geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1443409 - in /geronimo/xbean/trunk: ./ maven-xbean-plugin/src/main/java/org/apache/xbean/maven/ xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/ xbean-classloader/src/test/java/org/apache/xbean/classloader/ xbean-classpa...
Date Thu, 07 Feb 2013 11:06:35 GMT
Author: struberg
Date: Thu Feb  7 11:06:35 2013
New Revision: 1443409

URL: http://svn.apache.org/viewvc?rev=1443409&view=rev
Log:
XBEAN-239 fix toURL for java7

Modified:
    geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
    geronimo/xbean/trunk/pom.xml
    geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
    geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/MultiParentClassLoaderTest.java
    geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/UrlResourceFinderTest.java
    geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java
    geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java
    geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java

Modified: geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
(original)
+++ geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
Thu Feb  7 11:06:35 2013
@@ -250,27 +250,26 @@ public class XBeanMojo extends AbstractM
             Set<URL> urls = new HashSet<URL>();
 
             URL mainClasses = new File(project.getBuild().getOutputDirectory())
-                    .toURL();
+                    .toURI().toURL();
             getLog().debug("Adding to classpath : " + mainClasses);
             urls.add(mainClasses);
 
             URL testClasses = new File(project.getBuild()
-                    .getTestOutputDirectory()).toURL();
+                    .getTestOutputDirectory()).toURI().toURL();
             getLog().debug("Adding to classpath : " + testClasses);
             urls.add(testClasses);
 
             Set<Artifact> dependencies = project.getArtifacts();
-            Iterator iter = dependencies.iterator();
             for (Artifact classPathElement : dependencies) {
                 getLog().debug(
                         "Adding artifact: " + classPathElement.getFile()
                                 + " to classpath");
-                urls.add(classPathElement.getFile().toURL());
+                urls.add(classPathElement.getFile().toURI().toURL());
             }
 
             if( classPathIncludes!=null ) {
                 for (String include : classPathIncludes) {
-                    final URL url = new File(include).toURL();
+                    final URL url = new File(include).toURI().toURL();
                     getLog().debug("Adding to classpath : " + url);
                     urls.add(url);
                 }

Modified: geronimo/xbean/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/pom.xml?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/pom.xml (original)
+++ geronimo/xbean/trunk/pom.xml Thu Feb  7 11:06:35 2013
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.apache.geronimo.genesis</groupId>
         <artifactId>genesis-java5-flava</artifactId>
-        <version>2.0</version>
+        <version>2.1-SNAPSHOT</version>
     </parent>
 
     <groupId>org.apache.xbean</groupId>
@@ -335,6 +335,16 @@
                         </instructions>
                     </configuration>
                 </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>3.0</version>
+                    <configuration>
+                        <showDeprecation>false</showDeprecation>
+                        <showWarnings>false</showWarnings>
+                    </configuration>
+                </plugin>
             </plugins>
         </pluginManagement>
 
@@ -356,7 +366,7 @@
                     </execution>
                 </executions>
             </plugin>
-        
+
         </plugins>
     </build>
 

Modified: geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
Thu Feb  7 11:06:35 2013
@@ -542,7 +542,7 @@ public class QdoxMappingLoader implement
             JarEntry entry = (JarEntry) entries.nextElement();
             String name = entry.getName();
             if (name.endsWith(".java") && !isExcluded(name, excludedClasses) &&
!name.endsWith("/package-info.java")) {
-                builder.addSource(new URL("jar:" + base.toURL().toString() + "!/" + name));
+                builder.addSource(new URL("jar:" + base.toURI().toURL().toString() + "!/"
+ name));
             }
         }
     }

Modified: geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/MultiParentClassLoaderTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/MultiParentClassLoaderTest.java?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/MultiParentClassLoaderTest.java
(original)
+++ geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/MultiParentClassLoaderTest.java
Thu Feb  7 11:06:35 2013
@@ -61,12 +61,12 @@ public class MultiParentClassLoaderTest 
         for (int i = 0; i < files.length; i++) {
             File file = files[i];
             JarFile jarFile = new JarFile(files[i]);
-            String urlString = "jar:" + file.toURL() + "!/" + ENTRY_NAME;
-            URL url = new URL(files[i].toURL(), urlString);
+            String urlString = "jar:" + file.toURI().toURL() + "!/" + ENTRY_NAME;
+            URL url = new URL(files[i].toURI().toURL(), urlString);
             assertStreamContains(ENTRY_VALUE + i, url.openStream());
             jarFile.close();
 
-            URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { file.toURL() }
);
+            URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { file.toURI().toURL()
} );
             // clazz shared by all
             Class clazz = urlClassLoader.loadClass(CLASS_NAME);
             assertNotNull(clazz);
