Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure a message is logged if we can not create an override #80

Merged
merged 2 commits into from
Jun 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/main/java/hudson/remoting/ClassFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,20 @@ public final Class check(Class c) {
* values provide for user specified overrides - see {@link #FILE_OVERRIDE_LOCATION_PROPERTY}.
*/
/*package*/ static ClassFilter createDefaultInstance() {
List<Pattern> patternOverride = loadPatternOverride();
if (patternOverride != null) {
LOGGER.log(Level.FINE, "Using user specified overrides for class blacklisting");
return new RegExpClassFilter(patternOverride);
} else {
LOGGER.log(Level.FINE, "Using default in built class blacklisting");
return new RegExpClassFilter(DEFAULT_PATTERNS);
try {
List<Pattern> patternOverride = loadPatternOverride();
if (patternOverride != null) {
LOGGER.log(Level.FINE, "Using user specified overrides for class blacklisting");
return new RegExpClassFilter(patternOverride);
} else {
LOGGER.log(Level.FINE, "Using default in built class blacklisting");
return new RegExpClassFilter(DEFAULT_PATTERNS);
}
}
catch (Error e) {
// when being used by something like XStream the actual cause gets swallowed
LOGGER.log(Level.SEVERE, "Failed to initialize the default class filter", e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of this construct, because it may hide the original OOM if a new one happens within Logger listeners. But good for other error types

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this happens early on so if we are OOM there then wehey...
now you can argue this should be Throwable or a specific Error should be thrown.
or even a big fat 🐛 that List<Pattern> patternOverride = loadPatternOverride(); should be inside the try block.

throw e;
}
}

Expand Down