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 103176

Summary: RestSupport.addSwdpLibrary gratuitously uses deprecated ProjectClassPathExtender
Product: webservices Reporter: Jesse Glick <jglick>
Component: RESTAssignee: Nam Nguyen <nnguyen>
Status: VERIFIED FIXED    
Severity: blocker    
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Jesse Glick 2007-05-02 21:02:09 UTC
This code:

ProjectClassPathExtender pce =
project.getLookup().lookup(ProjectClassPathExtender.class);
ProjectClassPathModifierImplementation pcm =
project.getLookup().lookup(ProjectClassPathModifierImplementation.class);
if (pcm != null) {
    for (String type : classPathTypes) {
        ProjectClassPathModifier.addLibraries(new Library[] { swdpLibrary },
sourceRoot, type);
    }
} else if (pce != null) {
    pce.addLibrary(swdpLibrary);
} else{
    throw new IllegalStateException("Current project does not have support " +
            "for ProjectClassPathModifier or ProjectClassPathExtender");
}

can simply be replaced with

for (String type : classPathTypes) {
    ProjectClassPathModifier.addLibraries(new Library[] { swdpLibrary },
sourceRoot, type);
}

PCPM.aL already checks for both PCPMI and PCPE in lookup and insulates client
code from future SPI changes.
Comment 1 Nam Nguyen 2007-07-17 07:40:52 UTC
Fixed as suggested.
Comment 2 Lukas Jungmann 2007-08-08 16:42:41 UTC
v.