camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hadrian Zbarcea <hzbar...@gmail.com>
Subject Re: Need your help on camel-scala!
Date Wed, 11 Jan 2012 17:10:11 GMT
Hi Babak,

It's a fairly simple fix. Please feel free to attach your patch to the 
jira as is and I can take care of it. For reference, please find my 
fixes below (inline instead of attachment). I hope it's pretty self 
explanatory, but if you have any questions please feel free to ask.

Cheers,
Hadrian


diff --git 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala 
b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
index 6ceb6f6..d65ac2c 100644
--- 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
+++ 
b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
@@ -45,7 +45,7 @@ trait DSL {

    def filter(predicate: Exchange => Any) : SFilterDefinition

-  def handle[E](block: => Unit)(implicit manifest: Manifest[E]) : 
SOnExceptionDefinition
+  def handle[E <: Throwable](block: => Unit)(implicit manifest: 
Manifest[E]) : SOnExceptionDefinition

    def id(id : String): DSL
    def idempotentConsumer(expression: Exchange => Any): 
SIdempotentConsumerDefinition
diff --git 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala

b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
index d731388..7865c0a 100644
--- 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
+++ 
b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
@@ -74,7 +74,7 @@ abstract class SAbstractDefinition[P <: 
ProcessorDefinition[_]] extends DSL with

    def filter(predicate: Exchange => Any) = 
SFilterDefinition(target.filter(predicateBuilder(predicate)))

-  def handle[E](block: => Unit)(implicit manifest: Manifest[E]) = 
SOnExceptionDefinition(target.onException(manifest.erasure)).apply(block)
+  def handle[E <: Throwable](block: => Unit)(implicit manifest: 
Manifest[E]) = 
SOnExceptionDefinition(target.onException(manifest.erasure.asInstanceOf[Class[Throwable]])).apply(block)

    def id(id : String) = wrap(target.id(id))
    def idempotentConsumer(expression: Exchange => Any) = 
SIdempotentConsumerDefinition(target.idempotentConsumer(expression, null))
diff --git 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala 
b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala
index 3400392..54d2d3f 100644
--- 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala
+++ 
b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala
@@ -26,7 +26,7 @@ case class STryDefinition(override val target: 
TryDefinition)(implicit val build

    override def apply(block: => Unit) : STryDefinition = 
super.apply(block).asInstanceOf[STryDefinition]

-  def handle[Target](exception: Class[Target]) = {
+  def handle[Target <: Throwable](exception: Class[Target]) = {
      target.doCatch(exception)
      this
    }
diff --git 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala

b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
index 27e0d0e..d066ec2 100644
--- 
a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
+++ 
b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
@@ -82,9 +82,9 @@ class RouteBuilder extends Preamble with DSL with 
RoutesBuilder with Languages w
     * This is done a bit differently - the implicit manifest parameter 
forces us to define the block in the same
     * method definition
     */
-  def handle[E](block: => Unit)(implicit manifest: Manifest[E]) = {
+  def handle[E <: Throwable](block: => Unit)(implicit manifest: 
Manifest[E]) = {
      stack.size match {
-      case 0 => 
SOnExceptionDefinition(builder.onException(manifest.erasure))(this).apply(block)
+      case 0 => 
SOnExceptionDefinition(builder.onException(manifest.erasure.asInstanceOf[Class[Throwable]]))(this).apply(block)
        case _ => stack.top.handle[E](block)
      }
    }




On 01/11/2012 07:39 AM, Babak Vahdat wrote:
> Hi
>
> Just in case somebody intends to help out on this issue here is
> http://camel.465427.n5.nabble.com/file/n5136738/camel-scala-problem.diff
> camel-scala-problem.diff  the diff of my workspace which contains *only* the
> changes regarding this issue I've already mentioned by this thread.
>
> The steps to reproduce the problem on your workspace:
>
> - Apply the patch on your workspace
> - By the camel-core module do a "mvn clean install -Pfastinstall"
> - On camel-scala module do a "mvn clean install" to see the Scala-Compiler
> errors.
>
> As you see *one* of the good side effects by this refactoring is the removal
> of CastUtils.cast() stuff.
>
> Babak
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Need-your-help-on-camel-scala-tp5134007p5136738.html
> Sent from the Camel Development mailing list archive at Nabble.com.

-- 
Hadrian Zbarcea
Principal Software Architect
Talend, Inc
http://coders.talend.com/
http://camelbot.blogspot.com/

Mime
View raw message