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 134750 - REST support get unintentionally turned on
Summary: REST support get unintentionally turned on
Status: VERIFIED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 6.x
Hardware: Sun All
: P1 blocker (vote)
Assignee: Peter Liu
URL:
Keywords:
: 135284 135593 138952 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-05-08 22:39 UTC by Nam Nguyen
Modified: 2008-07-10 15:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed fix (1.40 KB, text/plain)
2008-05-08 23:10 UTC, Nam Nguyen
Details
A better patch? (2.82 KB, text/plain)
2008-05-10 00:14 UTC, Peter Liu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nam Nguyen 2008-05-08 22:39:27 UTC
- Using NB 6.1 FCS
- Create Web project
- Open the web.xml in XML view (optional to verify the inserted content).
- Create empty Java class
- type in 'aPath' in the java source editor
- depending on how busy is the system, after a while the ServletAdaptor declaration is insterted into the web.xml content.
- Also Jersey library is added to the project
Comment 1 Nam Nguyen 2008-05-08 23:10:02 UTC
Created attachment 61175 [details]
Proposed fix
Comment 2 Nam Nguyen 2008-05-08 23:13:07 UTC
I believe this patch is a quick fix while waiting for the real fix by issue 126300.
Comment 3 Peter Liu 2008-05-10 00:14:06 UTC
Created attachment 61203 [details]
A better patch?
Comment 4 Peter Liu 2008-05-10 00:19:28 UTC
Hi Nam, I think the patch I just attached is a better solution. So, basically, the patch checks one character before the
error to see if it is a "@" before adding it to the diagnostics. I also used string equals instead of contains for match
with jsr311 annotation.  
Comment 5 Nam Nguyen 2008-05-10 02:14:50 UTC
Having seen some large system code, I saw they do define their own annotation.  We definitely don't want to risk the
collision due to lack of qualified path.  We also need to take care of case code has 'import javax.ws.rs.*;'
Another code review side point that it would be good to preserve the generic purpose of method
getDiagnostics(FileObject) or if you are sure no other code path use it (It's been a while, I don't remember), you could
rename it to reflect what it actually doing.  .
Comment 6 Peter Liu 2008-05-10 03:58:18 UTC
Hi Nam, I think the patch I just attached is a better solution. So, basically, the patch checks one character before the
error to see if it is a "@" before adding it to the diagnostics. I also used string equals instead of contains for match
with jsr311 annotation.  
Comment 7 Lukas Jungmann 2008-05-12 11:48:17 UTC
Can't we only turn rest support on if and only if user finish some REST services related wizard and if user creates some
class, add ie @Path there then leave it up to the user what (s)he will do (in this case (s)he mostly knows what (s)he's
doing...)? 
Comment 8 Nam Nguyen 2008-05-12 17:04:00 UTC
So far we have 3 proposals:
(1) With my proposed fix, REST support is turned on when user type @javax.ws.rs.Path or import javax.ws.rs.Path.
(2) With Peter's patch,  REST support is turned on when user type @Path, but NOT with import javax.ws.rs.Path.
  (Similarly in both patches, with @GET, @PUT, @POST, @DELETE).
(3) Lukas proposal would be leaving its up to use to manually change web.xml and add REST library (of course, the wizard
currently already add REST support, exception are REST samples).

I would go with (3) if we could have a friendly mechanism to turn only REST.  Otherwise, (1) is more accurate than (2).
 Who know that some users meant to use another @my.org.Path annotation.




Comment 9 Peter Liu 2008-05-12 21:59:02 UTC
Fix checked into trunk:

http://hg.netbeans.org/main/rev/ada8b796820d

Note that we decided to go with Nam's patch. 
Comment 10 Lukas Jungmann 2008-05-13 16:22:15 UTC
v.
Comment 11 Lukas Jungmann 2008-05-22 13:08:48 UTC
*** Issue 135593 has been marked as a duplicate of this issue. ***
Comment 12 pslechta 2008-05-27 15:01:15 UTC
The fix has been ported into the release61_fixes repository.

http://hg.netbeans.org/release61_fixes/rev/1b66ee79c846
Comment 13 Peter Liu 2008-05-27 23:39:43 UTC
*** Issue 135284 has been marked as a duplicate of this issue. ***
Comment 14 Jaroslav Pospisil 2008-06-19 12:57:55 UTC
Verified in Patch 2.
Comment 15 Lukas Jungmann 2008-07-03 15:50:35 UTC
*** Issue 138952 has been marked as a duplicate of this issue. ***