[
https://issues.apache.org/jira/browse/METRON-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15302055#comment-15302055
]
ASF GitHub Bot commented on METRON-100:
---------------------------------------
Github user cestella commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/134#discussion_r64742580
--- Diff:
metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/adapters/jdbc/JdbcAdapter.java
---
@@ -38,6 +39,27 @@
private JdbcConfig config;
private String host;
+ protected boolean isConnectionClosed() {
+ boolean isClosed = statement == null || connection == null;
+ if(!isClosed) {
+ try {
+ isClosed = statement.isClosed() || connection.isClosed();
+ } catch (SQLException e) {
+ _LOG.error("Unable to maintain open JDBC connection: " +
e.getMessage(), e);
+ isClosed = true;
+ }
+ }
+ return isClosed;
+ }
+
+ protected boolean resetConnectionIfNecessary() {
+ if(isConnectionClosed())
+ {
--- End diff --
So, I'll definitely make the class consistently K&R (I must've fat-fingered
the newline). We don't have a coherent style at the moment in this respect. I
prefer K&R bracing, so you'll see that in my code, but yeah, I agree, we need
to correct style as we see it.
Also, don't worry about nitpicking..we all have to live in this code. :)
> GeoIP errors out silently in vagrant
> ------------------------------------
>
> Key: METRON-100
> URL: https://issues.apache.org/jira/browse/METRON-100
> Project: Metron
> Issue Type: Bug
> Reporter: Casey Stella
>
> GeoIP Enrichment errors out silently in vagrant. It's unclear whether it's
> just some data that is problematic or everything, but I see this in the logs:
> com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column
> 'ip' at row 1
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4224)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:2188)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:2044) ~[stormjar.jar:?]
> at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3538)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:489)
> ~[stormjar.jar:?]
> at
> com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3240)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2411)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2834)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
> ~[stormjar.jar:?]
> at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1569)
> ~[stormjar.jar:?]
> at
> org.apache.metron.enrichment.adapters.geo.GeoAdapter.enrich(GeoAdapter.java:50)
> [stormjar.jar:?]
> at
> org.apache.metron.enrichment.adapters.geo.GeoAdapter.enrich(GeoAdapter.java:28)
> [stormjar.jar:?]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)