It appears to me that Sun's RI is recognizing the "obvious" - that statements
can not appear between "switch" and "case", nor between "break" and "case".
Unless the spec specifically addresses this, it seems that Orion is doing the
correct thing, and Sun is providing a nicety that lulls one into writing bad
JSP code.
tim.

> Sorry if I didn't quite get your point.
> 
> It's odd though. The spec VERY specifically says that whitespace must be 
> preserved (JSP 1.1 spec, section 2.1.6), so it seems to me that what Orion 
> is doing is correct, even if it seems inconvenient.
> 
> If I write:
> 
> <% out.print("one"); %>
> <% out.print("two"); %>
> 
> then my reading of the spec says that I must get the two words printed on 
> different lines (which I believe Orion would do), whereas you seem to be 
> saying that Sun's RI would print "onetwo".  Or is Sun's RI somehow clever 
> enough to know the difference between my sample and yours? That would take 
> some clever examination of what's in the scriptlets, I would think.
> 
> Nick Newman
> 
> At 04:58 PM 2/27/01 -0500, you wrote:
> 
> >OK, thanks, I understand that (which is how I fixed the code).
> >
> >However, I believe this isn't the proper behaviour for JSP.
> >Orion should eat that newline. This is how other JSP engines behave,
> >including Sun's reference engine.
> >
> >It shouldn't break the java code by inserting an erroneous println...
> >or am I smoking crack?
> >
> >adam
> >
> >-----Original Message-----
> >From: Nick Newman 
> >[<mailto:[EMAIL PROTECTED]>mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, February 27, 2001 11:40 AM
> >To: Orion-Interest
> >Subject: Re: simple JSP bug with switch
> >
> >Hi Adam,
> >
> >I don't think this is a bug, although I agree the messages are
> >confusing.  Set the development="true" flag in the orion-web.xml and you
> >get the reason explained more fully.  Basically what you have written in
> >the broken version produces code like this:
> >
> >switch(1){
> >          // write a new line (but can't be reached!)
> >case 1:
> >          // write newline, "One", newline
> >break;
> >          // write a new line (but can't be reached!)
> >default:
> >          // write newline, "Default", newline
> >break;
> >          // write a new line (but can't be reached!)
> >}
> >
> >and the compiler complains (correctly) that some of the copde can't be 
> >reached.
> >
> >Nick Newman
> >
> >
> >
> >At 08:11 PM 2/26/01 -0500, you wrote:
> >
> > >Forgive me if this is a known bug, but I didn't see it in the FAQ or
> > >anywhere on orionsupport.com.
> > >
> > >I am using Orion 1.4.7 and I have tried having Orion use Jikes 1.12 as
> > >well as all three of the 1.30 JDKs
> > >{Sun,IBM,Blackdown}. This is all running on RedHat 7.0 Linux 2.4.2.
> > >
> > >fixed version (but I shouldn't have to do this...):
> > >
> > ><% switch(1) { case 1: %>
> > >One
> > ><% break; default: %>
> > >Default
> > ><% break;  } %>
> > >
> > >broken version:
> > >
> > ><% switch(1) { %>
> > ><% case 1: %>
> > >One
> > ><% break; %>
> > ><% default: %>
> > >Default
> > ><% break; %>
> > ><% } %>
> > >
> > >Gives the following error (this is the Blackdown error, but they're all
> > >similar)
> > >
> > >500 Internal Server Error
> > >Error parsing JSP page /jsp/test.jsp
> > >Syntax error in source
> > >/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> > >                         if(__coreOut == out)
> > > __coreOut.write(__staticContent, 0, 1);
> > >                         ^
> > >/jsp/test.jsp.java:29: 'case', 'default' or '}' expected (JSP page line 3)
> > >                         if(__coreOut == out)
> > > __coreOut.write(__staticContent, 0, 1);
> > >
> >  >         ^
> > >/jsp/test.jsp.java:30: 'case', 'default' or '}' expected (JSP page line 3)
> > >                         else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 0, 1, null);
> > >
> >  >                                          ^
> > >/jsp/test.jsp.java:35: 'case', 'default' or '}' expected (JSP page line 4)
> > >                         if(__coreOut == out)
> > > __coreOut.write(__staticContent, 1, 5);
> > >
> >  >         ^
> > >/jsp/test.jsp.java:36: 'case', 'default' or '}' expected (JSP page line 4)
> > >                         else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 1, 5, null);
> > >
> >  >                                          ^
> > >/jsp/test.jsp.java:38: 'case', 'default' or '}' expected (JSP page line 4)
> > >  break;
> > >       ^
> > >/jsp/test.jsp.java:41: 'case', 'default' or '}' expected (JSP page line 6)
> > >                         if(__coreOut == out)
> > > __coreOut.write(__staticContent, 6, 1);
> > >
> >  >         ^
> > >/jsp/test.jsp.java:42: 'case', 'default' or '}' expected (JSP page line 6)
> > >                         else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 6, 1, null);
> > >
> >  >                                          ^
> > >/jsp/test.jsp.java:47: 'case', 'default' or '}' expected (JSP page line 7)
> > >                         if(__coreOut == out)
> > > __coreOut.write(__staticContent, 7, 9);
> > >
> >  >         ^
> > >/jsp/test.jsp.java:48: 'case', 'default' or '}' expected (JSP page line 7)
> > >                         else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 7, 9, null);
> > >
> >  >                                          ^
> > >/jsp/test.jsp.java:50: 'case', 'default' or '}' expected (JSP page line 7)
> > >  break;
> > >       ^
> > >/jsp/test.jsp.java:53: 'case', 'default' or '}' expected (JSP page line 9)
> > >                         if(__coreOut == out)
> > > __coreOut.write(__staticContent, 16, 1);
> > >
> >  >          ^
> > >/jsp/test.jsp.java:54: 'case', 'default' or '}' expected (JSP page line 9)
> > >                         else
> > > com.evermind.server.http.EvermindJSPWriter.writeBytes(out,
> > > __staticContent, 16, 1, null);
> > >
> >  >                                           ^
> > >13 errors
> 
> 


Reply via email to