From afb3e923907b30119a8d1e13af4619437a396f4e5894d604ef6dd4c52f8088e3 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Thu, 5 Apr 2018 10:14:35 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/xmlgraphics-fop?expand=0&rev=67 --- java8-compatibility.patch | 108 ++++++++++++++++++++++++++++++++++++++ xmlgraphics-fop.changes | 8 +++ xmlgraphics-fop.spec | 4 +- 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 java8-compatibility.patch diff --git a/java8-compatibility.patch b/java8-compatibility.patch new file mode 100644 index 0000000..a1280e1 --- /dev/null +++ b/java8-compatibility.patch @@ -0,0 +1,108 @@ +--- fop-2.1/src/java/org/apache/fop/fo/FOText.java 2016-01-07 15:13:29.000000000 +0100 ++++ fop-2.1/src/java/org/apache/fop/fo/FOText.java 2018-04-05 12:06:45.984476031 +0200 +@@ -20,6 +20,7 @@ + package org.apache.fop.fo; + + import java.awt.Color; ++import java.nio.Buffer; + import java.nio.CharBuffer; + import java.text.CharacterIterator; + import java.text.StringCharacterIterator; +@@ -120,7 +121,7 @@ + charBuffer = CharBuffer.allocate(newLength); + } else { + // allocate a larger buffer, and transfer contents +- int requires = charBuffer.position() + length; ++ int requires = ((Buffer)charBuffer).position() + length; + int capacity = charBuffer.capacity(); + if (requires > capacity) { + int newCapacity = capacity * 2; +@@ -134,11 +135,11 @@ + } + } + // extend limit to capacity +- charBuffer.limit(charBuffer.capacity()); ++ ((Buffer)charBuffer).limit(charBuffer.capacity()); + // append characters + charBuffer.put(data, start, length); + // shrink limit to position +- charBuffer.limit(charBuffer.position()); ++ ((Buffer)charBuffer).limit(((Buffer)charBuffer).position()); + } + + /** +@@ -162,7 +163,7 @@ + // not really removing, just make sure the char buffer + // pointed to is really a different one + if (charBuffer != null) { +- ft.charBuffer = CharBuffer.allocate(charBuffer.limit()); ++ ft.charBuffer = CharBuffer.allocate(((Buffer)charBuffer).limit()); + charBuffer.rewind(); + ft.charBuffer.put(charBuffer); + ft.charBuffer.rewind(); +@@ -219,7 +220,7 @@ + */ + public boolean willCreateArea() { + if (whiteSpaceCollapse == Constants.EN_FALSE +- && charBuffer.limit() > 0) { ++ && ((Buffer)charBuffer).limit() > 0) { + return true; + } + +@@ -278,7 +279,7 @@ + charBuffer.rewind(); + CharBuffer tmp = charBuffer.slice(); + char c; +- int lim = charBuffer.limit(); ++ int lim = ((Buffer)charBuffer).limit(); + int pos = -1; + while (++pos < lim) { + c = charBuffer.get(); +@@ -522,13 +523,13 @@ + + /** {@inheritDoc} */ + public boolean hasNext() { +- return (this.currentPosition < charBuffer.limit()); ++ return (this.currentPosition < ((Buffer)charBuffer).limit()); + } + + /** {@inheritDoc} */ + public char nextChar() { + +- if (this.currentPosition < charBuffer.limit()) { ++ if (this.currentPosition < ((Buffer)charBuffer).limit()) { + this.canRemove = true; + this.canReplace = true; + return charBuffer.get(currentPosition++); +@@ -542,11 +543,11 @@ + public void remove() { + + if (this.canRemove) { +- charBuffer.position(currentPosition); ++ ((Buffer)charBuffer).position(currentPosition); + // Slice the buffer at the current position + CharBuffer tmp = charBuffer.slice(); + // Reset position to before current character +- charBuffer.position(--currentPosition); ++ ((Buffer)charBuffer).position(--currentPosition); + if (tmp.hasRemaining()) { + // Transfer any remaining characters + charBuffer.mark(); +@@ -554,7 +555,7 @@ + charBuffer.reset(); + } + // Decrease limit +- charBuffer.limit(charBuffer.limit() - 1); ++ ((Buffer)charBuffer).limit(((Buffer)charBuffer).limit() - 1); + // Make sure following calls fail, unless nextChar() was called + this.canRemove = false; + } else { +@@ -729,7 +730,7 @@ + + /** {@inheritDoc} */ + public int length() { +- return charBuffer.limit(); ++ return ((Buffer)charBuffer).limit(); + } + + /** diff --git a/xmlgraphics-fop.changes b/xmlgraphics-fop.changes index a229fe0..8849c0e 100644 --- a/xmlgraphics-fop.changes +++ b/xmlgraphics-fop.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Apr 5 10:13:02 UTC 2018 - fstrba@suse.com + +- Added patch: + * java8-compatibility.patch + + Fix compatibility with java8 and lower when built with java9 + or higher + ------------------------------------------------------------------- Fri Sep 29 06:57:25 UTC 2017 - fstrba@suse.com diff --git a/xmlgraphics-fop.spec b/xmlgraphics-fop.spec index 37b2a0b..85fc2ad 100644 --- a/xmlgraphics-fop.spec +++ b/xmlgraphics-fop.spec @@ -1,7 +1,7 @@ # # spec file for package xmlgraphics-fop # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2000-2008, JPackage Project # # All modifications and additions to the file contributed by third parties @@ -39,6 +39,7 @@ Source12: %{name}-fontlist.xml Patch1: xmlgraphics-fop-cli.patch Patch2: hyphenation-more-stack.patch Patch3: fix-javadoc-java8.patch +Patch4: java8-compatibility.patch BuildRequires: ant >= 1.6.5 BuildRequires: apache-commons-io >= 2.4 BuildRequires: apache-commons-logging @@ -88,6 +89,7 @@ rm src/java/org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java %patch1 -p1 -b .cli %patch2 -p1 %patch3 -p1 +%patch4 -p1 cp %{SOURCE2} %{SOURCE3} %{SOURCE4} . # Replace keyword "VERSION" in XML files with the real one: