Uploaded image for project: 'Apache Hop (Retired)'
  1. Apache Hop (Retired)
  2. HOP-3772

Using unassigned variable in User Defined Java Class totally hangs GUI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Migrated to GHI
    • GUI
    • None

    Description

      Using a uninitialized variable in a Java class crashes the gui and on restart refuses to draw the diagram of the hop.

      Example of used code where the relevant variable is "val".   If initialized properly everthing is OK.  If not, total misery and loss of your hop if you don't know how to fix it:

        <transform>
          <name>User defined Java class</name>
          <type>UserDefinedJavaClass</type>
          <description/>
          <distribute>Y</distribute>
          <custom_distribution/>
          <copies>1</copies>
          <partitioning>
            <method>none</method>
            <schema_name/>
          </partitioning>
          <definitions>
            <definition>
              <class_type>TRANSFORM_CLASS</class_type>
              <class_name>Processor</class_name>
              <class_source>
      public boolean processRow() throws HopException
      {

        if (first)

      {     first = false;   }

        Object[] r = getRow();

        if (r == null)

      {     setOutputDone();     return false;   }

        Object[] outputRow = createOutputRow(r, data.outputRowMeta.size());

        String val;
        if (false) { val = "Yes"; }
        //else { val = "No"; }
        get(Fields.Out, "val").setValue(outputRow,val);
        putRow(data.outputRowMeta, outputRow);

        return true;
      }
      </class_source>
            </definition>
          </definitions>
          <fields>
            <field>
              <field_name>val</field_name>
              <field_type>String</field_type>
              <field_length>-1</field_length>
              <field_precision>-1</field_precision>
            </field>
          </fields>
          <clear_result_fields>N</clear_result_fields>
          <info_transforms/>
          <target_transforms/>
          <usage_parameters/>
          <attributes/>
          <GUI>
            <xloc>288</xloc>
            <yloc>176</yloc>
          </GUI>
        </transform>
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            wayam02 wayam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: