Load from the named resource.
(String name, Class<?> cl, StreamLoader loader, boolean expected)
| 1164 | * Load from the named resource. |
| 1165 | */ |
| 1166 | private void loadResource(String name, Class<?> cl, StreamLoader loader, |
| 1167 | boolean expected) { |
| 1168 | InputStream clis = null; |
| 1169 | try { |
| 1170 | clis = getResourceAsStream(cl, name); |
| 1171 | if (clis != null) { |
| 1172 | loader.load(clis); |
| 1173 | logger.log(Level.CONFIG, "successfully loaded resource: {0}", |
| 1174 | name); |
| 1175 | } else { |
| 1176 | if (expected) |
| 1177 | logger.log(Level.WARNING, |
| 1178 | "expected resource not found: {0}", name); |
| 1179 | } |
| 1180 | } catch (IOException e) { |
| 1181 | logger.log(Level.CONFIG, "Exception loading resource", e); |
| 1182 | } catch (SecurityException sex) { |
| 1183 | logger.log(Level.CONFIG, "Exception loading resource", sex); |
| 1184 | } finally { |
| 1185 | try { |
| 1186 | if (clis != null) |
| 1187 | clis.close(); |
| 1188 | } catch (IOException ex) { } // ignore it |
| 1189 | } |
| 1190 | } |
| 1191 | |
| 1192 | /** |
| 1193 | * Load all of the named resource. |
no test coverage detected