Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 117888 - java-config-1 produces python stacktrace when environment is empty
Summary: java-config-1 produces python stacktrace when environment is empty
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2006-01-05 06:40 UTC by Fabian Groffen
Modified: 2006-09-05 18:22 UTC (History)
1 user (show)

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


Attachments
patch for jc_options.py (jc_options.py.diff,505 bytes, patch)
2006-01-05 06:41 UTC, Fabian Groffen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Groffen gentoo-dev 2006-01-05 06:40:27 UTC
When the CLASSPATH, JAVA_HOME and JAVAC variables are missing in the environment java-config -p produces a Python stacktrace.  The aforementioned variables can be unset by the user, or not set at all when in a non-interactive shell (default behaviour by bash and tcsh is not to source any scripts for non-interactive shells).

Together with Stefan Manegold, I figured out that the Ant wrapper script calls `java-config -p`, which then results in:

(pegasus:~) fabian% ssh pegatoo "tcsh -c ant"
Traceback (most recent call last):
  File "/usr/bin/java-config", line 123, in ?
    run(option_list)
  File "/usr/bin/java-config", line 41, in run
    func(args)
  File "/usr/lib/python2.4/site-packages/java_config/jc_options.py", line 337,
in __call__
    print env['CLASSPATH']
  File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
    def __getitem__(self, key): return self.data[key]
KeyError: 'CLASSPATH'
Buildfile: build.xml does not exist!
Build failed

The error itself is reproducable in many ways, simplest to just unset CLASSPATH, JAVA_HOME and JAVAC and then running java-config -p.

I did an attempt to fix this by catching the KeyError and printing an empty line instead.  See my attached patch.
Comment 1 Fabian Groffen gentoo-dev 2006-01-05 06:41:44 UTC
Created attachment 76237 [details, diff]
patch for jc_options.py

small "fix" which at least silences jc_options.py when CLASSPATH is not set
Comment 2 Fabian Groffen gentoo-dev 2006-03-29 09:23:31 UTC
any news/comment on this?
Comment 3 Simon Cooper 2006-08-01 10:20:37 UTC
the patch works for me - instead of printing nothing, I recommend printing an error message ie 'CLASSPATH not set'

Due to java changeover, the error is now caused by java-config-1 -p. This bug does not exist with v2
Comment 4 Josh Nichols (RETIRED) gentoo-dev 2006-09-05 15:57:36 UTC
So, for java-config-1 -p, -p is generally expecting the name of a package to get the classpath for. So, I think there's another bug at work which would cause ant to not pass anything to java-config-1.

So, for now, the patch should suffice.
Comment 5 Josh Nichols (RETIRED) gentoo-dev 2006-09-05 18:22:42 UTC
Fixed in 1.3.5, which should be hitting your local mirrors in the very near future.