diff Plugin/NativeSDK.cpp @ 5:c8f19e93ff99

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Oct 2023 08:49:07 +0200
parents 3ecef5782f2c
children 26c08ff926a3
line wrap: on
line diff
--- a/Plugin/NativeSDK.cpp	Thu Oct 19 08:22:23 2023 +0200
+++ b/Plugin/NativeSDK.cpp	Thu Oct 19 08:49:07 2023 +0200
@@ -32,12 +32,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -52,12 +52,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -73,11 +73,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -92,11 +92,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -111,11 +111,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -133,7 +133,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -144,18 +144,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -174,7 +174,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -185,18 +185,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -215,7 +215,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -226,18 +226,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -257,7 +257,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -268,18 +268,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -299,7 +299,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -310,18 +310,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -336,16 +336,16 @@
       , c_arg0.GetValue());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -359,16 +359,16 @@
       , c_arg0.GetValue());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -387,7 +387,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -398,18 +398,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -429,7 +429,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -440,18 +440,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -466,7 +466,7 @@
       , c_arg0.GetValue()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -474,7 +474,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -485,12 +485,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -505,7 +505,7 @@
       , c_arg0.GetValue()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -513,7 +513,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -524,12 +524,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -544,7 +544,7 @@
       , c_arg0.GetValue()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -552,7 +552,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -563,12 +563,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -583,7 +583,7 @@
       , c_arg0.GetValue()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -591,7 +591,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -602,12 +602,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -622,7 +622,7 @@
       , c_arg0.GetValue()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -630,7 +630,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -641,12 +641,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -660,7 +660,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -668,7 +668,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -679,12 +679,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -698,7 +698,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -706,7 +706,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -717,12 +717,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -736,7 +736,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -744,7 +744,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -755,12 +755,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -776,11 +776,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -795,11 +795,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -814,11 +814,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -832,7 +832,7 @@
       , arg0, c_arg1.GetValue()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -840,7 +840,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -851,12 +851,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -871,16 +871,16 @@
       , arg0, c_arg1.GetValue());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -894,12 +894,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -913,7 +913,7 @@
       , arg0));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -921,7 +921,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -932,12 +932,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -952,12 +952,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -971,7 +971,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -979,7 +979,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -990,12 +990,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1014,7 +1014,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1025,18 +1025,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1055,7 +1055,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1066,18 +1066,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1093,16 +1093,16 @@
       , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -1115,7 +1115,7 @@
       , static_cast<OrthancPluginErrorCode>(arg0));
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1125,12 +1125,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1145,7 +1145,7 @@
       , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginImageFormat>(arg2));
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -1155,12 +1155,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -1179,7 +1179,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1190,18 +1190,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1220,7 +1220,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1231,18 +1231,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1263,7 +1263,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1274,18 +1274,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1307,7 +1307,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1318,18 +1318,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1351,7 +1351,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1362,18 +1362,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1390,16 +1390,16 @@
       , c_arg0.GetValue(), c_arg1.GetValue(), c_arg2.GetValue());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -1413,12 +1413,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -1432,7 +1432,7 @@
       , arg0);
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1442,12 +1442,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1462,12 +1462,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -1482,16 +1482,16 @@
       , arg0, arg1, c_arg2.GetValue());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -1505,16 +1505,16 @@
       , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5);
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -1529,16 +1529,16 @@
       , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5, c_arg6.GetValue());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -1552,7 +1552,7 @@
       , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1560,7 +1560,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1571,12 +1571,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1591,7 +1591,7 @@
       , c_arg0.GetValue(), static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1599,7 +1599,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1610,12 +1610,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1634,7 +1634,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1645,18 +1645,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1670,7 +1670,7 @@
       , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2);
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -1680,12 +1680,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -1700,7 +1700,7 @@
       , c_arg0.GetData(), c_arg0.GetSize(), arg2);
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -1710,12 +1710,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -1730,7 +1730,7 @@
       , c_arg0.GetData(), c_arg0.GetSize()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1738,7 +1738,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1749,12 +1749,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1769,7 +1769,7 @@
       , c_arg0.GetData(), c_arg0.GetSize()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1777,7 +1777,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1788,12 +1788,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1807,7 +1807,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1815,7 +1815,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1826,12 +1826,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1846,7 +1846,7 @@
       , c_arg0.GetData(), c_arg0.GetSize());
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -1856,12 +1856,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -1875,7 +1875,7 @@
       );
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -1885,12 +1885,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -1905,7 +1905,7 @@
       , c_arg0.GetValue());
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1915,12 +1915,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1936,11 +1936,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -1954,7 +1954,7 @@
       , arg0, arg1, c_arg2.GetValue()));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -1962,7 +1962,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -1973,12 +1973,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -1993,7 +1993,7 @@
       , c_arg0.GetData(), c_arg0.GetSize());
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -2003,12 +2003,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2024,7 +2024,7 @@
       , c_arg0.GetData(), c_arg0.GetSize(), c_arg2.GetValue());
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -2034,12 +2034,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2053,7 +2053,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2061,7 +2061,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2072,12 +2072,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2097,7 +2097,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2108,18 +2108,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2135,11 +2135,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -2153,7 +2153,7 @@
       );
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2163,12 +2163,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2184,12 +2184,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2204,7 +2204,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2212,7 +2212,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2223,12 +2223,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2243,7 +2243,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2251,7 +2251,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2262,12 +2262,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2284,12 +2284,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2305,7 +2305,7 @@
       , c_arg0.GetValue());
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2315,12 +2315,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2336,12 +2336,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2356,7 +2356,7 @@
       ));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2364,7 +2364,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2375,12 +2375,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2396,12 +2396,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2417,12 +2417,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2441,7 +2441,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2452,18 +2452,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2478,7 +2478,7 @@
       , arg0);
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -2488,12 +2488,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2512,7 +2512,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2523,18 +2523,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2549,7 +2549,7 @@
       , static_cast<OrthancPluginDicomToJsonFormat>(arg0), static_cast<OrthancPluginDicomToJsonFlags>(arg1), arg2));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2557,7 +2557,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2568,12 +2568,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2589,16 +2589,16 @@
       , c_arg0.GetData(), c_arg0.GetSize());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -2612,16 +2612,16 @@
       );
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -2636,11 +2636,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -2656,12 +2656,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2677,12 +2677,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2697,7 +2697,7 @@
       , arg0));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2705,7 +2705,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2716,12 +2716,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2736,7 +2736,7 @@
       , arg0));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2744,7 +2744,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2755,12 +2755,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2776,11 +2776,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -2795,12 +2795,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2816,12 +2816,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2837,12 +2837,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2858,12 +2858,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2878,7 +2878,7 @@
       , static_cast<OrthancPluginPixelFormat>(arg0));
     if (answer == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return 0;
     }
     else
@@ -2888,12 +2888,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -2909,16 +2909,16 @@
       , arg0, c_arg1.GetValue(), arg2, arg3, arg4, arg5, arg6);
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -2933,11 +2933,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -2951,7 +2951,7 @@
       , arg0));
     if (s.GetValue() == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -2959,7 +2959,7 @@
       jstring t = env->NewStringUTF(s.GetValue());
       if (t == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -2970,12 +2970,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -2991,11 +2991,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3010,12 +3010,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -3030,7 +3030,7 @@
       , arg0);
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -3040,12 +3040,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -3060,7 +3060,7 @@
       , arg0);
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -3070,12 +3070,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -3091,7 +3091,7 @@
       , arg0, c_arg1.GetValue());
     if (s == NULL)
     {
-      JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+      JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
       return NULL;
     }
     else
@@ -3101,12 +3101,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -3124,11 +3124,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3144,11 +3144,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3164,11 +3164,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3183,11 +3183,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3203,11 +3203,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3223,11 +3223,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3244,11 +3244,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3265,11 +3265,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3285,16 +3285,16 @@
       , c_arg0.GetValue(), c_arg1.GetValue());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3309,16 +3309,16 @@
       , c_arg0.GetData(), c_arg0.GetSize());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3334,11 +3334,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3354,11 +3354,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3374,11 +3374,11 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3394,16 +3394,16 @@
       , c_arg0.GetValue(), c_arg1.GetData(), arg2, static_cast<OrthancPluginContentType>(arg3));
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3422,7 +3422,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -3433,18 +3433,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }
@@ -3460,16 +3460,16 @@
       , c_arg0.GetValue(), static_cast<OrthancPluginContentType>(arg1));
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3483,16 +3483,16 @@
       , static_cast<OrthancPluginResourceType>(arg0));
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3507,16 +3507,16 @@
       , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(arg0)), c_arg1.GetData(), c_arg1.GetSize());
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3530,16 +3530,16 @@
       );
     if (code != OrthancPluginErrorCode_Success)
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
   }
 }
 
@@ -3555,12 +3555,12 @@
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return 0;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return 0;
   }
 }
@@ -3579,7 +3579,7 @@
       jbyteArray answer = env->NewByteArray(b.GetSize());
       if (answer == NULL)
       {
-        JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
+        JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory);
         return NULL;
       }
       else
@@ -3590,18 +3590,18 @@
     }
     else
     {
-      JavaEnvironment::ThrowException(env, code);
+      JavaEnvironment::ThrowOrthancException(env, code);
       return NULL;
     }
   }
   catch (std::runtime_error& e)
   {
-    JavaEnvironment::ThrowException(env, e.what());
+    JavaEnvironment::ThrowOrthancException(env, e.what());
     return NULL;
   }
   catch (...)
   {
-    JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
+    JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin);
     return NULL;
   }
 }