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 150220 - View servlet action doesn't work
Summary: View servlet action doesn't work
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 6.x
Hardware: Sun All
: P1 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-15 13:45 UTC by Jindrich Sedek
Modified: 2008-10-20 08:45 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stacktrace (758 bytes, text/plain)
2008-10-15 13:45 UTC, Jindrich Sedek
Details
logfile (46.83 KB, text/plain)
2008-10-15 13:46 UTC, Jindrich Sedek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jindrich Sedek 2008-10-15 13:45:00 UTC
Create new WebApplication (tomcat or glassfish)
invoke run project
invoke view servlet on index.jsp
NPE is thrown and no code is open in the ditor
Comment 1 Jindrich Sedek 2008-10-15 13:45:37 UTC
Created attachment 71853 [details]
stacktrace
Comment 2 Jindrich Sedek 2008-10-15 13:46:47 UTC
Created attachment 71854 [details]
logfile
Comment 3 Petr Jiricka 2008-10-15 15:22:02 UTC
Reproduced.
Comment 4 Petr Jiricka 2008-10-15 15:43:48 UTC
Jindro, is this a recent regression? Did this work on Oct 9? I suspect this could be related to the fix of issue 149330.
Also cc'ing Jarda.
Comment 5 Jaroslav Tulach 2008-10-15 15:56:56 UTC
The NPE is caused by more strict enforcing of the API contract. Some CloneableEditorSupport.Env.getTime() 
implementation returns null which was never allowed. So the bug belongs to the Env provider.

On the other hand, this is an incompatible change in behaviour in openide.text. However it is needed to prevent data 
loss while editing. What could potentially be done is to print huge warning inspite of generating NPE, but still this 
needs fix in the Env provider.
Comment 6 Martin Schovanek 2008-10-15 16:11:12 UTC
Reproducible in #200810150101 but cannot reproduce in #200810090201.
Comment 7 Tomasz Slota 2008-10-15 16:14:46 UTC
Taking over upon request from pjiricka
Comment 8 Tomasz Slota 2008-10-15 16:22:28 UTC
Fixed in trunk, http://hg.netbeans.org/main/rev/c9e40f248252
Comment 9 Petr Jiricka 2008-10-15 18:03:19 UTC
Thanks many times, Tomasz! Petre P and Jarda, can you please review Tomasz's fix?

My comments on the patch: I see that the default implementation in DataEditorSupport is:

        public Date getTime() {
            // #32777 - refresh file object and return always the actual time
            getFileImpl().refresh(false);
            return getFileImpl ().lastModified ();
        }

which quite matches Tomasz's approach. One question I have is - when will this method be called, and how often? I
believe that the call of getServlet() can be quite slow, so I am not sure if something could get slower by this fix.
Allowing to return null from getTime() would make the implementation faster.

One scenario that should be verified by QE: 
1. run the page
2. open the servlet
3. modify the page and re-run it
-> will the servlet be correctly reloaded in the editor?
Comment 10 Jaroslav Tulach 2008-10-15 18:32:30 UTC
Patch is OK, thanks for creating it so quickly. PS: Slowness should not be problem, moreover definitely not P1 
problem.
Comment 11 Petr Pisl 2008-10-15 18:34:24 UTC
Shouldn't be there the refreshing file as well ?

--- a/web.core/src/org/netbeans/modules/web/core/jsploader/ServletEditor.java	Wed Oct 15 10:24:14 2008 -0700
+++ b/web.core/src/org/netbeans/modules/web/core/jsploader/ServletEditor.java	Wed Oct 15 19:33:13 2008 +0200
@@ -511,6 +511,7 @@
         public Date getTime () {
             DataObject servlet = getServlet();
             if (servlet != null)
+                servlet.getPrimaryFile().refresh(false);
                 return servlet.getPrimaryFile().lastModified();
             else
                 return new Date(System.currentTimeMillis());
Comment 12 Petr Jiricka 2008-10-15 19:10:32 UTC
I believe the getServlet() method does refresh internally, but I am not sure.
Comment 13 Martin Schovanek 2008-10-15 20:01:46 UTC
Verified in: Hudson > trunk > #4068 by QE.
Comment 14 Quality Engineering 2008-10-16 04:12:11 UTC
Integrated into 'main-golden', will be available in build *200810160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c9e40f248252
User: Tomasz Slota <tslota@netbeans.org>
Log: #150220: View servlet action doesn't work
Comment 15 Petr Blaha 2008-10-16 08:07:52 UTC
Tomasz, can you please push the fix in release65 clone and send the e-mail to reviewers? Thanks 
Comment 16 Tomasz Slota 2008-10-16 12:55:13 UTC
Fix integrated into the HR branch

http://hg.netbeans.org/release65/rev/ea0091e07925
Comment 17 Jindrich Sedek 2008-10-20 08:45:22 UTC
verified in m1.
NetBeans IDE 6.5 RC1 (Build 200810171318)