bundles/org.apache.jasper.glassfish/src/org/apache/jasper/xmlparser/ParserUtils.java
private static Schema getSchema(String schemaPublicId)
            throws SAXException {

        Schema schema = schemaCache.get(schemaPublicId);
        if (schema == null) {
            synchronized (schemaCache) {
                schema = schemaCache.get(schemaPublicId);
                if (schema == null) {
                    SchemaFactory schemaFactory = SchemaFactory.newInstance(
                        XMLConstants.W3C_XML_SCHEMA_NS_URI);
                    schemaFactory.setResourceResolver(
                        new MyLSResourceResolver());
                    schemaFactory.setErrorHandler(new MyErrorHandler());

                    String path = schemaPublicId;
                    if (schemaResourcePrefix != null) {
                        int index = schemaPublicId.lastIndexOf('/');
                        if (index != -1) {
                            path = schemaPublicId.substring(index+1);
                        }
                        path = schemaResourcePrefix + path;
                    }

                    InputStream input = null;
                    if (isSchemaResourcePrefixFileUrl) {
                        try {
                            File f = new File(new URI(path));
                            if (f.exists()) { 
                                input = new FileInputStream(f);
                            }
                        } catch (Exception e) {
                            throw new SAXException(e);
                        }
                    } else {
                        input = ParserUtils.class.getResourceAsStream(path);
                    }

                    if (input == null) {
		        throw new SAXException(
                            Localizer.getMessage(
                                "jsp.error.internal.filenotfound",
                                schemaPublicId));
                    }

                    schema = schemaFactory.newSchema(new StreamSource(input));
                    schemaCache.put(schemaPublicId, schema);
                }
            }
        }

        return schema;
    }
private static Schema getSchema(String schemaPublicId)
            throws SAXException {

        Schema schema = schemaCache.get(schemaPublicId);
        if (schema == null) {
            synchronized (schemaCache) {
                schema = schemaCache.get(schemaPublicId);
                if (schema == null) {
                    SchemaFactory schemaFactory = SchemaFactory.newInstance(
                        XMLConstants.W3C_XML_SCHEMA_NS_URI);
                    schemaFactory.setResourceResolver(
                        new MyLSResourceResolver());
                    schemaFactory.setErrorHandler(new MyErrorHandler());

                    String path = schemaPublicId;
                    if (schemaResourcePrefix != null) {
                        int index = schemaPublicId.lastIndexOf('/');
                        if (index != -1) {
                            path = schemaPublicId.substring(index+1);
                        }
                        path = schemaResourcePrefix + path;
                    }

                    InputStream input = null;
                    if (isSchemaResourcePrefixFileUrl) {
                        try {
                            File f = new File(new URI(path));
                            if (f.exists()) { 
                                input = new FileInputStream(f);
                            }
                        } catch (Exception e) {
                            throw new SAXException(e);
                        }
                    } else {
                        input = ParserUtils.class.getResourceAsStream(path);
                    }

                    if (input == null) {
		        throw new SAXException(
                            Localizer.getMessage(
                                "jsp.error.internal.filenotfound",
                                schemaPublicId));
                    }

                    schema = schemaFactory.newSchema(new StreamSource(input));
                    schemaCache.put(schemaPublicId, schema);
                }
            }
        }

        return schema;
    }
private static Schema getSchema ( String schemaPublicId ) throws SAXException { Schema schema = schemaCache . get ( schemaPublicId ) ; if ( schema == null ) { synchronized ( schemaCache ) { schema = schemaCache . get ( schemaPublicId ) ; if ( schema == null ) { SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; schemaFactory . setResourceResolver ( new MyLSResourceResolver ( ) ) ; schemaFactory . setErrorHandler ( new MyErrorHandler ( ) ) ; String path = schemaPublicId ; if ( schemaResourcePrefix != null ) { int index = schemaPublicId . lastIndexOf ( ' ' ) ; if ( index != - 1 ) { path = schemaPublicId . substring ( index + 1 ) ; } path = schemaResourcePrefix + path ; } InputStream input = null ; if ( isSchemaResourcePrefixFileUrl ) { try { File f = new File ( new URI ( path ) ) ; if ( f . exists ( ) ) { input = new FileInputStream ( f ) ; } } catch ( Exception e ) { throw new SAXException ( e ) ; } } else { input = ParserUtils . class . getResourceAsStream ( path ) ; } if ( input == null ) { throw new SAXException ( Localizer . getMessage ( "jsp.error.internal.filenotfound" , schemaPublicId ) ) ; } schema = schemaFactory . newSchema ( new StreamSource ( input ) ) ; schemaCache . put ( schemaPublicId , schema ) ; } } } return schema ; }
/*
Gets the compiled schema for the given schema public id.

@param schemaPublicId The public id for which to get the schema
(e.g., web-jsptaglibrary_2_0.xsd)

@return The compiled schema
/ * Gets the compiled schema for the given schema public id .