Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-12555

invalid element names cause NPE in forms tool

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.0
    • Fix Version/s: 2.6.0
    • Component/s: Metaobj
    • Labels:
      None

      Description

      invalid element names cause NPE in forms tool

      It will still crash (qa2-us 2.5.0-beta) if the form is not valid because element names start with numbers:

      Offending .xsd file:

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
      <xs:element name="1Test">
      <xs:annotation>
      <xs:documentation source="ospi.label">Test</xs:documentation>
      <xs:documentation source="ospi.description">Test</xs:documentation>
      </xs:annotation>
      <xs:complexType>
      <xs:sequence>

      <xs:element name="1Bad" minOccurs="1">
      <xs:annotation>
      <xs:documentation source="ospi.label">Bad</xs:documentation>
      <xs:documentation source="ospi.description">Bad</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
      <xs:restriction base="xs:string">
      <xs:enumeration value="1missing">
      <xs:annotation>

      <xs:documentation>missing</xs:documentation>
      </xs:annotation>
      </xs:enumeration>
      </xs:restriction>
      </xs:simpleType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      </xs:schema>

      Trace:
      This information will automatically be included in your bug report.

      org.sakaiproject.portal.api.PortalHandlerException: org.sakaiproject.tool.api.ToolException: Request processing failed; nested exception is org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1".
      at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:891)
      caused by: org.sakaiproject.tool.api.ToolException: Request processing failed; nested exception is org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1".
      at org.sakaiproject.cheftool.ToolServlet.sendToHelper(ToolServlet.java:652)
      caused by: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1".
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430)
      caused by: org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1".
      at org.jdom.Element.setName(Element.java:206)
      at org.jdom.Element.<init>(Element.java:140)
      at org.jdom.Element.<init>(Element.java:152)
      at org.sakaiproject.metaobj.shared.model.ElementBean.<init>(ElementBean.java:74)
      at org.sakaiproject.metaobj.shared.model.StructuredArtifact.<init>(StructuredArtifact.java:53)
      at org.sakaiproject.metaobj.shared.mgt.home.StructuredArtifactDefinition.createInstance(StructuredArtifactDefinition.java:158)
      at org.sakaiproject.metaobj.shared.mgt.home.ResourceHelperArtifactHome.createInstance(ResourceHelperArtifactHome.java:73)
      at org.sakaiproject.metaobj.shared.control.AddXmlElementController.formBackingObject(AddXmlElementController.java:63)
      at org.sakaiproject.metaobj.utils.mvc.impl.servlet.FormControllerImpl.formBackingObject(FormControllerImpl.java:144)
      at org.springframework.web.servlet.mvc.AbstractFormController.getErrorsForNewForm(AbstractFormController.java:343)
      at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:323)
      at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:263)
      at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
      at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:857)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at org.sakaiproject.spring.util.SpringTool.dispatch(SpringTool.java:231)
      at org.sakaiproject.spring.util.SpringTool.doGet(SpringTool.java:294)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:555)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.help(ActiveToolComponent.java:529)
      at org.sakaiproject.cheftool.ToolServlet.sendToHelper(ToolServlet.java:652)
      at org.sakaiproject.cheftool.ToolServlet.doGet(ToolServlet.java:212)
      at org.sakaiproject.cheftool.VelocityPortletPaneledAction.doGet(VelocityPortletPaneledAction.java:1005)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at org.sakaiproject.vm.ComponentServlet.service(ComponentServlet.java:56)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:555)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:459)
      at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1343)
      at org.sakaiproject.portal.charon.handlers.ToolHandler.doTool(ToolHandler.java:163)
      at org.sakaiproject.portal.charon.handlers.ToolHandler.doGet(ToolHandler.java:86)
      at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:891)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:592)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
      at java.lang.Thread.run(Thread.java:595)

      user: 1a3420f4-cbfc-4b27-9497-141f37a2d819

      usage-session: a2c39547-a93c-4a5c-bd85-3d105f1d9aee

      time: Dec 21, 2007 17:10:13

      [ Show ยป ]
      John Hall - 21-Dec-2007 15:12 It will still crash (qa2-us 2.5.0-beta) if the form is not valid because element names start with numbers: Offending .xsd file: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="1Test"> <xs:annotation> <xs:documentation source="ospi.label">Test</xs:documentation> <xs:documentation source="ospi.description">Test</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="1Bad" minOccurs="1"> <xs:annotation> <xs:documentation source="ospi.label">Bad</xs:documentation> <xs:documentation source="ospi.description">Bad</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="1missing"> <xs:annotation> <xs:documentation>missing</xs:documentation> </xs:annotation> </xs:enumeration> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> — Trace: This information will automatically be included in your bug report. org.sakaiproject.portal.api.PortalHandlerException: org.sakaiproject.tool.api.ToolException: Request processing failed; nested exception is org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1". at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:891) caused by: org.sakaiproject.tool.api.ToolException: Request processing failed; nested exception is org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1". at org.sakaiproject.cheftool.ToolServlet.sendToHelper(ToolServlet.java:652) caused by: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1". at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430) caused by: org.jdom.IllegalNameException: The name "1Test" is not legal for JDOM/XML elements: XML names cannot begin with the character "1". at org.jdom.Element.setName(Element.java:206) at org.jdom.Element.<init>(Element.java:140) at org.jdom.Element.<init>(Element.java:152) at org.sakaiproject.metaobj.shared.model.ElementBean.<init>(ElementBean.java:74) at org.sakaiproject.metaobj.shared.model.StructuredArtifact.<init>(StructuredArtifact.java:53) at org.sakaiproject.metaobj.shared.mgt.home.StructuredArtifactDefinition.createInstance(StructuredArtifactDefinition.java:158) at org.sakaiproject.metaobj.shared.mgt.home.ResourceHelperArtifactHome.createInstance(ResourceHelperArtifactHome.java:73) at org.sakaiproject.metaobj.shared.control.AddXmlElementController.formBackingObject(AddXmlElementController.java:63) at org.sakaiproject.metaobj.utils.mvc.impl.servlet.FormControllerImpl.formBackingObject(FormControllerImpl.java:144) at org.springframework.web.servlet.mvc.AbstractFormController.getErrorsForNewForm(AbstractFormController.java:343) at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:323) at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:263) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:857) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.sakaiproject.spring.util.SpringTool.dispatch(SpringTool.java:231) at org.sakaiproject.spring.util.SpringTool.doGet(SpringTool.java:294) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:555) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.help(ActiveToolComponent.java:529) at org.sakaiproject.cheftool.ToolServlet.sendToHelper(ToolServlet.java:652) at org.sakaiproject.cheftool.ToolServlet.doGet(ToolServlet.java:212) at org.sakaiproject.cheftool.VelocityPortletPaneledAction.doGet(VelocityPortletPaneledAction.java:1005) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at org.sakaiproject.vm.ComponentServlet.service(ComponentServlet.java:56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:555) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:459) at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1343) at org.sakaiproject.portal.charon.handlers.ToolHandler.doTool(ToolHandler.java:163) at org.sakaiproject.portal.charon.handlers.ToolHandler.doGet(ToolHandler.java:86) at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:891) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:592) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Thread.java:595) user: 1a3420f4-cbfc-4b27-9497-141f37a2d819 usage-session: a2c39547-a93c-4a5c-bd85-3d105f1d9aee time: Dec 21, 2007 17:10:13

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  • Assignee:
                    john.ellis@rsmart.com John Ellis (Inactive)
                    Reporter:
                    john.ellis@rsmart.com John Ellis (Inactive)
                  • Votes:
                    0 Vote for this issue
                    Watchers:
                    1 Start watching this issue

                    Dates

                    • Created:
                      Updated:
                      Resolved:

                      Git Integration