Compare commits

...

No commits in common. 'c8-stream-201801' and 'c9' have entirely different histories.

@ -1,165 +0,0 @@
From 8a9344f55d74a5b809051ae144b3c028499fec0d Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Sat, 27 Sep 2013 10:53:46 +0200
Subject: [PATCH] Don't use Werken XPath
---
src/java/org/apache/velocity/anakia/AnakiaElement.java | 7 +++++--
src/java/org/apache/velocity/anakia/NodeList.java | 6 ++++--
src/java/org/apache/velocity/anakia/XPathCache.java | 9 ++++++---
src/java/org/apache/velocity/anakia/XPathTool.java | 16 ++++++++++------
4 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/java/org/apache/velocity/anakia/AnakiaElement.java b/src/java/org/apache/velocity/anakia/AnakiaElement.java
index c72b653..df13153 100644
--- a/src/java/org/apache/velocity/anakia/AnakiaElement.java
+++ b/src/java/org/apache/velocity/anakia/AnakiaElement.java
@@ -20,8 +20,10 @@ package org.apache.velocity.anakia;
*/
import org.jdom.Element;
+import org.jdom.JDOMException;
import org.jdom.Namespace;
import org.jdom.output.XMLOutputter;
+
import java.util.List;
/**
@@ -126,10 +128,11 @@ public class AnakiaElement extends Element
* @param xpathExpression the XPath expression you wish to apply
* @return a NodeList representing the nodes that are the result of
* application of the XPath to the current element. It can be empty.
+ * @throws JDOMException
*/
- public NodeList selectNodes(String xpathExpression)
+ public NodeList selectNodes(String xpathExpression) throws JDOMException
{
- return new NodeList(XPathCache.getXPath(xpathExpression).applyTo(this), false);
+ return new NodeList(XPathCache.getXPath(xpathExpression).selectNodes(this), false);
}
/**
diff --git a/src/java/org/apache/velocity/anakia/NodeList.java b/src/java/org/apache/velocity/anakia/NodeList.java
index daf611d..b303bda 100644
--- a/src/java/org/apache/velocity/anakia/NodeList.java
+++ b/src/java/org/apache/velocity/anakia/NodeList.java
@@ -35,6 +35,7 @@ import org.jdom.DocType;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.EntityRef;
+import org.jdom.JDOMException;
import org.jdom.ProcessingInstruction;
import org.jdom.Text;
import org.jdom.output.XMLOutputter;
@@ -289,10 +290,11 @@ public class NodeList implements List, Cloneable
* @param xpathString the XPath expression you wish to apply
* @return a NodeList representing the nodes that are the result of
* application of the XPath to the current node list. It can be empty.
+ * @throws JDOMException
*/
- public NodeList selectNodes(String xpathString)
+ public NodeList selectNodes(String xpathString) throws JDOMException
{
- return new NodeList(XPathCache.getXPath(xpathString).applyTo(nodes), false);
+ return new NodeList(XPathCache.getXPath(xpathString).selectNodes(nodes), false);
}
// List methods implemented hereafter
diff --git a/src/java/org/apache/velocity/anakia/XPathCache.java b/src/java/org/apache/velocity/anakia/XPathCache.java
index cef43d9..0d633b0 100644
--- a/src/java/org/apache/velocity/anakia/XPathCache.java
+++ b/src/java/org/apache/velocity/anakia/XPathCache.java
@@ -19,7 +19,9 @@ package org.apache.velocity.anakia;
* under the License.
*/
-import com.werken.xpath.XPath;
+import org.jdom.JDOMException;
+import org.jdom.xpath.XPath;
+
import java.util.Map;
import java.util.WeakHashMap;
@@ -46,8 +48,9 @@ class XPathCache
* A cached object is returned if it already exists for the requested expression.
* @param xpathString the XPath expression to parse
* @return the XPath object that represents the parsed XPath expression.
+ * @throws JDOMException
*/
- static XPath getXPath(String xpathString)
+ static XPath getXPath(String xpathString) throws JDOMException
{
XPath xpath = null;
synchronized(XPATH_CACHE)
@@ -55,7 +58,7 @@ class XPathCache
xpath = (XPath)XPATH_CACHE.get(xpathString);
if(xpath == null)
{
- xpath = new XPath(xpathString);
+ xpath = XPath.newInstance(xpathString);
XPATH_CACHE.put(xpathString, xpath);
}
}
diff --git a/src/java/org/apache/velocity/anakia/XPathTool.java b/src/java/org/apache/velocity/anakia/XPathTool.java
index c9e6178..f85d2c1 100644
--- a/src/java/org/apache/velocity/anakia/XPathTool.java
+++ b/src/java/org/apache/velocity/anakia/XPathTool.java
@@ -23,6 +23,7 @@ import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
+import org.jdom.JDOMException;
/**
* This class adds an entrypoint into XPath functionality,
@@ -88,12 +89,13 @@ public class XPathTool
* @param doc The Document context
*
* @return A list of selected nodes
+ * @throws JDOMException
*/
public NodeList applyTo(String xpathSpec,
- Document doc)
+ Document doc) throws JDOMException
{
//RuntimeSingleton.info("XPathTool::applyTo(String, Document)");
- return new NodeList(XPathCache.getXPath(xpathSpec).applyTo( doc ), false);
+ return new NodeList(XPathCache.getXPath(xpathSpec).selectNodes( doc ), false);
}
/**
@@ -103,12 +105,13 @@ public class XPathTool
* @param elem The Element context
*
* @return A list of selected nodes
+ * @throws JDOMException
*/
public NodeList applyTo(String xpathSpec,
- Element elem)
+ Element elem) throws JDOMException
{
//RuntimeSingleton.info("XPathTool::applyTo(String, Element)");
- return new NodeList(XPathCache.getXPath(xpathSpec).applyTo( elem ), false);
+ return new NodeList(XPathCache.getXPath(xpathSpec).selectNodes( elem ), false);
}
/**
@@ -118,12 +121,13 @@ public class XPathTool
* @param nodeSet The nodeset context
*
* @return A list of selected nodes
+ * @throws JDOMException
*/
public NodeList applyTo(String xpathSpec,
- List nodeSet)
+ List nodeSet) throws JDOMException
{
//RuntimeSingleton.info("XPathTool::applyTo(String, List)");
- return new NodeList(XPathCache.getXPath(xpathSpec).applyTo( nodeSet ), false);
+ return new NodeList(XPathCache.getXPath(xpathSpec).selectNodes( nodeSet ), false);
}
}
--
1.8.3.1

