提交 99f43d6f 编写于 作者: A alanb

8031394: (sl) Fix exception handling in ServiceLoader

Reviewed-by: ahgross, mchung, weijun
上级 b40cbb6b
...@@ -382,7 +382,7 @@ public final class ServiceLoader<S> ...@@ -382,7 +382,7 @@ public final class ServiceLoader<S>
return p; return p;
} catch (Throwable x) { } catch (Throwable x) {
fail(service, fail(service,
"Provider " + cn + " could not be instantiated: " + x, "Provider " + cn + " could not be instantiated",
x); x);
} }
throw new Error(); // This cannot happen throw new Error(); // This cannot happen
......
...@@ -299,7 +299,7 @@ public final class Service<S> { ...@@ -299,7 +299,7 @@ public final class Service<S> {
return service.cast(c.newInstance()); return service.cast(c.newInstance());
} catch (Throwable x) { } catch (Throwable x) {
fail(service, fail(service,
"Provider " + cn + " could not be instantiated: " + x, "Provider " + cn + " could not be instantiated",
x); x);
} }
return null; /* This cannot happen */ return null; /* This cannot happen */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册