Index: lutinutil/src/java/org/codelutin/util/ArrayUtil.java diff -u lutinutil/src/java/org/codelutin/util/ArrayUtil.java:1.2 lutinutil/src/java/org/codelutin/util/ArrayUtil.java:1.3 --- lutinutil/src/java/org/codelutin/util/ArrayUtil.java:1.2 Thu Nov 4 13:51:54 2004 +++ lutinutil/src/java/org/codelutin/util/ArrayUtil.java Mon Nov 8 13:39:19 2004 @@ -23,15 +23,16 @@ * Created: 31 oct. 2004 * * @author Benjamin Poussin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/11/04 13:51:54 $ + * Mise a jour: $Date: 2004/11/08 13:39:19 $ * par : $Author: bpoussin $ */ package org.codelutin.util; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class ArrayUtil { // ArrayUtil @@ -48,6 +49,30 @@ return result; } + static public List asList(Object [] a){ + return Arrays.asList(a); + } + + /** + * 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); + for(int i=0; i - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/11/04 13:51:54 $ + * Mise a jour: $Date: 2004/11/08 13:39:19 $ * par : $Author: bpoussin $ */ @@ -158,7 +158,10 @@ public int hashCode(){ int result = 0; for(int i=0; i * Copyright Code Lutin -* @version $Revision: 1.17 $ +* @version $Revision: 1.18 $ * -* Mise a jour: $Date: 2004/11/04 13:51:54 $ +* Mise a jour: $Date: 2004/11/08 13:39:19 $ * par : $Author: bpoussin $ */ @@ -34,6 +34,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; +import java.io.IOException; import java.lang.ClassLoader; import java.lang.reflect.Method; import java.net.MalformedURLException; @@ -84,7 +85,7 @@ * @return l'url de la ressource * @throws ResourceNotFoundException si la resource n'a pas ete trouvee */ - static public URL getURL(String name) throws ResourceNotFoundException{ + static public URL getURL(String name) { // on recherche d'abord sur le filesystem File file = new File(name); if (file.exists()){ @@ -175,8 +176,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) - throws Exception { + static public List getURLs(String pattern) { return getURLs(pattern, null); } @@ -191,8 +191,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, URLClassLoader classLoader) - throws Exception { + static public List getURLs(String pattern, URLClassLoader classLoader) { if(classLoader == null){ classLoader = (URLClassLoader)ClassLoader.getSystemClassLoader(); } @@ -203,14 +202,13 @@ for(int i=0;i * Copyright Code Lutin - * @version $Revision: 1.1.1.1 $ - * - * Mise a jour: $Date: 2003/08/05 16:13:25 $ + * @version $Revision: 1.2 $ + * + * Mise a jour: $Date: 2004/11/08 13:39:19 $ * par : $Author: bpoussin $ */ package org.codelutin.util; -public class ResourceNotFoundException extends Exception { // ResourceNotFoundException - +public class ResourceNotFoundException extends ResourceException { // ResourceNotFoundException + public ResourceNotFoundException(String msg) { super(msg); } - + public ResourceNotFoundException(String msg, Throwable e) { super(msg, e); } - + } // ResourceNotFoundException Index: lutinutil/src/java/org/codelutin/util/StringUtil.java diff -u lutinutil/src/java/org/codelutin/util/StringUtil.java:1.5 lutinutil/src/java/org/codelutin/util/StringUtil.java:1.6 --- lutinutil/src/java/org/codelutin/util/StringUtil.java:1.5 Tue Nov 2 16:51:28 2004 +++ lutinutil/src/java/org/codelutin/util/StringUtil.java Mon Nov 8 13:39:19 2004 @@ -22,9 +22,9 @@ * * @author POUSSIN Benjamin * Copyright Code Lutin -* @version $Revision: 1.5 $ +* @version $Revision: 1.6 $ * -* Mise a jour: $Date: 2004/11/02 16:51:28 $ +* Mise a jour: $Date: 2004/11/08 13:39:19 $ * par : $Author: bpoussin $ */ package org.codelutin.util; @@ -82,7 +82,7 @@ } public static boolean toBoolean(String s){ - return Boolean.getBoolean(s); + return "true".equalsIgnoreCase(s); } public static byte toByte(String s){ Index: lutinutil/src/java/org/codelutin/util/ResourceException.java diff -u /dev/null lutinutil/src/java/org/codelutin/util/ResourceException.java:1.1 --- /dev/null Mon Nov 8 13:39:24 2004 +++ lutinutil/src/java/org/codelutin/util/ResourceException.java Mon Nov 8 13:39:19 2004 @@ -0,0 +1,45 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 Code Lutin, Cédric Pineau, + * Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * ResourceException.java + * + * Created: 6 nov. 2004 + * + * @author Benjamin Poussin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/11/08 13:39:19 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.util; + +public class ResourceException extends RuntimeException { // ResourceException + + public ResourceException(String msg) { + super(msg); + } + + public ResourceException(String msg, Throwable e) { + super(msg, e); + } + +} // ResourceException +