struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mauro antonaci (JIRA)" <>
Subject [jira] [Created] (WW-4723) s:url incompatible with JDK 1.5
Date Fri, 02 Dec 2016 11:26:58 GMT
mauro antonaci created WW-4723:

             Summary: s:url incompatible with JDK 1.5
                 Key: WW-4723
             Project: Struts 2
          Issue Type: Bug
          Components: Core, Core Tags
    Affects Versions: 2.3.31, 2.3.30, 2.3.29, 2.3.28
         Environment: JBoss 4.3 on JDK 1.5
            Reporter: mauro antonaci
            Priority: Blocker

problem: _s:url_ tag on an application server running on JDK 1.5 (ex. JBoss 4.3) fails in
some cases due to an incompatibility with JDK in class _org.apache.struts2.util.tomcat.buf.UDecoder_.
Here an error stracktrace:
ava.lang.NoSuchMethodError: java.lang.String.getBytes(Ljava/nio/charset/Charset;)[B
at org.apache.struts2.util.tomcat.buf.UDecoder.URLDecode(
at org.apache.struts2.util.tomcat.buf.UDecoder.URLDecode(
at org.apache.struts2.util.URLDecoderUtil.decode(
at org.apache.struts2.views.util.DefaultUrlHelper.decode(
at org.apache.struts2.views.util.DefaultUrlHelper.parseQueryString(
at org.apache.struts2.components.ServletUrlRenderer.includeGetParameters(
at org.apache.struts2.components.ServletUrlRenderer.beforeRenderUrl(
at org.apache.struts2.components.PortletUrlRenderer.beforeRenderUrl(
at org.apache.struts2.components.URL.start(
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(
at org.apache.jsp.jsp.cpRicercaPercorso_jsp._jspx_meth_s_005furl_005f0(

The code is:
public static String URLDecode(String str, String enc, boolean isQuery) {
        if (str == null)
            return (null);

        // use the specified encoding to extract bytes out of the
        // given string so that the encoding is not lost. If an
        // encoding is not specified, use ISO-8859-1
        byte[] bytes = null;
        try {
            if (enc == null) {
                bytes = str.getBytes("ISO-8859-1");
            } else {
                bytes = str.getBytes(B2CConverter.getCharset(enc));
        } catch (UnsupportedEncodingException uee) {
            if (log.isDebugEnabled()) {
                log.debug("Unable to URL decode the specified input since the encoding "+
enc + " is not supported.", uee);

        return URLDecode(bytes, enc, isQuery);

Struts2 (ex. v. 2.3.31) is compiled with target JDK 1.5 but, method _getBytes(Charset)_ is
only available since JDK 1.6. 

I suppose that this should be considered a bug because I suppose that Struts2 2.3.31, being
compiled with target 1.5, should be considered compatible with JDK 1.5... but maybe this is
a wrong assumption. I didn't find any explicit compatibility matrix on docs...

The problem was *not* present in v. 2.3.24.

This message was sent by Atlassian JIRA

View raw message