final String encFile = getEncodingsDefinitionFile();
final InputStream in = ObjectUtilities.getResourceAsStream
(encFile, EncodingComboBoxModel.class);
if (in == null)
{
final Messages messages = new Messages(locale, SwingCommonModule.BUNDLE_NAME,
ObjectUtilities.getClassLoader(SwingCommonModule.class));
logger.warn(messages.getString("EncodingComboBoxModel.WARN_ENCODING_FILE_NOT_FOUND", encFile)); //$NON-NLS-1$
}
else
{
try
{
// final Properties defaultEncodings = getDefaultEncodings();
final Properties encDef = new Properties();
final BufferedInputStream bin = new BufferedInputStream(in);
try
{
encDef.load(bin);
}
finally
{
bin.close();
}
final Enumeration en = encDef.keys();
while (en.hasMoreElements())
{
final String enc = (String) en.nextElement();
// if not set to "true"
if ("true".equalsIgnoreCase(encDef.getProperty(enc, "false"))) //$NON-NLS-1$ //$NON-NLS-2$
{
// if the encoding is disabled ...
ecb.addEncoding(enc, ecb.getEncodingDescription(enc));
}
}
}
catch (IOException e)
{
final Messages messages = new Messages(locale, SwingCommonModule.BUNDLE_NAME,
ObjectUtilities.getClassLoader(SwingCommonModule.class));
logger.warn(messages.getString("EncodingComboBoxModel.WARN_ERROR_READING_ENCODING_FILE") + encFile,
e); //$NON-NLS-1$
}
}
}
return ecb;