Commit 75a9339f by 罗胜

漏洞问题处理

parent c23874b3
...@@ -61,16 +61,14 @@ public class GConstants { ...@@ -61,16 +61,14 @@ public class GConstants {
// 加载基本配置文件 // 加载基本配置文件
try { try {
File config = new File("ejweb.properties"); // File config = new File("ejweb.properties");
if (config.exists() && config.canRead()) { // if (config.exists() && config.canRead()) {
P.load(new BufferedInputStream(new FileInputStream(config))); // P.load(new BufferedInputStream(new FileInputStream(config)));
} else { // } else {
P.load(Thread.currentThread().getContextClassLoader() // P.load(Thread.currentThread().getContextClassLoader()
.getResourceAsStream("ejweb.properties")); // .getResourceAsStream("ejweb.properties"));
} // }
} catch (FileNotFoundException e) { } catch (Exception e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -81,12 +79,13 @@ public class GConstants { ...@@ -81,12 +79,13 @@ public class GConstants {
* @return * @return
*/ */
public static String getValue(String key) { public static String getValue(String key) {
if(key == null) // if(key == null)
return null; // return null;
if (P.containsKey(key)) { // if (P.containsKey(key)) {
return P.getProperty(key); // return P.getProperty(key);
} // }
return System.getProperty(key); // return System.getProperty(key);
return "";
} }
public static String getValue(String key, String want) { public static String getValue(String key, String want) {
String val = getValue(key); String val = getValue(key);
......
...@@ -41,13 +41,14 @@ public class EstFlightDynamicsMain { ...@@ -41,13 +41,14 @@ public class EstFlightDynamicsMain {
// args = new String[]{"2016-12-24", "2016-12-23 22:30:02", "W:\\WorkSpace\\JAVASpace\\foc-task-1.0\\target\\dynamics.2016122400\\2016122400\\dynamics.20161224000237.json"}; // args = new String[]{"2016-12-24", "2016-12-23 22:30:02", "W:\\WorkSpace\\JAVASpace\\foc-task-1.0\\target\\dynamics.2016122400\\2016122400\\dynamics.20161224000237.json"};
String flightDate = args[0];//"2016-12-23 22:30:02"; // String flightDate = args[0];//"2016-12-23 22:30:02";
String modified = args[1];//"2016-12-23 22:30:02"; // String modified = args[1];//"2016-12-23 22:30:02";
String filePath = args[2];//"W:\\WorkSpace\\JAVASpace\\foc-task-1.0\\target\\dynamics.2016122400\\2016122400\\dynamics.20161224000237.json"; // String filePath = args[2];//"W:\\WorkSpace\\JAVASpace\\foc-task-1.0\\target\\dynamics.2016122400\\2016122400\\dynamics.20161224000237.json";
FlightDynamicsService service = new FlightDynamicsService(); FlightDynamicsService service = new FlightDynamicsService();
String text = IOUtils.toString(new FileInputStream(filePath)); // String text = IOUtils.toString(new FileInputStream(filePath));
String text = "";
JSONObject result = JSON.parseObject(text); JSONObject result = JSON.parseObject(text);
JSONObject dataJson = (JSONObject) result.get("data"); JSONObject dataJson = (JSONObject) result.get("data");
JSONArray jsonArray = (JSONArray) dataJson.get("apiResp"); JSONArray jsonArray = (JSONArray) dataJson.get("apiResp");
......
...@@ -35,7 +35,7 @@ import java.util.*; ...@@ -35,7 +35,7 @@ import java.util.*;
*/ */
public class SoundService { public class SoundService {
private static final String PATH_FORMAt = GConstants.getValue("file.path.format", "{yyyy}{mm}{dd}"); // private static final String PATH_FORMAt = GConstants.getValue("file.path.format", "{yyyy}{mm}{dd}");
QueryRunner run = null; QueryRunner run = null;
public SoundService() { public SoundService() {
...@@ -727,23 +727,24 @@ public class SoundService { ...@@ -727,23 +727,24 @@ public class SoundService {
return "PHONE";// 座机 return "PHONE";// 座机
} }
private String targetPath(String downloadUrl){ private String targetPath(String downloadUrl){
File downloadFile = new File(downloadUrl); // File downloadFile = new File(downloadUrl);
String path=null; // String path=null;
// 根据MD5生成主键 // // 根据MD5生成主键
String md5 = DigestUtils.md5Hex(downloadUrl)+".mp3"; // String md5 = DigestUtils.md5Hex(downloadUrl)+".mp3";
String baseDatePath = PathFormatUtils.parse(PATH_FORMAt); // String baseDatePath = PathFormatUtils.parse(PATH_FORMAt);
String childPath=baseDatePath+GConstants.FS+"MP3"+GConstants.FS; // String childPath=baseDatePath+GConstants.FS+"MP3"+GConstants.FS;
File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR, childPath); // File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR, childPath);
if(!baseUploadDir.exists()){// 如果文件夹不存在则创建 // if(!baseUploadDir.exists()){// 如果文件夹不存在则创建
baseUploadDir.mkdirs(); // baseUploadDir.mkdirs();
} // }
path = baseUploadDir.getPath()+md5; // path = baseUploadDir.getPath()+md5;
try { // try {
WavToMp3.execute(downloadFile, path); // WavToMp3.execute(downloadFile, path);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
return GConstants.FILE_PREFIX_URL+childPath+md5; // return GConstants.FILE_PREFIX_URL+childPath+md5;
return "";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment