public void setClientInfo(String name, String value) throws SQLClientInfoException { try { checkClosed(); ((java.sql.Connection) this.mc).setClientInfo(name, value); } catch (SQLException sqlException) { try { checkAndFireConnectionError(sqlException); } catch (SQLException sqlEx2) { SQLClientInfoException clientEx = new SQLClientInfoException(); clientEx.initCause(sqlEx2); throw clientEx; } } }
public void setClientInfo(Properties properties) throws SQLClientInfoException { try { checkClosed(); ((java.sql.Connection) this.mc).setClientInfo(properties); } catch (SQLException sqlException) { try { checkAndFireConnectionError(sqlException); } catch (SQLException sqlEx2) { SQLClientInfoException clientEx = new SQLClientInfoException(); clientEx.initCause(sqlEx2); throw clientEx; } } }
/** * Validate that the ordering of the returned Exceptions is correct using * for-each loop */ @Test public void test11() { SQLClientInfoException ex = new SQLClientInfoException("Exception 1", map, t1); SQLClientInfoException ex1 = new SQLClientInfoException("Exception 2", map); SQLClientInfoException ex2 = new SQLClientInfoException("Exception 3", map, t2); ex.setNextException(ex1); ex.setNextException(ex2); int num = 0; for (Throwable e : ex) { assertTrue(msgs[num++].equals(e.getMessage())); } }
public synchronized void setClientInfo(java.sql.Connection conn, Properties properties) throws SQLClientInfoException { try { Enumeration<?> propNames = properties.propertyNames(); while (propNames.hasMoreElements()) { String name = (String) propNames.nextElement(); String value = properties.getProperty(name); setClientInfo(conn, name, value); } } catch (SQLException sqlEx) { SQLClientInfoException clientInfoEx = new SQLClientInfoException(); clientInfoEx.initCause(sqlEx); throw clientInfoEx; } }
@Override protected boolean isOkaySpecialCaseException(Method method, Throwable cause) { final boolean result; if (super.isOkaySpecialCaseException(method, cause)) { result = true; } else if (SQLClientInfoException.class == cause.getClass() && normalClosedExceptionText.equals(cause.getMessage()) && (false || method.getName().equals("setClientInfo") || method.getName().equals("getClientInfo") )) { // Special good case--we had to use SQLClientInfoException from those. result = true; } else if (RuntimeException.class == cause.getClass() && normalClosedExceptionText.equals(cause.getMessage()) && (false || method.getName().equals("getCatalog") || method.getName().equals("getSchema") )) { // Special good-enough case--we had to use RuntimeException for now. result = true; } else { result = false; } return result; }
public void setClientInfo( Properties properties) throws SQLClientInfoException { try { validate(); } catch (SQLException e) { throw new SQLClientInfoException(e.getMessage(), e.getSQLState(), e.getErrorCode(), (Map<String, ClientInfoStatus>) null, e); } this.getConnection().setClientInfo(properties); }
/** * Serialize a SQLClientInfoException and make sure you can read it back * properly */ @Test public void test10() throws Exception { SQLClientInfoException e = new SQLClientInfoException(reason, state, errorCode, map, t); SQLClientInfoException ex1 = createSerializedException(e); assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode && ex1.getFailedProperties().equals(map)); }
/** * Create SQLClientInfoException with message, SQLState, and error code */ @Test public void test8() { SQLClientInfoException ex = new SQLClientInfoException(reason, state, errorCode, map, t); assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == errorCode && ex.getFailedProperties().equals(map)); }
/** * Create SQLClientInfoException with message, SQLState, errorCode, and * Throwable */ @Test public void test7() { SQLClientInfoException ex = new SQLClientInfoException(reason, state, errorCode, map); assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == errorCode && ex.getFailedProperties().equals(map)); }
/** * Create SQLClientInfoException with null Throwable */ @Test public void test4() { SQLClientInfoException ex = new SQLClientInfoException(reason, map, null); assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0 && ex.getFailedProperties().equals(map)); }
/** * Create SQLClientInfoException with message */ @Test public void test3() { SQLClientInfoException ex = new SQLClientInfoException(reason, map); assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0 && ex.getFailedProperties().equals(map)); }
public void setClientInfo(Properties properties) throws SQLClientInfoException { try { realConnection.setClientInfo(properties); } catch(SQLClientInfoException s) { String methodCall = "setClientInfo(" + properties + ")"; reportException(methodCall, s, null); throw s; } }
public void setClientInfo(Properties properties) throws SQLClientInfoException { try { getClientInfoProviderImpl().setClientInfo(this, properties); } catch (SQLClientInfoException ciEx) { throw ciEx; } catch (SQLException sqlEx) { SQLClientInfoException clientInfoEx = new SQLClientInfoException(); clientInfoEx.initCause(sqlEx); throw clientInfoEx; } }
/** * Create SQLClientInfoException with message, and SQLState */ @Test public void test5() { SQLClientInfoException ex = new SQLClientInfoException(reason, state, map); assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == 0 && ex.getFailedProperties().equals(map)); }
public void setClientInfo(String name, String value) throws SQLClientInfoException { try { getClientInfoProviderImpl().setClientInfo(this, name, value); } catch (SQLClientInfoException ciEx) { throw ciEx; } catch (SQLException sqlEx) { SQLClientInfoException clientInfoEx = new SQLClientInfoException(); clientInfoEx.initCause(sqlEx); throw clientInfoEx; } }
/** * Create SQLClientInfoException with message, and SQLState */ @Test public void test6() { SQLClientInfoException ex = new SQLClientInfoException(reason, state, map, t); assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0 && ex.getFailedProperties().equals(map)); }
public void setClientInfo(String name, String value) throws SQLClientInfoException { try { realConnection.setClientInfo(name, value); } catch(SQLClientInfoException s) { String methodCall = "setClientInfo(" + name + ", " + value + ")"; reportException(methodCall, s, null); throw s; } }
/** * Create SQLClientInfoException and setting all objects to null */ @Test public void test() { SQLClientInfoException e = new SQLClientInfoException(null); assertTrue(e.getMessage() == null && e.getSQLState() == null && e.getCause() == null && e.getErrorCode() == 0 && e.getFailedProperties() == null); }
@Override public JDBCException convert(SQLException sqlException, String message, String sql) { if ( SQLClientInfoException.class.isInstance( sqlException ) || SQLInvalidAuthorizationSpecException.class.isInstance( sqlException ) || SQLNonTransientConnectionException.class.isInstance( sqlException ) || SQLTransientConnectionException.class.isInstance( sqlException ) ) { return new JDBCConnectionException( message, sqlException, sql ); } else if ( DataTruncation.class.isInstance( sqlException ) || SQLDataException.class.isInstance( sqlException ) ) { throw new DataException( message, sqlException, sql ); } else if ( SQLIntegrityConstraintViolationException.class.isInstance( sqlException ) ) { return new ConstraintViolationException( message, sqlException, sql, getConversionContext().getViolatedConstraintNameExtracter().extractConstraintName( sqlException ) ); } else if ( SQLSyntaxErrorException.class.isInstance( sqlException ) ) { return new SQLGrammarException( message, sqlException, sql ); } else if ( SQLTimeoutException.class.isInstance( sqlException ) ) { return new QueryTimeoutException( message, sqlException, sql ); } else if ( SQLTransactionRollbackException.class.isInstance( sqlException ) ) { // Not 100% sure this is completely accurate. The JavaDocs for SQLTransactionRollbackException state that // it indicates sql states starting with '40' and that those usually indicate that: // <quote> // the current statement was automatically rolled back by the database because of deadlock or // other transaction serialization failures. // </quote> return new LockAcquisitionException( message, sqlException, sql ); } return null; // allow other delegates the chance to look }
/** * Create SQLClientInfoException with no-arg constructor */ @Test public void test1() { SQLClientInfoException ex = new SQLClientInfoException(); assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0 && ex.getFailedProperties() == null); }
@Override public void setClientInfo(String arg0, String arg1) throws SQLClientInfoException { throw new SQLClientInfoException("Method not supported", null); }
/** * Sets the value of the connection's client info properties. The * <code>Properties</code> object contains the names and values of the client info * properties to be set. The set of client info properties contained in * the properties list replaces the current set of client info properties * on the connection. If a property that is currently set on the * connection is not present in the properties list, that property is * cleared. Specifying an empty properties list will clear all of the * properties on the connection. See <code>setClientInfo (String, String)</code> for * more information. * <p> * If an error occurs in setting any of the client info properties, a * <code>SQLClientInfoException</code> is thrown. The <code>SQLClientInfoException</code> * contains information indicating which client info properties were not set. * The state of the client information is unknown because * some databases do not allow multiple client info properties to be set * atomically. For those databases, one or more properties may have been * set before the error occurred. * <p> * * @param properties the list of client info properties to set * <p> * @see java.sql.Connection#setClientInfo(String, String) setClientInfo(String, String) * @since JDK 1.6, HSQLDB 2.0 * <p> * @throws SQLClientInfoException if the database server returns an error while * setting the clientInfo values on the database server or this method * is called on a closed connection * <p> */ //#ifdef JAVA6 public void setClientInfo( Properties properties) throws SQLClientInfoException { if (!this.isClosed && (properties == null || properties.isEmpty())) { return; } SQLClientInfoException ex = new SQLClientInfoException(); if (this.isClosed) { ex.initCause(JDBCUtil.connectionClosedException()); } else { ex.initCause(JDBCUtil.notSupported()); } throw ex; }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { con.setClientInfo(properties); }
@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { conn.setClientInfo(properties); }
public void setClientInfo(String name, String value) throws SQLClientInfoException { this.getJDBC4Connection().setClientInfo(name, value); }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { connection.setClientInfo(properties); }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { this._clientInfo.put(name, value); }
public void setClientInfo(Properties properties) throws SQLClientInfoException { this.getJDBC4Connection().setClientInfo(properties); }