Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 158E6200D1F for ; Fri, 8 Sep 2017 02:03:40 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 14ADF1609BE; Fri, 8 Sep 2017 00:03:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 63AEB1609DC for ; Fri, 8 Sep 2017 02:03:39 +0200 (CEST) Received: (qmail 10393 invoked by uid 500); 8 Sep 2017 00:03:38 -0000 Mailing-List: contact commits-help@predictionio.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@predictionio.incubator.apache.org Delivered-To: mailing list commits@predictionio.incubator.apache.org Received: (qmail 10383 invoked by uid 99); 8 Sep 2017 00:03:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Sep 2017 00:03:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 0425ED84FC for ; Fri, 8 Sep 2017 00:03:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.222 X-Spam-Level: X-Spam-Status: No, score=-4.222 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id FJbBOvkh0LHb for ; Fri, 8 Sep 2017 00:03:33 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 2A9D3610C3 for ; Fri, 8 Sep 2017 00:02:37 +0000 (UTC) Received: (qmail 8500 invoked by uid 99); 8 Sep 2017 00:02:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Sep 2017 00:02:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3C326F56A2; Fri, 8 Sep 2017 00:02:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: shinsuke@apache.org To: commits@predictionio.incubator.apache.org Date: Fri, 08 Sep 2017 00:02:37 -0000 Message-Id: <7480fb4ad85e4f4fbf04ca96ebbda368@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] incubator-predictionio git commit: [PIO-118] ClassCastException from NullWritable to Text in ESEventsUtil archived-at: Fri, 08 Sep 2017 00:03:40 -0000 [PIO-118] ClassCastException from NullWritable to Text in ESEventsUtil Closes #429 Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/69c5e3b7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/69c5e3b7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/69c5e3b7 Branch: refs/heads/develop Commit: 69c5e3b777500b0ecc23516d4ae11c2fc95505c8 Parents: 6cf89c5 Author: Shinsuke Sugaya Authored: Fri Sep 8 09:02:15 2017 +0900 Committer: Shinsuke Sugaya Committed: Fri Sep 8 09:02:15 2017 +0900 ---------------------------------------------------------------------- .../data/storage/elasticsearch/ESEventsUtil.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/69c5e3b7/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala ---------------------------------------------------------------------- diff --git a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala index 749ab49..38dec8a 100644 --- a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala +++ b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala @@ -51,11 +51,9 @@ object ESEventsUtil { } def getOptStringCol(col: String): Option[String] = { - val r = result.get(new Text(col)) - if (r == null) { - None - } else { - Some(r.asInstanceOf[Text].toString()) + result.get(new Text(col)) match { + case x if x.isInstanceOf[Text] => Some(x.asInstanceOf[Text].toString) + case _ => None } }