[ 
https://issues.apache.org/jira/browse/KYLIN-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

peng.jianhua updated KYLIN-3060:
--------------------------------
    Description: 
When you set the invalid parameter for creating or updating a streaming table, 
the client will show an error message dialog, refer to 
[^create_non_interger_ID.png] and [^edit_non_interger_ID.png].
I analyze the Kylin server log, there are some null pointer exceptions, then I 
analyze the StreamingController.java, whose logical processing of streaming 
table has a bug, which will cause a NullPointerException. 
eg. When the streamingRequest.getKafkaConfig() has a invalid pamamter, the 
kafkaConfig will be null, then "kafkaConfig.setName(tableDesc.getIdentity());" 
will cause the NullPointerException.

{code:java}
public StreamingRequest saveStreamingConfig(@RequestBody StreamingRequest 
streamingRequest) {
  ......
  KafkaConfig kafkaConfig = deserializeKafkaSchemalDesc(streamingRequest);
  ......
  kafkaConfig.setName(tableDesc.getIdentity());
  ......
}

    private KafkaConfig deserializeKafkaSchemalDesc(StreamingRequest 
streamingRequest) {
        KafkaConfig desc = null;
        try {
            logger.debug("Saving KafkaConfig " + 
streamingRequest.getKafkaConfig());
            desc = JsonUtil.readValue(streamingRequest.getKafkaConfig(), 
KafkaConfig.class);
        } catch (JsonParseException e) {
            logger.error("The KafkaConfig definition is invalid.", e);
            updateRequest(streamingRequest, false, e.getMessage());
        } catch (JsonMappingException e) {
            logger.error("The data KafkaConfig definition is invalid.", e);
            updateRequest(streamingRequest, false, e.getMessage());
        } catch (IOException e) {
            logger.error("Failed to deal with the request.", e);
            throw new InternalErrorException("Failed to deal with the request:" 
+ e.getMessage(), e);
        }
        return desc;
    }
{code}


So I have repaired it, then the client will tell you the detail error message( 
refer to [^after_repaired.png]), the server no longer throws an null point 
exception.
you can check the patch, thanks!

{panel:title=Kylin server log}
2017-11-24 18:42:21,531 ERROR [http-bio-7070-exec-10] 
controller.StreamingController:202 : Failed to deal with the request:null
{color:red}java.lang.NullPointerException{color}
        at 
org.apache.kylin.source.kafka.KafkaConfigManager.updateKafkaConfig(KafkaConfigManager.java:156)
        at 
org.apache.kylin.rest.service.KafkaConfigService.updateKafkaConfig(KafkaConfigService.java:84)
        at 
{color:red}org.apache.kylin.rest.controller.StreamingController.updateStreamingConfig(StreamingController.java:198){color}
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
{panel}


  was:
When you set the invalid parameter for creating or updating a streaming table, 
the client will show an error message dialog, refer to 
[^create_non_interger_ID.png] and [^edit_non_interger_ID.png].
I analyze the Kylin server log, there are some null pointer exceptions, then I 
analyze the StreamingController.java, whose logical processing of streaming 
table has a bug, which will cause a NullPointerException. 
So I have repaired it, then the client will tell you the detail error message( 
refer to [^after_repaired.png]), the server no longer throws an null point 
exception.
you can check the patch, thanks!

{panel:title=Kylin server log}
2017-11-24 18:42:21,531 ERROR [http-bio-7070-exec-10] 
controller.StreamingController:202 : Failed to deal with the request:null
{color:red}java.lang.NullPointerException{color}
        at 
org.apache.kylin.source.kafka.KafkaConfigManager.updateKafkaConfig(KafkaConfigManager.java:156)
        at 
org.apache.kylin.rest.service.KafkaConfigService.updateKafkaConfig(KafkaConfigService.java:84)
        at 
{color:red}org.apache.kylin.rest.controller.StreamingController.updateStreamingConfig(StreamingController.java:198){color}
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
{panel}



> The logical processing of creating or updating streaming table has a bug in 
> server, which will cause a NullPointerException.
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KYLIN-3060
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3060
>             Project: Kylin
>          Issue Type: Bug
>          Components: streaming
>            Reporter: peng.jianhua
>            Assignee: peng.jianhua
>              Labels: patch
>         Attachments: 
> 0001-KYLIN-3060-The-logical-processing-of-creating-or-upd.patch, 
> after_repaired.png, create_non_interger_ID.png, edit_non_interger_ID.png
>
>
> When you set the invalid parameter for creating or updating a streaming 
> table, the client will show an error message dialog, refer to 
> [^create_non_interger_ID.png] and [^edit_non_interger_ID.png].
> I analyze the Kylin server log, there are some null pointer exceptions, then 
> I analyze the StreamingController.java, whose logical processing of streaming 
> table has a bug, which will cause a NullPointerException. 
> eg. When the streamingRequest.getKafkaConfig() has a invalid pamamter, the 
> kafkaConfig will be null, then 
> "kafkaConfig.setName(tableDesc.getIdentity());" will cause the 
> NullPointerException.
> {code:java}
> public StreamingRequest saveStreamingConfig(@RequestBody StreamingRequest 
> streamingRequest) {
>   ......
>   KafkaConfig kafkaConfig = deserializeKafkaSchemalDesc(streamingRequest);
>   ......
>   kafkaConfig.setName(tableDesc.getIdentity());
>   ......
> }
>     private KafkaConfig deserializeKafkaSchemalDesc(StreamingRequest 
> streamingRequest) {
>         KafkaConfig desc = null;
>         try {
>             logger.debug("Saving KafkaConfig " + 
> streamingRequest.getKafkaConfig());
>             desc = JsonUtil.readValue(streamingRequest.getKafkaConfig(), 
> KafkaConfig.class);
>         } catch (JsonParseException e) {
>             logger.error("The KafkaConfig definition is invalid.", e);
>             updateRequest(streamingRequest, false, e.getMessage());
>         } catch (JsonMappingException e) {
>             logger.error("The data KafkaConfig definition is invalid.", e);
>             updateRequest(streamingRequest, false, e.getMessage());
>         } catch (IOException e) {
>             logger.error("Failed to deal with the request.", e);
>             throw new InternalErrorException("Failed to deal with the 
> request:" + e.getMessage(), e);
>         }
>         return desc;
>     }
> {code}
> So I have repaired it, then the client will tell you the detail error 
> message( refer to [^after_repaired.png]), the server no longer throws an null 
> point exception.
> you can check the patch, thanks!
> {panel:title=Kylin server log}
> 2017-11-24 18:42:21,531 ERROR [http-bio-7070-exec-10] 
> controller.StreamingController:202 : Failed to deal with the request:null
> {color:red}java.lang.NullPointerException{color}
>         at 
> org.apache.kylin.source.kafka.KafkaConfigManager.updateKafkaConfig(KafkaConfigManager.java:156)
>         at 
> org.apache.kylin.rest.service.KafkaConfigService.updateKafkaConfig(KafkaConfigService.java:84)
>         at 
> {color:red}org.apache.kylin.rest.controller.StreamingController.updateStreamingConfig(StreamingController.java:198){color}
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
> {panel}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to