@@ -272,11 +272,11 @@ public class MultiParentClassLoaderTest 
 
         parents = new URLClassLoader[3];
         for (int i = 0; i < parents.length; i++) {
-            parents[i] = new URLClassLoader(new URL[]{files[i].toURL()});
+            parents[i] = new URLClassLoader(new URL[]{files[i].toURI().toURL()});
         }
 
         myFile = createJarFile(33);
-        classLoader = createClassLoader(NAME, new URL[]{myFile.toURL()}, parents);
+        classLoader = createClassLoader(NAME, new URL[]{myFile.toURI().toURL()}, parents);
     }
 
     /**

Modified: geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/UrlResourceFinderTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/UrlResourceFinderTest.java?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/UrlResourceFinderTest.java
(original)
+++ geronimo/xbean/trunk/xbean-classloader/src/test/java/org/apache/xbean/classloader/UrlResourceFinderTest.java
Thu Feb  7 11:06:35 2013
@@ -49,8 +49,8 @@ public class UrlResourceFinderTest exten
      * @throws Exception
      */
     public void testResourceEnumeration() throws Exception {
-        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
-        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURL();
+        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURI().toURL();
+        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar1, jar2});
 
         Enumeration enumeration = resourceFinder.findResources("resource");
@@ -72,7 +72,7 @@ public class UrlResourceFinderTest exten
     }
 
     public void testDirectoryResource() throws Exception {
-        URL jar = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar});
 
         ResourceHandle resource = resourceFinder.getResource("resource");
@@ -111,7 +111,7 @@ public class UrlResourceFinderTest exten
     }
 
     public void testJarResource() throws Exception {
-        URL jar = jarFile.toURL();
+        URL jar = jarFile.toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar});
 
         ResourceHandle resource = resourceFinder.getResource("resource");
@@ -150,7 +150,7 @@ public class UrlResourceFinderTest exten
     }
 
     public void testAddURL() throws Exception {
-        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar1});
 
         Enumeration enumeration = resourceFinder.findResources("resource");
@@ -164,7 +164,7 @@ public class UrlResourceFinderTest exten
         assertFalse(enumeration.hasMoreElements());
 
         // addUrl
-        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURL();
+        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURI().toURL();
         resourceFinder.addUrl(jar2);
 
         // getResource should find the first jar only
@@ -197,8 +197,8 @@ public class UrlResourceFinderTest exten
     }
 
     public void testConcurrentAddURL() throws Exception {
-        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
-        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURL();
+        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURI().toURL();
+        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar1, jar2});
 
         Enumeration enumeration = resourceFinder.findResources("resource");
@@ -214,7 +214,7 @@ public class UrlResourceFinderTest exten
         //
         // addURL
         //
-        URL newJar = jarFile.toURL();
+        URL newJar = jarFile.toURI().toURL();
         resourceFinder.addUrl(newJar);
 
         // new resources should be available
@@ -241,19 +241,19 @@ public class UrlResourceFinderTest exten
     }
 
     public void testDirectoryDestroy() throws Exception {
-        URL jar = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar});
         assertDestroyed(resourceFinder, "resource1", null);
     }
 
     public void testJarDestroy() throws Exception {
-        URL jar = jarFile.toURL();
+        URL jar = jarFile.toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar});
         assertDestroyed(resourceFinder, "resource3", manifest);
     }
 
     public void testUrlCopy() throws Exception {
-        URL jar = jarFile.toURL();
+        URL jar = jarFile.toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar});
 
         // get the resource
@@ -275,7 +275,7 @@ public class UrlResourceFinderTest exten
     }
 
     public void testUrlAccess() throws Exception {
-        URL jar = jarFile.toURL();
+        URL jar = jarFile.toURI().toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[]{jar});
 
         // get geronimo url from the resource finder
@@ -292,7 +292,7 @@ public class UrlResourceFinderTest exten
         assertEquals("jar3", toString(new URL(geronimoUrl, "jar3").openStream()));
 
         // verify both can see the jar3 file withing the jar file using a full url spec
-        String mainEntry = "jar:" + jarFile.toURL().toExternalForm() + "!/jar3";
+        String mainEntry = "jar:" + jarFile.toURI().toURL().toExternalForm() + "!/jar3";
         assertEquals("jar3", toString(new URL(systemUrl, mainEntry).openStream()));
         assertEquals("jar3", toString(new URL(geronimoUrl, mainEntry).openStream()));
 
