src/java/de/uapcore/lightpit/ModuleManager.java

changeset 9
20a9b2bc9063
parent 8
2dfdb79b5344
child 10
89e3e6e28b69
equal deleted inserted replaced
8:2dfdb79b5344 9:20a9b2bc9063
68 68
69 private boolean isRegisteredAsModule(Registration reg) { 69 private boolean isRegisteredAsModule(Registration reg) {
70 try { 70 try {
71 final Class scclass = Class.forName(reg.getClassName()); 71 final Class scclass = Class.forName(reg.getClassName());
72 72
73 final boolean lpservlet = LightPITServlet.class.isAssignableFrom(scclass); 73 final boolean lpservlet = AbstractLightPITServlet.class.isAssignableFrom(scclass);
74 final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class); 74 final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class);
75 75
76 if (lpservlet && !lpmodule) { 76 if (lpservlet && !lpmodule) {
77 LOG.warn( 77 LOG.warn(
78 "Servlet is a LightPITServlet but is missing the module annotation: {}", 78 "{} is a LightPIT Servlet but is missing the module annotation.",
79 reg.getClassName() 79 reg.getClassName()
80 ); 80 );
81 } else if (!lpservlet && lpmodule) { 81 } else if (!lpservlet && lpmodule) {
82 LOG.warn( 82 LOG.warn(
83 "Servlet is annotated as a LightPITModule but does not extend LightPITServlet: {}", 83 "{} is annotated as a LightPIT Module but does not extend {}.",
84 reg.getClassName() 84 reg.getClassName(),
85 AbstractLightPITServlet.class.getSimpleName()
85 ); 86 );
86 } 87 }
87 88
88 return lpservlet && lpmodule; 89 return lpservlet && lpmodule;
89 } catch (ClassNotFoundException ex) { 90 } catch (ClassNotFoundException ex) {
90 LOG.error( 91 LOG.error(
91 "Servlet registration refers to a class which cannot be found by the class loader: {}", 92 "Servlet registration refers to class {} which cannot be found by the class loader (Reason: {})",
92 reg.getClassName() 93 reg.getClassName(),
94 ex.getMessage()
93 ); 95 );
94 return false; 96 return false;
95 } 97 }
96 } 98 }
97 99

mercurial