incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r832608 - in /sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal: DefaultContentCreator.java Loader.java readers/XmlReader.java
Date Tue, 03 Nov 2009 23:39:10 GMT
Author: cziegeler
Date: Tue Nov  3 23:39:09 2009
New Revision: 832608

URL: http://svn.apache.org/viewvc?rev=832608&view=rev
Log:
Clean up code

Modified:
    sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java
    sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
    sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java

Modified: sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java?rev=832608&r1=832607&r2=832608&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java
(original)
+++ sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java
Tue Nov  3 23:39:09 2009
@@ -98,12 +98,12 @@
      * A one time use seed to randomize the user location.
      */
     private static final long INSTANCE_SEED = System.currentTimeMillis();
-   
+
     /**
      * The number of levels folder used to store a user, could be a configuration option.
      */
     private static final int STORAGE_LEVELS = 3;
-   
+
     /**
      * Constructor.
      * @param jcrContentHelper Helper class to get the mime type of a file
@@ -642,7 +642,7 @@
 
 		final Node parentNode = this.parentNodeStack.peek();
 		Session session = parentNode.getSession();
-		
+
         UserManager userManager = AccessControlUtil.getUserManager(session);
         Authorizable authorizable = userManager.getAuthorizable(name);
         if (authorizable == null) {
@@ -660,9 +660,8 @@
                 throw new RepositoryException(
                         "A user already exists with the requested name: "
                             + name);
-        	} else {
-        		//group already exists so just update it below        		
-        	}
+            }
+    		//group already exists so just update it below
         }
         //update the group members
         if (members != null) {
@@ -691,7 +690,7 @@
 			Map<String, Object> extraProperties) throws RepositoryException {
 		final Node parentNode = this.parentNodeStack.peek();
 		Session session = parentNode.getSession();
-		
+
         UserManager userManager = AccessControlUtil.getUserManager(session);
         Authorizable authorizable = userManager.getAuthorizable(name);
         if (authorizable == null) {
@@ -712,9 +711,8 @@
                 throw new RepositoryException(
                         "A group already exists with the requested name: "
                             + name);
-        	} else {
-        		//user already exists so just update it below        		
-        	}
+            }
+    		//user already exists so just update it below
         }
         if (extraProperties != null) {
         	ValueFactory valueFactory = session.getValueFactory();
@@ -725,7 +723,7 @@
 			}
         }
 	}
-	
+
 	/**
 	 * @param item
 	 * @return a parent path fragment for the item.
@@ -744,7 +742,7 @@
 			throw new RepositoryException("Unable to hash the path.", e);
 		}
 	}
-	
+
 
     /* (non-Javadoc)
 	 * @see org.apache.sling.jcr.contentloader.internal.ContentCreator#createAce(java.lang.String,
java.lang.String, java.lang.String[], java.lang.String[])
@@ -754,7 +752,7 @@
 			throws RepositoryException {
 		final Node parentNode = this.parentNodeStack.peek();
 		Session session = parentNode.getSession();
-		
+
 		UserManager userManager = AccessControlUtil.getUserManager(session);
 		Authorizable authorizable = userManager.getAuthorizable(principalId);
 		if (authorizable == null) {
@@ -762,7 +760,7 @@
 		}
 
 		String resourcePath = parentNode.getPath();
-		
+
 		AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
 		AccessControlList updatedAcl = null;
 		AccessControlPolicyIterator applicablePolicies = accessControlManager.getApplicablePolicies(resourcePath);
@@ -784,10 +782,10 @@
 		if (deniedPrivilegeNames != null) {
 			postedPrivilegeNames.addAll(Arrays.asList(deniedPrivilegeNames));
 		}
-			
+
 		List<Privilege> preserveGrantedPrivileges = new ArrayList<Privilege>();
 		List<Privilege> preserveDeniedPrivileges = new ArrayList<Privilege>();
-			
+
 		//keep track of the existing Aces for the target principal
 		AccessControlEntry[] accessControlEntries = updatedAcl.getAccessControlEntries();
 		List<AccessControlEntry> oldAces = new ArrayList<AccessControlEntry>();
@@ -818,7 +816,7 @@
 				updatedAcl.removeAccessControlEntry(ace);
 			}
 		}
-			
+
 		//add a fresh ACE with the granted privileges
 		List<Privilege> grantedPrivilegeList = new ArrayList<Privilege>();
 		for (String name : grantedPrivilegeNames) {
@@ -830,7 +828,7 @@
 		}
 		//add the privileges that should be preserved
 		grantedPrivilegeList.addAll(preserveGrantedPrivileges);
-			
+
 		if (grantedPrivilegeList.size() > 0) {
 			Principal principal = authorizable.getPrincipal();
 			updatedAcl.addAccessControlEntry(principal, grantedPrivilegeList.toArray(new Privilege[grantedPrivilegeList.size()]));
@@ -857,5 +855,5 @@
 		}
 
 		accessControlManager.setPolicy(resourcePath, updatedAcl);
-	}	
+	}
 }

Modified: sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java?rev=832608&r1=832607&r2=832608&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
(original)
+++ sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
Tue Nov  3 23:39:09 2009
@@ -462,7 +462,6 @@
                             PathEntry configuration)
     throws RepositoryException {
         final String resourcePath = resourceUrl.getPath().toLowerCase();
-        InputStream ins = null;
         try {
             // special treatment for system view imports
             if (resourcePath.endsWith(EXT_JCR_XML)) {
@@ -489,13 +488,6 @@
             throw re;
         } catch (Throwable t) {
             throw new RepositoryException(t.getMessage(), t);
-        } finally {
-            if (ins != null) {
-                try {
-                    ins.close();
-                } catch (IOException ignore) {
-                }
-            }
         }
     }
 

Modified: sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java?rev=832608&r1=832607&r2=832608&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java
(original)
+++ sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java
Tue Nov  3 23:39:09 2009
@@ -20,14 +20,16 @@
 
 import java.io.BufferedInputStream;
 import java.io.Closeable;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
-import java.io.File;
-import java.net.URL;
 import java.net.MalformedURLException;
-import java.net.URISyntaxException;
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.HashMap;
@@ -36,9 +38,6 @@
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.text.DateFormat;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;



Mime
View raw message