Java Code Examples for com.sun.org.apache.xml.internal.resolver.CatalogManager#setIgnoreMissingProperties()

The following examples show how to use com.sun.org.apache.xml.internal.resolver.CatalogManager#setIgnoreMissingProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlUtil.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example 2
Source File: XmlUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example 3
Source File: XmlUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example 4
Source File: XmlUtil.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example 5
Source File: XmlUtil.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example 6
Source File: XmlUtil.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example 7
Source File: RawXJC2Mojo.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Creates an instance of catalog resolver.
 * 
 * @return Instance of the catalog resolver.
 * @throws MojoExecutionException
 *             If catalog resolver cannot be instantiated.
 */
protected CatalogResolver createCatalogResolver() throws MojoExecutionException {
	final CatalogManager catalogManager = new CatalogManager();
	catalogManager.setIgnoreMissingProperties(true);
	catalogManager.setUseStaticCatalog(false);
	// TODO Logging
	if (getLog().isDebugEnabled()) {
		catalogManager.setVerbosity(Integer.MAX_VALUE);
	}
	if (getCatalogResolver() == null) {
		return new MavenCatalogResolver(catalogManager, this, getLog());
	} else {
		final String catalogResolverClassName = getCatalogResolver().trim();
		return createCatalogResolverByClassName(catalogResolverClassName);
	}
}
 
Example 8
Source File: XmlUtil.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
 */
public static EntityResolver createDefaultCatalogResolver() {

    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    // parse the catalog
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Enumeration<URL> catalogEnum;
    Catalog catalog = manager.getCatalog();
    try {
        if (cl == null) {
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
        } else {
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
        }

        while(catalogEnum.hasMoreElements()) {
            URL url = catalogEnum.nextElement();
            catalog.parseCatalog(url);
        }
    } catch (IOException e) {
        throw new WebServiceException(e);
    }

    return workaroundCatalogResolver(catalog);
}
 
Example 9
Source File: XmlUtil.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  Default CatalogResolver implementation is broken as it depends on CatalogManager.getCatalog() which will always create a new one when
 *  useStaticCatalog is false.
 *  This returns a CatalogResolver that uses the catalog passed as parameter.
 * @param catalog
 * @return  CatalogResolver
 */
private static CatalogResolver workaroundCatalogResolver(final Catalog catalog) {
    // set up a manager
    CatalogManager manager = new CatalogManager() {
        @Override
        public Catalog getCatalog() {
            return catalog;
        }
    };
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);

    return new CatalogResolver(manager);
}
 
Example 10
Source File: XMLCatalogResolver.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialization. Create a CatalogManager and set all
 * the properties upfront. This prevents JVM wide system properties
 * or a property file somewhere in the environment from affecting
 * the behaviour of this catalog resolver.
 */
private void init (String [] catalogs, boolean preferPublic) {
    fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
    fPreferPublic = preferPublic;
    fResolverCatalogManager = new CatalogManager();
    fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
    fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
    fResolverCatalogManager.setCatalogFiles("");
    fResolverCatalogManager.setIgnoreMissingProperties(true);
    fResolverCatalogManager.setPreferPublic(fPreferPublic);
    fResolverCatalogManager.setRelativeCatalogs(false);
    fResolverCatalogManager.setUseStaticCatalog(false);
    fResolverCatalogManager.setVerbosity(0);
}
 
Example 11
Source File: XMLCatalogResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialization. Create a CatalogManager and set all
 * the properties upfront. This prevents JVM wide system properties
 * or a property file somewhere in the environment from affecting
 * the behaviour of this catalog resolver.
 */
private void init (String [] catalogs, boolean preferPublic) {
    fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
    fPreferPublic = preferPublic;
    fResolverCatalogManager = new CatalogManager();
    fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
    fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
    fResolverCatalogManager.setCatalogFiles("");
    fResolverCatalogManager.setIgnoreMissingProperties(true);
    fResolverCatalogManager.setPreferPublic(fPreferPublic);
    fResolverCatalogManager.setRelativeCatalogs(false);
    fResolverCatalogManager.setUseStaticCatalog(false);
    fResolverCatalogManager.setVerbosity(0);
}
 
Example 12
Source File: XmlUtil.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  Default CatalogResolver implementation is broken as it depends on CatalogManager.getCatalog() which will always create a new one when
 *  useStaticCatalog is false.
 *  This returns a CatalogResolver that uses the catalog passed as parameter.
 * @param catalog
 * @return  CatalogResolver
 */
private static CatalogResolver workaroundCatalogResolver(final Catalog catalog) {
    // set up a manager
    CatalogManager manager = new CatalogManager() {
        @Override
        public Catalog getCatalog() {
            return catalog;
        }
    };
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);

    return new CatalogResolver(manager);
}
 
Example 13
Source File: XmlUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
 */
