Modified: 
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java?rev=1417506&r1=1417505&r2=1417506&view=diff
==============================================================================
--- 
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
 (original)
+++ 
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
 Wed Dec  5 16:19:59 2012
@@ -25,6 +25,8 @@ import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
@@ -36,11 +38,11 @@ public class IO {
 
     public static String readFileAsString(final URI uri) throws IOException {
         final StringBuilder builder = new StringBuilder("");
-        for (Proxy proxy : ProxySelector.getDefault().select(uri)) {
-            InputStream is;
+        for (final Proxy proxy : ProxySelector.getDefault().select(uri)) {
+            final InputStream is;
 
             try {
-                URLConnection urlConnection = 
uri.toURL().openConnection(proxy);
+                final URLConnection urlConnection = 
uri.toURL().openConnection(proxy);
                 urlConnection.setConnectTimeout(MAX_TIMEOUT);
                 is = urlConnection.getInputStream();
             } catch (IOException e) {
@@ -61,11 +63,11 @@ public class IO {
         return builder.toString();
     }
 
-    public static Properties readProperties(URL resource) throws IOException {
+    public static Properties readProperties(final URL resource) throws 
IOException {
         return readProperties(resource, new Properties());
     }
 
-    public static Properties readProperties(URL resource, Properties 
properties) throws IOException {
+    public static Properties readProperties(final URL resource, final 
Properties properties) throws IOException {
         return readProperties(read(resource), properties);
     }
 
@@ -73,19 +75,19 @@ public class IO {
         return readProperties(resource, new Properties());
     }
 
-    public static Properties readProperties(File resource, Properties 
properties) throws IOException {
+    public static Properties readProperties(final File resource, final 
Properties properties) throws IOException {
         return readProperties(read(resource), properties);
     }
 
     /**
      * Reads and closes the input stream
      *
-     * @param in
-     * @param properties
-     * @return
+     * @param in         InputStream
+     * @param properties Properties
+     * @return Properties
      * @throws IOException
      */
-    public static Properties readProperties(InputStream in, Properties 
properties) throws IOException {
+    public static Properties readProperties(final InputStream in, final 
Properties properties) throws IOException {
         if (in == null) throw new NullPointerException("InputStream is null");
         if (properties == null) throw new NullPointerException("Properties is 
null");
         try {
@@ -96,42 +98,42 @@ public class IO {
         return properties;
     }
 
-    public static String readString(URL url) throws IOException {
+    public static String readString(final URL url) throws IOException {
         final InputStream in = url.openStream();
         try {
-            BufferedReader reader = new BufferedReader(new 
InputStreamReader(in));
+            final BufferedReader reader = new BufferedReader(new 
InputStreamReader(in));
             return reader.readLine();
         } finally {
             close(in);
         }
     }
 
-    public static String readString(File file) throws IOException {
+    public static String readString(final File file) throws IOException {
         final FileReader in = new FileReader(file);
         try {
-            BufferedReader reader = new BufferedReader(in);
+            final BufferedReader reader = new BufferedReader(in);
             return reader.readLine();
         } finally {
             close(in);
         }
     }
 
-    public static String slurp(File file) throws IOException {
+    public static String slurp(final File file) throws IOException {
         return slurp(read(file));
     }
 
 
-    public static String slurp(URL url) throws IOException {
+    public static String slurp(final URL url) throws IOException {
         return slurp(url.openStream());
     }
 
-    public static String slurp(InputStream in) throws IOException {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
+    public static String slurp(final InputStream in) throws IOException {
+        final ByteArrayOutputStream out = new ByteArrayOutputStream();
         copy(in, out);
         return new String(out.toByteArray());
     }
 
-    public static void writeString(File file, String string) throws 
IOException {
+    public static void writeString(final File file, final String string) 
throws IOException {
         final FileWriter out = new FileWriter(file);
         try {
             final BufferedWriter bufferedWriter = new BufferedWriter(out);
@@ -179,11 +181,11 @@ public class IO {
         // Cater for destination being directory within the source directory 
(see IO-141)
         List<String> exclusionList = null;
         if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) {
-            File[] srcFiles = srcDir.listFiles();
+            final File[] srcFiles = srcDir.listFiles();
             if (srcFiles != null && srcFiles.length > 0) {
                 exclusionList = new ArrayList<String>(srcFiles.length);
-                for (File srcFile : srcFiles) {
-                    File copiedFile = new File(destDir, srcFile.getName());
+                for (final File srcFile : srcFiles) {
+                    final File copiedFile = new File(destDir, 
srcFile.getName());
                     exclusionList.add(copiedFile.getCanonicalPath());
                 }
             }
@@ -208,7 +210,7 @@ public class IO {
         if (!destDir.canWrite()) {
             throw new IOException("Destination '" + destDir + "' cannot be 
written to");
         }
-        for (File file : files) {
+        for (final File file : files) {
             final File copiedFile = new File(destDir, file.getName());
             if (exclusionList == null || 
!exclusionList.contains(file.getCanonicalPath())) {
                 if (file.isDirectory()) {
@@ -220,7 +222,7 @@ public class IO {
         }
     }
 
-    public static void copy(File from, OutputStream to) throws IOException {
+    public static void copy(final File from, final OutputStream to) throws 
IOException {
         final InputStream read = read(from);
         try {
             copy(read, to);
@@ -229,7 +231,7 @@ public class IO {
         }
     }
 
-    public static void copy(URL from, OutputStream to) throws IOException {
+    public static void copy(final URL from, final OutputStream to) throws 
IOException {
         final InputStream read = read(from);
         try {
             copy(read, to);
@@ -238,7 +240,7 @@ public class IO {
         }
     }
 
-    public static void copy(InputStream from, File to) throws IOException {
+    public static void copy(final InputStream from, final File to) throws 
IOException {
         final OutputStream write = write(to);
         try {
             copy(from, write);
@@ -247,7 +249,7 @@ public class IO {
         }
     }
 
-    public static void copy(InputStream from, File to, boolean append) throws 
IOException {
+    public static void copy(final InputStream from, final File to, final 
boolean append) throws IOException {
         final OutputStream write = write(to, append);
         try {
             copy(from, write);
@@ -256,8 +258,8 @@ public class IO {
         }
     }
 
-    public static void copy(InputStream from, OutputStream to) throws 
IOException {
-        byte[] buffer = new byte[1024];
+    public static void copy(final InputStream from, final OutputStream to) 
throws IOException {
+        final byte[] buffer = new byte[1024];
         int length;
         while ((length = from.read(buffer)) != -1) {
             to.write(buffer, 0, length);
@@ -265,25 +267,25 @@ public class IO {
         to.flush();
     }
 
-    public static void copy(byte[] from, File to) throws IOException {
+    public static void copy(final byte[] from, final File to) throws 
IOException {
         copy(new ByteArrayInputStream(from), to);
     }
 
-    public static void copy(byte[] from, OutputStream to) throws IOException {
+    public static void copy(final byte[] from, final OutputStream to) throws 
IOException {
         copy(new ByteArrayInputStream(from), to);
     }
 
-    public static ZipOutputStream zip(File file) throws IOException {
+    public static ZipOutputStream zip(final File file) throws IOException {
         final OutputStream write = write(file);
         return new ZipOutputStream(write);
     }
 
-    public static ZipInputStream unzip(File file) throws IOException {
+    public static ZipInputStream unzip(final File file) throws IOException {
         final InputStream read = read(file);
         return new ZipInputStream(read);
     }
 
-    public static void close(Closeable closeable) {
+    public static void close(final Closeable closeable) {
         if (closeable == null) return;
         try {
             if (Flushable.class.isInstance(closeable)) {
@@ -299,44 +301,44 @@ public class IO {
         }
     }
 
-    public static boolean delete(File file) {
+    public static boolean delete(final File file) {
         if (file == null) return false;
         if (!file.delete()) {
-            System.err.println("Delete failed " + file.getAbsolutePath());
+            Logger.getLogger(IO.class.getName()).log(Level.WARNING, "Delete 
failed on: " + file.getAbsolutePath());
             return false;
         }
 
         return true;
     }
 
-    public static OutputStream write(File destination) throws 
FileNotFoundException {
+    public static OutputStream write(final File destination) throws 
FileNotFoundException {
         final OutputStream out = new FileOutputStream(destination);
         return new BufferedOutputStream(out, 32768);
     }
 
-    public static OutputStream write(File destination, boolean append) throws 
FileNotFoundException {
+    public static OutputStream write(final File destination, final boolean 
append) throws FileNotFoundException {
         final OutputStream out = new FileOutputStream(destination, append);
         return new BufferedOutputStream(out, 32768);
     }
 
-    public static InputStream read(File source) throws FileNotFoundException {
+    public static InputStream read(final File source) throws 
FileNotFoundException {
         final InputStream in = new FileInputStream(source);
         return new BufferedInputStream(in, 32768);
     }
 
-    public static InputStream read(String content) {
+    public static InputStream read(final String content) {
         return read(content.getBytes());
     }
 
-    public static InputStream read(String content, String encoding) throws 
UnsupportedEncodingException {
+    public static InputStream read(final String content, final String 
encoding) throws UnsupportedEncodingException {
         return read(content.getBytes(encoding));
     }
 
-    public static InputStream read(byte[] content) {
+    public static InputStream read(final byte[] content) {
         return new ByteArrayInputStream(content);
     }
 
-    public static InputStream read(URL url) throws IOException {
+    public static InputStream read(final URL url) throws IOException {
         return url.openStream();
     }
 }
\ No newline at end of file

Modified: 
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java?rev=1417506&r1=1417505&r2=1417506&view=diff
==============================================================================
--- 
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
 (original)
+++ 
openejb/trunk/openejb/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
 Wed Dec  5 16:19:59 2012
@@ -71,10 +71,10 @@ public class ProvisioningUtil {
 
     public static InputStream inputStreamTryingProxies(final URI source) 
throws Exception {
         final URL url = source.toURL();
-        for (Proxy proxy : ProxySelector.getDefault().select(source)) {
+        for (final Proxy proxy : ProxySelector.getDefault().select(source)) {
             // try to connect
             try {
-                URLConnection urlConnection = url.openConnection(proxy);
+                final URLConnection urlConnection = url.openConnection(proxy);
                 urlConnection.setConnectTimeout(CONNECT_TIMEOUT);
                 return new BufferedInputStream(urlConnection.getInputStream());
             } catch (IOException e) {
@@ -92,7 +92,7 @@ public class ProvisioningUtil {
         return location.substring(idx + 1, location.length());
     }
 
-    public static String realLocation(String rawLocation) {
+    public static String realLocation(final String rawLocation) {
         if (rawLocation.startsWith(HTTP_PREFIX)) {
             final File file = cacheFile(lastPart(rawLocation));
 
@@ -117,7 +117,7 @@ public class ProvisioningUtil {
     }
 
     public static void addAdditionalLibraries() throws IOException {
-        File conf = SystemInstance.get().getConf(ADDITIONAL_LIB_CONFIG);
+        final File conf = SystemInstance.get().getConf(ADDITIONAL_LIB_CONFIG);
         if (conf == null || !conf.exists()) {
             return;
         }
@@ -127,18 +127,18 @@ public class ProvisioningUtil {
         final List<String> libToCopy = new ArrayList<String>();
         final String toCopy = additionalLibProperties.getProperty(JAR_KEY);
         if (toCopy != null) {
-            for (String lib : toCopy.split(",")) {
+            for (final String lib : toCopy.split(",")) {
                 libToCopy.add(realLocation(lib.trim()));
             }
         }
         final String toExtract = additionalLibProperties.getProperty(ZIP_KEY);
         if (toExtract != null) {
-            for (String zip : toExtract.split(",")) {
+            for (final String zip : toExtract.split(",")) {
                 libToCopy.addAll(extract(realLocation(zip)));
             }
         }
 
-        File destination;
+        final File destination;
         if (additionalLibProperties.containsKey(DESTINATION_KEY)) {
             destination = new 
File(additionalLibProperties.getProperty(DESTINATION_KEY));
         } else {
@@ -148,7 +148,7 @@ public class ProvisioningUtil {
             Files.mkdirs(destination);
         }
 
-        for (String lib : libToCopy) {
+        for (final String lib : libToCopy) {
             copy(new File(lib), destination);
         }
     }
@@ -194,7 +194,7 @@ public class ProvisioningUtil {
             return Collections.emptyList();
         }
 
-        for (File file : files) {
+        for (final File file : files) {
             if (file.isDirectory()) {
                 libs.addAll(list(file));
             } else {


Reply via email to