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 122476

Summary: refactoring a jsf fragment fails
Product: obsolete Reporter: pepeio <pepeio>
Component: visualwebAssignee: _ sandipchitale <sandipchitale>
Status: VERIFIED FIXED    
Severity: blocker CC: blaha, non_migrated_user, pjiricka, ppisl
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description pepeio 2007-11-21 11:10:22 UTC
I refactored a jspf page fragment in a web project. Customer.jspf was renamed to CustomerFragment.jspf

Now, i have a jasper error:

org.apache.jasper.JasperException: PWC6117: File "/resources/Customer.jspf" not found
        at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73)
        at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359)
        at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153)
        at org.apache.jasper.compiler.JspUtil.getInputStream(JspUtil.java:894)
        at org.apache.jasper.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:127)
        at org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:360)
        at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:194)
        at org.apache.jasper.compiler.ParserController.parse(ParserController.java:140)
        at org.apache.jasper.compiler.JspDocumentParser.processIncludeDirective(JspDocumentParser.java:1376)
        at org.apache.jasper.compiler.JspDocumentParser.parseStandardAction(JspDocumentParser.java:885)
        at org.apache.jasper.compiler.JspDocumentParser.startElement(JspDocumentParser.java:419)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
        at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2740)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
        at org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:203)
        at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:208)
        at org.apache.jasper.compiler.ParserController.parse(ParserController.java:124)
        at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:184)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:409)
        at org.apache.jasper.JspC.processFile(JspC.java:1150)
        at org.apache.jasper.JspC.execute(JspC.java:1319)
        at org.netbeans.modules.web.project.ant.JspC.main(JspC.java:88)
org.apache.jasper.JasperException: PWC6117: File "/resources/Customer.jspf" not found

Error lies in a page using this fragment, which had not been updated:
build/web/GenerateKeys.jsp:                            <jsp:directive.include file="resources/Customer.jspf"/>
Updating the page by hand corrected the problem.
Comment 1 Petr Blaha 2007-11-21 13:59:15 UTC
According Bug guidelines document http://qa.netbeans.org/bugzilla/bug_priority_guidelines.html the issue is P2 then P1.
Anyway, the bug should be fixed in next release or in some patch update.
Comment 2 Petr Pisl 2007-11-27 10:19:28 UTC
I wasn't able to reproduce this issue. Where did you see the exception? 
Comment 3 pepeio 2007-11-28 08:48:43 UTC
Here is how to reproduce the problem under NB6RC2:
Create a web project, select visual web
In your default page1.jsp, drop a "Page Fragment Box" on the page, click on "Create a new Page Fragment", give it 'Test'
as the name.
Now, in the projects tab, select the Test.jsp page, and rename it to TestFragment.jsp
Press f6 and in your compile log you will see the stack dump

Application will nevertheless be deployed.
Comment 4 Petr Pisl 2007-11-28 10:57:57 UTC
Now I understand. The problem is in the refactoring of the visual page. Reassigning. 
Comment 5 _ sandipchitale 2007-11-28 19:15:28 UTC
Hmmm...the refactoring is not handling the case of adjusting the relative path for fragment rename. Fragment move is
working.

The workwaround is to fix the path in JSP editor.
Comment 6 _ sandipchitale 2008-01-02 21:46:40 UTC
Handle the case of inter page references in case of Rename refactoring.
Also fixed handling of /faces/ prefix based references in case Move and Rename refactoring.

Checking in src/org/netbeans/modules/visualweb/insync/faces/refactoring/FacesJspFileMoveRefactoringPlugin.java;
/cvs/visualweb/insync/src/org/netbeans/modules/visualweb/insync/faces/refactoring/FacesJspFileMoveRefactoringPlugin.java,v
 <--  FacesJspFileMoveRefactoringPlugin.java
new revision: 1.12; previous revision: 1.11
done
Checking in src/org/netbeans/modules/visualweb/insync/faces/refactoring/FacesJspFileRenameRefactoringPlugin.java;
/cvs/visualweb/insync/src/org/netbeans/modules/visualweb/insync/faces/refactoring/FacesJspFileRenameRefactoringPlugin.java,v
 <--  FacesJspFileRenameRefactoringPlugin.java
new revision: 1.6; previous revision: 1.5
done
Checking in src/org/netbeans/modules/visualweb/insync/faces/refactoring/FacesRefactoringUtils.java;
/cvs/visualweb/insync/src/org/netbeans/modules/visualweb/insync/faces/refactoring/FacesRefactoringUtils.java,v  <-- 
FacesRefactoringUtils.java
new revision: 1.14; previous revision: 1.13
done
Comment 7 Petr Blaha 2008-01-03 09:17:02 UTC
Reporter, can you verify the fix in the latest daily build? Then, we can include the fix in next NB 6.0 patch. Thanks
Comment 8 pepeio 2008-01-04 05:42:02 UTC
I followed the steps i previously described, which somewhat worked. ( tree node in navigator did not update and was
showing old name). tThat seemed to be the only visible problem, but i cannot swear everything went fine internally (due
to node not updating, mainly)

I don't know if it's related to the refactoring but here it is anyway:
Then, i added a table to the fragment, duplicated the fragment on the page, compiled, ran, suppressed two of the three
fragments i duplicated. ( me evil ;) )
Then i refactored the fragment. The table i added to the fragment started to show incomplete (no bar, ...).
I got a NPE when i tried to remove table. (pressing suppr key). Here is the issue:
http://statistics.netbeans.org/analytics/detail.do?id=8615

Comment 9 _ krystyna 2008-01-07 19:10:09 UTC
Reporter, can you file separate issue on the Navigator issue as well as submit another report against
the NPE http://statistics.netbeans.org/analytics/detail.do?id=8615. I did duplicate the the Navigator
issue but not the NPE, so it would be ideal to have repeatable steps. Otherwise, the main issue of 
refactoring the fragment from the project node has been fixed and runtime no longer produces the
jasper exception.
Comment 10 pepeio 2008-01-09 06:25:00 UTC
Navigator issue got sent:
http://www.netbeans.org/issues/show_bug.cgi?id=124934

i am waiting for the possibility to test extensively the NPE before sending it.
Comment 11 _ sandipchitale 2008-01-09 07:06:29 UTC
Fixed.
Comment 12 _ krystyna 2008-01-09 18:41:54 UTC
Thank you, pepeio, for filing the bug!

Verifying fixed refactoring jsf fragment:  Trunk NetBeans IDE Dev (Build 200801081200)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 13 khu 2008-02-05 23:03:05 UTC
The fixes have been ported into the release601_fixes branch.

Checking in FacesJspFileMoveRefactoringPlugin.java;
/cvs/visualweb/insync/src/org/netbeans/modules/visualweb/insync/faces/refactoring/Attic/FacesJspFileMoveRefactoringPlugin.java,v
 <--  FacesJspFileMoveRefactoringPlugin.java
new revision: 1.11.10.1; previous revision: 1.11
done
Checking in FacesJspFileRenameRefactoringPlugin.java;
/cvs/visualweb/insync/src/org/netbeans/modules/visualweb/insync/faces/refactoring/Attic/FacesJspFileRenameRefactoringPlugin.java,v
 <--  FacesJspFileRenameRefactoringPlugin.java
new revision: 1.5.10.1; previous revision: 1.5
done
Checking in FacesRefactoringUtils.java;
/cvs/visualweb/insync/src/org/netbeans/modules/visualweb/insync/faces/refactoring/Attic/FacesRefactoringUtils.java,v 
<--  FacesRefactoringUtils.java
new revision: 1.13.6.1; previous revision: 1.13
done