Skip to content
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

Catch UnsatisfiedLinkError when load native library #23286

Merged
merged 1 commit into from
Oct 26, 2022
Merged
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
@@ -1,8 +1,13 @@
package chip.setuppayload;

import java.util.logging.Level;
import java.util.logging.Logger;

/** Parser for scanned QR code or manual entry code. */
public class SetupPayloadParser {

private static final Logger LOGGER = Logger.getLogger(SetupPayloadParser.class.getSimpleName());

/**
* Returns {@link SetupPayload} parsed from the QR code string. If an invalid element is included
* in the QRCode Parse result, SetupPayloadException occurs. Refer to {@link SetupPayload} for the
Expand Down Expand Up @@ -69,7 +74,11 @@ private native SetupPayload fetchPayloadFromManualEntryCode(
throws InvalidEntryCodeFormatException, SetupPayloadException;

static {
System.loadLibrary("SetupPayloadParser");
try {
System.loadLibrary("SetupPayloadParser");
} catch (UnsatisfiedLinkError e) {
LOGGER.log(Level.SEVERE, "Cannot load library.", e);
}
}

public static class UnrecognizedQrCodeException extends Exception {
Expand Down