Skip to content

Commit 2646e79

Browse files
committed
Updates Java UserAgent Error Handling
A concern was raised over the possibility of an Error being thrown during the initialization of the UserAgent class resulting in the class to fail to load and giving users an obscure NoClassDefFoundError. I'm upgrading the existing catch(Exception)'s to catch(Throwable)'s to catch these potential Error's and ensure that the user agent class will always load correctly. Any missing data due to caught errors will be replaced with a default value of "NotAvailable" Missing data in the user agent on rare occasions is a small concern and preferable to the driver crashing altogether.
1 parent c1d5e14 commit 2646e79

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

  • gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util
  • gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver

gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/Gremlin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class Gremlin {
3232
try {
3333
version = Manifests.read("version");
3434
}
35-
catch (Exception e) {
35+
catch (Throwable t) {
3636
version = "VersionNotFound";
3737
}
3838
}

gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/UserAgent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static String getAttributeOrDefault(ThrowingSupplier<String> supplier){
5959
try {
6060
ret = supplier.get().replace(' ', '_');
6161
}
62-
catch (Exception e) {
62+
catch (Throwable t) {
6363
// No action taken, default value of "NotAvailable" will be used if supplier fails
6464
}
6565
return ret;

0 commit comments

Comments
 (0)