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 40783 - I18N - JSP parser does not handle encoding by context-root path as url-pattern in web.xml
Summary: I18N - JSP parser does not handle encoding by context-root path as url-patter...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P2 blocker (vote)
Assignee: Petr Pisl
URL:
Keywords: I18N, RELNOTE, TOMCAT
Depends on:
Blocks:
 
Reported: 2004-03-05 09:04 UTC by mtsuruta
Modified: 2004-08-13 12:12 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
jasper-compiler.jar extracted from jakarta-tomcat-5-src-20040320.zip (342.59 KB, application/octet-stream)
2004-03-22 09:04 UTC, mtsuruta
Details
jasper-runtime.jar of jakarta-tomcat-5-src-20040320.zip (104.40 KB, application/octet-stream)
2004-03-22 09:05 UTC, mtsuruta
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mtsuruta 2004-03-05 09:04:57 UTC
Proper encoding to load and save jsp files by
parser on ide is not used when specified
url-pattern as "/dir/*".

1. create web module
2. add following property in web.xml.
   <jsp-config>
       <jsp-property-group>
           <url-pattern>/dir/*</url-pattern>
           <page-encoding>
           UTF-8
           </page-encoding>
                </jsp-property-group>
            </jsp-config>

3. JSP does not properly save and load in the
encoding type which is specified in web.xml.
(The result is proper by using "*.jsp" but not
"/dir/*".)
Comment 1 Petr Pisl 2004-03-05 10:05:59 UTC
This is problem in tomcat's parser, which has been already fixed. See
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26432 . But the fix
is not in the version, which we used in the IDE. If user replaces the
jasper-compiler-5.0.19.jar and jasper-runtime-5.0.19.jar with
appropriate jars from nightly tomcat's build, then it works.

Now we are in hight resistance mode, so I'm not going to replace bad
jars with this bug in the 3.6. But we will replace them in promo-D.

Could we put this issue into release notes?
Comment 2 Ken Frank 2004-03-05 16:45:51 UTC
marking as P2 since encoding issue which is important to customers.

ken.frank@sun.com
03/05/2004
Comment 3 Keiichi Oono 2004-03-05 17:23:21 UTC
I agree it's important. But this is bug in tomcat parser, I think we
can write down this topic in release note. Ken, would you give me your
any thoghts?
Comment 4 Petr Jiricka 2004-03-05 18:22:29 UTC
Petr, the Tomcat bug you are referring to was fixed on January 27.
Tomcat 5.0.19 release date is Feb 14. Do you know why 5.0.19 does not
contain this fix? Thanks.
Comment 5 Petr Pisl 2004-03-08 15:22:56 UTC
No I don't know it. But the bug is still in the tomcat 5.0.19 version.
Comment 6 Petr Pisl 2004-03-09 13:32:52 UTC
I wrote to Kin-Man, who fixed the bug, and here is her answer:
"I have no idea why the fix is not in 5.0.19.  It is possible that
Remy may have tagged the release before the fix was committed."
Comment 7 Patrick Keegan 2004-03-15 18:31:37 UTC
Chris, could you construct a brief release note for this issue?
Comment 8 Chris Kutler 2004-03-15 22:37:30 UTC
Here's my best guess. I have some unanswered questions, such as does
"/jsp_dir/*.jsp" work?. Can someone verify that what is written below
is true? I don't have my system set up so that I can try it myself.

Tomcat JSP Encoding Bug:

Due to a bug in the Tomcat servlet container, a property group entry
in the deployment descriptor (web.xml) for specifying the
page-encoding must use a URL pattern that includes the .jsp extension.
If you just specify all files in a directory, such as "/jsp_dir/*",
the server does not load the JSP using the specified encoding. Here is
an example of how to specify the URL pattern so that Tomcat loads the
JSPs using the correct encoding.

<jsp-config>
  <jsp-property-group>
  <url-pattern>*.jsp</url-pattern>
    <page-encoding>
      UTF-8
    </page-encoding>
  </jsp-property-group>
</jsp-config>

Alternatively, download the latest versions of the following JARs and
replace the JAR files in
<ide-install-dir>\jakarta-tomcat-5.0.19\common\lib

jasper-compiler-5.0.19.jar
jasper-runtime-5.0.19.jar




Comment 9 Chris Kutler 2004-03-15 22:45:37 UTC
oops, I should have written

Alternatively, download the latest versions of the following JARs from
http://jakarta.apache.org/tomcat/index.html ...
Comment 10 Ana.von Klopp 2004-03-16 00:55:59 UTC
Hm, I assume this bug prevents the editor from using the correct 
encoding also? So it might be worth mentioning that it affects the 
editor also, and isn't just about the servlet container. 

If so, we need to recommend that people who need to input non-ascii 
characters into a JSP file do not use NB for this purpose if they need 
to make a declaration of that type (which will work on other servers). 

BTW, we were assured that a number of things were fixed in time for 5.
19 - might there be other things we've missed also, because of this 
tagging? Have we verified the other issues? 

Comment 11 Chris Kutler 2004-03-16 01:47:06 UTC
Do we use the Tomcat parser for opening the JSP in the editor? Can
someone verify that this type of URL pattern for page-encoding causes
problems with the Source Editor? If so, we can write:

Tomcat JSP Encoding Bug:

Due to a bug in the Tomcat servlet container, a property group entry
in the deployment descriptor (web.xml) for specifying the
page-encoding must use a URL pattern that includes the .jsp extension.
If you just specify all files in a directory, such as "/jsp_dir/*",
the IDE's Source Editor and the Tomcat server do not load the JSP
using the specified encoding. Here is an example of how to specify the
URL pattern so that Tomcat loads the JSPs using the correct encoding.

<jsp-config>
  <jsp-property-group>
  <url-pattern>*.jsp</url-pattern>
    <page-encoding>
      UTF-8
    </page-encoding>
  </jsp-property-group>
</jsp-config>

Alternatively, download the latest version of the following JARs from
http://jakarta.apache.org/tomcat/index.html and
replace the JAR files in
<ide-install-dir>\jakarta-tomcat-5.0.19\common\lib

jasper-compiler-5.0.19.jar
jasper-runtime-5.0.19.jar
Comment 12 mtsuruta 2004-03-16 04:52:57 UTC
I have verified this issue on nb-trunk build 0403081900 as following.
Tested with:
- no page directive in jsp
- specified the URL pattern and page encoding for jsp in web.xml
- multibyte chars in jsp which has been saved in Shift_JIS and EUC-JP

OK = Opened and saved properly in ide editor and executed on browser
failed  =  Not able to open and save in ide editor properly using
page-encoding atttibute of web.xml and failed to execute on browser

- CASE1
in web.xml
<url-pattern>/dir/*</url-pattern>
<page-encoding>XXX</page-encoding>
XXX = Shift_JIS on Sol9
XXX = EUC-JP on W2K

result
    Platform  :  W2K  Sol9  RedHat8
    ide Editor:  OK    OK    OK

- CASE2
in web.xml
<url-pattern>/dir/*.jsp</url-pattern>
<page-encoding>XXX</page-encoding>
XXX = Shift_JIS on Sol9
XXX = EUC-JP on W2K

result
    Platform  :  W2K       Sol9     RedHat8
    ide Editor:  faild*    failed*    failed*
    
* org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Parse error in application web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> /test/*.jsp
in servlet mapping
Comment 13 mtsuruta 2004-03-16 04:57:58 UTC
Excuse me, the CASE1's url-pattern was wrong.
Here is correct url pattern that I tested as CASE1.

- CASE1
in web.xml
<url-pattern>*.jsp</url-pattern>
Comment 14 Chris Kutler 2004-03-16 15:02:12 UTC
Thank you for performing the test. To be clear, do the tests indicate
we need the following reworded entry See >> << for rewording ? 

P.S. Will the Source Editor work correctly if they follow the
alternative of dowloading new jars?

Tomcat JSP Encoding Bug:

Due to a bug in the Tomcat servlet container, a property group entry
in the deployment descriptor (web.xml) for specifying the
page-encoding >>must use a URL pattern that does not include a
directory and does include the .jsp extension.<<
If you just specify a directory, such as  >>"/jsp_dir/*" or
"/jsp_dir/*.jsp", the IDE's Source Editor and the Tomcat server do not
load the JSP using the specified encoding.<< Here is an example of how
to specify the URL pattern so that Tomcat loads the JSPs using the
correct encoding.

<jsp-config>
  <jsp-property-group>
  <url-pattern>*.jsp</url-pattern>
    <page-encoding>
      UTF-8
    </page-encoding>
  </jsp-property-group>
</jsp-config>

Alternatively, download the latest version of the following JARs from
http://jakarta.apache.org/tomcat/index.html and
replace the JAR files in
<ide-install-dir>\jakarta-tomcat-5.0.19\common\lib

jasper-compiler-5.0.19.jar
jasper-runtime-5.0.19.jar
Comment 15 Petr Pisl 2004-03-16 15:21:50 UTC
Hi Chris,

yes we use encodiing from the Tomcat parser for opening / saving the
JSP in the editor.  I think the last version is OK.
Comment 16 mtsuruta 2004-03-17 08:47:35 UTC
Petr, would you give me a specific URL to download the nighytly build
to verify those jars?  I have downloaded nightly build(zip) from
following URL and extracted, but there is no jasper-compiler and
jasper-runtime jars under /jakarta-tomcat-5/build/common/lib and other
extracted dir. I think I am checking wrong zip.

http://cvs.apache.org/builds/jakarta-tomcat-5/nightly/
Extracted: 
jakarta-tomcat-5-src-20040315.zip
jakarta-jsp-api-5-bin-20040315.zip 
Comment 17 mtsuruta 2004-03-22 08:55:51 UTC
Downloaded following zip from nightly-build page and replaced two jars
in ide-install directory, but "/jsp_dir/*" and "/jsp_dir/*.jsp" are
not possible to specify jsp page encoding with no page directive.
JSP file is not able to open and save in ide editor using the encoding
type of jsp-config property with the latest jars, and executing jsp
with no page directive also displayed garbaged multibyte chars as page
encoding is not specified in web.xml.
Only the URL pattern of *.jsp works fine after replacing jars, also.
There might be a regression in tomcat nightly build.
(new user dir, tested on Sol9 only)

downloaded:
http://cvs.apache.org/builds/jakarta-tomcat-5/nightly/jakarta-tomcat-5-src-20040320.zip 

replased:
jasper-compiler.jar
jasper-runtime.jar

in:
<ide-install-dir>/jakarta-tomcat-5.0.19/common/lib/
Comment 18 mtsuruta 2004-03-22 09:04:08 UTC
Created attachment 14069 [details]
jasper-compiler.jar extracted from jakarta-tomcat-5-src-20040320.zip
Comment 19 mtsuruta 2004-03-22 09:05:19 UTC
Created attachment 14070 [details]
jasper-runtime.jar of jakarta-tomcat-5-src-20040320.zip
Comment 20 mtsuruta 2004-03-26 12:25:28 UTC
Could not confirm the fix in tomcat nightly build again.

on sol9, with j2sdk1.4.2

jakarta-tomcat-5-src-20040322.zip
jakarta-tomcat-5-src-20040324.zip

I think there is no stability to get this fix in tomcat latest build
recently.
I'd propose to add some words as "after this issue was fixed" or
anything in release note if this comment is not too late for it.
Some words are needed to avoid users misunderstanding that they can
absolutely use the context root if they download the latest build. 
I think other part is fine. Excuse me for being late to verify this.
Comment 21 Petr Pisl 2004-05-17 12:39:06 UTC
New version of tomcat jsp parser was added into build in trunk. This
bug is fixed in this version of parser.
Comment 22 mtsuruta 2004-05-19 08:58:01 UTC
Fix is verified on Sol9, XP, and RedHat8 with build 200405171800.