I'm developing an app against the struts2 svn trunk, but I don't think that's the source of this problem.

The only difference between:
http://newfieldenterprises.com/struts2ParserIssue/broken-struts.xml
and:
http://newfieldenterprises.com/struts2ParserIssue/working-struts.xml
are the addition of a bunch of blank lines before the "param" line of this snippet:

            <interceptor-stack name="photoUploadStack">
                <interceptor-ref name="fileUpload">
                  <param name="allowedTypes">image/jpeg</param>
                </interceptor-ref>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>


In the file that does not parse correctly the parser splits "image/jpeg" into two chunks of text "image/jpe" and "g", which results in the interceptor's allowedTypes getting set to just "image/jpe" which causes me all sorts of problems down the line. It didn't matter what was there, the parser always cut off the string after the same number of characters (see below for some debugger output[1]). That spot is (by my count) 2051 characters into the file. Not exactly 2048, but interestingly close enough that it suggested to me that I should try moving my string away from this boundary (thus the extra lines), which worked! I'm a bit concerned that this bug unfixed could cause practically any xml configuration file to break... ...I'll create a JIRA issue in the morning, but I'm not even sure what package this issue is against. Should Struts2 or XWork2 be more careful when pulling data out of the DOM when there may be multiple text pieces that it should be stringing together? Is Xerces simply failing in it's contract (seems more likely a lexer problem than related to the DOM)? A call stack when the Interceptor attribute is set is below[2] as well as one where the configuration file is actually parsed[3]. All of the packages are represented, as well as tomcat, ognl, ...

...any advice would be appreciated...

(Oh, this is all tomcat5.5.20 under java5 on os x.)

Thanks,
-Dale Newfield
 [EMAIL PROTECTED]

Appendix [1]:
interceptorRefElement.getChildNodes().item(1).getChildNodes().item(0).getNodeValue() = "${'image/" interceptorRefElement.getChildNodes().item(1).getChildNodes().item(1).getNodeValue() = "jpeg','image/jpeg','image/jpg'}"

(Yeah, I was trying all sorts of stuff)

Appendix [2]: (via logged exception)
[seenabout] DEBUG [main] FileUploadInterceptor.setAllowedTypes(183) | FileUploadInterceptor: allowedTypesSet = getDelimitedValues(image/jpe) => [image/jpe] [seenabout] DEBUG [main] FileUploadInterceptor.setAllowedTypes(187) | Where is this string getting shortened?
java.lang.Exception: How do I get called?
at org.apache.struts2.interceptor.FileUploadInterceptor.setAllowedTypes(FileUploadInterceptor.java:185)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:532)
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:826)
        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:978)
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131) at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1670)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
        at ognl.SimpleNode.setValue(SimpleNode.java:246)
        at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186) at com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:360) at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76) at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:103) at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:90) at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:182) at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:57) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:858) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStack(XmlConfigurationProvider.java:693) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStacks(XmlConfigurationProvider.java:706) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptors(XmlConfigurationProvider.java:727) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:359) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:242) at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:146) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:394) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:213) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

Appendix [3]: (where output from debugger)
  [1] org.apache.xerces.parsers.XML11Configuration.parse (null)
  [2] org.apache.xerces.parsers.XMLParser.parse (null)
  [3] org.apache.xerces.parsers.AbstractSAXParser.parse (null)
  [4] org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse (null)
  [5] org.apache.xerces.jaxp.SAXParserImpl.parse (null)
  [6] com.opensymphony.xwork2.util.DomHelper.parse (DomHelper.java:121)
[7] com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles (XmlConfigurationProvider.java:780) [8] com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments (XmlConfigurationProvider.java:135) [9] com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init (XmlConfigurationProvider.java:103) [10] com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload (DefaultConfiguration.java:129) [11] com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration (ConfigurationManager.java:52) [12] org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration (Dispatcher.java:394)
  [13] org.apache.struts2.dispatcher.Dispatcher.init (Dispatcher.java:450)
[14] org.apache.struts2.dispatcher.FilterDispatcher.init (FilterDispatcher.java:213) [15] org.apache.catalina.core.ApplicationFilterConfig.getFilter (ApplicationFilterConfig.java:223) [16] org.apache.catalina.core.ApplicationFilterConfig.setFilterDef (ApplicationFilterConfig.java:304) [17] org.apache.catalina.core.ApplicationFilterConfig.<init> (ApplicationFilterConfig.java:77) [18] org.apache.catalina.core.StandardContext.filterStart (StandardContext.java:3,634) [19] org.apache.catalina.core.StandardContext.start (StandardContext.java:4,217) [20] org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:759) [21] org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:739) [22] org.apache.catalina.core.StandardHost.addChild (StandardHost.java:524) [23] org.apache.catalina.startup.HostConfig.deployDescriptor (HostConfig.java:608) [24] org.apache.catalina.startup.HostConfig.deployDescriptors (HostConfig.java:535) [25] org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:470)
  [26] org.apache.catalina.startup.HostConfig.start (HostConfig.java:1,122)
[27] org.apache.catalina.startup.HostConfig.lifecycleEvent (HostConfig.java:310) [28] org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) [29] org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1,021)
  [30] org.apache.catalina.core.StandardHost.start (StandardHost.java:718)
[31] org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1,013) [32] org.apache.catalina.core.StandardEngine.start (StandardEngine.java:442) [33] org.apache.catalina.core.StandardService.start (StandardService.java:450) [34] org.apache.catalina.core.StandardServer.start (StandardServer.java:709)
  [35] org.apache.catalina.startup.Catalina.start (Catalina.java:551)
  [36] sun.reflect.NativeMethodAccessorImpl.invoke0 (native method)
[37] sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) [38] sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
  [39] java.lang.reflect.Method.invoke (Method.java:585)
  [40] org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:294)
  [41] org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:432)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to