8131907: Numerous threads lock during XML processing while running Weblogic 12.1.3

Reviewed-by: rriggs, dfuchs, lancea
This commit is contained in:
Joe Wang 2015-07-22 10:55:39 -07:00
parent 37836b1f3d
commit 793dc7b0d2

View file

@ -1,13 +1,13 @@
/* /*
* reserved comment block * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER!
*/ */
/* /*
* Copyright 2001, 2002,2004 The Apache Software Foundation. * Licensed to the Apache Software Foundation (ASF) under one or more
* * contributor license agreements. See the NOTICE file distributed with
* Licensed under the Apache License, Version 2.0 (the "License"); * this work for additional information regarding copyright ownership.
* you may not use this file except in compliance with the License. * The ASF licenses this file to You under the Apache License, Version 2.0
* You may obtain a copy of the License at * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -20,8 +20,10 @@
package com.sun.org.apache.xerces.internal.impl.dv; package com.sun.org.apache.xerces.internal.impl.dv;
import java.util.Hashtable; import com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl;
import com.sun.org.apache.xerces.internal.impl.dv.dtd.XML11DTDDVFactoryImpl;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
import java.util.Hashtable;
/** /**
* The factory to create and return DTD types. The implementation should * The factory to create and return DTD types. The implementation should
@ -35,7 +37,11 @@ import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
*/ */
public abstract class DTDDVFactory { public abstract class DTDDVFactory {
private static final String DEFAULT_FACTORY_CLASS = "com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl"; private static final String DEFAULT_FACTORY_CLASS =
"com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl";
private static final String XML11_DATATYPE_VALIDATOR_FACTORY =
"com.sun.org.apache.xerces.internal.impl.dv.dtd.XML11DTDDVFactoryImpl";
/** /**
* Get an instance of the default DTDDVFactory implementation. * Get an instance of the default DTDDVFactory implementation.
@ -58,10 +64,16 @@ public abstract class DTDDVFactory {
*/ */
public static final DTDDVFactory getInstance(String factoryClass) throws DVFactoryException { public static final DTDDVFactory getInstance(String factoryClass) throws DVFactoryException {
try { try {
// if the class name is not specified, use the default one if (DEFAULT_FACTORY_CLASS.equals(factoryClass)) {
return new DTDDVFactoryImpl();
} else if (XML11_DATATYPE_VALIDATOR_FACTORY.equals(factoryClass)) {
return new XML11DTDDVFactoryImpl();
} else {
//fall back for compatibility
return (DTDDVFactory) return (DTDDVFactory)
(ObjectFactory.newInstance(factoryClass, true)); (ObjectFactory.newInstance(factoryClass, true));
} }
}
catch (ClassCastException e) { catch (ClassCastException e) {
throw new DVFactoryException("DTD factory class " + factoryClass + " does not extend from DTDDVFactory."); throw new DVFactoryException("DTD factory class " + factoryClass + " does not extend from DTDDVFactory.");
} }