Skip to content

fix more strict mode violation #6937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ static Architecture getValue() {
public static String streamToString(InputStream is) {
// Previous code was running into this: http://code.google.com/p/android/issues/detail?id=14562
// on Android 2.3.3. The below code below does not exhibit that problem.
final java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
try (final java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A")) {
return s.hasNext() ? s.next() : "";
}
}

public static String sha1(String source) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,15 +661,15 @@ private InputStream getResourceAsStream(String resource) {
}

private static byte[] readResource(InputStream is) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
byte[] buffer = new byte[1024];
int length;

while ((length = is.read(buffer)) != -1) {
out.write(buffer, 0, length);
while ((length = is.read(buffer)) != -1) {
out.write(buffer, 0, length);
}
return out.toByteArray();
}

return out.toByteArray();
}

private void finalizePreviousNativeSession(String previousSessionId) {
Expand Down
Loading