Changeset 33758 for main/trunk


Ignore:
Timestamp:
2019-12-07T01:56:06+13:00 (4 years ago)
Author:
ak19
Message:

Removed debugging and last bit of cleanup.

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/metadata/DocXMLFile.java

    r33757 r33758  
    6464        ArrayList description_elements_list = null;
    6565               
    66         System.err.println("Looking for key " + file_relative_path);
     66        ///System.err.println("Looking for key " + file_relative_path);
    6767        description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(file_relative_path);
    6868        if(description_elements_list != null) {
    69             System.err.println("   Found key matching REGULAR filepath: " + file_relative_path);
     69            ///System.err.println("   Found key matching REGULAR filepath: " + file_relative_path);
    7070            return description_elements_list;           
    7171        }
    7272        else if(!Utility.isWindows()) { // couldn't find a matching key, we're done
    73             System.err.println("Unable to find meta for regular file path form " + file_relative_path);
     73            ///System.err.println("Unable to find ex.meta for regular file path form " + file_relative_path);
    7474            return null;
    7575        }
     
    9292        }
    9393           
    94         System.err.println("### Looking for Windows short file name |" + win_short_file_relative_path +  "| in map of sourcefilenames to doc.xml's ex meta.");
     94        ///System.err.println("### Looking for Windows short file name |" + win_short_file_relative_path +  "| in map of sourcefilenames to doc.xml's ex meta.");
    9595        description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(win_short_file_relative_path);
    9696        if (description_elements_list != null) {
    97             System.err.println("   Found key matching FULL win shortfile path: " + win_short_file_relative_path);
     97            ///System.err.println("   Found key matching FULL win shortfile path: " + win_short_file_relative_path);
    9898            return description_elements_list; // found
    9999        }
     
    120120       
    121121        String path = shortFileRelDirPath + fileTailName;
    122         System.err.println("### Looking for Windows short file name |" + path +  "| in map of sourcefilenames to doc.xml's ex meta.");
     122        ///System.err.println("### Looking for Windows short file name |" + path +  "| in map of sourcefilenames to doc.xml's ex meta.");
    123123        description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(path);
    124124       
    125125        if(description_elements_list != null) {
    126             System.err.println("   Found key matching MIX of win shortfile path and regular path: " + path);
     126            ///System.err.println("   Found key matching MIX of win shortfile path and regular path: " + path);
    127127            return description_elements_list; // found
    128128        }
     
    130130        // try the other combination
    131131        path = fileRelDirPath + shortFileTailName;
    132         System.err.println("### Looking for Windows short file name |" + path +  "| in map of sourcefilenames to doc.xml's ex meta.");
     132        ///System.err.println("### Looking for Windows short file name |" + path +  "| in map of sourcefilenames to doc.xml's ex meta.");
    133133        description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(path);
    134134       
    135135        if(description_elements_list != null) {
    136             System.err.println("   Found key matching MIX of regular path and win shortfile path: " + path);
     136            ///System.err.println("   Found key matching MIX of regular path and win shortfile path: " + path);
    137137            return description_elements_list; // found
    138138        }       
    139139       
    140         return description_elements_list;
     140        // could not find gsdlsourcefilename in map
     141        ///System.err.println("Unable to find ex.meta for regular file path form " + file_relative_path);
     142        ///System.err.println("    Or for windows shortFile path form, or for combinations with regular file path form");       
     143       
     144        return description_elements_list; // returns null at this point
    141145    }
    142146   
     
    153157    }
    154158
    155     for (Object relFilename : source_file_name_to_description_elements_mapping.keySet()) {
    156         System.err.println("\n@@@ relFilename: " + relFilename);
    157     }
     159    ///for (Object relFilename : source_file_name_to_description_elements_mapping.keySet()) {
     160    ///    System.err.println("\n@@@ relFilename: " + relFilename);
     161    ///}
    158162   
    159163    // Check whether this file (i.e. doc.xml or docmets.xml on inheritance) file contains extracted metadata for the specified file
     
    162166    if (description_elements_list == null) {
    163167            // ...it doesn't
    164             System.err.println("Unable to find meta for (regular file path form) " + file_relative_path);
    165             if(Utility.isWindows()) {
    166                 System.err.println("    Or for windows shortFile path form, or for combinations with regular file path form");
    167             }
    168168            return metadata_values; // we're done
    169169    }
     
    363363            }
    364364           
    365             System.err.println("@@@@ Found gsdlsourcefilename: " + gsdlsourcefilename_value);
     365            ///System.err.println("@@@@ Found gsdlsourcefilename: " + gsdlsourcefilename_value);
    366366            // Remember this for quick access later
    367367            if (source_file_name_to_description_elements_mapping.get(gsdlsourcefilename_value) == null) {
     
    467467        // General info: https://stackoverflow.com/questions/43089541/difference-between-basic-and-url-base64-encoding-in-java-8
    468468        byte[] bytes = Base64.decodeBase64(importFilePathParts[i].getBytes());
    469         System.err.println("Got base64 string: " + importFilePathParts[i]);
    470         System.err.println("Decoded from base64 to bytes: " + new String(bytes, System.getProperty("file.encoding")));
     469        ///System.err.println("Got base64 string: " + importFilePathParts[i]);
     470        ///System.err.println("Decoded from base64 to bytes: " + new String(bytes, System.getProperty("file.encoding")));
    471471        // Using system file.encoding to interpret the resulting bytestring as a String,
    472472        // just as we always did with URL decoding method
     
    485485    decoded_gsdlsourcefilename += file_ext;
    486486   
    487     System.err.println("@@@@ decoded_gsdlsourcefilename: " + Utility.debugUnicodeString(decoded_gsdlsourcefilename));
     487    ///System.err.println("@@@@ decoded_gsdlsourcefilename: " + Utility.debugUnicodeString(decoded_gsdlsourcefilename));
    488488
    489489    return decoded_gsdlsourcefilename;
  • main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r33757 r33758  
    147147        throws IOException, InterruptedException {
    148148
    149         /*
    150         String path = getAbsolutePath(fileName);
    151        
    152         changed "+ fileName.toUpperCase() +" to "path"
    153         Process process =
    154             Runtime.getRuntime().exec(
    155                 "cmd /c for %I in (\"" + path + "\") do @echo %~fsI");
    156        
    157         process.waitFor();
    158        
    159         byte[] data = new byte[65536];
    160         int size = process.getInputStream().read(data);
    161 
    162         if (size <= 0) {
    163             return null;
    164         }
    165 
    166         return new String(data, 0, size).replaceAll("\\r\\n", "");
    167         */
    168149        String path = getAbsolutePath(fileName);
    169150       
Note: See TracChangeset for help on using the changeset viewer.