Uploaded image for project: 'Talend Component Kit'
  1. Talend Component Kit
  2. TCOMP-964

ClassCastException is thrown when non-string values are used as Suggestions method parameter

Details

    • Bug
    • Status: Done
    • Major
    • Resolution: Fixed
    • None
    • 1.0.4
    • None
    • All
    • Small

    Description

      Consider following option:
      @Option
      @Documentation("second primitive value")
      private boolean boolOption = true;

      @Option
      @Documentation("suggestable based on boolean value")
      @Suggestable(value = "basedOnBoolean", parameters =

      {"boolOption"}

      )
      private String basedOnBoolean;

      and action method:
      @Suggestions("basedOnBoolean")
      public SuggestionValues basedOnBoolean(@Option("bool") final boolean flag)

      { https://github.com/Talend/component-runtime-qa/blob/master/components/qa/src/main/java/org/talend/components/qa/actions/QASuggestionsDataset.java#L88-L95 https://github.com/Talend/component-runtime-qa/blob/master/components/qa/src/main/java/org/talend/components/qa/actions/QASuggestionsService.java#L73-L95 when user changes boolean option value following exception is thrown: {code}

      java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
      at org.talend.sdk.component.studio.model.parameter.listener.ActionParametersUpdater.propertyChange(ActionParametersUpdater.java:37)
      at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
      at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:328)
      at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
      at org.talend.sdk.component.studio.model.parameter.TaCoKitElementParameter.firePropertyChange(TaCoKitElementParameter.java:85)
      at org.talend.sdk.component.studio.model.parameter.TaCoKitElementParameter.setValue(TaCoKitElementParameter.java:189)
      at org.talend.sdk.component.studio.model.parameter.CheckElementParameter.setValue(CheckElementParameter.java:50)
      at org.talend.designer.core.ui.editor.nodes.Node.setPropertyValue(Node.java:1968)
      at org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand.execute(PropertyChangeCommand.java:255)
      at org.eclipse.gef.commands.CommandStack.execute(CommandStack.java:199)
      at org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController.executeCommand(AbstractElementPropertySectionController.java:1188)
      at org.talend.designer.core.ui.editor.properties.controllers.CheckController$1.widgetSelected(CheckController.java:216)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4454)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
      at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      at org.talend.rcp.intro.Application.start(Application.java:265)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
      at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

      
      

      this is due there is no conversion from native option type to String in Studio integration

      Attachments

        Activity

          People

            Unassigned Unassigned
            igonchar Ivan Gonchar
            Ivan Gonchar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: