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 - RestSupport.addSwdpLibrary gratuitously uses deprecated ProjectClassPathExtender
Summary: RestSupport.addSwdpLibrary gratuitously uses deprecated ProjectClassPathExtender
Status: VERIFIED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Nam Nguyen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-02 21:02 UTC by Jesse Glick
Modified: 2007-08-08 16:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.