mahout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stuart Smith (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MAHOUT-948) Improved error reporting when ARFF index does not exist in arff.vector [fix provided]
Date Wed, 18 Jan 2012 03:01:48 GMT

    [ 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:
> <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);
> </code>
> Is better than this:
> <code>
>   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);
>  </code>

--
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

        

Mime
View raw message