Skip to content

Commit

Permalink
Fix runtime crash caused by java.lang.ClassNotFoundException (#25101)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Feb 14, 2024
1 parent b6a392d commit 1080852
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 7 deletions.
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;
}
}

0 comments on commit 1080852

Please sign in to comment.