You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by dk...@apache.org on 2012/10/29 19:33:42 UTC

svn commit: r1403457 - in /aries/trunk/util: util-r42/src/main/java/org/apache/aries/util/ util-r42/src/main/java/org/apache/aries/util/filesystem/ util-r42/src/main/java/org/apache/aries/util/manifest/ util-r42/src/test/java/org/apache/aries/util/file...

Author: dkulp
Date: Mon Oct 29 18:33:41 2012
New Revision: 1403457

URL: http://svn.apache.org/viewvc?rev=1403457&view=rev
Log:
[ARIES-947] Warning cleanups for util
Patch from Jean-Baptiste Onofré applied

Modified:
    aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/VersionRange.java
    aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/filesystem/FileUtils.java
    aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/BundleManifest.java
    aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java
    aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/FileUtilsTest.java
    aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/IOUtilsTest.java
    aries/trunk/util/util/pom.xml

Modified: aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/VersionRange.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/VersionRange.java?rev=1403457&r1=1403456&r2=1403457&view=diff
==============================================================================
--- aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/VersionRange.java (original)
+++ aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/VersionRange.java Mon Oct 29 18:33:41 2012
@@ -373,7 +373,7 @@ public final class VersionRange {
      * Create a new version range that is the intersection of {@code this} and the argument.
      * In other words, the largest version range that lies within both {@code this} and
      * the parameter.
-     * @param range a version range to be intersected with {@code this}.
+     * @param r a version range to be intersected with {@code this}.
      * @return a new version range, or {@code null} if no intersection is possible.
      */
     public VersionRange intersect(VersionRange r) {

Modified: aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/filesystem/FileUtils.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/filesystem/FileUtils.java?rev=1403457&r1=1403456&r2=1403457&view=diff
==============================================================================
--- aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/filesystem/FileUtils.java (original)
+++ aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/filesystem/FileUtils.java Mon Oct 29 18:33:41 2012
@@ -25,10 +25,11 @@ import java.util.List;
 import org.apache.aries.util.manifest.BundleManifest;
 
 public class FileUtils {
+
   /**
    * Check whether a file is a bundle.
    * @param file the file path
-   * @return
+   * @return true if the file is a bundle, false else
    */
   public static boolean isBundle(File file) {
     BundleManifest bm = BundleManifest.fromBundle(file);
@@ -36,9 +37,9 @@ public class FileUtils {
   }
 
   /**
-   * Get a list of urls for the bundles under the parent url
-   * @param sourceDir The parent url
-   * @return
+   * Get a list of URLs for the bundles under the parent URL
+   * @param sourceDir The parent URL
+   * @return the list of URLs for the bundles
    * @throws IOException
    */
   public static  List<URI> getBundlesRecursive(URI sourceDir) throws IOException {

Modified: aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/BundleManifest.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/BundleManifest.java?rev=1403457&r1=1403456&r2=1403457&view=diff
==============================================================================
--- aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/BundleManifest.java (original)
+++ aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/BundleManifest.java Mon Oct 29 18:33:41 2012
@@ -47,8 +47,8 @@ public class BundleManifest
    * Read a manifest from a jar input stream. This will find the manifest even if it is NOT
    * the first file in the archive.
    *
-   * @param is
-   * @return
+   * @param is the jar input stream
+   * @return the bundle manifest
    */
   public static BundleManifest fromBundle(InputStream is) {
     JarInputStream jarIs = null;
@@ -78,8 +78,8 @@ public class BundleManifest
   /**
    * Retrieve a BundleManifest from the given jar file
    *
-   * @param f
-   * @return
+   * @param f the bundle jar file
+   * @return the bundle manifest
    */
   public static BundleManifest fromBundle(IFile f) {
     InputStream is = null;
@@ -105,8 +105,8 @@ public class BundleManifest
   /**
    * Retrieve a bundle manifest from the given jar file, which can be exploded or compressed
    *
-   * @param f
-   * @return
+   * @param f the bundle jar file
+   * @return the bundle manifest
    */
   public static BundleManifest fromBundle(File f) {
     if (f.isDirectory()) {

Modified: aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java?rev=1403457&r1=1403456&r2=1403457&view=diff
==============================================================================
--- aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java (original)
+++ aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java Mon Oct 29 18:33:41 2012
@@ -68,9 +68,6 @@ public class ManifestHeaderProcessor
 
   /**
    * A simple class to associate two types.
-   *
-   * @param <N> The type for the 'Name'
-   * @param <V> The type for the 'Value'
    */
   public static class NameValuePair {
     private String name;
@@ -132,9 +129,6 @@ public class ManifestHeaderProcessor
   /**
    * Intended to provide a standard way to add Name/Value's to
    * aggregations of Name/Value's.
-   *
-   * @param <N> Type of 'Name'
-   * @param <V> Type of 'Value'
    */
   public static interface NameValueCollection {
     /**
@@ -147,9 +141,6 @@ public class ManifestHeaderProcessor
 
   /**
    * Map of Name -> Value.
-   *
-   * @param <N> Type of 'Name'
-   * @param <V> Type of 'Value'
    */
   public static class NameValueMap extends HashMap<String, Map<String,String>> implements NameValueCollection, Map<String, Map<String,String>>{
 	private static final long serialVersionUID = -6446338858542599141L;
@@ -175,9 +166,6 @@ public class ManifestHeaderProcessor
 
   /**
    * List of Name/Value
-   *
-   * @param <N> Type of 'Name'
-   * @param <V> Type of 'Value'
    */
   public static class NameValueList extends ArrayList<NameValuePair> implements NameValueCollection, List<NameValuePair> {
 	private static final long serialVersionUID = 1808636823825029983L;
@@ -349,7 +337,7 @@ public class ManifestHeaderProcessor
    * <p>
    * Result is returned as a list, as export does allow duplicate package exports.
    *
-   * @param list The data to parse.
+   * @param s The data to parse.
    * @return List of NameValuePairs, where each Name in the list is an exported package,
    *         with its associated Value being a NameValueMap of any attributes declared.
    */

Modified: aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/FileUtilsTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/FileUtilsTest.java?rev=1403457&r1=1403456&r2=1403457&view=diff
==============================================================================
--- aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/FileUtilsTest.java (original)
+++ aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/FileUtilsTest.java Mon Oct 29 18:33:41 2012
@@ -22,16 +22,15 @@ package org.apache.aries.util.filesystem
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.StringBufferInputStream;
 import java.net.URI;
 import java.util.List;
 
 import org.apache.aries.unittest.fixture.ArchiveFixture;
 import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
-import org.apache.aries.util.filesystem.FileUtils;
 import org.apache.aries.util.io.IOUtils;
 import org.junit.Test;
 import org.osgi.framework.Constants;
@@ -92,12 +91,12 @@ public class FileUtilsTest
       fout.close();
     }
 
-    IOUtils.writeOut(tmpDir, "simple.jar", new StringBufferInputStream("abc"));
-    IOUtils.writeOut(tmpDir, "simple.war", new StringBufferInputStream("sss"));
-    IOUtils.writeOut(tmpDir, "simple.txt", new StringBufferInputStream("abc"));
-    IOUtils.writeOut(tmpDir, "some/relative/directory/complex.jar", new StringBufferInputStream("def"));
-    IOUtils.writeOut(tmpDir, "some/relative/directory/aa/complex2.war", new StringBufferInputStream("ghi"));
-    IOUtils.writeOut(tmpDir, "simple", new StringBufferInputStream("abc"));
+    IOUtils.writeOut(tmpDir, "simple.jar", new ByteArrayInputStream("abc".getBytes()));
+    IOUtils.writeOut(tmpDir, "simple.war", new ByteArrayInputStream("sss".getBytes()));
+    IOUtils.writeOut(tmpDir, "simple.txt", new ByteArrayInputStream("abc".getBytes()));
+    IOUtils.writeOut(tmpDir, "some/relative/directory/complex.jar", new ByteArrayInputStream("def".getBytes()));
+    IOUtils.writeOut(tmpDir, "some/relative/directory/aa/complex2.war", new ByteArrayInputStream("ghi".getBytes()));
+    IOUtils.writeOut(tmpDir, "simple", new ByteArrayInputStream("abc".getBytes()));
 
     List<URI> jarFiles = FileUtils.getBundlesRecursive(tmpDir.toURI());
     assertEquals("There should be 4 entries.", 4, jarFiles.size());

Modified: aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/IOUtilsTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/IOUtilsTest.java?rev=1403457&r1=1403456&r2=1403457&view=diff
==============================================================================
--- aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/IOUtilsTest.java (original)
+++ aries/trunk/util/util-r42/src/test/java/org/apache/aries/util/filesystem/IOUtilsTest.java Mon Oct 29 18:33:41 2012
@@ -27,17 +27,14 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.StringBufferInputStream;
 import java.util.zip.ZipFile;
 
-import org.apache.aries.util.filesystem.FileSystem;
-import org.apache.aries.util.filesystem.IDirectory;
-import org.apache.aries.util.filesystem.IFile;
 import org.apache.aries.util.io.IOUtils;
 import org.junit.AfterClass;
 import org.junit.Test;
@@ -85,9 +82,9 @@ public class IOUtilsTest
     File tmpDir = new File("ioUtilsTest/tmp");
     tmpDir.mkdir();
     
-    IOUtils.writeOut(tmpDir, "simple.txt", new StringBufferInputStream("abc"));
-    IOUtils.writeOut(tmpDir, "some/relative/directory/complex.txt", new StringBufferInputStream("def"));
-    IOUtils.writeOut(tmpDir, "some/relative/directory/complex2.txt", new StringBufferInputStream("ghi"));
+    IOUtils.writeOut(tmpDir, "simple.txt", new ByteArrayInputStream( "abc".getBytes()));
+    IOUtils.writeOut(tmpDir, "some/relative/directory/complex.txt", new ByteArrayInputStream( "def".getBytes()));
+    IOUtils.writeOut(tmpDir, "some/relative/directory/complex2.txt", new ByteArrayInputStream( "ghi".getBytes()));
     
     File simple = new File("ioUtilsTest/tmp/simple.txt");
     assertTrue(simple.exists());

Modified: aries/trunk/util/util/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/util/util/pom.xml?rev=1403457&r1=1403456&r2=1403457&view=diff
==============================================================================
--- aries/trunk/util/util/pom.xml (original)
+++ aries/trunk/util/util/pom.xml Mon Oct 29 18:33:41 2012
@@ -39,17 +39,9 @@
         <!-- Export package versions are maintained in packageinfo files -->
 
         <aries.osgi.export.pkg>
-            org.apache.aries.util;
-            org.apache.aries.util.log;
-            org.apache.aries.util.tracker;
-            org.apache.aries.util.nls;
-            org.apache.aries.util.io;
-            org.apache.aries.util.service.registry;
-            org.apache.aries.util.manifest;
-            org.apache.aries.util.filesystem;
+            org.apache.aries.util*;-split-package:=merge-first
         </aries.osgi.export.pkg>
         <aries.osgi.import.pkg>
-            !org.apache.aries.util*,
             org.osgi.framework.hooks.bundle;resolution:=optional,
             org.osgi.framework.launch;resolution:=optional,
             org.osgi.framework.wiring.*;resolution:=optional,
@@ -61,9 +53,9 @@
             *
         </aries.osgi.import.pkg>
         <aries.osgi.private.pkg>
-            org.apache.aries.util.internal,
-            org.apache.aries.util.filesystem.impl,
-            org.apache.aries.util.tracker.hook
+            org.apache.aries.util.internal;-split-package:=merge-first,
+            org.apache.aries.util.filesystem.impl;-split-package:=merge-first,
+            org.apache.aries.util.tracker.hook;-split-package:=merge-first
         </aries.osgi.private.pkg>
     </properties>