ソースを参照

sonar报错修改

zhanglong7 5 年 前
コミット
0724ea77bd
共有1 個のファイルを変更した9 個の追加1 個の削除を含む
  1. 9 1
      ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileCamera.java

+ 9 - 1
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileCamera.java

@ -460,8 +460,9 @@ public class MobileCamera extends Plugin {
460 460
	   }
461 461
	   String res = f.getAbsolutePath();
462 462
	   BufferedOutputStream bos = null;
463
		FileOutputStream outputStream = null;
463 464
	   try {
464
		   FileOutputStream outputStream = new FileOutputStream(f);
465
		   outputStream = new FileOutputStream(f);
465 466
		   bos = new BufferedOutputStream(outputStream);
466 467
		   bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos);
467 468
	   } catch (FileNotFoundException e) {
@ -475,6 +476,13 @@ public class MobileCamera extends Plugin {
475 476
				   Log.e(TAG, "addWaterMark: ", e);
476 477
			   }
477 478
		   }
479
		   if (outputStream != null) {
480
			   try {
481
				   outputStream.close();
482
			   } catch (IOException e) {
483
				   Log.e(TAG, "addWaterMark: ", e);
484
			   }
485
		   }
478 486
	   }
479 487
480 488
	   return res;