Commit c2c21787 authored by zhangsen's avatar zhangsen

根据代码检查工具处理阻断漏洞 0224

parent 098cbf6c
...@@ -21,7 +21,7 @@ public class AmosThreadPool { ...@@ -21,7 +21,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
...@@ -34,14 +34,12 @@ public class AmosThreadPool { ...@@ -34,14 +34,12 @@ public class AmosThreadPool {
* @return * @return
*/ */
public static AmosThreadPool getInstance() { public static AmosThreadPool getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (AmosThreadPool.class) {
} if (instance == null) {
synchronized (AmosThreadPool.class) { instance = new AmosThreadPool();
if (instance != null) { }
return instance;
} }
instance = new AmosThreadPool();
} }
return instance; return instance;
} }
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
...@@ -42,14 +42,12 @@ public class TriggerKeyQueue { ...@@ -42,14 +42,12 @@ public class TriggerKeyQueue {
* @return * @return
*/ */
public static TriggerKeyQueue getInstance() { public static TriggerKeyQueue getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (TriggerKeyQueue.class) {
} if (instance == null) {
synchronized (TriggerKeyQueue.class) { instance = new TriggerKeyQueue();
if (instance != null) { }
return instance;
} }
instance = new TriggerKeyQueue();
} }
return instance; return instance;
} }
......
...@@ -52,15 +52,16 @@ public class TikaUtils { ...@@ -52,15 +52,16 @@ public class TikaUtils {
ContentHandler handler = new ToHTMLContentHandler(); ContentHandler handler = new ToHTMLContentHandler();
AutoDetectParser parser = new AutoDetectParser(); AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
try (InputStream stream = new FileInputStream(new File(fileName));) { try {
InputStream stream = new FileInputStream(new File(fileName));
InputStream stream2 = new FileInputStream(new File(fileName));
parser.parse(stream, handler, metadata); parser.parse(stream, handler, metadata);
FileHelper.writeFile(handler.toString(), outPutFile + ".html"); FileHelper.writeFile(handler.toString(), outPutFile + ".html");
FileHelper.parse(outPutFile + ".html"); FileHelper.parse(outPutFile + ".html");
return null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return "";
} }
......
...@@ -21,7 +21,7 @@ public class AmosThreadPool { ...@@ -21,7 +21,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
...@@ -34,14 +34,12 @@ public class AmosThreadPool { ...@@ -34,14 +34,12 @@ public class AmosThreadPool {
* @return * @return
*/ */
public static AmosThreadPool getInstance() { public static AmosThreadPool getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (AmosThreadPool.class) {
} if (instance == null) {
synchronized (AmosThreadPool.class) { instance = new AmosThreadPool();
if (instance != null) { }
return instance;
} }
instance = new AmosThreadPool();
} }
return instance; return instance;
} }
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
...@@ -42,14 +42,12 @@ public class TriggerKeyQueue { ...@@ -42,14 +42,12 @@ public class TriggerKeyQueue {
* @return * @return
*/ */
public static TriggerKeyQueue getInstance() { public static TriggerKeyQueue getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (TriggerKeyQueue.class) {
} if (instance == null) {
synchronized (TriggerKeyQueue.class) { instance = new TriggerKeyQueue();
if (instance != null) { }
return instance;
} }
instance = new TriggerKeyQueue();
} }
return instance; return instance;
} }
......
...@@ -20,7 +20,7 @@ public class AmosThreadPool { ...@@ -20,7 +20,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
...@@ -33,14 +33,12 @@ public class AmosThreadPool { ...@@ -33,14 +33,12 @@ public class AmosThreadPool {
* @return * @return
*/ */
public static AmosThreadPool getInstance() { public static AmosThreadPool getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (AmosThreadPool.class) {
} if (instance == null) {
synchronized (AmosThreadPool.class) { instance = new AmosThreadPool();
if (instance != null) { }
return instance;
} }
instance = new AmosThreadPool();
} }
return instance; return instance;
} }
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
...@@ -42,14 +42,12 @@ public class TriggerKeyQueue { ...@@ -42,14 +42,12 @@ public class TriggerKeyQueue {
* @return * @return
*/ */
public static TriggerKeyQueue getInstance() { public static TriggerKeyQueue getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (TriggerKeyQueue.class) {
} if (instance == null) {
synchronized (TriggerKeyQueue.class) { instance = new TriggerKeyQueue();
if (instance != null) { }
return instance;
} }
instance = new TriggerKeyQueue();
} }
return instance; return instance;
} }
......
...@@ -21,7 +21,7 @@ public class AmosThreadPool { ...@@ -21,7 +21,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
...@@ -34,14 +34,12 @@ public class AmosThreadPool { ...@@ -34,14 +34,12 @@ public class AmosThreadPool {
* @return * @return
*/ */
public static AmosThreadPool getInstance() { public static AmosThreadPool getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (AmosThreadPool.class) {
} if (instance == null) {
synchronized (AmosThreadPool.class) { instance = new AmosThreadPool();
if (instance != null) { }
return instance;
} }
instance = new AmosThreadPool();
} }
return instance; return instance;
} }
......
...@@ -17,7 +17,7 @@ public class TriggerKeyQueue { ...@@ -17,7 +17,7 @@ public class TriggerKeyQueue {
/** /**
* 单例 * 单例
*/ */
private static TriggerKeyQueue instance; private static volatile TriggerKeyQueue instance;
/** /**
* 队列 * 队列
...@@ -42,14 +42,12 @@ public class TriggerKeyQueue { ...@@ -42,14 +42,12 @@ public class TriggerKeyQueue {
* @return * @return
*/ */
public static TriggerKeyQueue getInstance() { public static TriggerKeyQueue getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (TriggerKeyQueue.class) {
} if (instance == null) {
synchronized (TriggerKeyQueue.class) { instance = new TriggerKeyQueue();
if (instance != null) { }
return instance;
} }
instance = new TriggerKeyQueue();
} }
return instance; return instance;
} }
......
...@@ -20,7 +20,7 @@ public class AmosThreadPool { ...@@ -20,7 +20,7 @@ public class AmosThreadPool {
/** /**
* 单例 * 单例
*/ */
private static AmosThreadPool instance; private static volatile AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
...@@ -33,14 +33,12 @@ public class AmosThreadPool { ...@@ -33,14 +33,12 @@ public class AmosThreadPool {
* @return * @return
*/ */
public static AmosThreadPool getInstance() { public static AmosThreadPool getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (AmosThreadPool.class) {
} if (instance == null) {
synchronized (AmosThreadPool.class) { instance = new AmosThreadPool();
if (instance != null) { }
return instance;
} }
instance = new AmosThreadPool();
} }
return instance; return instance;
} }
......
...@@ -16,30 +16,30 @@ public class AmosThreadPool { ...@@ -16,30 +16,30 @@ public class AmosThreadPool {
*/ */
private static final Logger log = LoggerFactory.getLogger(AmosThreadPool.class); private static final Logger log = LoggerFactory.getLogger(AmosThreadPool.class);
/**
* 单例
*/
private static AmosThreadPool instance;
/** /**
* 执行服务 * 执行服务
*/ */
private static ExecutorService executorService; private static ExecutorService executorService;
/**
* 单例
*/
private static volatile AmosThreadPool instance;
/** /**
* 获取单例 * 获取单例
* *
* @return * @return
*/ */
public static AmosThreadPool getInstance() { public static AmosThreadPool getInstance() {
if (null != instance) { if (instance == null) {
return instance; synchronized (AmosThreadPool.class) {
} if (instance == null) {
synchronized (AmosThreadPool.class) { instance = new AmosThreadPool();
if (instance != null) { }
return instance;
} }
instance = new AmosThreadPool();
} }
return instance; return instance;
} }
......
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