diff --git a/apache-sshd-2.4.0-java8.patch b/apache-sshd-2.4.0-java8.patch new file mode 100644 index 0000000..eeb8505 --- /dev/null +++ b/apache-sshd-2.4.0-java8.patch @@ -0,0 +1,75 @@ +--- apache-sshd-2.4.0/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Session.java 2020-07-16 23:25:44.981904289 +0200 ++++ apache-sshd-2.4.0/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Session.java 2020-07-16 23:49:34.043250054 +0200 +@@ -362,13 +362,13 @@ + if (debugEnabled) { + log.debug("handleReadCycleCompletion({}) read {} bytes", this, result); + } +- buffer.flip(); ++ ((java.nio.Buffer)buffer).flip(); + + IoHandler handler = getIoHandler(); + handler.messageReceived(this, bufReader); + if (!closeFuture.isClosed()) { + // re-use reference for next iteration since we finished processing it +- buffer.clear(); ++ ((java.nio.Buffer)buffer).clear(); + doReadCycle(buffer, completionHandler); + } else { + if (debugEnabled) { +--- apache-sshd-2.4.0/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpRemotePathChannel.java 2020-07-16 23:25:44.961904157 +0200 ++++ apache-sshd-2.4.0/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpRemotePathChannel.java 2020-07-16 23:38:16.702818800 +0200 +@@ -20,6 +20,7 @@ + package org.apache.sshd.client.subsystem.sftp; + + import java.io.IOException; ++import java.nio.Buffer; + import java.nio.ByteBuffer; + import java.nio.MappedByteBuffer; + import java.nio.channels.AsynchronousCloseException; +@@ -123,7 +124,7 @@ + int read = sftp.read(handle, curPos, wrap.array(), wrap.arrayOffset() + wrap.position(), wrap.remaining()); + if (read > 0) { + if (wrap == buffer) { +- wrap.position(wrap.position() + read); ++ ((Buffer)wrap).position(wrap.position() + read); + } else { + buffer.put(wrap.array(), wrap.arrayOffset(), read); + } +@@ -191,7 +192,7 @@ + int written = wrap.remaining(); + sftp.write(handle, curPos, wrap.array(), wrap.arrayOffset() + wrap.position(), written); + if (wrap == buffer) { +- wrap.position(wrap.position() + written); ++ ((Buffer)wrap).position(wrap.position() + written); + } + curPos += written; + totalWritten += written; +--- apache-sshd-2.4.0/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpSubsystemHelper.java 2020-07-16 23:25:44.961904157 +0200 ++++ apache-sshd-2.4.0/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpSubsystemHelper.java 2020-07-16 23:51:17.255925762 +0200 +@@ -980,7 +980,7 @@ + if (remainLen < digestBuf.length) { + bb = ByteBuffer.wrap(digestBuf, 0, remainLen); + } +- bb.clear(); // prepare for next read ++ ((java.nio.Buffer)bb).clear(); // prepare for next read + + int readLen = channel.read(bb); + if (readLen < 0) { +@@ -1005,7 +1005,7 @@ + if (remainLen < digestBuf.length) { + bb = ByteBuffer.wrap(digestBuf, 0, remainLen); + } +- bb.clear(); // prepare for next read ++ ((java.nio.Buffer)bb).clear(); // prepare for next read + + int readLen = channel.read(bb); + if (readLen < 0) { +@@ -1140,7 +1140,7 @@ + if (remainLen < digestBuf.length) { + bb = ByteBuffer.wrap(digestBuf, 0, remainLen); + } +- bb.clear(); // prepare for next read ++ ((java.nio.Buffer)bb).clear(); // prepare for next read + + int readLen = channel.read(bb); + if (readLen < 0) { diff --git a/apache-sshd.changes b/apache-sshd.changes index 4a26d6b..43b9d53 100644 --- a/apache-sshd.changes +++ b/apache-sshd.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Jul 16 21:58:44 UTC 2020 - Fridrich Strba + +- Added patch: + * apache-sshd-2.4.0-java8.patch + + restore Java 8 compatibility of bytecode generated by Java 9+ + ------------------------------------------------------------------- Mon Jun 29 11:32:37 UTC 2020 - Fridrich Strba diff --git a/apache-sshd.spec b/apache-sshd.spec index 65c90ba..f2ccaab 100644 --- a/apache-sshd.spec +++ b/apache-sshd.spec @@ -27,6 +27,7 @@ URL: https://mina.apache.org/sshd-project Source0: https://archive.apache.org/dist/mina/sshd/%{version}/apache-sshd-%{version}-src.tar.gz # Avoid optional dep on tomcat native APR library Patch0: 0001-Avoid-optional-dependency-on-native-tomcat-APR-libra.patch +Patch1: apache-sshd-2.4.0-java8.patch BuildRequires: fdupes BuildRequires: maven-local BuildRequires: mvn(junit:junit) @@ -58,6 +59,7 @@ This package provides %{name}. %prep %setup -q +%patch1 -p1 # Avoid optional dep on tomcat native APR library %patch0 -p1