Community
Participate
Working Groups
Build ID: trunk Steps To Reproduce: 1. Create a C hello-world sample project 2. Select the zero from "return 0;" 3. Right-click, Refactor->Extract Constant... 4. Click Next More information: The NPE is in ChangeGenerator.synthTreatment(), when it hits a modification against a file that isn't in the workspace (in this case, /usr/stdio.h). The fix is to check for null, and if true, throw an UnhandledASTModificationException. (The exception appears to be handled correctly by the caller.)
Created attachment 112255 [details] Patch to test for modifications to files outside of workspace
Your patch look good but I can't reproduce the behavior you have descriped. When you invoke Extract constant in the c file create by the new project wizard the refactoring tried to replace all the 0 in stdio.h? That's not intended and does not happens when i try this.
I was only able to reproduce this on a HEAD build from last week, not current as of yesterday or the last release binary. Since you've been working hard on getting 5.0.1 ready, perhaps there was a small window between commits where this bug surfaced but which is now closed. It doesn't hurt to verify that the file is in the workspace, but it appears that the test isn't required anymore, either. So use your discretion as to whether to accept the patch or close this issue as "cannot reproduce". Thanks for following up on this so quickly.
I applied your patch to 5.0 and HEAD.