Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-4236

When performing lookup in registry and having expected type as parameter, then report better failure if ClassCastException

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.7.0
    • 2.8.0
    • camel-core
    • None

    Description

      When Camel lookup in the registry, it may lookup in different runtime registries, such as OSGi blueprint. If an explicit type has been provided as a parameter you will get a ClassCastException if the type does not match. But you cannot see which types was a stake. So we should provide a better exception.

      Caused by: java.lang.ClassCastException
      at java.lang.Class.cast(Class.java:2990)[:1.6.0_24]
      at org.apache.camel.blueprint.BlueprintContainerRegistry.lookup(BlueprintContainerRegistry.java:43)
      at org.apache.camel.impl.CompositeRegistry.lookup(CompositeRegistry.java:47)
      at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:54)
      ... 42 more

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: