Bug#918705: URL parsing fails with NoSuchMethodError on Java 8

Timo Kalliomäki timoka10 at gmail.com
Tue Jan 8 13:25:20 GMT 2019


Package: libhttpclient-java
Version: 4.5.6-1
Severity: important

Dear Maintainer,

The parsing functionality under URLEncodedUtils fails when running under Java 8.
This seems to be due to the return type of java.nio.ByteBuffer.flip() having
changed (covariant), so that the bytecodes of 11 and 8 are not compatible.

I stumbled upon this when trying to use Maven from the Debian repository in a
Java 8 project, but here's a minimal NWE:
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
 import org.apache.http.client.utils.URLEncodedUtils;
 public class UrlParsing {
   public static void main(String[] args) {
     URLEncodedUtils.parse("http://example.com/?key=value",
StandardCharsets.US_ASCII);
   }
 }
yields the following:
 Exception in thread "main" java.lang.NoSuchMethodError:
java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
       at org.apache.http.client.utils.URLEncodedUtils.urlDecode(URLEncodedUtils.java:590)
       at org.apache.http.client.utils.URLEncodedUtils.decodeFormFields(URLEncodedUtils.java:619)
       at org.apache.http.client.utils.URLEncodedUtils.parse(URLEncodedUtils.java:316)
       at org.apache.http.client.utils.URLEncodedUtils.parse(URLEncodedUtils.java:249)
       at UrlParsing.main(UrlParsing.java:7)

Br,
Timo


-- System Information:
Debian Release: buster/sid
 APT prefers testing
 APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8),
LANGUAGE= (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libhttpclient-java depends on:
ii  libcommons-codec-java    1.11-1
ii  libcommons-logging-java  1.2-2
ii  libhttpcore-java         4.4.10-1

libhttpclient-java recommends no packages.

libhttpclient-java suggests no packages.

-- no debconf information



More information about the pkg-java-maintainers mailing list