Upgrade to 2.12.2 for fix CVE-2022-23437
(cherry picked from commit 542c96f6c67c119b05c5c7553603e46b1525bca7)
This commit is contained in:
parent
f184e1a3bf
commit
65eb8162ed
1115
CVE-2012-0881.patch
1115
CVE-2012-0881.patch
File diff suppressed because it is too large
Load Diff
@ -1,212 +0,0 @@
|
||||
From f890ce20b623f2bea736d096229677c8b99556ad Mon Sep 17 00:00:00 2001
|
||||
From: Michael Glavassevich <mrglavas@apache.org>
|
||||
Date: Wed, 16 Mar 2011 15:57:02 +0000
|
||||
Subject: [PATCH] JIRA Issue #1499:
|
||||
http://issues.apache.org/jira/browse/XERCESJ-1499. Reducing the initial
|
||||
footprint of SymbolHash buckets within a SchemaGrammar from 1,515 to 177
|
||||
(about 12% of the default size). Implemented a rehash() method on SymbolHash
|
||||
to grow the maps if they actually become filled.
|
||||
|
||||
git-svn-id: https://svn.apache.org/repos/asf/xerces/java/trunk@1082175 13f79535-47bb-0310-9956-ffa450edef68
|
||||
---
|
||||
.../apache/xerces/impl/xs/SchemaGrammar.java | 44 ++++++++-------
|
||||
.../xerces/impl/xs/traversers/XSDHandler.java | 14 ++---
|
||||
src/org/apache/xerces/util/SymbolHash.java | 55 +++++++++++++++++--
|
||||
3 files changed, 81 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/org/apache/xerces/impl/xs/SchemaGrammar.java b/src/org/apache/xerces/impl/xs/SchemaGrammar.java
|
||||
index e522e9770..a4d5ca675 100644
|
||||
--- a/src/org/apache/xerces/impl/xs/SchemaGrammar.java
|
||||
+++ b/src/org/apache/xerces/impl/xs/SchemaGrammar.java
|
||||
@@ -144,35 +144,39 @@ public SchemaGrammar(String targetNamespace, XSDDescription grammarDesc,
|
||||
fGrammarDescription = grammarDesc;
|
||||
fSymbolTable = symbolTable;
|
||||
|
||||
- // REVISIT: do we know the numbers of the following global decls
|
||||
- // when creating this grammar? If so, we can pass the numbers in,
|
||||
- // and use that number to initialize the following hashtables.
|
||||
- fGlobalAttrDecls = new SymbolHash();
|
||||
- fGlobalAttrGrpDecls = new SymbolHash();
|
||||
- fGlobalElemDecls = new SymbolHash();
|
||||
- fGlobalGroupDecls = new SymbolHash();
|
||||
- fGlobalNotationDecls = new SymbolHash();
|
||||
- fGlobalIDConstraintDecls = new SymbolHash();
|
||||
+ // REVISIT: the initial sizes being chosen for each SymbolHash
|
||||
+ // may not be ideal and could still be tuned. They were chosen
|
||||
+ // somewhat arbitrarily to reduce the initial footprint of
|
||||
+ // SymbolHash buckets from 1,515 to 177 (about 12% of the
|
||||
+ // default size).
|
||||
+ fGlobalAttrDecls = new SymbolHash(12);
|
||||
+ fGlobalAttrGrpDecls = new SymbolHash(5);
|
||||
+ fGlobalElemDecls = new SymbolHash(25);
|
||||
+ fGlobalGroupDecls = new SymbolHash(5);
|
||||
+ fGlobalNotationDecls = new SymbolHash(1);
|
||||
+ fGlobalIDConstraintDecls = new SymbolHash(3);
|
||||
|
||||
// Extended tables
|
||||
- fGlobalAttrDeclsExt = new SymbolHash();
|
||||
- fGlobalAttrGrpDeclsExt = new SymbolHash();
|
||||
- fGlobalElemDeclsExt = new SymbolHash();
|
||||
- fGlobalGroupDeclsExt = new SymbolHash();
|
||||
- fGlobalNotationDeclsExt = new SymbolHash();
|
||||
- fGlobalIDConstraintDeclsExt = new SymbolHash();
|
||||
- fGlobalTypeDeclsExt = new SymbolHash();
|
||||
+ fGlobalAttrDeclsExt = new SymbolHash(12);
|
||||
+ fGlobalAttrGrpDeclsExt = new SymbolHash(5);
|
||||
+ fGlobalElemDeclsExt = new SymbolHash(25);
|
||||
+ fGlobalGroupDeclsExt = new SymbolHash(5);
|
||||
+ fGlobalNotationDeclsExt = new SymbolHash(1);
|
||||
+ fGlobalIDConstraintDeclsExt = new SymbolHash(3);
|
||||
+ fGlobalTypeDeclsExt = new SymbolHash(25);
|
||||
|
||||
// All global elements table
|
||||
- fAllGlobalElemDecls = new SymbolHash();
|
||||
+ fAllGlobalElemDecls = new SymbolHash(25);
|
||||
|
||||
// if we are parsing S4S, put built-in types in first
|
||||
// they might get overwritten by the types from S4S, but that's
|
||||
// considered what the application wants to do.
|
||||
- if (fTargetNamespace == SchemaSymbols.URI_SCHEMAFORSCHEMA)
|
||||
+ if (fTargetNamespace == SchemaSymbols.URI_SCHEMAFORSCHEMA) {
|
||||
fGlobalTypeDecls = SG_SchemaNS.fGlobalTypeDecls.makeClone();
|
||||
- else
|
||||
- fGlobalTypeDecls = new SymbolHash();
|
||||
+ }
|
||||
+ else {
|
||||
+ fGlobalTypeDecls = new SymbolHash(25);
|
||||
+ }
|
||||
} // <init>(String, XSDDescription)
|
||||
|
||||
// Clone an existing schema grammar
|
||||
diff --git a/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java b/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
|
||||
index e05409d6e..0937ac3a7 100644
|
||||
--- a/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
|
||||
+++ b/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
|
||||
@@ -445,13 +445,13 @@ private String doc2SystemId(Element ele) {
|
||||
private String [][] fKeyrefNamespaceContext = new String[INIT_KEYREF_STACK][1];
|
||||
|
||||
// global decls: map from decl name to decl object
|
||||
- SymbolHash fGlobalAttrDecls = new SymbolHash();
|
||||
- SymbolHash fGlobalAttrGrpDecls = new SymbolHash();
|
||||
- SymbolHash fGlobalElemDecls = new SymbolHash();
|
||||
- SymbolHash fGlobalGroupDecls = new SymbolHash();
|
||||
- SymbolHash fGlobalNotationDecls = new SymbolHash();
|
||||
- SymbolHash fGlobalIDConstraintDecls = new SymbolHash();
|
||||
- SymbolHash fGlobalTypeDecls = new SymbolHash();
|
||||
+ SymbolHash fGlobalAttrDecls = new SymbolHash(12);
|
||||
+ SymbolHash fGlobalAttrGrpDecls = new SymbolHash(5);
|
||||
+ SymbolHash fGlobalElemDecls = new SymbolHash(25);
|
||||
+ SymbolHash fGlobalGroupDecls = new SymbolHash(5);
|
||||
+ SymbolHash fGlobalNotationDecls = new SymbolHash(1);
|
||||
+ SymbolHash fGlobalIDConstraintDecls = new SymbolHash(3);
|
||||
+ SymbolHash fGlobalTypeDecls = new SymbolHash(25);
|
||||
|
||||
// Constructors
|
||||
public XSDHandler(){
|
||||
diff --git a/src/org/apache/xerces/util/SymbolHash.java b/src/org/apache/xerces/util/SymbolHash.java
|
||||
index 63974da68..08caa7b03 100644
|
||||
--- a/src/org/apache/xerces/util/SymbolHash.java
|
||||
+++ b/src/org/apache/xerces/util/SymbolHash.java
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
package org.apache.xerces.util;
|
||||
|
||||
-
|
||||
/**
|
||||
* This class is an unsynchronized hash table primary used for String
|
||||
* to Object mapping.
|
||||
@@ -78,7 +77,8 @@ public SymbolHash(int size) {
|
||||
* @param value
|
||||
*/
|
||||
public void put(Object key, Object value) {
|
||||
- int bucket = (key.hashCode() & 0x7FFFFFFF) % fTableSize;
|
||||
+ final int hash = hash(key);
|
||||
+ int bucket = hash % fTableSize;
|
||||
Entry entry = search(key, bucket);
|
||||
|
||||
// replace old value
|
||||
@@ -87,6 +87,12 @@ public void put(Object key, Object value) {
|
||||
}
|
||||
// create new entry
|
||||
else {
|
||||
+ if (fNum >= fTableSize) {
|
||||
+ // Rehash the table if the number of entries
|
||||
+ // would exceed the number of buckets.
|
||||
+ rehash();
|
||||
+ bucket = hash % fTableSize;
|
||||
+ }
|
||||
entry = new Entry(key, value, fBuckets[bucket]);
|
||||
fBuckets[bucket] = entry;
|
||||
fNum++;
|
||||
@@ -100,7 +106,7 @@ public void put(Object key, Object value) {
|
||||
* @return the value associated with the given key.
|
||||
*/
|
||||
public Object get(Object key) {
|
||||
- int bucket = (key.hashCode() & 0x7FFFFFFF) % fTableSize;
|
||||
+ int bucket = hash(key) % fTableSize;
|
||||
Entry entry = search(key, bucket);
|
||||
if (entry != null) {
|
||||
return entry.value;
|
||||
@@ -156,14 +162,15 @@ public SymbolHash makeClone() {
|
||||
SymbolHash newTable = new SymbolHash(fTableSize);
|
||||
newTable.fNum = fNum;
|
||||
for (int i = 0; i < fTableSize; i++) {
|
||||
- if (fBuckets[i] != null)
|
||||
+ if (fBuckets[i] != null) {
|
||||
newTable.fBuckets[i] = fBuckets[i].makeClone();
|
||||
+ }
|
||||
}
|
||||
return newTable;
|
||||
}
|
||||
|
||||
/**
|
||||
- * Remove all key/value assocaition. This tries to save a bit of GC'ing
|
||||
+ * Remove all key/value association. This tries to save a bit of GC'ing
|
||||
* by at least keeping the fBuckets array around.
|
||||
*/
|
||||
public void clear() {
|
||||
@@ -182,6 +182,44 @@ public class SymbolHash {
|
||||
return null;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns a hashcode value for the specified key.
|
||||
+ *
|
||||
+ * @param key The key to hash.
|
||||
+ */
|
||||
+ protected int hash(Object key) {
|
||||
+ return key.hashCode() & 0x7FFFFFFF;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Increases the capacity of and internally reorganizes this
|
||||
+ * SymbolHash, in order to accommodate and access its entries more
|
||||
+ * efficiently. This method is called automatically when the
|
||||
+ * number of keys in the SymbolHash exceeds its number of buckets.
|
||||
+ */
|
||||
+ protected void rehash() {
|
||||
+
|
||||
+ final int oldCapacity = fBuckets.length;
|
||||
+ final Entry[] oldTable = fBuckets;
|
||||
+
|
||||
+ final int newCapacity = (oldCapacity << 1) + 1;
|
||||
+ final Entry[] newTable = new Entry[newCapacity];
|
||||
+
|
||||
+ fBuckets = newTable;
|
||||
+ fTableSize = fBuckets.length;
|
||||
+
|
||||
+ for (int i = oldCapacity; i-- > 0;) {
|
||||
+ for (Entry old = oldTable[i]; old != null; ) {
|
||||
+ Entry e = old;
|
||||
+ old = old.next;
|
||||
+
|
||||
+ int index = hash(e.key) % newCapacity;
|
||||
+ e.next = newTable[index];
|
||||
+ newTable[index] = e;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
//
|
||||
// Classes
|
||||
//
|
||||
@ -1,71 +0,0 @@
|
||||
From 51c3e1286d7923eb2ecbc97aade9d2cf5faa22b7 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Glavassevich <mrglavas@apache.org>
|
||||
Date: Tue, 9 Aug 2011 14:51:31 +0000
|
||||
Subject: [PATCH] JIRA Issue #1521:
|
||||
http://issues.apache.org/jira/browse/XERCESJ-1521. Compact the
|
||||
SoftReferenceSymbolTable if after cleaning out cleared SoftReferences the
|
||||
number of symbols drops below 25% of the table's load factor threshold.
|
||||
|
||||
git-svn-id: https://svn.apache.org/repos/asf/xerces/java/trunk@1155386 13f79535-47bb-0310-9956-ffa450edef68
|
||||
---
|
||||
.../xerces/util/SoftReferenceSymbolTable.java | 40 ++++++++++++++-----
|
||||
1 file changed, 31 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/org/apache/xerces/util/SoftReferenceSymbolTable.java b/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
|
||||
index aebe2f449..542bfb7da 100644
|
||||
--- a/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
|
||||
+++ b/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
|
||||
@@ -200,12 +200,26 @@ public String addSymbol(char[] buffer, int offset, int length) {
|
||||
* and load factor.
|
||||
*/
|
||||
protected void rehash() {
|
||||
-
|
||||
- int oldCapacity = fBuckets.length;
|
||||
- SREntry[] oldTable = fBuckets;
|
||||
-
|
||||
- int newCapacity = oldCapacity * 2 + 1;
|
||||
- SREntry[] newTable = new SREntry[newCapacity];
|
||||
+ rehashCommon(fBuckets.length * 2 + 1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Reduces the capacity of and internally reorganizes this
|
||||
+ * SymbolTable, in order to accommodate and access its entries in
|
||||
+ * a more memory efficient way. This method is called automatically when
|
||||
+ * the number of keys in the SymbolTable drops below 25% of this
|
||||
+ * hashtable's load factor (as a result of SoftReferences which have
|
||||
+ * been cleared).
|
||||
+ */
|
||||
+ protected void compact() {
|
||||
+ rehashCommon(((int) (fCount / fLoadFactor)) * 2 + 1);
|
||||
+ }
|
||||
+
|
||||
+ private void rehashCommon(final int newCapacity) {
|
||||
+
|
||||
+ final int oldCapacity = fBuckets.length;
|
||||
+ final SREntry[] oldTable = fBuckets;
|
||||
+ final SREntry[] newTable = new SREntry[newCapacity];
|
||||
|
||||
fThreshold = (int)(newCapacity * fLoadFactor);
|
||||
fBuckets = newTable;
|
||||
@@ -312,9 +312,17 @@ public class SoftReferenceSymbolTable ex
|
||||
*/
|
||||
private void clean() {
|
||||
SREntry entry = (SREntry)fReferenceQueue.poll();
|
||||
- while (entry != null) {
|
||||
- removeEntry(entry);
|
||||
- entry = (SREntry)fReferenceQueue.poll();
|
||||
+ if (entry != null) {
|
||||
+ do {
|
||||
+ removeEntry(entry);
|
||||
+ entry = (SREntry)fReferenceQueue.poll();
|
||||
+ }
|
||||
+ while (entry != null);
|
||||
+ // Reduce the number of buckets if the number of items
|
||||
+ // in the table has dropped below 25% of the threshold.
|
||||
+ if (fCount < (fThreshold >> 2)) {
|
||||
+ compact();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
32
XJavac.java
32
XJavac.java
@ -46,24 +46,27 @@ public class XJavac extends Javac {
|
||||
* @exception BuildException if the compilation has problems.
|
||||
*/
|
||||
public void execute() throws BuildException {
|
||||
if(isJDK14OrHigher()) {
|
||||
Properties props = null;
|
||||
try {
|
||||
props = System.getProperties();
|
||||
} catch (Exception e) {
|
||||
throw new BuildException("unable to determine java vendor because could not access system properties!");
|
||||
}
|
||||
String currBCP = (String)props.get("sun.boot.class.path"); // this property is absent / null with JDK 9 & above
|
||||
|
||||
if(isJDK14OrHigher() && !(currBCP == null)) {
|
||||
// maybe the right one; check vendor:
|
||||
// by checking system properties:
|
||||
Properties props = null;
|
||||
try {
|
||||
props = System.getProperties();
|
||||
} catch (Exception e) {
|
||||
throw new BuildException("unable to determine java vendor because could not access system properties!");
|
||||
}
|
||||
// by checking system properties:
|
||||
// this is supposed to be provided by all JVM's from time immemorial
|
||||
String vendor = ((String)props.get("java.vendor")).toUpperCase(Locale.ENGLISH);
|
||||
if (vendor.indexOf("IBM") >= 0) {
|
||||
// we're on an IBM 1.4 or higher; fiddle with the bootclasspath.
|
||||
setBootclasspath(createIBMJDKBootclasspath());
|
||||
}
|
||||
// need to do special things for Sun too and also
|
||||
// need to do special things for Sun/Oracle too and also
|
||||
// for Apple, HP, FreeBSD, SableVM, Kaffe and Blackdown: a Linux port of Sun Java
|
||||
else if( (vendor.indexOf("SUN") >= 0) ||
|
||||
(vendor.indexOf("ORACLE") >= 0) ||
|
||||
(vendor.indexOf("BLACKDOWN") >= 0) ||
|
||||
(vendor.indexOf("APPLE") >= 0) ||
|
||||
(vendor.indexOf("HEWLETT-PACKARD") >= 0) ||
|
||||
@ -75,8 +78,7 @@ public class XJavac extends Javac {
|
||||
// we must use the classpath
|
||||
Path bcp = createBootclasspath();
|
||||
Path clPath = getClasspath();
|
||||
bcp.append(clPath);
|
||||
String currBCP = (String)props.get("sun.boot.class.path");
|
||||
bcp.append(clPath);
|
||||
Path currBCPath = new Path(null);
|
||||
currBCPath.createPathElement().setPath(currBCP);
|
||||
bcp.append(currBCPath);
|
||||
@ -94,10 +96,16 @@ public class XJavac extends Javac {
|
||||
Path bcp = createBootclasspath();
|
||||
String javaHome = System.getProperty("java.home");
|
||||
StringBuffer bcpMember = new StringBuffer();
|
||||
bcpMember.append(javaHome).append("/lib/charsets.jar:");
|
||||
bcpMember.append(javaHome).append("/bin/default/jclSC170/vm.jar:");
|
||||
bcp.createPathElement().setPath(bcpMember.toString());
|
||||
bcpMember.replace(javaHome.length(), bcpMember.length(), "/lib/ppc/default/jclSC170/vm.jar:");
|
||||
bcp.createPathElement().setPath(bcpMember.toString());
|
||||
bcpMember.replace(javaHome.length(), bcpMember.length(), "/lib/charsets.jar:");
|
||||
bcp.createPathElement().setPath(bcpMember.toString());
|
||||
bcpMember.replace(javaHome.length(), bcpMember.length(), "/lib/core.jar:");
|
||||
bcp.createPathElement().setPath(bcpMember.toString());
|
||||
bcpMember.replace(javaHome.length(), bcpMember.length(), "/lib/math.jar:");
|
||||
bcp.createPathElement().setPath(bcpMember.toString());
|
||||
bcpMember.replace(javaHome.length(), bcpMember.length(), "/lib/vm.jar:");
|
||||
bcp.createPathElement().setPath(bcpMember.toString());
|
||||
bcpMember.replace(javaHome.length(), bcpMember.length(), "/lib/java.util.jar:");
|
||||
|
||||
Binary file not shown.
BIN
Xerces-J-src.2.12.2.tar.gz
Normal file
BIN
Xerces-J-src.2.12.2.tar.gz
Normal file
Binary file not shown.
@ -1,47 +0,0 @@
|
||||
--- a/src/org/apache/xerces/impl/XMLScanner.java 2013/07/03 18:25:06 1499505
|
||||
+++ b/src/org/apache/xerces/impl/XMLScanner.java 2013/07/03 18:29:43 1499506
|
||||
@@ -542,7 +542,7 @@
|
||||
// document is until we scan the encoding declaration
|
||||
// you cannot reliably read any characters outside
|
||||
// of the ASCII range here. -- mrglavas
|
||||
- String name = fEntityScanner.scanName();
|
||||
+ String name = scanPseudoAttributeName();
|
||||
XMLEntityManager.print(fEntityManager.getCurrentEntity());
|
||||
if (name == null) {
|
||||
reportFatalError("PseudoAttrNameExpected", null);
|
||||
@@ -599,6 +599,35 @@
|
||||
} // scanPseudoAttribute(XMLString):String
|
||||
|
||||
/**
|
||||
+ * Scans the name of a pseudo attribute. The only legal names
|
||||
+ * in XML 1.0/1.1 documents are 'version', 'encoding' and 'standalone'.
|
||||
+ *
|
||||
+ * @return the name of the pseudo attribute or <code>null</code>
|
||||
+ * if a legal pseudo attribute name could not be scanned.
|
||||
+ */
|
||||
+ private String scanPseudoAttributeName() throws IOException, XNIException {
|
||||
+ final int ch = fEntityScanner.peekChar();
|
||||
+ switch (ch) {
|
||||
+ case 'v':
|
||||
+ if (fEntityScanner.skipString(fVersionSymbol)) {
|
||||
+ return fVersionSymbol;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 'e':
|
||||
+ if (fEntityScanner.skipString(fEncodingSymbol)) {
|
||||
+ return fEncodingSymbol;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 's':
|
||||
+ if (fEntityScanner.skipString(fStandaloneSymbol)) {
|
||||
+ return fStandaloneSymbol;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ return null;
|
||||
+ } // scanPseudoAttributeName()
|
||||
+
|
||||
+ /**
|
||||
* Scans a processing instruction.
|
||||
* <p>
|
||||
* <pre>
|
||||
@ -39,7 +39,7 @@
|
||||
<!-- substitute tokens as needed -->
|
||||
<replace file="${build.dir}/src/org/apache/xerces/impl/Version.java"
|
||||
token="@@VERSION@@" value="${parser.Name} ${parser.Version}"/>
|
||||
@@ -1231,30 +1206,6 @@
|
||||
@@ -1232,30 +1207,6 @@
|
||||
<!-- HACK: Remove reference to XML11Configurable from SAX parser -->
|
||||
<replace file="${build.dir}/src/org/apache/xerces/parsers/AbstractSAXParser.java"
|
||||
token="return (fConfiguration instanceof XML11Configurable);" value="return false;"/>
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Xerces-J2 constants script
|
||||
# JPackage Project (http://www.jpackage.org/)
|
||||
# $Id: xerces-j2-constants.sh,v 1.3 2005/05/26 14:21:22 gbenson Exp $
|
||||
|
||||
# Source functions library
|
||||
. /usr/share/java-utils/java-functions
|
||||
|
||||
# Configuration
|
||||
MAIN_CLASS=org.apache.xerces.impl.Constants
|
||||
|
||||
# Set parameters
|
||||
set_jvm
|
||||
export CLASSPATH=$(build-classpath xerces-j2)
|
||||
set_flags $BASE_FLAGS
|
||||
set_options $BASE_OPTIONS
|
||||
|
||||
# Let's start
|
||||
run "$@"
|
||||
File diff suppressed because one or more lines are too long
@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Xerces-J2 version script
|
||||
# JPackage Project (http://www.jpackage.org/)
|
||||
# $Id: xerces-j2-version.sh,v 1.3 2005/05/26 14:21:22 gbenson Exp $
|
||||
|
||||
# Source functions library
|
||||
. /usr/share/java-utils/java-functions
|
||||
|
||||
# Configuration
|
||||
MAIN_CLASS=org.apache.xerces.impl.Version
|
||||
|
||||
# Set parameters
|
||||
set_jvm
|
||||
export CLASSPATH=$(build-classpath xerces-j2)
|
||||
set_flags $BASE_FLAGS
|
||||
set_options $BASE_OPTIONS
|
||||
|
||||
# Let's start
|
||||
run "$@"
|
||||
@ -1,29 +1,24 @@
|
||||
Name: xerces-j2
|
||||
Version: 2.11.0
|
||||
Release: 37
|
||||
Version: 2.12.2
|
||||
Release: 1
|
||||
Summary: Java XML parser
|
||||
License: ASL 2.0 and W3C
|
||||
URL: http://xerces.apache.org/xerces2-j/
|
||||
|
||||
Source0: http://archive.apache.org/dist/xerces/j/Xerces-J-src.%{version}.tar.gz
|
||||
Source1: %{name}-version.sh
|
||||
Source2: %{name}-constants.sh
|
||||
Source0: http://mirror.ox.ac.uk/sites/rsync.apache.org/xerces/j/source/Xerces-J-src.%{version}.tar.gz
|
||||
Source11: %{name}-version.1
|
||||
Source12: %{name}-constants.1
|
||||
Source3: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_11_0/tools/src/XJavac.java
|
||||
Source5: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_11_0/tools/src/ExperimentalTaglet.java
|
||||
Source6: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_11_0/tools/src/InternalTaglet.java
|
||||
Source3: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_12_2/tools/src/XJavac.java
|
||||
Source5: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_12_2/tools/src/ExperimentalTaglet.java
|
||||
Source6: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_12_2/tools/src/InternalTaglet.java
|
||||
Source7: %{name}-pom.xml
|
||||
|
||||
Patch0: %{name}-build.patch
|
||||
Patch1: %{name}-manifest.patch
|
||||
Patch2: xerces-j2-CVE-2013-4002.patch
|
||||
Patch3: JIRA-Issue-1521-http-issues.apache.org-jira-browse-X.patch
|
||||
Patch4: JIRA-Issue-1499-http-issues.apache.org-jira-browse-X.patch
|
||||
Patch5: CVE-2012-0881.patch
|
||||
|
||||
BuildRequires: javapackages-local ant apache-parent xalan-j2 >= 2.7.1
|
||||
BuildRequires: xml-commons-apis >= 1.4.01 xml-commons-resolver >= 1.2
|
||||
BuildRequires: java-1.8.0-openjdk-devel
|
||||
|
||||
Requires: xalan-j2 >= 2.7.1 xml-commons-resolver >= 1.2
|
||||
Requires: xml-commons-apis >= 1.4.01 javapackages-tools
|
||||
@ -75,13 +70,14 @@ Obsoletes: %{name}-javadoc-other < %{version}-%{release}
|
||||
Man pages and other related documents for %{name}.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n xerces-2_11_0
|
||||
%autosetup -p1 -n xerces-2_12_2
|
||||
install -d tools/org/apache/xerces/util
|
||||
install -d tools/bin
|
||||
cp -a %{SOURCE3} %{SOURCE5} %{SOURCE6} tools/org/apache/xerces/util
|
||||
find -name '*.class' -exec rm -f '{}' \;
|
||||
find -name '*.jar' -exec rm -f '{}' \;
|
||||
sed -i 's/\r//' LICENSE README NOTICE
|
||||
sed -i -e "s|additionalparam='|additionalparam='-Xdoclint:none |" build.xml
|
||||
%mvn_alias : xerces:xerces xerces:xmlParserAPIs apache:%{name}
|
||||
%mvn_file : %{name} jaxp_parser_impl
|
||||
|
||||
@ -96,8 +92,8 @@ ln -sf $(build-classpath xml-commons-apis) xml-apis.jar
|
||||
ln -sf $(build-classpath xml-commons-resolver) resolver.jar
|
||||
ln -sf $(build-classpath %{name}) x.jar
|
||||
popd
|
||||
export ANT_OPTS="-Xmx256m -Djava.endorsed.dirs=$(pwd)/tools -Djava.awt.headless=true -Dbuild.sysclasspath=first -Ddisconnected=true"
|
||||
ant -Djavac.source=1.5 -Djavac.target=1.5 -Dbuild.compiler=modern clean jars javadocs
|
||||
export ANT_OPTS="-Xmx512m -Djava.awt.headless=true -Dbuild.sysclasspath=first -Ddisconnected=true"
|
||||
%ant -Djavac.source=1.6 -Djavac.target=1.6 -Dbuild.compiler=modern clean jars javadocs
|
||||
%mvn_artifact %{SOURCE7} build/xercesImpl.jar
|
||||
|
||||
%install
|
||||
@ -112,8 +108,8 @@ cp -pr build/docs/javadocs/xerces2/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}/impl
|
||||
cp -pr build/docs/javadocs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}/xs
|
||||
cp -pr build/docs/javadocs/xni/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}/xni
|
||||
cp -pr build/docs/javadocs/other/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}/other
|
||||
install -pD -m755 -T %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/%{name}-version
|
||||
install -pD -m755 -T %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/%{name}-constants
|
||||
%jpackage_script org.apache.xerces.impl.Version "" "" %{name} %{name}-version 1
|
||||
%jpackage_script org.apache.xerces.impl.Constants "" "" %{name} %{name}-constants 1
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1
|
||||
install -p -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{_mandir}/man1
|
||||
install -p -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man1
|
||||
@ -135,6 +131,9 @@ ln -sf %{name}.jar %{_javadir}/jaxp_parser_impl.jar
|
||||
%{_mandir}/*/*
|
||||
|
||||
%changelog
|
||||
* Wed Apr 27 2022 yaoxin <yaoxin30@h-partners.com> - 2.12.2-1
|
||||
- Upgrade to 2.12.2 for fix CVE-2022-23437
|
||||
|
||||
* Sat Sep 19 2020 wangxiao<wangxiao65@huawei.com> - 2.11.0-37
|
||||
- fix CVE-2012-0881
|
||||
* Mon Feb 17 2020 zhouyihang<zhouyihang1@huawei.com> - 2.11.0-36
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user