cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r582915 - in /incubator/cxf/branches/2.0.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/util/ common/xsd/src/main/java/org/apache/cxf/maven_plugin/ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/
Date Mon, 08 Oct 2007 17:55:15 GMT
Author: dkulp
Date: Mon Oct  8 10:55:14 2007
New Revision: 582915

URL: http://svn.apache.org/viewvc?rev=582915&view=rev
Log:
Merged revisions 580473 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r580473 | dkulp | 2007-09-28 15:57:28 -0400 (Fri, 28 Sep 2007) | 2 lines
  
  Remove stack traces when doing -Psetup.eclipse and such
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
    incubator/cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
    incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java?rev=582915&r1=582914&r2=582915&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
Mon Oct  8 10:55:14 2007
@@ -31,18 +31,45 @@
 
     public static List<String> getPackagesFromJar(File jarFile) throws IOException
{
         List<String> packageNames = new ArrayList<String>();
-        JarResource resource = new JarResource();
-        for (String item : resource.getJarContents(jarFile)) {
-            if (!item.endsWith(".class")) {
-                continue;
-            }
-            String packageName = getPackageName(item);
-            if (!StringUtils.isEmpty(packageName)
-                && !packageNames.contains(packageName)) {
-                packageNames.add(packageName);
+        if (jarFile.isDirectory()) {
+            getPackageNamesFromDir(jarFile, jarFile, packageNames);
+        } else {
+            JarResource resource = new JarResource();
+            for (String item : resource.getJarContents(jarFile)) {
+                if (!item.endsWith(".class")) {
+                    continue;
+                }
+                String packageName = getPackageName(item);
+                if (!StringUtils.isEmpty(packageName)
+                    && !packageNames.contains(packageName)) {
+                    packageNames.add(packageName);
+                }
             }
         }
         return packageNames;
+    }
+    
+    private static void getPackageNamesFromDir(File base, File dir, List<String> pkgs)
{
+        boolean foundClass = false;
+        for (File file : dir.listFiles()) {
+            if (file.isDirectory()) {
+                getPackageNamesFromDir(base, file, pkgs);
+            } else if (!foundClass && file.getName().endsWith(".class")) {
+                foundClass = true;
+                String pkg = "";
+                file = dir;
+                while (!file.equals(base)) {
+                    if (!"".equals(pkg)) {
+                        pkg = "." + pkg;
+                    }
+                    pkg = file.getName() + pkg;
+                    file = file.getParentFile();
+                }
+                if (!pkgs.contains(pkg)) {
+                    pkgs.add(pkg);
+                }
+            }
+        }
     }
 
     private static String getPackageName(String clzName) {

Modified: incubator/cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java?rev=582915&r1=582914&r2=582915&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
Mon Oct  8 10:55:14 2007
@@ -19,9 +19,11 @@
 
 package org.apache.cxf.maven_plugin;
 
+import java.io.File;
 import java.io.IOException;
 
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.jar.JarEntry;
@@ -60,20 +62,27 @@
                     return;
                 }
             }
-            JarFile jar;
+            
             try {
-                jar = new JarFile(url.getPath());
-                Enumeration entries = jar.entries();
-                while (entries.hasMoreElements()) {
-                    JarEntry entry = (JarEntry)entries.nextElement();
-                    if (!entry.isDirectory()
-                        && !entry.getName().startsWith("META")
-                        && entry.getTime() > timestamp) {
-                        
-                        timestamp = entry.getTime();
-                    }                    
+                if (url.getPath().endsWith(".class")) {
+                    timestamp = new File(url.toURI()).lastModified();
+                } else {
+                    JarFile jar = new JarFile(url.getPath());
+                    Enumeration entries = jar.entries();
+                    while (entries.hasMoreElements()) {
+                        JarEntry entry = (JarEntry)entries.nextElement();
+                        if (!entry.isDirectory()
+                            && !entry.getName().startsWith("META")
+                            && entry.getTime() > timestamp) {
+                            
+                            timestamp = entry.getTime();
+                        }                    
+                    }
                 }
             } catch (IOException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } catch (URISyntaxException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }

Modified: incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java?rev=582915&r1=582914&r2=582915&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
Mon Oct  8 10:55:14 2007
@@ -19,9 +19,11 @@
 
 package org.apache.cxf.maven_plugin;
 
+import java.io.File;
 import java.io.IOException;
 
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.jar.JarEntry;
@@ -65,20 +67,26 @@
                     return;
                 }
             }
-            JarFile jar;
             try {
-                jar = new JarFile(url.getPath());
-                Enumeration entries = jar.entries();
-                while (entries.hasMoreElements()) {
-                    JarEntry entry = (JarEntry)entries.nextElement();
-                    if (!entry.isDirectory()
-                        && !entry.getName().startsWith("META")
-                        && entry.getTime() > timestamp) {
-                        
-                        timestamp = entry.getTime();
-                    }                    
+                if (url.getPath().endsWith(".class")) {
+                    timestamp = new File(url.toURI()).lastModified();
+                } else {
+                    JarFile jar = new JarFile(url.getPath());
+                    Enumeration entries = jar.entries();
+                    while (entries.hasMoreElements()) {
+                        JarEntry entry = (JarEntry)entries.nextElement();
+                        if (!entry.isDirectory()
+                            && !entry.getName().startsWith("META")
+                            && entry.getTime() > timestamp) {
+                            
+                            timestamp = entry.getTime();
+                        }                    
+                    }
                 }
             } catch (IOException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } catch (URISyntaxException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }



Mime
View raw message