creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1462952 - /creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java
Date Sun, 31 Mar 2013 13:47:39 GMT
Author: rdonkin
Date: Sun Mar 31 13:47:38 2013
New Revision: 1462952

URL: http://svn.apache.org/r1462952
Log:
DRY up code

Modified:
    creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java

Modified: creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java
URL: http://svn.apache.org/viewvc/creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java?rev=1462952&r1=1462951&r2=1462952&view=diff
==============================================================================
--- creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java (original)
+++ creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java Sun Mar 31
13:47:38 2013
@@ -609,11 +609,16 @@ public class Main {
         }
 
         private Map<URI, URI> mapOther() {
-            final File jarContents = contents(this.file);
+            final File jarContents = contents();
             final List<File> legal =
                     Main.this.fileSystem
                             .legalDocumentsUndeclaredIn(jarContents);
 
+            return buildMapFrom(jarContents, legal);
+        }
+
+        private Map<URI, URI> buildMapFrom(final File jarContents,
+                final List<File> legal) {
             final Map<URI, URI> map = new LinkedHashMap<URI, URI>();
             for (final File file : legal) {
                 final URI name = jarContents.toURI().relativize(file.toURI());
@@ -626,19 +631,15 @@ public class Main {
         }
 
         private Map<URI, URI> map() {
-            final File jarContents = contents(this.file);
+            final File jarContents = contents();
             final List<File> legal =
                     Main.this.fileSystem.legalDocumentsDeclaredIn(jarContents);
 
-            final Map<URI, URI> map = new LinkedHashMap<URI, URI>();
-            for (final File file : legal) {
-                final URI name = jarContents.toURI().relativize(file.toURI());
-                final URI link =
-                        Main.this.local.toURI().relativize(file.toURI());
+            return buildMapFrom(jarContents, legal);
+        }
 
-                map.put(name, link);
-            }
-            return map;
+        private File contents() {
+            return Main.this.contents(this.file);
         }
     }
 



Mime
View raw message