You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2018/10/23 09:23:41 UTC
svn commit: r1844626 - in /webservices/axiom/trunk:
axiom-compat/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
components/core-streams/src/main/java/org/apache/axiom/core/stream/serializer/writer/OutputStreamXmlWriter.java
Author: veithen
Date: Tue Oct 23 09:23:40 2018
New Revision: 1844626
URL: http://svn.apache.org/viewvc?rev=1844626&view=rev
Log:
Ensure compatibility with Java 8.
Modified:
webservices/axiom/trunk/axiom-compat/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/serializer/writer/OutputStreamXmlWriter.java
Modified: webservices/axiom/trunk/axiom-compat/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-compat/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java?rev=1844626&r1=1844625&r2=1844626&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-compat/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java (original)
+++ webservices/axiom/trunk/axiom-compat/src/main/java/org/apache/axiom/attachments/impl/BufferUtils.java Tue Oct 23 09:23:40 2018
@@ -22,6 +22,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
@@ -167,13 +168,13 @@ public class BufferUtils {
// If the ByteBuffer is not full, allocate a new one
ByteBuffer temp = ByteBuffer.allocate(bytesRead);
temp.put(bb.array(), 0, bytesRead);
- temp.position(0);
+ ((Buffer)temp).position(0);
channel.write(temp);
} else {
// Write to channel
- bb.position(0);
+ ((Buffer)bb).position(0);
channel.write(bb);
- bb.clear();
+ ((Buffer)bb).clear();
}
// REVIEW: Do we need to ensure that bytesWritten is
Modified: webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/serializer/writer/OutputStreamXmlWriter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/serializer/writer/OutputStreamXmlWriter.java?rev=1844626&r1=1844625&r2=1844626&view=diff
==============================================================================
--- webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/serializer/writer/OutputStreamXmlWriter.java (original)
+++ webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/serializer/writer/OutputStreamXmlWriter.java Tue Oct 23 09:23:40 2018
@@ -20,6 +20,7 @@ package org.apache.axiom.core.stream.ser
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@@ -46,7 +47,8 @@ final class OutputStreamXmlWriter extend
private void flushEncodingOut() throws IOException {
out.write(encoderOut.array(), 0, encoderOut.position());
- encoderOut.clear();
+ // Cast ensures compatibility with Java 8.
+ ((Buffer)encoderOut).clear();
}
private CharBuffer getEncoderIn() throws IOException {
@@ -61,7 +63,8 @@ final class OutputStreamXmlWriter extend
}
private void flush(CharBuffer encoderIn) throws IOException {
- encoderIn.flip();
+ // Cast ensures compatibility with Java 8.
+ ((Buffer)encoderIn).flip();
while (true) {
CoderResult coderResult = encoder.encode(encoderIn, encoderOut, false);
if (coderResult.isUnderflow()) {