mina-sshd
mina-sshd copied to clipboard
OsUtils#isAndroid() returns false on WearOS
Version
2.12.1
Bug description
I noticed that ExceptionUtils#peelException() returns a somewhat weird exception on my GW6 (java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/management/ReflectionException)
, after digging into its code I found that this code got triggered when its not supposed to
// Android does not have these classes
if (!OsUtils.isAndroid()) {
if (t instanceof ReflectionException) {
Throwable target = ((ReflectionException) t).getTargetException();
if (target != null) {
return peelException(target);
}
} else if (t instanceof MBeanException) {
Throwable target = ((MBeanException) t).getTargetException();
if (target != null) {
return peelException(target);
}
}
}
After inspecting it by debug logs, I found out that OsUtils#isAndroid() returns false when its supposed to be true
Actual behavior
It returns false
Expected behavior
It returns true?
Relevant log output
FATAL EXCEPTION: main
Process: top.apip.sftpserver, PID: 27567
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/management/ReflectionException;
at org.apache.sshd.common.util.ExceptionUtils.peelException(ExceptionUtils.java:126)
at org.apache.sshd.common.util.ExceptionUtils.peelException(ExceptionUtils.java:118)
at org.apache.sshd.common.util.security.SecurityEntityFactory$1.getInstance(SecurityEntityFactory.java:93)
at org.apache.sshd.common.util.security.SecurityUtils.getKeyAgreement(SecurityUtils.java:772)
at org.apache.sshd.common.kex.MontgomeryCurve.<init>(MontgomeryCurve.java:121)
at org.apache.sshd.common.kex.MontgomeryCurve.<clinit>(MontgomeryCurve.java:95)
at org.apache.sshd.common.kex.BuiltinDHFactories$13.isSupported(BuiltinDHFactories.java:260)
at org.apache.sshd.common.NamedFactory.lambda$setUpTransformedFactories$0(NamedFactory.java:54)
at org.apache.sshd.common.NamedFactory$$ExternalSyntheticLambda0.test(D8$$SyntheticClass:0)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:184)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:475)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:236)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:517)
at org.apache.sshd.common.NamedFactory.setUpTransformedFactories(NamedFactory.java:56)
at org.apache.sshd.server.ServerBuilder.setUpDefaultKeyExchanges(ServerBuilder.java:178)
at org.apache.sshd.server.ServerBuilder.fillWithDefaultValues(ServerBuilder.java:119)
at org.apache.sshd.server.ServerBuilder.fillWithDefaultValues(ServerBuilder.java:58)
at org.apache.sshd.common.BaseBuilder.build(BaseBuilder.java:273)
at org.apache.sshd.server.ServerBuilder.build(ServerBuilder.java:151)
at org.apache.sshd.server.ServerBuilder.build(ServerBuilder.java:58)
at org.apache.sshd.common.BaseBuilder.build(BaseBuilder.java:297)
at org.apache.sshd.server.SshServer.setUpDefaultServer(SshServer.java:442)
at top.apip.sftpserver.presentation.MainActivityKt.SetupSftpServer(MainActivity.kt:135)
at top.apip.sftpserver.presentation.ComposableSingletons$MainActivityKt$lambda-1$1.invoke(MainActivity.kt:67)
at top.apip.sftpserver.presentation.ComposableSingletons$MainActivityKt$lambda-1$1.invoke(MainActivity.kt:66)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:428)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:195)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:119)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:118)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
Other information
No response
I think this was fixed in #476. Please try the 2.13.0-SNAPSHOT version available from the Apache Snapshot maven repository.