} catch (Exception except) { throw new RuntimeException( XMLMessages.createXMLMessage( XMLErrorResources.ER_RESOURCE_COULD_NOT_LOAD, new Object[] { entitiesResource, except.toString(), entitiesResource, except.toString()})); } finally { if (is != null) { try { is.close(); } catch (Exception except) { } } } }
} else {
    public CharInfo(String entitiesResource)    {        InputStream is = null;        BufferedReader reader = null;        int index;        String name;        String value;        int code;        String line;        try        {            try            {                // Maintenance note: we should evaluate replacing getting the                 //  ClassLoader with javax.xml.transform.FactoryFinder.findClassLoader()                //  or similar code                ClassLoader cl = CharInfo.class.getClassLoader();                if (cl == null)                {                    is =                        ClassLoader.getSystemResourceAsStream(entitiesResource);                }                else                {                    is = cl.getResourceAsStream(entitiesResource);                }            }            catch (Exception e)            {            }            if (is == null)                is = CharInfo.class.getResourceAsStream(entitiesResource);            if (is == null)            {                URL url = new URL(entitiesResource);                is = url.openStream();            }            if (is == null)                throw new RuntimeException(                    XMLMessages.createXMLMessage(                        XMLErrorResources.ER_RESOURCE_COULD_NOT_FIND,                        new Object[] { entitiesResource, entitiesResource }));            // Fix Bugzilla#4000: force reading in UTF-8            //  This creates the de facto standard that Xalan's resource             //  files must be encoded in UTF-8. This should work in all JVMs.            //            // %REVIEW% KNOWN ISSUE: IT FAILS IN MICROSOFT VJ++, which            // didn't implement the UTF-8 encoding. Theoretically, we should            // simply let it fail in that case, since the JVM is obviously            // broken if it doesn't support such a basic standard.  But            // since there are still some users attempting to use VJ++ for            // development, we have dropped in a fallback which makes a            // second attempt using the platform's default encoding. In VJ++            // this is apparently ASCII, which is subset of UTF-8... and            // since the strings we'll be reading here are also primarily            // limited to the 7-bit ASCII range (at least, in English            // versions of Xalan), this should work well enough to keep us            // on the air until we're ready to officially decommit from            // VJ++.            try            {                reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));            }            catch (java.io.UnsupportedEncodingException e)            {                reader = new BufferedReader(new InputStreamReader(is));            }            line = reader.readLine();            while (line != null)            {                if (line.length() == 0 || line.charAt(0) == '#')                {                    line = reader.readLine();                    continue;                }                index = line.indexOf(' ');                if (index > 1)                {                    name = line.substring(0, index);                    ++index;                    if (index < line.length())                    {                        value = line.substring(index);                        index = value.indexOf(' ');                        if (index > 0)                            value = value.substring(0, index);                        code = Integer.parseInt(value);                        defineEntity(name, (char) code);                    }                }                line = reader.readLine();            }            is.close();            m_specialsMap.set(S_LINEFEED);            m_specialsMap.set(S_CARRIAGERETURN);        }        catch (Exception except)        {            throw new RuntimeException(                XMLMessages.createXMLMessage(                    XMLErrorResources.ER_RESOURCE_COULD_NOT_LOAD,                    new Object[] {                        entitiesResource,                        except.toString(),                        entitiesResource,                        except.toString()}));        }        finally        {            if (is != null)            {                try                {                    is.close();                }                catch (Exception except)                {                }            }        }    }