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 101395 - NPE in CasualDiff.isCommaSeparated
Summary: NPE in CasualDiff.isCommaSeparated
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Pavel Flaska
: 101725 102202 102813 107350 (view as bug list)
Depends on:
Blocks: 90254 102202 104449 107039 107562
  Show dependency tree
Reported: 2007-04-17 15:45 UTC by Jan Pokorsky
Modified: 2007-06-22 16:11 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

NPE (2.05 KB, text/plain)
2007-04-17 15:47 UTC, Jan Pokorsky
Applied workaround. (2.24 KB, application/octet-stream)
2007-04-25 15:32 UTC, Pavel Flaska

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Pokorsky 2007-04-17 15:45:43 UTC
I get following NPE.
Comment 1 Jan Pokorsky 2007-04-17 15:47:19 UTC
Created attachment 41097 [details]
Comment 2 Jan Pokorsky 2007-04-17 16:02:37 UTC
I am adding a new field to empty class

ElementHandle<VariableElement> handle = ...;
VariableElement elm = handle.resolve(wc);
Tree tree = SourceUtils.treeFor(wc, elm);
List<Tree> members = new ArrayList<Tree>();
ClassTree newClassTree = make.Class(

Here is the debugger output.
old class tree:

public class NewClassEx {
    public NewClassEx() {

new class tree:

public class NewClassEx extends newpackage.NewSuperClass {
    public int public_field;
Comment 3 Pavel Flaska 2007-04-19 09:03:25 UTC
Reproducible. Temporary fix exists.
Comment 4 Pavel Flaska 2007-04-19 11:05:42 UTC
*** Issue 101725 has been marked as a duplicate of this issue. ***
Comment 5 Milan Kuchtiak 2007-04-24 17:07:36 UTC
*** Issue 102202 has been marked as a duplicate of this issue. ***
Comment 6 Milan Kuchtiak 2007-04-24 17:10:50 UTC
Changing priority to P1 (as issue 102202 is P1).
This has a bad impact on WS Client code that isn't generated correctly.
Isn't that possible to fix this to M9 ?
Comment 7 Andrey Yamkovoy 2007-04-24 18:10:45 UTC
This issue is stopper for J1 preview release (Identity module).
Comment 8 Pavel Flaska 2007-04-25 09:11:43 UTC
It is related to detection of fields separated by commas. Unfortunately I do not
have simple solution. I'm able to fix it, but it will broke other things.
(Currently renaming of enum constant.) I have thought about the final solution
and have some idea, but it is not bug fix, there has to be done more work than
just changing several lines. When I'll be available, I'll try to find some
hacking stuff.
Comment 9 Pavel Flaska 2007-04-25 14:14:00 UTC

Checking in test/unit/src/org/netbeans/api/java/source/gen/;
new revision: 1.25; previous revision: 1.24
Comment 10 Pavel Flaska 2007-04-25 14:18:32 UTC
Milane, is it newly created field or was it found in different source and
replaced to the first one?
Comment 11 Pavel Flaska 2007-04-25 14:50:04 UTC
I was unable to reproduce it with my test-case. It looks like test-case does not
cover the same scenario. Also, I was unable to reproduce it in current trunk
build. We are trying to reproduce it with Honza.
Comment 12 Pavel Flaska 2007-04-25 15:31:29 UTC
Checking in
new revision: 1.3; previous revision: 1.2
Comment 13 Pavel Flaska 2007-04-25 15:32:53 UTC
Created attachment 41636 [details]
Applied workaround.
Comment 14 Pavel Flaska 2007-04-25 15:50:46 UTC
Workaround exists, see commit to refactoring/java or attachement. It doesn't
mean that issue is finished, we still plan to fix it correctly. For the time
being, please, use workaround if you need immediate fix. Removing
PREVIEW_STOPPER and changing priority back to P2.

(Only what you need is not to put the found tree to different places. Make a
copy of it.)
Comment 15 Lukas Jungmann 2007-04-27 19:16:15 UTC
*** Issue 102813 has been marked as a duplicate of this issue. ***
Comment 16 Jiri Prox 2007-05-25 15:25:51 UTC
Should be this fixed now? I've found reproducible testcase in actual build. Just
call Pull Up on class with two methods and two fields and select all to be
Comment 17 Milan Kuchtiak 2007-06-20 10:45:13 UTC
Please, would it be possible to fix that for M10 ?
See the issue 107039.
I applied a workarond suggested in this issue but, apparently, this didn't help.
Comment 18 Pavel Flaska 2007-06-20 11:22:01 UTC
I'm not sure, perhaps no.
Comment 19 Pavel Flaska 2007-06-20 13:36:50 UTC
*** Issue 107350 has been marked as a duplicate of this issue. ***
Comment 20 Pavel Flaska 2007-06-20 13:40:15 UTC
Priority increased because of P1 duplicate.
Comment 21 Pavel Flaska 2007-06-22 10:51:02 UTC
Anyone has a simple straight-forward reproducible test-case? I'm trying to figure out the test for it, but still I'm not
Comment 22 Lukas Jungmann 2007-06-22 11:42:48 UTC
Not so straightforward, but reliably reproducible with following steps:

-have an IDE with enterprise cluster
-create new Java EE 5 web project (you'll need glassfish for this -
-create new file -> web services -> web service client (you can use this wsdl URL:
-create new servlet
-invoke web service client resources -> Call ws operation from editor's context menu within processRequest method in the
servlet, choose eg. getZipinfoSoap in the dialog which appears and press OK

=> reported NPE

You can also try to check generateServiceRefInjection method in JaxWsCodeGenerator class from websvc/core module from
where this NPE is being thrown, this could maybe save you some time....

Hope this somehow helps
Comment 23 Pavel Flaska 2007-06-22 13:55:05 UTC
Preventing NPE. Hacking stuff, should work for you right now.

Checking in org/netbeans/modules/java/source/save/;
/cvs/java/source/src/org/netbeans/modules/java/source/save/,v  <--
new revision: 1.143; previous revision: 1.142
Comment 24 Pavel Flaska 2007-06-22 14:20:28 UTC
Thanks to Honza Stola and Lukas Jungmann for test-cases, I used Honza's test-case to reproduce the issue. (Glassfish
installation and Enterprise cluster compiling was exactly what I didn't want to do. ;-) It takes too long.) Please,
reopen, if you are able to reproduce it in another testcase.
Comment 25 Pavel Flaska 2007-06-22 15:19:03 UTC
Still reproducible in Lukas' test-case. Another hack, now it will be hopefully correct.

Checking in src/org/netbeans/modules/java/source/save/;
/cvs/java/source/src/org/netbeans/modules/java/source/save/,v  <--
new revision: 1.144; previous revision: 1.143
Comment 26 Lukas Jungmann 2007-06-22 16:11:42 UTC
That's it, thank you a lot, Pavel! :)

Since I'm not able to reproduce this any more in any test case I have, I'm marking this as verified.
We will reopen this if we find some new test case for this (if there will be any, but I hope there won't be ;)...)