Repository: wicket Updated Branches: refs/heads/WICKET-5713-meta-inf-wicket d106598d4 -> fa10aef39
WICKET-5713 Move /wicket.properties to /META-INF/wicket/xyz.properties Minor improvements Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fa10aef3 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fa10aef3 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fa10aef3 Branch: refs/heads/WICKET-5713-meta-inf-wicket Commit: fa10aef39e23c0258738079e1d1ff90885175dc1 Parents: d106598 Author: Martin Tzvetanov Grigorov <mgrigo...@apache.org> Authored: Thu Oct 2 14:25:20 2014 +0200 Committer: Martin Tzvetanov Grigorov <mgrigo...@apache.org> Committed: Thu Oct 2 14:25:20 2014 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/wicket/Application.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/fa10aef3/wicket-core/src/main/java/org/apache/wicket/Application.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java b/wicket-core/src/main/java/org/apache/wicket/Application.java index 5376284..2bd8462 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Application.java +++ b/wicket-core/src/main/java/org/apache/wicket/Application.java @@ -105,7 +105,6 @@ import org.apache.wicket.settings.StoreSettings; import org.apache.wicket.util.IProvider; import org.apache.wicket.util.file.File; import org.apache.wicket.util.file.Folder; -import org.apache.wicket.util.io.IOUtils; import org.apache.wicket.util.io.Streams; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Generics; @@ -167,6 +166,8 @@ public abstract class Application implements UnboundListener, IEventSink /** Log. */ private static final Logger log = LoggerFactory.getLogger(Application.class); + private static final String PROPERTIES_FILE_EXTENSION = ".properties"; + /** root mapper */ private IRequestMapper rootRequestMapper; @@ -485,7 +486,7 @@ public abstract class Application implements UnboundListener, IEventSink */ private void collectWicketProperties() throws IOException, URISyntaxException { - Iterator<URL> wicketResources = getApplicationSettings().getClassResolver().getResources("META-INF/wicket"); + Iterator<URL> wicketResources = getApplicationSettings().getClassResolver().getResources("META-INF/wicket/"); while (wicketResources.hasNext()) { URL metaInfWicket = wicketResources.next(); @@ -493,8 +494,7 @@ public abstract class Application implements UnboundListener, IEventSink if ("jar".equals(protocol)) { - URLConnection urlConnection = metaInfWicket.openConnection(); - JarURLConnection jarURLConnection = (JarURLConnection) urlConnection; + JarURLConnection jarURLConnection = (JarURLConnection) metaInfWicket.openConnection();; JarFile jarFile = jarURLConnection.getJarFile(); Enumeration<JarEntry> jarEntries = jarFile.entries(); while (jarEntries.hasMoreElements()) @@ -503,9 +503,9 @@ public abstract class Application implements UnboundListener, IEventSink String entryName = jarEntry.getName(); if (entryName.startsWith("META-INF/wicket/") && entryName.endsWith(".properties")) { - Properties properties = new Properties(); try (InputStream jarEntryStream = jarFile.getInputStream(jarEntry)) { + Properties properties = new Properties(); properties.load(jarEntryStream); load(properties); break; // atm there is no need to have more than one .properties file @@ -522,14 +522,14 @@ public abstract class Application implements UnboundListener, IEventSink public boolean accept(File file) { String fileName = file.getAbsolutePath(); - return fileName.contains("/META-INF/wicket/") && fileName.endsWith(".properties"); + return fileName.contains("/META-INF/wicket/") && fileName.endsWith(PROPERTIES_FILE_EXTENSION); } }); for (File wicketPropertiesFile : files) { - Properties properties = new Properties(); try (InputStream stream = wicketPropertiesFile.inputStream()) { + Properties properties = new Properties(); properties.load(stream); load(properties); } @@ -537,7 +537,7 @@ public abstract class Application implements UnboundListener, IEventSink } else { - throw new WicketRuntimeException("Unknown protocol: " + protocol); + log.error("Cannot load '{}'. The protocol '{}' is not supported!", metaInfWicket, protocol); } } }