Cannot update project attribute via the REST API

Dear Community members,

I am encountering the following issue when try to update a project attribute using the REST API. I am using the end point "/attributeValues" and a most method.

I am passing the following body which - to me at least - seems correctly formatted and correspond to the example provided in the REST API documentation:

[

{

"value": true,

"attribute": {

"id": 1178,

"name": "EPO_Project_Formatted",

"displayName": "Formatted",

"resourceType": "PROJECT",

"type": "BOOLEAN"

},

"resource": { "id": 2094 }

}

]

 

After the Post is sent, I receive a response saying that method ran to completion but returned the following error:

{

"errors": [

{

"code": 500,

"type": "SERVER",

"message": "java.lang.NullPointerException"

}

]

}

 

When I check in the system log of the application, I can see that the following messages:

[2017-02-21 19:03:15,347] INFO http-apr-443-exec-8 com.sdl.lt.worldserver.service.permission.PermissionStageRouter: Checking permission for PermissionKey[resourceType=ATTRIBUTE_VALUE,permissionType=WRITE,auxPermission=CHANGE_PROJECT_ATTRIBUTES] [CHANGE_PROJECT_ATTRIBUTES]
[2017-02-21 19:03:15,353] INFO http-apr-443-exec-8 com.sdl.lt.worldserver.service.permission.PermissionStageRouter: Checking permission for PermissionKey[resourceType=<null>,permissionType=NONE,auxPermission=<null>] []
[2017-02-21 19:03:15,359] INFO http-apr-443-exec-8 com.sdl.lt.worldserver.service.permission.PermissionStageRouter: Checking permission for PermissionKey[resourceType=<null>,permissionType=NONE,auxPermission=<null>] []
[2017-02-21 19:03:15,392] ERROR http-apr-443-exec-8 com.sdl.lt.worldserver.api.rest.error.ExceptionControllerAdvice: Exception intercepted:
java.lang.NullPointerException

Any idea why this is not working? Why is the resourceType "null" in the checking

Thanks in advance for your support.

Regards,

Laurent

Parents
  • Hi Laurent,

    can you please add the full stacktrace of the NullPointerException. You should see more lines in the logs.

    Thanks,
    Stefan.
  • Hi Stefan,

    Thank you for your prompt reaction. Here is the full stack trace of the null pointer.

    Regards,

    Laurent

     

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    [2017-02-21 19:03:15,392] ERROR http-apr-443-exec-8 com.sdl.lt.worldserver.api.rest.error.ExceptionControllerAdvice: Exception intercepted:
    java.lang.NullPointerException
    at com.sdl.lt.worldserver.service.attribute.action.ChangeAttributesAction.getAttributesMap(ChangeAttributesAction.java:87)
    at com.sdl.lt.worldserver.service.attribute.action.ChangeAttributesAction.doExecute(ChangeAttributesAction.java:58)
    at com.sdl.lt.worldserver.service.attribute.action.ChangeAttributesAction.doExecute(ChangeAttributesAction.java:37)
    at com.sdl.lt.worldserver.action.GenericAction.executeInsidePermissions(GenericAction.java:69)
    at com.sdl.lt.worldserver.action.PermissionExecutor.executeWithPermissions(PermissionExecutor.java:52)
    at com.sdl.lt.worldserver.action.PermissionExecutor.execute(PermissionExecutor.java:39)
    at com.sdl.lt.worldserver.action.GenericAction.actionExecution(GenericAction.java:63)
    at com.sdl.lt.worldserver.action.GenericAction.lambda$execute$0(GenericAction.java:58)
    at com.sdl.lt.worldserver.service.util.PerformanceLogger.withPerformanceLog(PerformanceLogger.java:19)
    at com.sdl.lt.worldserver.action.GenericAction.execute(GenericAction.java:58)
    at com.sdl.lt.worldserver.action.BatchAction.executeRequest(BatchAction.java:59)
    at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1612)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at com.sdl.lt.worldserver.action.BatchAction.execute(BatchAction.java:47)
    at com.sdl.lt.worldserver.service.attribute.AttributeValueServiceLegacy.changeAttributes(AttributeValueServiceLegacy.java:109)
    at com.sdl.lt.worldserver.service.attribute.AttributeValueServiceLegacy$$FastClassBySpringCGLIB$$e3e319f.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Reply
  • Hi Stefan,

    Thank you for your prompt reaction. Here is the full stack trace of the null pointer.

    Regards,

    Laurent

     

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    [2017-02-21 19:03:15,392] ERROR http-apr-443-exec-8 com.sdl.lt.worldserver.api.rest.error.ExceptionControllerAdvice: Exception intercepted:
    java.lang.NullPointerException
    at com.sdl.lt.worldserver.service.attribute.action.ChangeAttributesAction.getAttributesMap(ChangeAttributesAction.java:87)
    at com.sdl.lt.worldserver.service.attribute.action.ChangeAttributesAction.doExecute(ChangeAttributesAction.java:58)
    at com.sdl.lt.worldserver.service.attribute.action.ChangeAttributesAction.doExecute(ChangeAttributesAction.java:37)
    at com.sdl.lt.worldserver.action.GenericAction.executeInsidePermissions(GenericAction.java:69)
    at com.sdl.lt.worldserver.action.PermissionExecutor.executeWithPermissions(PermissionExecutor.java:52)
    at com.sdl.lt.worldserver.action.PermissionExecutor.execute(PermissionExecutor.java:39)
    at com.sdl.lt.worldserver.action.GenericAction.actionExecution(GenericAction.java:63)
    at com.sdl.lt.worldserver.action.GenericAction.lambda$execute$0(GenericAction.java:58)
    at com.sdl.lt.worldserver.service.util.PerformanceLogger.withPerformanceLog(PerformanceLogger.java:19)
    at com.sdl.lt.worldserver.action.GenericAction.execute(GenericAction.java:58)
    at com.sdl.lt.worldserver.action.BatchAction.executeRequest(BatchAction.java:59)
    at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1612)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at com.sdl.lt.worldserver.action.BatchAction.execute(BatchAction.java:47)
    at com.sdl.lt.worldserver.service.attribute.AttributeValueServiceLegacy.changeAttributes(AttributeValueServiceLegacy.java:109)
    at com.sdl.lt.worldserver.service.attribute.AttributeValueServiceLegacy$$FastClassBySpringCGLIB$$e3e319f.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Children