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

Fix runtime crash caused by java.lang.ClassNotFoundException #25101

Merged
merged 1 commit into from
Feb 16, 2023
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
2 changes: 1 addition & 1 deletion examples/java-matter-controller/Manifest.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Main-Class: com.matter.controller.Main
Class-Path: ../lib/third_party/connectedhomeip/src/controller/java/CHIPController.jar ../lib/third_party/connectedhomeip/src/setup_payload/java/SetupPayloadParser.jar
Class-Path: ../lib/third_party/connectedhomeip/src/controller/java/CHIPController.jar ../lib/third_party/connectedhomeip/src/setup_payload/java/SetupPayloadParser.jar ../lib/third_party/connectedhomeip/third_party/java_deps/stub_src/Android.jar ../lib/third_party/connectedhomeip/third_party/java_deps/json-20220924.jar ../lib/third_party/connectedhomeip/third_party/java_deps/jsr305-3.0.2.jar

81 changes: 75 additions & 6 deletions third_party/java_deps/stub_src/android/util/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,88 @@
package android.util;

public final class Log {
public static int d(String tag, String message) {
return 0;

public static final int VERBOSE = 2;

public static final int DEBUG = 3;

public static final int INFO = 4;

public static final int WARN = 5;

public static final int ERROR = 6;

public static final int ASSERT = 7;

public static final int NONE = Integer.MAX_VALUE;

/**
* Send a DEBUG log message.
*
* @param tag Used to identify the source of a log message. It usually identifies the class or
* activity where the log call occurs.
* @param msg The message you would like logged.
* @return A positive value if the message was loggable.
*/
public static int d(String tag, String msg) {
return log(DEBUG, tag, msg);
}

/**
* Send a ERROR log message.
*
* @param tag Used to identify the source of a log message. It usually identifies the class or
* activity where the log call occurs.
* @param msg The message you would like logged.
* @return A positive value if the message was loggable.
*/
public static int e(String tag, String msg) {
return 0;
return log(ERROR, tag, msg);
}

/**
* Send a ERROR log message and log the exception.
*
* @param tag Used to identify the source of a log message. It usually identifies the class or
* activity where the log call occurs.
* @param msg The message you would like logged.
* @param tr An exception to log.
* @return A positive value if the message was loggable.
*/
public static int e(String tag, String msg, Throwable tr) {
return 0;
return log(ERROR, tag, msg, tr);
}

public static int w(String tag, String message) {
return 0;
/**
* Send a WARN log message.
*
* @param tag Used to identify the source of a log message. It usually identifies the class or
* activity where the log call occurs.
* @param msg The message you would like logged.
* @return A positive value if the message was loggable.
*/
public static int w(String tag, String msg) {
return log(WARN, tag, msg);
}

private static int log(int level, String tag, String msg) {
if (level > ASSERT) {
return -1;
}

System.out.println(tag + ':' + msg);

return 1;
}

private static int log(int level, String tag, String msg, Throwable tr) {
if (level > ASSERT) {
return -1;
}

System.out.println(tag + ':' + msg);
System.out.println(tr.toString());

return 1;
}
}