Bug 26108 - reader.readLine() returns null while reader.ready() returns true
Summary: reader.readLine() returns null while reader.ready() returns true
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.20
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2006-02-05 18:20 UTC by Egon Willighagen
Modified: 2012-01-10 15:54 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Egon Willighagen 2006-02-05 18:20:51 UTC
cc: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=351551

When I run a CDK based test suite [1], the "OpenSource JVM Test Suite", I get a
NullPointerException, because of this situation:

- reader.ready() returns true
- a subsequent reader.readLine() returns null

The code I deduce this from is:

    protected void loadClassList(String classList) throws Exception {
        classesToTest = new Vector();
        // get the src/core.javafiles file
        BufferedReader reader = new BufferedReader(new InputStreamReader(
        while (reader.ready()) {
            // load them one by one
            String rawClassName = reader.readLine();
            rawClassName = rawClassName.substring(20);
            String className = convertSlash2Dot(
                rawClassName.substring(0, rawClassName.indexOf('.'))

The NullPointerException occurs on this line:

rawClassName = rawClassName.substring(20);

Because rawClassName is null.

This happens with cacao and jamvm, but not with kaffe, so seems a Classpath problem.

Comment 1 Mark Wielaard 2006-02-05 21:53:45 UTC
Could you add more context. I cannot replicate this. I tried downloading the src/core.javafiles file from the cdt test suite, but even with this file I cannot make this particular snippet of code fail.

If you have a standalone example that would help. Or if you have some simple instructions for running the whole test suite plus steps to get to this particular failure.
Comment 2 Egon Willighagen 2006-02-06 08:03:41 UTC
Argg... forgot to give [1]:


It contains two CDK jars and a script to run the test suite. The above bug occurs with 'benchmark II'. See also the README in that distrib.

BTW, the *.javafiles are generated from the CDK sources by running:

ant runDoclet

CDK's build.xml should automatically pick up gjdoc.