Uploaded image for project: 'Pentaho Data Integration - Kettle'
  1. Pentaho Data Integration - Kettle
  2. PDI-17635

Coding flaw in KFDialog could prevent seed from being used

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Unknown
    • Resolution: Fixed
    • Affects Version/s: 8.1.0 GA, Master
    • Fix Version/s: 8.2.0 GA
    • Component/s: Step
    • Labels:
    • Story Points:
      0
    • PDI Sub-component:
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.

      Description

      Seen during code review for invalid integer conversion, strumbled upon KFDialog here:
      https://github.com/pentaho/pentaho-data-mining-ee/blob/master/pdi-weka-knowledge-flow-plugin-ee/impl/src/main/java/org/pentaho/di/kf/KFDialog.java#L1547-L1554

      Is:

          try {
            Integer.parseInt( m_wSampleSize.getText() );
            m_currentMeta.setSampleSize( m_wSampleSize.getText() );
            Integer.parseInt( m_wSeed.getText() );
            m_currentMeta.setRandomSeed( m_wSeed.getText() );
          } catch ( NumberFormatException ex ) {
            // leave at default if we can't parse it
          }
      

      The problem here is that if the sample size fails to parse as a number, it never examines and sets the seed. That's a real problem.

      Should Be

          try {
            Integer.parseInt( m_wSampleSize.getText() );
            m_currentMeta.setSampleSize( m_wSampleSize.getText() );
          } catch ( NumberFormatException ex ) {
            // leave at default if we can't parse it
          }
          try {
            Integer.parseInt( m_wSeed.getText() );
            m_currentMeta.setRandomSeed( m_wSeed.getText() );
          } catch ( NumberFormatException ex ) {
            // leave at default if we can't parse it
          }
      

        Attachments

          Activity

            People

            Assignee:
            rrosinha Ricardo Rosinha
            Reporter:
            mbatchelor Marc Batchelor (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: