From 1220f1f086501481a0052af615078889fda41778 Mon Sep 17 00:00:00 2001 From: Bruno Cavaleiro Date: Wed, 27 Nov 2024 15:06:17 +0000 Subject: [PATCH] fix: fix issue in the code (cherry picked from commit d4c623bb35907b90a0dfcfac6baa7365ea95eb99) --- .../connections/sql/SQLConnection.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/connections/sql/SQLConnection.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/connections/sql/SQLConnection.java index 15581462ca..dfd541b8e3 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/connections/sql/SQLConnection.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/connections/sql/SQLConnection.java @@ -266,7 +266,7 @@ private static void handleTestConnection( Properties props, String connectionNam /** * Allows the native SQL Connection to be enhanced in a subclass. Best used when a connection needs to be enhanced * with an "effective user" - * + * * @param connection */ protected void enhanceConnection( Connection connection ) throws SQLException { @@ -275,7 +275,7 @@ protected void enhanceConnection( Connection connection ) throws SQLException { /** * Allows enhancements to the native SQL Connection to be removed in a subclass. Best used when a connection needs to * be enhanced with an "effective user" - * + * * @param connection */ protected void unEnhanceConnection( Connection connection ) throws SQLException { @@ -284,7 +284,7 @@ protected void unEnhanceConnection( Connection connection ) throws SQLException /** * Allow wrapping/proxying of the native SQL connection by a subclass. Best used when a connection needs to be be * enhanced or proxied for Single Signon or possibly tenanting. - * + * * @param connection * @return */ @@ -295,7 +295,7 @@ protected Connection captureConnection( Connection connection ) throws SQLExcept /** * Allows the native SQL Statement to be enhanced by a subclass. Examples may be to allow additional information like * a user to be bound to the statement. - * + * * @param statement */ protected void enhanceStatement( Statement statement ) throws SQLException { @@ -323,9 +323,7 @@ private void closeStatements() { * iterate over and close all resultsets. Remove each result set from the list. */ private void closeResultSets() { -private static boolean isTestConnection( String connectionName ) { - return connectionName.length() > 12 && connectionName.startsWith( "__TEST__" ) && connectionName.endsWith( "__TEST__" ); -} Iterator iter = resultSets.iterator(); + Iterator iter = resultSets.iterator(); while ( iter.hasNext() ) { IPentahoResultSet rset = (IPentahoResultSet) iter.next(); if ( rset != null ) { @@ -368,7 +366,7 @@ public void close() { /* * (non-Javadoc) - * + * * @see org.pentaho.connection.IPentahoConnection#getLastQuery() */ public String getLastQuery() { @@ -377,7 +375,7 @@ public String getLastQuery() { /** * Executes the specified query. - * + * * @param query * the query to execute * @return the resultset from the query @@ -394,7 +392,7 @@ public IPentahoResultSet executeQuery( final String query ) throws SQLException, /** * Executes the specified query with the defined parameters - * + * * @param query * the query to be executed * @param scrollType @@ -462,7 +460,7 @@ public IPentahoResultSet prepareAndExecuteQuery( final String query, final List * The purpose of this method is to set limitations such as fetchSize and maxrows on the provided statement. If the * JDBC driver does not support the setting and throws an Exception, we will re-throw iff the limit was explicitly * set. - * + * * @param stmt * Either a Statement or PreparedStatement * @throws SQLException @@ -577,7 +575,7 @@ public boolean preparedQueriesSupported() { /* * (non-Javadoc) - * + * * @see org.pentaho.connection.IPentahoConnection#isClosed() */ public boolean isClosed() { @@ -592,9 +590,9 @@ public boolean isClosed() { /* * (non-Javadoc) - * + * * @see org.pentaho.connection.IPentahoConnection#isReadOnly() - * + * * Right now this architecture only support selects (read only) */ public boolean isReadOnly() {