Changeset 2233 for trunk/autoquest-plugin-jfc/src/main/java/de/ugoe
- Timestamp:
- 12/08/17 09:36:26 (7 years ago)
- Location:
- trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDcorrectDirOldJFC.java
r927 r2233 69 69 String absolutPath = folder.getAbsolutePath(); 70 70 String absolutDestPath = destfolder.getAbsolutePath(); 71 for (String filename : folder.list()) { 72 String source = absolutPath + "/" + filename; 73 String dest = absolutDestPath + "/" + filename; 74 Console.traceln(Level.INFO, "Processing file: " + source); 71 String[] children = folder.list(); 72 73 if (children != null) { 74 for (String filename : folder.list()) { 75 String source = absolutPath + "/" + filename; 76 String dest = absolutDestPath + "/" + filename; 77 Console.traceln(Level.INFO, "Processing file: " + source); 75 78 76 corrector.correctFile(source, dest); 79 corrector.correctFile(source, dest); 80 } 77 81 } 78 82 } -
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDparseDirJFC.java
r1179 r2233 69 69 70 70 String absolutPath = folder.getAbsolutePath(); 71 for (String filename : folder.list()) { 72 String source = absolutPath + File.separator + filename; 73 Console.traceln(Level.INFO, "Processing file: " + source); 71 String[] children = folder.list(); 72 73 if (children != null) { 74 for (String filename : children) { 75 String source = absolutPath + File.separator + filename; 76 Console.traceln(Level.INFO, "Processing file: " + source); 74 77 75 try { 76 parser.parseFile(source); 77 } 78 catch (Exception e) { 79 Console.printerrln("Could not parse " + source + ": " + e.getMessage()); 80 } 78 try { 79 parser.parseFile(source); 80 } 81 catch (Exception e) { 82 Console.printerrln("Could not parse " + source + ": " + e.getMessage()); 83 } 84 } 81 85 } 82 86 -
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDparseDirOldJFC.java
r1179 r2233 69 69 70 70 String absolutPath = folder.getAbsolutePath(); 71 for (String filename : folder.list()) { 72 String source = absolutPath + File.separator + filename; 73 Console.traceln(Level.INFO, "Processing file: " + source); 71 String[] children = folder.list(); 72 73 if (children != null) { 74 for (String filename : children) { 75 String source = absolutPath + File.separator + filename; 76 Console.traceln(Level.INFO, "Processing file: " + source); 74 77 75 try { 76 parser.parseFile(source); 77 } 78 catch (Exception e) { 79 Console.printerrln("Could not parse " + source + ": " + e.getMessage()); 78 try { 79 parser.parseFile(source); 80 } 81 catch (Exception e) { 82 Console.printerrln("Could not parse " + source + ": " + e.getMessage()); 83 } 80 84 } 81 85 } -
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDparseJFCDirwithJacaretoIndices.java
r1946 r2233 83 83 84 84 String absolutPath = folder.getAbsolutePath(); 85 for (String filename : folder.list()) { 86 String source = absolutPath + File.separator + filename; 87 Console.traceln(Level.INFO, "Processing file: " + source); 88 89 try { 90 parser.parseFile(source); 91 } 92 catch (Exception e) { 93 Console.printerrln("Could not parse " + source + ": " + e.getMessage()); 85 String[] children = folder.list(); 86 87 if (children != null) { 88 for (String filename : children) { 89 String source = absolutPath + File.separator + filename; 90 Console.traceln(Level.INFO, "Processing file: " + source); 91 92 try { 93 parser.parseFile(source); 94 } 95 catch (Exception e) { 96 Console.printerrln("Could not parse " + source + ": " + e.getMessage()); 97 } 94 98 } 95 99 } -
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDpreprocessDirJFC.java
r927 r2233 69 69 String absolutPathTarget = targetFolder.getAbsolutePath(); 70 70 71 for (String filename : sourceFolder.list()) { 72 String source = absolutPathSource + "/" + filename; 73 Console.traceln(Level.INFO, "Preprocessing file: " + source); 74 File file = new File(source); 75 InputStreamReader reader; 76 try { 77 FileInputStream fis = new FileInputStream(file); 78 reader = new InputStreamReader(fis, "UTF-16"); 79 } catch (FileNotFoundException e) { 80 Console.printerrln(e.getMessage()); 81 return; 82 } catch (UnsupportedEncodingException e) { 83 Console.printerrln(e.getMessage()); 84 return; 85 } 86 char[] buffer = new char[(int) file.length()]; 87 try { 88 reader.read(buffer); 89 reader.close(); 90 } catch (IOException e) { 91 Console.printerrln(e.getMessage()); 92 return; 93 } 71 String[] children = sourceFolder.list(); 72 73 if (children != null) { 74 for (String filename : children) { 75 String source = absolutPathSource + "/" + filename; 76 Console.traceln(Level.INFO, "Preprocessing file: " + source); 77 File file = new File(source); 78 InputStreamReader reader; 79 try { 80 FileInputStream fis = new FileInputStream(file); 81 reader = new InputStreamReader(fis, "UTF-16"); 82 } catch (FileNotFoundException e) { 83 Console.printerrln(e.getMessage()); 84 return; 85 } catch (UnsupportedEncodingException e) { 86 Console.printerrln(e.getMessage()); 87 return; 88 } 89 char[] buffer = new char[(int) file.length()]; 90 try { 91 reader.read(buffer); 92 reader.close(); 93 } catch (IOException e) { 94 Console.printerrln(e.getMessage()); 95 return; 96 } 94 97 95 String content = new String(buffer).trim();98 String content = new String(buffer).trim(); 96 99 97 int index = filename.lastIndexOf('.');98 String target = absolutPathTarget + "/"99 + filename.substring(0, index) + ".xml";100 int index = filename.lastIndexOf('.'); 101 String target = absolutPathTarget + "/" 102 + filename.substring(0, index) + ".xml"; 100 103 101 Console.traceln(Level.INFO, " Saving as: " + target);104 Console.traceln(Level.INFO, " Saving as: " + target); 102 105 103 OutputStreamWriter writer; 104 try { 105 FileOutputStream fos = new FileOutputStream(target); 106 writer = new OutputStreamWriter(fos, "UTF-8"); 107 } catch (IOException e) { 108 Console.printerrln(e.getMessage()); 109 return; 110 } 111 try { 112 writer.write(content); 113 if (!content.endsWith("</sessions>")) { 114 writer.write("</sessions>"); 115 } 116 writer.close(); 117 } catch (IOException e) { 118 Console.printerrln(e.getMessage()); 119 } 106 OutputStreamWriter writer; 107 try { 108 FileOutputStream fos = new FileOutputStream(target); 109 writer = new OutputStreamWriter(fos, "UTF-8"); 110 } catch (IOException e) { 111 Console.printerrln(e.getMessage()); 112 return; 113 } 114 try { 115 writer.write(content); 116 if (!content.endsWith("</sessions>")) { 117 writer.write("</sessions>"); 118 } 119 writer.close(); 120 } catch (IOException e) { 121 Console.printerrln(e.getMessage()); 122 } 123 } 120 124 } 121 125 }
Note: See TracChangeset
for help on using the changeset viewer.