Changeset 33758
- Timestamp:
- 2019-12-07T01:56:06+13:00 (4 years ago)
- 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 64 64 ArrayList description_elements_list = null; 65 65 66 System.err.println("Looking for key " + file_relative_path);66 ///System.err.println("Looking for key " + file_relative_path); 67 67 description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(file_relative_path); 68 68 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); 70 70 return description_elements_list; 71 71 } 72 72 else if(!Utility.isWindows()) { // couldn't find a matching key, we're done 73 System.err.println("Unable to findmeta 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); 74 74 return null; 75 75 } … … 92 92 } 93 93 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."); 95 95 description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(win_short_file_relative_path); 96 96 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); 98 98 return description_elements_list; // found 99 99 } … … 120 120 121 121 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."); 123 123 description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(path); 124 124 125 125 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); 127 127 return description_elements_list; // found 128 128 } … … 130 130 // try the other combination 131 131 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."); 133 133 description_elements_list = (ArrayList) source_file_name_to_description_elements_mapping.get(path); 134 134 135 135 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); 137 137 return description_elements_list; // found 138 138 } 139 139 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 141 145 } 142 146 … … 153 157 } 154 158 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 ///} 158 162 159 163 // Check whether this file (i.e. doc.xml or docmets.xml on inheritance) file contains extracted metadata for the specified file … … 162 166 if (description_elements_list == null) { 163 167 // ...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 }168 168 return metadata_values; // we're done 169 169 } … … 363 363 } 364 364 365 System.err.println("@@@@ Found gsdlsourcefilename: " + gsdlsourcefilename_value);365 ///System.err.println("@@@@ Found gsdlsourcefilename: " + gsdlsourcefilename_value); 366 366 // Remember this for quick access later 367 367 if (source_file_name_to_description_elements_mapping.get(gsdlsourcefilename_value) == null) { … … 467 467 // General info: https://stackoverflow.com/questions/43089541/difference-between-basic-and-url-base64-encoding-in-java-8 468 468 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"))); 471 471 // Using system file.encoding to interpret the resulting bytestring as a String, 472 472 // just as we always did with URL decoding method … … 485 485 decoded_gsdlsourcefilename += file_ext; 486 486 487 System.err.println("@@@@ decoded_gsdlsourcefilename: " + Utility.debugUnicodeString(decoded_gsdlsourcefilename));487 ///System.err.println("@@@@ decoded_gsdlsourcefilename: " + Utility.debugUnicodeString(decoded_gsdlsourcefilename)); 488 488 489 489 return decoded_gsdlsourcefilename; -
main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r33757 r33758 147 147 throws IOException, InterruptedException { 148 148 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 */168 149 String path = getAbsolutePath(fileName); 169 150
Note:
See TracChangeset
for help on using the changeset viewer.