exo-jcr SVN: r5517 - in kernel/branches/2.4.x: exo.kernel.commons/src/main/java/org/exoplatform/commons/utils and 20 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-25 08:00:12 -0500 (Wed, 25 Jan 2012)
New Revision: 5517
Modified:
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java
kernel/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java
kernel/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java
kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java
kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java
kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java
kernel/branches/2.4.x/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java
kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/AbstractRPCService.java
kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
kernel/branches/2.4.x/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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/reflect/AnnotationIntrospector.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ExpressionUtil.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/IOUtil.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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 = PrivilegedFileHelper.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 = PrivilegedFileHelper.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());
+ }
}
}
}
@@ -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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/ExoLogger.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/AbstractExoLogFactory.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestIOUtil.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ConcurrentFIFOExoCache.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/ListenerContext.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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@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/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -111,7 +111,7 @@
{
if (region == null)
{
- throw new NullPointerException("region cannot be null");
+ throw new IllegalArgumentException("region cannot be null");
}
if (region.length() == 0)
{
@@ -188,7 +188,10 @@
}
catch (ClassNotFoundException e)
{
- // The implementation could not be found
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
if (simple == null)
@@ -221,7 +224,10 @@
}
catch (Exception e)
{
- // ignore me
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
if (cache != null)
{
Modified: kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceManaged.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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@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/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/invalidation/InvalidationExoCache.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/test/java/org/exoplatform/services/cache/test/TestConcurrentCache.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/AbstractRPCService.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/AbstractRPCService.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/AbstractRPCService.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -482,8 +482,10 @@
if (!body.accept(getLocalAddress()))
{
if (LOG.isTraceEnabled())
+ {
LOG.trace("Command : " + commandId + " needs to be executed on the coordinator " +
"only and the local node is not the coordinator, the command will be ignored");
+ }
return null;
}
RemoteCommand command = getCommand(commandId);
@@ -493,13 +495,17 @@
}
Object execResult = command.execute(body.getArgs());
if (LOG.isTraceEnabled())
+ {
LOG.trace("Command : " + commandId + " executed, result is: " + execResult);
+ }
return execResult;
}
catch (Throwable x)
{
if (LOG.isTraceEnabled())
+ {
LOG.trace("Problems invoking command.", x);
+ }
return new RPCException("Cannot execute the command " + (commandId == null ? "" : commandId), x);
}
}
Modified: kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -101,7 +101,7 @@
{
if (listener == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
listeners.add(new ListenerContext<K, V>(listener, this));
}
@@ -221,11 +221,11 @@
/**
* {@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)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
@@ -251,11 +251,11 @@
/**
* {@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)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
for (Serializable name : objs.keySet())
{
@@ -303,7 +303,7 @@
{
if (name == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
V result = SecurityHelper.doPrivilegedAction(new PrivilegedAction<V>()
{
Modified: kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -344,7 +344,8 @@
// We expect a distributed cache
if (distributedCacheManager == null)
{
- throw new NullPointerException("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,
@@ -421,7 +422,7 @@
Set<String> implementations = creator.getExpectedImplementations();
if (implementations == null)
{
- throw new NullPointerException("The set of implementations cannot be null");
+ throw new IllegalArgumentException("The set of implementations cannot be null");
}
for (String imp : implementations)
{
Modified: kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -132,7 +132,7 @@
{
if (listener == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
List<ListenerContext> lListeners = getListeners(fullName);
if (lListeners == null)
@@ -356,11 +356,11 @@
/**
* {@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)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
@@ -387,11 +387,11 @@
/**
* {@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)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
for (Serializable name : objs.keySet())
{
@@ -435,11 +435,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");
}
@SuppressWarnings("rawtypes")
CacheKey key = new CacheKey<Serializable>(fullName, name);
Modified: kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -160,7 +160,7 @@
Cache<K, V> cache = manager.getCache(cacheName, false);
if (cache == null)
{
- throw new NullPointerException("The expected cache named '" + cacheName
+ throw new IllegalArgumentException("The expected cache named '" + cacheName
+ "' has not been defined in the configuration of infinispan as named cache.");
}
return cache;
Modified: kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -424,7 +424,10 @@
}
catch (Exception ex)
{
- // ignore me
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ex.getMessage());
+ }
}
}
Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -91,7 +91,7 @@
{
if (clazz == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -26,6 +26,7 @@
import java.lang.management.ManagementFactory;
import java.lang.reflect.Method;
import java.net.URI;
+import java.net.URISyntaxException;
import java.security.PrivilegedAction;
import javax.management.MBeanServer;
@@ -40,7 +41,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
@@ -103,10 +104,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());
+ }
+ }
}
else
{
@@ -118,9 +129,12 @@
{
exoConfDir_ = new File(jbossConfigDir, confDirName).getAbsolutePath();
}
- catch (Throwable e)
+ catch (SecurityException e)
{
- // don't care about it
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
}
@@ -136,11 +150,11 @@
// We assume that JBoss AS 7 or higher is currently used
// since this class has been removed starting from this version
// of JBoss AS
- log.debug(ignore.getLocalizedMessage(), ignore);
+ LOG.debug(ignore.getLocalizedMessage(), ignore);
}
catch (Exception ignore)
{
- log.error(ignore.getLocalizedMessage(), ignore);
+ LOG.error(ignore.getLocalizedMessage(), ignore);
}
}
else if (jettyHome != null)
@@ -192,7 +206,7 @@
String exoConfHome = System.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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -53,7 +53,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
{
@@ -143,7 +143,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);
}
}
}
@@ -187,7 +187,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
{
@@ -202,7 +202,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
{
@@ -217,7 +217,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);
}
}
}
@@ -258,19 +258,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)
{
@@ -288,12 +288,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
{
@@ -305,6 +305,10 @@
}
catch (IOException ignore)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
}
}
}
Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/TemplateConfigurationHelper.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Configuration.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/xml/ObjectParam.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -101,7 +101,7 @@
}
}
}
- catch (Throwable ex)
+ catch (Exception ex)
{
// if(prop != null) {
// S ystem.out.println("Exception when try setting the prop.name " +
Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java 2012-01-25 12:55:12 UTC (rev 5516)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java 2012-01-25 13:00:12 UTC (rev 5517)
@@ -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();
}
//
12 years, 3 months
exo-jcr SVN: r5516 - jcr/branches/1.15.x/exo.jcr.component.core.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-25 07:55:12 -0500 (Wed, 25 Jan 2012)
New Revision: 5516
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt
Log:
EXOJCR-1728: Remove ReadOnly support for WorkspacePersistentDataManager
Modified: jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt 2012-01-25 12:52:37 UTC (rev 5515)
+++ jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt 2012-01-25 12:55:12 UTC (rev 5516)
@@ -12,4 +12,5 @@
* Removed TextFilter interfaces
* Not supported fields autoInitializedRootNt and autoInitPermissions
* Removed ValueStorageCleanHelper class
-* Removed BackupSchedulerException class
\ No newline at end of file
+* Removed BackupSchedulerException class
+* EXOJCR-1728: Remove ReadOnly support for WorkspacePersistentDataManager
12 years, 3 months
exo-jcr SVN: r5515 - in jcr/branches/1.15.x/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/dataflow and 4 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-25 07:52:37 -0500 (Wed, 25 Jan 2012)
New Revision: 5515
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-1728: Remove ReadOnly support for WorkspacePersistentDataManager
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -57,11 +57,6 @@
final int ONLINE = 1;
/**
- * Repository READONLY status.
- */
- final int READONLY = 2;
-
- /**
* Repository SUSPENDED status.
*/
final int SUSPENDED = 3;
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -20,7 +20,6 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
-import org.exoplatform.services.jcr.impl.ReadOnlySupport;
import org.exoplatform.services.jcr.impl.WorkspaceContainer;
import org.exoplatform.services.jcr.impl.backup.ResumeException;
import org.exoplatform.services.jcr.impl.backup.SuspendException;
@@ -113,21 +112,6 @@
*/
public int getState()
{
- boolean hasROComponents = false;
- boolean hasRWComponents = false;
- List<ReadOnlySupport> readOnlyComponents = getComponentInstancesOfType(ReadOnlySupport.class);
- for (ReadOnlySupport component : readOnlyComponents)
- {
- if (component.isReadOnly())
- {
- hasROComponents = true;
- }
- else
- {
- hasRWComponents = true;
- }
- }
-
boolean hasSuspendedComponents = false;
boolean hasResumedComponents = false;
List<Suspendable> suspendableComponents = getComponentInstancesOfType(Suspendable.class);
@@ -143,16 +127,12 @@
}
}
- if (hasSuspendedComponents && !hasResumedComponents && !hasROComponents)
+ if (hasSuspendedComponents && !hasResumedComponents)
{
return ManageableRepository.SUSPENDED;
}
- else if (hasROComponents && !hasRWComponents && !hasSuspendedComponents)
+ else if (!hasSuspendedComponents)
{
- return ManageableRepository.READONLY;
- }
- else if (!hasSuspendedComponents && !hasROComponents)
- {
return ManageableRepository.ONLINE;
}
else
@@ -189,9 +169,6 @@
break;
case ManageableRepository.OFFLINE :
break;
- case ManageableRepository.READONLY :
- setReadOnly(true);
- break;
case ManageableRepository.SUSPENDED :
suspend();
break;
@@ -217,18 +194,6 @@
}
/**
- * Set all components readonly.
- */
- private void setReadOnly(boolean readOnly)
- {
- List<ReadOnlySupport> components = getComponentInstancesOfType(ReadOnlySupport.class);
- for (ReadOnlySupport component : components)
- {
- component.setReadOnly(readOnly);
- }
- }
-
- /**
* Suspend all components in workspace.
*
* @throws RepositoryException
@@ -299,7 +264,6 @@
*/
private void setOnline() throws RepositoryException
{
- setReadOnly(false);
resume();
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -20,7 +20,6 @@
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListenerFilter;
-import org.exoplatform.services.jcr.impl.ReadOnlySupport;
/**
* Created by The eXo Platform SAS.
@@ -30,7 +29,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
* @version $Id: PersistentDataManager.java 34801 2009-07-31 15:44:50Z dkatayev $
*/
-public interface PersistentDataManager extends DataManager, ReadOnlySupport
+public interface PersistentDataManager extends DataManager
{
void addItemPersistenceListener(ItemsPersistenceListener listener);
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl;
-
-/**
- * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
- * @version $Id: ReadOnlySupport.java 34360 2009-07-22 23:58:59Z tolusha $
- */
-public interface ReadOnlySupport
-{
-
- /**
- * Status of write-operations restrictions.
- *
- * Read-only status is descriptive within the container, i.e. will not prevent any write
- * operation.
- *
- * Used in DataManager implementations.
- *
- * @return true - if write-operations allowed, false - otherwise.
- */
- boolean isReadOnly();
-
- /**
- * Set status of write-operations restrictions.
- *
- * Read-only status is descriptive within the container, i.e. will not prevent any write
- * operation.
- *
- * Used in DataManager implementations.
- *
- * @param status
- * , true - if write-operations allowed, false - otherwise.
- */
- void setReadOnly(boolean status);
-
-}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -763,8 +763,6 @@
return "online";
case OFFLINE :
return "offline";
- case READONLY :
- return "readonly";
case SUSPENDED :
return "suspended";
default :
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -1048,20 +1048,4 @@
con.close();
}
}
-
- /**
- * {@inheritDoc}true
- */
- public boolean isReadOnly()
- {
- return readOnly;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setReadOnly(boolean status)
- {
- this.readOnly = status;
- }
}
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent;
-
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
-
-/**
- * Created by The eXo Platform SAS
- * Author : Sergey Karpenko <sergey.karpenko(a)exoplatform.com.ua>
- * @version $Id: $
- */
-
-public class TestRepositoryReadOnly extends JcrImplBaseTest
-{
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
-
- repository.getWorkspaceContainer(session.getWorkspace().getName());
- //dataContainer = (WorkspaceDataContainer) wsFacade.getComponent(WorkspaceDataContainer.class);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- repository.setState(repository.ONLINE);
- super.tearDown();
- }
-
- public void testRepositoryReadOnly() throws Exception
- {
-
- repository.setState(repository.READONLY);
-
- assertEquals(repository.READONLY, repository.getState());
-
- WorkspacePersistentDataManager dm =
- (WorkspacePersistentDataManager)(repository.getWorkspaceContainer(session.getWorkspace().getName()))
- .getComponent(WorkspacePersistentDataManager.class);
-
- try
- {
- dm.save(new PlainChangesLogImpl());
- fail("Read-only container should throw an ReadOnlyWorkspaceException");
- }
- catch (ReadOnlyWorkspaceException e)
- {
- // ok
- }
- }
-
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java 2012-01-25 10:13:19 UTC (rev 5514)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java 2012-01-25 12:52:37 UTC (rev 5515)
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent;
-
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
-import org.exoplatform.services.jcr.dataflow.PersistentDataManager;
-import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date: 15.08.2008
- *
- * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id: TestWorspaceReadOnly.java 34801 2009-07-31 15:44:50Z dkatayev $
- */
-public class TestWorspaceReadOnly extends JcrImplBaseTest
-{
-
- private WorkspaceContainerFacade wsFacade;
-
- private PersistentDataManager dataManager;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
-
- wsFacade = repository.getWorkspaceContainer(session.getWorkspace().getName());
- dataManager = (PersistentDataManager)wsFacade.getComponent(PersistentDataManager.class);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- dataManager.setReadOnly(false);
- super.tearDown();
- }
-
- public void testWorkspaceDataContainerStatus()
- {
-
- dataManager.setReadOnly(true);
-
- assertTrue(dataManager.isReadOnly());
- }
-
- public void testWorkspaceDataManager() throws Exception
- {
-
- dataManager.setReadOnly(true);
-
- WorkspacePersistentDataManager dm =
- (WorkspacePersistentDataManager)wsFacade.getComponent(WorkspacePersistentDataManager.class);
-
- try
- {
- dm.save(new PlainChangesLogImpl());
- fail("Read-only container should throw an ReadOnlyWorkspaceException");
- }
- catch (ReadOnlyWorkspaceException e)
- {
- // ok
- }
- }
-
-}
12 years, 3 months
exo-jcr SVN: r5514 - jcr/branches/1.15.x.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-25 05:13:19 -0500 (Wed, 25 Jan 2012)
New Revision: 5514
Modified:
jcr/branches/1.15.x/pom.xml
Log:
EXOJCR-1573: relies on doc-style version 2
Modified: jcr/branches/1.15.x/pom.xml
===================================================================
--- jcr/branches/1.15.x/pom.xml 2012-01-25 10:12:30 UTC (rev 5513)
+++ jcr/branches/1.15.x/pom.xml 2012-01-25 10:13:19 UTC (rev 5514)
@@ -45,7 +45,7 @@
<org.exoplatform.kernel.version>2.4.0-Beta01-SNAPSHOT</org.exoplatform.kernel.version>
<org.exoplatform.core.version>2.5.0-Beta01-SNAPSHOT</org.exoplatform.core.version>
<org.exoplatform.ws.version>2.3.0-Beta01-SNAPSHOT</org.exoplatform.ws.version>
- <org.exoplatform.doc-style.version>2-SNAPSHOT</org.exoplatform.doc-style.version>
+ <org.exoplatform.doc-style.version>2</org.exoplatform.doc-style.version>
</properties>
<dependencyManagement>
12 years, 3 months
exo-jcr SVN: r5513 - jcr/trunk.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-25 05:12:30 -0500 (Wed, 25 Jan 2012)
New Revision: 5513
Modified:
jcr/trunk/pom.xml
Log:
EXOJCR-1573: relies on doc-style version 2
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2012-01-24 13:51:06 UTC (rev 5512)
+++ jcr/trunk/pom.xml 2012-01-25 10:12:30 UTC (rev 5513)
@@ -45,7 +45,7 @@
<org.exoplatform.kernel.version>2.3.6-GA-SNAPSHOT</org.exoplatform.kernel.version>
<org.exoplatform.core.version>2.4.6-GA-SNAPSHOT</org.exoplatform.core.version>
<org.exoplatform.ws.version>2.2.6-GA-SNAPSHOT</org.exoplatform.ws.version>
- <org.exoplatform.doc-style.version>2-SNAPSHOT</org.exoplatform.doc-style.version>
+ <org.exoplatform.doc-style.version>2</org.exoplatform.doc-style.version>
</properties>
<dependencyManagement>
12 years, 3 months
exo-jcr SVN: r5512 - jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-24 08:51:06 -0500 (Tue, 24 Jan 2012)
New Revision: 5512
Added:
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/SetPropertyAction.java
Log:
EXOJCR-146: Allowed to specify properties to an Extension Action
Added: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/SetPropertyAction.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/SetPropertyAction.java (rev 0)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/SetPropertyAction.java 2012-01-24 13:51:06 UTC (rev 5512)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.ext.backup.usecase;
+
+import org.apache.commons.chain.Context;
+import org.exoplatform.services.command.action.Action;
+import org.exoplatform.services.jcr.impl.core.ItemImpl;
+
+import javax.jcr.Node;
+
+/**
+ * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 20 січ. 2012 skarpenko $
+ *
+ */
+public class SetPropertyAction implements Action
+{
+
+ private String addPropertyName;
+
+ private String addPropertyValue;
+
+ /**
+ * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+ */
+ @Override
+ public boolean execute(Context context) throws Exception
+ {
+ ItemImpl currentItem = (ItemImpl)context.get("currentItem");
+ Node myActionNode = ((Node)currentItem).addNode("myActionNode");
+ myActionNode.setProperty(addPropertyName, addPropertyValue);
+
+ return false;
+ }
+}
12 years, 3 months
exo-jcr SVN: r5511 - in ws/trunk: exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl and 8 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-24 08:12:13 -0500 (Tue, 24 Jan 2012)
New Revision: 5511
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -32,7 +32,11 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.net.ProtocolException;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -94,6 +98,8 @@
{
// class fields
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.AuthorizationInfo");
+
/** Holds the list of lists of authorization info structures */
private static Hashtable CntxtList = new Hashtable();
@@ -1112,9 +1118,42 @@
// ai.extra_info = extra_info.clone();
ai.extra_info = extra_info.getClass().getMethod("clone", null).invoke(extra_info, null);
}
- catch (Throwable t)
+ catch (IllegalAccessException e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
+ catch (IllegalArgumentException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+ catch (InvocationTargetException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+
ai.paths = new String[paths.length];
System.arraycopy(paths, 0, ai.paths, 0, paths.length);
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -81,7 +81,7 @@
private Response saved_resp;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.AuthorizationModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.AuthorizationModule");
// Constructors
@@ -127,22 +127,22 @@
copyFrom((AuthorizationModule)deferred_auth_list.remove(out));
req.copyFrom(saved_req);
- if (log.isDebugEnabled())
- log.debug("Handling deferred auth challenge");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling deferred auth challenge");
handle_auth_challenge(req, saved_resp);
if (auth_sent != null)
{
- if (log.isDebugEnabled())
- log.debug("Sending request with Authorization '" + auth_sent + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sending request with Authorization '" + auth_sent + "'");
}
else
{
- if (log.isDebugEnabled())
- log.debug("Sending request with Proxy-Authorization '" + prxy_sent + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sending request with Proxy-Authorization '" + prxy_sent + "'");
}
return REQ_RESTART;
}
@@ -193,8 +193,8 @@
prxy_sent = guess;
prxy_from_4xx = false;
- if (log.isDebugEnabled())
- log.debug("Preemptively sending Proxy-Authorization '" + guess + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Preemptively sending Proxy-Authorization '" + guess + "'");
}
if (rem_idx >= 0)
@@ -253,8 +253,8 @@
auth_sent = guess;
auth_from_4xx = false;
- if (log.isDebugEnabled())
- log.debug("Preemptively sending Authorization '" + guess + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Preemptively sending Authorization '" + guess + "'");
}
if (rem_idx >= 0)
@@ -288,7 +288,11 @@
AuthorizationInfo.getAuthorization(auth_sent, req, resp, false).addPath(req.getRequestURI());
}
catch (AuthSchemeNotImplException asnie)
- { /* shouldn't happen */
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + asnie.getMessage());
+ }
}
}
@@ -343,8 +347,8 @@
{
if (!HTTPConnection.deferStreamed)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " not handled - request has an output stream");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Status " + sts + " not handled - request has an output stream");
return RSP_CONTINUE;
}
@@ -356,16 +360,16 @@
req.getStream().reset();
resp.setRetryRequest(true);
- if (log.isDebugEnabled())
- log.debug("Handling of status " + sts + " deferred because an output stream was used");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling of status " + sts + " deferred because an output stream was used");
return RSP_CONTINUE;
}
// handle the challenge
- if (log.isDebugEnabled())
- log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
handle_auth_challenge(req, resp);
@@ -379,17 +383,25 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
if (auth_sent != null)
{
- if (log.isDebugEnabled())
- log.debug("Resending request with Authorization '" + auth_sent + "'");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Resending request with Authorization '" + auth_sent + "'");
+ }
}
else
{
- if (log.isDebugEnabled())
- log.debug("Resending request with Proxy-Authorization '" + prxy_sent + "'");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Resending request with Proxy-Authorization '" + prxy_sent + "'");
+ }
}
return RSP_REQUEST;
@@ -397,13 +409,17 @@
if (req.getStream() != null)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " not handled - request has an output stream");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Status " + sts + " not handled - request has an output stream");
+ }
}
else
{
- if (log.isDebugEnabled())
- log.debug("No Auth Info found - status " + sts + " not handled");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No Auth Info found - status " + sts + " not handled");
+ }
}
return RSP_CONTINUE;
@@ -516,11 +532,11 @@
// get the list of challenges the server sent
AuthorizationInfo[] challenges = AuthorizationInfo.parseAuthString(auth_str, req, resp);
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Parsed " + challenges.length + " challenges:");
+ LOG.debug("Parsed " + challenges.length + " challenges:");
for (int idx = 0; idx < challenges.length; idx++)
- log.debug("AuthM: Challenge " + challenges[idx]);
+ LOG.debug("AuthM: Challenge " + challenges[idx]);
}
if (challenges.length == 0)
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -32,6 +32,9 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -47,6 +50,9 @@
*/
class BufferedInputStream extends FilterInputStream
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.BufferedInputStream");
+
/** our read buffer */
private byte[] buffer = new byte[2000];
@@ -182,17 +188,20 @@
{
int avail = end - pos;
if (avail == 0)
+ {
return in.available();
+ }
try
{
avail += in.available();
}
catch (IOException ignored)
- { /*
- * ignore this because we have something
- * available
- */
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignored.getMessage());
+ }
}
return avail;
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -99,13 +99,21 @@
public Cookie(String name, String value, String domain, String path, Date expires, boolean secure)
{
if (name == null)
- throw new NullPointerException("missing name");
+ {
+ throw new IllegalArgumentException("missing name");
+ }
if (value == null)
- throw new NullPointerException("missing value");
+ {
+ throw new IllegalArgumentException("missing value");
+ }
if (domain == null)
- throw new NullPointerException("missing domain");
+ {
+ throw new IllegalArgumentException("missing domain");
+ }
if (path == null)
- throw new NullPointerException("missing path");
+ {
+ throw new IllegalArgumentException("missing path");
+ }
this.name = name;
this.value = value;
@@ -115,7 +123,9 @@
this.secure = secure;
if (this.domain.indexOf('.') == -1)
+ {
this.domain += ".local";
+ }
}
/**
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -114,7 +114,7 @@
/** the cookie policy handler */
private static CookiePolicyHandler cookie_handler = new DefaultCookiePolicyHandler();
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.CookieModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.CookieModule");
// read in cookies from disk at startup
@@ -148,8 +148,12 @@
{
System.runFinalizersOnExit(true);
}
- catch (Throwable t)
+ catch (SecurityException t)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + t.getMessage());
+ }
}
}
}
@@ -168,10 +172,14 @@
ois.close();
}
}
- catch (Throwable t)
+ catch (IOException t)
{
cookie_jar = null;
}
+ catch (ClassNotFoundException e)
+ {
+ cookie_jar = null;
+ }
}
private static void saveCookies()
@@ -199,8 +207,12 @@
oos.writeObject(cookie_list);
oos.close();
}
- catch (Throwable t)
+ catch (IOException t)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + t.getMessage());
+ }
}
}
}
@@ -216,6 +228,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
if (file == null)
@@ -307,8 +323,8 @@
if (cookie.hasExpired())
{
- if (log.isDebugEnabled())
- log.debug("Cookie has expired and is being removed: " + cookie);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Cookie has expired and is being removed: " + cookie);
if (remove_list == null)
remove_list = new Vector();
@@ -375,8 +391,8 @@
req.setHeaders(hdrs);
- if (log.isDebugEnabled())
- log.debug("Sending cookies '" + value + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sending cookies '" + value + "'");
}
@@ -444,11 +460,11 @@
else
cookies = Cookie.parse(set_cookie, req);
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Received and parsed " + cookies.length + " cookies:");
+ LOG.debug("Received and parsed " + cookies.length + " cookies:");
for (int idx = 0; idx < cookies.length; idx++)
- log.debug("Cookie " + idx + ": " + cookies[idx]);
+ LOG.debug("Cookie " + idx + ": " + cookies[idx]);
}
Hashtable cookie_list = Util.getList(cookie_cntxt_list, req.getConnection().getContext());
@@ -459,8 +475,8 @@
Cookie cookie = (Cookie)cookie_list.get(cookies[idx]);
if (cookie != null && cookies[idx].hasExpired())
{
- if (log.isDebugEnabled())
- log.debug("Cookie has expired and is " + "being removed: " + cookie);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Cookie has expired and is " + "being removed: " + cookie);
cookie_list.remove(cookie); // expired, so remove
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -633,6 +633,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
StringTokenizer tok = new StringTokenizer(ch_params[ch_domain].getValue());
@@ -943,11 +947,19 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
return data;
}
- catch (Throwable t)
+ catch (IOException e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -975,6 +987,10 @@
}
catch (ArrayIndexOutOfBoundsException aioobe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + aioobe.getMessage());
+ }
}
return data;
@@ -1313,6 +1329,9 @@
class SimpleAuthPopup implements AuthorizationPrompter
{
+
+ private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPopup");
+
private static BasicAuthBox inp = null;
/**
@@ -1499,6 +1518,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
}
}
@@ -1538,6 +1561,9 @@
*/
class SimpleAuthPrompt implements AuthorizationPrompter
{
+
+ private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPrompt");
+
/**
* the method called by DefaultAuthHandler.
* @return the username/password pair
@@ -1627,6 +1653,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -49,7 +49,7 @@
/** number of times the request will be retried */
private int req_timeout_retries;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.DefaultModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.DefaultModule");
// Constructors
@@ -92,16 +92,16 @@
if (req_timeout_retries-- == 0 || req.getStream() != null)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " " + resp.getReasonLine()
+ if (LOG.isDebugEnabled())
+ LOG.debug("Status " + sts + " " + resp.getReasonLine()
+ " not handled - maximum number of retries exceeded");
return RSP_CONTINUE;
}
else
{
- if (log.isDebugEnabled())
- log.debug("Handling " + sts + " " + resp.getReasonLine() + " - resending request");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling " + sts + " " + resp.getReasonLine() + " - resending request");
return RSP_REQUEST;
}
@@ -116,12 +116,16 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
if (req.getData() != null)
throw new ProtocolException("Received status code 411 even" + " though Content-Length was sent");
- if (log.isDebugEnabled())
- log.debug("Handling " + sts + " " + resp.getReasonLine()
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling " + sts + " " + resp.getReasonLine()
+ " - resending request with 'Content-length: 0'");
req.setData(new byte[0]); // will send Content-Length: 0
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -114,7 +114,7 @@
/** the method used in the request */
private String method = null;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.HTTPResponse");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.HTTPResponse");
// Constructors
@@ -137,6 +137,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
this.method = orig.getMethod();
}
@@ -504,7 +508,7 @@
}
catch (IOException ioe)
{
- log.error(method + " " + OriginalURI.getPathAndQuery());
+ LOG.error(method + " " + OriginalURI.getPathAndQuery());
try
{
@@ -512,6 +516,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
throw ioe;
}
@@ -644,7 +652,7 @@
{
if (!(e instanceof InterruptedIOException))
{
- log.error(method + " " + OriginalURI.getPathAndQuery());
+ LOG.error(method + " " + OriginalURI.getPathAndQuery());
}
return "Failed to read headers: " + e;
@@ -943,6 +951,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
}
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -140,6 +140,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
try
@@ -148,6 +152,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -65,7 +65,7 @@
/** used for deferred redirection retries */
private Request saved_req;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.RedirectionModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.RedirectionModule");
// Constructors
@@ -140,10 +140,14 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
- if (log.isDebugEnabled())
- log.debug("Matched request in permanent redirection list - redoing request to " + lastURI.toExternalForm());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Matched request in permanent redirection list - redoing request to " + lastURI.toExternalForm());
if (!con.isCompatibleWith(new_loc))
{
@@ -203,8 +207,8 @@
*/
if (req.getMethod().equals("POST") || req.getMethod().equals("PUT"))
{
- if (log.isDebugEnabled())
- log.debug("Received status: " + sts + " " + resp.getReasonLine() + " - treating as 303");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Received status: " + sts + " " + resp.getReasonLine() + " - treating as 303");
sts = 303;
}
@@ -213,15 +217,15 @@
case 303 : // See Other (use GET)
case 307 : // Moved Temporarily (we mean it!)
- if (log.isDebugEnabled())
- log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
// the spec says automatic redirection may only be done if
// the second request is a HEAD or GET.
if (!req.getMethod().equals("GET") && !req.getMethod().equals("HEAD") && sts != 303)
{
- if (log.isDebugEnabled())
- log.debug("Not redirected because method is neither HEAD nor GET");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Not redirected because method is neither HEAD nor GET");
if (sts == 301 && resp.getHeader("Location") != null)
update_perm_redir_list(req, resLocHdr(resp.getHeader("Location"), req));
@@ -235,16 +239,16 @@
if (sts == 305 || sts == 306)
{
- if (log.isDebugEnabled())
- log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
}
// Don't accept 305 from a proxy
if (sts == 305 && req.getConnection().getProxyHost() != null)
{
- if (log.isDebugEnabled())
- log.debug("305 ignored because a proxy is already in use");
+ if (LOG.isDebugEnabled())
+ LOG.debug("305 ignored because a proxy is already in use");
resp.setEffectiveURI(lastURI);
return RSP_CONTINUE;
@@ -259,12 +263,12 @@
*/
if (level >= 15 || resp.getHeader("Location") == null)
{
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
if (level >= 15)
- log.debug("Not redirected because of too many levels of redirection");
+ LOG.debug("Not redirected because of too many levels of redirection");
else
- log.debug("Not redirected because no Location header was present");
+ LOG.debug("Not redirected because no Location header was present");
}
resp.setEffectiveURI(lastURI);
@@ -364,8 +368,8 @@
{
if (!HTTPConnection.deferStreamed)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " not handled - request has an output stream");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Status " + sts + " not handled - request has an output stream");
return RSP_CONTINUE;
}
@@ -410,6 +414,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
if (sts != 305 && sts != 306)
@@ -419,16 +427,20 @@
lastURI = new URI(loc, nres);
}
catch (ParseException pe)
- { /* ??? */
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
- if (log.isDebugEnabled())
- log.debug("Request redirected to " + lastURI.toExternalForm() + " using method " + req.getMethod());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Request redirected to " + lastURI.toExternalForm() + " using method " + req.getMethod());
}
else
{
- if (log.isDebugEnabled())
- log.debug("Resending request using " + "proxy " + mvd.getProxyHost() + ":" + mvd.getProxyPort());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Resending request using " + "proxy " + mvd.getProxyHost() + ":" + mvd.getProxyPort());
}
if (req.getStream() != null)
@@ -473,6 +485,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
if (!cur_loc.equals(new_loc))
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -82,19 +82,24 @@
/** the total number of bytes of entity data read from the demux so far */
int count = 0;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.RespInputStream");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.RespInputStream");
static
{
try
{
dontTimeoutBody = Boolean.getBoolean("HTTPClient.dontTimeoutRespBody");
- if (log.isDebugEnabled() && dontTimeoutBody)
- log.debug("Disabling timeouts when " + "reading response body");
-
+ if (LOG.isDebugEnabled() && dontTimeoutBody)
+ {
+ LOG.debug("Disabling timeouts when " + "reading response body");
+ }
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
@@ -150,8 +155,8 @@
else
{
if (resph.resp.cd_type != CD_HDRS)
- if (log.isDebugEnabled())
- log.debug("Reading stream " + this.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Reading stream " + this.hashCode());
int rcvd;
if (dontTimeoutBody && resph.resp.cd_type != CD_HDRS)
@@ -221,8 +226,8 @@
if (dont_truncate && (buffer == null || interrupted))
readAll(resph.resp.timeout);
- if (log.isDebugEnabled())
- log.debug("User closed stream " + hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("User closed stream " + hashCode());
demux.closeSocketIfAllStreamsClosed();
@@ -271,8 +276,8 @@
*/
void readAll(int timeout) throws IOException
{
- if (log.isDebugEnabled())
- log.debug("Read-all on stream " + this.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Read-all on stream " + this.hashCode());
synchronized (resph.resp)
{
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -143,7 +143,7 @@
/** should the request be retried by the application? */
boolean retry = false;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.Response");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.Response");
static
{
@@ -577,7 +577,7 @@
}
catch (IOException ioe)
{
- log.error("Response: (" + inp_stream.hashCode() + ")", ioe);
+ LOG.error("Response: (" + inp_stream.hashCode() + ")", ioe);
try
{
@@ -585,6 +585,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
throw ioe;
}
@@ -732,6 +736,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
if (te_hdr != null)
{
@@ -758,6 +766,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
// now determine content-delimiter
@@ -813,9 +825,9 @@
inp_stream.close(); // we will not receive any more data
}
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Response entity delimiter: "
+ LOG.debug("Response entity delimiter: "
+ (cd_type == CD_0 ? "No Entity" : cd_type == CD_CLOSE ? "Close" : cd_type == CD_CONTLEN ? "Content-Length"
: cd_type == CD_CHUNKED ? "Chunked" : cd_type == CD_MP_BR ? "Multipart" : "???") + " ("
+ inp_stream.hashCode() + ")");
@@ -952,12 +964,12 @@
*/
private String readResponseHeaders(InputStream inp) throws IOException
{
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
if (buf_pos == 0)
- log.debug("Reading Response headers " + inp_stream.hashCode());
+ LOG.debug("Reading Response headers " + inp_stream.hashCode());
else
- log.debug("Resuming reading Response headers " + inp_stream.hashCode());
+ LOG.debug("Resuming reading Response headers " + inp_stream.hashCode());
}
// read 7 bytes to see type of response
@@ -990,7 +1002,7 @@
}
catch (EOFException eof)
{
- log.error("Response: (" + inp_stream.hashCode() + ")", eof);
+ LOG.error("Response: (" + inp_stream.hashCode() + ")", eof);
throw eof;
}
@@ -1104,8 +1116,8 @@
String sts_line = null;
StringTokenizer lines = new StringTokenizer(headers, "\r\n"), elem;
- if (log.isDebugEnabled())
- log.debug("Parsing Response headers from Request " + "\"" + method + " " + resource + "\": ("
+ if (LOG.isDebugEnabled())
+ LOG.debug("Parsing Response headers from Request " + "\"" + method + " " + resource + "\": ("
+ inp_stream.hashCode() + ")\n\n" + headers);
// Detect and handle HTTP/0.9 responses
@@ -1198,6 +1210,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
}
@@ -1218,8 +1234,8 @@
throw exception;
}
- if (log.isDebugEnabled())
- log.debug("Reading Response trailers " + inp_stream.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Reading Response trailers " + inp_stream.hashCode());
try
{
@@ -1231,8 +1247,8 @@
if (trailers_read)
{
- if (log.isDebugEnabled())
- log.debug("Parsing Response trailers from " + "Request \"" + method + " " + resource + "\": ("
+ if (LOG.isDebugEnabled())
+ LOG.debug("Parsing Response trailers from " + "Request \"" + method + " " + resource + "\": ("
+ inp_stream.hashCode() + ")\n\n" + hdrs);
parseHeaderFields(new StringTokenizer(hdrs.toString(), "\r\n"), Trailers);
@@ -1356,6 +1372,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
}
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -60,6 +60,9 @@
*/
class SocksClient
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SocksClient");
+
/** the host the socks server sits on */
private String socks_host;
@@ -204,6 +207,10 @@
}
catch (IOException ee)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ee.getMessage());
+ }
}
}
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -82,7 +82,7 @@
/** the currently set timeout for the socket */
private int cur_timeout = 0;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.StreamDemultiplexor");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.StreamDemultiplexor");
static
{
@@ -132,8 +132,8 @@
*/
private void init(Socket sock) throws IOException
{
- if (log.isDebugEnabled())
- log.debug("Initializing Stream Demultiplexor (" + this.hashCode() + ")");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Initializing Stream Demultiplexor (" + this.hashCode() + ")");
this.Sock = sock;
this.Stream = new BufferedInputStream(sock.getInputStream());
@@ -241,8 +241,8 @@
throw resph.exception;
}
- if (resph.resp.cd_type != CD_HDRS && log.isDebugEnabled())
- log.debug("Reading for stream " + resph.stream.hashCode());
+ if (resph.resp.cd_type != CD_HDRS && LOG.isDebugEnabled())
+ LOG.debug("Reading for stream " + resph.stream.hashCode());
if (Timer != null)
Timer.hyber();
@@ -253,8 +253,8 @@
if (timeout != cur_timeout)
{
- if (log.isDebugEnabled())
- log.debug("Setting timeout to " + timeout + " ms");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Setting timeout to " + timeout + " ms");
Sock.setSoTimeout(timeout);
cur_timeout = timeout;
@@ -453,8 +453,8 @@
{
if (Sock == null) // already cleaned up
return;
- if (log.isDebugEnabled())
- log.debug("Closing all streams and socket (" + this.hashCode() + ")");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Closing all streams and socket (" + this.hashCode() + ")");
try
{
@@ -462,6 +462,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
try
{
@@ -469,6 +473,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
Sock = null;
@@ -546,8 +554,8 @@
if (resph != (ResponseHandler)RespHandlerList.getFirst())
return;
- if (log.isDebugEnabled())
- log.debug("Closing stream " + resph.stream.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Closing stream " + resph.stream.hashCode());
resph.eof = true;
RespHandlerList.remove(resph);
@@ -655,8 +663,8 @@
{
MarkedForClose = resph;
- if (log.isDebugEnabled())
- log.debug("Stream " + resp.inp_stream.hashCode() + " marked for close");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stream " + resp.inp_stream.hashCode() + " marked for close");
closeSocketIfAllStreamsClosed();
return;
@@ -674,8 +682,8 @@
MarkedForClose = lasth; // resp == null, so use last resph
closeSocketIfAllStreamsClosed();
- if (log.isDebugEnabled())
- log.debug("Stream " + lasth.stream.hashCode() + " marked for close");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stream " + lasth.stream.hashCode() + " marked for close");
}
}
@@ -686,8 +694,8 @@
*/
void abort()
{
- if (log.isDebugEnabled())
- log.debug("Aborting socket (" + this.hashCode() + ")");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Aborting socket (" + this.hashCode() + ")");
// notify all responses of abort
@@ -711,38 +719,48 @@
{
try
{
- try
+ Sock.setSoLinger(false, 0);
+ }
+ catch (SocketException se)
+ {
+ if (LOG.isTraceEnabled())
{
- Sock.setSoLinger(false, 0);
+ LOG.trace("An exception occurred: " + se.getMessage());
}
- catch (SocketException se)
- {
- }
+ }
- try
+ try
+ {
+ if (Stream != null)
{
Stream.close();
}
- catch (IOException ioe)
+ }
+ catch (IOException ioe)
+ {
+ if (LOG.isTraceEnabled())
{
+ LOG.trace("An exception occurred: " + ioe.getMessage());
}
- try
- {
- Sock.close();
- }
- catch (IOException ioe)
- {
- }
- Sock = null;
+ }
- if (Timer != null)
+ try
+ {
+ Sock.close();
+ }
+ catch (IOException ioe)
+ {
+ if (LOG.isTraceEnabled())
{
- Timer.kill();
- Timer = null;
+ LOG.trace("An exception occurred: " + ioe.getMessage());
}
}
- catch (NullPointerException npe)
+ Sock = null;
+
+ if (Timer != null)
{
+ Timer.kill();
+ Timer = null;
}
Connection.DemuxList.remove(this);
@@ -796,6 +814,9 @@
*/
class SocketTimeout extends Thread
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SocketTimeout");
+
private boolean alive = true;
/**
@@ -806,6 +827,7 @@
*/
class TimeoutEntry
{
+
boolean restart = false, hyber = false, alive = true;
StreamDemultiplexor demux;
@@ -878,6 +900,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
} // Oh well...
setPriority(MAX_PRIORITY);
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -32,6 +32,9 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.lang.reflect.Array;
import java.net.URL;
import java.text.DateFormat;
@@ -69,6 +72,8 @@
private static final Object http_parse_lock = new Object();
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.Util");
+
static
{
// rfc-2616 tspecial
@@ -840,6 +845,10 @@
}
catch (java.text.ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
try
{
@@ -847,6 +856,10 @@
}
catch (java.text.ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
try
{
Modified: ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java
===================================================================
--- ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.ws.frameworks.json.JsonHandler;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
import org.exoplatform.ws.frameworks.json.value.impl.ArrayValue;
@@ -35,6 +37,8 @@
public class JsonDefaultHandler implements JsonHandler
{
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.frameworks.json.JsonDefaultHandler");
+
/** The key. */
private String key;
@@ -190,7 +194,10 @@
}
catch (NumberFormatException e)
{
- // nothing to do!
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
else
@@ -217,7 +224,10 @@
}
catch (NumberFormatException d)
{
- // nothing to do!
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + d.getMessage());
+ }
}
}
// nothing to do!
@@ -241,7 +251,10 @@
}
catch (NumberFormatException d)
{
- // nothing to do!
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + d.getMessage());
+ }
}
}
}
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -262,14 +262,20 @@
Throwable cause = invExc.getCause();
// if WebApplicationException than it may contain response
if (WebApplicationException.class == cause.getClass())
+ {
throw (WebApplicationException)cause;
+ }
throw new InternalException(cause);
}
- catch (Throwable thr)
+ catch (WebApplicationException thr)
{
throw new InternalException(thr);
}
+ catch (InternalException thr)
+ {
+ throw new InternalException(thr);
+ }
}
/**
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.rest.impl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.GenericContainerRequest;
import org.exoplatform.services.rest.impl.header.AcceptLanguage;
import org.exoplatform.services.rest.impl.header.AcceptMediaType;
@@ -108,6 +110,8 @@
*/
private URI baseUri;
+ private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.ContainerRequest");
+
/**
* Constructs new instance of ContainerRequest.
*
@@ -568,7 +572,10 @@
}
catch (IllegalArgumentException e)
{
- // If the specified date is invalid, the header is ignored.
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
return null;
@@ -587,17 +594,23 @@
String ifModified = getRequestHeaders().getFirst(IF_MODIFIED_SINCE);
if (ifModified == null)
+ {
return null;
+ }
try
{
long modifiedSince = HeaderHelper.parseDateHeader(ifModified).getTime();
if (lastModified < modifiedSince)
+ {
return Response.notModified();
-
+ }
}
catch (IllegalArgumentException e)
{
- // If the specified date is invalid, the header is ignored.
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
return null;
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -19,6 +19,8 @@
package org.exoplatform.services.rest.impl;
import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.ApplicationContext;
import org.exoplatform.services.rest.FieldInjector;
import org.exoplatform.services.rest.impl.method.ParameterHelper;
@@ -27,6 +29,7 @@
import org.exoplatform.services.rest.resource.ResourceDescriptorVisitor;
import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
@@ -51,7 +54,7 @@
public class FieldInjectorImpl implements FieldInjector
{
/** Logger. */
- //private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.FieldInjectorImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.FieldInjectorImpl");
/** All annotations including JAX-RS annotation. */
private final Annotation[] annotations;
@@ -152,7 +155,10 @@
}
catch (PrivilegedActionException e)
{
- // Ignore NoSuchMethodException.
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
return setter;
}
@@ -242,11 +248,13 @@
jfield.set(resource, pr.resolve(this, context));
}
}
- catch (Throwable e)
+ catch (Exception e)
{
Class<?> ac = annotation.annotationType();
if (ac == MatrixParam.class || ac == QueryParam.class || ac == PathParam.class)
+ {
throw new WebApplicationException(e, Response.status(Response.Status.NOT_FOUND).build());
+ }
throw new WebApplicationException(e, Response.status(Response.Status.BAD_REQUEST).build());
}
}
@@ -276,10 +284,18 @@
jfield.set(resource, tmp);
}
}
- catch (Throwable e)
+ catch (IllegalAccessException e)
{
throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
}
+ catch (IllegalArgumentException e)
+ {
+ throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
+ }
}
}
}
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -70,7 +70,9 @@
public InputHeadersMap(Map<String, List<String>> m)
{
if (m == null)
- throw new NullPointerException();
+ {
+ throw new IllegalArgumentException();
+ }
this.m = new HashMap<String, List<String>>(m.size());
for (Map.Entry<String, List<String>> e : m.entrySet())
this.m.put(e.getKey().toLowerCase(), Collections.unmodifiableList(e.getValue()));
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -807,7 +807,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("ContextResolver instance is null.");
+ {
+ throw new IllegalArgumentException("ContextResolver instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -853,7 +855,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("MessageBodyReader instance is null.");
+ {
+ throw new IllegalArgumentException("MessageBodyReader instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -890,7 +894,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("MessageBodyWriter instance is null.");
+ {
+ throw new IllegalArgumentException("MessageBodyWriter instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -947,7 +953,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("ExceptionMapper instance is null.");
+ {
+ throw new IllegalArgumentException("ExceptionMapper instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -980,7 +988,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("RequestFilter instance is null.");
+ {
+ throw new IllegalArgumentException("RequestFilter instance is null.");
+ }
factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -1010,7 +1020,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("ResponseFilter instance is null.");
+ {
+ throw new IllegalArgumentException("ResponseFilter instance is null.");
+ }
factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -1040,7 +1052,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("MethodInvokerFilter instance is null.");
+ {
+ throw new IllegalArgumentException("MethodInvokerFilter instance is null.");
+ }
factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
break;
case CONTAINER :
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -19,6 +19,8 @@
package org.exoplatform.services.rest.impl.header;
import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.header.QualityValue;
import java.text.ParseException;
@@ -49,6 +51,8 @@
public final class HeaderHelper
{
+ private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.HeaderHelper");
+
/**
* Constructor.
*/
@@ -483,7 +487,10 @@
}
catch (ParseException e)
{
- // ignore all ParseException now
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
// no one format was found
throw new IllegalArgumentException("Not found appropriated date format for " + header);
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -590,6 +590,10 @@
}
catch (NoSuchMethodException e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
if (inhMethod == null)
@@ -614,6 +618,10 @@
}
catch (NoSuchMethodException exc)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + exc.getMessage());
+ }
}
}
}
Modified: ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -45,7 +45,7 @@
um = new InputHeadersMap(null);
fail("NullPointerException should be here");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
MultivaluedMap<String, String> m = new MultivaluedMapImpl();
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -22,6 +22,8 @@
import groovy.lang.GroovyResourceLoader;
import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -49,6 +51,9 @@
{
private static final String DEFAULT_SOURCE_FILE_EXTENSION = ".groovy";
+ private static final Log LOG = ExoLogger
+ .getLogger("org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoader");
+
public final ConcurrentMap<String, Future<URL>> findResourceURLTasks = new ConcurrentHashMap<String, Future<URL>>();
private int maxEntries = 512;
@@ -146,7 +151,10 @@
}
catch (CancellationException e)
{
- // ignore me
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
catch (ExecutionException e)
{
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -33,7 +33,7 @@
{
if (name == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
this.name = name;
}
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -242,7 +242,7 @@
}
catch (Exception e)
{
- LOG.error(e);
+ LOG.error(e.getMessage());
return Response.serverError();
}
finally
@@ -259,20 +259,30 @@
Type formType = MultivaluedMapImpl.class.getGenericInterfaces()[0];
MediaType contentType = context.getHttpHeaders().getMediaType();
- if (contentType == null) {
+ if (contentType == null)
+ {
contentType = MediaType.APPLICATION_FORM_URLENCODED_TYPE;
- }
+ }
MultivaluedMap<String, String> form = new MultivaluedMapImpl();
- try {
+ try
+ {
MessageBodyReader reader =
context.getProviders().getMessageBodyReader(MultivaluedMap.class, formType, null, contentType);
- if (reader != null) {
- form = (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, formType, null, contentType, context
- .getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
+ if (reader != null)
+ {
+ form =
+ (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, formType, null, contentType,
+ context.getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
}
- } catch (Exception e) {
}
+ catch (Exception e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
parameters.putAll(form);
return parameters;
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -38,7 +38,7 @@
{
if (method == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2012-01-24 13:03:19 UTC (rev 5510)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2012-01-24 13:12:13 UTC (rev 5511)
@@ -110,7 +110,7 @@
else
{
String msg = "XSLT scheme name is null.";
- throw new NullPointerException(msg);
+ throw new IllegalArgumentException(msg);
}
transformer.initResult(new StreamResult(outStream));
if (xsltParams != null)
12 years, 3 months
exo-jcr SVN: r5510 - in ws/branches/2.3.x: exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl and 8 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-24 08:03:19 -0500 (Tue, 24 Jan 2012)
New Revision: 5510
Modified:
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java
ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java
ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
ws/branches/2.3.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationInfo.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -32,7 +32,11 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.net.ProtocolException;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -94,6 +98,8 @@
{
// class fields
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.AuthorizationInfo");
+
/** Holds the list of lists of authorization info structures */
private static Hashtable CntxtList = new Hashtable();
@@ -1112,9 +1118,42 @@
// ai.extra_info = extra_info.clone();
ai.extra_info = extra_info.getClass().getMethod("clone", null).invoke(extra_info, null);
}
- catch (Throwable t)
+ catch (IllegalAccessException e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
+ catch (IllegalArgumentException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+ catch (InvocationTargetException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
+
ai.paths = new String[paths.length];
System.arraycopy(paths, 0, ai.paths, 0, paths.length);
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/AuthorizationModule.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -81,7 +81,7 @@
private Response saved_resp;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.AuthorizationModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.AuthorizationModule");
// Constructors
@@ -127,22 +127,22 @@
copyFrom((AuthorizationModule)deferred_auth_list.remove(out));
req.copyFrom(saved_req);
- if (log.isDebugEnabled())
- log.debug("Handling deferred auth challenge");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling deferred auth challenge");
handle_auth_challenge(req, saved_resp);
if (auth_sent != null)
{
- if (log.isDebugEnabled())
- log.debug("Sending request with Authorization '" + auth_sent + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sending request with Authorization '" + auth_sent + "'");
}
else
{
- if (log.isDebugEnabled())
- log.debug("Sending request with Proxy-Authorization '" + prxy_sent + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sending request with Proxy-Authorization '" + prxy_sent + "'");
}
return REQ_RESTART;
}
@@ -193,8 +193,8 @@
prxy_sent = guess;
prxy_from_4xx = false;
- if (log.isDebugEnabled())
- log.debug("Preemptively sending Proxy-Authorization '" + guess + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Preemptively sending Proxy-Authorization '" + guess + "'");
}
if (rem_idx >= 0)
@@ -253,8 +253,8 @@
auth_sent = guess;
auth_from_4xx = false;
- if (log.isDebugEnabled())
- log.debug("Preemptively sending Authorization '" + guess + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Preemptively sending Authorization '" + guess + "'");
}
if (rem_idx >= 0)
@@ -288,7 +288,11 @@
AuthorizationInfo.getAuthorization(auth_sent, req, resp, false).addPath(req.getRequestURI());
}
catch (AuthSchemeNotImplException asnie)
- { /* shouldn't happen */
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + asnie.getMessage());
+ }
}
}
@@ -343,8 +347,8 @@
{
if (!HTTPConnection.deferStreamed)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " not handled - request has an output stream");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Status " + sts + " not handled - request has an output stream");
return RSP_CONTINUE;
}
@@ -356,16 +360,16 @@
req.getStream().reset();
resp.setRetryRequest(true);
- if (log.isDebugEnabled())
- log.debug("Handling of status " + sts + " deferred because an output stream was used");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling of status " + sts + " deferred because an output stream was used");
return RSP_CONTINUE;
}
// handle the challenge
- if (log.isDebugEnabled())
- log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
handle_auth_challenge(req, resp);
@@ -379,17 +383,25 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
if (auth_sent != null)
{
- if (log.isDebugEnabled())
- log.debug("Resending request with Authorization '" + auth_sent + "'");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Resending request with Authorization '" + auth_sent + "'");
+ }
}
else
{
- if (log.isDebugEnabled())
- log.debug("Resending request with Proxy-Authorization '" + prxy_sent + "'");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Resending request with Proxy-Authorization '" + prxy_sent + "'");
+ }
}
return RSP_REQUEST;
@@ -397,13 +409,17 @@
if (req.getStream() != null)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " not handled - request has an output stream");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Status " + sts + " not handled - request has an output stream");
+ }
}
else
{
- if (log.isDebugEnabled())
- log.debug("No Auth Info found - status " + sts + " not handled");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No Auth Info found - status " + sts + " not handled");
+ }
}
return RSP_CONTINUE;
@@ -516,11 +532,11 @@
// get the list of challenges the server sent
AuthorizationInfo[] challenges = AuthorizationInfo.parseAuthString(auth_str, req, resp);
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Parsed " + challenges.length + " challenges:");
+ LOG.debug("Parsed " + challenges.length + " challenges:");
for (int idx = 0; idx < challenges.length; idx++)
- log.debug("AuthM: Challenge " + challenges[idx]);
+ LOG.debug("AuthM: Challenge " + challenges[idx]);
}
if (challenges.length == 0)
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/BufferedInputStream.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -32,6 +32,9 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -47,6 +50,9 @@
*/
class BufferedInputStream extends FilterInputStream
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.BufferedInputStream");
+
/** our read buffer */
private byte[] buffer = new byte[2000];
@@ -182,17 +188,20 @@
{
int avail = end - pos;
if (avail == 0)
+ {
return in.available();
+ }
try
{
avail += in.available();
}
catch (IOException ignored)
- { /*
- * ignore this because we have something
- * available
- */
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignored.getMessage());
+ }
}
return avail;
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Cookie.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -99,13 +99,21 @@
public Cookie(String name, String value, String domain, String path, Date expires, boolean secure)
{
if (name == null)
- throw new NullPointerException("missing name");
+ {
+ throw new IllegalArgumentException("missing name");
+ }
if (value == null)
- throw new NullPointerException("missing value");
+ {
+ throw new IllegalArgumentException("missing value");
+ }
if (domain == null)
- throw new NullPointerException("missing domain");
+ {
+ throw new IllegalArgumentException("missing domain");
+ }
if (path == null)
- throw new NullPointerException("missing path");
+ {
+ throw new IllegalArgumentException("missing path");
+ }
this.name = name;
this.value = value;
@@ -115,7 +123,9 @@
this.secure = secure;
if (this.domain.indexOf('.') == -1)
+ {
this.domain += ".local";
+ }
}
/**
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -114,7 +114,7 @@
/** the cookie policy handler */
private static CookiePolicyHandler cookie_handler = new DefaultCookiePolicyHandler();
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.CookieModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.CookieModule");
// read in cookies from disk at startup
@@ -148,8 +148,12 @@
{
System.runFinalizersOnExit(true);
}
- catch (Throwable t)
+ catch (SecurityException t)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + t.getMessage());
+ }
}
}
}
@@ -168,10 +172,14 @@
ois.close();
}
}
- catch (Throwable t)
+ catch (IOException t)
{
cookie_jar = null;
}
+ catch (ClassNotFoundException e)
+ {
+ cookie_jar = null;
+ }
}
private static void saveCookies()
@@ -199,8 +207,12 @@
oos.writeObject(cookie_list);
oos.close();
}
- catch (Throwable t)
+ catch (IOException t)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + t.getMessage());
+ }
}
}
}
@@ -216,6 +228,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
if (file == null)
@@ -307,8 +323,8 @@
if (cookie.hasExpired())
{
- if (log.isDebugEnabled())
- log.debug("Cookie has expired and is being removed: " + cookie);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Cookie has expired and is being removed: " + cookie);
if (remove_list == null)
remove_list = new Vector();
@@ -375,8 +391,8 @@
req.setHeaders(hdrs);
- if (log.isDebugEnabled())
- log.debug("Sending cookies '" + value + "'");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sending cookies '" + value + "'");
}
@@ -444,11 +460,11 @@
else
cookies = Cookie.parse(set_cookie, req);
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Received and parsed " + cookies.length + " cookies:");
+ LOG.debug("Received and parsed " + cookies.length + " cookies:");
for (int idx = 0; idx < cookies.length; idx++)
- log.debug("Cookie " + idx + ": " + cookies[idx]);
+ LOG.debug("Cookie " + idx + ": " + cookies[idx]);
}
Hashtable cookie_list = Util.getList(cookie_cntxt_list, req.getConnection().getContext());
@@ -459,8 +475,8 @@
Cookie cookie = (Cookie)cookie_list.get(cookies[idx]);
if (cookie != null && cookies[idx].hasExpired())
{
- if (log.isDebugEnabled())
- log.debug("Cookie has expired and is " + "being removed: " + cookie);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Cookie has expired and is " + "being removed: " + cookie);
cookie_list.remove(cookie); // expired, so remove
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -633,6 +633,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
StringTokenizer tok = new StringTokenizer(ch_params[ch_domain].getValue());
@@ -943,11 +947,19 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
return data;
}
- catch (Throwable t)
+ catch (IOException e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -975,6 +987,10 @@
}
catch (ArrayIndexOutOfBoundsException aioobe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + aioobe.getMessage());
+ }
}
return data;
@@ -1313,6 +1329,9 @@
class SimpleAuthPopup implements AuthorizationPrompter
{
+
+ private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPopup");
+
private static BasicAuthBox inp = null;
/**
@@ -1499,6 +1518,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
}
}
@@ -1538,6 +1561,9 @@
*/
class SimpleAuthPrompt implements AuthorizationPrompter
{
+
+ private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPrompt");
+
/**
* the method called by DefaultAuthHandler.
* @return the username/password pair
@@ -1627,6 +1653,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultModule.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -49,7 +49,7 @@
/** number of times the request will be retried */
private int req_timeout_retries;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.DefaultModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.DefaultModule");
// Constructors
@@ -92,16 +92,16 @@
if (req_timeout_retries-- == 0 || req.getStream() != null)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " " + resp.getReasonLine()
+ if (LOG.isDebugEnabled())
+ LOG.debug("Status " + sts + " " + resp.getReasonLine()
+ " not handled - maximum number of retries exceeded");
return RSP_CONTINUE;
}
else
{
- if (log.isDebugEnabled())
- log.debug("Handling " + sts + " " + resp.getReasonLine() + " - resending request");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling " + sts + " " + resp.getReasonLine() + " - resending request");
return RSP_REQUEST;
}
@@ -116,12 +116,16 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
if (req.getData() != null)
throw new ProtocolException("Received status code 411 even" + " though Content-Length was sent");
- if (log.isDebugEnabled())
- log.debug("Handling " + sts + " " + resp.getReasonLine()
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling " + sts + " " + resp.getReasonLine()
+ " - resending request with 'Content-length: 0'");
req.setData(new byte[0]); // will send Content-Length: 0
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -32,8 +32,8 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
-import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -305,7 +305,7 @@
/** controls whether modules are allowed to interact with user */
private boolean allowUI;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.HTTPConnection");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.HTTPConnection");
static
{
@@ -322,8 +322,10 @@
throw new Exception(); // try JDK 1.0.x naming
int port = Integer.getInteger("http.proxyPort", -1).intValue();
- if (log.isDebugEnabled())
- log.debug("using proxy " + host + ":" + port);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("using proxy " + host + ":" + port);
+ }
setProxyServer(host, port);
}
@@ -337,8 +339,10 @@
String host = PrivilegedSystemHelper.getProperty("proxyHost");
int port = Integer.getInteger("proxyPort", -1).intValue();
- if (log.isDebugEnabled())
- log.debug("using proxy " + host + ":" + port);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("using proxy " + host + ":" + port);
+ }
setProxyServer(host, port);
}
@@ -356,13 +360,19 @@
{
String hosts = PrivilegedSystemHelper.getProperty("HTTPClient.nonProxyHosts");
if (hosts == null)
+ {
hosts = PrivilegedSystemHelper.getProperty("http.nonProxyHosts");
+ }
String[] list = Util.splitProperty(hosts);
dontProxyFor(list);
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -379,13 +389,19 @@
int port = Integer.getInteger("HTTPClient.socksPort", -1).intValue();
int version = Integer.getInteger("HTTPClient.socksVersion", -1).intValue();
- if (log.isDebugEnabled())
- log.debug("using SOCKS " + host + ":" + port);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("using SOCKS " + host + ":" + port);
+ }
if (version == -1)
+ {
setSocksServer(host, port);
+ }
else
+ {
setSocksServer(host, port, version);
+ }
}
}
catch (Exception e)
@@ -432,14 +448,17 @@
String mname = list[idx];
DefaultModuleList.addElement(ClassLoading.forName(mname, HTTPConnection.class));
- if (log.isDebugEnabled())
- log.debug("added module " + list[idx]);
-
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("added module " + list[idx]);
+ }
}
catch (ClassNotFoundException cnfe)
{
if (!in_applet)
+ {
throw new NoClassDefFoundError(cnfe.getMessage());
+ }
/*
* Just ignore it. This allows for example applets to just load the
@@ -458,14 +477,18 @@
neverPipeline = Boolean.getBoolean("HTTPClient.disable_pipelining");
if (neverPipeline)
{
- if (log.isDebugEnabled())
- log.debug("disabling pipelining");
-
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("disabling pipelining");
+ }
}
}
catch (Exception e)
{
- // nothing to do
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -476,14 +499,18 @@
noKeepAlives = Boolean.getBoolean("HTTPClient.disableKeepAlives");
if (noKeepAlives)
{
- if (log.isDebugEnabled())
- log.debug("disabling keep-alives");
-
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("disabling keep-alives");
+ }
}
}
catch (Exception e)
{
- // notning to do
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -494,13 +521,18 @@
force_1_0 = Boolean.getBoolean("HTTPClient.forceHTTP_1.0");
if (force_1_0)
{
- if (log.isDebugEnabled())
- log.debug("forcing HTTP/1.0 requests");
-
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("forcing HTTP/1.0 requests");
+ }
}
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -511,13 +543,18 @@
no_chunked = Boolean.getBoolean("HTTPClient.dontChunkRequests");
if (no_chunked)
{
- if (log.isDebugEnabled())
- log.debug("never chunking requests");
-
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("never chunking requests");
+ }
}
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -527,16 +564,23 @@
{
if (PrivilegedSystemHelper.getProperty("os.name").indexOf("Windows") >= 0
&& PrivilegedSystemHelper.getProperty("java.version").startsWith("1.1"))
+ {
haveMSLargeWritesBug = true;
+ }
if (haveMSLargeWritesBug)
{
- if (log.isDebugEnabled())
- log.debug("splitting large writes into 20K chunks (M$ bug)");
-
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("splitting large writes into 20K chunks (M$ bug)");
+ }
}
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
/*
@@ -550,13 +594,18 @@
deferStreamed = Boolean.getBoolean("HTTPClient.deferStreamed");
if (deferStreamed)
{
- if (log.isDebugEnabled())
- log.debug("enabling defered handling of responses to streamed requests");
-
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("enabling defered handling of responses to streamed requests");
+ }
}
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
@@ -1479,7 +1528,7 @@
}
catch (XMLStreamException e)
{
- log.error(e.getLocalizedMessage(), e);
+ LOG.error(e.getLocalizedMessage(), e);
throw new IOException("Can't write XML data to output stream.");
}
return response;
@@ -1601,7 +1650,7 @@
}
catch (XMLStreamException e)
{
- log.error(e.getLocalizedMessage(), e);
+ LOG.error(e.getLocalizedMessage(), e);
throw new IOException("Can't write XML data to output stream.");
}
return response;
@@ -1658,7 +1707,7 @@
}
catch (XMLStreamException e)
{
- log.error(e.getLocalizedMessage(), e);
+ LOG.error(e.getLocalizedMessage(), e);
throw new IOException("Can't write XML request.");
}
finally
@@ -1925,12 +1974,20 @@
try
{
if (raw)
+ {
removeModule(ClassLoading.forName(modules[idx], this));
+ }
else
+ {
addModule(ClassLoading.forName(modules[idx], this), -1);
+ }
}
catch (ClassNotFoundException cnfe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + cnfe.getMessage());
+ }
}
}
}
@@ -2184,9 +2241,9 @@
list.insertElementAt(module, pos);
}
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Added module " + module.getName() + " to " + ((list == DefaultModuleList) ? "default " : "") //NOSONAR
+ LOG.debug("Added module " + module.getName() + " to " + ((list == DefaultModuleList) ? "default " : "") //NOSONAR
+ "list");
}
@@ -2201,9 +2258,9 @@
boolean removed = list.removeElement(module);
if (removed)
{
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Removed module " + module.getName() + " from " + ((list == DefaultModuleList) ? "default " : "") //NOSONAR
+ LOG.debug("Removed module " + module.getName() + " from " + ((list == DefaultModuleList) ? "default " : "") //NOSONAR
+ "list");
}
}
@@ -2508,18 +2565,25 @@
public static void dontProxyFor(String[] hosts)
{
if (hosts == null || hosts.length == 0)
+ {
return;
+ }
for (int idx = 0; idx < hosts.length; idx++)
{
try
{
if (hosts[idx] != null)
+ {
dontProxyFor(hosts[idx]);
+ }
}
catch (ParseException pe)
{
- // ignore it
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
}
}
@@ -3008,27 +3072,23 @@
if (early_stall != null)
{
- try
+ if (LOG.isDebugEnabled())
{
- if (log.isDebugEnabled())
- log.debug("Early-stalling Request: " + req.getMethod() + " " + req.getRequestURI());
+ LOG.debug("Early-stalling Request: " + req.getMethod() + " " + req.getRequestURI());
+ }
- synchronized (early_stall)
+ synchronized (early_stall)
+ {
+ // wait till the response is received
+ try
{
- // wait till the response is received
- try
- {
- early_stall.getVersion();
- }
- catch (IOException ioe)
- {
- }
- early_stall = null;
+ early_stall.getVersion();
}
+ catch (IOException ioe)
+ {
+ }
+ early_stall = null;
}
- catch (NullPointerException npe)
- {
- }
}
String[] con_hdrs = assembleHeaders(req, hdr_buf);
@@ -3059,18 +3119,26 @@
{
if (input_demux != null || keepAliveUnknown)
{
- if (log.isDebugEnabled())
- log.debug("Stalling Request: " + req.getMethod() + " " + req.getRequestURI());
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Stalling Request: " + req.getMethod() + " " + req.getRequestURI());
+ }
try
// wait till the response is received
{
late_stall.getVersion();
if (keepAliveUnknown)
+ {
determineKeepAlive(late_stall);
+ }
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
}
@@ -3087,8 +3155,8 @@
if ((req.getMethod().equals("POST") || req.dont_pipeline) && prev_resp != null && input_demux != null)
{
- if (log.isDebugEnabled())
- log.debug("Stalling Request: " + req.getMethod() + " " + req.getRequestURI());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stalling Request: " + req.getMethod() + " " + req.getRequestURI());
try
// wait till the response is received
@@ -3097,6 +3165,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
}
@@ -3165,8 +3237,8 @@
if (req.aborted)
throw new IOException("Request aborted by user");
- if (log.isDebugEnabled())
- log.debug("Sending Request");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sending Request");
// Send headers
@@ -3195,6 +3267,10 @@
}
catch (InterruptedIOException iioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + iioe.getMessage());
+ }
}
finally
{
@@ -3250,7 +3326,7 @@
catch (IOException ioe)
{
- log.error("Send request error", ioe);
+ LOG.error("Send request error", ioe);
closeDemux(ioe, true);
@@ -3258,7 +3334,7 @@
|| ioe instanceof NoRouteToHostException || ioe instanceof InterruptedIOException || req.aborted)
throw ioe;
- log.info("Retrying request");
+ LOG.info("Retrying request");
continue;
}
@@ -3279,8 +3355,8 @@
if (keepAliveReqMax != -1)
- if (log.isDebugEnabled())
- log.debug("Number of requests left: " + keepAliveReqLeft);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Number of requests left: " + keepAliveReqLeft);
/*
* We don't pipeline the first request, as we need some info about the
@@ -3326,8 +3402,8 @@
}
// Looks like were finally done
- if (log.isDebugEnabled())
- log.debug("Request sent");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Request sent");
}
return resp;
@@ -3358,8 +3434,8 @@
actual_port = Port;
}
- if (log.isDebugEnabled())
- log.debug("Creating Socket: " + actual_host + ":" + actual_port);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Creating Socket: " + actual_host + ":" + actual_port);
if (con_timeout == 0) // normal connection establishment
{
@@ -3456,8 +3532,10 @@
hdr_buf.reset();
assembleHeaders(connect, hdr_buf);
- if (log.isDebugEnabled())
- log.debug("Sending SSL-Tunneling Subrequest");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Sending SSL-Tunneling Subrequest");
+ }
// send CONNECT
@@ -3467,7 +3545,9 @@
resp = new Response(connect, sock[0].getInputStream());
if (resp.getStatusCode() == 200)
+ {
return null;
+ }
// failed!
@@ -3479,6 +3559,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
try
{
@@ -3486,6 +3570,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
// handle response
@@ -3571,17 +3659,25 @@
String file = Util.escapeUnsafeChars(req.getRequestURI());
if (Proxy_Host != null && Protocol != HTTPS && !file.equals("*"))
+ {
dataout.writeBytes(req.getMethod() + " http://" + Host + ":" + Port + file + " " + RequestProtocolVersion
+ "\r\n");
+ }
else
+ {
dataout.writeBytes(req.getMethod() + " " + file + " " + RequestProtocolVersion + "\r\n");
+ }
String h_hdr = (ho_idx >= 0) ? hdrs[ho_idx].getValue().trim() : Host;
if (Port != URI.defaultPort(getProtocol()))
+ {
dataout.writeBytes("Host: " + h_hdr + ":" + Port + "\r\n");
+ }
else
- // Netscape-Enterprise has some bugs...
+ {
+ // Netscape-Enterprise has some bugs...
dataout.writeBytes("Host: " + h_hdr + "\r\n");
+ }
/*
* What follows is the setup for persistent connections. We default to doing
@@ -3615,7 +3711,9 @@
try
{
if (ka_idx != -1 && Util.hasToken(con_hdrs[0], "keep-alive"))
+ {
dataout.writeBytes("Keep-Alive: " + hdrs[ka_idx].getValue().trim() + "\r\n");
+ }
}
catch (ParseException pe)
{
@@ -3686,22 +3784,29 @@
dataout.writeBytes(hdrs[te_idx].getValue().trim() + "\r\n");
}
else
+ {
dataout.writeBytes("TE: trailers\r\n");
+ }
// User-Agent
if (ua_idx != -1)
+ {
dataout.writeBytes("User-Agent: " + hdrs[ua_idx].getValue().trim() + " " + version + "\r\n");
+ }
else
+ {
dataout.writeBytes("User-Agent: " + version + "\r\n");
-
+ }
// Write out any headers left
for (int idx = 0; idx < hdrs.length; idx++)
{
if (idx != ct_idx && idx != ua_idx && idx != co_idx && idx != pc_idx && idx != ka_idx && idx != ex_idx
&& idx != te_idx && idx != ho_idx)
+ {
dataout.writeBytes(hdrs[idx].getName().trim() + ": " + hdrs[idx].getValue().trim() + "\r\n");
+ }
}
// Handle Content-type, Content-length and Expect headers
@@ -3710,15 +3815,23 @@
{
dataout.writeBytes("Content-type: ");
if (ct_idx != -1)
+ {
dataout.writeBytes(hdrs[ct_idx].getValue().trim());
+ }
else
+ {
dataout.writeBytes("application/octet-stream");
+ }
dataout.writeBytes("\r\n");
if (req.getData() != null)
+ {
dataout.writeBytes("Content-length: " + req.getData().length + "\r\n");
+ }
else if (req.getStream().getLength() != -1 && tc_idx == -1)
+ {
dataout.writeBytes("Content-length: " + req.getStream().getLength() + "\r\n");
+ }
if (ex_idx != -1)
{
@@ -3821,12 +3934,14 @@
{
doesKeepAlive = true;
keepAliveUnknown = false;
- if (log.isDebugEnabled())
- log.debug("Keep-Alive enabled");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Keep-Alive enabled");
}
else if (resp.getStatusCode() < 400)
+ {
keepAliveUnknown = false;
+ }
// get maximum number of requests
@@ -3838,19 +3953,31 @@
keepAliveReqMax = Integer.parseInt(max.getValue());
keepAliveReqLeft = keepAliveReqMax;
- if (log.isDebugEnabled())
- log.debug("Max Keep-Alive requests: " + keepAliveReqMax);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Max Keep-Alive requests: " + keepAliveReqMax);
}
}
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
catch (NumberFormatException nfe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + nfe.getMessage());
+ }
}
catch (ClassCastException cce)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + cce.getMessage());
+ }
}
}
@@ -3863,7 +3990,9 @@
synchronized void closeDemux(IOException ioe, boolean was_reset)
{
if (input_demux != null)
+ {
input_demux.close(ioe, was_reset);
+ }
early_stall = null;
late_stall = null;
@@ -3915,6 +4044,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
} // Oh well...
actual_host = host;
@@ -3932,7 +4065,9 @@
try
{
if (Socks_client != null)
+ {
sock = Socks_client.getSocket(actual_host, actual_port);
+ }
else
{
// try all A records
@@ -3942,15 +4077,21 @@
try
{
if (LocalAddr == null)
+ {
sock = new Socket(addr_list[idx], actual_port);
+ }
else
+ {
sock = new Socket(addr_list[idx], actual_port, LocalAddr, LocalPort);
+ }
break; // success
}
catch (SocketException se)
{
if (idx == addr_list.length - 1 || close)
+ {
throw se; // we tried them all
+ }
}
}
}
@@ -3968,6 +4109,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
sock = null;
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -114,7 +114,7 @@
/** the method used in the request */
private String method = null;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.HTTPResponse");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.HTTPResponse");
// Constructors
@@ -137,6 +137,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
this.method = orig.getMethod();
}
@@ -504,7 +508,7 @@
}
catch (IOException ioe)
{
- log.error(method + " " + OriginalURI.getPathAndQuery());
+ LOG.error(method + " " + OriginalURI.getPathAndQuery());
try
{
@@ -512,6 +516,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
throw ioe;
}
@@ -644,7 +652,7 @@
{
if (!(e instanceof InterruptedIOException))
{
- log.error(method + " " + OriginalURI.getPathAndQuery());
+ LOG.error(method + " " + OriginalURI.getPathAndQuery());
}
return "Failed to read headers: " + e;
@@ -943,6 +951,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
}
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -32,8 +32,8 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
-import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -145,7 +145,7 @@
/** the output stream used for POST and PUT */
private OutputStream output_stream;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.HttpURLConnection");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.HttpURLConnection");
static
{
@@ -158,6 +158,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
}
// get the RedirectionModule class
@@ -179,6 +183,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
}
}
@@ -220,6 +228,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
}
try
@@ -236,6 +248,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
}
// now setup stuff
@@ -293,8 +309,8 @@
if (connected)
throw new ProtocolException("Already connected!");
- if (log.isDebugEnabled())
- log.debug(urlString + " Setting request method: " + method);
+ if (LOG.isDebugEnabled())
+ LOG.debug(urlString + " Setting request method: " + method);
this.method = method.trim().toUpperCase();
method_set = true;
@@ -589,8 +605,8 @@
if (output_stream == null)
{
- if (log.isDebugEnabled())
- log.debug(urlString + " creating output stream");
+ if (LOG.isDebugEnabled())
+ LOG.debug(urlString + " creating output stream");
String cl = getRequestProperty("Content-Length");
if (cl != null)
@@ -657,8 +673,8 @@
public void setRequestProperty(String name, String value)
{
- if (log.isDebugEnabled())
- log.debug(urlString + " Setting request property: " + name + " : " + value);
+ if (LOG.isDebugEnabled())
+ LOG.debug(urlString + " Setting request property: " + name + " : " + value);
int idx;
for (idx = 0; idx < headers.length; idx++)
@@ -698,8 +714,8 @@
*/
public static void setDefaultRequestProperty(String name, String value)
{
- if (log.isDebugEnabled())
- log.debug("Setting default request property: " + name + " : " + value);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Setting default request property: " + name + " : " + value);
int idx;
for (idx = 0; idx < default_headers.length; idx++)
@@ -764,8 +780,8 @@
if (connected)
return;
- if (log.isDebugEnabled())
- log.debug(urlString + " Connecting ...");
+ if (LOG.isDebugEnabled())
+ LOG.debug(urlString + " Connecting ...");
// useCaches TBD!!!
@@ -800,8 +816,8 @@
@Override
public void disconnect()
{
- if (log.isDebugEnabled())
- log.debug(urlString + " Disconnecting ...");
+ if (LOG.isDebugEnabled())
+ LOG.debug(urlString + " Disconnecting ...");
con.stop();
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -140,6 +140,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
try
@@ -148,6 +152,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RedirectionModule.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -65,7 +65,7 @@
/** used for deferred redirection retries */
private Request saved_req;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.RedirectionModule");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.RedirectionModule");
// Constructors
@@ -140,10 +140,14 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
- if (log.isDebugEnabled())
- log.debug("Matched request in permanent redirection list - redoing request to " + lastURI.toExternalForm());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Matched request in permanent redirection list - redoing request to " + lastURI.toExternalForm());
if (!con.isCompatibleWith(new_loc))
{
@@ -203,8 +207,8 @@
*/
if (req.getMethod().equals("POST") || req.getMethod().equals("PUT"))
{
- if (log.isDebugEnabled())
- log.debug("Received status: " + sts + " " + resp.getReasonLine() + " - treating as 303");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Received status: " + sts + " " + resp.getReasonLine() + " - treating as 303");
sts = 303;
}
@@ -213,15 +217,15 @@
case 303 : // See Other (use GET)
case 307 : // Moved Temporarily (we mean it!)
- if (log.isDebugEnabled())
- log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
// the spec says automatic redirection may only be done if
// the second request is a HEAD or GET.
if (!req.getMethod().equals("GET") && !req.getMethod().equals("HEAD") && sts != 303)
{
- if (log.isDebugEnabled())
- log.debug("Not redirected because method is neither HEAD nor GET");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Not redirected because method is neither HEAD nor GET");
if (sts == 301 && resp.getHeader("Location") != null)
update_perm_redir_list(req, resLocHdr(resp.getHeader("Location"), req));
@@ -235,16 +239,16 @@
if (sts == 305 || sts == 306)
{
- if (log.isDebugEnabled())
- log.debug("Handling status: " + sts + " " + resp.getReasonLine());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handling status: " + sts + " " + resp.getReasonLine());
}
// Don't accept 305 from a proxy
if (sts == 305 && req.getConnection().getProxyHost() != null)
{
- if (log.isDebugEnabled())
- log.debug("305 ignored because a proxy is already in use");
+ if (LOG.isDebugEnabled())
+ LOG.debug("305 ignored because a proxy is already in use");
resp.setEffectiveURI(lastURI);
return RSP_CONTINUE;
@@ -259,12 +263,12 @@
*/
if (level >= 15 || resp.getHeader("Location") == null)
{
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
if (level >= 15)
- log.debug("Not redirected because of too many levels of redirection");
+ LOG.debug("Not redirected because of too many levels of redirection");
else
- log.debug("Not redirected because no Location header was present");
+ LOG.debug("Not redirected because no Location header was present");
}
resp.setEffectiveURI(lastURI);
@@ -364,8 +368,8 @@
{
if (!HTTPConnection.deferStreamed)
{
- if (log.isDebugEnabled())
- log.debug("Status " + sts + " not handled - request has an output stream");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Status " + sts + " not handled - request has an output stream");
return RSP_CONTINUE;
}
@@ -410,6 +414,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
if (sts != 305 && sts != 306)
@@ -419,16 +427,20 @@
lastURI = new URI(loc, nres);
}
catch (ParseException pe)
- { /* ??? */
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
- if (log.isDebugEnabled())
- log.debug("Request redirected to " + lastURI.toExternalForm() + " using method " + req.getMethod());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Request redirected to " + lastURI.toExternalForm() + " using method " + req.getMethod());
}
else
{
- if (log.isDebugEnabled())
- log.debug("Resending request using " + "proxy " + mvd.getProxyHost() + ":" + mvd.getProxyPort());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Resending request using " + "proxy " + mvd.getProxyHost() + ":" + mvd.getProxyPort());
}
if (req.getStream() != null)
@@ -473,6 +485,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
if (!cur_loc.equals(new_loc))
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/RespInputStream.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -82,19 +82,24 @@
/** the total number of bytes of entity data read from the demux so far */
int count = 0;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.RespInputStream");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.RespInputStream");
static
{
try
{
dontTimeoutBody = Boolean.getBoolean("HTTPClient.dontTimeoutRespBody");
- if (log.isDebugEnabled() && dontTimeoutBody)
- log.debug("Disabling timeouts when " + "reading response body");
-
+ if (LOG.isDebugEnabled() && dontTimeoutBody)
+ {
+ LOG.debug("Disabling timeouts when " + "reading response body");
+ }
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
@@ -150,8 +155,8 @@
else
{
if (resph.resp.cd_type != CD_HDRS)
- if (log.isDebugEnabled())
- log.debug("Reading stream " + this.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Reading stream " + this.hashCode());
int rcvd;
if (dontTimeoutBody && resph.resp.cd_type != CD_HDRS)
@@ -221,8 +226,8 @@
if (dont_truncate && (buffer == null || interrupted))
readAll(resph.resp.timeout);
- if (log.isDebugEnabled())
- log.debug("User closed stream " + hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("User closed stream " + hashCode());
demux.closeSocketIfAllStreamsClosed();
@@ -271,8 +276,8 @@
*/
void readAll(int timeout) throws IOException
{
- if (log.isDebugEnabled())
- log.debug("Read-all on stream " + this.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Read-all on stream " + this.hashCode());
synchronized (resph.resp)
{
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -143,7 +143,7 @@
/** should the request be retried by the application? */
boolean retry = false;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.Response");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.Response");
static
{
@@ -577,7 +577,7 @@
}
catch (IOException ioe)
{
- log.error("Response: (" + inp_stream.hashCode() + ")", ioe);
+ LOG.error("Response: (" + inp_stream.hashCode() + ")", ioe);
try
{
@@ -585,6 +585,10 @@
}
catch (Exception e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
throw ioe;
}
@@ -732,6 +736,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
if (te_hdr != null)
{
@@ -758,6 +766,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
// now determine content-delimiter
@@ -813,9 +825,9 @@
inp_stream.close(); // we will not receive any more data
}
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Response entity delimiter: "
+ LOG.debug("Response entity delimiter: "
+ (cd_type == CD_0 ? "No Entity" : cd_type == CD_CLOSE ? "Close" : cd_type == CD_CONTLEN ? "Content-Length"
: cd_type == CD_CHUNKED ? "Chunked" : cd_type == CD_MP_BR ? "Multipart" : "???") + " ("
+ inp_stream.hashCode() + ")");
@@ -952,12 +964,12 @@
*/
private String readResponseHeaders(InputStream inp) throws IOException
{
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
if (buf_pos == 0)
- log.debug("Reading Response headers " + inp_stream.hashCode());
+ LOG.debug("Reading Response headers " + inp_stream.hashCode());
else
- log.debug("Resuming reading Response headers " + inp_stream.hashCode());
+ LOG.debug("Resuming reading Response headers " + inp_stream.hashCode());
}
// read 7 bytes to see type of response
@@ -990,7 +1002,7 @@
}
catch (EOFException eof)
{
- log.error("Response: (" + inp_stream.hashCode() + ")", eof);
+ LOG.error("Response: (" + inp_stream.hashCode() + ")", eof);
throw eof;
}
@@ -1104,8 +1116,8 @@
String sts_line = null;
StringTokenizer lines = new StringTokenizer(headers, "\r\n"), elem;
- if (log.isDebugEnabled())
- log.debug("Parsing Response headers from Request " + "\"" + method + " " + resource + "\": ("
+ if (LOG.isDebugEnabled())
+ LOG.debug("Parsing Response headers from Request " + "\"" + method + " " + resource + "\": ("
+ inp_stream.hashCode() + ")\n\n" + headers);
// Detect and handle HTTP/0.9 responses
@@ -1198,6 +1210,10 @@
}
catch (ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
}
@@ -1218,8 +1234,8 @@
throw exception;
}
- if (log.isDebugEnabled())
- log.debug("Reading Response trailers " + inp_stream.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Reading Response trailers " + inp_stream.hashCode());
try
{
@@ -1231,8 +1247,8 @@
if (trailers_read)
{
- if (log.isDebugEnabled())
- log.debug("Parsing Response trailers from " + "Request \"" + method + " " + resource + "\": ("
+ if (LOG.isDebugEnabled())
+ LOG.debug("Parsing Response trailers from " + "Request \"" + method + " " + resource + "\": ("
+ inp_stream.hashCode() + ")\n\n" + hdrs);
parseHeaderFields(new StringTokenizer(hdrs.toString(), "\r\n"), Trailers);
@@ -1356,6 +1372,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
}
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -60,6 +60,9 @@
*/
class SocksClient
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SocksClient");
+
/** the host the socks server sits on */
private String socks_host;
@@ -204,6 +207,10 @@
}
catch (IOException ee)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ee.getMessage());
+ }
}
}
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -82,7 +82,7 @@
/** the currently set timeout for the socket */
private int cur_timeout = 0;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.StreamDemultiplexor");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.StreamDemultiplexor");
static
{
@@ -132,8 +132,8 @@
*/
private void init(Socket sock) throws IOException
{
- if (log.isDebugEnabled())
- log.debug("Initializing Stream Demultiplexor (" + this.hashCode() + ")");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Initializing Stream Demultiplexor (" + this.hashCode() + ")");
this.Sock = sock;
this.Stream = new BufferedInputStream(sock.getInputStream());
@@ -241,8 +241,8 @@
throw resph.exception;
}
- if (resph.resp.cd_type != CD_HDRS && log.isDebugEnabled())
- log.debug("Reading for stream " + resph.stream.hashCode());
+ if (resph.resp.cd_type != CD_HDRS && LOG.isDebugEnabled())
+ LOG.debug("Reading for stream " + resph.stream.hashCode());
if (Timer != null)
Timer.hyber();
@@ -253,8 +253,8 @@
if (timeout != cur_timeout)
{
- if (log.isDebugEnabled())
- log.debug("Setting timeout to " + timeout + " ms");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Setting timeout to " + timeout + " ms");
Sock.setSoTimeout(timeout);
cur_timeout = timeout;
@@ -453,8 +453,8 @@
{
if (Sock == null) // already cleaned up
return;
- if (log.isDebugEnabled())
- log.debug("Closing all streams and socket (" + this.hashCode() + ")");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Closing all streams and socket (" + this.hashCode() + ")");
try
{
@@ -462,6 +462,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
try
{
@@ -469,6 +473,10 @@
}
catch (IOException ioe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ioe.getMessage());
+ }
}
Sock = null;
@@ -546,8 +554,8 @@
if (resph != (ResponseHandler)RespHandlerList.getFirst())
return;
- if (log.isDebugEnabled())
- log.debug("Closing stream " + resph.stream.hashCode());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Closing stream " + resph.stream.hashCode());
resph.eof = true;
RespHandlerList.remove(resph);
@@ -655,8 +663,8 @@
{
MarkedForClose = resph;
- if (log.isDebugEnabled())
- log.debug("Stream " + resp.inp_stream.hashCode() + " marked for close");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stream " + resp.inp_stream.hashCode() + " marked for close");
closeSocketIfAllStreamsClosed();
return;
@@ -674,8 +682,8 @@
MarkedForClose = lasth; // resp == null, so use last resph
closeSocketIfAllStreamsClosed();
- if (log.isDebugEnabled())
- log.debug("Stream " + lasth.stream.hashCode() + " marked for close");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stream " + lasth.stream.hashCode() + " marked for close");
}
}
@@ -686,8 +694,8 @@
*/
void abort()
{
- if (log.isDebugEnabled())
- log.debug("Aborting socket (" + this.hashCode() + ")");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Aborting socket (" + this.hashCode() + ")");
// notify all responses of abort
@@ -711,38 +719,48 @@
{
try
{
- try
+ Sock.setSoLinger(false, 0);
+ }
+ catch (SocketException se)
+ {
+ if (LOG.isTraceEnabled())
{
- Sock.setSoLinger(false, 0);
+ LOG.trace("An exception occurred: " + se.getMessage());
}
- catch (SocketException se)
- {
- }
+ }
- try
+ try
+ {
+ if (Stream != null)
{
Stream.close();
}
- catch (IOException ioe)
+ }
+ catch (IOException ioe)
+ {
+ if (LOG.isTraceEnabled())
{
+ LOG.trace("An exception occurred: " + ioe.getMessage());
}
- try
- {
- Sock.close();
- }
- catch (IOException ioe)
- {
- }
- Sock = null;
+ }
- if (Timer != null)
+ try
+ {
+ Sock.close();
+ }
+ catch (IOException ioe)
+ {
+ if (LOG.isTraceEnabled())
{
- Timer.kill();
- Timer = null;
+ LOG.trace("An exception occurred: " + ioe.getMessage());
}
}
- catch (NullPointerException npe)
+ Sock = null;
+
+ if (Timer != null)
{
+ Timer.kill();
+ Timer = null;
}
Connection.DemuxList.remove(this);
@@ -796,6 +814,9 @@
*/
class SocketTimeout extends Thread
{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SocketTimeout");
+
private boolean alive = true;
/**
@@ -806,6 +827,7 @@
*/
class TimeoutEntry
{
+
boolean restart = false, hyber = false, alive = true;
StreamDemultiplexor demux;
@@ -878,6 +900,10 @@
}
catch (SecurityException se)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + se.getMessage());
+ }
} // Oh well...
setPriority(MAX_PRIORITY);
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Util.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -32,6 +32,9 @@
package org.exoplatform.common.http.client;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.lang.reflect.Array;
import java.net.URL;
import java.text.DateFormat;
@@ -69,6 +72,8 @@
private static final Object http_parse_lock = new Object();
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.Util");
+
static
{
// rfc-2616 tspecial
@@ -840,6 +845,10 @@
}
catch (java.text.ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
try
{
@@ -847,6 +856,10 @@
}
catch (java.text.ParseException pe)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + pe.getMessage());
+ }
}
try
{
Modified: ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java
===================================================================
--- ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonDefaultHandler.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.ws.frameworks.json.JsonHandler;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
import org.exoplatform.ws.frameworks.json.value.impl.ArrayValue;
@@ -35,6 +37,8 @@
public class JsonDefaultHandler implements JsonHandler
{
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.frameworks.json.JsonDefaultHandler");
+
/** The key. */
private String key;
@@ -190,7 +194,10 @@
}
catch (NumberFormatException e)
{
- // nothing to do!
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
else
@@ -217,7 +224,10 @@
}
catch (NumberFormatException d)
{
- // nothing to do!
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + d.getMessage());
+ }
}
}
// nothing to do!
@@ -241,7 +251,10 @@
}
catch (NumberFormatException d)
{
- // nothing to do!
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + d.getMessage());
+ }
}
}
}
Modified: ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java
===================================================================
--- ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -19,6 +19,8 @@
package org.exoplatform.ws.frameworks.json.impl;
import org.exoplatform.commons.utils.ClassLoading;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
@@ -53,6 +55,8 @@
SKIP_METHODS.add("setMetaClass");
}
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.frameworks.json.ObjectBuilder");
+
/**
* Create array of Java Object from JSON source include multi-dimension
* array.
@@ -174,7 +178,10 @@
}
catch (Exception e2)
{
- // ignore exception here
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e2.getMessage());
+ }
}
}
}
@@ -283,7 +290,10 @@
}
catch (Exception e2)
{
- // ignore exception here
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e2.getMessage());
+ }
}
}
}
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ConstructorDescriptorImpl.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -262,14 +262,20 @@
Throwable cause = invExc.getCause();
// if WebApplicationException than it may contain response
if (WebApplicationException.class == cause.getClass())
+ {
throw (WebApplicationException)cause;
+ }
throw new InternalException(cause);
}
- catch (Throwable thr)
+ catch (WebApplicationException thr)
{
throw new InternalException(thr);
}
+ catch (InternalException thr)
+ {
+ throw new InternalException(thr);
+ }
}
/**
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.rest.impl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.GenericContainerRequest;
import org.exoplatform.services.rest.impl.header.AcceptLanguage;
import org.exoplatform.services.rest.impl.header.AcceptMediaType;
@@ -108,6 +110,8 @@
*/
private URI baseUri;
+ private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.ContainerRequest");
+
/**
* Constructs new instance of ContainerRequest.
*
@@ -568,7 +572,10 @@
}
catch (IllegalArgumentException e)
{
- // If the specified date is invalid, the header is ignored.
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
return null;
@@ -587,17 +594,23 @@
String ifModified = getRequestHeaders().getFirst(IF_MODIFIED_SINCE);
if (ifModified == null)
+ {
return null;
+ }
try
{
long modifiedSince = HeaderHelper.parseDateHeader(ifModified).getTime();
if (lastModified < modifiedSince)
+ {
return Response.notModified();
-
+ }
}
catch (IllegalArgumentException e)
{
- // If the specified date is invalid, the header is ignored.
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
return null;
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -19,6 +19,8 @@
package org.exoplatform.services.rest.impl;
import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.ApplicationContext;
import org.exoplatform.services.rest.FieldInjector;
import org.exoplatform.services.rest.impl.method.ParameterHelper;
@@ -27,6 +29,7 @@
import org.exoplatform.services.rest.resource.ResourceDescriptorVisitor;
import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
@@ -51,7 +54,7 @@
public class FieldInjectorImpl implements FieldInjector
{
/** Logger. */
- //private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.FieldInjectorImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.FieldInjectorImpl");
/** All annotations including JAX-RS annotation. */
private final Annotation[] annotations;
@@ -152,7 +155,10 @@
}
catch (PrivilegedActionException e)
{
- // Ignore NoSuchMethodException.
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
return setter;
}
@@ -242,11 +248,13 @@
jfield.set(resource, pr.resolve(this, context));
}
}
- catch (Throwable e)
+ catch (Exception e)
{
Class<?> ac = annotation.annotationType();
if (ac == MatrixParam.class || ac == QueryParam.class || ac == PathParam.class)
+ {
throw new WebApplicationException(e, Response.status(Response.Status.NOT_FOUND).build());
+ }
throw new WebApplicationException(e, Response.status(Response.Status.BAD_REQUEST).build());
}
}
@@ -276,10 +284,18 @@
jfield.set(resource, tmp);
}
}
- catch (Throwable e)
+ catch (IllegalAccessException e)
{
throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
}
+ catch (IllegalArgumentException e)
+ {
+ throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new WebApplicationException(e, Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
+ }
}
}
}
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -70,7 +70,9 @@
public InputHeadersMap(Map<String, List<String>> m)
{
if (m == null)
- throw new NullPointerException();
+ {
+ throw new IllegalArgumentException();
+ }
this.m = new HashMap<String, List<String>>(m.size());
for (Map.Entry<String, List<String>> e : m.entrySet())
this.m.put(e.getKey().toLowerCase(), Collections.unmodifiableList(e.getValue()));
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ProviderBinder.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -807,7 +807,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("ContextResolver instance is null.");
+ {
+ throw new IllegalArgumentException("ContextResolver instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -853,7 +855,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("MessageBodyReader instance is null.");
+ {
+ throw new IllegalArgumentException("MessageBodyReader instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -890,7 +894,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("MessageBodyWriter instance is null.");
+ {
+ throw new IllegalArgumentException("MessageBodyWriter instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -947,7 +953,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("ExceptionMapper instance is null.");
+ {
+ throw new IllegalArgumentException("ExceptionMapper instance is null.");
+ }
factory = new SingletonObjectFactory<ProviderDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -980,7 +988,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("RequestFilter instance is null.");
+ {
+ throw new IllegalArgumentException("RequestFilter instance is null.");
+ }
factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -1010,7 +1020,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("ResponseFilter instance is null.");
+ {
+ throw new IllegalArgumentException("ResponseFilter instance is null.");
+ }
factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
break;
case CONTAINER :
@@ -1040,7 +1052,9 @@
break;
case SINGLETON :
if (instance == null)
- throw new NullPointerException("MethodInvokerFilter instance is null.");
+ {
+ throw new IllegalArgumentException("MethodInvokerFilter instance is null.");
+ }
factory = new SingletonObjectFactory<FilterDescriptor>(descriptor, instance);
break;
case CONTAINER :
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -19,6 +19,8 @@
package org.exoplatform.services.rest.impl.header;
import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.header.QualityValue;
import java.text.ParseException;
@@ -49,6 +51,8 @@
public final class HeaderHelper
{
+ private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.HeaderHelper");
+
/**
* Constructor.
*/
@@ -483,7 +487,10 @@
}
catch (ParseException e)
{
- // ignore all ParseException now
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
// no one format was found
throw new IllegalArgumentException("Not found appropriated date format for " + header);
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -590,6 +590,10 @@
}
catch (NoSuchMethodException e)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
}
if (inhMethod == null)
@@ -614,6 +618,10 @@
}
catch (NoSuchMethodException exc)
{
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + exc.getMessage());
+ }
}
}
}
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/header/InputHeadersMapTest.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -45,7 +45,7 @@
um = new InputHeadersMap(null);
fail("NullPointerException should be here");
}
- catch (NullPointerException e)
+ catch (IllegalArgumentException e)
{
}
MultivaluedMap<String, String> m = new MultivaluedMapImpl();
Modified: ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -22,6 +22,8 @@
import groovy.lang.GroovyResourceLoader;
import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -49,6 +51,9 @@
{
private static final String DEFAULT_SOURCE_FILE_EXTENSION = ".groovy";
+ private static final Log LOG = ExoLogger
+ .getLogger("org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoader");
+
public final ConcurrentMap<String, Future<URL>> findResourceURLTasks = new ConcurrentHashMap<String, Future<URL>>();
private int maxEntries = 512;
@@ -146,7 +151,10 @@
}
catch (CancellationException e)
{
- // ignore me
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
}
catch (ExecutionException e)
{
Modified: ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/ResourceKey.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -33,7 +33,7 @@
{
if (name == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
this.name = name;
}
Modified: ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/RestResource.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -242,7 +242,7 @@
}
catch (Exception e)
{
- LOG.error(e);
+ LOG.error(e.getMessage());
return Response.serverError();
}
finally
@@ -259,20 +259,30 @@
Type formType = MultivaluedMapImpl.class.getGenericInterfaces()[0];
MediaType contentType = context.getHttpHeaders().getMediaType();
- if (contentType == null) {
+ if (contentType == null)
+ {
contentType = MediaType.APPLICATION_FORM_URLENCODED_TYPE;
- }
+ }
MultivaluedMap<String, String> form = new MultivaluedMapImpl();
- try {
+ try
+ {
MessageBodyReader reader =
context.getProviders().getMessageBodyReader(MultivaluedMap.class, formType, null, contentType);
- if (reader != null) {
- form = (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, formType, null, contentType, context
- .getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
+ if (reader != null)
+ {
+ form =
+ (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, formType, null, contentType,
+ context.getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
}
- } catch (Exception e) {
}
+ catch (Exception e)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + e.getMessage());
+ }
+ }
parameters.putAll(form);
return parameters;
Modified: ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/management/invocation/SimpleMethodInvoker.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -38,7 +38,7 @@
{
if (method == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
//
Modified: ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2012-01-24 13:00:12 UTC (rev 5509)
+++ ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2012-01-24 13:03:19 UTC (rev 5510)
@@ -110,7 +110,7 @@
else
{
String msg = "XSLT scheme name is null.";
- throw new NullPointerException(msg);
+ throw new IllegalArgumentException(msg);
}
transformer.initResult(new StreamResult(outStream));
if (xsltParams != null)
12 years, 3 months
exo-jcr SVN: r5509 - in core/trunk: exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-01-24 08:00:12 -0500 (Tue, 24 Jan 2012)
New Revision: 5509
Modified:
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipTypeDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/GroupDAOImpl.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipDAOImpl.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipTypeDAOImpl.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserProfileDAOImpl.java
Log:
EXOJCR-1716: changed validation method's parameters, since no need to pass more than one Permission to be validated
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -84,7 +84,7 @@
*/
public void addGroupEventListener(GroupEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.add(listener);
}
@@ -93,7 +93,7 @@
*/
public void removeGroupEventListener(GroupEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -90,7 +90,7 @@
*/
public void addMembershipEventListener(MembershipEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.add(listener);
}
@@ -99,7 +99,7 @@
*/
public void removeMembershipEventListener(MembershipEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipTypeDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipTypeDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipTypeDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -157,7 +157,7 @@
*/
public void addMembershipTypeEventListener(MembershipTypeEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.add(listener);
}
@@ -166,7 +166,7 @@
*/
public void removeMembershipTypeEventListener(MembershipTypeEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -77,7 +77,7 @@
*/
public void addUserEventListener(UserEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.add(listener);
}
@@ -86,7 +86,7 @@
*/
public void removeUserEventListener(UserEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -69,7 +69,7 @@
*/
public void addUserProfileEventListener(UserProfileEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.add(listener);
}
@@ -78,7 +78,7 @@
*/
public void removeUserProfileEventListener(UserProfileEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners_.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/GroupDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/GroupDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/GroupDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -91,7 +91,7 @@
*/
public void addGroupEventListener(GroupEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.add(listener);
}
@@ -100,7 +100,7 @@
*/
public void removeGroupEventListener(GroupEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -101,7 +101,7 @@
*/
public void addMembershipEventListener(MembershipEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.add(listener);
}
@@ -110,7 +110,7 @@
*/
public void removeMembershipEventListener(MembershipEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipTypeDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipTypeDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/MembershipTypeDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -375,7 +375,7 @@
*/
public void addMembershipTypeEventListener(MembershipTypeEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.add(listener);
}
@@ -384,7 +384,7 @@
*/
public void removeMembershipTypeEventListener(MembershipTypeEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -98,7 +98,7 @@
*/
public void addUserEventListener(UserEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.add(listener);
}
@@ -107,7 +107,7 @@
*/
public void removeUserEventListener(UserEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.remove(listener);
}
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserProfileDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserProfileDAOImpl.java 2012-01-24 12:58:34 UTC (rev 5508)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserProfileDAOImpl.java 2012-01-24 13:00:12 UTC (rev 5509)
@@ -256,7 +256,7 @@
*/
public void addUserProfileEventListener(UserProfileEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.add(listener);
}
@@ -265,7 +265,7 @@
*/
public void removeUserProfileEventListener(UserProfileEventListener listener)
{
- SecurityHelper.validateSecurityPermissions(new RuntimePermission[]{PermissionConstants.MANAGE_LISTENERS});
+ SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
listeners.remove(listener);
}
12 years, 3 months
exo-jcr SVN: r5508 - kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-01-24 07:58:34 -0500 (Tue, 24 Jan 2012)
New Revision: 5508
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
Log:
EXOJCR-1716: changed validation method's parameters, since no need to pass more than one Permission to be validated
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java 2012-01-24 12:41:30 UTC (rev 5507)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java 2012-01-24 12:58:34 UTC (rev 5508)
@@ -325,15 +325,12 @@
*
* @throws AccessControlException
*/
- public static void validateSecurityPermissions(RuntimePermission... perms)
+ public static void validateSecurityPermission(Permission permission)
{
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- for (Permission permission : perms)
- {
- security.checkPermission(permission);
- }
+ security.checkPermission(permission);
}
}
}
12 years, 3 months