-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Maybe (!!!) fixes race condition in GlassFish. Since this change the TCK jstl/spec/xml/xmlcore/types passed several times without failing. However, I am still not convinced, because the failure wasn't well reproducible and also the cause wasn't clearly visible. - XPathUtil doesn't set system properties any more (see XPathUtil). - DocumentBuilderFactory should not be used as a constant, it is not thread-safe. Despite in this case I doubt it could cause issue, I cannot be sure. - Deleted unused methods - JSTLNodeList moved to own file - Deleted copy pasted javadocs from old versions - More should be done, but let's start with this. Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
- Loading branch information
Showing
6 changed files
with
518 additions
and
810 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/DocumentBuilderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package org.apache.taglibs.standard.tag.common.xml; | ||
|
||
import javax.xml.parsers.DocumentBuilder; | ||
import javax.xml.parsers.DocumentBuilderFactory; | ||
import javax.xml.parsers.ParserConfigurationException; | ||
|
||
/** | ||
* @author David Matejcek | ||
*/ | ||
public class DocumentBuilderProvider { | ||
|
||
/** | ||
* Creates a namespace-aware {@link DocumentBuilder} with disabled validation. | ||
* <p> | ||
* Note that {@link DocumentBuilder} instances are not thread-safe and their implementation can | ||
* be chosen as described in {@link DocumentBuilderFactory} documentation. | ||
* | ||
* @return new {@link DocumentBuilder} instance. | ||
*/ | ||
static DocumentBuilder createDocumentBuilder() { | ||
try { | ||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | ||
dbf.setNamespaceAware(true); | ||
dbf.setValidating(false); | ||
return dbf.newDocumentBuilder(); | ||
} catch (ParserConfigurationException e) { | ||
// this should never happen with a well-behaving JAXP implementation. | ||
throw new Error(e); | ||
} | ||
} | ||
} |
Oops, something went wrong.