public static EntityResolver createDefaultCatalogResolver() {

    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    // parse the catalog
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Enumeration<URL> catalogEnum;
    Catalog catalog = manager.getCatalog();
    try {
        if (cl == null) {
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
        } else {
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
        }

        while(catalogEnum.hasMoreElements()) {
            URL url = catalogEnum.nextElement();
            catalog.parseCatalog(url);
        }
    } catch (IOException e) {
        throw new WebServiceException(e);
    }

    return workaroundCatalogResolver(catalog);
}
 
Example 14
Source File: XmlUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  Default CatalogResolver implementation is broken as it depends on CatalogManager.getCatalog() which will always create a new one when
 *  useStaticCatalog is false.
 *  This returns a CatalogResolver that uses the catalog passed as parameter.
 * @param catalog
 * @return  CatalogResolver
 */
private static CatalogResolver workaroundCatalogResolver(final Catalog catalog) {
    // set up a manager
    CatalogManager manager = new CatalogManager() {
        @Override
        public Catalog getCatalog() {
            return catalog;
        }
    };
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);

    return new CatalogResolver(manager);
}
 
Example 15
Source File: XMLCatalogResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialization. Create a CatalogManager and set all
 * the properties upfront. This prevents JVM wide system properties
 * or a property file somewhere in the environment from affecting
 * the behaviour of this catalog resolver.
 */
private void init (String [] catalogs, boolean preferPublic) {
    fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
    fPreferPublic = preferPublic;
    fResolverCatalogManager = new CatalogManager();
    fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
    fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
    fResolverCatalogManager.setCatalogFiles("");
    fResolverCatalogManager.setIgnoreMissingProperties(true);
    fResolverCatalogManager.setPreferPublic(fPreferPublic);
    fResolverCatalogManager.setRelativeCatalogs(false);
    fResolverCatalogManager.setUseStaticCatalog(false);
    fResolverCatalogManager.setVerbosity(0);
}
 
Example 16
Source File: EntityResolverFactory.java    From java-9-wtf with Apache License 2.0 5 votes vote down vote up
private static EntityResolver withConfiguredSimpleCatalogManager() {
	// works on Java 9
	final CatalogManager catalogManager = new CatalogManager();
	catalogManager.setIgnoreMissingProperties(true);
	catalogManager.setUseStaticCatalog(false);
	return new CatalogResolver(catalogManager);
}
 
Example 17
Source File: XmlUtil.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
 */
public static EntityResolver createDefaultCatalogResolver() {

    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    // parse the catalog
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Enumeration<URL> catalogEnum;
    Catalog catalog = manager.getCatalog();
    try {
        if (cl == null) {
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
        } else {
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
        }

        while(catalogEnum.hasMoreElements()) {
            URL url = catalogEnum.nextElement();
            catalog.parseCatalog(url);
        }
    } catch (IOException e) {
        throw new WebServiceException(e);
    }

    return workaroundCatalogResolver(catalog);
}
 
Example 18
Source File: XmlUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
 */
public static EntityResolver createDefaultCatalogResolver() {

    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    // parse the catalog
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Enumeration<URL> catalogEnum;
    Catalog catalog = manager.getCatalog();
    try {
        if (cl == null) {
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
        } else {
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
        }

        while(catalogEnum.hasMoreElements()) {
            URL url = catalogEnum.nextElement();
            catalog.parseCatalog(url);
        }
    } catch (IOException e) {
        throw new WebServiceException(e);
    }

    return workaroundCatalogResolver(catalog);
}
 
Example 19
Source File: XMLCatalogResolver.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialization. Create a CatalogManager and set all
 * the properties upfront. This prevents JVM wide system properties
 * or a property file somewhere in the environment from affecting
 * the behaviour of this catalog resolver.
 */
private void init (String [] catalogs, boolean preferPublic) {
    fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
    fPreferPublic = preferPublic;
    fResolverCatalogManager = new CatalogManager();
    fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
    fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
    fResolverCatalogManager.setCatalogFiles("");
    fResolverCatalogManager.setIgnoreMissingProperties(true);
    fResolverCatalogManager.setPreferPublic(fPreferPublic);
    fResolverCatalogManager.setRelativeCatalogs(false);
    fResolverCatalogManager.setUseStaticCatalog(false);
    fResolverCatalogManager.setVerbosity(0);
}
 
Example 20
Source File: XmlUtil.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
 */
public static EntityResolver createDefaultCatalogResolver() {

    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    // parse the catalog
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Enumeration<URL> catalogEnum;
    Catalog catalog = manager.getCatalog();
    try {
        if (cl == null) {
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
        } else {
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
        }

        while(catalogEnum.hasMoreElements()) {
            URL url = catalogEnum.nextElement();
            catalog.parseCatalog(url);
        }
    } catch (IOException e) {
        throw new WebServiceException(e);
    }

    return workaroundCatalogResolver(catalog);
}