Paul Carter-Brown created NETBEANS-333:
------------------------------------------

             Summary: JAX-RS ApplicationConfig auto-generated 
addRestResourceClasses looses sub resources on mvn clean
                 Key: NETBEANS-333
                 URL: https://issues.apache.org/jira/browse/NETBEANS-333
             Project: NetBeans
          Issue Type: Bug
          Components: webservices - REST
    Affects Versions: 8.2
            Reporter: Paul Carter-Brown


I am experiencing a nasty intermittent bug where Netbeans removes sub resources 
in the auto-generated ApplicationConfig source. This happens intermittently and 
unpredictably when I clean or clean and build the project. It happens about 10% 
of the time. If I close Netbeans and reopen then it rescans the projects and 
adds the lines back. 

 

E.g. normal state:

 

@javax.ws.rs.ApplicationPath("/rest/v1")
public class ApplicationConfig extends javax.ws.rs.core.Application {

@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<>();
addRestResourceClasses(resources);
return resources;
}

/**
* Do not modify addRestResourceClasses() method.
* It is automatically populated with
* all resources defined in the project.
* If required, comment out calling this method in getClasses().
* @param resources Resource list
*/
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(test.TemplateResource.class);
resources.add(test.TemplatesResource.class);
}

}

And then sometime after cleaning the project:

 

@javax.ws.rs.ApplicationPath("/rest/v1")
public class ApplicationConfig extends javax.ws.rs.core.Application {

@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<>();
addRestResourceClasses(resources);
return resources;
}

/**
* Do not modify addRestResourceClasses() method.
* It is automatically populated with
* all resources defined in the project.
* If required, comment out calling this method in getClasses().
* @param resources Resource list
*/
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(test.TemplatesResource.class);
}

}

It never removes normal resources. Only sub resources are removed (ones with no 
@Path annotating the class)

 

Assuming this would be very difficult to fix as its so unpredictable - Is there 
maybe a way I can disable the auto-changing of ApplicationConfig source 0 i.e. 
turn the feature off?

 

Thanks

Paul

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to