- This topic has 8 replies, 2 voices, and was last updated 18 years, 1 month ago by Riyad Kalla.
-
AuthorPosts
-
rogue_devMemberIf I have the following:
<% String myVariable="Message"; %> ... a whole bunch of HTML tags, other Java code, Javascript, etc ... <%= myVariable%>
I get a warning that myVariable is never read.
Eclipse 3.2 ME 5.0.1GA(Pro)
Riyad KallaMemberCan you reproduce this in a page that I can use on my side for testing? Using the code snippet above and putting some hodge-podge testing code in the middle is not duplicating the problem for me.
rogue_devMemberOk. Here are four files which give me the error:
File _setup.jspf<% // try to prevent all caching! response.addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT"); response.addHeader("Cache-Control","no-store, no-cache, must-revalidate"); response.addHeader("Cache-Control","post-check=0, pre-check=0"); response.addHeader("Cache-Control","private"); response.addHeader("Pragma","no-cache"); %>
File _header.jspf
<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Strict//EN" SYSTEM "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-strict.dtd"> <html> <head> <title><%= pageTitle %></title> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="Author" content="The Rogue" /> <meta name="Copyright" content="CopyRight" /> </head> <% if ( showBasePath ) ) { %> <!-- BP: <%= basePath %> --> <% } else {} %> <body onload="app_page_setup()"> <center> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <table border="0" width="100%"> <tr> <td> <!-- content starts -->
File _footer.jspf
<!-- content ends --> </td> </tr> </table> </td> </tr> </table> </body> </html>
File test.jsp
<%@ include file="_setup.jspf"%> <% String pageTitle = "Page Title"; boolean showBasePath = true; %> <%@ include file="_header.jspf" %> The page title is <%= pageTitle %> <%@ include file="_footer.jspf"%>
A couple of things here.
The variables basePath and showBasePath have warnings that they are never used.
I validated this from the root of all my JSP pages (114 of them). I am getting some warnings within this _setup.jsp file which cannot possibly be there. Things like “The import ca.site.MyClass is never used”. If I clear all validation markers, then run the validation only from the directory where these four files are, I do not get this warning.
Note that I have placed an empty block after the else within _header.jspf. This does not cause a warning (my other bug).
Further to the empty block warning. This is shown as occuring in my real _header.jspf. This file has about 300 lines. I have gone through all the validation markers in the editor (both in the right column and the left column). None of them has the empty block warning, so I cannot narrow down which line is causing the warning.
I currently have 114 JSP/JSPF files. I have over 700 warnings. Now some of these will be duplicates as they point to included files (over 120 empty blocks…).
Note that ME 4.x did not give any of these warnings. In ME 4.x the entire site validation was slow (about 1 – 2 seconds per JSP, so 1.5 minutes). ME 5.x is a lot faster so I am guessing that you are caching the JSP/JSPF code then compiling in memory, rather than calling the external javac for each JSP. Yet Tomcat does use the external javac.
Can I have the option of which validation method is used? I can live with the slowness, but going through all these warnings trying to find other warnings is a real pain. So I run the ME validation, look for errors, then I clear all the validation markers. What with all the mouse clicks, the entire process is not really any faster for me.
Riyad KallaMemberrogue,
I was able to reproduce the problem with the basePath variable, thank you for submitting the example (note: you have an extra “)” char in your header in that if-statement that causes a compilation error but not a big deal)Also we have a lot of enhancements and fixes planned for the validation moving forward. I have to appologiize for all the noise that they are currently causing, things will absolutely get better faster going forward with the 5.1 release and beyond. All I can offer is that the work is far from done and bug fixes, options and enhancements will make their way in.
Right now I don’t have a solution for you and hate that as erroneous bugs during development are so frustrating.
On last thing, but I think you know this, is that JSPF are validated after being inserted into the final JSP page that includes them and the errors are reported against the main JSP page itself, however it should correctly indicate the include as the cause with a red underline. is this happening?
rogue_devMember(note: you have an extra “)” char in your header in that if-statement that causes a compilation error but not a big deal)
Of course. Well it was never meant to run, it is just to show the warning.
The extra bracket shows up as an error in test.jsp. Nothing in _header.jspf is shown as being wrong (other than all the spelling warnings. sigh)
—-
Ok, try this (with Remove Validation Markers and Run Validate between each step):
– remove the extra bracket in _header.jspf
– in test.jsp add an ‘x’ to the variable pageTitle in “<%= pageTitle %> “. This will cause an error.
– remove the else{} in _header.jspf
– remove the x in test.jspI am now getting a warning that there is an undocumented empty block in _header.jspf
Note that I did start Eclipse with -clean
Riyad KallaMemberAhh, yea I reproduced it. I’ve filed it for investigation against the validator. Thanks for hanging in there and helping me dig this out, time consuming sometimes.
rogue_devMemberThis is almost at the level of a show stopper for me (revert back to 4.x). I need to have clean code before it is moved from the development system over to test, then to production.
IDE bugs can be worked around and/or other tools used during development, but the compiled code must act the same on all platforms (we strictly control Java/ Tomcat versions on all the servers).
So if the validator does not 100% accurately follow javac then there is a level of trust that is missing. I would still like to have the option of internal vs javac. I can live with the longer compile/validate times.
rogue_devMemberI see that this is now closed, so I can assume that the problem was found?
I am also getting a lot of other warnings and errors from the validator which I did not specify. Things like:
– The static field MyObject.XXX should be accessed in a static way
– The import ca.site.MyObject is never used
– The expression of type Data is already an instance of type RowInformation
– No end tag (</sometag>)
– Invalid location of tag <sometag>Of the current set of 89 web pages (114 files) I have 269 errors and 550 warnings.
Should I create a forum message for each type of error/warning (and try to create “simple” test cases)? Or was the fix fundamental? Any idea which GA version it will appear in?
Riyad KallaMemberYes it was closed because I’ve confirmed quite a few of the validator problems and filed them, no need to open a thread for each one. I would say that some should get fixed in 5.0.3, but the vast majority are going to be in the 5.1 release which should go into RC testing a month or two after that. 5.0.3 is planned for release Nov 6th.
-
AuthorPosts