package datacentermr;

import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.log4j.Logger;

public class EsFeederMapper extends Mapper<Object, Text, NullWritable, MapWritable> {
	private static Logger log = Logger.getLogger(EsFeederMapper.class);
	
	@Override
	public void map(Object key, Text value, Context context)
			throws IOException, InterruptedException {
	 
		MapWritable doc = new MapWritable();
		String[] line = value.toString().split(",");
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		
		
		doc.put(new Text("hcan_SiteName"), new Text(line[1]));
		doc.put(new Text("hcan_RoomName"), new Text(line[2]));
		Date date = null;
		try {
			date = dateFormat.parse(line[3]);
			long time = date.getTime();
			doc.put(new Text("hcan_Fecha"), new FloatWritable(time));
			doc.put(new Text("hcan_Power"), new FloatWritable(Float.parseFloat(line[4])));
			doc.put(new Text("hcan_Temp"), new FloatWritable(Float.parseFloat(line[5])));
			doc.put(new Text("hcan_Humidity"), new FloatWritable(Float.parseFloat(line[6])));
			date = dateFormat.parse(line[7]);
			time = date.getTime();
			doc.put(new Text("hcan_Timestamp"), new FloatWritable(time));
			context.write(NullWritable.get(), doc);
		} catch (ParseException e) {
			log.error(e.getMessage());
		}
 }
}

@@ -109,66 +109,8 @@
 ion;
-%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;
 %0A%0Aim
@@ -708,82 +708,8 @@
 %22);%0A
-%09%09DateFormat dateFormat = new SimpleDateFormat(%22yyyy-MM-dd HH:mm:ss%22);%0A%09%09%0A
 %09%09%0A%09
@@ -825,105 +825,8 @@
 ));%0A
-%09%09Date date = null;%0A%09%09try %7B%0A%09%09%09date = dateFormat.parse(line%5B3%5D);%0A%09%09%09long time = date.getTime();%0A%09
 %09%09do
@@ -859,39 +859,49 @@
 %22), new 
-FloatWritable(time
+Text(line%5B3%5D.replace(' ','T'
 ))
+)
 ;%0A
-%09
 %09%09doc.pu
@@ -969,25 +969,24 @@
 line%5B4%5D)));%0A
-%09
 %09%09doc.put(ne
@@ -1051,25 +1051,24 @@
 ne%5B5%5D)));%0A%09%09
-%09
 doc.put(new 
@@ -1141,72 +1141,8 @@
 ));%0A
-%09%09%09date = dateFormat.parse(line%5B7%5D);%0A%09%09%09time = date.getTime();%0A%09
 %09%09do
@@ -1183,31 +1183,41 @@
 new 
-FloatWritable(time
+Text(line%5B6%5D.replace(' ','T')
 ));%0A
-%09
 %09%09co
@@ -1258,73 +1258,8 @@
 c);%0A
-%09%09%7D catch (ParseException e) %7B%0A%09%09%09log.error(e.getMessage());%0A%09%09%7D%0A
  %7D%0A%7D

Replace date parsing by string replace