@ -0,0 +1,464 @@
From bf0462e3c293863947dde1c22a62c3d4a187a70c Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Thu, 31 Oct 2019 14:35:40 +0100
Subject: [PATCH 1/2] Port to apache-commons-lang3
---
pom.xml | 6 +++---
.../velocity/app/event/implement/EscapeHtmlReference.java | 4 ++--
.../app/event/implement/EscapeJavaScriptReference.java | 4 ++--
.../velocity/app/event/implement/EscapeSqlReference.java | 5 +++--
.../velocity/app/event/implement/EscapeXmlReference.java | 2 +-
src/java/org/apache/velocity/runtime/RuntimeInstance.java | 2 +-
.../org/apache/velocity/runtime/VelocimacroFactory.java | 2 +-
src/java/org/apache/velocity/runtime/directive/Block.java | 2 +-
.../org/apache/velocity/runtime/directive/RuntimeMacro.java | 2 +-
src/java/org/apache/velocity/runtime/parser/Parser.java | 2 +-
.../apache/velocity/runtime/parser/ParserTokenManager.java | 2 +-
.../apache/velocity/runtime/parser/node/ASTDirective.java | 2 +-
.../org/apache/velocity/runtime/parser/node/ASTMethod.java | 4 ++--
.../velocity/runtime/parser/node/ASTStringLiteral.java | 2 +-
.../org/apache/velocity/runtime/parser/node/NodeUtils.java | 2 +-
.../velocity/runtime/parser/node/PropertyExecutor.java | 2 +-
.../velocity/runtime/parser/node/SetPropertyExecutor.java | 4 ++--
.../org/apache/velocity/runtime/parser/node/SimpleNode.java | 4 ++--
.../velocity/runtime/resource/ResourceManagerImpl.java | 4 ++--
.../runtime/resource/loader/ClasspathResourceLoader.java | 2 +-
.../runtime/resource/loader/DataSourceResourceLoader.java | 2 +-
.../runtime/resource/loader/FileResourceLoader.java | 2 +-
.../velocity/runtime/resource/loader/JarResourceLoader.java | 2 +-
.../runtime/resource/loader/StringResourceLoader.java | 2 +-
.../velocity/runtime/resource/loader/URLResourceLoader.java | 2 +-
.../org/apache/velocity/util/introspection/ClassMap.java | 2 +-
.../org/apache/velocity/io/UnicodeInputStreamTestCase.java | 2 +-
src/test/org/apache/velocity/test/BaseTestCase.java | 2 +-
.../org/apache/velocity/test/MethodCacheKeyTestCase.java | 2 +-
29 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/pom.xml b/pom.xml
index 77a8e383..eee15b34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,9 +148,9 @@
<version>3.2.1</version>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.9</version>
</dependency>
<dependency>
<groupId>oro</groupId>
diff --git a/src/java/org/apache/velocity/app/event/implement/EscapeHtmlReference.java b/src/java/org/apache/velocity/app/event/implement/EscapeHtmlReference.java
index 6d98b45c..e1469957 100644
--- a/src/java/org/apache/velocity/app/event/implement/EscapeHtmlReference.java
+++ b/src/java/org/apache/velocity/app/event/implement/EscapeHtmlReference.java
@@ -19,7 +19,7 @@ package org.apache.velocity.app.event.implement;
* under the License.
*/
-import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
/**
* Escape all HTML entities.
@@ -39,7 +39,7 @@ public class EscapeHtmlReference extends EscapeReference
*/
protected String escape(Object text)
{
- return StringEscapeUtils.escapeHtml(text.toString());
+ return StringEscapeUtils.escapeHtml4(text.toString());
}
/**
diff --git a/src/java/org/apache/velocity/app/event/implement/EscapeJavaScriptReference.java b/src/java/org/apache/velocity/app/event/implement/EscapeJavaScriptReference.java
index ea49ddbf..12f38f47 100644
--- a/src/java/org/apache/velocity/app/event/implement/EscapeJavaScriptReference.java
+++ b/src/java/org/apache/velocity/app/event/implement/EscapeJavaScriptReference.java
@@ -19,7 +19,7 @@ package org.apache.velocity.app.event.implement;
* under the License.
*/
-import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
/**
* Escapes the characters in a String to be suitable for use in JavaScript.
@@ -39,7 +39,7 @@ public class EscapeJavaScriptReference extends EscapeReference
*/
protected String escape(Object text)
{
- return StringEscapeUtils.escapeJavaScript(text.toString());
+ return StringEscapeUtils.escapeEcmaScript(text.toString());
}
/**
diff --git a/src/java/org/apache/velocity/app/event/implement/EscapeSqlReference.java b/src/java/org/apache/velocity/app/event/implement/EscapeSqlReference.java
index 585cb6c6..39e04f43 100644
--- a/src/java/org/apache/velocity/app/event/implement/EscapeSqlReference.java
+++ b/src/java/org/apache/velocity/app/event/implement/EscapeSqlReference.java
@@ -19,7 +19,7 @@ package org.apache.velocity.app.event.implement;
* under the License.
*/
-import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* Escapes the characters in a String to be suitable to pass to an SQL query.
@@ -39,7 +39,8 @@ public class EscapeSqlReference extends EscapeReference
*/
protected String escape(Object text)
{
- return StringEscapeUtils.escapeSql(text.toString());
+ // See https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringEscapeUtils.html#escapeSql(java.lang.String)
+ return StringUtils.replace(text.toString(), "'", "''");
}
/**
diff --git a/src/java/org/apache/velocity/app/event/implement/EscapeXmlReference.java b/src/java/org/apache/velocity/app/event/implement/EscapeXmlReference.java
index 3d5b40f0..fbb525cb 100644
--- a/src/java/org/apache/velocity/app/event/implement/EscapeXmlReference.java
+++ b/src/java/org/apache/velocity/app/event/implement/EscapeXmlReference.java
@@ -19,7 +19,7 @@ package org.apache.velocity.app.event.implement;
* under the License.
*/
-import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
/**
* Escape all XML entities.
diff --git a/src/java/org/apache/velocity/runtime/RuntimeInstance.java b/src/java/org/apache/velocity/runtime/RuntimeInstance.java
index 670c083d..f877114d 100644
--- a/src/java/org/apache/velocity/runtime/RuntimeInstance.java
+++ b/src/java/org/apache/velocity/runtime/RuntimeInstance.java
@@ -32,7 +32,7 @@ import java.util.Map;
import java.util.Properties;
import org.apache.commons.collections.ExtendedProperties;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.Template;
import org.apache.velocity.app.event.EventCartridge;
import org.apache.velocity.app.event.EventHandler;
diff --git a/src/java/org/apache/velocity/runtime/VelocimacroFactory.java b/src/java/org/apache/velocity/runtime/VelocimacroFactory.java
index 8756b66f..70e3d489 100644
--- a/src/java/org/apache/velocity/runtime/VelocimacroFactory.java
+++ b/src/java/org/apache/velocity/runtime/VelocimacroFactory.java
@@ -26,7 +26,7 @@ import java.util.Map;
import java.util.Vector;
import java.util.ArrayList;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.Template;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.directive.Directive;
diff --git a/src/java/org/apache/velocity/runtime/directive/Block.java b/src/java/org/apache/velocity/runtime/directive/Block.java
index f5fdfa85..b136543d 100755
--- a/src/java/org/apache/velocity/runtime/directive/Block.java
+++ b/src/java/org/apache/velocity/runtime/directive/Block.java
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.TemplateInitException;
import org.apache.velocity.runtime.Renderable;
diff --git a/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java b/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
index 090b5522..d22ac4ed 100644
--- a/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
+++ b/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.io.Writer;
import java.util.List;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
diff --git a/src/java/org/apache/velocity/runtime/parser/Parser.java b/src/java/org/apache/velocity/runtime/parser/Parser.java
index 1253381f..b8e7112e 100644
--- a/src/java/org/apache/velocity/runtime/parser/Parser.java
+++ b/src/java/org/apache/velocity/runtime/parser/Parser.java
@@ -10,7 +10,7 @@ import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.directive.Macro;
import org.apache.velocity.runtime.directive.MacroParseException;
import org.apache.velocity.util.StringUtils;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.runtime.RuntimeConstants;
/**
diff --git a/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java b/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
index ce00d99d..9563a1fb 100644
--- a/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
+++ b/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
@@ -9,7 +9,7 @@ import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.directive.Macro;
import org.apache.velocity.runtime.directive.MacroParseException;
import org.apache.velocity.util.StringUtils;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.runtime.RuntimeConstants;
/** Token Manager. */
diff --git a/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java b/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
index 74727729..8fc59737 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
@@ -22,7 +22,7 @@ package org.apache.velocity.runtime.parser.node;
import java.io.IOException;
import java.io.Writer;
-import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
diff --git a/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java b/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
index 489429bb..df54dd93 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
@@ -21,8 +21,8 @@ package org.apache.velocity.runtime.parser.node;
import java.lang.reflect.InvocationTargetException;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.app.event.EventHandlerUtil;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
diff --git a/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java b/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
index 2267993c..82cca27a 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.TemplateInitException;
import org.apache.velocity.exception.VelocityException;
diff --git a/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java b/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java
index 713a86ae..0ac03fbc 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java
@@ -19,7 +19,7 @@ package org.apache.velocity.runtime.parser.node;
* under the License.
*/
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.runtime.parser.ParserConstants;
diff --git a/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java b/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java
index 8c78228e..20d6c185 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java
@@ -21,7 +21,7 @@ package org.apache.velocity.runtime.parser.node;
import java.lang.reflect.InvocationTargetException;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeLogger;
import org.apache.velocity.runtime.log.Log;
diff --git a/src/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java b/src/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java
index 0078d023..80887fad 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java
@@ -21,8 +21,8 @@ package org.apache.velocity.runtime.parser.node;
import java.lang.reflect.InvocationTargetException;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.util.introspection.Introspector;
diff --git a/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java b/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
index 108846f8..6372830f 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
@@ -22,8 +22,8 @@ package org.apache.velocity.runtime.parser.node;
import java.io.IOException;
import java.io.Writer;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
diff --git a/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java b/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
index 778b42a9..a396e42f 100644
--- a/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
+++ b/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
@@ -158,7 +158,7 @@ public class ResourceManagerImpl
Object cacheObject = null;
- if (org.apache.commons.lang.StringUtils.isNotEmpty(cacheClassName))
+ if (org.apache.commons.lang3.StringUtils.isNotEmpty(cacheClassName))
{
try
{
@@ -534,7 +534,7 @@ public class ResourceManagerImpl
* this strikes me as bad...
*/
- if (!org.apache.commons.lang.StringUtils.equals(resource.getEncoding(), encoding))
+ if (!org.apache.commons.lang3.StringUtils.equals(resource.getEncoding(), encoding))
{
log.warn("Declared encoding for template '" +
resource.getName() +
diff --git a/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java b/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
index 52d09a98..bf48aa45 100644
--- a/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
+++ b/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
@@ -22,7 +22,7 @@ package org.apache.velocity.runtime.resource.loader;
import java.io.InputStream;
import org.apache.commons.collections.ExtendedProperties;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ClassUtils;
diff --git a/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java b/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
index f85b6d62..38ec30dc 100644
--- a/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
+++ b/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
@@ -218,7 +218,7 @@ public class DataSourceResourceLoader extends ResourceLoader
public synchronized InputStream getResourceStream(final String name)
throws ResourceNotFoundException
{
- if (org.apache.commons.lang.StringUtils.isEmpty(name))
+ if (org.apache.commons.lang3.StringUtils.isEmpty(name))
{
throw new ResourceNotFoundException("DataSourceResourceLoader: Template name was empty or null");
}
diff --git a/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java b/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
index 923274a7..8580caeb 100644
--- a/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
+++ b/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
@@ -118,7 +118,7 @@ public class FileResourceLoader extends ResourceLoader
/*
* Make sure we have a valid templateName.
*/
- if (org.apache.commons.lang.StringUtils.isEmpty(templateName))
+ if (org.apache.commons.lang3.StringUtils.isEmpty(templateName))
{
/*
* If we don't get a properly formed templateName then
diff --git a/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java b/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
index 054d890e..71d6c083 100644
--- a/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
+++ b/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
@@ -195,7 +195,7 @@ public class JarResourceLoader extends ResourceLoader
{
InputStream results = null;
- if (org.apache.commons.lang.StringUtils.isEmpty(source))
+ if (org.apache.commons.lang3.StringUtils.isEmpty(source))
{
throw new ResourceNotFoundException("Need to have a resource!");
}
diff --git a/src/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java b/src/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
index 245c10b8..86a08b9d 100644
--- a/src/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
+++ b/src/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
@@ -26,7 +26,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import org.apache.commons.collections.ExtendedProperties;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.resource.Resource;
diff --git a/src/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java b/src/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
index de066367..74ab86a6 100644
--- a/src/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
+++ b/src/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
@@ -26,7 +26,7 @@ import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import org.apache.commons.collections.ExtendedProperties;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.resource.Resource;
diff --git a/src/java/org/apache/velocity/util/introspection/ClassMap.java b/src/java/org/apache/velocity/util/introspection/ClassMap.java
index 00512892..2e128b7e 100644
--- a/src/java/org/apache/velocity/util/introspection/ClassMap.java
+++ b/src/java/org/apache/velocity/util/introspection/ClassMap.java
@@ -23,7 +23,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.lang.text.StrBuilder;
+import org.apache.commons.lang3.text.StrBuilder;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.util.MapFactory;
diff --git a/src/test/org/apache/velocity/io/UnicodeInputStreamTestCase.java b/src/test/org/apache/velocity/io/UnicodeInputStreamTestCase.java
index 02499985..4b0b254f 100644
--- a/src/test/org/apache/velocity/io/UnicodeInputStreamTestCase.java
+++ b/src/test/org/apache/velocity/io/UnicodeInputStreamTestCase.java
@@ -27,7 +27,7 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang3.ArrayUtils;
/**
diff --git a/src/test/org/apache/velocity/test/BaseTestCase.java b/src/test/org/apache/velocity/test/BaseTestCase.java
index 0ea00cbd..798a322b 100644
--- a/src/test/org/apache/velocity/test/BaseTestCase.java
+++ b/src/test/org/apache/velocity/test/BaseTestCase.java
@@ -353,7 +353,7 @@ public abstract class BaseTestCase extends TestCase implements TemplateTestBase
buf.append(baseFile.getPath());
}
- if (org.apache.commons.lang.StringUtils.isNotEmpty(ext))
+ if (org.apache.commons.lang3.StringUtils.isNotEmpty(ext))
{
buf.append('.').append(ext);
}
diff --git a/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java b/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java
index 77dfc54e..4befc6ef 100644
--- a/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java
+++ b/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java
@@ -21,7 +21,7 @@ package org.apache.velocity.test;
import junit.framework.TestCase;
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.velocity.runtime.parser.node.ASTMethod;
/**
--
2.25.4

@ -1,62 +0,0 @@
From 1d2f89cb3e954b943751fa8dd587fdb404eb9338 Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
Date: Mon, 21 Feb 2011 15:53:34 +0100
Subject: [PATCH 1/3] Remove avalon-logkit
we don't have it packaged so change defaults and remove it from pom.xml
---
pom.xml | 6 ------
.../velocity/runtime/defaults/velocity.properties | 4 ++--
.../apache/velocity/runtime/log/LogManager.java | 2 +-
3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index 77a8e38..f453208 100644
--- a/pom.xml
+++ b/pom.xml
@@ -197,12 +197,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>logkit</groupId>
- <artifactId>logkit</artifactId>
- <version>2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6</version>
diff --git a/src/java/org/apache/velocity/runtime/defaults/velocity.properties b/src/java/org/apache/velocity/runtime/defaults/velocity.properties
index 750a59a..7fac119 100644
--- a/src/java/org/apache/velocity/runtime/defaults/velocity.properties
+++ b/src/java/org/apache/velocity/runtime/defaults/velocity.properties
@@ -20,10 +20,10 @@
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
-# default LogChute to use: default: AvalonLogChute, Log4JLogChute, CommonsLogLogChute, ServletLogChute, JdkLogChute
+# default LogChute to use: default: Log4JLogChute, CommonsLogLogChute, ServletLogChute, JdkLogChute
# ----------------------------------------------------------------------------
-runtime.log.logsystem.class = org.apache.velocity.runtime.log.AvalonLogChute,org.apache.velocity.runtime.log.Log4JLogChute,org.apache.velocity.runtime.log.CommonsLogLogChute,org.apache.velocity.runtime.log.ServletLogChute,org.apache.velocity.runtime.log.JdkLogChute
+runtime.log.logsystem.class = org.apache.velocity.runtime.log.Log4JLogChute,org.apache.velocity.runtime.log.CommonsLogLogChute,org.apache.velocity.runtime.log.ServletLogChute,org.apache.velocity.runtime.log.JdkLogChute
# ---------------------------------------------------------------------------
# This is the location of the Velocity Runtime log.
diff --git a/src/java/org/apache/velocity/runtime/log/LogManager.java b/src/java/org/apache/velocity/runtime/log/LogManager.java
index 19d1016..97dceef 100644
--- a/src/java/org/apache/velocity/runtime/log/LogManager.java
+++ b/src/java/org/apache/velocity/runtime/log/LogManager.java
@@ -119,7 +119,7 @@ public class LogManager
* classes, and we use the first one we find.
*
* Note that the default value of this property contains the
- * AvalonLogChute, the Log4JLogChute, CommonsLogLogChute,
+ * Log4JLogChute, CommonsLogLogChute,
* ServletLogChute, and the JdkLogChute for
* convenience - so we use whichever we works first.
*/
--
1.7.4

@ -0,0 +1,25 @@
From b2eee6ccc6ef24e084567a0a38d21fa3765df6ad Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 15 May 2020 09:56:26 +0200
Subject: [PATCH 2/2] Force use of JDK log chute
---
.../org/apache/velocity/runtime/defaults/velocity.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/java/org/apache/velocity/runtime/defaults/velocity.properties b/src/java/org/apache/velocity/runtime/defaults/velocity.properties
index 750a59af..855118b9 100644
--- a/src/java/org/apache/velocity/runtime/defaults/velocity.properties
+++ b/src/java/org/apache/velocity/runtime/defaults/velocity.properties
@@ -23,7 +23,7 @@
# default LogChute to use: default: AvalonLogChute, Log4JLogChute, CommonsLogLogChute, ServletLogChute, JdkLogChute
# ----------------------------------------------------------------------------
-runtime.log.logsystem.class = org.apache.velocity.runtime.log.AvalonLogChute,org.apache.velocity.runtime.log.Log4JLogChute,org.apache.velocity.runtime.log.CommonsLogLogChute,org.apache.velocity.runtime.log.ServletLogChute,org.apache.velocity.runtime.log.JdkLogChute
+runtime.log.logsystem.class = org.apache.velocity.runtime.log.JdkLogChute
# ---------------------------------------------------------------------------
# This is the location of the Velocity Runtime log.
--
2.25.4

@ -0,0 +1,77 @@
From 3be84770e7fbe6f000f0c002905e86fe1412d551 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Thu, 11 Mar 2021 16:22:50 +0100
Subject: [PATCH] CVE-2020-13936
From upstream patches:
https://github.com/apache/velocity-engine/commit/1ba60771d23dae7e6b3138ae6bee09cf6f9d2485
https://github.com/apache/velocity-engine/commit/15909056fe51f5d39d49e101d706d3075876dde4
https://github.com/apache/velocity-engine/commit/3f5d477bb4f4397bed2d2926c35dcef7de3aae3e
---
.../velocity/runtime/defaults/velocity.properties | 15 ++++++++++-----
.../introspection/SecureIntrospectorImpl.java | 9 +++++++++
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/java/org/apache/velocity/runtime/defaults/velocity.properties b/src/java/org/apache/velocity/runtime/defaults/velocity.properties
index 855118b..a8a9231 100644
--- a/src/java/org/apache/velocity/runtime/defaults/velocity.properties
+++ b/src/java/org/apache/velocity/runtime/defaults/velocity.properties
@@ -245,15 +245,16 @@ runtime.introspector.uberspect = org.apache.velocity.util.introspection.Uberspec
# accessed.
# ----------------------------------------------------------------------------
+# Prohibit reflection
introspector.restrict.packages = java.lang.reflect
# The two most dangerous classes
+# ClassLoader, Thread, and subclasses disabled by default in SecureIntrospectorImpl
-introspector.restrict.classes = java.lang.Class
-introspector.restrict.classes = java.lang.ClassLoader
-
-# Restrict these for extra safety
+# Restrict these system classes. Note that anything in this list is matched exactly.
+# (Subclasses must be explicitly named to be included).
+introspector.restrict.classes = java.lang.Class
introspector.restrict.classes = java.lang.Compiler
introspector.restrict.classes = java.lang.InheritableThreadLocal
introspector.restrict.classes = java.lang.Package
@@ -262,8 +263,12 @@ introspector.restrict.classes = java.lang.Runtime
introspector.restrict.classes = java.lang.RuntimePermission
introspector.restrict.classes = java.lang.SecurityManager
introspector.restrict.classes = java.lang.System
-introspector.restrict.classes = java.lang.Thread
introspector.restrict.classes = java.lang.ThreadGroup
introspector.restrict.classes = java.lang.ThreadLocal
+# Restrict instance managers for common servlet containers (Tomcat, JBoss, Jetty)
+introspector.restrict.classes = org.apache.catalina.core.DefaultInstanceManager
+introspector.restrict.classes = org.apache.tomcat.SimpleInstanceManager
+introspector.restrict.classes = org.wildfly.extension.undertow.deployment.UndertowJSPInstanceManager
+introspector.restrict.classes = org.eclipse.jetty.util.DecoratedObjectFactory
diff --git a/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java b/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
index f317b1c..25fc84d 100644
--- a/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
+++ b/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
@@ -121,6 +121,15 @@ public class SecureIntrospectorImpl extends Introspector implements SecureIntros
return true;
}
+ /**
+ * Always disallow ClassLoader, Thread and subclasses
+ */
+ if (ClassLoader.class.isAssignableFrom(clazz) ||
+ Thread.class.isAssignableFrom(clazz))
+ {
+ return false;
+ }
+
/**
* check the classname (minus any array info)
* whether it matches disallowed classes or packages
--
2.29.2

@ -1,197 +0,0 @@
From 813085c72e9906a53bec5954bcce7305a7c320d1 Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
Date: Mon, 21 Feb 2011 17:58:39 +0100
Subject: [PATCH 3/3] Use system jars
---
build/build.xml | 56 +++++++++++----------------------------------------
build/testcases.xml | 6 -----
2 files changed, 12 insertions(+), 50 deletions(-)
diff --git a/build/build.xml b/build/build.xml
index c667553..479ef2d 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -140,28 +140,6 @@
<!-- =================================================================== -->
<!-- sets up the build environment (classpath and libs) -->
<!-- =================================================================== -->
- <target name="build-prepare">
- <ant antfile="${velocity.build.dir}/download.xml" target="build-download" />
-
- <!-- Build classpath -->
- <path id="velocity.build.classpath">
- <fileset dir="${build.lib}">
- <include name="**/*.jar"/>
- </fileset>
- </path>
-
- <!-- Test classpath, contains dependencies needed only for Testing -->
- <path id="velocity.test.classpath">
- <fileset dir="${build.test.lib}">
- <include name="**/*.jar"/>
- </fileset>
- </path>
-
- <path id="velocity.run.classpath">
- <path refid="velocity.build.classpath"/>
- <pathelement location="${build.dir}/${final.name}.jar"/>
- </path>
- </target>
<!-- =================================================================== -->
<!-- checks for the existence/non-existence of various java features -->
@@ -174,12 +152,11 @@
<target name="prepare-jdbc" depends="check-jdbc,check-jdbc-true,check-jdbc-false"/>
<target name="prepare-jdk14" depends="check-jdk14,check-jdk14-true,check-jdk14-false"/>
- <target name="check-jdbc" depends="build-prepare">
+ <target name="check-jdbc">
<!-- note: check to see if required class is available. -->
<!-- might be j2ee.jar, jdbc2_0-stdext.jar, or simply JDK 1.4+ -->
<available classname="javax.sql.DataSource"
property="jdbc.present">
- <classpath refid="velocity.build.classpath"/>
</available>
</target>
@@ -210,10 +187,9 @@
</echo>
</target>
- <target name="check-jdk14" depends="build-prepare">
+ <target name="check-jdk14">
<available classname="java.util.logging.Logger"
property="jdk14.present">
- <classpath refid="velocity.build.classpath"/>
</available>
</target>
@@ -248,7 +224,7 @@
<!-- =================================================================== -->
<target name="compile" depends="compile-src,compile-test"/>
- <target name="compile-src" depends="prepare,build-prepare,check-jdbc,check-jdk14"
+ <target name="compile-src" depends="prepare,check-jdbc,check-jdk14"
description="Compiles the Velocity source">
<javac srcdir="${build.src}"
destdir="${build.dest}"
@@ -257,8 +233,7 @@
target="${javac.target}"
source="${javac.source}"
deprecation="${deprecation}"
- optimize="${optimize}"
- classpathref="velocity.build.classpath"/>
+ optimize="${optimize}"/>
<copy todir="${build.dest}" filtering="yes">
<fileset dir="${src.java.dir}">
@@ -268,7 +243,7 @@
</target>
- <target name="compile-test" depends="prepare,build-prepare,compile-src"
+ <target name="compile-test" depends="prepare,compile-src"
description="Compiles the Velocity test classes">
<javac srcdir="${build.test.src}"
destdir="${build.test.dest}"
@@ -279,8 +254,6 @@
<!-- Don't use the run classpath, build using the exploded class tree -->
<classpath>
- <path refid="velocity.build.classpath"/>
- <path refid="velocity.test.classpath" />
<pathelement location="${build.dest}"/>
</classpath>
</javac>
@@ -561,7 +534,7 @@
<!-- =================================================================== -->
<!-- Compiles the example code -->
<!-- =================================================================== -->
- <target name="examples" depends="build-prepare,jar"
+ <target name="examples"
description="Compiles the Velocity Example code">
<echo>
@@ -585,8 +558,7 @@
encoding="UTF-8"
debug="${debug}"
deprecation="${deprecation}"
- optimize="${optimize}"
- classpathref="velocity.run.classpath"/>
+ optimize="${optimize}"/>
</target>
<target name="examples-clean" depends="examples-clean-anakia">
@@ -604,7 +576,7 @@
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
- <target name="javadocs" depends="prepare,build-prepare"
+ <target name="javadocs" depends="prepare"
description="Creates the Javadoc API documentation">
<mkdir dir="${build.javadoc}"/>
@@ -620,8 +592,7 @@
doctitle="${name} ${version} API"
encoding="UTF-8"
docencoding="UTF-8"
- bottom="Copyright &#169; 2000-${build.year} &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache Software Foundation&lt;/a&gt;. All Rights Reserved."
- classpathref="velocity.build.classpath">
+ bottom="Copyright &#169; 2000-${build.year} &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache Software Foundation&lt;/a&gt;. All Rights Reserved.">
<link href="${javadocs.ref.jsdk}"/>
<link href="http://www.jdom.org/docs/apidocs"/>
@@ -1024,12 +995,11 @@
<!-- Make HTML version of Velocity documentation -->
<!-- =================================================================== -->
- <target name="docs" depends="build-prepare,jar"
+ <target name="docs" depends="jar"
description="Generates the Velocity HTML documentation">
<taskdef name="anakia"
- classname="org.apache.velocity.anakia.AnakiaTask"
- classpathref="velocity.run.classpath"/>
+ classname="org.apache.velocity.anakia.AnakiaTask"/>
<echo>
#######################################################
@@ -1231,7 +1201,7 @@
<!-- =================================================================== -->
<!-- JUnit Tests for Velocity -->
<!-- =================================================================== -->
- <target name="test-main" depends="build-prepare,compile-test"
+ <target name="test-main" depends="compile-test"
description="Run the Velocity testcases">
<!-- Require ant 1.7+ for Junit compatibility -->
@@ -1264,8 +1234,6 @@
<!-- Don't use the run classpath, test using the exploded class tree -->
<classpath>
- <path refid="velocity.build.classpath" />
- <path refid="velocity.test.classpath" />
<pathelement path="${build.dest}"/>
<pathelement path="${build.test.dest}"/>
</classpath>
diff --git a/build/testcases.xml b/build/testcases.xml
index 06bb36e..f3749bc 100644
--- a/build/testcases.xml
+++ b/build/testcases.xml
@@ -36,12 +36,6 @@
<!-- Build classpath -->
<path id="velocity.test.classpath">
- <fileset dir="${build.lib}">
- <include name="**/*.jar"/>
- </fileset>
- <fileset dir="${build.test.lib}">
- <include name="**/*.jar"/>
- </fileset>
<pathelement location="${build.dest}"/>
<pathelement location="${build.test.dest}"/>
</path>
--
1.7.4

@ -1,19 +0,0 @@
--- a/src/test/org/apache/velocity/test/sql/HsqlDataSource.java 2012-02-15 19:49:20.202936454 -0500
+++ b/src/test/org/apache/velocity/test/sql/HsqlDataSource.java 2012-02-15 19:52:35.062574871 -0500
@@ -23,6 +23,7 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
import javax.sql.DataSource;
@@ -73,5 +74,8 @@
public Object unwrap(final Class iface) throws SQLException {
throw new SQLException("Not implemented");
}
+ public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException {
+ throw new SQLFeatureNotSupportedException("getParentLogger() not supported");
+ }
}

@ -1,25 +0,0 @@
From cec42bf7ae8b4b72850c3cdea74a07603f11786f Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Wed, 18 Jun 2014 07:25:12 +0200
Subject: [PATCH 4/4] Use log4j 1.2.17
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index e35d72d..c8d48fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -187,7 +187,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.12</version>
+ <version>1.2.17</version>
<scope>provided</scope>
</dependency>
<dependency>
--
1.9.3

@ -1,26 +0,0 @@
From 6060e6ef497bddc4a9aeac343e584ff324746d58 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Wed, 18 Jun 2014 08:11:48 +0200
Subject: [PATCH 6/6] Skip Java 8 incompatible test
---
src/test/org/apache/velocity/test/issues/VelTools66TestCase.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java b/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java
index 00bb0b1..6fb7260 100644
--- a/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java
+++ b/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java
@@ -87,7 +87,8 @@ public class VelTools66TestCase
Method testMethod = introspector.getMethod(TestObject.class, "getTestValue", new Object[0]);
assertNotNull(testMethod);
- assertEquals("Method object does not match!", verifyMethod, testMethod);
+ // Java 8 incompatibility
+ // assertEquals("Method object does not match!", verifyMethod, testMethod);
}
public static interface TestInterface
--
1.9.3

@ -9,13 +9,13 @@ wget "http://www.apache.org/dist/${name}/engine/${version}/${name}-${version}.ta
rm -rf tarball-tmp
mkdir tarball-tmp
cd tarball-tmp
pushd tarball-tmp
tar xf "../${name}-${version}.orig.tar.gz"
# CLEAN TARBALL
rm -r */*.jar
rm -r */lib
tar cf "../${name}-${version}.tar.gz" *
cd ..
tar -czf "../${name}-${version}.tar.gz" *
popd
rm -r tarball-tmp "${name}-${version}.orig.tar.gz"

@ -1,11 +0,0 @@
diff -Nru velocity-1.7/build/build.xml velocity-1.7.doclint/build/build.xml
--- velocity-1.7/build/build.xml 2015-07-22 12:13:51.566920750 +0200
+++ velocity-1.7.doclint/build/build.xml 2015-07-22 12:13:14.929703544 +0200
@@ -592,6 +592,7 @@
doctitle="${name} ${version} API"
encoding="UTF-8"
docencoding="UTF-8"
+ additionalparam="-Xdoclint:none"
bottom="Copyright &#169; 2000-${build.year} &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache Software Foundation&lt;/a&gt;. All Rights Reserved.">
<link href="${javadocs.ref.jsdk}"/>

@ -1,43 +0,0 @@
diff -Nru velocity-1.7/build/build.properties velocity-1.7.osgi/build/build.properties
--- velocity-1.7/build/build.properties 2010-11-19 21:16:21.000000000 +0100
+++ velocity-1.7.osgi/build/build.properties 2015-07-22 12:21:19.627117810 +0200
@@ -166,8 +166,7 @@
########################################################################
# OSGi stuff
-import=com.werken.xpath;resolution:=optional,\
- javax.naming,\
+import=javax.naming,\
javax.servlet;resolution:=optional,\
javax.servlet.http;resolution:=optional,\
javax.sql,\
@@ -188,8 +187,7 @@
org.jdom.input;resolution:=optional,\
org.jdom.output;resolution:=optional,\
org.xml.sax
-dep.import=com.werken.xpath;resolution:=optional,\
- javax.naming,\
+dep.import=javax.naming,\
javax.servlet;resolution:=optional,\
javax.servlet.http;resolution:=optional,\
javax.sql,\
@@ -207,8 +205,7 @@
export=org.apache.velocity;uses:="org.apache.velocity.context,\
org.apache.velocity.exception,\
org.apache.velocity.runtime.resource",\
- org.apache.velocity.anakia;uses:="com.werken.xpath,\
- org.apache.tools.ant,\
+ org.apache.velocity.anakia;uses:="org.apache.tools.ant,\
org.apache.tools.ant.taskdefs,\
org.jdom,\
org.jdom.output",\
@@ -327,8 +324,7 @@
org.apache.velocity;uses:="org.apache.velocity.context,\
org.apache.velocity.exception,\
org.apache.velocity.runtime.resource",\
- org.apache.velocity.anakia;uses:="com.werken.xpath,\
- org.apache.tools.ant,\
+ org.apache.velocity.anakia;uses:="org.apache.tools.ant,\
org.apache.tools.ant.taskdefs,\
org.jdom,\
org.jdom.output",\

@ -1,9 +1,8 @@
%bcond_without hsqldb
%bcond_with bootstrap
Name: velocity
Version: 1.7
Release: 24%{?dist}
Epoch: 0
Release: 38%{?dist}
Summary: Java-based template engine
License: ASL 2.0
URL: http://velocity.apache.org/
@ -15,36 +14,18 @@ Source1: http://repo1.maven.org/maven2/org/apache/%{name}/%{name}/%{versi
# Remove bundled binaries which cannot be easily verified for licensing
Source2: generate-tarball.sh
Patch0: 0001-Remove-avalon-logkit.patch
Patch1: 0004-Use-log4j-1.2.17.patch
Patch2: 0003-Use-system-jars.patch
Patch3: 0004-JDBC-41-compat.patch
Patch4: 0001-Don-t-use-Werken-XPath.patch
Patch5: 0006-Skip-Java-8-incompatible-test.patch
Patch6: velocity-1.7-doclint.patch
Patch7: velocity-1.7-osgi.patch
BuildRequires: javapackages-local
BuildRequires: ant
BuildRequires: antlr
BuildRequires: junit
BuildRequires: ant-junit
%if %{with hsqldb}
BuildRequires: hsqldb-lib
Patch1: 0001-Port-to-apache-commons-lang3.patch
Patch2: 0002-Force-use-of-JDK-log-chute.patch
Patch3: 0003-CVE-2020-13936.patch
BuildRequires: maven-local
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: mvn(commons-collections:commons-collections)
BuildRequires: mvn(org.apache.commons:commons-lang3)
BuildRequires: mvn(org.apache:apache:pom:)
%endif
BuildRequires: apache-commons-collections
BuildRequires: apache-commons-logging
BuildRequires: apache-commons-lang
BuildRequires: glassfish-servlet-api
BuildRequires: jakarta-oro
BuildRequires: jaxen
BuildRequires: jdom
BuildRequires: bcel
BuildRequires: log4j12
BuildRequires: apache-parent
# It fails one of the arithmetic test cases with gcj
BuildRequires: java-devel >= 1:1.6.0
%description
Velocity is a Java-based template engine. It permits anyone to use the
@ -67,134 +48,108 @@ template services for the Turbine web application framework.
Velocity+Turbine provides a template service that will allow web
applications to be developed according to a true MVC model.
%package manual
Summary: Manual for %{name}
%description manual
Documentation for %{name}.
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
Javadoc for %{name}.
%package demo
Summary: Demo for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description demo
Demonstrations and samples for %{name}.
# -----------------------------------------------------------------------------
%prep
%setup -q
cp %{SOURCE1} ./pom.xml
%patch1 -p1
%patch2 -p1
%patch3 -p1
# remove bundled libs/classes (except those used for testing)
find . -name '*.jar' ! -name 'test*.jar' -print -delete
find . -name '*.class' ! -name 'Foo.class' -print -delete
# Remove dependency on avalon-logkit
rm -f src/java/org/apache/velocity/runtime/log/AvalonLogChute.java
rm -f src/java/org/apache/velocity/runtime/log/AvalonLogSystem.java
rm -f src/java/org/apache/velocity/runtime/log/VelocityFormatter.java
# Disable unneeded features
rm -r src/java/org/apache/velocity/{anakia,texen,servlet,convert}
rm src/java/org/apache/velocity/runtime/log/{Avalon,Log4J}Log{Chute,System}.java
rm src/java/org/apache/velocity/runtime/log/{CommonsLog,Servlet}LogChute.java
rm src/java/org/apache/velocity/runtime/log/SimpleLog4JLogSystem.java
rm src/java/org/apache/velocity/runtime/log/VelocityFormatter.java
rm src/java/org/apache/velocity/app/event/implement/Escape{Html,JavaScript,Sql,Xml,}Reference.java
%pom_remove_dep :oro
%pom_remove_dep :jdom
%pom_remove_dep :commons-logging
%pom_remove_dep :log4j
%pom_remove_dep :servlet-api
%pom_remove_dep :logkit
%pom_remove_dep :ant
%pom_remove_dep :werken-xpath
# need porting to new servlet API. We would just add a lot of empty functions
rm src/test/org/apache/velocity/test/VelocityServletTestCase.java
%mvn_alias : %{name}:%{name}
# This test doesn't work with new hsqldb
rm src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java
%build
%mvn_build -f
cp %{SOURCE1} ./pom.xml
%install
%mvn_install
# remove rest of avalon logkit refences
%patch0 -p1
%files -f .mfiles
%doc README.txt
%license LICENSE NOTICE
# Use log4j 1.2.17
%patch1 -p1
%files javadoc -f .mfiles-javadoc
%license LICENSE NOTICE
# Use system jar files instead of downloading from net
%patch2 -p1
%changelog
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.7-38
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
%patch3 -p1
* Wed Jun 09 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.7-37
- Rebuild to workaround DistroBaker issue
# Use jdom instead of werken-xpath
%patch4 -p1
%pom_remove_dep werken-xpath:
* Tue Jun 08 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.7-36
- Bootstrap Maven for CentOS Stream 9
# Skip Java 8 incompatible test
%patch5 -p1
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.7-35
- Bootstrap build
- Non-bootstrap build
# Disable Java8 doclint
%patch6 -p1
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.7-34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
# Remove werken-xpath Import/Export refences in OSGi manifest file
%patch7 -p1
* Fri Sep 11 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.7-33
- Default to JDK logging and drop commons-logging and log4j12 implementations.
%if %{without hsqldb}
rm -r src/test/org/apache/velocity/test/sql
%endif
* Thu Jul 30 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.7-32
- Port to commons-lang3.
# -----------------------------------------------------------------------------
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.7-31
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
%build
* Tue Jul 14 2020 Jiri Vanek <jvanek@redhat.com> - 0:1.7-30
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
export CLASSPATH=$(build-classpath \
antlr \
apache-commons-collections \
commons-lang \
commons-logging \
glassfish-servlet-api \
junit \
jakarta-oro \
log4j:log4j:1.2.17 \
jaxen \
jdom \
bcel \
hsqldb \
junit)
ant \
-buildfile build/build.xml \
-Dbuild.sysclasspath=first \
-Djavac.target=1.6 \
-Djavac.source=1.6 \
jar javadocs test
# fix line-endings in generated files
sed -i 's/\r//' docs/api/stylesheet.css docs/api/package-list
# -----------------------------------------------------------------------------
* Mon Jul 13 2020 Mat Booth <mat.booth@redhat.com> - 0:1.7-29
- Ignore test case that fails on Java 11
%install
%mvn_file : %{name}
%mvn_alias : %{name}:%{name}
%mvn_artifact pom.xml bin/%{name}-%{version}.jar
%mvn_install -J docs/api
* Sat Jul 11 2020 Jiri Vanek <jvanek@redhat.com> - 0:1.7-28
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
# zero-length file
rm -r test/issues/velocity-537/compare/velocity537.vm.cmp
# data
install -d -m 755 %{buildroot}%{_datadir}/%{name}
cp -pr examples test %{buildroot}%{_datadir}/%{name}
* Fri May 15 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.7-27
- Build with Maven
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.7-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
%files -f .mfiles
%doc README.txt
%license LICENSE NOTICE
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.7-26
- Mass rebuild for javapackages-tools 201902
%files manual
%license LICENSE NOTICE
%doc docs/*
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.7-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
%files javadoc -f .mfiles-javadoc
%license LICENSE NOTICE
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.7-25
- Mass rebuild for javapackages-tools 201901
%files demo
%license LICENSE NOTICE
%{_datadir}/%{name}
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.7-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
%changelog
* Tue Jul 31 2018 Michael Simacek <msimacek@redhat.com> - 0:1.7-24
- Repack the tarball without binaries

Loading…
Cancel
Save