DebugDumper.java
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.aemfd.docmanager.Document
*/
package com.adobe.fd.output.internal.utils;
import com.adobe.aemfd.docmanager.Document;
import com.adobe.fd.output.internal.logging.OutputServiceLogger;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class DebugDumper {
OutputServiceLogger logger = new OutputServiceLogger(DebugDumper.class);
File debugDir;
String timestamp;
public DebugDumper(String debugDir) {
if (debugDir != null && !debugDir.trim().isEmpty()) {
this.debugDir = new File(debugDir);
}
this.timestamp = "" + System.nanoTime() + "";
}
public void dump(String fileName, Document doc) {
try {
if (doc != null && this.debugDir != null && this.debugDir.isDirectory()) {
doc.copyToFile(new File(this.debugDir, this.timestamp + "_" + fileName));
}
}
catch (IOException e) {
this.logger.error("AEM_OUT_001_005", new String[]{fileName, this.debugDir + ""}, e);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Loose catch block
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
public void dump(String fileName, byte[] contents) {
if (contents == null) return;
if (this.debugDir == null) return;
if (!this.debugDir.isDirectory()) return;
FileOutputStream fos = null;
fos = new FileOutputStream(new File(this.debugDir, this.timestamp + "_" + fileName));
fos.write(contents);
if (fos == null) return;
try {
fos.close();
return;
}
catch (Exception e) {
this.logger.warn("AEM_OUT_001_003", new String[]{e.getMessage()}, e);
return;
}
catch (Exception e) {
try {
this.logger.error("AEM_OUT_001_005", new String[]{fileName, this.debugDir + ""}, e);
if (fos == null) return;
}
catch (Throwable var5_7) {
if (fos == null) throw var5_7;
try {
fos.close();
throw var5_7;
}
catch (Exception e) {
this.logger.warn("AEM_OUT_001_003", new String[]{e.getMessage()}, e);
}
throw var5_7;
}
try {
fos.close();
return;
}
catch (Exception e) {
this.logger.warn("AEM_OUT_001_003", new String[]{e.getMessage()}, e);
return;
}
}
}
}