Commit 2ebb9a26f84ef1069a43f9e4efbd666f079539ea

Authored by Emerson Oliveira
1 parent a7f2b75f
Exists in master

Removendo exception desnecessária

impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Reflections.java
@@ -36,7 +36,6 @@ @@ -36,7 +36,6 @@
36 */ 36 */
37 package br.gov.frameworkdemoiselle.util; 37 package br.gov.frameworkdemoiselle.util;
38 38
39 -import java.io.FileNotFoundException;  
40 import java.lang.reflect.Field; 39 import java.lang.reflect.Field;
41 import java.lang.reflect.Member; 40 import java.lang.reflect.Member;
42 import java.lang.reflect.Method; 41 import java.lang.reflect.Method;
@@ -163,33 +162,33 @@ public final class Reflections { @@ -163,33 +162,33 @@ public final class Reflections {
163 return type.isAssignableFrom(clazz) && clazz != type; 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 return Reflections.getClassLoaderForResource(canonicalName.replaceAll("\\.", "/") + ".class"); 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 final String stripped = resource.startsWith("/") ? resource.substring(1) : resource; 170 final String stripped = resource.startsWith("/") ? resource.substring(1) : resource;
172 - 171 +
173 URL url = null; 172 URL url = null;
174 ClassLoader result = Thread.currentThread().getContextClassLoader(); 173 ClassLoader result = Thread.currentThread().getContextClassLoader();
175 - 174 +
176 if (result != null) { 175 if (result != null) {
177 url = result.getResource(stripped); 176 url = result.getResource(stripped);
178 } 177 }
179 - 178 +
180 if (url == null) { 179 if (url == null) {
181 result = ConfigurationLoader.class.getClassLoader(); 180 result = ConfigurationLoader.class.getClassLoader();
182 url = ConfigurationLoader.class.getClassLoader().getResource(stripped); 181 url = ConfigurationLoader.class.getClassLoader().getResource(stripped);
183 } 182 }
184 - 183 +
185 if (url == null) { 184 if (url == null) {
186 result = null; 185 result = null;
187 } 186 }
188 - 187 +
189 return result; 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 ClassLoader classLoader = getClassLoaderForResource(resource); 192 ClassLoader classLoader = getClassLoaderForResource(resource);
194 return classLoader != null ? classLoader.getResource(resource) : null; 193 return classLoader != null ? classLoader.getResource(resource) : null;
195 } 194 }