Skip to content

Commit

Permalink
Merge pull request #67 from georgekankava/staging/nested-blocks-of-co…
Browse files Browse the repository at this point in the history
…de-should-not-be-left-empty-fix-1

Do at least something for exceptions we swallow but do not expect
  • Loading branch information
saudet committed Feb 18, 2016
2 parents 3380ee9 + 7858f2e commit 4b738fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
16 changes: 12 additions & 4 deletions src/main/java/org/bytedeco/javacpp/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,16 @@ public static Properties loadProperties(String name) {
} finally {
try {
is2.close();
} catch (IOException ex) { }
} catch (IOException ex) {
logger.error("Unable to close resource : " + ex.getMessage());
}
}
} finally {
try {
is.close();
} catch (IOException ex) { }
} catch (IOException ex) {
logger.error("Unable to close resource : " + ex.getMessage());
}
}
return p;
}
Expand Down Expand Up @@ -235,7 +239,9 @@ public static Class getCallerClass(int i) {
return super.getClassContext();
}
}.getClassContext();
} catch (NoSuchMethodError e) { }
} catch (NoSuchMethodError e) {
logger.error("No definition of this method : " + e.getMessage());
}
if (classContext != null) {
for (int j = 0; j < classContext.length; j++) {
if (classContext[j] == Loader.class) {
Expand All @@ -251,7 +257,9 @@ public static Class getCallerClass(int i) {
return Class.forName(classNames[i+j].getClassName());
}
}
} catch (ClassNotFoundException e) { }
} catch (ClassNotFoundException e) {
logger.error("No definition for the class found : " + e.getMessage());
}
}
return null;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/bytedeco/javacpp/Pointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ public int offsetof(String member) {
if (c != Pointer.class) {
offset = Loader.offsetof(c, member);
}
} catch (NullPointerException e) { }
} catch (NullPointerException e) {
return offset;
}
return offset;
}

Expand Down
8 changes: 2 additions & 6 deletions src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2696,18 +2696,14 @@ public File parse(File outputDirectory, String[] classPath, Class cls) throws IO
for (Class c : allInherited) {
try {
((InfoMapper)c.newInstance()).map(infoMap);
} catch (ClassCastException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (ClassCastException | InstantiationException | IllegalAccessException e) {
// fail silently as if the interface wasn't implemented
}
}
leafInfoMap = new InfoMap();
try {
((InfoMapper)cls.newInstance()).map(leafInfoMap);
} catch (ClassCastException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (ClassCastException | InstantiationException | IllegalAccessException e) {
// fail silently as if the interface wasn't implemented
}
infoMap.putAll(leafInfoMap);
Expand Down

0 comments on commit 4b738fa

Please sign in to comment.