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 136222

Summary: generate Setters/Getters methods does not work and throws NPE
Product: java Reporter: hdwang <hdwang>
Component: EditorAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: screen snap for refactor npe dialog box
the IDE log file
the encapsulate fields dialog box which cause error message

Description hdwang 2008-06-01 00:53:07 UTC
in NB6.1,create a class file which named "User.java" and enter codes like this:
public class User{
   private String username;
   private String password;

   public String getUsername(){
      return username;
   }
   public void setUsername(String username){
      this.username=username;
   }

}
choose "Refactor->Encapsulate Fields" menu, in the refactor dialog box,
choose all the fields to generate setter/getters.
After do  above operations,IDE sometimes popup a error dialog(please see the attachment),
and  does  not generate the Setter/Getter method for field password.

I test with other class,it is seemed that if your have a  Setter/Getter methods for a field,
the IDE can not generate  Setters/Getters for the remain fields.
Comment 1 hdwang 2008-06-01 00:55:50 UTC
Created attachment 62213 [details]
screen snap for refactor npe dialog box
Comment 2 hdwang 2008-06-01 00:58:02 UTC
Created attachment 62214 [details]
the IDE log file
Comment 3 hdwang 2008-06-01 04:14:06 UTC
Created attachment 62216 [details]
the encapsulate fields dialog box which cause error message
Comment 4 Jiri Prox 2008-06-02 08:43:27 UTC
This issue is already fixed and the fix will be included in patch 2. Thanks for your report anyway.

*** This issue has been marked as a duplicate of 131619 ***