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

Fix ByteBuffer errors to be compatible with Java 8 runtimes #937

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.46.3] - 2023-09-26
- Fix ByteBuffer errors to be compatible with Java 8 runtimes.

## [29.46.2] - 2023-09-25
- add service/cluster-not-found count to simple load balancer jmx. And add entry-out-of-sync count to dual read monitoring.

Expand Down Expand Up @@ -5536,7 +5539,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.46.2...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.46.3...master
[29.46.3]: https://github.com/linkedin/rest.li/compare/v29.46.2...v29.46.3
[29.46.2]: https://github.com/linkedin/rest.li/compare/v29.46.1...v29.46.2
[29.46.1]: https://github.com/linkedin/rest.li/compare/v29.46.0...v29.46.1
[29.46.0]: https://github.com/linkedin/rest.li/compare/v29.45.1...v29.46.0
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.46.2
version=29.46.3
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import java.net.URI;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.Buffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.util.ArrayList;
Expand Down Expand Up @@ -831,7 +832,9 @@ private static ByteBuffer decodePercentEncodedOctets(String s, int i, ByteBuffer
if (bb == null)
bb = ByteBuffer.allocate(1);
else
bb.clear();
// Fix java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer based on the suggestions from
// https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip
((Buffer)bb).clear();

while (true) {
// Decode the hex digits
Expand All @@ -849,16 +852,19 @@ private static ByteBuffer decodePercentEncodedOctets(String s, int i, ByteBuffer

// Check if the byte buffer needs to be increased in size
if (bb.position() == bb.capacity()) {
bb.flip();
// Fix java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer based on the suggestions from
// https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip
((Buffer)bb).flip();
// Create a new byte buffer with the maximum number of possible
// octets, hence resize should only occur once
ByteBuffer bb_new = ByteBuffer.allocate(s.length() / 3);
bb_new.put(bb);
bb = bb_new;
}
}

bb.flip();
// Fix java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer based on the suggestions from
// https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip
((Buffer)bb).flip();
return bb;
}

Expand Down
Loading