Return-Path: X-Original-To: apmail-mahout-dev-archive@www.apache.org Delivered-To: apmail-mahout-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8501DB4B5 for ; Wed, 18 Jan 2012 03:02:24 +0000 (UTC) Received: (qmail 530 invoked by uid 500); 18 Jan 2012 03:02:23 -0000 Delivered-To: apmail-mahout-dev-archive@mahout.apache.org Received: (qmail 99729 invoked by uid 500); 18 Jan 2012 03:02:20 -0000 Mailing-List: contact dev-help@mahout.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mahout.apache.org Delivered-To: mailing list dev@mahout.apache.org Received: (qmail 98720 invoked by uid 99); 18 Jan 2012 03:02:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jan 2012 03:02:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jan 2012 03:02:10 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E9678152BAB for ; Wed, 18 Jan 2012 03:01:48 +0000 (UTC) Date: Wed, 18 Jan 2012 03:01:48 +0000 (UTC) From: "Stuart Smith (Commented) (JIRA)" To: dev@mahout.apache.org Message-ID: <1853408099.51457.1326855709037.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1154599650.51441.1326855459747.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided] MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MAHOUT-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188229#comment-13188229 ] Stuart Smith commented on MAHOUT-948: ------------------------------------- Using correct code tags.. {code} public double getValue(String data, int idx) { ARFFType type = typeMap.get(idx); data = QUOTE_PATTERN.matcher(data).replaceAll(""); data = data.trim(); double result; if( type == null ) { throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx ); } switch (type) { case NUMERIC: result = processNumeric(data); break; {code} > Improved error reporting when ARFF index does not exist in arff.vector [fix provided] > ------------------------------------------------------------------------------------- > > Key: MAHOUT-948 > URL: https://issues.apache.org/jira/browse/MAHOUT-948 > Project: Mahout > Issue Type: Improvement > Components: Integration > Environment: I just pulled the latest from SVN today (01/17/2012) > Reporter: Stuart Smith > Priority: Trivial > Labels: patch > Attachments: MapBackedARFFModel.java > > Original Estimate: 0h > Remaining Estimate: 0h > > MapBackedARFFModel throws an NPE when getValue is passed an idx for an attribute that does not exist. > In short, this: > > public double getValue(String data, int idx) { > ARFFType type = typeMap.get(idx); > data = QUOTE_PATTERN.matcher(data).replaceAll(""); > data = data.trim(); > double result; > if( type == null ) { > throw new IllegalStateException( "Attribute type cannot be NULL, attribute index was: " + idx ); > } > switch (type) { > case NUMERIC: > result = processNumeric(data); > > Is better than this: > > public double getValue(String data, int idx) { > ARFFType type = typeMap.get(idx); > data = QUOTE_PATTERN.matcher(data).replaceAll(""); > data = data.trim(); > double result; > switch (type) { > case NUMERIC: > result = processNumeric(data); > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira