diff --git a/pom.xml b/pom.xml
index 925e666..089aaf5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,14 +8,14 @@
jar
- asm
+ org.ow2.asm
asm
- 3.3.1
+ 9.7
junit
junit
- 4.11
+ 4.13.2
test
@@ -26,8 +26,8 @@
maven-compiler-plugin
3.0
- 1.6
- 1.6
+ 17
+ 17
UTF-8
diff --git a/src/main/java/com/taobao/profile/analysis/ProfilerLogAnalysis.java b/src/main/java/com/taobao/profile/analysis/ProfilerLogAnalysis.java
index 03e1a2e..2137675 100644
--- a/src/main/java/com/taobao/profile/analysis/ProfilerLogAnalysis.java
+++ b/src/main/java/com/taobao/profile/analysis/ProfilerLogAnalysis.java
@@ -77,11 +77,12 @@ public List getTimeSortData() {
* 读取log,并解析
*/
private void reader() {
- BufferedReader reader = null;
+ // 首先读取方法路径文件
+ BufferedReader methodReader = null;
try {
- reader = new BufferedReader(new FileReader(methodPath));
+ methodReader = new BufferedReader(new FileReader(methodPath));
String line = null;
- while ((line = reader.readLine()) != null) {
+ while ((line = methodReader.readLine()) != null) {
if (line.startsWith("instrument")) {
continue;
}
@@ -91,11 +92,26 @@ private void reader() {
}
methodIdMap.put(Long.parseLong(data[0]), String.valueOf(data[1]));
}
- reader.close();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (methodReader != null) {
+ try {
+ methodReader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
- reader = new BufferedReader(new FileReader(logPath));
- line = null;
- while ((line = reader.readLine()) != null) {
+ // 然后读取日志路径文件
+ BufferedReader logReader = null;
+ try {
+ logReader = new BufferedReader(new FileReader(logPath));
+ String line = null;
+ while ((line = logReader.readLine()) != null) {
if (line.startsWith("##")) {
line = line.substring(line.indexOf(":") + 1, line.length());
if (line.equals("true")) {
@@ -121,9 +137,9 @@ private void reader() {
} catch (IOException e) {
e.printStackTrace();
} finally {
- if (reader != null) {
+ if (logReader != null) {
try {
- reader.close();
+ logReader.close();
} catch (IOException e) {
e.printStackTrace();
}