This is an automated email from the ASF dual-hosted git repository. hanahmily pushed a commit to branch fix/linear-npe in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git
The following commit(s) were added to refs/heads/fix/linear-npe by this push: new f32c9e3 Avoid null point exception new 061d334 Merge remote-tracking branch 'origin/fix/linear-npe' into fix/linear-npe f32c9e3 is described below commit f32c9e36ac32c11a298e7797693e5f6cf267608e Author: Gao Hongtao <hanahm...@gmail.com> AuthorDate: Mon Oct 8 20:54:18 2018 +0800 Avoid null point exception --- .../oap/server/core/analysis/indicator/PxxIndicator.java | 2 +- .../storage/plugin/elasticsearch/query/MetricQueryEsDAO.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java index d16f9bf..7dab015 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/indicator/PxxIndicator.java @@ -38,7 +38,7 @@ public abstract class PxxIndicator extends Indicator implements IntValueHolder { protected static final String VALUE = "value"; protected static final String PRECISION = "precision"; - @Getter @Setter @Column(columnName = VALUE) private int value; + @Getter @Setter @Column(columnName = VALUE, isValue = true) private int value; @Getter @Setter @Column(columnName = PRECISION) private int precision; @Getter @Setter @Column(columnName = DETAIL_GROUP) private IntKeyLongValueArray detailGroup; diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetricQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetricQueryEsDAO.java index c9dcf26..ba9d192 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetricQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetricQueryEsDAO.java @@ -89,11 +89,14 @@ public class MetricQueryEsDAO extends EsDAO implements IMetricQueryDAO { IntValues intValues = new IntValues(); for (MultiGetItemResponse itemResponse : response.getResponses()) { - int value = ((Number)itemResponse.getResponse().getSource().getOrDefault(valueCName, 0)).intValue(); KVInt kvInt = new KVInt(); kvInt.setId(itemResponse.getId()); - kvInt.setValue(value); + kvInt.setValue(0); + Map<String, Object> source = itemResponse.getResponse().getSource(); + if (source != null) { + kvInt.setValue(((Number)source.getOrDefault(valueCName, 0)).intValue()); + } intValues.getValues().add(kvInt); } return intValues;