Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-21

java.lang.NumberFormatException should just result in http error code

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Won't Do
    • None
    • None
    • adsal
    • None
    • Operating System: Linux
      Platform: PC

    • 27

    Description

      I was testing some code I wrote to see how it would handle
      error conditions and found this issue when trying to purposefully
      add (POST) a bogus flow via the REST API.

      In this case, I was trying to add a flow with switch ID 'G'.

      1. note: python dictionary syntax
        newflow =
        Unknown macro: {u'actions'}

      I saw expecting something like
      Status: 500 Invalid Configuration (You're an idiot)
      -or-
      Status: 404 OF|00:00:00:00:00:00:00:0G : Node does not exist

      I believe the GET function of the API does handle this correctly.

      Here's the traceback result:

      Status: 500
      java.lang.NumberFormatException: For input string: "G"
      java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      java.lang.Integer.parseInt(Integer.java:492)
      java.math.BigInteger.<init>(BigInteger.java:338)
      org.opendaylight.controller.sal.utils.HexEncode.stringToLong(HexEncode.java:87)
      org.opendaylight.controller.sal.core.Node.fillmeFromString(Node.java:223)
      org.opendaylight.controller.sal.core.Node.setType(Node.java:245)
      sun.reflect.GeneratedMethodAccessor219.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:601)
      com.sun.xml.internal.bind.v2.runtime.reflect.Accessor$GetterSetterReflection.set(Accessor.java:351)
      com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:232)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:194)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:486)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:232)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:166)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:355)
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:334)
      com.sun.jersey.json.impl.BaseJSONUnmarshaller.unmarshalJAXBElementFromJSON(BaseJSONUnmarshaller.java:111)
      com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider.readFrom(JSONJAXBElementProvider.java:125)
      com.sun.jersey.core.provider.jaxb.AbstractJAXBElementProvider.readFrom(AbstractJAXBElementProvider.java:110)
      com.sun.jersey.core.provider.jaxb.AbstractJAXBElementProvider.readFrom(AbstractJAXBElementProvider.java:79)
      com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:488)
      com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123)
      com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46)
      com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153)
      com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:203)
      com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
      com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
      com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
      com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
      com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
      com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
      com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
      com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            dwcarder@wisc.edu Dale W. Carder
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: