[CONTROLLER-21] java.lang.NumberFormatException should just result in http error code Created: 21/Jun/13  Updated: 25/Jul/23  Resolved: 19/May/16

Status: Resolved
Project: controller
Component/s: adsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Dale W. Carder Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


External issue ID: 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)



 Comments   
Comment by Carol Sanders [ 04/May/15 ]

This bug is part of the project to Move all ADSAL associated component bugs to ADSAL

Comment by Robert Varga [ 19/May/16 ]

AD-SAL has been removed, this issue will not be fixed.

Generated at Wed Feb 07 19:51:59 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.