[
https://issues.apache.org/jira/browse/TAJO-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14394108#comment-14394108
]
ASF GitHub Bot commented on TAJO-1512:
--------------------------------------
GitHub user dongjoon-hyun opened a pull request:
https://github.com/apache/tajo/pull/504
TAJO-1512: Fix Aggregation.clone NPE bug
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dongjoon-hyun/tajo TAJO-1512
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tajo/pull/504.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #504
----
commit c929b5b49866e29b2b948277387856017f26fbcb
Author: Dongjoon Hyun <[email protected]>
Date: 2015-04-03T06:00:52Z
TAJO-1512: Fix Aggregation.clone NPE bug
----
> 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
>
> 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)