Accepting request 655909 from Java:packages

Restore Java 8 compatibility

OBS-URL: https://build.opensuse.org/request/show/655909
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xmlgraphics-fop?expand=0&rev=38
This commit is contained in:
Dominique Leuenberger 2018-12-07 13:32:54 +00:00 committed by Git OBS Bridge
commit 97b4ba0ed3
3 changed files with 192 additions and 61 deletions

View File

@ -1,5 +1,91 @@
--- fop-2.1/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java 2016-01-07 15:13:29.000000000 +0100
+++ fop-2.1/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java 2018-12-06 23:18:14.815791853 +0100
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
@@ -68,7 +69,7 @@
if (bb.hasArray()) {
return getEncodedChars(bb.array(), bb.limit());
} else {
- bb.rewind();
+ ((Buffer)bb).rewind();
byte[] bytes = new byte[bb.remaining()];
bb.get(bytes);
return getEncodedChars(bytes, bytes.length);
--- fop-2.1/src/java/org/apache/fop/area/AreaTreeParser.java 2016-01-07 15:13:29.000000000 +0100
+++ fop-2.1/src/java/org/apache/fop/area/AreaTreeParser.java 2018-12-06 23:18:14.815791853 +0100
@@ -24,6 +24,7 @@
import java.awt.geom.Rectangle2D;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.List;
import java.util.Map;
@@ -322,7 +323,7 @@
throws SAXException {
lastAttributes = new AttributesImpl(attributes);
Maker maker = makers.get(localName);
- content.clear();
+ ((Buffer)content).clear();
ignoreCharacters = true;
if (maker != null) {
ignoreCharacters = maker.ignoreCharacters();
@@ -353,7 +354,7 @@
Maker maker = makers.get(localName);
if (maker != null) {
maker.endElement();
- content.clear();
+ ((Buffer)content).clear();
}
ignoreCharacters = true;
} else {
@@ -798,7 +799,7 @@
boolean reversed = XMLUtil.getAttributeAsBoolean(lastAttributes, "reversed", false);
int[][] gposAdjustments
= XMLUtil.getAttributeAsPositionAdjustments(lastAttributes, "position-adjust");
- content.flip();
+ ((Buffer)content).flip();
WordArea word = new WordArea(
offset, level, content.toString().trim(), letterAdjust,
null, gposAdjustments, reversed);
@@ -818,7 +819,7 @@
int offset = XMLUtil.getAttributeAsInt(lastAttributes, "offset", 0);
//TODO the isAdjustable parameter is currently not used/implemented
if (content.position() > 0) {
- content.flip();
+ ((Buffer)content).flip();
boolean adjustable = XMLUtil.getAttributeAsBoolean(lastAttributes, "adj", true);
int level = XMLUtil.getAttributeAsInt(lastAttributes, "level", -1);
SpaceArea space = new SpaceArea(offset, level, content.charAt(0), adjustable);
@@ -1207,17 +1208,17 @@
// allocate a larger buffer and transfer content
CharBuffer newContent
= CharBuffer.allocate(this.content.position() + length);
- this.content.flip();
+ ((Buffer)(this.content)).flip();
newContent.put(this.content);
this.content = newContent;
}
// make sure the full capacity is used
- this.content.limit(this.content.capacity());
+ ((Buffer)(this.content)).limit(this.content.capacity());
// add characters to the buffer
this.content.put(ch, start, length);
// decrease the limit, if necessary
if (this.content.position() < this.content.limit()) {
- this.content.limit(this.content.position());
+ ((Buffer)(this.content)).limit(this.content.position());
}
}
}
--- 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
+++ fop-2.1/src/java/org/apache/fop/fo/FOText.java 2018-12-06 23:21:33.412845154 +0100
@@ -20,6 +20,7 @@
package org.apache.fop.fo;
@ -8,16 +94,14 @@
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 @@
@@ -128,17 +129,17 @@
newCapacity = requires;
}
CharBuffer newBuffer = CharBuffer.allocate(newCapacity);
- charBuffer.rewind();
+ ((Buffer)charBuffer).rewind();
newBuffer.put(charBuffer);
charBuffer = newBuffer;
}
}
// extend limit to capacity
@ -31,50 +115,64 @@
}
/**
@@ -162,7 +163,7 @@
// not really removing, just make sure the char buffer
@@ -150,7 +151,7 @@
if (this.charBuffer == null) {
return null;
}
- this.charBuffer.rewind();
+ ((Buffer)(this.charBuffer)).rewind();
return this.charBuffer.asReadOnlyBuffer().subSequence(0, this.charBuffer.limit());
}
@@ -163,9 +164,9 @@
// 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 = CharBuffer.allocate(charBuffer.limit());
- charBuffer.rewind();
+ ((Buffer)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;
- ft.charBuffer.rewind();
+ ((Buffer)(ft.charBuffer)).rewind();
}
}
ft.prevFOTextThisBlock = null;
@@ -197,7 +198,7 @@
/** {@inheritDoc} */
public void endOfNode() throws FOPException {
if (charBuffer != null) {
- charBuffer.rewind();
+ ((Buffer)charBuffer).rewind();
}
super.endOfNode();
getFOEventHandler().characters(this);
@@ -224,7 +225,7 @@
}
@@ -278,7 +279,7 @@
charBuffer.rewind();
char ch;
- charBuffer.rewind();
+ ((Buffer)charBuffer).rewind();
while (charBuffer.hasRemaining()) {
ch = charBuffer.get();
if (!((ch == CharUtilities.SPACE)
@@ -232,7 +233,7 @@
|| (ch == CharUtilities.CARRIAGE_RETURN)
|| (ch == CharUtilities.TAB))) {
// not whitespace
- charBuffer.rewind();
+ ((Buffer)charBuffer).rewind();
return true;
}
}
@@ -275,7 +276,7 @@
return;
}
- charBuffer.rewind();
+ ((Buffer)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 @@
int lim = charBuffer.limit();
@@ -542,19 +543,19 @@
public void remove() {
if (this.canRemove) {
@ -87,9 +185,11 @@
+ ((Buffer)charBuffer).position(--currentPosition);
if (tmp.hasRemaining()) {
// Transfer any remaining characters
charBuffer.mark();
@@ -554,7 +555,7 @@
charBuffer.reset();
- charBuffer.mark();
+ ((Buffer)charBuffer).mark();
charBuffer.put(tmp);
- charBuffer.reset();
+ ((Buffer)charBuffer).reset();
}
// Decrease limit
- charBuffer.limit(charBuffer.limit() - 1);
@ -97,12 +197,31 @@
// 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();
@@ -737,7 +738,7 @@
*/
public void resetBuffer() {
if (charBuffer != null) {
- charBuffer.rewind();
+ ((Buffer)charBuffer).rewind();
}
}
--- fop-2.1/src/java/org/apache/fop/fonts/MultiByteFont.java 2016-01-07 15:13:29.000000000 +0100
+++ fop-2.1/src/java/org/apache/fop/fonts/MultiByteFont.java 2018-12-06 23:18:14.815791853 +0100
@@ -21,6 +21,7 @@
import java.awt.Rectangle;
import java.io.InputStream;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.nio.IntBuffer;
import java.util.BitSet;
@@ -686,7 +687,7 @@
cb.put((char) cc);
}
}
- cb.flip();
+ ((Buffer)cb).flip();
return cb;
}
/**

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Thu Dec 6 21:54:53 UTC 2018 - Fridrich Strba <fstrba@suse.com>
- Bring back the java-devel/java requirements to >= 1.8; we will
fix the ByteBuffer/CharBuffer compatibilities as they arise.
- Modified patch:
* java8-compatibility.patch
+ Fix fix ByteBuffer/CharBuffer incompatibilities with java8
Cast all the java.nio.ByteBuffer and java.nio.CharBuffer
instances to java.nio.Buffer before calling the clear(),
flip(), limit(int), mark(), reset() and rewind() methods.
-------------------------------------------------------------------
Thu Nov 15 11:45:21 UTC 2018 - thomas.schraitle@suse.com

View File

@ -13,7 +13,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -48,7 +48,7 @@ BuildRequires: apache-commons-logging
BuildRequires: apache-pdfbox
BuildRequires: avalon-framework
BuildRequires: docbook-xsl-stylesheets
BuildRequires: java-devel-openjdk >= 9
BuildRequires: java-devel >= 1.8
# Needed for maven conversions
BuildRequires: javapackages-local
BuildRequires: javapackages-tools
@ -64,7 +64,7 @@ Requires: apache-commons-io >= 2.4
Requires: apache-commons-logging
Requires: apache-pdfbox
Requires: avalon-framework
Requires: java >= 9
Requires: java >= 1.8
Requires: xml-commons-apis >= 1.3
Requires: xmlgraphics-batik >= 1.8
Requires: xmlgraphics-commons >= 2.1