don't (re) create a string from a numeric timestamp, just return the string we get

This commit is contained in:
Shay Banon 2012-07-11 21:28:14 +02:00
parent 29d6b0e30a
commit 5517df6353
2 changed files with 4 additions and 2 deletions

View File

@ -655,7 +655,7 @@ public class IndexRequest extends ShardReplicationOperationRequest {
// generate timestamp if not provided, we always have one post this stage...
if (timestamp == null) {
timestamp = String.valueOf(System.currentTimeMillis());
timestamp = Long.toString(System.currentTimeMillis());
}
}

View File

@ -160,7 +160,9 @@ public class MappingMetaData {
public static String parseStringTimestamp(String timestampAsString, FormatDateTimeFormatter dateTimeFormatter) throws TimestampParsingException {
long ts;
try {
// if we manage to parse it, its a millisecond timestamp, just return the string as is
ts = Long.parseLong(timestampAsString);
return timestampAsString;
} catch (NumberFormatException e) {
try {
ts = dateTimeFormatter.parser().parseMillis(timestampAsString);
@ -168,7 +170,7 @@ public class MappingMetaData {
throw new TimestampParsingException(timestampAsString);
}
}
return String.valueOf(ts);
return Long.toString(ts);
}