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 232193 - Correct JSP with "Error parsing file"
Summary: Correct JSP with "Error parsing file"
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-03 09:50 UTC by Vortilion
Modified: 2013-07-31 13:20 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 Vortilion 2013-07-03 09:50:56 UTC
Hi,

since I upgraded from 7.2 to 7.3 (and still in 7.3.1) Netbeans shows the red exclamation mark with "Error parsing File" in the Projects Tree on some (not all) JSP-Files contained in a Struts 2-Project. As far as I can tell it has something to do with a HTML-Script-Tag containing OGNL-Tags, because if I delete all script-tags the "error" disappears. The file itself doesn't contain any errors (green box in the top right saying "No errors".

for example the code 

"<script>

  var prepareGMT = function (){

    var mapSelector = "#xxx";

    var shopConfig = {
      selected: true,
      icon: '<s:url value="/img/yyy.png" namespace="/"/>',
      icon_anchor_x: 20,
      icon_anchor_y: 30
    };

    if (GMT.xxx) {
      GMT.configure(mapSelector)
        .setStartLocation(GMT.xxx.lat, GMT.xxx.lon)
        .setStartZoomLevel(GMT.xxx.zoom);
    } else {
      GMT.configure(mapSelector)
        .setStartZoomLevel(6);
    }

    var xxxTemplateOptions = {
      processView : function(view) {
        view.xxx= false;
        view.yyy= false;
        if (view.availableLayers[0] && view.availableLayers[0].layer == 'ftth') {
          for (var i=0; i < GMT.xxx.length; i++) {
            var city = GMT.xxx[i];
            if ((city.google_name || city.name) == view.address_components.city) {
              view.yyy= true;
              break;
            }
          }
        }
        return view;
      }
    };

    GMT.configure(mapSelector)
      .setTrackingUrl('initialized' , 'https://www.xxx.de/lp/yyy/bbb-3')
      .setTrackingUrl('address_found', 'https://www.xxx.de/lp/yyy/bbb-3')
      .setTrackingUrl('popup_opened' , 'https://www.xxx.de/lp/yyy/bbb-3')
      .setTitle("blabla")
      .setExplanation("bla bla")
      .setGoButton("<s:url value="/img/xxx/yyy.png" namespace="/"/>")
      .addPolygonGroup("xxx",
        GMT.area("xxx", "xxx", {selected:true}))
      .setPointCheckboxes("xxx",
        GMT.point("xxx", "xxx"   , shopConfig))
      .setHomeMarkerOptions({
        icon: '<s:url value="/img/zzz/yyy.png" namespace="/"/>',
        icon_anchor_x: 18,
        icon_anchor_y: 46
      })
      .setMapOptions({
        mapTypeId: google.maps.MapTypeId.HYBRID,
        panControlOptions:  {position: google.maps.ControlPosition.LEFT_CENTER},
        zoomControlOptions: {position: google.maps.ControlPosition.LEFT_CENTER},
        streetViewControl: false,
        scrollwheel: true,
        mapTypeControl: false})
      .setTemplateOptions("homemarker", ftthTemplateOptions)
      .setPostInitCallback(ftthExtension);

  };
  </script>
  

<!-- WebTrekk -->
<s:if test="statusBean.city == null">
    <s:set var="page_content_id" value="%{'www.xxx.de.yyy.zzz.de'}" />
</s:if>
<s:else>
    <s:set var="page_content_id" value="%{'www.xxx.de' + statusBean.city.geoIpName + '.yyy'}" />
</s:else>

<script>
    var utag_data = {
        page_content_id : "<s:property value="page_content_id" />",
        shop_product_name: "",
        shop_product_status: "",
        shop_product_quantity: "",
        shop_order_value: "",
        shop_order_id: ""
    };
</script>
<script>
    <s:include value="../../js/utag-call.js"/>
</script>

<script>
    <s:include value="../../js/piwik.js"/>
   trackPiwik("");
</script>"

in a jsp-file gives me this error. If I delete it and save the file, it disappears.

I tested it in a completely new JSP file where I added the code

<script>
    <s:url action="blabla" />
</script>

which also gives me the "error parsing file".

(I had to disguise some names and urls because of privacy policy, sorry)
Comment 1 Vladimir Riha 2013-07-03 10:00:13 UTC
Reproducible, thank you for reporting. Please notice that you also have unescaped double quotes in 2 places, e.g.:

 .setGoButton("<s:url value="/img/xxx/yyy.png" namespace="/"/>")

After fixing this, only case with 

<script>
    <s:url action="blabla" />
</script>


remains.
Comment 2 Vortilion 2013-07-03 10:10:30 UTC
Hi, thanks for the fast response! 

I'm sorry, but I don't see any double quotes which have to be escaped?

.setGoButton("<s:url value="/img/xxx/yyy.png" namespace="/"/>") looks fine to me. The inner part is OGNL which insers an image-path into the javascript-string, e.g. it becomes 

.setGoButton("http://www.blabla.de/img/xxx/yyy.png")

so I don't see why they had to be escaped? Could you help me out here?
Comment 3 Vladimir Riha 2013-07-03 10:20:02 UTC
If you have 

.setGoButton("<s:url value="/img/xxx/yyy.png" namespace="/"/>")

then (afaik) editor doesn't know it will be replaced with something else (for instance plain old jQuery could look like $(document).html("<div class=\"test\"></div>") and escaping is necessary here). If escaping quotes breaks the code, what about using single quotes

.setGoButton('<s:url value="/img/xxx/yyy.png" namespace="/"/>')

that should be still valid for your code and it makes few errors go away.
Comment 4 Vladimir Riha 2013-07-03 10:28:39 UTC
Possibly a duplicate of/similar to issue 225538
Comment 5 Vortilion 2013-07-03 10:30:11 UTC
Hi, I alreeady tried that, but it doesn't change anything. And I can't escape the double quotes because they have to be unescaped for the OGNl-Tag. They are not part of the String (like html tag-attributes).
Comment 6 Petr Pisl 2013-07-10 12:33:57 UTC
I'm going to fix the issue #225538 as first. This issue possibly will required more fixes after fixing issue #225538.
Comment 7 Petr Hejl 2013-07-31 12:11:26 UTC
Both cases described by the reporter seems to be ok now. Please verify.
Comment 8 Vortilion 2013-07-31 13:16:25 UTC
How can I verify that? Where can I get the patch for this problem??
Comment 9 Petr Hejl 2013-07-31 13:20:15 UTC
The easiest way is to try the daily build http://bits.netbeans.org/download/trunk/nightly/latest/