Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
修正 Oracle 出错反馈
  • Loading branch information
Ch1ngg committed May 24, 2022
1 parent 9b01807 commit 9e430b0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
19 changes: 10 additions & 9 deletions MDAT-DEV/src/main/Plugins/Oracle/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public static String listfile(String dirPath, String encoding){
encoding = "utf-8";
}
String r = "";
File oF = new File(dirPath), l[] = oF.listFiles();
String s = "", sT, sQ, sF = "";
java.util.Date dt;
String fileCode=(String)System.getProperties().get("file.encoding");
SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
File oF = new File(dirPath), l[] = oF.listFiles();
String s = "", sT, sQ, sF = "";
java.util.Date dt;
String fileCode=(String)System.getProperties().get("file.encoding");
SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (int i = 0; i < l.length; i++) {
dt = new java.util.Date(l[i].lastModified());
sT = fm.format(dt);
Expand All @@ -71,7 +71,7 @@ public static String listfile(String dirPath, String encoding){
s += sF;
r = new String(s.getBytes(fileCode), encoding);
}catch (Exception e){
return e.getMessage();
r = "ERROR://" + e.toString();
}
return r;
}
Expand All @@ -81,7 +81,7 @@ public static String getPath() {
try {
result = directory.getAbsolutePath();
} catch (Exception e) {
return e.getMessage();
result = "ERROR://" + e.toString();
}
return result;
}
Expand All @@ -96,7 +96,7 @@ public static String readFile(String filePath){
sb.append(hex);
}
} catch (Exception e) {
sb.append(e.toString());
sb.append("ERROR://" + e.toString());
}
//System.out.println(sb.toString());
return sb.toString();
Expand All @@ -115,7 +115,7 @@ public static String writeFile(String filePath, String fileContext){
}
os.close();
} catch (Exception e) {
return e.getMessage()
r = "ERROR://" + e.toString();
}
return r;
}
Expand All @@ -134,4 +134,5 @@ public static String deleteFile(String path) {
}
return sb.toString();
}

}
1 change: 1 addition & 0 deletions MDAT-DEV/src/main/java/Controller/OracleController.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ public void showFilesOnTable(String path,String code){

if("null".equals(arrayFiles.get(0))){
oracleLogTextArea.appendText(Utils.log("路径读取失败!可能当前路径没有文件!"));
return;
}else {
for (int i = 0; i < arrayFiles.size(); i++) {
String file = arrayFiles.get(i);
Expand Down
4 changes: 4 additions & 0 deletions MDAT-DEV/src/main/java/Dao/OracleDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ public ArrayList<String> getFiles(String path,String code){
String sql = String.format(OracleSqlUtil.getFilesSql,path,code);
try {
tempres = executeSql(sql);
if(tempres.contains("ERROR://")){
oracleController.oracleLogTextArea.appendText(Utils.log("获取所有文件失败!错误:"+ tempres.replace("ERROR://","")));
return res;
}
res = splitFiles(tempres);
} catch (Exception e) {
Platform.runLater(() ->{
Expand Down

0 comments on commit 9e430b0

Please sign in to comment.