(final Class<?> c, final String name)
| 1272 | } |
| 1273 | |
| 1274 | private static InputStream getResourceAsStream(final Class<?> c, |
| 1275 | final String name) throws IOException { |
| 1276 | try { |
| 1277 | return AccessController.doPrivileged( |
| 1278 | new PrivilegedExceptionAction<InputStream>() { |
| 1279 | @Override |
| 1280 | public InputStream run() throws IOException { |
| 1281 | try { |
| 1282 | return c.getResourceAsStream(name); |
| 1283 | } catch (RuntimeException e) { |
| 1284 | // gracefully handle ClassLoader bugs (Tomcat) |
| 1285 | IOException ioex = new IOException( |
| 1286 | "ClassLoader.getResourceAsStream failed"); |
| 1287 | ioex.initCause(e); |
| 1288 | throw ioex; |
| 1289 | } |
| 1290 | } |
| 1291 | } |
| 1292 | ); |
| 1293 | } catch (PrivilegedActionException e) { |
| 1294 | throw (IOException)e.getException(); |
| 1295 | } |
| 1296 | } |
| 1297 | |
| 1298 | private static URL[] getResources(final ClassLoader cl, final String name) { |
| 1299 | return AccessController.doPrivileged(new PrivilegedAction<URL[]>() { |
no test coverage detected