Uploaded image for project: 'External API Framework'
  1. External API Framework
  2. EXTAPI-68

NPE on NBI serviceOrder when processing SO response

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: High High
    • Beijing Release
    • Beijing Release
    • None
    • None

      The following NPE occurs on processing the SO reponse :

      java.lang.NullPointerException: null
      {{ at org.onap.nbi.apis.serviceorder.workflow.SOTaskProcessor.updateServiceOrderItem(SOTaskProcessor.java:296) ~[classes!/:1.0.0-SNAPSHOT]}}
      {{ at org.onap.nbi.apis.serviceorder.workflow.SOTaskProcessor.processOrderItem(SOTaskProcessor.java:92) ~[classes!/:1.0.0-SNAPSHOT]}}
      {{ at org.onap.nbi.apis.serviceorder.workflow.SOTaskManager.processExecutionPlan(SOTaskManager.java:91) ~[classes!/:1.0.0-SNAPSHOT]}}
      {{ at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source) ~[na:na]}}
      {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]}}
      {{ at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]}}
      {{ at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]}}
      {{ at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]}}
      {{ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]}}
      {{ at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_121]}}
      {{ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]}}
      {{ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_121]}}
      {{ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]}}
      {{ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]}}
      {{ at java.lang.Thread.run(Thread.java:745) }}

       

      This is due to NBI expecting requestReference instead of requestReferences in the SO response :

      {"requestReferences":{"instanceId":"b45c768d-19cc-4859-bb43-8fb74b38de2a","requestId":"2f9cfd36-1f7d-4ed3-b685-7d8272ae3621"}}

       

      The file below  needs to be changed (and renamed) :

      src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java

       ** < public class RequestReferences {

      > public class RequestReference {

      27c43

      <         return "RequestReferences{" + "instanceId='" + instanceId + '\'' + ", requestId='" + requestId + '\'' + '}';

      >         return "RequestReference{" + "instanceId='" + instanceId + '\'' + ", requestId='" + requestId + '\'' + '}';

      And this file:

      src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java 

      <     public RequestReferences getRequestReferences() {

      <         return requestReferences;

      >     public RequestReference getRequestReference() {

      >         return requestReference;

      9,10c25,26

      <     public void setRequestReferences(RequestReferences requestReferences) {

      <         this.requestReferences = requestReferences;

      >     public void setRequestReference(RequestReference requestReference) {

      >         this.requestReference = requestReference;

      13c29

      <     private RequestReferences requestReferences;

      >     private RequestReference requestReference;

       ** 

      And this file:

      src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java

      <                     || response.getBody().getRequestReferences() == null) {

      >                     || response.getBody().getRequestReference() == null) {

       

      <             orderItem.getService().setId(createServiceInstanceResponse.getRequestReferences().getInstanceId());

      <             orderItem.setRequestId(createServiceInstanceResponse.getRequestReferences().getRequestId());

      >             orderItem.getService().setId(createServiceInstanceResponse.getRequestReference().getInstanceId());

      >             orderItem.setRequestId(createServiceInstanceResponse.getRequestReference().getRequestId());

            romaingimbert romaingimbert
            chiarelloa chiarelloa
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: