Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f1b6deb7
Commit
f1b6deb7
authored
5 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java/Exception: add RethrowException()
parent
72ebd5eb
sisyphus
0.23.15-alt1
0.23.14-alt1
0.23.13-alt1
0.23.12-alt1
0.23.11-alt1
0.23.8-alt3
0.23.8-alt2
0.23.8-alt1
gb-sisyphus-task339776.6100
gb-sisyphus-task337393.100
gb-sisyphus-task337176.300
gb-sisyphus-task334590.100
gb-sisyphus-task333607.100
gb-sisyphus-task331543.2500
gb-sisyphus-task328663.4700
gb-sisyphus-task325064.100
gb-sisyphus-task319111.4000
gb-sisyphus-task313704.100
gb-sisyphus-task312885.100
gb-sisyphus-task308905.3200
gb-sisyphus-task305294.500
gb-sisyphus-task304007.100
gb-sisyphus-task303674.1700
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
1 deletion
+65
-1
Exception.cxx
src/java/Exception.cxx
+50
-0
Exception.hxx
src/java/Exception.hxx
+14
-1
meson.build
src/java/meson.build
+1
-0
No files found.
src/java/Exception.cxx
0 → 100644
View file @
f1b6deb7
/*
* Copyright 2010-2019 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Exception.hxx"
#include "Object.hxx"
#include "String.hxx"
Java
::
Exception
::
Exception
(
JNIEnv
*
env
,
jthrowable
e
)
noexcept
:
std
::
runtime_error
(
Java
::
String
(
env
,
Object
::
toString
(
env
,
e
)).
ToString
())
{
}
void
Java
::
RethrowException
(
JNIEnv
*
env
)
{
jthrowable
exception
=
env
->
ExceptionOccurred
();
if
(
exception
==
nullptr
)
return
;
LocalRef
<
jthrowable
>
ref
(
env
,
exception
);
env
->
ExceptionClear
();
throw
Exception
(
env
,
exception
);
}
This diff is collapsed.
Click to expand it.
src/java/Exception.hxx
View file @
f1b6deb7
/*
* Copyright 2010-201
8
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2010-201
9
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -30,9 +30,22 @@
#ifndef JAVA_EXCEPTION_HXX
#define JAVA_EXCEPTION_HXX
#include <stdexcept>
#include <jni.h>
namespace
Java
{
class
Exception
:
public
std
::
runtime_error
{
public
:
explicit
Exception
(
JNIEnv
*
env
,
jthrowable
e
)
noexcept
;
};
/**
* Check if a Java exception has occurred, and if yes, convert
* it to a C++ #Exception and throw that.
*/
void
RethrowException
(
JNIEnv
*
env
);
/**
* Check if an exception has occurred, and discard it.
*
...
...
This diff is collapsed.
Click to expand it.
src/java/meson.build
View file @
f1b6deb7
java = static_library(
'java',
'Global.cxx',
'Exception.cxx',
'File.cxx',
'Object.cxx',
'String.cxx',
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment