Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 325079 - dev-java/jnr-netdb-1.0 uses Java 6 API String.isEmpty
Summary: dev-java/jnr-netdb-1.0 uses Java 6 API String.isEmpty
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-22 15:36 UTC by Martin von Gagern
Modified: 2010-06-27 07:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Java 1.5 compat (gentoo325079.patch,563 bytes, patch)
2010-06-22 15:58 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2010-06-22 15:36:26 UTC
dev-java/jnr-netdb-1.0 won't compile against sun-jdk-1.5, as it makes use of the java.lang.String.isEmpty method which is new in Java 6. Working around this via a langth()==0 check would be easy, so I'd prefer a backwards compatibility patch instead of forcing a dependency of Java 6.

-do-compile:
    [mkdir] Created dir: /var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0/build/empty
    [javac] Compiling 15 source files to /var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0/build/classes
    [javac] /var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0/src/jnr/netdb/NetDBIterator.java:27: cannot find symbol
    [javac] symbol  : method isEmpty()
    [javac] location: class java.lang.String
    [javac]             if (line.length < 0 || line[0].isEmpty()) {
    [javac]                                        ^
    [javac] 1 error

BUILD FAILED
/var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0/nbproject/build-impl.xml:445: The following error occurred while executing this line:
/var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0/nbproject/build-impl.xml:224: Compile failed; see the compiler error output for details.

Total time: 2 seconds
 * ERROR: dev-java/jnr-netdb-1.0 failed:
 *   eant failed
 * 
 * Call stack:
 *     ebuild.sh, line   48:  Called src_compile
 *   environment, line 4424:  Called java-pkg-2_src_compile
 *   environment, line 2439:  Called eant 'jar' '-f' 'build.xml' '-Dreference.jaffl.jar=lib/jaffl.jar' '-Dproject.jaffl="/var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0"' '-D"already.built./var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0"=true'
 *   environment, line  967:  Called die
 * The specific snippet of code:
 *       ant ${antflags} "${@}" || die "eant failed"
 * 
 * If you need support, post the output of 'emerge --info =dev-java/jnr-netdb-1.0',
 * the complete build log and the output of 'emerge -pqv =dev-java/jnr-netdb-1.0'.
!!! When you file a bug report, please include the following information:
GENTOO_VM=sun-jdk-1.5  CLASSPATH="" JAVA_HOME="/opt/sun-jdk-1.5.0.22"
JAVACFLAGS="-source 1.5 -target 1.5" COMPILER="javac"
and of course, the output of emerge --info
 * The complete build log is located at '/var/log/portage/dev-java:jnr-netdb-1.0:20100622-084632.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-java/jnr-netdb-1.0/temp/environment'.
 * S: '/var/tmp/portage/dev-java/jnr-netdb-1.0/work/jnr-netdb-1.0'
Comment 1 Martin von Gagern 2010-06-22 15:58:06 UTC
Created attachment 236257 [details, diff]
Java 1.5 compat

This patch uses String.length() == 0 instead of String.isEmpty(), thereby restoring compatibility with Java 1.5 API. Works for me.

The patch also changes a obviously broken "array.length < 0" check, as an array never has negative length, and as accessing the first element of a length-zero array is an error. Therefore I assume that "line.length <= 0" is intended.

Haven't found an upstream bug tracker, but will write an email to the upstream developer, Wayne Meissner, pointing him to this bug report here.
Comment 2 Martin von Gagern 2010-06-23 07:47:06 UTC
Upstream fixed this in their 1.0.1 tag. Be careful when bumping the ebuild, as it currently has 1.0 hardcoded into the SRC_URI, instead of using ${PV}.
Comment 3 Alistair Bush (RETIRED) gentoo-dev 2010-06-27 07:53:28 UTC
Bumped to 1.0.1.