File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
src/main/groovy/com/sensorsdata/analytics/android/plugin Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11project. 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())
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments