Fixed 30055. Fix all warnings in src-trl
authorStefan Hühner <stefan.huehner@openbravo.com>
Sun, 31 May 2015 14:06:56 +0200
changeset 26843 1474b680f216
parent 26842 ada6ae238e94
child 26844 e46899b00411
Fixed 30055. Fix all warnings in src-trl

Two types of changes:
- Remove variables which are never read
- Do not assign to parameters, copy to local var instead
References of parameters cannot be modified in java
Content of objects passed in can be, however in all this
cases object are String which are immutable
Same fix always: Copy of local variable keeping name
of old param as new variable name to reduce diff to review.
- That avoid any developer confusing maybe thinking change
of param would be visible in caller.
src-trl/src/org/openbravo/translate/RTLSkin.java
src-trl/src/org/openbravo/translate/Translate.java
--- a/src-trl/src/org/openbravo/translate/RTLSkin.java	Sun May 31 13:33:21 2015 +0200
+++ b/src-trl/src/org/openbravo/translate/RTLSkin.java	Sun May 31 14:06:56 2015 +0200
@@ -38,7 +38,6 @@
   static int count = 0;
   private static String srcDirRTLSkin = "";
   private static String srcDirLTRSkin = "";
-  private static String srcDirOrig = "";
   private static Vector<String> vImagesToFlip;
 
   static Logger log4j = Logger.getLogger(Translate.class);
@@ -85,7 +84,6 @@
     File fileLTRSrcDeep, fileRTLSrcDeep;
 
     for (int i = 0; i < files.length; i++) {
-      String pathModule = "";
       log4j.info("Processing RTL skin " + files[i]);
       vImagesToFlip = new Vector<String>();
       fImagesToFlip = new File(srcDirRTLSkin + "/" + files[i] + "/RTLFlippedImages.txt");
@@ -96,7 +94,6 @@
         if (strDirModule.list().length == 1 && strDirModule.isDirectory()) {
           fImagesToFlip = new File(srcDirRTLSkin + "/" + files[i] + "/" + strDirModule.list()[0]
               + "/RTLFlippedImages.txt");
-          pathModule = srcDirRTLSkin + "/" + files[i] + "/" + strDirModule.list()[0];
         } else {
           log4j.error("Not Founded File with images to flip! " + srcDirRTLSkin + "/" + files[i]
               + "/RTLFlippedImages.txt");
@@ -143,14 +140,16 @@
    * @param strSkinFolderName
    *          Path to the folder that contains the original skin -where no change will be
    *          performed-.
-   * @param relativePath
+   * @param _relativePath
    *          Relative Path.
    * @param folderContentType
    *          whether skin or javascript folder is passed in srcDir
    */
-  public static void runFolders(File srcDir, String strSkinFolderName, String relativePath,
+  public static void runFolders(File srcDir, String strSkinFolderName, String _relativePath,
       String folderContentType) {
 
+    String relativePath = _relativePath;
+
     File[] list = srcDir.listFiles();
 
     for (int i = 0; i < list.length; i++) {
--- a/src-trl/src/org/openbravo/translate/Translate.java	Sun May 31 13:33:21 2015 +0200
+++ b/src-trl/src/org/openbravo/translate/Translate.java	Sun May 31 14:06:56 2015 +0200
@@ -211,11 +211,12 @@
    *          If is filtered.
    * @param dirFilter
    *          Filter to apply.
-   * @param relativePath
+   * @param _relativePath
    *          The relative path.
    */
   private static void listDir(File file, boolean boolFilter, DirFilter dirFilter,
-      String relativePath, boolean parse, String parent, int level, String module) {
+      String _relativePath, boolean parse, String parent, int level, String module) {
+    String relativePath = _relativePath;
     File[] list;
     if (boolFilter)
       list = file.listFiles(dirFilter);
@@ -293,12 +294,13 @@
    * 
    * @param fileParsing
    *          File to parse.
-   * @param relativePath
+   * @param _relativePath
    *          The relative path.
    */
-  private static void parseFile(File fileParsing, String relativePath, String parent, String module) {
+  private static void parseFile(File fileParsing, String _relativePath, String parent, String module) {
     if (!translateModule)
       return;
+    String relativePath = _relativePath;
     final String strFileName = fileParsing.getName();
     if (log4j.isDebugEnabled())
       log4j.debug("Parsing of " + strFileName);
@@ -530,15 +532,16 @@
   /**
    * This method is the one in charge of the translation of the found text.
    * 
-   * @param ini
+   * @param input
    *          String with the text to translate.
    * @param isPartial
    *          Indicates if the text passed is partial text or the complete one found in the element
    *          content.
    */
-  private void translate(String ini, boolean isPartial) {
+  private void translate(String input, boolean isPartial) {
     if (!translateModule)
       return;
+    String ini = input;
     ini = replace(replace(ini.trim(), "\r", ""), "\n", " ");
     ini = ini.trim();
     ini = delSp(ini);
@@ -559,10 +562,9 @@
     final Vector<String> translated = new Vector<String>(0);
     boolean aux = true;
     translated.addElement("Y");
-    String resultado = ini;
     if (!ini.equals("") && !ini.toLowerCase().startsWith("xx") && !isNumeric(ini)) {
       log4j.debug("Translating " + ini + " for file" + actualFile + " moduleLang:" + moduleLang);
-      resultado = tokenize(ini, 0, translated);
+      tokenize(ini, 0, translated);
       try {
         aux = translated.elementAt(0).equals("Y");
         if (moduleLang == null || moduleLang.equals("")) {