Skip to content

Commit

Permalink
Change from 2.4. to 2.0 compat, remove NumberFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
smxsm committed Nov 28, 2018
1 parent 6fdbfc9 commit b581821
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions src/main/java/de/shoptimax/JRPInputTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.net.URL;
import java.net.Proxy;
import java.net.InetSocketAddress;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.*;

Expand Down Expand Up @@ -255,19 +256,11 @@ public void run() {
// String version = ctx.read("$.version");

Map<String, Object> map = mapper.readValue(json, new TypeReference<Map<String,Object>>(){});
NumberFormat nf = NumberFormat.getInstance();
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
try {
// we have many numeric (custom) fields, so
// try to convert to number, e.g. for "timestamp" and "level"
LOGGER.debug("Parsing key <{}> and value {} to class {}", key, value.toString(), nf.parse(value.toString()).getClass().getName());
eventdata.put(key, nf.parse(value.toString()));
} catch (ParseException e) {
// if failed, it is probably a string :)
eventdata.put(key, value.toString());
}
LOGGER.debug("Storing field <{}> with value <{}>.", key, value);
eventdata.put(key, value);
}
} catch (IOException e) {
eventdata.put("host", new URL(config.getUrl()).getHost());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version=${project.version}
# The required Graylog server version
# no bleeding edge required atm :)
#graylog.version=${graylog.version}
graylog.version=2.4.0
graylog.version=2.0.0

# When set to true (the default) the plugin gets a separate class loader
# when loading the plugin. When set to false, the plugin shares a class loader
Expand Down

0 comments on commit b581821

Please sign in to comment.