Fix some compile warnings
This commit is contained in:
parent
5a47360cb5
commit
c1f8fd2bac
|
@ -121,6 +121,8 @@ public class PropertiesLauncher extends Launcher {
|
|||
|
||||
private static final Pattern WORD_SEPARATOR = Pattern.compile("\\W+");
|
||||
|
||||
private static final URL[] EMPTY_URLS = {};
|
||||
|
||||
private final File home;
|
||||
|
||||
private List<String> paths = new ArrayList<String>(DEFAULT_PATHS);
|
||||
|
@ -493,28 +495,32 @@ public class PropertiesLauncher extends Launcher {
|
|||
private void addParentClassLoaderEntries(List<Archive> lib) throws IOException,
|
||||
URISyntaxException {
|
||||
ClassLoader parentClassLoader = getClass().getClassLoader();
|
||||
if (parentClassLoader instanceof URLClassLoader) {
|
||||
URLClassLoader urlClassLoader = (URLClassLoader) parentClassLoader;
|
||||
for (URL url : urlClassLoader.getURLs()) {
|
||||
if (url.toString().endsWith(".jar") || url.toString().endsWith(".zip")) {
|
||||
lib.add(0, new JarFileArchive(new File(url.toURI())));
|
||||
}
|
||||
else if (url.toString().endsWith("/*")) {
|
||||
String name = url.getFile();
|
||||
File dir = new File(name.substring(0, name.length() - 1));
|
||||
if (dir.exists()) {
|
||||
lib.add(0,
|
||||
new ExplodedArchive(new File(name.substring(0,
|
||||
name.length() - 1)), false));
|
||||
}
|
||||
}
|
||||
else {
|
||||
lib.add(0, new ExplodedArchive(new File(url.getFile())));
|
||||
for (URL url : getURLs(parentClassLoader)) {
|
||||
if (url.toString().endsWith(".jar") || url.toString().endsWith(".zip")) {
|
||||
lib.add(0, new JarFileArchive(new File(url.toURI())));
|
||||
}
|
||||
else if (url.toString().endsWith("/*")) {
|
||||
String name = url.getFile();
|
||||
File dir = new File(name.substring(0, name.length() - 1));
|
||||
if (dir.exists()) {
|
||||
lib.add(0,
|
||||
new ExplodedArchive(new File(name.substring(0,
|
||||
name.length() - 1)), false));
|
||||
}
|
||||
}
|
||||
else {
|
||||
lib.add(0, new ExplodedArchive(new File(url.getFile())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private URL[] getURLs(ClassLoader classLoader) {
|
||||
if (classLoader instanceof URLClassLoader) {
|
||||
return ((URLClassLoader) classLoader).getURLs();
|
||||
}
|
||||
return EMPTY_URLS;
|
||||
}
|
||||
|
||||
private String cleanupPath(String path) {
|
||||
path = path.trim();
|
||||
if (path.toLowerCase().endsWith(".jar") || path.toLowerCase().endsWith(".zip")) {
|
||||
|
|
|
@ -126,6 +126,7 @@ public class ExplodedArchiveTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
public void getFilteredArchive() throws Exception {
|
||||
Archive filteredArchive = this.archive
|
||||
.getFilteredArchive(new Archive.EntryRenameFilter() {
|
||||
|
|
|
@ -281,6 +281,7 @@ public class RandomAccessJarFileTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
public void verifySignedJar() throws Exception {
|
||||
String classpath = System.getProperty("java.class.path");
|
||||
String[] entries = classpath.split(System.getProperty("path.separator"));
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.springframework.web.context.support.GenericWebApplicationContext;
|
|||
* class and only creates a web application context if it is present. Non-web features,
|
||||
* like a repository layer, can be tested cleanly by simply <em>not</em> marking the test
|
||||
* class <code>@WebAppConfiguration</code>.
|
||||
*
|
||||
* <p>
|
||||
* If <code>@ActiveProfiles</code> are provided in the test class they will be used to
|
||||
* create the application context.
|
||||
|
@ -92,12 +91,9 @@ public class SpringApplicationContextLoader extends AbstractContextLoader {
|
|||
}
|
||||
|
||||
/**
|
||||
* Detect the default configuration classes for the supplied test class.
|
||||
*
|
||||
* <p>
|
||||
* The default implementation simply delegates to
|
||||
* {@link AnnotationConfigContextLoaderUtils#detectDefaultConfigurationClasses(Class)}.
|
||||
*
|
||||
* Detect the default configuration classes for the supplied test class. By default
|
||||
* simply delegates to
|
||||
* {@link AnnotationConfigContextLoaderUtils#detectDefaultConfigurationClasses} .
|
||||
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
||||
* @return an array of default configuration classes, potentially empty but never
|
||||
* {@code null}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -25,6 +25,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* Tests for
|
||||
* {@link SpringApplicationContextLoader#detectDefaultConfigurationClasses(Class)}
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
|
Loading…
Reference in New Issue