From 3ecec84c83bea5f985ea4f3047b8336f88be0267 Mon Sep 17 00:00:00 2001 From: Magnus Jedvert Date: Thu, 7 Jun 2018 12:57:06 +0200 Subject: [PATCH] Android: Throw exception in CallSessionFileRotatingLogSink if dir is null This CL throws an IllegalArgumentException in case the dir path argument is null. This makes the error more clear than crashing in native JNI code while trying to convert a null string. Bug: b/106732994 Change-Id: Ib04ebf017c6e33b9896fc1e1db051a853838a7f4 Reviewed-on: https://webrtc-review.googlesource.com/81740 Reviewed-by: Paulina Hensman Commit-Queue: Magnus Jedvert Cr-Commit-Position: refs/heads/master@{#23535} --- .../api/org/webrtc/CallSessionFileRotatingLogSink.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/android/api/org/webrtc/CallSessionFileRotatingLogSink.java b/sdk/android/api/org/webrtc/CallSessionFileRotatingLogSink.java index c6b9e97e7d..f4edb58847 100644 --- a/sdk/android/api/org/webrtc/CallSessionFileRotatingLogSink.java +++ b/sdk/android/api/org/webrtc/CallSessionFileRotatingLogSink.java @@ -14,11 +14,17 @@ public class CallSessionFileRotatingLogSink { private long nativeSink; public static byte[] getLogData(String dirPath) { + if (dirPath == null) { + throw new IllegalArgumentException("dirPath may not be null."); + } return nativeGetLogData(dirPath); } public CallSessionFileRotatingLogSink( String dirPath, int maxFileSize, Logging.Severity severity) { + if (dirPath == null) { + throw new IllegalArgumentException("dirPath may not be null."); + } nativeSink = nativeAddSink(dirPath, maxFileSize, severity.ordinal()); }