package com.ontology2.telepath.project3d;

import com.google.common.base.Splitter;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
import java.util.Iterator;

public class Project3DMapper extends Mapper<LongWritable,Text,Text,LongWritable> {
    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
    }

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        Iterator<String> parts= Splitter.on(' ').split(value.toString()).iterator();
        String lang=parts.next();
        String page=parts.next();
        Long count=Long.parseLong(parts.next());

        if (!lang.equals("en"))
            return;

        context.write(new Text(page),new LongWritable(count));
    }
}

@@ -76,16 +76,101 @@
 litter;%0A
+import org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A
 import o
@@ -335,16 +335,57 @@
 terator;
+%0Aimport java.util.NoSuchElementException;
 %0A%0Apublic
@@ -461,16 +461,127 @@
 able%3E %7B%0A
+    private Splitter SPACE_SPLITTER =Splitter.on(' ');%0A    Log LOG= LogFactory.getLog(Project3DMapper.class);%0A%0A
     @Ove
@@ -827,32 +827,50 @@
 ptedException %7B%0A
+        try %7B%0A    
         Iterator
@@ -886,31 +886,29 @@
 parts= S
-plitter.on(' ')
+PACE_SPLITTER
 .split(v
@@ -940,24 +940,28 @@
 ();%0A        
+   
+ 
 String lang=
@@ -966,32 +966,36 @@
 g=parts.next();%0A
+    
         String p
@@ -1020,16 +1020,20 @@
         
+ 
+   
 Long cou
@@ -1074,16 +1074,20 @@
         
+   
+ 
 if (!lan
@@ -1114,16 +1114,20 @@
         
+    
 return;%0A
@@ -1127,16 +1127,20 @@
 eturn;%0A%0A
+    
         
@@ -1194,16 +1194,140 @@
 ount));%0A
+        %7D catch(NoSuchElementException nsee) %7B%0A            LOG.warn(%22invalid input line %5B%22+value.toString()+%22%5D%22);%0A        %7D%0A
     %7D%0A%7D%0A

add some error handling to logic to catch a case that blew up the last run