From 4aa150b2e5fa5b48b488f4f4409602954a7e0215 Mon Sep 17 00:00:00 2001
From: kubycsolutions
Date: Mon, 27 Nov 2023 13:43:57 -0500
Subject: [PATCH] Reconcile/rebase
---
.../TransformThread/TransformThread.java | 2 +-
.../samples/Validate/ValidateXMLInput.java | 2 +-
.../sql/extConnection/ExternalConnection.java | 115 +++++++++---------
.../extensions/sql/runExtConnection.sh | 2 +-
.../xalan/samples/extensions/sql/runXalan.sh | 2 +-
.../apache/xalan/samples/servlet/default.xsl | 4 +-
.../xalan/samples/servlet/jspSample.jsp | 2 +-
stylebook/sources/xalan/history.xml | 6 +-
stylebook/sources/xalan/xsltc_usage.xml | 2 +-
.../xalan/templates/ElemExsltFuncResult.java | 2 +-
.../xalan/transformer/TransformerImpl.java | 4 +-
.../org/apache/xalan/xsltc/trax/DOM2SAX.java | 2 +-
.../xalan/xsltc/trax/TemplatesImpl.java | 4 +-
.../apache/xml/utils/XMLReaderManager.java | 9 +-
14 files changed, 82 insertions(+), 76 deletions(-)
diff --git a/samples/src/main/java/org/apache/xalan/samples/TransformThread/TransformThread.java b/samples/src/main/java/org/apache/xalan/samples/TransformThread/TransformThread.java
index e65e0ebf3..d27f5e49e 100644
--- a/samples/src/main/java/org/apache/xalan/samples/TransformThread/TransformThread.java
+++ b/samples/src/main/java/org/apache/xalan/samples/TransformThread/TransformThread.java
@@ -139,7 +139,7 @@ public TransformThread(int thrdNum)
StreamSource xslSource = new StreamSource(xslSourceFileName);
xslSource.setSystemId(xslSourceURI);
- // Initialize the tranformer
+ // Initialize the transformer
m_transformer =
TransformerFactory.newInstance().newTransformer(xslSource);
m_thread = new Thread(this);
diff --git a/samples/src/main/java/org/apache/xalan/samples/Validate/ValidateXMLInput.java b/samples/src/main/java/org/apache/xalan/samples/Validate/ValidateXMLInput.java
index 1ea39bf9f..6f0ad2621 100644
--- a/samples/src/main/java/org/apache/xalan/samples/Validate/ValidateXMLInput.java
+++ b/samples/src/main/java/org/apache/xalan/samples/Validate/ValidateXMLInput.java
@@ -88,7 +88,7 @@ void validate()
}
catch (TransformerException te)
{
- // The TransformerException wraps someting other than a SAXParseException
+ // The TransformerException wraps something other than a SAXParseException
// warning or error, either of which should be "caught" by the Handler.
System.out.println("Not a SAXParseException warning or error: " + te.getMessage());
}
diff --git a/samples/src/main/java/org/apache/xalan/samples/extensions/sql/extConnection/ExternalConnection.java b/samples/src/main/java/org/apache/xalan/samples/extensions/sql/extConnection/ExternalConnection.java
index 1115da147..b27e57cf9 100644
--- a/samples/src/main/java/org/apache/xalan/samples/extensions/sql/extConnection/ExternalConnection.java
+++ b/samples/src/main/java/org/apache/xalan/samples/extensions/sql/extConnection/ExternalConnection.java
@@ -44,64 +44,65 @@
*/
public class ExternalConnection
{
- public static void main(String[] args)
+ public static void main(String[] args)
throws TransformerException, TransformerConfigurationException,
- FileNotFoundException, IOException
+ FileNotFoundException, IOException
{
-
- // Create a connection to the database server
- // Up the connection pool count for testing
- DefaultConnectionPool cp = new DefaultConnectionPool();
- cp.setDriver("org.apache.derby.jdbc.EmbeddedDriver");
- cp.setURL("jdbc:derby:sampleDB");
- //cp.setUser("sa");
- //cp.setPassword("");
- cp.setMinConnections(10);
- cp.setPoolEnabled(true);
-
- // Now let's register our connection pool so we can use
- // in a stylesheet
- ConnectionPoolManager pm = new ConnectionPoolManager();
- pm.registerPool("extpool", cp);
-
-
- // Use the static TransformerFactory.newInstance() method to instantiate
- // a TransformerFactory. The javax.xml.transform.TransformerFactory
- // system property setting determines the actual class to instantiate --
- // org.apache.xalan.transformer.TransformerImpl.
- TransformerFactory tFactory = TransformerFactory.newInstance();
-
- // Grab the Name of the Stylesheet from the commad line
- if (args.length == 0)
- {
- System.out.println("You must provide the path and name to a stylesheet to process");
- System.exit(0);
- }
-
- String stylesheet = args[0];
- System.out.println("Transforming Stylesheet " + stylesheet);
-
- // Use the TransformerFactory to instantiate a Transformer that will work with
- // the stylesheet you specify. This method call also processes the stylesheet
- // into a compiled Templates object.
- Transformer transformer = tFactory.newTransformer(
- new StreamSource(stylesheet));
-
- // For this transformation, all the required information is in the stylesheet, so generate
- // a minimal XML source document for the input.
- // Note: the command-line processor (org.apache.xalan.xslt.Process) uses this strategy when
- // the user does not provide an -IN parameter.
- StringReader reader =
- new StringReader(" ");
-
- // Use the Transformer to apply the associated Templates object to an XML document
- // and write the output to a file.
- transformer.transform(
- new StreamSource(reader),
- new StreamResult(new FileOutputStream("dbtest-out.html")));
-
- System.out.println("************* The result is in dbtest-out.html *************");
-
- cp.setPoolEnabled(false);
+
+ // Create a connection to the database server
+ // Up the connection pool count for testing
+ DefaultConnectionPool cp = new DefaultConnectionPool();
+ cp.setDriver("org.apache.derby.jdbc.EmbeddedDriver");
+ cp.setURL("jdbc:derby:sampleDB");
+ //cp.setUser("sa");
+ //cp.setPassword("");
+ cp.setMinConnections(10);
+ cp.setPoolEnabled(true);
+
+ // Now let's register our connection pool so we can use
+ // in a stylesheet
+ ConnectionPoolManager pm = new ConnectionPoolManager();
+ pm.registerPool("extpool", cp);
+
+
+ // Use the static TransformerFactory.newInstance() method to instantiate
+ // a TransformerFactory. The javax.xml.transform.TransformerFactory
+ // system property setting determines the actual class to instantiate --
+ // org.apache.xalan.transformer.TransformerImpl.
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+
+ // Grab the Name of the Stylesheet from the command line
+ if (args.length == 0)
+ {
+ System.out.println("You must provide the path and name to a stylesheet to process");
+ System.exit(0);
+ }
+
+ String stylesheet = args[0];
+ System.out.println("Transforming Stylesheet " + stylesheet);
+
+ // Use the TransformerFactory to instantiate a Transformer that will work with
+ // the stylesheet you specify. This method call also processes the stylesheet
+ // into a compiled Templates object.
+ Transformer transformer = tFactory.newTransformer(
+ new StreamSource(stylesheet));
+
+ // For this transformation, all the required information is in the
+ // stylesheet, so generate a minimal XML source document for the
+ // input. Note: the command-line processor
+ // (org.apache.xalan.xslt.Process) uses this strategy when the user
+ // does not provide an -IN parameter.
+ StringReader reader =
+ new StringReader(" ");
+
+ // Use the Transformer to apply the associated Templates object to
+ // an XML document and write the output to a file.
+ transformer.transform(
+ new StreamSource(reader),
+ new StreamResult(new FileOutputStream("dbtest-out.html")));
+
+ System.out.println("************* The result is in dbtest-out.html *************");
+
+ cp.setPoolEnabled(false);
}
}
diff --git a/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runExtConnection.sh b/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runExtConnection.sh
index 71d37a0eb..90facec8c 100644
--- a/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runExtConnection.sh
+++ b/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runExtConnection.sh
@@ -30,7 +30,7 @@ fi
#argument when running under JDK 1.4 this should also work for JDK 1.5
#The XML Apis are going to be either in the LIB dir for a source
-#release or in the root direcctory for a binary release.
+#release or in the root directory for a binary release.
if [ -f ../../../build/xalan.jar ] ; then
diff --git a/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runXalan.sh b/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runXalan.sh
index 529c059bd..1ded8f467 100644
--- a/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runXalan.sh
+++ b/samples/src/main/java/org/apache/xalan/samples/extensions/sql/runXalan.sh
@@ -30,7 +30,7 @@ fi
#argument when running under JDK 1.4 this should also work for JDK 1.5
#The XML Apis are going to be either in the LIB dir for a source
-#release or in the root direcctory for a binary release.
+#release or in the root directory for a binary release.
if [ -f ../../../build/xalan.jar ] ; then
diff --git a/samples/src/main/java/org/apache/xalan/samples/servlet/default.xsl b/samples/src/main/java/org/apache/xalan/samples/servlet/default.xsl
index 6511033ea..9a45c4b96 100644
--- a/samples/src/main/java/org/apache/xalan/samples/servlet/default.xsl
+++ b/samples/src/main/java/org/apache/xalan/samples/servlet/default.xsl
@@ -178,7 +178,7 @@
}
e = e.parentElement;
- // call the correct funtion to change the collapse/expand state and display
+ // call the correct function to change the collapse/expand state and display
if (e.className == "e")
ch(e);
if (e.className == "k")
@@ -291,4 +291,4 @@
-
\ No newline at end of file
+
diff --git a/samples/src/main/java/org/apache/xalan/samples/servlet/jspSample.jsp b/samples/src/main/java/org/apache/xalan/samples/servlet/jspSample.jsp
index 998a710d7..c33fc433e 100644
--- a/samples/src/main/java/org/apache/xalan/samples/servlet/jspSample.jsp
+++ b/samples/src/main/java/org/apache/xalan/samples/servlet/jspSample.jsp
@@ -12,7 +12,7 @@
* This JSP uses PMA to set param1 in the
* foo.xsl stylesheet before using the
* stylesheet to transform foo.xml
- * and outputing the result.
+ * and outputting the result.
*
* Invoke the jsp from the appropriate
* context for your servlet/jsp server.
diff --git a/stylebook/sources/xalan/history.xml b/stylebook/sources/xalan/history.xml
index 7c8f79a15..cdcfa2beb 100644
--- a/stylebook/sources/xalan/history.xml
+++ b/stylebook/sources/xalan/history.xml
@@ -3286,7 +3286,7 @@ are unlikely to be equal. Saving them in a plain Vector has a
lower cost than saving them in DTMStringPool. Only prefixed QNames
are saved in DTMStringPool after this change.
-Need to make changes in a few interfaces to accommadate this change.
+Need to make changes in a few interfaces to accommodate this change.
[Committed by ]mkwan@apache.org[ on ]2003/03/13
[Modified: ] xml-xalan/java/src/org/apache/xml/utils FastStringBuffer.java
[Committer's log entry: ]
XSLTC_DTM performance work
Small improvement in FastStringBuffer.sendSAXCharacters() when the whole
@@ -4798,7 +4798,7 @@ alternatives.
[Committed by ]jkesselm@apache.org[
transforms so that when the transformer is reused, we were using nodesets from
the previous transform which were using a different DTM. Note that we want keep
any variables that have been set externally by the user (using
-Transformer.setParameter()).]
[Committed by ]mmidy@apache.org[ on ]01/28/2002
[Modified: ]java/src/org/apache/xpath/res XPATHErrorResources.java
[Committer's log entry: ]bug 4762: Fixed the duplicate error message in XPATH.
[Committed by ]jkesselm@apache.org[ on ]01/28/2002
[Modified: ]java/src/org/apache/xalan/transformer TransformerImpl.java
[Committer's log entry: ]Bugzilla 4054: Retain previously set output properties when adding new ones.
[Committed by ]mmidy@apache.org[ on ]01/28/2002
[Modified: ]java/src/org/apache/xalan/transformer TransformerImpl.java
[Committer's log entry: ]Bug 5872. We were using a constructor of TranformerException without the
+Transformer.setParameter()).
[Committed by ]mmidy@apache.org[ on ]01/28/2002
[Modified: ]java/src/org/apache/xpath/res XPATHErrorResources.java
[Committer's log entry: ]bug 4762: Fixed the duplicate error message in XPATH.
[Committed by ]jkesselm@apache.org[ on ]01/28/2002
[Modified: ]java/src/org/apache/xalan/transformer TransformerImpl.java
[Committer's log entry: ]Bugzilla 4054: Retain previously set output properties when adding new ones.
[Committed by ]mmidy@apache.org[ on ]01/28/2002
[Modified: ]java/src/org/apache/xalan/transformer TransformerImpl.java
[Committer's log entry: ]Bug 5872. We were using a constructor of TransformerException without the
locator information. Changed to code to use a locator if info is available.
[Committed by ]dleslie@apache.org[ on ]01/30/2002
[Modified: ]java/src/org/apache/xalan/lib NodeInfo.java
[Committer's log entry: ]Changed "system id" to "public identifier" in javadoc
comments for publicId() methods.
[Committed by ]jkesselm@apache.org[ on ]01/30/2002
[Modified: ]java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java
[Committer's log entry: ]Bugzilla 2617, part 1: Construct the data structures and access them
correctly.
@@ -6512,7 +6512,7 @@ Frame slot was available. Unfortunately, this also indicated that the item was
passed as a parameter which it wasn't. This fix changes isParamVar into to
fields, isAvailable which indicates that the slot is available and
isFromWithParam indicating the Frame slot came from an xsl:with-param or a
-top-level parameter passed in via the tranformerImpl.setParameter() API.
+top-level parameter passed in via the transformerImpl.setParameter() API.
I have tested this change against the conformance suite and had no
regression. I've also submitted a test case which fails on the existing
codebase but works okay after this fix.
diff --git a/stylebook/sources/xalan/xsltc_usage.xml b/stylebook/sources/xalan/xsltc_usage.xml
index fc4aa81b3..607a3268a 100644
--- a/stylebook/sources/xalan/xsltc_usage.xml
+++ b/stylebook/sources/xalan/xsltc_usage.xml
@@ -392,7 +392,7 @@ parser.
Perform the transformation, using a StreamSource object for the XML
input and a StreamResult object to hold the transformation output.
-Both a Templates
object and a Tranformer
object are
+
Both a Templates
object and a Transformer
object are
processed representations of a stylesheet, but you cannot use a
Templates
object to perform transformations. Instead,
you can use a Templates
object to create new
diff --git a/xalan/src/main/java/org/apache/xalan/templates/ElemExsltFuncResult.java b/xalan/src/main/java/org/apache/xalan/templates/ElemExsltFuncResult.java
index 13c7a4d0a..09af15db8 100644
--- a/xalan/src/main/java/org/apache/xalan/templates/ElemExsltFuncResult.java
+++ b/xalan/src/main/java/org/apache/xalan/templates/ElemExsltFuncResult.java
@@ -34,7 +34,7 @@ public class ElemExsltFuncResult extends ElemVariable
static final long serialVersionUID = -3478311949388304563L;
/*
* To keep the binary compatibility put those three private global
- * variables back, although they are never used in this verison
+ * variables back, although they are never used in this version
*/
// A flag indicating whether the return result is set
private boolean m_isResultSet = false;
diff --git a/xalan/src/main/java/org/apache/xalan/transformer/TransformerImpl.java b/xalan/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
index bd9baaf71..62241afcc 100644
--- a/xalan/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
+++ b/xalan/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
@@ -356,7 +356,7 @@ public class TransformerImpl extends Transformer
*/
private boolean m_isTransformDone = false;
- /** Flag to to tell if the tranformer needs to be reset. */
+ /** Flag to tell if the transformer needs to be reset. */
private boolean m_hasBeenReset = false;
/** NEEDSDOC Field m_shouldReset */
@@ -2262,7 +2262,7 @@ public boolean applyTemplateToNode(ElemTemplateElement xslInstruction, // xsl:a
// since much (most? all?) of the processing has been inlined.
// (It would be nice if there was a single entry point that
// worked for both... but the interpretive system works by
- // having the Tranformer execute the children, while the
+ // having the Transformer execute the children, while the
// compiled obviously has to run its own code. It's
// also unclear that "execute" is really the right name for
// that entry point.)
diff --git a/xalan/src/main/java/org/apache/xalan/xsltc/trax/DOM2SAX.java b/xalan/src/main/java/org/apache/xalan/xsltc/trax/DOM2SAX.java
index 3e0159807..a8988ca42 100644
--- a/xalan/src/main/java/org/apache/xalan/xsltc/trax/DOM2SAX.java
+++ b/xalan/src/main/java/org/apache/xalan/xsltc/trax/DOM2SAX.java
@@ -146,7 +146,7 @@ private static String getLocalName(Node node) {
}
public void parse(InputSource unused) throws IOException, SAXException {
- parse(_dom);
+ parse();
}
public void parse() throws IOException, SAXException {
diff --git a/xalan/src/main/java/org/apache/xalan/xsltc/trax/TemplatesImpl.java b/xalan/src/main/java/org/apache/xalan/xsltc/trax/TemplatesImpl.java
index 76df1ce70..481328ad2 100644
--- a/xalan/src/main/java/org/apache/xalan/xsltc/trax/TemplatesImpl.java
+++ b/xalan/src/main/java/org/apache/xalan/xsltc/trax/TemplatesImpl.java
@@ -169,7 +169,7 @@ public TemplatesImpl() { }
/**
* Overrides the default readObject implementation since we decided
- * it would be cleaner not to serialize the entire tranformer
+ * it would be cleaner not to serialize the entire transformer
* factory. [ ref bugzilla 12317 ]
* We need to check if the user defined class for URIResolver also
* implemented Serializable
@@ -407,4 +407,4 @@ public DOM getStylesheetDOM() {
public void setStylesheetDOM(DOM sdom) {
_sdom.set(sdom);
}
-}
\ No newline at end of file
+}
diff --git a/xalan/src/main/java/org/apache/xml/utils/XMLReaderManager.java b/xalan/src/main/java/org/apache/xml/utils/XMLReaderManager.java
index d05c91b76..df9ceb365 100644
--- a/xalan/src/main/java/org/apache/xml/utils/XMLReaderManager.java
+++ b/xalan/src/main/java/org/apache/xml/utils/XMLReaderManager.java
@@ -147,15 +147,20 @@ public synchronized XMLReader getXMLReader() throws SAXException {
/**
* Mark the cached XMLReader as available. If the reader was not
- * actually in the cache, do nothing.
+ * for this thread, mark it as no longer being in use.
*
* @param reader The XMLReader that's being released.
*/
public synchronized void releaseXMLReader(XMLReader reader) {
+ if(reader == null) {
+ return;
+ }
// If the reader that's being released is the cached reader
// for this thread, remove it from the m_isUse list.
if (m_readers.get() == reader && reader != null) {
- m_inUse.remove(reader);
+ m_readers.set(null)
+ m_inUse.put(reader, Boolean.FALSE);
}
+ m.inUse.remove(reader);
}
}