camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r937158 - in /camel/trunk/camel-core/src/main/java/org/apache/camel: impl/ language/simple/ processor/aggregate/ util/
Date Fri, 23 Apr 2010 05:19:09 GMT
Author: davsclaus
Date: Fri Apr 23 05:19:08 2010
New Revision: 937158

URL: http://svn.apache.org/viewvc?rev=937158&view=rev
Log:
Fixed shutting down aggregator. More standard classes can be loaded without java.lanng prefix.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java?rev=937158&r1=937157&r2=937158&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java
Fri Apr 23 05:19:08 2010
@@ -255,6 +255,8 @@ public class DefaultExecutorServiceStrat
     }
 
     public void shutdown(ExecutorService executorService) {
+        ObjectHelper.notNull(executorService, "executorService");
+
         if (executorService.isShutdown()) {
             return;
         }
@@ -269,6 +271,8 @@ public class DefaultExecutorServiceStrat
     }
 
     public List<Runnable> shutdownNow(ExecutorService executorService) {
+        ObjectHelper.notNull(executorService, "executorService");
+
         if (executorService.isShutdown()) {
             return null;
         }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java?rev=937158&r1=937157&r2=937158&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
Fri Apr 23 05:19:08 2010
@@ -62,6 +62,7 @@ import org.apache.camel.util.OgnlHelper;
  * <ul>
  *   <li><tt>file:name</tt> to access the file name (is relative, see note
below))</li>
  *   <li><tt>file:name.noext</tt> to access the file name with no extension</li>
+ *   <li><tt>file:name.ext</tt> to access the file extension</li>
  *   <li><tt>file:ext</tt> to access the file extension</li>
  *   <li><tt>file:onlyname</tt> to access the file name (no paths)</li>
  *   <li><tt>file:onlyname.noext</tt> to access the file name (no paths)
