From 4d1546cb38e8bf7c46284297093574831a5eb448 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 24 Apr 2019 14:43:09 +0200 Subject: [PATCH] java/File: use DiscardException() --- src/java/File.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/java/File.cxx b/src/java/File.cxx index 33056586d..0d8c789f3 100644 --- a/src/java/File.cxx +++ b/src/java/File.cxx @@ -31,6 +31,7 @@ #include "Class.hxx" #include "String.hxx" #include "Object.hxx" +#include "Exception.hxx" #include "fs/AllocatedPath.hxx" #include "fs/Limits.hxx" @@ -54,10 +55,8 @@ Java::File::ToAbsolutePath(JNIEnv *env, jobject _file) noexcept LocalObject file(env, _file); const jstring path = getAbsolutePath(env, file); - if (path == nullptr) { - env->ExceptionClear(); + if (DiscardException(env) || path == nullptr) return nullptr; - } Java::String path2(env, path); return AllocatedPath::FromFS(path2.ToString());