Revision 50157
Added by Alessia Bardi over 6 years ago
OaiFeedMapper.java | ||
---|---|---|
30 | 30 |
import eu.dnetlib.miscutils.functional.xml.IndentXmlString; |
31 | 31 |
import org.apache.commons.io.output.ByteArrayOutputStream; |
32 | 32 |
import org.apache.commons.lang.StringUtils; |
33 |
import org.apache.commons.lang.time.DateUtils; |
|
34 | 33 |
import org.apache.hadoop.io.NullWritable; |
35 | 34 |
import org.apache.hadoop.io.Text; |
36 | 35 |
import org.apache.hadoop.mapreduce.Mapper; |
... | ... | |
114 | 113 |
|
115 | 114 |
String feedDateString = context.getConfiguration().get(JobParams.OAI_FEED_DATE); |
116 | 115 |
try { |
117 |
feedDate = DateUtils.parseDate(feedDateString, new String[]{"yyyy-MM-dd\'T\'hh:mm:ss\'Z\'"}); |
|
116 |
// date will be in the form: 2017-12-18T12:00:04+00:00 |
|
117 |
feedDate = org.apache.commons.lang.time.DateUtils.parseDate( |
|
118 |
feedDateString, |
|
119 |
new String[]{ "yyyy-MM-dd'T'HH:mm:ssXXX", "yyyy-MM-dd'T'HH:mm:ssZ" }); |
|
118 | 120 |
} catch (ParseException e) { |
119 | 121 |
e.printStackTrace(System.err); |
120 | 122 |
throw new RuntimeException(e); |
Also available in: Unified diff
Fixed date parsing in OAI