- Add patches for bnc#814241 upstream#1616

* arrays-doubling.patch
  * scan-pseudo-attribute.patch

OBS-URL: https://build.opensuse.org/package/show/Java:packages/xerces-j2?expand=0&rev=43
This commit is contained in:
Tomáš Chvátal 2016-02-11 15:20:10 +00:00 committed by Git OBS Bridge
parent bcb91586b0
commit 0c86ef06d6
4 changed files with 111 additions and 2 deletions

48
arrays-doubling.patch Normal file
View File

@ -0,0 +1,48 @@
--- xerces/src/org/apache/xerces/util/XMLStringBuffer.java 2006/09/18 05:12:57 447241
+++ xerces/src/org/apache/xerces/util/XMLStringBuffer.java 2013/07/25 18:13:37
@@ -111,12 +111,13 @@
*/
public void append(char c) {
if (this.length + 1 > this.ch.length) {
- int newLength = this.ch.length*2;
- if (newLength < this.ch.length + DEFAULT_SIZE)
- newLength = this.ch.length + DEFAULT_SIZE;
- char[] newch = new char[newLength];
- System.arraycopy(this.ch, 0, newch, 0, this.length);
- this.ch = newch;
+ int newLength = this.ch.length * 2;
+ if (newLength < this.ch.length + DEFAULT_SIZE) {
+ newLength = this.ch.length + DEFAULT_SIZE;
+ }
+ char[] newch = new char[newLength];
+ System.arraycopy(this.ch, 0, newch, 0, this.length);
+ this.ch = newch;
}
this.ch[this.length] = c;
this.length++;
@@ -130,9 +131,10 @@
public void append(String s) {
int length = s.length();
if (this.length + length > this.ch.length) {
- int newLength = this.ch.length*2;
- if (newLength < this.length + length + DEFAULT_SIZE)
+ int newLength = this.ch.length * 2;
+ if (newLength < this.length + length + DEFAULT_SIZE) {
newLength = this.ch.length + length + DEFAULT_SIZE;
+ }
char[] newch = new char[newLength];
System.arraycopy(this.ch, 0, newch, 0, this.length);
this.ch = newch;
@@ -150,7 +152,11 @@
*/
public void append(char[] ch, int offset, int length) {
if (this.length + length > this.ch.length) {
- char[] newch = new char[this.ch.length + length + DEFAULT_SIZE];
+ int newLength = this.ch.length * 2;
+ if (newLength < this.length + length + DEFAULT_SIZE) {
+ newLength = this.ch.length + length + DEFAULT_SIZE;
+ }
+ char[] newch = new char[newLength];
System.arraycopy(this.ch, 0, newch, 0, this.length);
this.ch = newch;
}

View File

@ -0,0 +1,47 @@
--- xerces/src/org/apache/xerces/impl/XMLScanner.java 2013/07/03 18:25:06 1499505
+++ xerces/src/org/apache/xerces/impl/XMLScanner.java 2013/07/03 18:29:43
@@ -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>

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Feb 11 15:12:31 UTC 2016 - tchvatal@suse.com
- Add patches for bnc#814241 upstream#1616
* arrays-doubling.patch
* scan-pseudo-attribute.patch
-------------------------------------------------------------------
Mon Jul 21 09:58:48 UTC 2014 - tchvatal@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package xerces-j2
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -30,12 +30,15 @@ Source2: %{name}-version.sh
Source3: %{name}-version.1
Source4: %{name}-constants.sh
Source5: %{name}-constants.1
Patch0: arrays-doubling.patch
Patch1: scan-pseudo-attribute.patch
BuildRequires: dos2unix
# some build requirements removed to enable jpackage bootstrap. this is
# the first package built, and we use the libraries in the tools subdir
# for it.
BuildRequires: java-1_5_0-gcj-compat-devel
#!BuildIgnore: java-1_6_0-openjdk java-1_6_0-openjdk-devel
#!BuildIgnore: antlr antlr-java
BuildRequires: java-1_5_0-gcj-compat-devel
BuildRequires: javapackages-tools
BuildRequires: unzip
Requires(post): update-alternatives
@ -160,6 +163,10 @@ This package contains the APIs subproject of xml-commons.
%setup -q -T -a 1 -D -n xerces-%{cvs_version}
%setup -q -T -D -n xerces-%{cvs_version}
find -type f -print |xargs -i dos2unix {}
%patch0 -p1
%patch1 -p1
echo 'javac.target=1.5' > build.properties
echo 'javac.source=1.5' >> build.properties