with no extension </li>

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java?rev=937158&r1=937157&r2=937158&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java
Fri Apr 23 05:19:08 2010
@@ -173,7 +173,7 @@ public abstract class SimpleLanguageSupp
                         predicate = PredicateBuilder.not(predicate);
                     }
                 } else if (operator == REGEX || operator == NOT_REGEX) {
-                    // reg ex should use String pattern, so we evalute the right hand side
as a String
+                    // reg ex should use String pattern, so we evaluate the right hand side
as a String
                     predicate = PredicateBuilder.regex(left, right.evaluate(exchange, String.class));
                     if (operator == NOT_REGEX) {
                         predicate = PredicateBuilder.not(predicate);
@@ -197,11 +197,7 @@ public abstract class SimpleLanguageSupp
                     String name = right.evaluate(exchange, String.class);
                     Class<?> rightType = exchange.getContext().getClassResolver().resolveClass(name);
                     if (rightType == null) {
-                        // prefix class name with java.lang. so people can use String as
shorthand
-                        rightType = exchange.getContext().getClassResolver().resolveClass("java.lang."
+ name);
-                    }
-                    if (rightType == null) {
-                        throw new IllegalArgumentException("Syntax error in is operator:
" + expression
+                        throw new IllegalArgumentException("Syntax error in " + operatorText
+ " operator: " + expression
                                 + " cannot find class with name: " + name);
                     }
                     predicate = PredicateBuilder.isInstanceOf(left, rightType);
@@ -220,8 +216,8 @@ public abstract class SimpleLanguageSupp
                         predicate = PredicateBuilder.isGreaterThanOrEqualTo(left, from);
                         predicate = PredicateBuilder.and(predicate, PredicateBuilder.isLessThanOrEqualTo(left,
to));
                     } else {
-                        throw new IllegalArgumentException("Syntax error in range operator:
" + expression + " is not valid."
-                                + " Valid syntax: from..to (where from and to are numbers).");
+                        throw new IllegalArgumentException("Syntax error in " + operatorText
+ " operator: " + expression
+                                + " is not valid. Valid syntax:from..to(where from and to
are numbers).");
                     }
                     if (operator == NOT_RANGE) {
                         predicate = PredicateBuilder.not(predicate);
@@ -229,7 +225,7 @@ public abstract class SimpleLanguageSupp
                 }
 
                 if (predicate == null) {
-                    throw new IllegalArgumentException("Unsupported operator: " + operator
+ " for expression: " + expression);
+                    throw new IllegalArgumentException("Unsupported operator: " + operatorText
+ " for expression: " + expression);
                 }
 
                 boolean matches = predicate.matches(exchange);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java?rev=937158&r1=937157&r2=937158&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
Fri Apr 23 05:19:08 2010
@@ -789,7 +789,9 @@ public class AggregateProcessor extends 
 
     @Override
     protected void doStop() throws Exception {
-        camelContext.getExecutorServiceStrategy().shutdownNow(recoverService);
+        if (recoverService != null) {
+            camelContext.getExecutorServiceStrategy().shutdownNow(recoverService);
+        }
         ServiceHelper.stopServices(timeoutMap, processor, deadLetterProcessor);
 
         if (closedCorrelationKeys != null) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=937158&r1=937157&r2=937158&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Fri Apr 23
05:19:08 2010
@@ -291,7 +291,7 @@ public final class ObjectHelper {
      * Asserts whether the string is <b>not</b> empty.
      *
      * @param value  the string to test
-     * @param on     additional description to indicate where this problem occured (appended
as toString())
+     * @param on     additional description to indicate where this problem occurred (appended
as toString())
      * @param name   the key that resolved the value
      * @throws IllegalArgumentException is thrown if assertion fails
      */
@@ -541,12 +541,11 @@ public final class ObjectHelper {
     }
 
     /**
-     * A helper method to access a system property, catching any security
-     * exceptions
+     * A helper method to access a system property, catching any security exceptions
      *
-     * @param name the name of the system property required
+     * @param name         the name of the system property required
      * @param defaultValue the default value to use if the property is not
-     *                available or a security exception prevents access
+     *                     available or a security exception prevents access
      * @return the system property value or the default value if the property is
      *         not available or security does not allow its access
      */
@@ -555,7 +554,7 @@ public final class ObjectHelper {
             return System.getProperty(name, defaultValue);
         } catch (Exception e) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Caught security exception accessing system property: " + name
+ ". Reason: " + e, e);
+                LOG.debug("Caught security exception accessing system property: " + name
+ ". Will use default value: " + defaultValue, e);
             }
             return defaultValue;
         }
@@ -565,9 +564,9 @@ public final class ObjectHelper {
      * A helper method to access a boolean system property, catching any
      * security exceptions
      *
-     * @param name the name of the system property required
+     * @param name         the name of the system property required
      * @param defaultValue the default value to use if the property is not
-     *                available or a security exception prevents access
+     *                     available or a security exception prevents access
      * @return the boolean representation of the system property value or the
      *         default value if the property is not available or security does
      *         not allow its access
@@ -608,7 +607,7 @@ public final class ObjectHelper {
      * loader or the class loader used to load this class
      *
      * @param name the name of the class to load
-     * @return the class or null if it could not be loaded
+     * @return the class or <tt>null</tt> if it could not be loaded
      */
     public static Class<?> loadClass(String name) {
         return loadClass(name, ObjectHelper.class.getClassLoader());
@@ -619,9 +618,8 @@ public final class ObjectHelper {
      * loader or the given class loader
      *
      * @param name the name of the class to load
-     * @param loader the class loader to use after the thread context class
-     *                loader
-     * @return the class or null if it could not be loaded
+     * @param loader the class loader to use after the thread context class loader
+     * @return the class or <tt>null</tt> if it could not be loaded
      */
     public static Class<?> loadClass(String name, ClassLoader loader) {
         return loadClass(name, loader, true);
@@ -632,10 +630,9 @@ public final class ObjectHelper {
      * loader or the given class loader
      *
      * @param name the name of the class to load
-     * @param loader the class loader to use after the thread context class
-     *                loader
-     * @param needToWarn if it is true will use log a warning message for not loading the
class               
-     * @return the class or null if it could not be loaded
+     * @param loader the class loader to use after the thread context class loader
+     * @param needToWarn when <tt>true</tt> logs a warning when a class with
the given name could not be loaded
+     * @return the class or <tt>null</tt> if it could not be loaded
      */
     public static Class<?> loadClass(String name, ClassLoader loader, boolean needToWarn)
{
         // must clean the name so its pure java name, eg removing \n or whatever people can
do in the Spring XML
@@ -649,8 +646,28 @@ public final class ObjectHelper {
             return String.class;
         } else if ("java.lang.Integer".equals(name) || "Integer".equals(name)) {
             return Integer.class;
+        } else if ("int".equals(name)) {
+            return int.class;
         } else if ("java.lang.Long".equals(name) || "Long".equals(name)) {
             return Long.class;
+        } else if ("long".equals(name)) {
+            return long.class;
+        } else if ("java.lang.Short".equals(name) || "Short".equals(name)) {
+            return Short.class;
+        } else if ("short".equals(name)) {
+            return long.class;
+        } else if ("java.lang.Byte".equals(name) || "Byte".equals(name)) {
+            return Byte.class;
+        } else if ("byte".equals(name)) {
+            return byte.class;
+        } else if ("java.lang.Float".equals(name) || "Float".equals(name)) {
+            return Float.class;
+        } else if ("float".equals(name)) {
+            return byte.class;
+        } else if ("java.lang.Double".equals(name) || "Double".equals(name)) {
+            return Double.class;
+        } else if ("double".equals(name)) {
+            return byte.class;
         }
 
         // try context class loader first



Mime
View raw message