1818 */
1919package org .jooby .run ;
2020
21- import org .jboss .modules .DependencySpec ;
22- import org .jboss .modules .Module ;
23- import org .jboss .modules .ModuleIdentifier ;
24- import org .jboss .modules .ModuleLoadException ;
25- import org .jboss .modules .ModuleLoader ;
26- import org .jboss .modules .ModuleSpec ;
27- import org .jboss .modules .ResourceLoaderSpec ;
28- import org .jboss .modules .ResourceLoaders ;
29- import org .jooby .internal .run__ .JoobyRef ;
30-
3121import java .io .BufferedReader ;
3222import java .io .File ;
3323import java .io .FileReader ;
4434import java .util .Set ;
4535import java .util .jar .JarFile ;
4636
37+ import org .jboss .modules .DependencySpec ;
38+ import org .jboss .modules .Module ;
39+ import org .jboss .modules .ModuleIdentifier ;
40+ import org .jboss .modules .ModuleLoadException ;
41+ import org .jboss .modules .ModuleLoader ;
42+ import org .jboss .modules .ModuleSpec ;
43+ import org .jboss .modules .ResourceLoaderSpec ;
44+ import org .jboss .modules .ResourceLoaders ;
45+
4746public class AppModuleLoader extends ModuleLoader {
4847
4948 private Map <ModuleIdentifier , ModuleSpec > modules ;
@@ -82,7 +81,8 @@ private static Map<ModuleIdentifier, ModuleSpec> newModule(final String name,
8281 String mId = name .replace (".jar" , "" );
8382 ModuleSpec .Builder builder = ModuleSpec .build (ModuleIdentifier .fromString (mId ));
8483 if (level == 0 ) {
85- String classurl = JoobyRef .class .getResource (JoobyRef .class .getSimpleName () + ".class" )
84+ String classurl = AppModuleLoader .class
85+ .getResource ("/" + Main .JOOBY_REF .replace ("." , "/" ) + ".class" )
8686 .toString ();
8787 String jartoken = ".jar!" ;
8888 File jar = new File (URI
@@ -140,7 +140,7 @@ private static Map<ModuleIdentifier, ModuleSpec> newModule(final String name,
140140 return modules ;
141141 }
142142
143- @ SuppressWarnings ({"rawtypes" , "unchecked" })
143+ @ SuppressWarnings ({"rawtypes" , "unchecked" })
144144 private static Set <String > jdkPaths () throws Exception {
145145 Class jdkPath = AppModuleLoader .class .getClassLoader ().loadClass ("org.jboss.modules.JDKPaths" );
146146 Field field = jdkPath .getDeclaredField ("JDK" );
@@ -168,12 +168,12 @@ private static Set<String> pkgs(final File file) throws IOException {
168168 if (file .exists ()) {
169169 return pkgs (new FileReader (file ));
170170 }
171- return new LinkedHashSet <String >();
171+ return new LinkedHashSet <>();
172172 }
173173
174174 private static Set <String > pkgs (final Reader reader ) throws IOException {
175175 try (BufferedReader in = new BufferedReader (reader )) {
176- Set <String > pkgs = new LinkedHashSet <String >();
176+ Set <String > pkgs = new LinkedHashSet <>();
177177 String line = in .readLine ();
178178 while (line != null ) {
179179 pkgs .add (line .trim ());
@@ -183,7 +183,7 @@ private static Set<String> pkgs(final Reader reader) throws IOException {
183183 }
184184 }
185185
186- public static void main (String [] args ) throws MalformedURLException {
186+ public static void main (final String [] args ) throws MalformedURLException {
187187 URI jaruri = URI .create (
188188 "jar:file:/Users/edgar/.m2/repository/org/jooby/jooby-run/1.0.4-SNAPSHOT/jooby-run-1.0.4-SNAPSHOT.jar!/org/jooby/internal/run__/JoobyRef.class" );
189189 System .out .println (jaruri .toURL ().toExternalForm ());
0 commit comments