Fridrich Strba 2018-04-05 10:14:35 +00:00 committed by Git OBS Bridge
parent 8f76b82f56
commit afb3e92390
3 changed files with 119 additions and 1 deletions

108
java8-compatibility.patch Normal file
View File

@ -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();
}
/**

View File

@ -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

View File

@ -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: