Browse Source

无JIRA任务 findbugs问题

final/10.0
Mata.Li 6 years ago
parent
commit
45bfd04215
  1. 16
      designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java
  2. 5
      designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java
  3. 36
      designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java

16
designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java

@ -4,7 +4,11 @@ package com.fr.design.onlineupdate.domain;
* Created by XINZAI on 2018/8/21. * Created by XINZAI on 2018/8/21.
*/ */
import com.fr.third.org.apache.commons.collections4.collection.UnmodifiableCollection;
import com.fr.third.org.apache.commons.collections4.list.UnmodifiableList;
import java.awt.Color; import java.awt.Color;
import java.util.Arrays;
/** /**
* 更新升级的常量 * 更新升级的常量
@ -28,7 +32,7 @@ public interface UpdateConstants {
int BYTE = 153600; int BYTE = 153600;
String[] JARS_FOR_SERVER_X = new String[]{ UnmodifiableList JARS_FOR_SERVER_X = new UnmodifiableList(Arrays.asList(new String[]{
"fine-activator-10.0.jar", "fine-activator-10.0.jar",
"fine-core-10.0.jar", "fine-core-10.0.jar",
"fine-report-engine-10.0.jar", "fine-report-engine-10.0.jar",
@ -41,16 +45,16 @@ public interface UpdateConstants {
"fine-datasource-10.0.jar", "fine-datasource-10.0.jar",
"fine-third-10.0.jar", "fine-third-10.0.jar",
"fine-accumulator-10.0.jar" "fine-accumulator-10.0.jar"
}; }));
String[] JARS_FOR_DESIGNER_X = new String[]{ UnmodifiableList JARS_FOR_DESIGNER_X = new UnmodifiableList(Arrays.asList(new String[]{
"fine-report-designer-10.0.jar", "fine-report-designer-10.0.jar",
"aspectjrt.jar" "aspectjrt.jar"
}; }));
String[] LOG_TYPE = new String[]{ UnmodifiableList LOG_TYPE = new UnmodifiableList(Arrays.asList(new String[]{
"REPORT", "MOBILE", "CHART", "PFC", "BI" "REPORT", "MOBILE", "CHART", "PFC", "BI"
}; }));
} }

5
designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java

@ -27,6 +27,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -161,7 +162,7 @@ public class RestoreResultDialog extends JDialog {
} }
private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, java.util.List<String> list) { private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, java.util.List<String> list) {
String[] files = UpdateConstants.JARS_FOR_DESIGNER_X; List<String> files = UpdateConstants.JARS_FOR_DESIGNER_X;
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
for (String file : files) { for (String file : files) {
map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file),
@ -171,7 +172,7 @@ public class RestoreResultDialog extends JDialog {
} }
private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, java.util.List<String> list) { private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, java.util.List<String> list) {
String[] files = UpdateConstants.JARS_FOR_SERVER_X; List<String> files = UpdateConstants.JARS_FOR_SERVER_X;
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
for (String file : files) { for (String file : files) {
map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file),

36
designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java

@ -58,12 +58,7 @@ import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedReader; import java.io.*;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -443,8 +438,8 @@ public class UpdateMainDialog extends UIDialog {
return; return;
} }
if (cacheFile.exists()) { if (cacheFile.exists()) {
FileReader reader = new FileReader(cacheFile); InputStreamReader streamReader = new InputStreamReader(new FileInputStream(cacheFile), "UTF-8");
BufferedReader br = new BufferedReader(reader); BufferedReader br = new BufferedReader(streamReader);
String readStr, updateTimeStr; String readStr, updateTimeStr;
while ((readStr = br.readLine()) != null) { while ((readStr = br.readLine()) != null) {
@ -466,7 +461,7 @@ public class UpdateMainDialog extends UIDialog {
} }
} }
br.close(); br.close();
reader.close(); streamReader.close();
} }
} }
@ -490,8 +485,8 @@ public class UpdateMainDialog extends UIDialog {
if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) { if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) {
return; return;
} }
FileWriter fileWriter = new FileWriter(cacheFile, true); OutputStreamWriter writerStream = new OutputStreamWriter(new FileOutputStream(cacheFile), "UTF-8");
BufferedWriter bufferWriter = new BufferedWriter(fileWriter); BufferedWriter bufferWriter = new BufferedWriter(writerStream);
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jo = (JSONObject) jsonArray.get(i); JSONObject jo = (JSONObject) jsonArray.get(i);
bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title")); bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title"));
@ -499,7 +494,7 @@ public class UpdateMainDialog extends UIDialog {
bufferWriter.flush(); bufferWriter.flush();
} }
bufferWriter.close(); bufferWriter.close();
fileWriter.close(); writerStream.close();
lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS; lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS;
lastUpdateCacheTime = endTime; lastUpdateCacheTime = endTime;
cacheProperty.updateProperty("updateTime", lastUpdateCacheTime); cacheProperty.updateProperty("updateTime", lastUpdateCacheTime);
@ -678,7 +673,7 @@ public class UpdateMainDialog extends UIDialog {
jarCurrentLabel.setText(downloadFileConfig.optString("buildNO")); jarCurrentLabel.setText(downloadFileConfig.optString("buildNO"));
} }
private void backupFilesFromInstallEnv(String installHome, String todayBackupDir, String[] files) { private void backupFilesFromInstallEnv(String installHome, String todayBackupDir, List<String> files) {
for (String file : files) { for (String file : files) {
try { try {
IOUtils.copy( IOUtils.copy(
@ -690,7 +685,7 @@ public class UpdateMainDialog extends UIDialog {
} }
} }
private void backupFilesFromInstallLib(String installHome, String todayBackupDir, String[] files) { private void backupFilesFromInstallLib(String installHome, String todayBackupDir, List<String> files) {
for (String file : files) { for (String file : files) {
try { try {
IOUtils.copy( IOUtils.copy(
@ -734,21 +729,22 @@ public class UpdateMainDialog extends UIDialog {
} }
//获取服务器jar包列表 //获取服务器jar包列表
private String[] getJARList4Server() { private List<String> getJARList4Server() {
return UpdateConstants.JARS_FOR_SERVER_X; return UpdateConstants.JARS_FOR_SERVER_X;
} }
//获取设计器jar包列表 //获取设计器jar包列表
private String[] getJARList4Designer() { private List<String> getJARList4Designer() {
return UpdateConstants.JARS_FOR_DESIGNER_X; return UpdateConstants.JARS_FOR_DESIGNER_X;
} }
//获取服务器jar包下载列表 //获取服务器jar包下载列表
private String[] getDownLoadJAR4Server() { private String[] getDownLoadJAR4Server() {
ArrayList<String> jarList = new ArrayList<String>(); ArrayList<String> jarList = new ArrayList<String>();
List<String> serverItems = getJARList4Server();
for (DownloadItem downloadItem : downloadItems) { for (DownloadItem downloadItem : downloadItems) {
String downloadItemName = downloadItem.getName(); String downloadItemName = downloadItem.getName();
if (ArrayUtils.contains(getJARList4Server(), downloadItemName)) { if (serverItems.contains(downloadItemName)) {
jarList.add(downloadItemName); jarList.add(downloadItemName);
} }
} }
@ -758,9 +754,10 @@ public class UpdateMainDialog extends UIDialog {
//获取设计器jar包下载列表 //获取设计器jar包下载列表
private String[] getDownLoadJAR4Designer() { private String[] getDownLoadJAR4Designer() {
ArrayList<String> jarList = new ArrayList<String>(); ArrayList<String> jarList = new ArrayList<String>();
List<String> designerJarItems = getJARList4Designer();
for (DownloadItem downloadItem : downloadItems) { for (DownloadItem downloadItem : downloadItems) {
String downloadItemName = downloadItem.getName(); String downloadItemName = downloadItem.getName();
if (ArrayUtils.contains(getJARList4Designer(), downloadItemName)) { if (designerJarItems.contains(downloadItemName)) {
jarList.add(downloadItemName); jarList.add(downloadItemName);
} }
} }
@ -791,7 +788,8 @@ public class UpdateMainDialog extends UIDialog {
//判断是否是有效的日志内容 //判断是否是有效的日志内容
private boolean isValidLogInfo(String logContent) { private boolean isValidLogInfo(String logContent) {
String log = logContent.toUpperCase(); String log = logContent.toUpperCase();
for (String s : UpdateConstants.LOG_TYPE) { List<String> logType = UpdateConstants.LOG_TYPE;
for (String s : logType) {
if (log.startsWith(s)) { if (log.startsWith(s)) {
return true; return true;
} }

Loading…
Cancel
Save