Commit 2ebb9a26f84ef1069a43f9e4efbd666f079539ea
1 parent
a7f2b75f
Exists in
master
Removendo exception desnecessária
Showing
1 changed file
with
8 additions
and
9 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Reflections.java
| ... | ... | @@ -36,7 +36,6 @@ |
| 36 | 36 | */ |
| 37 | 37 | package br.gov.frameworkdemoiselle.util; |
| 38 | 38 | |
| 39 | -import java.io.FileNotFoundException; | |
| 40 | 39 | import java.lang.reflect.Field; |
| 41 | 40 | import java.lang.reflect.Member; |
| 42 | 41 | import java.lang.reflect.Method; |
| ... | ... | @@ -163,33 +162,33 @@ public final class Reflections { |
| 163 | 162 | return type.isAssignableFrom(clazz) && clazz != type; |
| 164 | 163 | } |
| 165 | 164 | |
| 166 | - public static ClassLoader getClassLoaderForClass(final String canonicalName) throws FileNotFoundException { | |
| 165 | + public static ClassLoader getClassLoaderForClass(final String canonicalName) { | |
| 167 | 166 | return Reflections.getClassLoaderForResource(canonicalName.replaceAll("\\.", "/") + ".class"); |
| 168 | 167 | } |
| 169 | 168 | |
| 170 | - public static ClassLoader getClassLoaderForResource(final String resource) throws FileNotFoundException { | |
| 169 | + public static ClassLoader getClassLoaderForResource(final String resource) { | |
| 171 | 170 | final String stripped = resource.startsWith("/") ? resource.substring(1) : resource; |
| 172 | - | |
| 171 | + | |
| 173 | 172 | URL url = null; |
| 174 | 173 | ClassLoader result = Thread.currentThread().getContextClassLoader(); |
| 175 | - | |
| 174 | + | |
| 176 | 175 | if (result != null) { |
| 177 | 176 | url = result.getResource(stripped); |
| 178 | 177 | } |
| 179 | - | |
| 178 | + | |
| 180 | 179 | if (url == null) { |
| 181 | 180 | result = ConfigurationLoader.class.getClassLoader(); |
| 182 | 181 | url = ConfigurationLoader.class.getClassLoader().getResource(stripped); |
| 183 | 182 | } |
| 184 | - | |
| 183 | + | |
| 185 | 184 | if (url == null) { |
| 186 | 185 | result = null; |
| 187 | 186 | } |
| 188 | - | |
| 187 | + | |
| 189 | 188 | return result; |
| 190 | 189 | } |
| 191 | 190 | |
| 192 | - public static URL getResourceAsURL(final String resource) throws FileNotFoundException { | |
| 191 | + public static URL getResourceAsURL(final String resource) { | |
| 193 | 192 | ClassLoader classLoader = getClassLoaderForResource(resource); |
| 194 | 193 | return classLoader != null ? classLoader.getResource(resource) : null; |
| 195 | 194 | } | ... | ... |