This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 61795 - NPE on line where "variable V might not have been initialized"
Summary: NPE on line where "variable V might not have been initialized"
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Hurka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-04 12:22 UTC by Antonin Nebuzelsky
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NPE stacktrace (1.15 KB, text/plain)
2005-08-04 12:23 UTC, Antonin Nebuzelsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antonin Nebuzelsky 2005-08-04 12:22:11 UTC
I get the attached NPE from Hints on a line where there is an error that the
variable might have not been initialized.
Comment 1 Antonin Nebuzelsky 2005-08-04 12:23:28 UTC
Created attachment 23493 [details]
NPE stacktrace
Comment 2 Pavel Flaska 2005-08-04 13:01:03 UTC
I tried it and it seems it works. My test code was

 Object o;
 String s = (String) o;

So closing as WORKSFORME. Please, provide always part of your code where problem
was found, as you cannot generalize that if it does not work in your particular
case, it does not work always. This will allow us to fix the problem instead of
closing because of insufficient information.
Comment 3 Antonin Nebuzelsky 2005-08-04 13:17:07 UTC
My code snippet where this happens:

...
	        BufferedReader in;
	        try {
	            in = new BufferedReader(new FileReader(portFile));
	        } catch (FileNotFoundException ex) {
	            ex.printStackTrace();
	        }
	        String check;
	        try {
	            check = in.readLine();
	        } catch (IOException ex) {
	            ex.printStackTrace();
	        }
...

on the line where check variable is initialized.
Comment 4 Pavel Flaska 2005-08-04 13:26:45 UTC
When I use the code, it still works.
But when I tried your steps to reporoduce it in jEdit.java file, I was able to
reproduce. Source contains 'tab' characters, which can cause the bug.
Comment 5 Pavel Flaska 2005-08-17 09:14:21 UTC
It was caused by bug in try wrapper, but the problem occurs later. Fixed.

Checking in src/org/netbeans/modules/javacore/TryWrapper.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/TryWrapper.java,v  <-- 
TryWrapper.java
new revision: 1.15; previous revision: 1.14
done
Comment 6 Quality Engineering 2007-09-20 10:49:35 UTC
Reorganization of java component