Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-2914

Consolidate trim calls

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.1.0
    • None

    Description

      There are some [tTrim] functions across our codebase:

      171-     * @return the formatted time string.
      >> [350] 14:20 : oozie (cdh6.x) :: ack -C8 --type=java "[tT]rim\(String"
      core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProviderFactory.java
      89-    }
      90-
      91-    /**
      92-     * To trim string
      93-     *
      94-     * @param str
      95-     * @return trim string
      96-     */
      97:    public String trim(String str) {
      98-        if (str != null) {
      99-            str = str.replaceAll("\\n", "");
      100-            str = str.replaceAll("\\t", "");
      101-            str = str.trim();
      102-        }
      103-        return str;
      104-    }
      105-}
      
      core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java
      81-    }
      82-
      83-    /**
      84-     * To trim string
      85-     *
      86-     * @param str
      87-     * @return trim string
      88-     */
      89:    public static String Trim(String str) {
      90-        if (str != null) {
      91-            str = str.replaceAll("\\n", "");
      92-            str = str.replaceAll("\\t", "");
      93-            str = str.trim();
      94-        }
      95-        return str;
      96-    }
      97-
      

      The purpose of these functions is to clean up input from xml files.
      They should be consolidated to one place.
      There might be a similar method in Hadoop, we should use that.

      Attachments

        1. OOZIE-2914-1.patch
          10 kB
          Jan Hentschel

        Activity

          People

            janh Jan Hentschel
            gezapeti Gézapeti
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: