Index: lutinutil/src/java/org/codelutin/util/ArgumentsParser.java diff -u lutinutil/src/java/org/codelutin/util/ArgumentsParser.java:1.6 lutinutil/src/java/org/codelutin/util/ArgumentsParser.java:1.7 --- lutinutil/src/java/org/codelutin/util/ArgumentsParser.java:1.6 Wed Dec 27 15:56:44 2006 +++ lutinutil/src/java/org/codelutin/util/ArgumentsParser.java Wed Apr 25 13:42:43 2007 @@ -24,9 +24,9 @@ * Created: 22 août 2003 * * @author Benjamin Poussin -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ * -* Mise a jour: $Date: 2006/12/27 15:56:44 $ +* Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -35,7 +35,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; /** * Parser d'option de la ligne de commande. @@ -43,6 +42,7 @@ * et mettre des methodes pour récupérer directement ce type. */ public class ArgumentsParser extends java.lang.Object { + /** La liste des arguments qui ne sont pas des options */ protected ArrayList arguments = new ArrayList(); /** le nom à afficher pour l'usage */ Index: lutinutil/src/java/org/codelutin/util/ArrayUtil.java diff -u lutinutil/src/java/org/codelutin/util/ArrayUtil.java:1.7 lutinutil/src/java/org/codelutin/util/ArrayUtil.java:1.8 --- lutinutil/src/java/org/codelutin/util/ArrayUtil.java:1.7 Fri Jan 13 16:54:17 2006 +++ lutinutil/src/java/org/codelutin/util/ArrayUtil.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * Created: 31 oct. 2004 * * @author Benjamin Poussin - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * - * Mise a jour: $Date: 2006/01/13 16:54:17 $ + * Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -42,15 +42,15 @@ * Permet de convertir un tableau en une liste, le type primitif * est encapsulé dans un objet. */ - static public List asList(double [] a){ - ArrayList result = new ArrayList(a.length); + static public List asList(double [] a){ + ArrayList result = new ArrayList(a.length); for(int i=0; i List asList(T [] a){ return Arrays.asList(a); } @@ -58,8 +58,8 @@ * Permet de convertir un tableau en une liste, le type primitif * est encapsulé dans un objet. */ - static public List asList(int [] a){ - ArrayList result = new ArrayList(a.length); + static public List asList(int [] a){ + ArrayList result = new ArrayList(a.length); for(int i=0; i clazz = null; int length = 0; for(Object[] tab:tabs){ if(tab != null){ length += tab.length; - Class tmp = tab.getClass().getComponentType(); + Class tmp = tab.getClass().getComponentType(); if(clazz == null){ clazz = tmp; } else if(tmp.isAssignableFrom(clazz)){ @@ -156,7 +156,8 @@ * @param elems les elemements a ajouter * @return un nouveau tableau contenant a la fin les elements souhaites */ - static public E [] concatElems(E [] tab, E ... elems) { + @SuppressWarnings("unchecked") + static public E [] concatElems(E [] tab, F ... elems) { E [] result = (E[])concat(tab, elems); return result; } Index: lutinutil/src/java/org/codelutin/util/BoundedList.java diff -u lutinutil/src/java/org/codelutin/util/BoundedList.java:1.2 lutinutil/src/java/org/codelutin/util/BoundedList.java:1.3 --- lutinutil/src/java/org/codelutin/util/BoundedList.java:1.2 Wed Jan 4 13:26:32 2006 +++ lutinutil/src/java/org/codelutin/util/BoundedList.java Wed Apr 25 13:42:43 2007 @@ -24,7 +24,7 @@ * Created: 30 mai 2005 * * @author Arnaud Thimel -* @version $Revision: 1.2 $ +* @version $Revision: 1.3 $ */ @@ -36,7 +36,7 @@ /** * ArrayList with minimum and maximum sizes. For each operation, the size is checked and the BoundedList to ensure that it is kept in the range. */ -public class BoundedList extends ArrayList { +public class BoundedList extends ArrayList { /** */ private static final long serialVersionUID = -3211387041114409849L; @@ -79,7 +79,7 @@ * Creates a new BoundedList with the specified collection of elements. The min size is set to 0 and the max size to the infinite. * @param arg0 */ - public BoundedList(Collection arg0) { + public BoundedList(Collection arg0) { super(arg0); } @@ -100,7 +100,8 @@ * Appends the specified element to the end of this list. * @param o the Object to be added */ - public boolean add(Object o) { + @Override + public boolean add(E o) { if (checkNewSize(1)) return super.add(o); else @@ -112,7 +113,8 @@ * @param index the position where to add the Object * @param o the Object to be added */ - public void add(int index, Object o) { + @Override + public void add(int index, E o) { if (checkNewSize(1)) super.add(index, o); else @@ -123,7 +125,8 @@ * Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. * @param c the collection of Objects to be added */ - public boolean addAll(Collection c) { + @Override + public boolean addAll(Collection c) { if (checkNewSize(c.size())) return super.addAll(c); else @@ -135,7 +138,8 @@ * @param index the index where to start adding the collection of objects * @param c the collection of Objects to be added */ - public boolean addAll(int index, Collection c) { + @Override + public boolean addAll(int index, Collection c) { if (checkNewSize(c.size())) return super.addAll(index, c); else @@ -145,8 +149,10 @@ /** * Returns a shallow copy of this BoundedList instance */ + @SuppressWarnings("unchecked") + @Override public Object clone() { - BoundedList bL = (BoundedList)super.clone(); + BoundedList bL = (BoundedList)super.clone(); bL.minSize = minSize; bL.maxSize = maxSize; return bL; @@ -163,7 +169,8 @@ * Removes the element at the specified position in this list. * @param index the position of the element to be removed */ - public Object remove(int index) { + @Override + public E remove(int index) { if (checkNewSize(-1)) return super.remove(index); else @@ -175,6 +182,7 @@ * @param fromIndex index of first element to be removed * @param toIndex index after last element to be removed */ + @Override protected void removeRange(int fromIndex, int toIndex) { if (checkNewSize(-(toIndex - fromIndex))) super.removeRange(fromIndex, toIndex); @@ -185,6 +193,7 @@ /** * Removes a single instance of the specified element from this list, if it is present (optional operation). */ + @Override public boolean remove(Object o) { if (checkNewSize(-1) || !contains(o)) return super.remove(o); @@ -195,7 +204,8 @@ /** * Removes from this collection all of its elements that are contained in the specified collection (optional operation). */ - public boolean removeAll(Collection c) { + @Override + public boolean removeAll(Collection c) { //On ne sait pas si les éléments de la Collection sont contenus dans la liste. //De plus, on ne sait pas si les instances sont présentes un ou plusieurs fois (Si elles y sont +sieurs fois elles sont supprimées +sieurs fois) if (checkNewSize(-c.size())) @@ -216,6 +226,7 @@ return new BoundedListOutOfBoundsException(msg); } + @Override public String toString() { return /*"(" + minSize + ", " + maxSize + ") " +*/ super.toString(); } Index: lutinutil/src/java/org/codelutin/util/CategorisedListenerSet.java diff -u lutinutil/src/java/org/codelutin/util/CategorisedListenerSet.java:1.9 lutinutil/src/java/org/codelutin/util/CategorisedListenerSet.java:1.10 --- lutinutil/src/java/org/codelutin/util/CategorisedListenerSet.java:1.9 Mon Sep 18 10:02:09 2006 +++ lutinutil/src/java/org/codelutin/util/CategorisedListenerSet.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ * - * Mise a jour: $Date: 2006/09/18 10:02:09 $ + * Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -37,7 +37,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.log.LutinLogFactory; /** * Objet permettant de géré plusieurs liste de listener de facon simple. Index: lutinutil/src/java/org/codelutin/util/FileUtil.java diff -u lutinutil/src/java/org/codelutin/util/FileUtil.java:1.18 lutinutil/src/java/org/codelutin/util/FileUtil.java:1.19 --- lutinutil/src/java/org/codelutin/util/FileUtil.java:1.18 Thu Feb 8 11:47:23 2007 +++ lutinutil/src/java/org/codelutin/util/FileUtil.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * Created: 22 nov. 2004 * * @author Benjamin Poussin - * @version $Revision: 1.18 $ + * @version $Revision: 1.19 $ * - * Mise a jour: $Date: 2007/02/08 11:47:23 $ + * Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -251,6 +251,7 @@ static public BufferedReader getReader(File file, String encoding) throws IOException { FileInputStream inf = new FileInputStream(file); InputStreamReader in = new InputStreamReader(inf, encoding); +// FileReader in = new FileReader(file); BufferedReader result = new BufferedReader(in); return result; } @@ -278,10 +279,14 @@ static public BufferedWriter getWriter(File file, String encoding) throws IOException { FileOutputStream outf = new FileOutputStream(file); OutputStreamWriter out = new OutputStreamWriter(outf, encoding); +// FileWriter out = new FileWriter(file); BufferedWriter result = new BufferedWriter(out); return result; } + public static void main(String[] args) { + + } /** * Permet de creer un nouveu repertoire temporaire, l'effacement du Index: lutinutil/src/java/org/codelutin/util/FormatMap.java diff -u lutinutil/src/java/org/codelutin/util/FormatMap.java:1.3 lutinutil/src/java/org/codelutin/util/FormatMap.java:1.4 --- lutinutil/src/java/org/codelutin/util/FormatMap.java:1.3 Wed Jan 4 13:26:32 2006 +++ lutinutil/src/java/org/codelutin/util/FormatMap.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * Created: 16 septembre 2005 10:41:58 CEST * * @author Benjamin POUSSIN - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Last update: $Date: 2006/01/04 13:26:32 $ + * Last update: $Date: 2007/04/25 13:42:43 $ * by : $Author: bpoussin $ */ @@ -156,7 +156,7 @@ public Object unconvert(FormatConverterFactory factory, Format format, Object ... args){ Object result = null; - Map values = this; + Map values = this; if (!values.containsKey(format) && !values.containsKey(FormatConverter.FORMAT_JAVA)) { throw new IllegalArgumentException("Aucun valeur disponible"); Index: lutinutil/src/java/org/codelutin/util/HashList.java diff -u lutinutil/src/java/org/codelutin/util/HashList.java:1.2 lutinutil/src/java/org/codelutin/util/HashList.java:1.3 --- lutinutil/src/java/org/codelutin/util/HashList.java:1.2 Wed Jan 4 13:26:32 2006 +++ lutinutil/src/java/org/codelutin/util/HashList.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * Created: 2 nov. 2004 * * @author Benjamin Poussin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2006/01/04 13:26:32 $ + * Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -48,34 +48,37 @@ * garantie. Il faut donc surcharger readObject et writeObject pour conserver * le HashSet */ -public class HashList extends ArrayList { // HashList +public class HashList extends ArrayList { // HashList /** */ private static final long serialVersionUID = -334941610313293930L; - protected HashSet set = new HashSet(); + protected HashSet set = new HashSet(); public HashList(){ super(); } - public HashList(Collection c){ + public HashList(Collection c){ addAll(c); } public HashList(int initialCapacity){ super(initialCapacity); } - public Object set(int index, Object element) { + @Override + public E set(int index, E element) { throw new UnsupportedOperationException("You can't use set method in HashList"); } - public boolean add(Object o) { + @Override + public boolean add(E o) { boolean result = !contains(o); add(size(), o); return result; } - public void add(int index, Object element) { + @Override + public void add(int index, E element) { if(set.add(element)){ super.add(index, element); } @@ -85,19 +88,24 @@ * supprime l'element demandé. Si l'elment n'existe pas alors, null * est retrouné. */ - public Object remove(int index) { + @Override + public E remove(int index) { if(set.remove(get(index))){ return super.remove(index); } return null; } + + @Override public void clear() { set.clear(); super.clear(); } - public boolean addAll(Collection c) { + + @Override + public boolean addAll(Collection c) { boolean modified = false; - Iterator e = c.iterator(); + Iterator e = c.iterator(); while (e.hasNext()) { if(add(e.next())) modified = true; @@ -105,9 +113,11 @@ return modified; } - public boolean addAll(int index, Collection c) { + + @Override + public boolean addAll(int index, Collection c) { boolean modified = false; - Iterator e = c.iterator(); + Iterator e = c.iterator(); while (e.hasNext()) { add(index++, e.next()); modified = true; @@ -116,18 +126,21 @@ } + @Override protected void removeRange(int fromIndex, int toIndex) { for(int i=toIndex-1; i>=fromIndex; i--){ remove(i); } } + @Override public boolean contains(Object elem) { return set.contains(elem); } + @Override public Object clone() { - HashList result = new HashList(this); + HashList result = new HashList(this); return result; } Index: lutinutil/src/java/org/codelutin/util/HashMapMultiKey.java diff -u lutinutil/src/java/org/codelutin/util/HashMapMultiKey.java:1.10 lutinutil/src/java/org/codelutin/util/HashMapMultiKey.java:1.11 --- lutinutil/src/java/org/codelutin/util/HashMapMultiKey.java:1.10 Tue May 23 13:55:52 2006 +++ lutinutil/src/java/org/codelutin/util/HashMapMultiKey.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * Created: 2 nov. 2004 * * @author Benjamin Poussin - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ * - * Mise a jour: $Date: 2006/05/23 13:55:52 $ + * Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -52,7 +52,7 @@ * fonctionner comme il faut, c-a-d qu'il retourne les references et non * les objets. Mais les methodes simples fonctionnent: put, remove, get, ... */ -public class HashMapMultiKey extends HashMap { // HashMapMultiKey +public class HashMapMultiKey extends HashMap { // HashMapMultiKey /** */ private static final long serialVersionUID = 8455012633585431630L; @@ -65,12 +65,12 @@ public static final Object WEAK = new Object(); /** key: un objet, value un Set de key pour la vrai hashmap */ - protected HashMap keys = new HashMap(); + protected HashMap> keys = new HashMap>(); /** key: la valeur, valeur: la cle. Permet de supprimer rapidement une * key lorsque la valeur disparait */ - protected Map valueToKey = new IdentityHashMap(); - protected ReferenceQueue refQueueKey = new ReferenceQueue(); - protected ReferenceQueue refQueueValue = new ReferenceQueue(); + protected Map valueToKey = new IdentityHashMap(); + protected ReferenceQueue refQueueKey = new ReferenceQueue(); + protected ReferenceQueue refQueueValue = new ReferenceQueue(); protected Object keyType = null; protected Object valueType = null; @@ -95,12 +95,12 @@ /** * Encapsule dans un objet Reference si besoin l'objet o */ - protected Object refValue(Object o) { + protected Object refValue(Object o) { Object result = o; if (valueType == SOFT) { - result = new TransparenteSoftReference(o, refQueueValue, false); + result = new TransparenteSoftReference(o, refQueueValue, false); } else if (valueType == WEAK) { - result = new TransparenteWeakReference(o, refQueueValue, false); + result = new TransparenteWeakReference(o, refQueueValue, false); } return result; } @@ -108,9 +108,9 @@ protected Object derefValue(Object o) { Object result = o; if (valueType == SOFT && o != null) { - result = ((TransparenteSoftReference)o).get(); + result = ((TransparenteSoftReference)o).get(); } else if (valueType == WEAK && o != null) { - result = ((TransparenteWeakReference)o).get(); + result = ((TransparenteWeakReference)o).get(); } return result; } @@ -119,12 +119,12 @@ /** * Encapsule dans un objet Reference si besoin l'objet o */ - protected Object refKey(Object o){ + protected Object refKey(Object o){ Object result = o; if (keyType == SOFT) { - result = new TransparenteSoftReference(o, refQueueKey, false); + result = new TransparenteSoftReference(o, refQueueKey, false); } else if (keyType == WEAK) { - result = new TransparenteWeakReference(o, refQueueKey, false); + result = new TransparenteWeakReference(o, refQueueKey, false); } return result; } @@ -132,9 +132,9 @@ protected Object derefKey(Object o) { Object result = o; if (keyType == SOFT && o != null) { - result = ((TransparenteSoftReference)o).get(); + result = ((TransparenteSoftReference)o).get(); } else if (keyType == WEAK && o != null) { - result = ((TransparenteWeakReference)o).get(); + result = ((TransparenteWeakReference)o).get(); } return result; } @@ -146,7 +146,7 @@ * call it */ protected void cleanQueue(){ - Reference o = null; + Reference o = null; while(null != (o = refQueueKey.poll())) { if(log.isTraceEnabled()){ log.trace("clean the refQueueKey : " + o);} Object val = super.remove(o); @@ -165,9 +165,9 @@ // System.out.println("++++++++++ key: " + key + " keyRef: " + keyRef + " for value: " + o); if( key != null) { // suppression dans l'association des objets de la cle - for(Iterator i=((Key)key).iterator(); i.hasNext();){ + for(Iterator i=((Key)key).iterator(); i.hasNext();){ Object k = i.next(); - Set list = (Set)keys.get(k); + Set list = keys.get(k); // FIXME il arrive que la list soit null, mais cela devrait // etre impossible puisqu'on vient de recuperer une cle qui // contient cette sous cle qui devrait retourner cette liste @@ -181,11 +181,11 @@ } else { if(log.isTraceEnabled()){ log.trace("key is null !!! do long task to prevent memory leak " + o);} // to prevent memory leak we can clean all list in keys Map - for (Iterator e=keys.keySet().iterator(); e.hasNext();) { + for (Iterator e=keys.keySet().iterator(); e.hasNext();) { Object k = e.next(); - Set list = keys.get(k); + Set list = keys.get(k); if (list != null) { - for (Iterator i=list.iterator(); i.hasNext();) { + for (Iterator i=list.iterator(); i.hasNext();) { if (derefKey(i.next()) == null) { i.remove(); } @@ -207,8 +207,8 @@ * @return la liste des cles. Si aucune cle ne contient l'element e, * alors la liste retourné est vide. */ - public Set getKeys(Object e){ - Set list = _getKeys(e); + public Set getKeys(Object e){ + Set list = _getKeys(e); return list; } @@ -219,17 +219,17 @@ * @return la liste des cles. Si aucune cle ne contient l'element e, * alors la liste retourné est vide. */ - protected Set _getKeys(Object e){ + protected Set _getKeys(Object e){ cleanQueue(); - Set list = (Set)keys.get(e); + Set list = keys.get(e); if( list == null){ - list = new HashSet(); + list = new HashSet(); } return list; } - protected Set getKeysAndAdd(Object e){ - Set list = _getKeys(e); + protected Set getKeysAndAdd(Object e){ + Set list = _getKeys(e); // il ne faut pas encapsuler e dans une ref, sinon on ne retrouve // plus les cles si l'objet etait seulement dans la cle keys.put(e, list); @@ -259,7 +259,7 @@ for(int i=0; i list = getKeysAndAdd(k); list.add(keyRef); } // On encapsule la valeur si besoin @@ -314,9 +314,9 @@ // de devoir le supprimer dans les lists de keys, le // GC le ferait pour nous. Object keyRef = refKey(key); - for(Iterator i=((Key)key).iterator(); i.hasNext();){ + for(Iterator i=((Key)key).iterator(); i.hasNext();){ Object k = i.next(); - Set list = _getKeys(k); + Set list = _getKeys(k); if (list != null) { list.remove(keyRef); if (list.size() == 0) { @@ -329,10 +329,10 @@ valueToKey.remove(result); return derefValue(result); }else{ - ArrayList result = new ArrayList(); - Set list = _getKeys(key); + ArrayList result = new ArrayList(); + Set list = _getKeys(key); if ( list != null ){ - for(Iterator i=list.iterator(); i.hasNext();){ + for(Iterator i=list.iterator(); i.hasNext();){ Object keyRef = i.next(); Key keyObject = (Key)derefKey(keyRef); i.remove(); @@ -355,12 +355,12 @@ * @param keyElement un element constituant d'une ou de plusieurs cles * @return la liste des valeurs associées aux clés contenant keyElement */ - public ArrayList getValues(Object keyElement){ + public ArrayList getValues(Object keyElement){ cleanQueue(); - ArrayList result = new ArrayList(); - Set list = _getKeys(keyElement); + ArrayList result = new ArrayList(); + Set list = _getKeys(keyElement); if (list != null) { - for(Iterator i=list.iterator(); i.hasNext();){ + for(Iterator i=list.iterator(); i.hasNext();){ Key keyObject = (Key)derefKey(i.next()); if (keyObject != null) { // si la cle existe encore Object val = super.get(keyObject); @@ -374,7 +374,7 @@ static public class Key implements Serializable { /** */ private static final long serialVersionUID = -2297846844678010597L; - ArrayList keys = new ArrayList(); + ArrayList keys = new ArrayList(); public Key add(Object o){ keys.add(o); return this; @@ -385,7 +385,7 @@ public Object get(int index){ return keys.get(index); } - public Iterator iterator(){ + public Iterator iterator(){ return keys.iterator(); } public boolean equals(Object o){ Index: lutinutil/src/java/org/codelutin/util/Log.java diff -u lutinutil/src/java/org/codelutin/util/Log.java:1.8 lutinutil/src/java/org/codelutin/util/Log.java:1.9 --- lutinutil/src/java/org/codelutin/util/Log.java:1.8 Fri Sep 15 08:56:34 2006 +++ lutinutil/src/java/org/codelutin/util/Log.java Wed Apr 25 13:42:43 2007 @@ -23,10 +23,10 @@ * Created: 12 août 2004 * * @author Benjamin Poussin - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ * - * Mise a jour: $Date: 2006/09/15 08:56:34 $ - * par : $Author: thimel $ + * Mise a jour: $Date: 2007/04/25 13:42:43 $ + * par : $Author: bpoussin $ */ package org.codelutin.util; @@ -147,7 +147,7 @@ /** * Tous les listeners */ - static protected CategorisedListenerSet listeners = new CategorisedListenerSet(); + static protected CategorisedListenerSet listeners = new CategorisedListenerSet(); /** Level.INFO = 700 Level.FINE=500 **/ public static final Level USER_INFO = new UserLevel("USERINFO", 600); Index: lutinutil/src/java/org/codelutin/util/LoggingPatternFormatter.java diff -u lutinutil/src/java/org/codelutin/util/LoggingPatternFormatter.java:1.4 lutinutil/src/java/org/codelutin/util/LoggingPatternFormatter.java:1.5 --- lutinutil/src/java/org/codelutin/util/LoggingPatternFormatter.java:1.4 Thu Jan 20 14:02:08 2005 +++ lutinutil/src/java/org/codelutin/util/LoggingPatternFormatter.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * * @author POUSSIN Benjamin * Copyright Code Lutin -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * -* Mise a jour: $Date: 2005/01/20 14:02:08 $ +* Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -91,13 +91,13 @@ private static final String DEFAULT_PATTERN = "%d{yyyy-MM-dd HH:mm:ss} [free:%o{-7}|total:%O{-7}][%t][%p{7}] %c{org.codelutin.*|25} %M{15:105}: %m%n%e"; - protected HashMap arguments = null; - protected ArrayList compile = null; + protected HashMap> arguments = null; + protected ArrayList compile = null; protected String pattern = null; public LoggingPatternFormatter() { try{ - arguments = new HashMap(); + arguments = new HashMap>(); initArguments(); LogManager manager = LogManager.getLogManager(); String cname = this.getClass().getName(); @@ -142,7 +142,7 @@ * Genere a partir de la chaine la liste des objet Argument. */ protected void compilePattern(String pattern){ - compile = new ArrayList(); + compile = new ArrayList(); String[] match = findNextPattern(pattern); while(!match[1].equals("")){ compile.add(new StringArgument(match[0])); Index: lutinutil/src/java/org/codelutin/util/Resource.java diff -u lutinutil/src/java/org/codelutin/util/Resource.java:1.28 lutinutil/src/java/org/codelutin/util/Resource.java:1.29 --- lutinutil/src/java/org/codelutin/util/Resource.java:1.28 Thu Oct 12 21:22:24 2006 +++ lutinutil/src/java/org/codelutin/util/Resource.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * * @author POUSSIN Benjamin * Copyright Code Lutin -* @version $Revision: 1.28 $ +* @version $Revision: 1.29 $ * -* Mise a jour: $Date: 2006/10/12 21:22:24 $ +* Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -60,14 +60,8 @@ */ public class Resource { // Resource - /** - * Logger for this class - */ - private static final Log log = LogFactory.getLog(Resource.class); - - /** to use log facility, just put in your code: log.info(\"...\"); */ -// private static Logger log = Logger.getLogger("org.codelutin.util.Resource"); + private static final Log log = LogFactory.getLog(Resource.class); protected Resource() { @@ -114,7 +108,7 @@ File file = new File(name); if (file.exists()){ try{ - return file.toURL(); + return file.toURI().toURL(); }catch(MalformedURLException eee){ log.warn("Le fichier '" + file + "' a été trouvé, mais il n'a pas pu etre converti en URL"); } @@ -185,14 +179,14 @@ File etcConfig = new File("/etc/" + filename); if(etcConfig.exists()){ log.info("Chargement du fichier de config: " + etcConfig); - result.load(etcConfig.toURL().openStream()); + result.load(etcConfig.toURI().toURL().openStream()); result = new Properties(result); } File config = new File(filename); if(config.exists()){ log.info("Chargement du fichier de config: " + config); - result.load(config.toURL().openStream()); + result.load(config.toURI().toURL().openStream()); result = new Properties(result); } @@ -210,7 +204,7 @@ *@return la liste des urls correspondant au pattern *@exception Exception s'il y a un problème une exception est levée */ - static public List getURLs(String pattern) { + static public List getURLs(String pattern) { return getURLs(pattern, null); } @@ -225,12 +219,12 @@ *@return la liste des urls correspondant au pattern *@exception Exception s'il y a un problème une exception est levée */ - static public List getURLs(String pattern, URLClassLoader classLoader) { + static public List getURLs(String pattern, URLClassLoader classLoader) { if(classLoader == null){ classLoader = (URLClassLoader)ClassLoader.getSystemClassLoader(); } - HashList urlList = new HashList(); + HashList urlList = new HashList(); URL[] arrayURL = classLoader.getURLs(); if (log.isInfoEnabled()) { @@ -256,13 +250,13 @@ return urlList; } - static public List getURLsFromJar(File jarfile, String pattern) { + static public List getURLsFromJar(File jarfile, String pattern) { try{ if(log.isTraceEnabled()) { log.trace("search '" + pattern + "' in " + jarfile); } - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList(); InputStream in = new FileInputStream(jarfile); ZipInputStream zis = new ZipInputStream(in); while (zis.available() != 0) { @@ -309,13 +303,13 @@ *@return la liste des urls correspondant au pattern *@exception Exception s'il y a un problème une exception est levée */ - static public List getURLsFromDirectory(File repository, String pattern) { + static public List getURLsFromDirectory(File repository, String pattern) { try{ if(log.isTraceEnabled()) { log.trace("search '" + pattern + "' in " + repository); } - HashList urlList = new HashList(); + HashList urlList = new HashList(); File[] filesList = repository.listFiles(); if (filesList != null) { @@ -334,7 +328,7 @@ urlList.addAll(Resource.getURLsFromDirectory(file, pattern)); // si le fichier du repertoire n'est pas un repertoire on verifie s'il correspond au pattern }else if (pattern == null || name.matches(pattern)){ - URL url = file.toURL(); + URL url = file.toURI().toURL(); if(log.isTraceEnabled()) { log.trace("directory: " + repository + " url: " + url); } Index: lutinutil/src/java/org/codelutin/util/StreamKeywordTokenizer.java diff -u lutinutil/src/java/org/codelutin/util/StreamKeywordTokenizer.java:1.1 lutinutil/src/java/org/codelutin/util/StreamKeywordTokenizer.java:1.2 --- lutinutil/src/java/org/codelutin/util/StreamKeywordTokenizer.java:1.1 Fri Jun 18 19:00:11 2004 +++ lutinutil/src/java/org/codelutin/util/StreamKeywordTokenizer.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/06/18 19:00:11 $ + * Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ @@ -40,7 +40,7 @@ public static final int TT_KEYWORD = -101; public static final int TT_VARIABLE = -102; - protected HashSet keywords = new HashSet(); + protected HashSet keywords = new HashSet(); protected boolean lowerCaseKeyword = false; protected int quoteCharVariable = -1; Index: lutinutil/src/java/org/codelutin/util/StringUtil.java diff -u lutinutil/src/java/org/codelutin/util/StringUtil.java:1.15 lutinutil/src/java/org/codelutin/util/StringUtil.java:1.16 --- lutinutil/src/java/org/codelutin/util/StringUtil.java:1.15 Fri Mar 9 14:12:42 2007 +++ lutinutil/src/java/org/codelutin/util/StringUtil.java Wed Apr 25 13:42:43 2007 @@ -22,9 +22,9 @@ * * @author POUSSIN Benjamin * Copyright Code Lutin -* @version $Revision: 1.15 $ +* @version $Revision: 1.16 $ * -* Mise a jour: $Date: 2007/03/09 14:12:42 $ +* Mise a jour: $Date: 2007/04/25 13:42:43 $ * par : $Author: bpoussin $ */ package org.codelutin.util; @@ -53,7 +53,7 @@ } static public String substring(String s, int begin) { - String result = result = substring(s, begin, s.length()); + String result = substring(s, begin, s.length()); return result; } @@ -129,7 +129,7 @@ return new String[0]; } - List result = new ArrayList(); + List result = new ArrayList(); int start = 0; int end = 0; Index: lutinutil/src/java/org/codelutin/util/TransformedList.java diff -u lutinutil/src/java/org/codelutin/util/TransformedList.java:1.3 lutinutil/src/java/org/codelutin/util/TransformedList.java:1.4 --- lutinutil/src/java/org/codelutin/util/TransformedList.java:1.3 Wed Jan 4 13:26:32 2006 +++ lutinutil/src/java/org/codelutin/util/TransformedList.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * Created: 2 août 2005 02:12:42 CEST * * @author Benjamin POUSSIN - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Last update: $Date: 2006/01/04 13:26:32 $ + * Last update: $Date: 2007/04/25 13:42:43 $ * by : $Author: bpoussin $ */ @@ -47,19 +47,19 @@ /** */ private static final long serialVersionUID = 2354881761407900789L; - protected Transformer transformer = null; - protected List inner = null; + protected Transformer transformer = null; + protected List inner = null; - public TransformedList(Transformer transformer){ + public TransformedList(Transformer transformer){ if(transformer == null){ throw new IllegalArgumentException("Transformer must not be null"); } else { this.transformer = transformer; - this.inner = new ArrayList(); + this.inner = new ArrayList(); } } - public TransformedList(Transformer transformer, Collection c){ + public TransformedList(Transformer transformer, Collection c){ this(transformer); addAll(c); } @@ -70,14 +70,14 @@ public E get(int index){ Object f = inner.get(index); - E result = (E)transformer.untransform(f); + E result = transformer.untransform(f); return result; } public E set(int index, E element){ Object f = transformer.transform(element); f = inner.set(index, f); - E result = (E)transformer.untransform(f); + E result = transformer.untransform(f); return result; } @@ -88,7 +88,7 @@ public E remove(int index) { Object f = inner.remove(index); - E result = (E)transformer.untransform(f); + E result = transformer.untransform(f); return result; } @@ -98,10 +98,11 @@ out.writeObject(inner); } + @SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); - transformer = (Transformer)in.readObject(); - inner = (List)in.readObject(); + transformer = (Transformer)in.readObject(); + inner = (List)in.readObject(); } } // TransformedList Index: lutinutil/src/java/org/codelutin/util/ZipUtil.java diff -u lutinutil/src/java/org/codelutin/util/ZipUtil.java:1.4 lutinutil/src/java/org/codelutin/util/ZipUtil.java:1.5 --- lutinutil/src/java/org/codelutin/util/ZipUtil.java:1.4 Mon Jan 8 13:19:09 2007 +++ lutinutil/src/java/org/codelutin/util/ZipUtil.java Wed Apr 25 13:42:43 2007 @@ -23,9 +23,9 @@ * Created: 24 août 2006 10:13:35 * * @author poussin - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * - * Last update: $Date: 2007/01/08 13:19:09 $ + * Last update: $Date: 2007/04/25 13:42:43 $ * by : $Author: bpoussin $ */ @@ -38,15 +38,11 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.Collection; -import java.util.Enumeration; import java.util.List; import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream;