No ... Just don't forget to fill a JIRA for OWB update ;-)

2012/9/12 Romain Manni-Bucau <[email protected]>

> sorry i updated OWB in the same commit (// taks + some network latency :s)
>
> is it an issue for anyone?
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau*
> *Blog: http://rmannibucau.wordpress.com*
>
>
>
>
> ---------- Forwarded message ----------
> From: <[email protected]>
> Date: 2012/9/12
> Subject: svn commit: r1384123 - in /openejb/trunk/openejb: pom.xml
>
> tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
> To: [email protected]
>
>
> Author: rmannibucau
> Date: Wed Sep 12 21:01:26 2012
> New Revision: 1384123
>
> URL: http://svn.apache.org/viewvc?rev=1384123&view=rev
> Log:
> tomcat 7.0.30 doesn't scan exactly the same way servlet 3 annotations and
> sometimes give subfolder instead of webinf/classes. just adapting the
> classname to manage it
>
> Modified:
>     openejb/trunk/openejb/pom.xml
>
>
> openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
>
> Modified: openejb/trunk/openejb/pom.xml
> URL:
>
> http://svn.apache.org/viewvc/openejb/trunk/openejb/pom.xml?rev=1384123&r1=1384122&r2=1384123&view=diff
>
> ==============================================================================
> --- openejb/trunk/openejb/pom.xml (original)
> +++ openejb/trunk/openejb/pom.xml Wed Sep 12 21:01:26 2012
> @@ -143,7 +143,7 @@
>      <junit.version>4.9</junit.version>
>      <org.apache.axis2.version>1.4.1</org.apache.axis2.version>
>      <scannotation.version>1.0.2</scannotation.version>
> -
>  <org.apache.openwebbeans.version>1.1.5</org.apache.openwebbeans.version>
> +
>
>  
> <org.apache.openwebbeans.version>1.1.6-SNAPSHOT</org.apache.openwebbeans.version>
>      <geronimo.connector.version>3.1.1</geronimo.connector.version>
>      <geronimo-osgi.version>1.1</geronimo-osgi.version>
>
>
>  
> <geronimo-javamail_1.4_spec.version>1.7.1</geronimo-javamail_1.4_spec.version>
>
> Modified:
>
> openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
> URL:
>
> http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java?rev=1384123&r1=1384122&r2=1384123&view=diff
>
> ==============================================================================
> ---
>
> openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
> (original)
> +++
>
> openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
> Wed Sep 12 21:01:26 2012
> @@ -25,6 +25,7 @@ import org.apache.openejb.assembler.clas
>  import org.apache.openejb.loader.SystemInstance;
>  import org.apache.openejb.util.LogCategory;
>  import org.apache.openejb.util.Logger;
> +import org.apache.xbean.finder.util.Classes;
>  import org.xml.sax.InputSource;
>
>  import javax.servlet.ServletContainerInitializer;
> @@ -44,6 +45,9 @@ public class OpenEJBContextConfig extend
>      private static final String MYFACES_TOMEEM_CONTAINER_INITIALIZER =
> "org.apache.tomee.myfaces.TomEEMyFacesContainerInitializer";
>      private static final String TOMEE_MYFACES_CONTEXT_LISTENER =
> "org.apache.tomee.myfaces.TomEEMyFacesContextListener";
>
> +    private static final String CLASSES = "classes";
> +    private static final String WEB_INF = "WEB-INF";
> +
>      private TomcatWebAppBuilder.StandardContextInfo info;
>
>      public OpenEJBContextConfig(TomcatWebAppBuilder.StandardContextInfo
> standardContextInfo) {
> @@ -144,7 +148,7 @@ public class OpenEJBContextConfig extend
>              final URLClassLoader loader = new URLClassLoader(new
> URL[]{file.toURI().toURL()});
>              for (String webAnnotatedClassName :
> webAppInfo.webAnnotatedClasses) {
>
> -                final String classFile =
> webAnnotatedClassName.replace('.', '/') + ".class";
> +                final String classFile =
> webAnnotatedClassName.substring(getSubPackage(file).length()).replace('.',
> '/') + ".class";
>                  final URL classUrl = loader.getResource(classFile);
>
>                  if (classUrl == null) {
> @@ -170,6 +174,34 @@ public class OpenEJBContextConfig extend
>          }
>      }
>
> +    // because we don't always get WEB-INF/classes folder, simply get the
> already appended subpackage
> +    private static String getSubPackage(final File file) {
> +        File current = file.getParentFile();
> +        if (current == null) {
> +            return "";
> +        }
> +
> +        File previous = file;
> +        while (current.getParentFile() != null) {
> +            if (CLASSES.equals(previous.getName()) &&
> WEB_INF.equals(current.getName())) {
> +                String path =
> file.getAbsolutePath().replaceFirst(previous.getAbsolutePath(), "");
> +                if (path.startsWith(File.separator)) {
> +                    path = path.substring(File.separator.length());
> +                }
> +                if (path.endsWith(File.separator)) {
> +                    path = path.substring(0, path.length() - 1);
> +                }
> +
> +                return path + File.separator;
> +            }
> +
> +            previous = current;
> +            current = current.getParentFile();
> +        }
> +
> +        return ""; // no subpackage found
> +    }
> +
>      @Override
>      protected void processAnnotationsUrl(URL url, WebXml fragment, boolean
> handlesTypeOnly) {
>          logger.debug("processAnnotationsUrl " + url);
>

Reply via email to