Accepting request 821368 from Java:packages

Restore java 8 compatibility

OBS-URL: https://build.opensuse.org/request/show/821368
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/apache-sshd?expand=0&rev=2
This commit is contained in:
Dominique Leuenberger 2020-07-17 18:49:51 +00:00 committed by Git OBS Bridge
commit 36305a07f4
3 changed files with 84 additions and 0 deletions

View File

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

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jul 16 21:58:44 UTC 2020 - Fridrich Strba <fstrba@suse.com>
- 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 <fstrba@suse.com>

View File

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