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

Dongjoon Hyun updated TAJO-1512:
--------------------------------
    Attachment: TAJO-1512.Hyun.150403.0.patch

> Fix Aggregation.clone NPE bug
> -----------------------------
>
>                 Key: TAJO-1512
>                 URL: https://issues.apache.org/jira/browse/TAJO-1512
>             Project: Tajo
>          Issue Type: Bug
>            Reporter: Dongjoon Hyun
>            Assignee: Dongjoon Hyun
>            Priority: Critical
>         Attachments: TAJO-1512.Hyun.150403.0.patch
>
>
> When `Expr.clone()` is called, NPE is raised because `Aggregation.clone()` 
> does not check its `null` array. This issue should be solved for others 
> issues reusing `Expr`. Please refer the following code. 
> {code:java}
> -    aggregation.namedExprs = new NamedExpr[namedExprs.length];
> -    for (int i = 0; i < namedExprs.length; i++) {
> -      aggregation.namedExprs[i] = (NamedExpr) namedExprs[i].clone();
> +    if (namedExprs != null) {
> +      aggregation.namedExprs = new NamedExpr[namedExprs.length];
> +      for (int i = 0; i < namedExprs.length; i++) {
> +        aggregation.namedExprs[i] = (NamedExpr) namedExprs[i].clone();
> +      }
>      }
>  
> -    aggregation.groups = new GroupElement[groups.length];
> -    for (int i = 0; i < groups.length; i++) {
> -      aggregation.groups[i] = (GroupElement) groups[i].clone();
> +    if (groups != null) {
> +      aggregation.groups = new GroupElement[groups.length];
> +      for (int i = 0; i < groups.length; i++) {
> +        aggregation.groups[i] = (GroupElement) groups[i].clone();
> +      }
>      }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to