Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snappy-java 1.1.9.0 Can't work with Java 8 #389

Closed
LuciferYang opened this issue Jan 31, 2023 · 6 comments · Fixed by #390
Closed

snappy-java 1.1.9.0 Can't work with Java 8 #389

LuciferYang opened this issue Jan 31, 2023 · 6 comments · Fixed by #390

Comments

@LuciferYang
Copy link

LuciferYang commented Jan 31, 2023

I wrote a simple demo to reproduce this issue, the demo is in https://github.com/LuciferYang/snappy-java-test

The test code as follows:

@Test
 public void testCompress() throws IOException {
        ByteBuffer src = ByteBuffer.allocateDirect(1024);
        src.put("hello world".getBytes());
        src.flip();
        ByteBuffer dest = ByteBuffer.allocateDirect(1024);
        int maxCompressedLen = Snappy.compress(src, dest);
        Assert.assertEquals(maxCompressedLen, 13);
    }

run the above case with zulu 8u352

java -version
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (Zulu 8.66.0.15-CA-macos-aarch64) (build 1.8.0_352-b08)
OpenJDK 64-Bit Server VM (Zulu 8.66.0.15-CA-macos-aarch64) (build 25.352-b08, mixed mode)

run mvn clean test -Dsnappy-java.version=1.1.8.4 with Java 8 will pass

run mvn clean test -Dsnappy-java.version=1.1.9.0 with Java 8 will failed as follows:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.example.SnappyJavaTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.374 sec <<< FAILURE!
testCompress(org.example.SnappyJavaTest)  Time elapsed: 0.345 sec  <<< ERROR!
java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
	at org.xerial.snappy.Snappy.compress(Snappy.java:157)
	at org.example.SnappyJavaTest.testCompress(SnappyJavaTest.java:17)

run mvn clean test -Dsnappy-java.version=1.1.9.0 with Java 11 will pass

@LuciferYang LuciferYang changed the title 1.1.9.0 Can't work with Java 8 snappy-java 1.1.9.0 Can't work with Java 8 Jan 31, 2023
@LuciferYang
Copy link
Author

cc @dongjoon-hyun I create a issue for snappy-java 1.1.9.0 run with Java 8

I'm not sure whether this is unexpected. Let's wait for @xerial

@xerial
Copy link
Owner

xerial commented Jan 31, 2023

Ok. It hits a well-known issue of ByteBuffer incompatibility between JDK8 and later #390

@xerial
Copy link
Owner

xerial commented Jan 31, 2023

Releasing https://github.com/xerial/snappy-java/releases/tag/v1.1.9.1 with a fix for this

@LuciferYang
Copy link
Author

Thanks @xerial

@dongjoon-hyun
Copy link

Thank you, @LuciferYang and @xerial .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants