public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**
public static void initializeMessages(String bundleName, Class clazz) { // load the resource bundle and set the fields final Field[] fields = clazz.getDeclaredFields(); load(bundleName, clazz.getClassLoader(), fields); // iterate over the fields in the class to make sure that there aren't any empty ones final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC; final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL; final int numFields = fields.length; for (int i = 0; i < numFields; i++) { Field field = fields[i]; if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) continue; try { // Set the value into the field if its empty. We should never get an exception here because // we know we have a public static non-final field. If we do get an exception, silently // log it and continue. This means that the field will (most likely) be un-initialized and // will fail later in the code and if so then we will see both the NPE and this error. if (field.get(clazz) == null) { String value = "Missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$ field.set(null, value); } } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } /**