[exo-jcr-commits] exo-jcr SVN: r5521 - in kernel/trunk: exo.kernel.commons/src/main/java/org/exoplatform/commons/utils and 18 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Jan 26 05:23:09 EST 2012
Author: andrew.plotnikov
Date: 2012-01-26 05:23:07 -0500 (Thu, 26 Jan 2012)
New Revision: 5521
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java
kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java
kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java
kernel/trunk/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -43,18 +43,18 @@
* @param classAnnotation the annotation to lookup
* @param <A> the annotation class
* @return the annotation
- * @throws NullPointerException if any argument is null
+ * @throws IllegalArgumentException if any argument is null
*/
public static <A extends Annotation> A resolveClassAnnotations(Class<?> clazz, Class<A> classAnnotation)
- throws NullPointerException
+ throws IllegalArgumentException
{
if (clazz == null)
{
- throw new NullPointerException("No null class");
+ throw new IllegalArgumentException("No null class");
}
if (classAnnotation == null)
{
- throw new NullPointerException("No null annotation");
+ throw new IllegalArgumentException("No null annotation");
}
//
@@ -92,11 +92,11 @@
{
if (clazz == null)
{
- throw new NullPointerException("No null class");
+ throw new IllegalArgumentException("No null class");
}
if (methodAnnotation == null)
{
- throw new NullPointerException("No null annotation");
+ throw new IllegalArgumentException("No null annotation");
}
//
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -18,6 +18,9 @@
*/
package org.exoplatform.commons.utils;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.util.ResourceBundle;
/**
@@ -29,6 +32,9 @@
*/
public class ExpressionUtil
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.commons.ExpressionUtil");
+
static public String getExpressionValue(ResourceBundle res, String key)
{
if (res == null)
@@ -43,6 +49,10 @@
}
catch (java.util.MissingResourceException ex)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ex.getMessage());
+ }
}
return value;
}
@@ -66,6 +76,10 @@
}
catch (java.util.MissingResourceException ex)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ex.getMessage());
+ }
}
return key;
}
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -18,6 +18,9 @@
*/
package org.exoplatform.commons.utils;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -37,6 +40,8 @@
public class IOUtil
{
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.commons.IOUtil");
+
/** The buffer size for reading input streams. */
private static final int DEFAULT_BUFFER_SIZE = 256;
@@ -46,9 +51,9 @@
* @param file the file
* @return the content
* @throws IOException any io exception
- * @throws NullPointerException if any argument is null
+ * @throws IllegalArgumentException if any argument is null
*/
- static public String getFileContentAsString(File file) throws IOException, NullPointerException
+ static public String getFileContentAsString(File file) throws IOException, IllegalArgumentException
{
return getFileContentAsString(file, "UTF-8");
}
@@ -60,13 +65,13 @@
* @param charset the charset
* @return the content
* @throws IOException any io exception
- * @throws NullPointerException if any argument is null
+ * @throws IllegalArgumentException if any argument is null
*/
- static public String getFileContentAsString(File file, String charset) throws IOException, NullPointerException
+ static public String getFileContentAsString(File file, String charset) throws IOException, IllegalArgumentException
{
if (file == null)
{
- throw new NullPointerException("No null file accepted");
+ throw new IllegalArgumentException("No null file accepted");
}
FileInputStream is = new FileInputStream(file);
return new String(getStreamContentAsBytes(is), charset);
@@ -79,14 +84,14 @@
* @param charset the charset
* @return the content
* @throws IOException any io exception
- * @throws NullPointerException if any argument is null
+ * @throws IllegalArgumentException if any argument is null
*/
static public String getFileContentAsString(String fileName, String charset) throws IOException,
- NullPointerException
+ IllegalArgumentException
{
if (fileName == null)
{
- throw new NullPointerException("No null file name accepted");
+ throw new IllegalArgumentException("No null file name accepted");
}
return getFileContentAsString(new File(fileName), charset);
}
@@ -97,9 +102,9 @@
* @param fileName the file name
* @return the content
* @throws IOException any io exception
- * @throws NullPointerException if any argument is null
+ * @throws IllegalArgumentException if any argument is null
*/
- static public String getFileContentAsString(String fileName) throws IOException, NullPointerException
+ static public String getFileContentAsString(String fileName) throws IOException, IllegalArgumentException
{
return getFileContentAsString(fileName, "UTF-8");
}
@@ -110,9 +115,9 @@
* @param is the stream
* @return the content
* @throws IOException any io exception
- * @throws NullPointerException if the specified stream is null
+ * @throws IllegalArgumentException if the specified stream is null
*/
- static public String getStreamContentAsString(InputStream is) throws IOException, NullPointerException
+ static public String getStreamContentAsString(InputStream is) throws IOException, IllegalArgumentException
{
byte buf[] = getStreamContentAsBytes(is);
return new String(buf, "UTF-8");
@@ -124,13 +129,13 @@
* @param fileName the file name
* @return the content
* @throws IOException any io exception
- * @throws NullPointerException if the specified file name is null
+ * @throws IllegalArgumentException if the specified file name is null
*/
- static public byte[] getFileContentAsBytes(String fileName) throws IOException, NullPointerException
+ static public byte[] getFileContentAsBytes(String fileName) throws IOException, IllegalArgumentException
{
if (fileName == null)
{
- throw new NullPointerException("No null file name accepted");
+ throw new IllegalArgumentException("No null file name accepted");
}
FileInputStream is = new FileInputStream(fileName);
return getStreamContentAsBytes(is);
@@ -144,13 +149,13 @@
* @param is the input stream
* @return the data read from the input stream its end
* @throws IOException if any IOException occurs during a read
- * @throws NullPointerException if the provided input stream is null
+ * @throws IllegalArgumentException if the provided input stream is null
*/
- static public byte[] getStreamContentAsBytes(InputStream is) throws IOException, NullPointerException
+ static public byte[] getStreamContentAsBytes(InputStream is) throws IOException, IllegalArgumentException
{
if (is == null)
{
- throw new NullPointerException("No null input stream accepted");
+ throw new IllegalArgumentException("No null input stream accepted");
}
try
{
@@ -173,9 +178,17 @@
}
catch (IOException ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
catch (RuntimeException ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
}
@@ -189,7 +202,7 @@
*
* @param resource the resource name
* @return the resource content
- * @throws NullPointerException if the specified argument is null or the loaded resource does not exist
+ * @throws IllegalArgumentException if the specified argument is null or the loaded resource does not exist
* @throws IOException thrown by accessing the resource
*/
static public String getResourceAsString(String resource) throws IOException
@@ -205,20 +218,21 @@
*
* @param resource the resource name
* @return the resource content
- * @throws NullPointerException if the specified argument is null or the loaded resource does not exist
+ * @throws IllegalArgumentException if the specified argument is null or the loaded resource does not exist
* @throws IOException thrown by accessing the resource
*/
static public byte[] getResourceAsBytes(String resource) throws IOException
{
if (resource == null)
{
- throw new NullPointerException("Cannot provide null resource values");
+ throw new IllegalArgumentException("Cannot provide null resource values");
}
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL url = cl.getResource(resource);
if (url == null)
{
- throw new NullPointerException("The resource " + resource + " was not found in the thread context classloader");
+ throw new IllegalArgumentException("The resource " + resource
+ + " was not found in the thread context classloader");
}
InputStream is = url.openStream();
return getStreamContentAsBytes(is);
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -35,20 +35,20 @@
* All the time zones already registered
*/
private static volatile Map<String, TimeZone> TIME_ZONES = new HashMap<String, TimeZone>();
-
+
/**
* Instantiates a {@link HashSet} object and fills it with the provided element array.
*
* @param elements the list of elements to add
* @param <E> the element type
* @return the set of elements
- * @throws NullPointerException if the element array is null
+ * @throws IllegalArgumentException if the element array is null
*/
- public static <E> Set<E> set(E... elements) throws NullPointerException
+ public static <E> Set<E> set(E... elements) throws IllegalArgumentException
{
if (elements == null)
{
- throw new NullPointerException("No null element array accepted");
+ throw new IllegalArgumentException("No null element array accepted");
}
HashSet<E> set = new HashSet<E>();
if (elements.length > 0)
@@ -69,13 +69,13 @@
*
* @param s the list to parse
* @return the set of string found in the list
- * @throws NullPointerException if the string argument is null
+ * @throws IllegalArgumentException if the string argument is null
*/
- public static Set<String> parseCommaList(String s) throws NullPointerException
+ public static Set<String> parseCommaList(String s) throws IllegalArgumentException
{
if (s == null)
{
- throw new NullPointerException("No null string list accepted");
+ throw new IllegalArgumentException("No null string list accepted");
}
Set<String> set = new HashSet<String>();
for (String v : s.split(","))
@@ -94,13 +94,13 @@
*
* @param map the map to copy
* @return the properties copy
- * @throws NullPointerException if the map argument is null
+ * @throws IllegalArgumentException if the map argument is null
*/
- public static Properties asProperties(Map<String, String> map) throws NullPointerException
+ public static Properties asProperties(Map<String, String> map) throws IllegalArgumentException
{
if (map == null)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
Properties props = new Properties();
for (Map.Entry<String, String> entry : map.entrySet())
@@ -116,13 +116,13 @@
*
* @param props the properties object to copy
* @return the properties copy as a map
- * @throws NullPointerException if the props argument is null
+ * @throws IllegalArgumentException if the props argument is null
*/
- public static Map<String, String> asMap(Properties props) throws NullPointerException
+ public static Map<String, String> asMap(Properties props) throws IllegalArgumentException
{
if (props == null)
{
- throw new NullPointerException("No null properties accepted");
+ throw new IllegalArgumentException("No null properties accepted");
}
Map<String, String> map = new HashMap<String, String>();
for (Object key : props.keySet())
@@ -141,17 +141,17 @@
* @param s the string to test
* @param end the string suffix
* @return true if the string s ends with the end string ignoring the case
- * @throws NullPointerException if any string is null
+ * @throws IllegalArgumentException if any string is null
*/
- public static boolean endsWithIgnoreCase(String s, String end) throws NullPointerException
+ public static boolean endsWithIgnoreCase(String s, String end) throws IllegalArgumentException
{
if (s == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
if (end == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
if (s.length() < end.length())
{
@@ -168,7 +168,7 @@
{
if (ID == null)
{
- throw new NullPointerException("ID of the timezone cannot be null");
+ throw new IllegalArgumentException("ID of the timezone cannot be null");
}
if (ID.length() == 0)
{
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -75,13 +75,13 @@
* to replace the current static instance.
*
* @param factory ExoLogFactory, the new factory
- * @throws NullPointerException when the factory is null
+ * @throws IllegalArgumentException when the factory is null
*/
- public static void setFactory(ExoLogFactory factory) throws NullPointerException
+ public static void setFactory(ExoLogFactory factory) throws IllegalArgumentException
{
if (factory == null)
{
- throw new NullPointerException("Cannot set a null logger factory");
+ throw new IllegalArgumentException("Cannot set a null logger factory");
}
loggerFactory = factory;
}
@@ -113,13 +113,13 @@
*
* @param name the logger name
* @return the logger
- * @throws NullPointerException if the name is null
+ * @throws IllegalArgumentException if the name is null
*/
- public static Log getExoLogger(String name) throws NullPointerException
+ public static Log getExoLogger(String name) throws IllegalArgumentException
{
if (name == null)
{
- throw new NullPointerException("No null name accepted");
+ throw new IllegalArgumentException("No null name accepted");
}
try
{
@@ -139,13 +139,13 @@
*
* @param name the logger name
* @return the logger
- * @throws NullPointerException if the name is null
+ * @throws IllegalArgumentException if the name is null
*/
- public static Log getExoLogger(Class name) throws NullPointerException
+ public static Log getExoLogger(Class name) throws IllegalArgumentException
{
if (name == null)
{
- throw new NullPointerException("No null name accepted");
+ throw new IllegalArgumentException("No null name accepted");
}
try
{
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -52,7 +52,7 @@
{
if (name == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
Log exoLogger = loggers.get(name);
if (exoLogger == null)
@@ -74,7 +74,7 @@
{
if (clazz == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
return getExoLogger(clazz.getName());
}
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -40,13 +40,13 @@
* Create a new instance.
*
* @param logger the logger
- * @throws NullPointerException if the logger is null
+ * @throws IllegalArgumentException if the logger is null
*/
public LocationAwareSLF4JExoLog(LocationAwareLogger logger)
{
if (logger == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
this.logger = new DynamicLocationAwareLogger(logger);
}
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -37,12 +37,14 @@
* Create a new instance.
*
* @param logger Logger
- * @throws NullPointerException if the logger is null
+ * @throws IllegalArgumentException if the logger is null
*/
- public SLF4JExoLog(Logger logger) throws NullPointerException
+ public SLF4JExoLog(Logger logger) throws IllegalArgumentException
{
if (logger == null)
- throw new NullPointerException();
+ {
+ throw new IllegalArgumentException();
+ }
this.logger = logger;
}
Modified: kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -33,50 +33,50 @@
public class TestIOUtil extends TestCase
{
- public void testGetFileContentAsStringThrowsNPE() throws IOException
+ public void testGetFileContentAsStringThrowsIllegalArgumentException() throws IOException
{
try
{
IOUtil.getFileContentAsString((File)null);
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
try
{
IOUtil.getFileContentAsString((String)null);
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
try
{
IOUtil.getFileContentAsString((File)null, "UTF-8");
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
try
{
IOUtil.getFileContentAsString((String)null, "UTF-8");
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
}
- public void testStreamContentAsStringThrowsNPE() throws IOException
+ public void testStreamContentAsStringThrowsIllegalArgumentException() throws IOException
{
try
{
IOUtil.getStreamContentAsString(null);
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
}
@@ -87,14 +87,14 @@
assertEquals("a\u1000", s);
}
- public void testStreamContentAsBytesThrowsNPE() throws IOException
+ public void testStreamContentAsBytesThrowsIllegalArgumentException() throws IOException
{
try
{
IOUtil.getStreamContentAsBytes(null);
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
}
@@ -121,14 +121,14 @@
}
}
- public void testGetResourceAsStringThrowsNPE() throws IOException
+ public void testGetResourceAsStringThrowsIllegalArgumentException() throws IOException
{
try
{
IOUtil.getResourceAsString(null);
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
//
}
@@ -149,9 +149,9 @@
{
Thread.currentThread().setContextClassLoader(newCL);
IOUtil.getResourceAsString("whatever");
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
//
}
@@ -308,14 +308,14 @@
}
}
- public void testGetStreamContentAsBytesThrowsNPE() throws IOException
+ public void testGetStreamContentAsBytesThrowsIllegalArgumentException() throws IOException
{
try
{
IOUtil.getStreamContentAsBytes(null);
- fail("Was expecting an NPE");
+ fail("Was expecting an IllegalArgumentException");
}
- catch (NullPointerException expected)
+ catch (IllegalArgumentException expected)
{
}
}
Modified: kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -66,14 +66,14 @@
assertTrue(strings.contains("b"));
}
- public void testSetThrowsNPE()
+ public void testSetThrowsIllegalArgumentException()
{
try
{
Tools.set((String[])null);
fail();
}
- catch (NullPointerException expected)
+ catch (IllegalArgumentException expected)
{
}
}
@@ -89,14 +89,14 @@
assertEquals(Tools.set("a", "b"),Tools.parseCommaList("a,b"));
}
- public void testParseCommandListThrowsNPE()
+ public void testParseCommandListThrowsIllegalArgumentException()
{
try
{
Tools.parseCommaList(null);
fail();
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
}
@@ -110,14 +110,14 @@
assertTrue(Tools.endsWithIgnoreCase("A", "a"));
}
- public void testEndsWithIgnoreCaseThrowsNPE()
+ public void testEndsWithIgnoreCaseThrowsIllegalArgumentException()
{
try
{
Tools.endsWithIgnoreCase(null, "a");
fail();
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
try
@@ -125,7 +125,7 @@
Tools.endsWithIgnoreCase("a", null);
fail();
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
try
@@ -133,7 +133,7 @@
Tools.endsWithIgnoreCase(null, null);
fail();
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
}
@@ -151,14 +151,14 @@
assertEquals("b", props.getProperty("a"));
}
- public void testAsMapThrowsNPE()
+ public void testAsMapThrowsIllegalArgumentException()
{
try
{
Tools.asMap(null);
fail();
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
}
@@ -176,14 +176,14 @@
assertEquals(Collections.singletonMap("a", "b"), map);
}
- public void testAsPropertiesThrowsNPE()
+ public void testAsPropertiesThrowsIllegalArgumentException()
{
try
{
Tools.asProperties(null);
fail();
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
}
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -180,7 +180,7 @@
{
if (name == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
if (liveTimeMillis != 0)
{
@@ -193,7 +193,7 @@
{
if (objs == null)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
long expirationTime = liveTimeMillis > 0 ? System.currentTimeMillis() + liveTimeMillis : Long.MAX_VALUE;
for (Serializable name : objs.keySet())
@@ -213,7 +213,7 @@
{
if (name == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
return state.remove(name);
}
@@ -281,7 +281,7 @@
{
if (listener == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
listeners.add(new ListenerContext<K, V>(listener, this));
}
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -21,6 +21,8 @@
import org.exoplatform.services.cache.CacheInfo;
import org.exoplatform.services.cache.CacheListener;
import org.exoplatform.services.cache.CacheListenerContext;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
/**
* @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -29,6 +31,8 @@
public class ListenerContext<K, V> implements CacheListenerContext, CacheInfo
{
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.cache.ListenerContext");
+
/** . */
private final ConcurrentFIFOExoCache cache;
@@ -74,6 +78,10 @@
}
catch (Exception ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
@@ -85,6 +93,10 @@
}
catch (Exception ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
@@ -96,6 +108,10 @@
}
catch (Exception ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
@@ -107,6 +123,10 @@
}
catch (Exception ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
@@ -118,6 +138,10 @@
}
catch (Exception ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
}
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -109,7 +109,7 @@
{
if (region == null)
{
- throw new NullPointerException("region cannot be null");
+ throw new IllegalArgumentException("region cannot be null");
}
if (region.length() == 0)
{
@@ -187,7 +187,10 @@
}
catch (ClassNotFoundException e)
{
- // The implementation could not be found
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
if (simple == null)
@@ -220,7 +223,10 @@
}
catch (Exception e)
{
- // ignore me
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
if (cache != null)
{
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -25,6 +25,8 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
/**
* @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -36,6 +38,8 @@
public class CacheServiceManaged implements ManagementAware
{
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.cache.CacheServiceManaged");
+
/** . */
private ManagementContext context;
@@ -62,6 +66,10 @@
}
catch (Exception wtf)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + wtf.getMessage());
+ }
}
}
}
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -168,11 +168,11 @@
/**
* @see org.exoplatform.services.cache.ExoCache#putMap(java.util.Map)
*/
- public void putMap(Map<? extends K, ? extends V> objs) throws NullPointerException, IllegalArgumentException
+ public void putMap(Map<? extends K, ? extends V> objs) throws IllegalArgumentException
{
if (objs == null)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
Map<K, HashCode<V>> map = new LinkedHashMap<K, HashCode<V>>();
for (Entry<? extends K, ? extends V> entry : objs.entrySet())
@@ -308,11 +308,11 @@
/**
* @see org.exoplatform.services.cache.ExoCache#addCacheListener(org.exoplatform.services.cache.CacheListener)
*/
- public void addCacheListener(CacheListener<? super K, ? super V> listener) throws NullPointerException
+ public void addCacheListener(CacheListener<? super K, ? super V> listener) throws IllegalArgumentException
{
if (listener == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
listeners.add(listener);
}
Modified: kernel/trunk/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -57,7 +57,7 @@
cache.put(null, new Object());
fail();
}
- catch (NullPointerException ignore)
+ catch (IllegalArgumentException ignore)
{
assertEquals(1, cache.getCacheSize());
assertEquals("a", cache.get("a"));
@@ -67,7 +67,7 @@
cache.remove(null);
fail();
}
- catch (NullPointerException ignore)
+ catch (IllegalArgumentException ignore)
{
assertEquals(1, cache.getCacheSize());
assertEquals("a", cache.get("a"));
@@ -77,7 +77,7 @@
cache.putMap(null);
fail();
}
- catch (NullPointerException ignore)
+ catch (IllegalArgumentException ignore)
{
assertEquals(1, cache.getCacheSize());
assertEquals("a", cache.get("a"));
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -101,7 +101,7 @@
{
if (listener == null)
{
- throw new IllegalArgumentException("The listener cannot be null");
+ throw new IllegalArgumentException();
}
listeners.add(new ListenerContext<K, V>(listener, this));
}
@@ -221,7 +221,7 @@
/**
* {@inheritDoc}
*/
- public void put(final K key, final V value) throws NullPointerException
+ public void put(final K key, final V value) throws IllegalArgumentException
{
if (key == null)
{
@@ -256,7 +256,7 @@
/**
* {@inheritDoc}
*/
- public void putMap(final Map<? extends K, ? extends V> objs) throws NullPointerException, IllegalArgumentException
+ public void putMap(final Map<? extends K, ? extends V> objs) throws IllegalArgumentException
{
if (objs == null)
{
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -385,7 +385,8 @@
// We expect a distributed cache
if (distributedCacheManager == null)
{
- throw new IllegalStateException("The DistributedCacheManager has not been defined in the configuration,"
+ throw new IllegalArgumentException(
+ "The DistributedCacheManager has not been defined in the configuration,"
+ " please configure it at root container level if you want to use a distributed cache.");
}
return new DistributedExoCache(ctx, config,
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -136,7 +136,7 @@
{
if (listener == null)
{
- throw new IllegalArgumentException("The listener cannot be null");
+ throw new IllegalArgumentException();
}
List<ListenerContext> lListeners = getListeners(fullName);
if (lListeners == null)
@@ -360,7 +360,7 @@
/**
* {@inheritDoc}
*/
- public void put(final K key, final V value) throws NullPointerException
+ public void put(final K key, final V value) throws IllegalArgumentException
{
if (key == null)
{
@@ -396,7 +396,7 @@
/**
* {@inheritDoc}
*/
- public void putMap(final Map<? extends K, ? extends V> objs) throws NullPointerException, IllegalArgumentException
+ public void putMap(final Map<? extends K, ? extends V> objs) throws IllegalArgumentException
{
if (objs == null)
{
@@ -444,7 +444,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public V remove(Serializable name) throws NullPointerException
+ public V remove(Serializable name) throws IllegalArgumentException
{
if (name == null)
{
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -107,7 +107,7 @@
{
if (listener == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
listeners.add(new ListenerContext<K, V>(listener, this));
}
@@ -234,11 +234,11 @@
/**
* {@inheritDoc}
*/
- public void put(K key, V value) throws NullPointerException
+ public void put(K key, V value) throws IllegalArgumentException
{
if (key == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
putOnly(key, value);
onPut(key, value);
@@ -255,11 +255,11 @@
/**
* {@inheritDoc}
*/
- public void putMap(Map<? extends K, ? extends V> objs) throws NullPointerException, IllegalArgumentException
+ public void putMap(Map<? extends K, ? extends V> objs) throws IllegalArgumentException
{
if (objs == null)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
for (Serializable name : objs.keySet())
{
@@ -299,11 +299,11 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public V remove(Serializable name) throws NullPointerException
+ public V remove(Serializable name) throws IllegalArgumentException
{
if (name == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
final Fqn<Serializable> fqn = getFqn(name);
// We use the methods peek and getDirect to avoid going through the interceptor chain
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -111,7 +111,9 @@
public ConcurrentPicoContainer(ComponentAdapterFactory componentAdapterFactory, PicoContainer parent)
{
if (componentAdapterFactory == null)
- throw new NullPointerException("componentAdapterFactory");
+ {
+ throw new IllegalArgumentException("componentAdapterFactory");
+ }
this.componentAdapterFactory = componentAdapterFactory;
this.parent = parent == null ? null : new ImmutablePicoContainer(parent);
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -424,7 +424,10 @@
}
catch (Exception ex)
{
- // ignore me
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ex.getMessage());
+ }
}
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -96,7 +96,7 @@
{
if (container == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
RequestLifeCycleStack lf = current.get();
if (lf == null)
@@ -118,7 +118,7 @@
{
if (lifeCycle == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
RequestLifeCycleStack lf = current.get();
if (lf == null)
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -70,7 +70,7 @@
public class ConfigurationUnmarshaller
{
- private static final Log log = ExoLogger.getLogger("exo.kernel.container.ConfigurationUnmarshaller");
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.container.ConfigurationUnmarshaller");
/**
* A private copy of the list of kernel namespaces
@@ -92,14 +92,14 @@
public void warning(SAXParseException exception) throws SAXException
{
- log.warn(exception.getMessage(), exception);
+ LOG.warn(exception.getMessage(), exception);
}
public void error(SAXParseException exception) throws SAXException
{
if (exception.getMessage().equals("cvc-elt.1: Cannot find the declaration of element 'configuration'."))
{
- log.info("The document "
+ LOG.info("The document "
+ url
+ " does not contain a schema declaration, it should have an "
+ "XML declaration similar to\n"
@@ -111,7 +111,7 @@
}
else
{
- log.error("In document " + url + " at (" + exception.getLineNumber() + "," + exception.getColumnNumber()
+ LOG.error("In document " + url + " at (" + exception.getLineNumber() + "," + exception.getColumnNumber()
+ ") :" + exception.getMessage());
}
valid = false;
@@ -119,7 +119,7 @@
public void fatalError(SAXParseException exception) throws SAXException
{
- log.fatal("In document " + url + " at (" + exception.getLineNumber() + "," + exception.getColumnNumber()
+ LOG.fatal("In document " + url + " at (" + exception.getLineNumber() + "," + exception.getColumnNumber()
+ ") :" + exception.getMessage());
valid = false;
}
@@ -172,12 +172,12 @@
}
catch (ParserConfigurationException e)
{
- log.error("Got a parser configuration exception when doing XSD validation");
+ LOG.error("Got a parser configuration exception when doing XSD validation");
return false;
}
catch (SAXException e)
{
- log.error("Got a sax exception when doing XSD validation");
+ LOG.error("Got a sax exception when doing XSD validation");
return false;
}
}
@@ -204,7 +204,10 @@
}
catch (Exception e)
{
- // ignore me
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
}
@@ -216,7 +219,7 @@
boolean valid = isValid(url);
if (!valid)
{
- log.info("The configuration file " + url + " was not found valid according to its XSD");
+ LOG.info("The configuration file " + url + " was not found valid according to its XSD");
}
}
@@ -239,7 +242,7 @@
if (cause instanceof FactoryConfigurationError)
{
// do nothing and let try to instantiate later
- log.debug("Was not able to find document builder factory class in Java > 5, will use default", cause);
+ LOG.debug("Was not able to find document builder factory class in Java > 5, will use default", cause);
}
else
{
@@ -249,7 +252,10 @@
}
catch (NoSuchMethodException e)
{
- // Java < 6
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
//
@@ -295,8 +301,8 @@
String document = buffer.toString();
// Debug
- if (log.isTraceEnabled())
- log.trace("About to parse configuration file " + document);
+ if (LOG.isTraceEnabled())
+ LOG.trace("About to parse configuration file " + document);
//
IBindingFactory bfact = BindingDirectory.getFactory(Configuration.class);
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -246,7 +246,10 @@
}
catch (Exception e)
{
- // Ignore, may be caused by lazy initialization mechanism
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
return super.unregisterComponent(componentKey);
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -75,7 +75,7 @@
{
if (container == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
@@ -102,11 +102,11 @@
{
if (parent == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
if (container == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
@@ -133,7 +133,7 @@
{
if (parent == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
if ((resource != null && typeMD == null) && (resource == null && typeMD != null))
{
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -91,7 +91,7 @@
{
if (clazz == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -27,6 +27,7 @@
import java.lang.management.ManagementFactory;
import java.lang.reflect.Method;
import java.net.URI;
+import java.net.URISyntaxException;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
@@ -42,7 +43,7 @@
/**
* The logger
*/
- private static final Log log = ExoLogger.getLogger("exo.kernel.container.J2EEServerInfo");
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.container.J2EEServerInfo");
/**
* The name of the JVM parameter that allows us to change the location of the
@@ -101,10 +102,20 @@
{
exoConfDir_ = new File(new File(new URI(jbossConfigUrl)), confDirName).getAbsolutePath();
}
- catch (Throwable e)
+ catch (SecurityException e)
{
- // don't care about it
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
+ catch (URISyntaxException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
}
//
@@ -124,7 +135,7 @@
}
catch (Exception ignore)
{
- log.error(ignore.getLocalizedMessage(), ignore);
+ LOG.error(ignore.getLocalizedMessage(), ignore);
}
}
else if (jettyHome != null)
@@ -182,7 +193,7 @@
String exoConfHome = PrivilegedSystemHelper.getProperty(EXO_CONF_PARAM);
if (exoConfHome != null && exoConfHome.length() > 0)
{
- log.info("Override exo-conf directory '" + exoConfDir_ + "' with location '" + exoConfHome
+ LOG.info("Override exo-conf directory '" + exoConfDir_ + "' with location '" + exoConfHome
+ "'");
exoConfDir_ = exoConfHome;
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -52,7 +52,7 @@
public class ContainerUtil
{
/** The logger. */
- private static final Log log = ExoLogger.getExoLogger(ContainerUtil.class);
+ private static final Log LOG = ExoLogger.getExoLogger(ContainerUtil.class);
static public Constructor<?>[] getSortedConstructors(Class<?> clazz) throws NoClassDefFoundError
{
@@ -142,7 +142,7 @@
}
catch (Exception ex)
{
- log.error("Failed to instanciate plugin " + plugin.getType() + ": " + ex.getMessage(), ex);
+ LOG.error("Failed to instanciate plugin " + plugin.getType() + ": " + ex.getMessage(), ex);
}
}
@@ -163,7 +163,7 @@
}
catch (Exception ex)
{
- log.error("Failed to instanciate plugin " + plugin.getType() + ": " + ex.getMessage(), ex);
+ LOG.error("Failed to instanciate plugin " + plugin.getType() + ": " + ex.getMessage(), ex);
}
}
}
@@ -188,7 +188,7 @@
if (component.isMultiInstance())
{
container.registerComponent(new ConstructorInjectionComponentAdapter(classType, classType));
- log.debug("===>>> Thread local component " + classType.getName() + " registered.");
+ LOG.debug("===>>> Thread local component " + classType.getName() + " registered.");
}
else
{
@@ -203,7 +203,7 @@
if (component.isMultiInstance())
{
container.registerComponent(new ConstructorInjectionComponentAdapter(keyType, classType));
- log.debug("===>>> Thread local component " + classType.getName() + " registered.");
+ LOG.debug("===>>> Thread local component " + classType.getName() + " registered.");
}
else
{
@@ -218,7 +218,7 @@
}
catch (ClassNotFoundException ex)
{
- log.error("Cannot register the component corresponding to key = '" + key + "' and type = '" + type + "'", ex);
+ LOG.error("Cannot register the component corresponding to key = '" + key + "' and type = '" + type + "'", ex);
}
}
}
@@ -259,19 +259,19 @@
String fileName = url.getFile();
if (Tools.endsWithIgnoreCase(path, ".properties"))
{
- if (log.isDebugEnabled())
- log.debug("Attempt to load property file " + path);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Attempt to load property file " + path);
props = PropertiesLoader.load(in);
}
else if (Tools.endsWithIgnoreCase(fileName, ".xml"))
{
- if (log.isDebugEnabled())
- log.debug("Attempt to load property file " + path + " with XML format");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Attempt to load property file " + path + " with XML format");
props = PropertiesLoader.loadFromXML(in);
}
- else if (log.isDebugEnabled())
+ else if (LOG.isDebugEnabled())
{
- log.debug("Will not load property file" + path + " because its format is not recognized");
+ LOG.debug("Will not load property file" + path + " because its format is not recognized");
}
if (props != null && resolveVariables)
{
@@ -289,12 +289,12 @@
}
else
{
- log.error("Could not load property file " + path);
+ LOG.error("Could not load property file " + path);
}
}
catch (Exception e)
{
- log.error("Cannot load property file " + path, e);
+ LOG.error("Cannot load property file " + path, e);
}
finally
{
@@ -306,6 +306,10 @@
}
catch (IOException ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -20,6 +20,8 @@
import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -42,6 +44,9 @@
*/
public class TemplateConfigurationHelper
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.container.TemplateConfigurationHelper");
+
// list with include-patterns
private List<Pattern> includes = new ArrayList<Pattern>();
@@ -147,7 +152,10 @@
}
catch (Exception e)
{
- // will try to use another resolve mechanism
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
// try to get resource by class loader
@@ -172,7 +180,10 @@
}
catch (IOException e)
{
- // Still can't resolve
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
return inputStream;
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -47,7 +47,7 @@
public static final String KERNEL_CONFIGURATION_1_0_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
- private static final Log log = ExoLogger.getLogger("exo.kernel.container.Configuration");
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.container.Configuration");
private Map<String, ContainerLifecyclePlugin> containerLifecyclePlugin_ =
new HashMap<String, ContainerLifecyclePlugin>();
@@ -264,7 +264,7 @@
}
catch (CloneNotSupportedException e)
{
- log.warn("Could not clone the configuration", e);
+ LOG.warn("Could not clone the configuration", e);
break;
}
}
@@ -291,7 +291,7 @@
}
catch (Exception e)
{
- log.warn("Couldn't dump the runtime configuration in XML Format", e);
+ LOG.warn("Couldn't dump the runtime configuration in XML Format", e);
}
}
@@ -308,7 +308,7 @@
}
catch (Exception e)
{
- log.warn("Cannot convert the configuration to XML format", e);
+ LOG.warn("Cannot convert the configuration to XML format", e);
return null;
}
finally
@@ -319,6 +319,10 @@
}
catch (IOException ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
return sw.toString();
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -100,7 +100,7 @@
}
}
}
- catch (Throwable ex)
+ catch (Exception ex)
{
// if(prop != null) {
// S ystem.out.println("Exception when try setting the prop.name " +
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -49,17 +49,17 @@
*
* @param method the method
* @param impactType the access mode
- * @throws NullPointerException if the method is null or the impact is null
+ * @throws IllegalArgumentException if the method is null or the impact is null
*/
- public ManagedMethodMetaData(Method method, ImpactType impactType) throws NullPointerException
+ public ManagedMethodMetaData(Method method, ImpactType impactType) throws IllegalArgumentException
{
if (method == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
if (impactType == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -48,12 +48,11 @@
private final ManagedParameterMetaData setterParameter;
public ManagedPropertyMetaData(String name, Method getter, String getterDescription, Method setter,
- String setterDescription, ManagedParameterMetaData setterParameter) throws NullPointerException,
- IllegalArgumentException
+ String setterDescription, ManagedParameterMetaData setterParameter) throws IllegalArgumentException
{
if (name == null)
{
- throw new NullPointerException("No null name accepted");
+ throw new IllegalArgumentException("No null name accepted");
}
if (setter != null)
{
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java 2012-01-26 10:14:51 UTC (rev 5520)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java 2012-01-26 10:23:07 UTC (rev 5521)
@@ -43,11 +43,11 @@
/** . */
private final Map<MethodKey, ManagedMethodMetaData> methods;
- public ManagedTypeMetaData(Class type) throws NullPointerException
+ public ManagedTypeMetaData(Class type) throws IllegalArgumentException
{
if (type == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
More information about the exo-jcr-commits
mailing list