提交 da236bad 编写于 作者: M mindless

Support "optional=true" parameter for @Extension to logging exceptions at FINE

level (instead of WARNING) for any class loading problems reading the extension.
Also move up to sezpoz 1.7 and remove catch block for LinkageError in
ExtensionFinder.. sezpoz should now throw only InstantiationException.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30963 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9b2d1099
......@@ -736,7 +736,7 @@ THE SOFTWARE.
<dependency>
<groupId>net.java.sezpoz</groupId>
<artifactId>sezpoz</artifactId>
<version>1.5</version>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.jvnet.hudson</groupId>
......
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc.
* Copyright (c) 2004-2010, Sun Microsystems, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -78,4 +78,10 @@ public @interface Extension {
* @since 1.306
*/
double ordinal() default 0;
/**
* If an extension is optional, don't log any class loading errors when reading it.
* @since 1.358
*/
boolean optional() default false;
}
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc.
* Copyright (c) 2004-2010, Sun Microsystems, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -125,10 +125,8 @@ public abstract class ExtensionFinder implements ExtensionPoint {
result.add(new ExtensionComponent<T>(type.cast(instance),item.annotation()));
}
} catch (InstantiationException e) {
LOGGER.log(Level.WARNING, "Failed to load "+item.className(),e);
} catch (LinkageError e) {
// work around for SEZPOZ-11: https://sezpoz.dev.java.net/issues/show_bug.cgi?id=11
LOGGER.log(Level.WARNING, "Failed to load "+item.className(),e);
LOGGER.log(item.annotation().optional() ? Level.FINE : Level.WARNING,
"Failed to load "+item.className(), e);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册