- This topic has 7 replies, 2 voices, and was last updated 19 years, 11 months ago by Riyad Kalla.
-
AuthorPosts
-
Charles EubanksMember(I am using 3.8.4 on eclipse 3.0.1)
In the following fragment, the second “String a” is incorrectly flagged as a duplicate variable:
<body>
This is my JSP page. <br>
<%
String a = “hello”;
%>
<%
String a = “goodbye”;
%>
</body>Is this a known issue and is it going to (please) get fixed soon?
Riyad KallaMemberzero,
This is not a valid page. If you are interested why, dump this page in Tomcat and try and run it, when it fails, go take a look at the generated Java file, you should see some relatively disgusting code, but buried within that code you will see something like:String a = "hello"; // messy generated code for about 4 lines String b = "goodbye";
Anything within a scriplet <%%>, is directly inlined into the JSP page, considering that, it is a lot like writing a Java method in a normal Java class like this:
public String getName() { String name = "Bob"; String name = "Betty"; return name; }
Charles EubanksMemberYou are right. I mistakenly tried to simplify my original problem too much. Tthe original problem is with a fragment that looks like:
<body>….
<blox:container id=”blox1″ width=”200″ height=”100″ visible=”true”>
<%
BloxModel model = blox1.getBloxModel();
model.setLayout( new VerticalLayout() );
model.setStyle( new Style( “border:1;” ) );RadioButton radioButton1 = new RadioButton(null, “button 1”, “group”);
radioButton1.setChecked(true);
…%>
</blox:container>
disabled = true:
<blox:container id=”blox2″ width=”200″ height=”100″ visible=”true” >
<%
BloxModel model2 = blox2.getBloxModel();
model2.setLayout( new VerticalLayout() );
model2.setStyle( new Style( “border:1;” ) );RadioButton radioButton1 = new RadioButton(null, “button 1”, “group1”);
radioButton1.setChecked(true);
…%>
</blox:container>
…
</body>It tells me that the second radioButton1 is a duplicate….
When I simplify this *not so much* it becomes:
<body>
This is my JSP page. xxx<br>
<blox:container>
<%
String a = “hello”;
%>
</blox:container><blox:container>
<%
String a = “goodbye”;%>
</blox:container>
</body>and this works with no error (!)
So I guess the *real* problem is that when there is complicated scripting nested in tags sometimes you get a bogus duplicate variable error. Or maybe its something related to the <blox:…> tags (?)
I have tried wrapping the second set of radioButton code in curly braces {} to force it to recognize a new scope but this has no effect.
Any additional diagnostic suggestions?
Riyad KallaMemberand this works with no error (!)
Are you absolutely sure that THIS page you posted works? The reason I ask is because MyEclipse uses the Jasper2 JSP compiler from Tomcat to validate it’s pages, so if this doesn’t even compile in MyEclipse, but actually RUNs in Tomcat, I will be officially confused-as-hell.
Charles EubanksMemberYes, this page works — it runs in tomcat with no problem. I have also checked the page in intellij 4.5 and this page is OK as far as it is concerned.
Riyad KallaMemberThis is certainly strange… is there anyway you would be able to create a small sample web project that contained this identical code and email it to support@genuitec.com ATTN Riyad so I can test it and file a bug report with the issue in it?
Charles EubanksMemberI wish I could do this for you but the tags come from a real honest to god product that we (IBM) sell. And my boss tells me that sending that jar to you would get me fired. Therefore “no” is the answer.
Seriously tho, I don’t think that our tags are the issue — these tags are out in the wild and have been for 2+ years. And like I noted above the JetBrains product handles the same case w/ no problem (as does Rational App Developer). So I imagine someone less IP-constrained will hit this sort of problem or you will see it reproduced in some other way.
Riyad KallaMemberSeriously tho, I don’t think that our tags are the issue
I don’t either, I agree with your assessment that is why I wanted a sample project so we could file the bug against an explicit use case.
I have a feeling this bug will get fixed as a side effect of bigger fixes going into 3.9 and 4.0 however… I will try and keep an ear to the ground relating to these types of changes in the code and will post back here if I hear anything. Sorry for the inconvenience and open-endedness of this.
-
AuthorPosts