Author: davsclaus
Date: Fri Jul 18 11:25:52 2008
New Revision: 677992

URL: http://svn.apache.org/viewvc?rev=677992&view=rev
Log:
CAMEL-737: Applied patch with thanks to William Tam. Also fixed the same 
problem for LogFormatter. Polished the message if a spring.jar is needed for 
the JMX stuff.

Added:
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteWithTracerTest.java
   (with props)
Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java?rev=677992&r1=677991&r2=677992&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
 Fri Jul 18 11:25:52 2008
@@ -164,7 +164,7 @@
 
     protected Object getBodyTypeAsString(Message message) {
         String answer = ObjectHelper.className(message.getBody());
-        if (answer.startsWith("java.lang.")) {
+        if (answer != null && answer.startsWith("java.lang.")) {
             return answer.substring(10);
         }
         return answer;

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=677992&r1=677991&r2=677992&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 Fri Jul 18 11:25:52 2008
@@ -106,7 +106,9 @@
                 // if we can't instantiate the JMX enabled strategy then 
fallback to default
                 // could be because of missing .jars on the classpath
                 LOG.warn("Could not find needed classes for JMX lifecycle 
strategy."
-                    + " Are you missing spring-context.jar by any chance? 
NoClassDefFoundError: " + e.getMessage());
+                    + " Needed class is in spring-context.jar using Spring 2.5 
or newer ("
+                    + " spring-jmx.jar using Spring 2.0.x)."
+                    + " NoClassDefFoundError: " + e.getMessage());
             } catch (Exception e) {
                 LOG.warn("Could not create JMX lifecycle strategy, caused by: 
" + e.getMessage());
             }

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java?rev=677992&r1=677991&r2=677992&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
 Fri Jul 18 11:25:52 2008
@@ -121,7 +121,7 @@
 
     protected Object getBodyTypeAsString(Message message) {
         String answer = ObjectHelper.className(message.getBody());
-        if (answer.startsWith("java.lang.")) {
+        if (answer != null && answer.startsWith("java.lang.")) {
             return answer.substring(10);
         }
         return answer;

Added: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteWithTracerTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteWithTracerTest.java?rev=677992&view=auto
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteWithTracerTest.java
 (added)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteWithTracerTest.java
 Fri Jul 18 11:25:52 2008
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.timer;
+
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.processor.interceptor.Tracer;
+
+/**
+ * @version $Revision$
+ */
+public class TimerRouteWithTracerTest extends TimerRouteTest {
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                getContext().addInterceptStrategy(new Tracer());
+                
from("timer://foo?fixedRate=true&delay=0&period=500").to("bean:myBean");
+            }
+        };
+    }
+}

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteWithTracerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/timer/TimerRouteWithTracerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date


Reply via email to