diff --git a/jpype/dbapi2.py b/jpype/dbapi2.py index 72e4e6e66..0b39ad97c 100644 --- a/jpype/dbapi2.py +++ b/jpype/dbapi2.py @@ -407,18 +407,18 @@ def connect(dsn, *, driver=None, driver_args=None, # User is supplying Java properties if isinstance(driver_args, Properties): - connection = DM.getConnection(dsn, driver_args, caller=False) + connection = DM.getConnection(dsn, driver_args) # User is supplying a mapping that can be converted Properties elif isinstance(driver_args, typing.Mapping): info = Properties() for k, v in driver_args.items(): info.setProperty(k, v) - connection = DM.getConnection(dsn, info, caller=False) + connection = DM.getConnection(dsn, info) # User supplied nothing elif driver_args is None: - connection = DM.getConnection(dsn, caller=False) + connection = DM.getConnection(dsn) # Otherwise use the kwargs else: diff --git a/native/java/org/jpype/JPypeContext.java b/native/java/org/jpype/JPypeContext.java index c997d3759..db85cf37c 100644 --- a/native/java/org/jpype/JPypeContext.java +++ b/native/java/org/jpype/JPypeContext.java @@ -19,11 +19,8 @@ import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.nio.Buffer; import java.nio.ByteOrder; -import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; @@ -244,21 +241,21 @@ private void shutdown() if (freeResources) { - // Release all Python references - try - { - JPypeReferenceQueue.getInstance().stop(); - } catch (Throwable th) - { - } - - // Release any C++ resources - try - { - this.typeManager.shutdown(); - } catch (Throwable th) - { - } + // Release all Python references + try + { + JPypeReferenceQueue.getInstance().stop(); + } catch (Throwable th) + { + } + + // Release any C++ resources + try + { + this.typeManager.shutdown(); + } catch (Throwable th) + { + } } // Execute post hooks @@ -324,9 +321,10 @@ public void _addPost(Runnable run) } /** - * Call a method using reflection.This method creates a stackframe so that - * caller sensitive methods will execute properly. + * Call a method using reflection. * + * This method creates a stackframe so that caller sensitive methods will + * execute properly. * * @param method is the method to call. * @param obj is the object to operate on, it will be null if the method is @@ -344,10 +342,11 @@ public Object callMethod(Method method, Object obj, Object[] args) return method.invoke(obj, args); } catch (InvocationTargetException ex) { +// ex.printStackTrace(); throw ex.getCause(); } } - + /** * Helper function for collect rectangular, */ @@ -637,22 +636,22 @@ private static void scanExistingJars() } } - private static long getTotalMemory() + private static long getTotalMemory() { return Runtime.getRuntime().totalMemory(); } - private static long getFreeMemory() + private static long getFreeMemory() { return Runtime.getRuntime().freeMemory(); } - private static long getMaxMemory() + private static long getMaxMemory() { return Runtime.getRuntime().maxMemory(); } - private static long getUsedMemory() + private static long getUsedMemory() { return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); } diff --git a/native/java/org/jpype/classloader/DynamicClassLoader.java b/native/java/org/jpype/classloader/DynamicClassLoader.java index b2c0fffe8..1021217c3 100644 --- a/native/java/org/jpype/classloader/DynamicClassLoader.java +++ b/native/java/org/jpype/classloader/DynamicClassLoader.java @@ -57,8 +57,8 @@ private static URL[] launch() ArrayList path = new ArrayList<>(); int last = 0; int next = 0; - - while (next!=-1) + + while (next != -1) { // Find the parts next = cp.indexOf(File.pathSeparator, last);