[ 
https://issues.apache.org/jira/browse/MAHOUT-1612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14385453#comment-14385453
 ] 

ASF GitHub Bot commented on MAHOUT-1612:
----------------------------------------

Github user smarthi commented on a diff in the pull request:

    https://github.com/apache/mahout/pull/55#discussion_r27347130
  
    --- Diff: 
integration/src/main/java/org/apache/mahout/utils/clustering/JsonClusterWriter.java
 ---
    @@ -70,20 +71,30 @@ public void write(ClusterWritable clusterWritable) 
throws IOException {
         Map<String, Object> res = Maps.newHashMap();
     
         // get top terms
    -    List<Object> topTerms = getTopFeaturesList(clusterWritable.getValue()
    +    if (dictionary != null) {
    +      List<Object> topTerms = getTopFeaturesList(clusterWritable.getValue()
             .getCenter(), dictionary, numTopFeatures);
    -    res.put("top_terms", topTerms);
    -
    +      res.put("top_terms", topTerms);
    +    } else {
    +      res.put("top_terms", Lists.newArrayList());
    --- End diff --
    
    Replace Lists.newArrayList() with new ArrayList<>(). Since we are now on 
Java 7. Also replace all similar codes in this code.  Same with 
Maps.newHashMap() to be replaced by new HashMap<>()


> NullPointerException happens during JSON output format for clusterdumper
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-1612
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1612
>             Project: Mahout
>          Issue Type: Bug
>          Components: Clustering
>    Affects Versions: 0.9
>            Reporter: Guo Ruijing
>            Assignee: Suneel Marthi
>              Labels: legacy
>             Fix For: 0.10.0
>
>
> 1. download datafile from:
> http://archive.ics.uci.edu/ml/databases/synthetic_control/synthetic_control.data
> 2. put data file on hdfs:
> hdfs dfs -mkdir testdata
> hdfs dfs -put synthetic_control.data testdata/
> 3. run a mahout clustering job:
> mahout org.apache.mahout.clustering.syntheticcontrol.kmeans.Job
> 4. run clusterdump with JSON format:
> mahout clusterdump i output/clusters*-final -p output/clusteredPoints -o 
> /tmp/report -of JSON
> expected:
> clusterdump with JSON format should succeeded same as CSV and TEXT
> actually:
> clusterdump with JSON format throw NullPointerException



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to