Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Oct 16, 2024
1 parent 08ba15a commit abcc6cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class RNSentryModuleImpl {
private static final ILogger logger = new AndroidLogger(NAME);
private static final BuildInfoProvider buildInfo = new BuildInfoProvider(logger);
private static final String modulesPath = "modules.json";
private static final Charset UTF_8 = Charset.forName(Charset.UTF_8);
private static final Charset UTF_8 = Charset.forName("UTF-8"); // NOPMD - Allow using UTF-8

private final ReactApplicationContext reactApplicationContext;
private final PackageInfo packageInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableNativeArray;
import java.io.IOException;
import java.io.InputStream;

public class AssetsModule extends ReactContextBaseJavaModule {
Expand All @@ -21,9 +22,9 @@ public String getName() {

@ReactMethod
public void getExampleAssetData(Promise promise) {
InputStream stream = null;
try {
InputStream stream = // NOPMD - Stream is closed in finally block
this.getReactApplicationContext().getResources().getAssets().open("logo_mini.png");
stream = this.getReactApplicationContext().getResources().getAssets().open("logo_mini.png");
int size = stream.available();
byte[] buffer = new byte[size];
stream.read(buffer);
Expand All @@ -36,7 +37,9 @@ public void getExampleAssetData(Promise promise) {
promise.reject(e);
} finally {
try {
stream.close();
if (stream != null) {
stream.close();
}
} catch (IOException e) {
promise.reject(e);
}
Expand Down

0 comments on commit abcc6cc

Please sign in to comment.