nicoloboschi commented on a change in pull request #410:
URL: https://github.com/apache/curator/pull/410#discussion_r815698375
##########
File path:
curator-framework/src/main/java/org/apache/curator/framework/imps/GzipCompressionProvider.java
##########
@@ -45,6 +45,23 @@
/** GZIP header magic number. */
private static final int GZIP_MAGIC = 0x8b1f;
+ private static final String JAVA_VERSION_STR =
System.getProperty("java.version", "-1");
+ private static final int JAVA_VERSION;
+ static {
+ if ("1.8".equals(JAVA_VERSION_STR)) {
+ JAVA_VERSION = 8;
+ } else if (JAVA_VERSION_STR.contains("-")) {
+ // e.g. 18-ea, take 18
+ JAVA_VERSION = Integer.parseInt(JAVA_VERSION_STR.split("-", 2)[0]);
+ } else if (JAVA_VERSION_STR.contains(".")) {
+ // e.g. 17.0.1, take 17
+ JAVA_VERSION = Integer.parseInt(JAVA_VERSION_STR.split("\\.",
2)[0]);
+ } else {
+ JAVA_VERSION = Integer.parseInt(JAVA_VERSION_STR, 10);
+ }
+ }
+ private static final byte OS_BIT = JAVA_VERSION >= 16 ? (byte) -1 : 0;
Review comment:
could you add a comment explaining why this is needed ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]