@@ -309,12 +309,12 @@ public class UrlResourceFinderTest exten
         }
 
         // verify both can see the alternate jar
-        String alternateEntry = "jar:" + alternateJarFile.toURL().toExternalForm() + "!/jar4";
+        String alternateEntry = "jar:" + alternateJarFile.toURI().toURL().toExternalForm()
+ "!/jar4";
         assertEquals("jar4", toString(new URL(systemUrl, alternateEntry).openStream()));
         assertEquals("jar4", toString(new URL(geronimoUrl, alternateEntry).openStream()));
 
         // verify both throw a FileNotFoundExcetion for an unknown entry in the alternate
file
-        String alternateUnknownEntry = "jar:" + alternateJarFile.toURL().toExternalForm()
+ "!/unknown";
+        String alternateUnknownEntry = "jar:" + alternateJarFile.toURI().toURL().toExternalForm()
+ "!/unknown";
         try {
             new URL(systemUrl, alternateUnknownEntry).openStream();
             fail("Expected a FileNotFoundException");
@@ -327,11 +327,11 @@ public class UrlResourceFinderTest exten
         }
 
         // verify both work an excepton for a non-jar entry
-        assertEquals("testResource", toString(new URL(systemUrl, testResource.toURL().toExternalForm()).openStream()));
-        assertEquals("testResource", toString(new URL(geronimoUrl, testResource.toURL().toExternalForm()).openStream()));
+        assertEquals("testResource", toString(new URL(systemUrl, testResource.toURI().toURL().toExternalForm()).openStream()));
+        assertEquals("testResource", toString(new URL(geronimoUrl, testResource.toURI().toURL().toExternalForm()).openStream()));
 
         // verify both fail for a spec without a !/
-        String badEntry = "jar:" + alternateJarFile.toURL().toExternalForm();
+        String badEntry = "jar:" + alternateJarFile.toURI().toURL().toExternalForm();
         try {
             new URL(systemUrl, badEntry).openStream();
             fail("Expected a FileNotFoundException");
@@ -344,7 +344,7 @@ public class UrlResourceFinderTest exten
         }
 
         // verify both throw FileNotFoundException for a nested jar file
-        badEntry = "jar:" + alternateJarFile.toURL().toExternalForm() + "!/foo.jar!/bar";
+        badEntry = "jar:" + alternateJarFile.toURI().toURL().toExternalForm() + "!/foo.jar!/bar";
         try {
             new URL(systemUrl, badEntry).openStream();
             fail("Expected a FileNotFoundException");

Modified: geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java
(original)
+++ geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java
Thu Feb  7 11:06:35 2013
@@ -51,7 +51,7 @@ public abstract class SunURLClassPath im
         // Create URLs from them
         final URL[] jars = new URL[jarNames.length];
         for (int j = 0; j < jarNames.length; j++) {
-            jars[j] = new File(dir, jarNames[j]).toURL();
+            jars[j] = new File(dir, jarNames[j]).toURI().toURL();
         }
 
         sun.misc.URLClassPath path = getURLClassPath(loader);

Modified: geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java
(original)
+++ geronimo/xbean/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java
Thu Feb  7 11:06:35 2013
@@ -79,7 +79,7 @@ public class TomcatClassPath extends Sun
         }
 
         for (int j = 0; j < jarNames.length; j++) {
-            this.addJarToPath(new File(dir, jarNames[j]).toURL());
+            this.addJarToPath(new File(dir, jarNames[j]).toURI().toURL());
         }
         rebuild();
     }
@@ -98,7 +98,7 @@ public class TomcatClassPath extends Sun
         if (addRepositoryMethod != null){
             addRepositoryMethod.invoke(getClassLoader(), new Object[]{path});
         } else {
-            addURLMethod.invoke(getClassLoader(), new Object[]{new File(path).toURL()});
+            addURLMethod.invoke(getClassLoader(), new Object[]{new File(path).toURI().toURL()});
         }
     }
 

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java?rev=1443409&r1=1443408&r2=1443409&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
Thu Feb  7 11:06:35 2013
@@ -542,7 +542,7 @@ public class QdoxMappingLoader implement
             JarEntry entry = (JarEntry) entries.nextElement();
             String name = entry.getName();
             if (name.endsWith(".java") && !isExcluded(name, excludedClasses) &&
!name.endsWith("/package-info.java")) {
-                builder.addSource(new URL("jar:" + base.toURL().toString() + "!/" + name));
+                builder.addSource(new URL("jar:" + base.toURI().toURL().toString() + "!/"
+ name));
             }
         }
     }



Mime
View raw message