Skip to content

Commit fc7605e

Browse files
committed
Release 2.0.1
1 parent 5379adc commit fc7605e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

aop/ext.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project.ext {
2-
pluginVersion = '2.0.0'
2+
pluginVersion = '2.0.1'
33
Properties properties = new Properties()
44
if (project.file('local.properties').exists()) {
55
properties.load(project.file('local.properties').newDataInputStream())

aop/src/main/groovy/com/sensorsdata/analytics/android/plugin/SensorsAnalyticsTransform.groovy

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ class SensorsAnalyticsTransform extends Transform {
249249
*/
250250
private static File modifyClassFile(File dir, File classFile, File tempDir) {
251251
File modified = null
252+
FileOutputStream outputStream = null
252253
try {
253254
String className = path2ClassName(classFile.absolutePath.replace(dir.absolutePath + File.separator, ""))
254255
if (isShouldModify(className)) {
@@ -260,13 +261,22 @@ class SensorsAnalyticsTransform extends Transform {
260261
modified.delete()
261262
}
262263
modified.createNewFile()
263-
new FileOutputStream(modified).write(modifiedClassBytes)
264+
outputStream = new FileOutputStream(modified)
265+
outputStream.write(modifiedClassBytes)
264266
}
265267
} else {
266268
return classFile
267269
}
268270
} catch (Exception e) {
269271
e.printStackTrace()
272+
} finally {
273+
try {
274+
if (outputStream != null) {
275+
outputStream.close()
276+
}
277+
} catch (Exception e) {
278+
//ignore
279+
}
270280
}
271281
return modified
272282
}

0 commit comments

Comments
 (0)