[lsc-changes] r496 - in lsc/trunk/src/main/java/org/lsc: beans jndi utils

jclarke at lsc-project.org jclarke at lsc-project.org
Mon Nov 30 00:03:24 CET 2009


Author: jclarke
Date: 2009-11-30 00:03:24 +0100 (Mon, 30 Nov 2009)
New Revision: 496

Modified:
   lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java
   lsc/trunk/src/main/java/org/lsc/beans/BeanComparator.java
   lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java
   lsc/trunk/src/main/java/org/lsc/utils/FrenchFilters.java
   lsc/trunk/src/main/java/org/lsc/utils/SetUtils.java
Log:
Cleanup code and comments

Modified: lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java	2009-11-29 21:42:44 UTC (rev 495)
+++ lsc/trunk/src/main/java/org/lsc/beans/AbstractBean.java	2009-11-29 23:03:24 UTC (rev 496)
@@ -159,10 +159,7 @@
 						localMethod = meths.get(0);
 					} else {
 						/* Find method matching returnType */
-						Iterator<Method> methsIt = meths.iterator();
-						Method currentMeth = null;
-						while (methsIt.hasNext()) {
-							currentMeth = methsIt.next();
+						for (Method currentMeth : meths) {
 							if (currentMeth.getParameterTypes()[0].isAssignableFrom(returnType)) {
 								localMethod = currentMeth;
 							}

Modified: lsc/trunk/src/main/java/org/lsc/beans/BeanComparator.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/beans/BeanComparator.java	2009-11-29 21:42:44 UTC (rev 495)
+++ lsc/trunk/src/main/java/org/lsc/beans/BeanComparator.java	2009-11-29 23:03:24 UTC (rev 496)
@@ -489,6 +489,7 @@
 	 * @param srcBean database object bean
 	 * @param destBean directory object bean
 	 * @param jm modification to apply on the main object
+	 * @return Array of {@link JndiModifications}
 	 * @throws InvocationTargetException
 	 * @throws IllegalAccessException
 	 * @throws IllegalArgumentException

Modified: lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java	2009-11-29 21:42:44 UTC (rev 495)
+++ lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java	2009-11-29 23:03:24 UTC (rev 496)
@@ -595,7 +595,7 @@
 	private void deleteChildrenRecursively(String distinguishName) throws NamingException {
 		SearchControls sc = new SearchControls();
 		sc.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-		NamingEnumeration ne = ctx.search(distinguishName, DEFAULT_FILTER, sc);
+		NamingEnumeration<SearchResult> ne = ctx.search(distinguishName, DEFAULT_FILTER, sc);
 		while (ne.hasMore()) {
 			SearchResult sr = (SearchResult) ne.next();
 			String childrenDn = rewriteBase(sr.getName() + "," + distinguishName);

Modified: lsc/trunk/src/main/java/org/lsc/utils/FrenchFilters.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/utils/FrenchFilters.java	2009-11-29 21:42:44 UTC (rev 495)
+++ lsc/trunk/src/main/java/org/lsc/utils/FrenchFilters.java	2009-11-29 23:03:24 UTC (rev 496)
@@ -243,35 +243,8 @@
 	}
 
 	/**
-	 * Remove all the occurences of a string in a string
+	 * Transform a telephone number in the international display
 	 *
-	 * @param chars to remove
-	 * @param string to filter
-	 *
-	 * @return
-	 */
-	private static String filterDelStringIntoString(final String charactere,
-					final String string) {
-		String returned = "";
-		String tmp = string;
-		int i = tmp.indexOf(charactere);
-
-		while ((i != -1) && (i < string.length())) {
-			returned += tmp.substring(0, i);
-			tmp = tmp.substring(i + 1, tmp.length());
-			i = tmp.indexOf(charactere);
-		}
-
-		if (tmp.length() > 0) {
-			returned += tmp;
-		}
-
-		return returned;
-	}
-
-	/**
-	 * Transform a telephon number in the international display
-	 *
 	 * @param phone2parse
 	 *
 	 * @return the filtered phone number
@@ -369,7 +342,7 @@
 		String tmp = filterName(startString);
 
 		for (int i = 0; i < BAD_SEPARATOR_FOR_ID.length; i++) {
-			tmp = filterDelStringIntoString(BAD_SEPARATOR_FOR_ID[i], tmp);
+			tmp = tmp.replaceAll(BAD_SEPARATOR_FOR_ID[i], "");
 		}
 
 		// Remove all accents and cedillas

Modified: lsc/trunk/src/main/java/org/lsc/utils/SetUtils.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/utils/SetUtils.java	2009-11-29 21:42:44 UTC (rev 495)
+++ lsc/trunk/src/main/java/org/lsc/utils/SetUtils.java	2009-11-29 23:03:24 UTC (rev 496)
@@ -218,6 +218,7 @@
 	 *            Set of Objects to find the needles in.
 	 * @param needles
 	 *            Set of Objects to search for in the haystack.
+	 * @return true if all the members of needles are found in haystack
 	 */
 	public static boolean setContainsAll(Set<Object> haystack, Set<Object> needles)
 	{



More information about the lsc-changes mailing list