Nuiton-utils-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
May 2011
- 4 participants
- 14 discussions
r2137 - in trunk/nuiton-utils/src: main/java/org/nuiton/util main/java/org/nuiton/util/converter test/java/org/nuiton/util test/java/org/nuiton/util/rmi
by tchemit@users.nuiton.org 13 May '11
by tchemit@users.nuiton.org 13 May '11
13 May '11
Author: tchemit
Date: 2011-05-13 11:07:31 +0200 (Fri, 13 May 2011)
New Revision: 2137
Url: http://nuiton.org/repositories/revision/nuiton-utils/2137
Log:
clean some codes, and more...
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/CallAnalyse.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/CategorisedListenerSet.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/ClassLoaderUtil.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/FileUtil.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/StringUtil.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeLog.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeTrace.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipStreamEncoder.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/ConverterUtil.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/EnumConverter.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/FormatConverterFactory.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URIConverter.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URLConverter.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/VersionConverter.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/CallAnalyseTest.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/ZipUtilTest.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/rmi/RmiExporterAndProxyTest.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -291,7 +291,7 @@
* Last update $Date$ by */
public class ApplicationConfig {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(ApplicationConfig.class);
/** Used to know what is separator between class and method on command line. */
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/CallAnalyse.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/CallAnalyse.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/CallAnalyse.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -63,7 +63,7 @@
*/
public class CallAnalyse { // CallAnalyse
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(CallAnalyse.class);
static private List<ThreadStatistics> listThreadStatistics =
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/CategorisedListenerSet.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/CategorisedListenerSet.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/CategorisedListenerSet.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -67,7 +67,7 @@
*/
public class CategorisedListenerSet<L> { // CategorisedListenerSet
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
private static Log log = LogFactory.getLog(CategorisedListenerSet.class);
/**
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ClassLoaderUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ClassLoaderUtil.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ClassLoaderUtil.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -44,7 +44,7 @@
public class ClassLoaderUtil {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
private static final Log log = LogFactory.getLog(ClassLoaderUtil.class);
/**
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/FileUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/FileUtil.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/FileUtil.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -86,7 +86,7 @@
*/
public class FileUtil { // FileUtil
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(FileUtil.class);
/** Encoding utilisé (peut être redéfini) */
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -36,6 +36,12 @@
package org.nuiton.util;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.MethodUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
@@ -43,22 +49,15 @@
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-
-import org.apache.commons.beanutils.MethodUtils;
-import static org.nuiton.i18n.I18n._;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.beanutils.ConvertUtils;
+import static org.nuiton.i18n.I18n._;
+
/**
* Outils pour manipuler des objets. Création d'un objet à partir d'une chaîne
* le décrivant, conversion d'un objet en Object, récupération de méthodes
@@ -71,7 +70,7 @@
*/
public class ObjectUtil { // ObjectUtil
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(ObjectUtil.class);
protected static final Integer ZERO = 0;
@@ -106,10 +105,10 @@
}
// copy collection into modifiable list to add new object
- List container = new LinkedList(args);
+ List<?> container = new LinkedList(args);
Constructor<E> constructor = constructors[0];
- Class[] paramTypes = constructor.getParameterTypes();
+ Class<?>[] paramTypes = constructor.getParameterTypes();
Object[] params = new Object[paramTypes.length];
for (int i=0; i<paramTypes.length; i++) {
@@ -137,14 +136,14 @@
* @param nullIfMissing
* @return
*/
- static protected Object choiceArgument(Class clazz, List args, boolean nullIfMissing) {
+ static protected Object choiceArgument(Class<?> clazz, List args, boolean nullIfMissing) {
Object result = null;
boolean addResult = false;
for (Object o : args) {
if (o != null) {
- if ((o instanceof Class) && clazz.isAssignableFrom((Class) o)) {
+ if (o instanceof Class<?> && clazz.isAssignableFrom((Class<?>) o)) {
// cas on l'on trouve une class dans arg qui une fois instancier convient
- result = newInstance((Class) o, args, nullIfMissing);
+ result = newInstance((Class<?>) o, args, nullIfMissing);
addResult = true;
break;
} else if (clazz.isInstance(o)) {
@@ -267,13 +266,20 @@
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
- oos.writeObject(e);
- oos.close();
+ try {
+ oos.writeObject(e);
+ } finally {
+ oos.close();
+ }
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ E result;
ObjectInputStream ois = new ObjectInputStream(bis);
- E result = (E) ois.readObject();
- ois.close();
+ try {
+ result = (E) ois.readObject();
+ } finally {
+ ois.close();
+ }
return result;
} catch (Exception eee) {
@@ -390,7 +396,7 @@
public static <T> T newInstance(Class<T> clazz, String ... params)
throws IllegalArgumentException {
if (params == null) {
- params = new String[0];
+ params = StringUtil.EMPTY_STRING_ARRAY;
}
List<Constructor<T>> constructors = getConstructor(clazz, params.length);
@@ -670,5 +676,59 @@
return value == ZEROD;
}
+ /**
+ * Verifie si la classe est de type primitif.
+ *
+ * @param clazz nom de la classe a tester
+ * @return vrai si le classe est de type primitif faux sinon
+ */
+ public static boolean isPrimitive(Class<?> clazz) {
+ return clazz.isPrimitive() || clazz == Boolean.class
+ || clazz == Byte.class || clazz == Character.class
+ || clazz == Short.class || clazz == Integer.class
+ || clazz == Long.class || clazz == Float.class
+ || clazz == Double.class;
+ }
+
+ /**
+ * Retourne la classe du type primitf associé avec la classe de de l'objet
+ * passé en parametre. Par exemple si la classe passée en paramètre est
+ * Integer alors le resultat sera la classe de int.
+ *
+ * @param clazz la classe dont on souhaite le type primitf
+ * @return le type primitif associé a la classe en paramètre, ou null s'il
+ * n'y a pas de type primitif associé.
+ */
+ public static Class<?> getPrimitiveClass(Class<?> clazz) {
+ if (clazz == Boolean.class) {
+ return Boolean.TYPE;
+ }
+ if (clazz == Byte.class) {
+ return Byte.TYPE;
+ }
+ if (clazz == Character.class) {
+ return Character.TYPE;
+ }
+ if (clazz == Short.class) {
+ return Short.TYPE;
+ }
+ if (clazz == Integer.class) {
+ return Integer.TYPE;
+ }
+ if (clazz == Long.class) {
+ return Long.TYPE;
+ }
+ if (clazz == Float.class) {
+ return Float.TYPE;
+ }
+ if (clazz == Double.class) {
+ return Double.TYPE;
+ }
+ if (clazz == Void.class) {
+ return Void.TYPE;
+ }
+ return null;
+ }
+
} // ObjectUtil
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -25,8 +25,10 @@
package org.nuiton.util;
-import static org.nuiton.i18n.I18n._;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import javax.swing.ImageIcon;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -50,11 +52,8 @@
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
-import javax.swing.ImageIcon;
+import static org.nuiton.i18n.I18n._;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Cette class permet de rechercher un fichier en indiquant son nom avec son
* chemin. Cette librairie ira ensuite chercher ce fichier sur le système de
@@ -71,7 +70,7 @@
*/
public class Resource { // Resource
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
private static final Log log = LogFactory.getLog(Resource.class);
protected Resource() {
@@ -84,7 +83,7 @@
*
* @param url l'url a ajouter
*/
- static public void addDefaultClassLoader(URL url) {
+ public static void addDefaultClassLoader(URL url) {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
addClassLoader(classLoader, url);
}
@@ -96,7 +95,7 @@
* @param classLoader le classloader a modifier
* @param url l'url a ajouter
*/
- static public void addClassLoader(ClassLoader classLoader, URL url) {
+ public static void addClassLoader(ClassLoader classLoader, URL url) {
try {
Method method = URLClassLoader.class.getDeclaredMethod("addURL",
new Class[]{URL.class});
@@ -114,7 +113,7 @@
* @return l'url de la ressource
* @throws ResourceNotFoundException si la resource n'a pas ete trouvee
*/
- static public URL getURL(String name) {
+ public static URL getURL(String name) {
URL url = getURLOrNull(name);
if (url != null) {
return url;
@@ -129,7 +128,7 @@
* @param name le nom de la ressource
* @return l'url de la ressource ou null
*/
- static public URL getURLOrNull(String name) {
+ public static URL getURLOrNull(String name) {
// on recherche d'abord sur le filesystem
File file = new File(name);
if (file.exists()) {
@@ -164,7 +163,7 @@
* @param name le nom de l'icone
* @return Retourne l'icon demande ou null s'il n'est pas trouvé
*/
- static public ImageIcon getIcon(String name) {
+ public static ImageIcon getIcon(String name) {
try {
return new ImageIcon(getURL(name));
} catch (Exception eee) {
@@ -184,25 +183,11 @@
* compris).
* @return la liste des urls correspondant au pattern
*/
- static public List<URL> getURLs(String pattern) {
+ public static List<URL> getURLs(String pattern) {
return getURLs(pattern, (URLClassLoader) null);
}
/**
- * Recupere la liste des urls d'un {@link URLClassLoader}.
- * <p/>
- * Note : Un cas particulier est positionné pour JBoss qui utilise la method getAllURLs.
- *
- * @param classLoader le class loader a scanner
- * @return les urls du classloade.
- * @deprecated should use now {@link ClassLoaderUtil#getURLs(URLClassLoader)}
- */
- @Deprecated
- static public URL[] getURLs(URLClassLoader classLoader) {
- return ClassLoaderUtil.getURLs(classLoader);
- }
-
- /**
* Retourner la liste des fichiers du classLoader. Ces fichiers doivent
* correspondre au pattern donne.
*
@@ -212,7 +197,7 @@
* compris).
* @return la liste des urls correspondant au pattern
*/
- static public List<URL> getURLs(String pattern, URLClassLoader classLoader) {
+ public static List<URL> getURLs(String pattern, URLClassLoader classLoader) {
if (classLoader == null) {
classLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
}
@@ -226,14 +211,14 @@
*
* @param arrayURL les urls ou chercher
* @param pattern le nom du fichier a extraire du fichier compressé ou
- * durepertoire doit correspondre au pattern (repertoire + nom
+ * dur epertoire doit correspondre au pattern (repertoire + nom
* compris).
* @return la liste des urls correspondant au pattern
*/
- static public List<URL> getURLs(String pattern, URL... arrayURL) {
+ public static List<URL> getURLs(String pattern, URL... arrayURL) {
long t0 = System.nanoTime();
- HashList<URL> urlList = new HashList<URL>();
+ List<URL> urlList = new HashList<URL>();
if (arrayURL.length == 1) {
URL jarURL = arrayURL[0];
@@ -256,7 +241,7 @@
for (URL urlFile : arrayURL) {
// EC-20100510 this cause wrong accent encoding
//String fileName = urlFile.getFile();
- String fileName = null;
+ String fileName;
try {
fileName = urlFile.toURI().getPath();
}
@@ -314,7 +299,7 @@
return urlList;
}
- static public URL[] getClassPathURLsFromJarManifest(URL jarURL)
+ public static URL[] getClassPathURLsFromJarManifest(URL jarURL)
throws IOException, URISyntaxException {
JarFile jar = null;
URL[] result;
@@ -335,7 +320,7 @@
if (classPath != null) {
paths = classPath.split(" ");
} else {
- paths = new String[0];
+ paths = StringUtil.EMPTY_STRING_ARRAY;
}
result = new URL[paths.length + 1];
result[0] = jarURL;
@@ -368,7 +353,7 @@
return result;
}
- static public List<URL> getURLsFromZip(File zipFile, String pattern) {
+ public static List<URL> getURLsFromZip(File zipFile, String pattern) {
try {
if (log.isTraceEnabled()) {
log.trace("search '" + pattern + "' in " + zipFile);
@@ -409,13 +394,13 @@
}
}
- static public List<URL> getURLsFromJar(File jarfile, String pattern) {
+ public static List<URL> getURLsFromJar(File jarfile, String pattern) {
try {
if (log.isTraceEnabled()) {
log.trace("search '" + pattern + "' in " + jarfile);
}
- ArrayList<URL> result = new ArrayList<URL>();
+ List<URL> result = new ArrayList<URL>();
InputStream in = new FileInputStream(jarfile);
ZipInputStream zis = new ZipInputStream(in);
while (zis.available() != 0) {
@@ -460,13 +445,13 @@
* pattern est null, tous les fichiers trouvé sont retourné.
* @return la liste des urls correspondant au pattern
*/
- static public List<URL> getURLsFromDirectory(File repository, String pattern) {
+ public static List<URL> getURLsFromDirectory(File repository, String pattern) {
try {
if (log.isTraceEnabled()) {
log.trace("search '" + pattern + "' in " + repository);
}
- HashList<URL> urlList = new HashList<URL>();
+ List<URL> urlList = new HashList<URL>();
File[] filesList = repository.listFiles();
if (filesList != null) {
@@ -512,7 +497,7 @@
* @param name nom du fichier a tester
* @return vrai si le fichier se termine par .jar faux sinon
*/
- static public boolean isJar(String name) {
+ public static boolean isJar(String name) {
if (name != null && name.length() > 4) {
String ext = name.substring(name.length() - 4, name.length());
return ".jar".equalsIgnoreCase(ext);
@@ -526,7 +511,7 @@
* @param name nom du fichier a tester
* @return vrai si le fichier se termine par .zip faux sinon
*/
- static public boolean isZip(String name) {
+ public static boolean isZip(String name) {
if (name != null && name.length() > 4) {
String ext = name.substring(name.length() - 4, name.length());
return ".zip".equalsIgnoreCase(ext);
@@ -539,13 +524,11 @@
*
* @param clazz nom de la classe a tester
* @return vrai si le classe est de type primitif faux sinon
+ * @deprecated since 2.2, use now the method {@link ObjectUtil#isPrimitive(Class)}
*/
- static public boolean isPrimitive(Class clazz) {
- return clazz.isPrimitive() || clazz == Boolean.class
- || clazz == Byte.class || clazz == Character.class
- || clazz == Short.class || clazz == Integer.class
- || clazz == Long.class || clazz == Float.class
- || clazz == Double.class;
+ @Deprecated
+ public static boolean isPrimitive(Class clazz) {
+ return ObjectUtil.isPrimitive(clazz);
}
/**
@@ -556,36 +539,11 @@
* @param clazz la classe dont on souhaite le type primitf
* @return le type primitif associé a la classe en paramètre, ou null s'il
* n'y a pas de type primitif associé.
+ * @deprecated since 2.2, use now the method {@link ObjectUtil#getPrimitiveClass(Class)}
*/
- static public Class getPrimitiveClass(Class clazz) {
- if (clazz == Boolean.class) {
- return Boolean.TYPE;
- }
- if (clazz == Byte.class) {
- return Byte.TYPE;
- }
- if (clazz == Character.class) {
- return Character.TYPE;
- }
- if (clazz == Short.class) {
- return Short.TYPE;
- }
- if (clazz == Integer.class) {
- return Integer.TYPE;
- }
- if (clazz == Long.class) {
- return Long.TYPE;
- }
- if (clazz == Float.class) {
- return Float.TYPE;
- }
- if (clazz == Double.class) {
- return Double.TYPE;
- }
- if (clazz == Void.class) {
- return Void.TYPE;
- }
- return null;
+ @Deprecated
+ public static Class getPrimitiveClass(Class clazz) {
+ return ObjectUtil.getPrimitiveClass(clazz);
}
@@ -626,12 +584,13 @@
}
/**
- * Return true is str is a pattern (contains * or ?).
+ * Return true if {@code str} is a pattern (contains * or ?).
*
* @param str str to test
* @since 2.2
+ * @return {@code true} if {@code str} is a pattern, {@code false} otherwise
*/
- static protected boolean isPattern(String str) {
+ protected static boolean isPattern(String str) {
return str.indexOf('*') != -1 || str.indexOf('?') != -1;
}
@@ -643,7 +602,7 @@
* @throws IOException
* @since 2.2
*/
- static public List<URL> getResources(String pattern) throws IOException {
+ public static List<URL> getResources(String pattern) throws IOException {
return getResources(pattern, null);
}
@@ -656,12 +615,13 @@
* @throws IOException
* @since 2.2
*/
- static public List<URL> getResources(String pattern, ClassLoader classLoader) throws IOException {
+ public static List<URL> getResources(String pattern,
+ ClassLoader classLoader) throws IOException {
if (classLoader == null) {
classLoader = ClassLoader.getSystemClassLoader();
}
- List<URL> urlList = null;
+ List<URL> urlList;
if (isPattern(pattern)) {
urlList = getPatternRessources(pattern, classLoader);
@@ -686,7 +646,8 @@
* @throws IOException
* @since 2.2
*/
- static protected List<URL> getPatternRessources(String pattern, ClassLoader classLoader) throws IOException {
+ protected static List<URL> getPatternRessources(String pattern,
+ ClassLoader classLoader) throws IOException {
List<URL> urlList = new HashList<URL>();
@@ -756,7 +717,8 @@
* @see JarURLConnection
* @since 2.2
*/
- protected static List<URL> doFindPathMatchingJarResources(URL rootDirResource, String subPattern) throws IOException {
+ protected static List<URL> doFindPathMatchingJarResources(URL rootDirResource,
+ String subPattern) throws IOException {
URLConnection con = rootDirResource.openConnection();
JarFile jarFile;
@@ -771,7 +733,7 @@
jarFile = jarCon.getJarFile();
jarFileUrl = jarCon.getJarFileURL().toExternalForm();
JarEntry jarEntry = jarCon.getJarEntry();
- rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
+ rootEntryPath = jarEntry != null ? jarEntry.getName() : "";
}
else {
// No JarURLConnection -> need to resort to URL file parsing.
@@ -809,7 +771,7 @@
rootEntryPath = rootEntryPath + "/";
}
List<URL> result = new HashList<URL>(8);
- for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) {
+ for (Enumeration<?> entries = jarFile.entries(); entries.hasMoreElements();) {
JarEntry entry = (JarEntry) entries.nextElement();
String entryPath = entry.getName();
if (entryPath.startsWith(rootEntryPath)) {
@@ -842,10 +804,11 @@
* @param subPattern the sub pattern to match (below the root directory)
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
- * @see #retrieveMatchingFiles
+ * @see #retrieveMatchingFiles(File, String)
* @since 2.2
*/
- protected static List<URL> doFindMatchingFileSystemResources(URL rootDirResource, String subPattern)
+ protected static List<URL> doFindMatchingFileSystemResources(URL rootDirResource,
+ String subPattern)
throws IOException {
File rootDir;
@@ -873,7 +836,8 @@
* @throws IOException if directory contents could not be retrieved
* @since 2.2
*/
- protected static List<URL> retrieveMatchingFiles(File rootDir, String pattern) throws IOException {
+ protected static List<URL> retrieveMatchingFiles(File rootDir,
+ String pattern) throws IOException {
if (!rootDir.exists()) {
return Collections.emptyList();
}
@@ -909,7 +873,9 @@
* @throws IOException if directory contents could not be retrieved
* @since 2.2
*/
- protected static void doRetrieveMatchingFiles(String fullPattern, File dir, List<URL> result) throws IOException {
+ protected static void doRetrieveMatchingFiles(String fullPattern,
+ File dir,
+ List<URL> result) throws IOException {
if (log.isDebugEnabled()) {
log.debug("Searching directory [" + dir.getAbsolutePath() +
"] for files matching pattern [" + fullPattern + "]");
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/StringUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/StringUtil.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/StringUtil.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -58,11 +58,13 @@
* Created: 21 octobre 2003
*
* @author bpoussin <poussin(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* $Id$
*/
-public class StringUtil {
- public static final String[] EMPTY_STRING_ARRAY = new String[0]; // StringUtil
+public class StringUtil { // StringUtil
+ public static final String[] EMPTY_STRING_ARRAY = new String[0];
+
/** Constructor for the StringUtil object */
protected StringUtil() {
}
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeLog.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeLog.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeLog.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -24,14 +24,15 @@
*/
package org.nuiton.util;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Cette classe permet de facilement trace le temps d'execution entre deux points
- *
+ * <p/>
* usage
* <pre>
* final static private Log log = LogFactory.getLog(MyClass.class);
@@ -51,63 +52,60 @@
*
* System.out.println ("time: " + timeLog.getCallCount());
* </pre>
- *
+ * <p/>
* You can configure log level in configuration file with:
* log4j.logger.org.codelutin.MyClass=DEBUG
* log4j.logger.org.codelutin.MyClass.TimeLog=INFO
*
- * @see CallAnalyse
* @author poussin
* @version $Revision: 1985 $
+ * @see CallAnalyse
* @since 2.1
- *
- * Last update: $Date: 2010-12-23 12:45:57 +0100 (jeu. 23 déc. 2010) $
- * by : $Author: sletellier $
+ * <p/>
+ * Last update: $Date: 2010-12-23 12:45:57 +0100 (jeu. 23 déc. 2010) $
+ * by : $Author: sletellier $
*/
public class TimeLog {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- final static private Log log = LogFactory.getLog(TimeLog.class);
-
static public class CallStat {
- long callNumber = 0;
- long callTime = 0;
+ protected long callNumber;
+
+ protected long callTime;
+
@Override
public String toString() {
String callTimeString =
StringUtil.convertTime(callTime);
String avgTimeString =
- StringUtil.convertTime((callTime/ callNumber));
+ StringUtil.convertTime(callTime / callNumber);
return String.format("total call %s, total time %s, avg time %s",
- callNumber, callTimeString, avgTimeString);
+ callNumber, callTimeString, avgTimeString);
}
}
/** loggueur used to log time */
protected Log timeLog;
+
/** time to trigger log time in info level (ns) (default: 1s) */
protected long timeToLogInfo = 1000l * 1000000l;
+
/** time to trigger log time in warn level (ns) (default: 3s) */
protected long timeToLogWarn = 3000l * 1000000l;
/** for each method of all proxies, keep number of call */
protected Map<String, CallStat> callCount = new HashMap<String, CallStat>();
- /**
- *
- * @param logTime log used to log time message.
- */
+ /** @param logTime log used to log time message. */
protected TimeLog(Log logTime) {
- this.timeLog = logTime;
+ timeLog = logTime;
}
/**
- *
* @param logName log category used to log time message. This category must
- * be category used to log message in classe that use this TimeLog
- * (normaly class name). TimeLog is added at the end.
+ * be category used to log message in classe that use this TimeLog
+ * (normaly class name). TimeLog is added at the end.
*/
public TimeLog(String logName) {
this(LogFactory.getLog(logName + ".TimeLog"));
@@ -115,19 +113,18 @@
/**
* @param logName log category used to log time message. This category must
- * be category used to log message in classe that use this TimeLog
- * (normaly class name)
+ * be category used to log message in classe that use this TimeLog
+ * (normaly class name)
* @since 2.1
*/
- public TimeLog(Class logName) {
+ public TimeLog(Class<?> logName) {
this(logName.getName());
}
/**
- *
- * @param logName log category used to log time message. This category must
- * be category used to log message in classe that use this TimeLog
- * (normaly class name)
+ * @param logName log category used to log time message. This category must
+ * be category used to log message in classe that use this TimeLog
+ * (normaly class name)
* @param timeToLogInfo time in milliseconde after that we log info
* @param timeToLogWarn time in milliseconde after that we log warn
*/
@@ -138,31 +135,24 @@
}
/**
- *
- * @param logName log category used to log time message. This category must
- * be category used to log message in classe that use this TimeLog
- * (normaly class name)
+ * @param logName log category used to log time message. This category must
+ * be category used to log message in classe that use this TimeLog
+ * (normaly class name)
* @param timeToLogInfo time in milliseconde after that we log info
* @param timeToLogWarn time in milliseconde after that we log warn
*/
- public TimeLog(Class logName, long timeToLogInfo, long timeToLogWarn) {
+ public TimeLog(Class<?> logName, long timeToLogInfo, long timeToLogWarn) {
this(logName.getName(), timeToLogInfo, timeToLogWarn);
}
- /**
- *
- * @param timeToLogInfoMs time in milliseconde after that we log info
- */
+ /** @param timeToLogInfoMs time in milliseconde after that we log info */
public void setTimeToLogInfo(long timeToLogInfoMs) {
- this.timeToLogInfo = timeToLogInfoMs * 1000000l; // convert ms -> ns
+ timeToLogInfo = timeToLogInfoMs * 1000000l; // convert ms -> ns
}
- /**
- *
- * @param timeToLogWarnMs time in milliseconde after that we log warn
- */
+ /** @param timeToLogWarnMs time in milliseconde after that we log warn */
public void setTimeToLogWarn(long timeToLogWarnMs) {
- this.timeToLogWarn = timeToLogWarnMs * 1000000l; // convert ms -> ns
+ timeToLogWarn = timeToLogWarnMs * 1000000l; // convert ms -> ns
}
public Map<String, CallStat> getCallCount() {
@@ -170,18 +160,22 @@
}
/**
- * return time in format acceptable for {@link #add(timeToLogInfo, timeToLogInfo, null)}
- * @return
+ * return time in format acceptable for
+ * {@link #log(long, long, String, String)} method.
+ *
+ * @return the current time in nanoseconds
*/
static public long getTime() {
return System.nanoTime();
}
/**
- * add new trace, stop time is automaticaly computed
+ * add new trace, stop time is automaticaly computed.
*
- * @param startNs time returned by {@link #getTime()} method
+ * @param startNs time returned by {@link #getTime()} method
* @param methodName key name to store this time
+ * @return time used as stop time, this permit to chain many add in same
+ * method to trace time.
*/
public long log(long startNs, String methodName) {
long result = log(startNs, getTime(), methodName, "");
@@ -191,11 +185,11 @@
/**
* add new trace, stop time is automaticaly computed
*
- * @param startNs time returned by {@link #getTime()} method
+ * @param startNs time returned by {@link #getTime()} method
* @param methodName key name to store this time
- * @param msg message to add to log
+ * @param msg message to add to log
* @return time used as stop time, this permit to chain many add in same
- * method to trace time.
+ * method to trace time.
*/
public long log(long startNs, String methodName, String msg) {
long result = log(startNs, getTime(), methodName, msg);
@@ -205,10 +199,10 @@
/**
* add new trace
*
- * @param startNs time returned by {@link #getTime()} method
- * @param stopNs time returned by {@link #getTime()} method
+ * @param startNs time returned by {@link #getTime()} method
+ * @param stopNs time returned by {@link #getTime()} method
* @param methodName key name to store this time
- * @param msg message to add to log
+ * @param msg message to add to log
* @return time used as stop time (stopNs)
*/
public long log(long startNs, long stopNs, String methodName, String msg) {
@@ -227,7 +221,7 @@
// affiche le temps de l'appel si necessaire
String timeString = StringUtil.convertTime(time);
String message = String.format("[%s] for method '%s', %s (%s)",
- timeString, methodName, msg, calls);
+ timeString, methodName, msg, calls);
if (time > timeToLogWarn && timeLog.isWarnEnabled()) {
timeLog.warn(message);
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeTrace.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeTrace.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/TimeTrace.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -58,7 +58,7 @@
@Deprecated
public class TimeTrace {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
private Log log = LogFactory.getLog(TimeTrace.class);
static public class CallStat {
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipStreamEncoder.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipStreamEncoder.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipStreamEncoder.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -41,7 +41,7 @@
*/
public class ZipStreamEncoder extends Thread {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(ZipStreamEncoder.class);
/** The Constant BUFFER. */
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/ConverterUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/ConverterUtil.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/ConverterUtil.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -40,7 +40,7 @@
*/
public class ConverterUtil {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(ConverterUtil.class);
/**
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/EnumConverter.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/EnumConverter.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/EnumConverter.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -49,7 +49,7 @@
*/
public class EnumConverter implements Converter {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static Log log = getLog(EnumConverter.class);
/** valeur par default à utiliser, si pas non trouvée et {@link #useDefault} actif. */
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/FormatConverterFactory.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/FormatConverterFactory.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/FormatConverterFactory.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -43,7 +43,7 @@
* existe sont moins couteuse a convertir.
* Il faut aussi que les converter sache convertir de leur representation vers
* un objet Java.
- * par exemple si on enregistre les converiseurs suivant:
+ * par exemple si on enregistre les convertiseurs suivant:
* <pre>
* addConverter(new MatrixToXMLFormatConverter());
* addConverter(new MatrixToSQLFormatConverter());
@@ -60,7 +60,7 @@
*/
public class FormatConverterFactory { // FormatConverterFactory
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(FormatConverterFactory.class);
static protected FormatConverterFactory instance;
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URIConverter.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URIConverter.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URIConverter.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -26,14 +26,15 @@
package org.nuiton.util.converter;
import org.apache.commons.beanutils.ConversionException;
-import static org.apache.commons.logging.LogFactory.getLog;
-import static org.nuiton.i18n.I18n._;
+import org.apache.commons.beanutils.Converter;
+import org.apache.commons.logging.Log;
import java.net.URI;
import java.net.URISyntaxException;
-import org.apache.commons.beanutils.Converter;
-import org.apache.commons.logging.Log;
+import static org.apache.commons.logging.LogFactory.getLog;
+import static org.nuiton.i18n.I18n._;
+
/**
* classe pour convertir une chaine en un objet URI.
*
@@ -42,7 +43,7 @@
*/
public class URIConverter implements Converter {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static Log log = getLog(URIConverter.class);
@Override
@@ -79,7 +80,7 @@
public URIConverter() {
if (log.isDebugEnabled()) {
- log.debug(this);
+ log.debug("init uri converter " + this);
}
}
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URLConverter.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URLConverter.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/URLConverter.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -26,14 +26,15 @@
package org.nuiton.util.converter;
import org.apache.commons.beanutils.ConversionException;
-import static org.apache.commons.logging.LogFactory.getLog;
-import static org.nuiton.i18n.I18n._;
+import org.apache.commons.beanutils.Converter;
+import org.apache.commons.logging.Log;
import java.net.MalformedURLException;
import java.net.URL;
-import org.apache.commons.beanutils.Converter;
-import org.apache.commons.logging.Log;
+import static org.apache.commons.logging.LogFactory.getLog;
+import static org.nuiton.i18n.I18n._;
+
/**
* classe pour convertir une chaine en un objet URL.
*
@@ -42,7 +43,7 @@
*/
public class URLConverter implements Converter {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static Log log = getLog(URLConverter.class);
@Override
@@ -63,7 +64,7 @@
}
}
throw new ConversionException(
- _("nuitonutil.error.no.convertor", aClass.getName(), value));
+ _("nuitonutil.error.no.convertor", aClass.getName(), value));
}
protected URL valueOf(String value) {
@@ -78,7 +79,9 @@
}
public URLConverter() {
- log.info(this);
+ if (log.isDebugEnabled()) {
+ log.debug("init url converter " + this);
+ }
}
protected boolean isEnabled(Class<?> aClass) {
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/VersionConverter.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/VersionConverter.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/converter/VersionConverter.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -43,12 +43,12 @@
*/
public class VersionConverter implements Converter {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
private static final Log log = LogFactory.getLog(VersionConverter.class);
public VersionConverter() {
if (log.isDebugEnabled()) {
- log.debug(this);
+ log.debug("init version converter " + this);
}
}
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/CallAnalyseTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/CallAnalyseTest.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/CallAnalyseTest.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -45,7 +45,7 @@
public class CallAnalyseTest extends TestCase { // CallAnalyseTest
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(CallAnalyseTest.class);
protected List<List<?>> memoryConsume = new ArrayList<List<?>>();
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/ZipUtilTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/ZipUtilTest.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/ZipUtilTest.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -51,7 +51,7 @@
*/
public class ZipUtilTest {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
private static Log log = LogFactory.getLog(ZipUtilTest.class);
protected static final File DIR = new File(System.getProperty("java.home"),
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/rmi/RmiExporterAndProxyTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/rmi/RmiExporterAndProxyTest.java 2011-05-10 08:12:36 UTC (rev 2136)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/rmi/RmiExporterAndProxyTest.java 2011-05-13 09:07:31 UTC (rev 2137)
@@ -38,7 +38,7 @@
*/
public class RmiExporterAndProxyTest {
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /** Logger. */
static private Log log = LogFactory.getLog(RmiExporterAndProxyTest.class);
@Test(expected = NullPointerException.class)
1
0
10 May '11
Author: echatellier
Date: 2011-05-10 10:12:36 +0200 (Tue, 10 May 2011)
New Revision: 2136
Url: http://nuiton.org/repositories/revision/nuiton-utils/2136
Log:
Fix since
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-05-10 08:06:26 UTC (rev 2135)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-05-10 08:12:36 UTC (rev 2136)
@@ -629,7 +629,7 @@
* Return true is str is a pattern (contains * or ?).
*
* @param str str to test
- * @since 2.3
+ * @since 2.2
*/
static protected boolean isPattern(String str) {
return str.indexOf('*') != -1 || str.indexOf('?') != -1;
@@ -641,7 +641,7 @@
* @param pattern java regex style pattern to find
* @return url list found
* @throws IOException
- * @since 2.3
+ * @since 2.2
*/
static public List<URL> getResources(String pattern) throws IOException {
return getResources(pattern, null);
@@ -654,7 +654,7 @@
* @param classLoader classLoader
* @return url list found
* @throws IOException
- * @since 2.3
+ * @since 2.2
*/
static public List<URL> getResources(String pattern, ClassLoader classLoader) throws IOException {
if (classLoader == null) {
@@ -684,7 +684,7 @@
* @param classLoader
* @return
* @throws IOException
- * @since 2.3
+ * @since 2.2
*/
static protected List<URL> getPatternRessources(String pattern, ClassLoader classLoader) throws IOException {
@@ -733,7 +733,7 @@
*
* @param url url to test
* @return true if url denote a jar file
- * @since 2.3
+ * @since 2.2
*/
public static boolean isJarUrl(URL url) {
String protocol = url.getProtocol();
@@ -754,7 +754,7 @@
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
* @see JarURLConnection
- * @since 2.3
+ * @since 2.2
*/
protected static List<URL> doFindPathMatchingJarResources(URL rootDirResource, String subPattern) throws IOException {
@@ -843,7 +843,7 @@
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
* @see #retrieveMatchingFiles
- * @since 2.3
+ * @since 2.2
*/
protected static List<URL> doFindMatchingFileSystemResources(URL rootDirResource, String subPattern)
throws IOException {
@@ -871,7 +871,7 @@
* relative to the root directory
* @return the Set of matching File instances
* @throws IOException if directory contents could not be retrieved
- * @since 2.3
+ * @since 2.2
*/
protected static List<URL> retrieveMatchingFiles(File rootDir, String pattern) throws IOException {
if (!rootDir.exists()) {
@@ -907,7 +907,7 @@
* @param dir the current directory
* @param result the Set of matching File instances to add to
* @throws IOException if directory contents could not be retrieved
- * @since 2.3
+ * @since 2.2
*/
protected static void doRetrieveMatchingFiles(String fullPattern, File dir, List<URL> result) throws IOException {
if (log.isDebugEnabled()) {
1
0
r2135 - in trunk/nuiton-utils/src: main/java/org/nuiton/util test/java/org/nuiton/util
by echatellier@users.nuiton.org 10 May '11
by echatellier@users.nuiton.org 10 May '11
10 May '11
Author: echatellier
Date: 2011-05-10 10:06:26 +0200 (Tue, 10 May 2011)
New Revision: 2135
Url: http://nuiton.org/repositories/revision/nuiton-utils/2135
Log:
#1316: find pattern resources in ClassLoader instead of URLClassLoader
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/ResourceTest.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-05-04 14:17:42 UTC (rev 2134)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-05-10 08:06:26 UTC (rev 2135)
@@ -25,30 +25,36 @@
package org.nuiton.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import static org.nuiton.i18n.I18n._;
-import javax.swing.ImageIcon;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.lang.String;
import java.lang.reflect.Method;
+import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.net.URLConnection;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
import java.util.List;
import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
+import javax.swing.ImageIcon;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* Cette class permet de rechercher un fichier en indiquant son nom avec son
* chemin. Cette librairie ira ensuite chercher ce fichier sur le système de
@@ -618,4 +624,323 @@
}
return false;
}
+
+ /**
+ * Return true is str is a pattern (contains * or ?).
+ *
+ * @param str str to test
+ * @since 2.3
+ */
+ static protected boolean isPattern(String str) {
+ return str.indexOf('*') != -1 || str.indexOf('?') != -1;
+ }
+
+ /**
+ * Find pattern resouces in {@link ClassLoader#getSystemClassLoader()}.
+ *
+ * @param pattern java regex style pattern to find
+ * @return url list found
+ * @throws IOException
+ * @since 2.3
+ */
+ static public List<URL> getResources(String pattern) throws IOException {
+ return getResources(pattern, null);
+ }
+
+ /**
+ * Find pattern resouces in classloader.
+ *
+ * @param pattern java regex style pattern to find
+ * @param classLoader classLoader
+ * @return url list found
+ * @throws IOException
+ * @since 2.3
+ */
+ static public List<URL> getResources(String pattern, ClassLoader classLoader) throws IOException {
+ if (classLoader == null) {
+ classLoader = ClassLoader.getSystemClassLoader();
+ }
+
+ List<URL> urlList = null;
+
+ if (isPattern(pattern)) {
+ urlList = getPatternRessources(pattern, classLoader);
+ }
+ else {
+ urlList = new HashList<URL>();
+ Enumeration<URL> resourceUrls = classLoader.getResources(pattern);
+ while (resourceUrls.hasMoreElements()) {
+ URL url = resourceUrls.nextElement();
+ urlList.add(url);
+ }
+ }
+
+ return urlList;
+ }
+
+ /**
+ *
+ * @param pattern
+ * @param classLoader
+ * @return
+ * @throws IOException
+ * @since 2.3
+ */
+ static protected List<URL> getPatternRessources(String pattern, ClassLoader classLoader) throws IOException {
+
+ List<URL> urlList = new HashList<URL>();
+
+ // get root directory to get URL in classpath
+ // for example :
+ // /WEB-INF/*.xml -> /WEB-INF/
+ // /META-INF/persistence/*.xml -> /META-INF/persistence/
+ int prefixEnd = pattern.indexOf(":") + 1;
+ int rootDirEnd = pattern.length();
+ while (rootDirEnd > prefixEnd && isPattern(pattern.substring(prefixEnd, rootDirEnd))) {
+ rootDirEnd = pattern.lastIndexOf('/', rootDirEnd - 2) + 1;
+ }
+ if (rootDirEnd == 0) {
+ rootDirEnd = prefixEnd;
+ }
+ String rootDirPath = pattern.substring(0, rootDirEnd);
+ String subPattern = pattern.substring(rootDirPath.length());
+
+ Enumeration<URL> rootDirResources = classLoader.getResources(rootDirPath);
+
+ while (rootDirResources.hasMoreElements()) {
+ URL rootDirResource = rootDirResources.nextElement();
+
+ if (isJarUrl(rootDirResource)) {
+ // cas ou le ichier du classLoader est un fichier jar
+ if (log.isDebugEnabled()) {
+ log.debug("jar to search " + rootDirResource);
+ }
+ urlList.addAll(doFindPathMatchingJarResources(rootDirResource, subPattern));
+ }
+ else {
+ urlList.addAll(doFindMatchingFileSystemResources(rootDirResource, subPattern));
+ }
+ }
+
+ return urlList;
+ }
+
+ /**
+ * Test if an url detnoe a jar file.
+ *
+ * Code taken from spring source code :
+ * org.springframework.core.io.support.PathMatchingResourcePatternResolver
+ *
+ * @param url url to test
+ * @return true if url denote a jar file
+ * @since 2.3
+ */
+ public static boolean isJarUrl(URL url) {
+ String protocol = url.getProtocol();
+ return "jar".equals(protocol) ||
+ "zip".equals(protocol) ||
+ "wsjar".equals(protocol);
+ }
+
+ /**
+ * Find all resources in jar files that match the given location pattern
+ * via the Java Regex style Matcher.
+ *
+ * Code taken from spring source code :
+ * org.springframework.core.io.support.PathMatchingResourcePatternResolver
+ *
+ * @param rootDirResource the root directory as Resource
+ * @param subPattern the sub pattern to match (below the root directory)
+ * @return the Set of matching Resource instances
+ * @throws IOException in case of I/O errors
+ * @see JarURLConnection
+ * @since 2.3
+ */
+ protected static List<URL> doFindPathMatchingJarResources(URL rootDirResource, String subPattern) throws IOException {
+
+ URLConnection con = rootDirResource.openConnection();
+ JarFile jarFile;
+ String jarFileUrl;
+ String rootEntryPath;
+ boolean newJarFile = false;
+
+ if (con instanceof JarURLConnection) {
+ // Should usually be the case for traditional JAR files.
+ JarURLConnection jarCon = (JarURLConnection) con;
+ jarCon.setUseCaches(false);
+ jarFile = jarCon.getJarFile();
+ jarFileUrl = jarCon.getJarFileURL().toExternalForm();
+ JarEntry jarEntry = jarCon.getJarEntry();
+ rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
+ }
+ else {
+ // No JarURLConnection -> need to resort to URL file parsing.
+ // We'll assume URLs of the format "jar:path!/entry", with the protocol
+ // being arbitrary as long as following the entry format.
+ // We'll also handle paths with and without leading "file:" prefix.
+ String urlFile = rootDirResource.getFile();
+ int separatorIndex = urlFile.indexOf("!/");
+ if (separatorIndex != -1) {
+ jarFileUrl = urlFile.substring(0, separatorIndex);
+ rootEntryPath = urlFile.substring(separatorIndex + "!/".length());
+ //jarFile = getJarFile(jarFileUrl);
+ if (jarFileUrl.startsWith("file:")) {
+ jarFile = new JarFile(jarFileUrl.substring("file:".length()));
+ }
+ else {
+ jarFile = new JarFile(jarFileUrl);
+ }
+ }
+ else {
+ jarFile = new JarFile(urlFile);
+ jarFileUrl = urlFile;
+ rootEntryPath = "";
+ }
+ newJarFile = true;
+ }
+
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("Looking for matching resources in jar file [" + jarFileUrl + "]");
+ }
+ if (!"".equals(rootEntryPath) && !rootEntryPath.endsWith("/")) {
+ // Root entry path must end with slash to allow for proper matching.
+ // The Sun JRE does not return a slash here, but BEA JRockit does.
+ rootEntryPath = rootEntryPath + "/";
+ }
+ List<URL> result = new HashList<URL>(8);
+ for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) {
+ JarEntry entry = (JarEntry) entries.nextElement();
+ String entryPath = entry.getName();
+ if (entryPath.startsWith(rootEntryPath)) {
+ String relativePath = entryPath.substring(rootEntryPath.length());
+ if (relativePath.matches(subPattern)) {
+ URL entryURL = new URL(rootDirResource, relativePath);
+ result.add(entryURL);
+ }
+ }
+ }
+ return result;
+ }
+ finally {
+ // Close jar file, but only if freshly obtained -
+ // not from JarURLConnection, which might cache the file reference.
+ if (newJarFile) {
+ jarFile.close();
+ }
+ }
+ }
+
+ /**
+ * Find all resources in the file system that match the given location pattern
+ * via the Java style matcher.
+ *
+ * Code taken from spring source code :
+ * org.springframework.core.io.support.PathMatchingResourcePatternResolver
+ *
+ * @param rootDirResource the root directory as Resource
+ * @param subPattern the sub pattern to match (below the root directory)
+ * @return the Set of matching Resource instances
+ * @throws IOException in case of I/O errors
+ * @see #retrieveMatchingFiles
+ * @since 2.3
+ */
+ protected static List<URL> doFindMatchingFileSystemResources(URL rootDirResource, String subPattern)
+ throws IOException {
+
+ File rootDir;
+ try {
+ rootDir = new File(rootDirResource.toURI().getSchemeSpecificPart());
+ rootDir = rootDir.getAbsoluteFile();
+ }
+ catch (URISyntaxException ex) {
+ return Collections.emptyList();
+ }
+ return retrieveMatchingFiles(rootDir, subPattern);
+ }
+
+ /**
+ * Retrieve files that match the given path pattern,
+ * checking the given directory and its subdirectories.
+ *
+ * Code taken from spring source code :
+ * org.springframework.core.io.support.PathMatchingResourcePatternResolver
+ *
+ * @param rootDir the directory to start from
+ * @param pattern the pattern to match against,
+ * relative to the root directory
+ * @return the Set of matching File instances
+ * @throws IOException if directory contents could not be retrieved
+ * @since 2.3
+ */
+ protected static List<URL> retrieveMatchingFiles(File rootDir, String pattern) throws IOException {
+ if (!rootDir.exists()) {
+ return Collections.emptyList();
+ }
+ if (!rootDir.isDirectory()) {
+ return Collections.emptyList();
+ }
+ if (!rootDir.canRead()) {
+ return Collections.emptyList();
+ }
+ //String fullPattern = StringUtils.replace(rootDir.getAbsolutePath(), File.separator, "/");
+ String fullPattern = rootDir.getAbsolutePath().replace(File.separator, "/");
+ if (!pattern.startsWith("/")) {
+ fullPattern += "/";
+ }
+ //fullPattern = fullPattern + StringUtils.replace(pattern, File.separator, "/");
+ fullPattern = fullPattern + pattern.replace(File.separator, "/");
+ List<URL> result = new HashList<URL>(8);
+ doRetrieveMatchingFiles(fullPattern, rootDir, result);
+ return result;
+ }
+
+ /**
+ * Recursively retrieve files that match the given pattern,
+ * adding them to the given result list.
+ *
+ * Code taken from spring source code :
+ * org.springframework.core.io.support.PathMatchingResourcePatternResolver
+ *
+ * @param fullPattern the pattern to match against,
+ * with preprended root directory path
+ * @param dir the current directory
+ * @param result the Set of matching File instances to add to
+ * @throws IOException if directory contents could not be retrieved
+ * @since 2.3
+ */
+ protected static void doRetrieveMatchingFiles(String fullPattern, File dir, List<URL> result) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("Searching directory [" + dir.getAbsolutePath() +
+ "] for files matching pattern [" + fullPattern + "]");
+ }
+ File[] dirContents = dir.listFiles();
+ if (dirContents == null) {
+ if (log.isWarnEnabled()) {
+ log.warn("Could not retrieve contents of directory [" + dir.getAbsolutePath() + "]");
+ }
+ return;
+ }
+ for (File content : dirContents) {
+ //String currPath = StringUtils.replace(content.getAbsolutePath(), File.separator, "/");
+ String currPath = content.getAbsolutePath().replace(File.separator, "/");
+ //if (content.isDirectory() && getPathMatcher().matchStart(fullPattern, currPath + "/")) {
+ if (content.isDirectory() && (currPath + "/").matches(fullPattern + ".*")) {
+ if (!content.canRead()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Skipping subdirectory [" + dir.getAbsolutePath() +
+ "] because the application is not allowed to read the directory");
+ }
+ }
+ else {
+ doRetrieveMatchingFiles(fullPattern, content, result);
+ }
+ }
+ //if (getPathMatcher().match(fullPattern, currPath)) {
+ if (currPath.matches(fullPattern)) {
+ result.add(content.toURI().toURL());
+ }
+ }
+ }
+
} // Resource
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/ResourceTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/ResourceTest.java 2011-05-04 14:17:42 UTC (rev 2134)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/ResourceTest.java 2011-05-10 08:06:26 UTC (rev 2135)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2004 - 2010 CodeLutin
+ * Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -23,19 +23,6 @@
* #L%
*/
-/* *
-* ResourceTest.java
-*
-* Created: Jul 29, 2004
-*
-* @author Benjamin Poussin <poussin(a)codelutin.com>
-* Copyright Code Lutin
-* @version $Revision$
-*
-* Mise a jour: $Date$
-* par : $Author$
-*/
-
package org.nuiton.util;
import java.io.File;
@@ -45,9 +32,17 @@
import java.util.List;
import org.junit.Assert;
-
import org.junit.Test;
+/**
+ * Test class for {@link Resource}.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
public class ResourceTest { // ResourceTest
@Test
@@ -132,6 +127,58 @@
Assert.assertFalse(Resource.isZip(""));
Assert.assertFalse(Resource.isZip(null));
}
+
+ @Test
+ public void testIsPattern() {
+ Assert.assertTrue(Resource.isPattern(".*.zip"));
+ Assert.assertTrue(Resource.isPattern(".?.zip"));
+ Assert.assertFalse(Resource.isPattern("toto.zip"));
+ }
+ /**
+ * Test de recherche de resource dans le classpath (jar).
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetResourcesJarClassPath() throws Exception {
+ // ce test peut echoué a chaque changement dans les dépendances
+ List<URL> urlsPattern = Resource.getResources("org/nuiton/util/Version.*Test\\.class");
+ List<URL> urlsClass1 = Resource.getResources("org/nuiton/util/VersionTest.class");
+ List<URL> urlsClass2 = Resource.getResources("org/nuiton/util/VersionUtilTest.class");
+ Assert.assertEquals(2, urlsPattern.size());
+ Assert.assertEquals(urlsPattern.size(), urlsClass1.size() + urlsClass2.size());
+
+ // test sans dossier de recherche (directement un pattern)
+ List<URL> urlsAllPattern = Resource.getResources("log4j\\..*");
+ Assert.assertEquals(1, urlsAllPattern.size());
+ }
+
+ /**
+ * Test de recherche de resource dans le classpath (dossier hors jar).
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetResourcesFileSystemClassPath() throws Exception {
+ List<URL> urls = Resource.getResources("META-INF/services/.*apache.*");
+ // i18n, resources, test resources
+ Assert.assertEquals(3, urls.size());
+ }
+
+ /**
+ * Test de recherche de resource dans le classpath (dossier hors jar) en
+ * utiliant le classloader de test.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetTestResourcesClassPath() throws Exception {
+ List<URL> urls = Resource.getResources("org/nuiton/util/.*\\.txt");
+ Assert.assertEquals(1, urls.size());
+
+ urls = Resource.getResources("org/nuiton/util/.*\\.txt", ResourceTest.class.getClassLoader());
+ Assert.assertEquals(1, urls.size());
+ }
+
} // ResourceTest
-
1
0
r2134 - in trunk: . nuiton-utils/src/main/resources/i18n nuiton-validator/src/main/resources/i18n
by fdesbois@users.nuiton.org 04 May '11
by fdesbois@users.nuiton.org 04 May '11
04 May '11
Author: fdesbois
Date: 2011-05-04 16:17:42 +0200 (Wed, 04 May 2011)
New Revision: 2134
Url: http://nuiton.org/repositories/revision/nuiton-utils/2134
Log:
Use I18n 2.4 snapshot, resources file becomes UTF-8
Modified:
trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_es_ES.properties
trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_fr_FR.properties
trunk/nuiton-validator/src/main/resources/i18n/nuiton-validator_es_ES.properties
trunk/pom.xml
Modified: trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_es_ES.properties
===================================================================
--- trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_es_ES.properties 2011-04-28 14:40:42 UTC (rev 2133)
+++ trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_es_ES.properties 2011-05-04 14:17:42 UTC (rev 2134)
@@ -1,9 +1,9 @@
-nuitonutil.config.moving.conf=Colocar el fichero de configuraci\u00F3n de %s hacia %s
-nuitonutil.debug.objectutil.create=Probar la creaci\u00F3n %s con %s
-nuitonutil.debug.objectutil.instantiate=No se puede instanciar %s con los par\u00E1metros %s
-nuitonutil.debug.objectutil.invoke=Invocaci\u00F3n %s con %s
-nuitonutil.error.add.url.in.classloader=Imposible adjuntar la URL en el classloader %s por la siguiente raz\u00F3n \: %s
-nuitonutil.error.applicationconfig.save=Imposible guardar le fichero de configuraci\u00F3n en %s
+nuitonutil.config.moving.conf=Colocar el fichero de configuración de %s hacia %s
+nuitonutil.debug.objectutil.create=Probar la creación %s con %s
+nuitonutil.debug.objectutil.instantiate=No se puede instanciar %s con los parámetros %s
+nuitonutil.debug.objectutil.invoke=Invocación %s con %s
+nuitonutil.error.add.url.in.classloader=Imposible adjuntar la URL en el classloader %s por la siguiente razón \: %s
+nuitonutil.error.applicationconfig.save=Imposible guardar le fichero de configuración en %s
nuitonutil.error.cant.instanciate.class=
nuitonutil.error.class.with.more.than.one.constructor=
nuitonutil.error.convert.file.to.url=El archivo '%1$s' no puede ser convertido en URL debido a \: %2$S
@@ -12,16 +12,16 @@
nuitonutil.error.could.not.find.MD5=No se ha encontrado el algoritmo MD5\!
nuitonutil.error.could.not.removePCL=No se ha eliminado la PropertychangeListener %1$s en el objeto %2$s debido a \: %3$s
nuitonutil.error.get.url.from.zip=Eror al leer el archivo comprimido %1$s \: %2$s
-nuitonutil.error.no.convertor=Ning\u00FAn convertidor encontrado para el tipo %2$s y el objeto '%1$s'
-nuitonutil.error.not.an.enum=El tipo %1$s no es una enumeraci\u00F3n de java
-nuitonutil.error.null.parameter=El par\u00E1metro '%1$s' es nulo\!
+nuitonutil.error.no.convertor=Ningún convertidor encontrado para el tipo %2$s y el objeto '%1$s'
+nuitonutil.error.not.an.enum=El tipo %1$s no es una enumeración de java
+nuitonutil.error.null.parameter=El parámetro '%1$s' es nulo\!
nuitonutil.error.resource.not.found=Imposible encontrar el recurso \: %s
nuitonutil.error.unfound.assignable.argument=
nuitonutil.error.unfound.month=No se encuentra el mes a partir de '%s', use el mes por defecto '%s'
nuitonutil.error.unknown.url.type=No se puede tratar el tipo desconocido de URL %1$s
-nuitonutil.error.url.convertor=Problema encontrado en la converci\u00F3n de la URL de '%s' con el convertidor %s debido a \: %s
+nuitonutil.error.url.convertor=Problema encontrado en la converción de la URL de '%s' con el convertidor %s debido a \: %s
nuitonutil.error.version.convertor=No se puede convertir el valor %%1$s con el conversor %2$s debido a \: %3$s
-nuitonutil.error.version.pattern=Patr\u00F3n de versi\u00F3n no conocido por %1$s
+nuitonutil.error.version.pattern=Patrón de versión no conocido por %1$s
nuitonutil.fileCompletion.cancel=.. para anular o regresar al directorio anterior
nuitonutil.fileCompletion.enter=Introducir para mostar la lista de archivos, o completar la ruta
nuitonutil.fileCompletion.exit=Pulsar "\!q" para salir
Modified: trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_fr_FR.properties
===================================================================
--- trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_fr_FR.properties 2011-04-28 14:40:42 UTC (rev 2133)
+++ trunk/nuiton-utils/src/main/resources/i18n/nuiton-utils_fr_FR.properties 2011-05-04 14:17:42 UTC (rev 2134)
@@ -1,35 +1,35 @@
-nuitonutil.config.moving.conf=D\u00E9placement du fichier de configuration depuis %s vers %s
-nuitonutil.debug.objectutil.create=Essaye de cr\u00E9er %s avec %s
-nuitonutil.debug.objectutil.instantiate=Ne peut pas instancier %s avec les param\u00EAtres %s
+nuitonutil.config.moving.conf=Déplacement du fichier de configuration depuis %s vers %s
+nuitonutil.debug.objectutil.create=Essaye de créer %s avec %s
+nuitonutil.debug.objectutil.instantiate=Ne peut pas instancier %s avec les paramêtres %s
nuitonutil.debug.objectutil.invoke=Invocation de %s avec %s
nuitonutil.error.add.url.in.classloader=Impossible d'ajouter une url dans le classloader %s pour la raison \: %s
nuitonutil.error.applicationconfig.save=Impossible de sauvegarder le fichier de configuration dans %s
-nuitonutil.error.cant.instanciate.class=La Classe %s n'a pas pu \u00EAtre instanci\u00E9e avec %s
+nuitonutil.error.cant.instanciate.class=La Classe %s n'a pas pu être instanciée avec %s
nuitonutil.error.class.with.more.than.one.constructor=Votre classe %s a plus d'un constructeur
-nuitonutil.error.convert.file.to.url=Le fichier '%1$s' n'a pas pu \u00EAtre converti en URL pour la raison suivante \: %2$S
-nuitonutil.error.convertor.noValue=Aucune valeur \u00E0 convertir pour le convertisseur %s
-nuitonutil.error.could.not.addPCL=N'a pas pu ajout\u00E9 le PropertychangeListener %1$s sur l'objet %2$s pour la raison suivante \: %3$s
-nuitonutil.error.could.not.find.MD5=L'algorithme MD5 n'a pas \u00E9t\u00E9 trouv\u00E9\!
-nuitonutil.error.could.not.removePCL=N'a pas pu enlev\u00E9 le PropertychangeListener %1$s sur l'objet %2$s pour la raison suivante \: %3$s
-nuitonutil.error.get.url.from.zip=Erreur lors de la lecture du fichier compress\u00E9 %1$s \: %2$s
-nuitonutil.error.no.convertor=Aucun convertisseur trouv\u00E9 pour le type %2$s et l''objet '%1$s'
+nuitonutil.error.convert.file.to.url=Le fichier '%1$s' n'a pas pu être converti en URL pour la raison suivante \: %2$S
+nuitonutil.error.convertor.noValue=Aucune valeur à convertir pour le convertisseur %s
+nuitonutil.error.could.not.addPCL=N'a pas pu ajouté le PropertychangeListener %1$s sur l'objet %2$s pour la raison suivante \: %3$s
+nuitonutil.error.could.not.find.MD5=L'algorithme MD5 n'a pas été trouvé\!
+nuitonutil.error.could.not.removePCL=N'a pas pu enlevé le PropertychangeListener %1$s sur l'objet %2$s pour la raison suivante \: %3$s
+nuitonutil.error.get.url.from.zip=Erreur lors de la lecture du fichier compressé %1$s \: %2$s
+nuitonutil.error.no.convertor=Aucun convertisseur trouvé pour le type %2$s et l''objet '%1$s'
nuitonutil.error.not.an.enum=Le type %1$s n'est pas une enumeration java
-nuitonutil.error.null.parameter=Le param\u00E8tre '%1$s' est null\!
+nuitonutil.error.null.parameter=Le paramètre '%1$s' est null\!
nuitonutil.error.resource.not.found=Impossible de trouver la ressource \: %s
nuitonutil.error.unfound.assignable.argument=N'a pas pu trouver un argument assignable pour %s dans %s
-nuitonutil.error.unfound.month=n'a pas pu trouv\u00E9 le mois \u00E0 partir de '%s', utilise le mois par d\u00E9faut '%s'
+nuitonutil.error.unfound.month=n'a pas pu trouvé le mois à partir de '%s', utilise le mois par défaut '%s'
nuitonutil.error.unknown.url.type=could not treate unknown type of url %1$s
-nuitonutil.error.url.convertor=Un probl\u00E8me est apparu lors de la convertion en url de '%s' avec le convertisseur %s pour la raison suivante \: %s
+nuitonutil.error.url.convertor=Un problème est apparu lors de la convertion en url de '%s' avec le convertisseur %s pour la raison suivante \: %s
nuitonutil.error.version.convertor=N'a pas pu convertir la valeur %1$s avec le converter %2$s pour la raison suivante \: %3$s
nuitonutil.error.version.pattern=Pattern de version non connu pour %1$s
-nuitonutil.fileCompletion.cancel=.. pour annuler ou pour revenir au repertoire pr\u00E9c\u00E9dent
-nuitonutil.fileCompletion.enter=Entrer pour afficher la liste des fichiers, ou pour compl\u00E9ter le chemin
+nuitonutil.fileCompletion.cancel=.. pour annuler ou pour revenir au repertoire précédent
+nuitonutil.fileCompletion.enter=Entrer pour afficher la liste des fichiers, ou pour compléter le chemin
nuitonutil.fileCompletion.exit=Saisir "\!q" pour quitter
nuitonutil.fileCompletion.save=Saisir "\!s" a la fin du nom de fichier pour l'enregistrer
nuitonutil.month.april=avril
-nuitonutil.month.august=ao\u00FBt
-nuitonutil.month.december=d\u00E9cembre
-nuitonutil.month.february=f\u00E9vrier
+nuitonutil.month.august=août
+nuitonutil.month.december=décembre
+nuitonutil.month.february=février
nuitonutil.month.january=janvier
nuitonutil.month.july=juillet
nuitonutil.month.june=juin
Modified: trunk/nuiton-validator/src/main/resources/i18n/nuiton-validator_es_ES.properties
===================================================================
--- trunk/nuiton-validator/src/main/resources/i18n/nuiton-validator_es_ES.properties 2011-04-28 14:40:42 UTC (rev 2133)
+++ trunk/nuiton-validator/src/main/resources/i18n/nuiton-validator_es_ES.properties 2011-05-04 14:17:42 UTC (rev 2134)
@@ -1,4 +1,4 @@
validator.scope.error.label=Error
validator.scope.fatal.label=Fatal Error
-validator.scope.info.label=Informaci\u00f3n
+validator.scope.info.label=Información
validator.scope.warning.label=Advertencias
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-04-28 14:40:42 UTC (rev 2133)
+++ trunk/pom.xml 2011-05-04 14:17:42 UTC (rev 2134)
@@ -183,7 +183,7 @@
<projectId>nuiton-utils</projectId>
- <nuitonI18nVersion>2.3.2</nuitonI18nVersion>
+ <nuitonI18nVersion>2.4-SNAPSHOT</nuitonI18nVersion>
<aspectwerkzVersion>2.0</aspectwerkzVersion>
<xworkVersion>2.2.1.1</xworkVersion>
1
0