// // Return the methods of an interface in a deterministic // order. Class.getMethods() does not do us this favor. // private Method[] sortMethods(Class iface) throws Exception { Method[] raw = iface.getMethods(); int count = raw.length; Method[] cooked = new Method[count]; MethodSortable[] sortables = new MethodSortable[count]; for (int i = 0; i < count; i++) { sortables[i] = new MethodSortable(raw[i]); } Arrays.sort(sortables); for (int i = 0; i < count; i++) { cooked[i] = sortables[i].getMethod(); } return cooked; }
// debug print the list of methods which have disappeared from the SQL interface private void printVanishedMethodList(HashSet<String> vanishedMethodList) { int count = vanishedMethodList.size(); if (count == 0) { return; } println("--------------- VANISHED METHODS ------------------"); println("--"); String[] result = new String[count]; vanishedMethodList.toArray(result); Arrays.sort(result); for (int i = 0; i < count; i++) { println(result[i]); } }
// debug print the list of methods which throw SQLFeatureNotSupportedException private void printUnsupportedList(HashSet<String> unsupportedList) { int count = unsupportedList.size(); if (count == 0) { return; } println("--------------- UNSUPPORTED METHODS ------------------"); println("--"); String[] result = new String[count]; unsupportedList.toArray(result); Arrays.sort(result); for (int i = 0; i < count; i++) { println(result[i]); } }
// Debug print the list of method failures which we don't understand private void printNotUnderstoodList(HashSet<String> notUnderstoodList) { int count = notUnderstoodList.size(); if (count == 0) { return; } println("\n\n"); println("--------------- NOT UNDERSTOOD METHODS ------------------"); println("--"); String[] result = new String[count]; notUnderstoodList.toArray(result); Arrays.sort(result); for (int i = 0; i < count; i++) { println(result[i]); } }
static { try { CON_PROXY_CTOR = createProxyConstructor(ProxyConnection.class); Class[] argClasses = new Class[0]; RS_CLOSE_METHOD = ResultSet.class.getMethod("close", argClasses); STMT_CLOSE_METHOD = Statement.class.getMethod("close", argClasses); CLOSE_ARGS = new Object[0]; OBJECT_METHODS = Collections.unmodifiableSet(new HashSet(Arrays.asList(Object.class.getMethods()))); } catch (Exception e) { // e.printStackTrace(); logger.log( MLevel.SEVERE, "An Exception occurred in static initializer of" + C3P0PooledConnection.class.getName(), e); throw new InternalError( "Something is very wrong, or this is a pre 1.3 JVM." + "We cannot set up dynamic proxies and/or methods!"); } }