id
stringlengths
22
25
commit_message
stringlengths
137
6.96k
diffs
listlengths
0
63
derby-DERBY-2107-b91cfb22
DERBY-2107: Move page latching out of the lock manager Added test case. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@506899 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_RawStoreFactory.java", "hunks": [ { "added": [ "\t\tP024(0);\t// test page latching" ], "header": "@@ -315,6 +315,7 @@ public class T_RawStoreFactory extends T_MultiThreadedIterations {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_Util.java", "hunks": [ { "added": [ "\t/**", "\t * Check that it's not possible to get a page which is latched.", "\t *", "\t * @param c a container handle", "\t * @param pageNumber the page number to check", "\t * @exception StandardException if an unexpected error occurs", "\t * @exception T_Fail if the test fails", "\t */", "\tpublic void t_checkGetLatchedPage(ContainerHandle c, long pageNumber)", "\t\t\tthrows StandardException, T_Fail {", "\t\t// we expect to hang in getPage() so make sure we are interrupted", "\t\tfinal Thread me = Thread.currentThread();", "\t\tRunnable r = new Runnable() {", "\t\t\t\tpublic void run() {", "\t\t\t\t\ttry {", "\t\t\t\t\t\tThread.sleep(2000);", "\t\t\t\t\t} catch (InterruptedException e) { }", "\t\t\t\t\tme.interrupt();", "\t\t\t\t}", "\t\t\t};", "\t\tThread interrupter = new Thread(r);", "\t\tinterrupter.start();", "", "\t\ttry {", "\t\t\tPage p = c.getPage(pageNumber);", "\t\t\tthrow T_Fail.testFailMsg(\"got latched page\");", "\t\t} catch (StandardException se) {", "\t\t\t// expect thread interrupted exception", "\t\t\tif (!se.getMessageId().equals(\"08000\")) {", "\t\t\t\tthrow se;", "\t\t\t}", "\t\t}", "", "\t\ttry {", "\t\t\tinterrupter.join();", "\t\t} catch (InterruptedException ie) { }", "\t}" ], "header": "@@ -1133,6 +1133,43 @@ public class T_Util", "removed": [] } ] } ]
derby-DERBY-2109-04243ad4
DERBY-4786 (Shutdown command without username and password should work with mixed client and network server releases.) This change will send shutdown command with protocol level 2 whether there is username or password provided or not. If this command fails because of DRDA_InvalidReplyHead from server, then it will resend the shutdown command but this time with protocol level 1. The attempt with protocol level 1 will be made only if there was no username and password supplied with the shutdown command because shutdown command at protocol level 1 does not support username/password. If a client with these changes sends a shutdown command to a 10.3 server(which does not have DERBY-2109 changes) without the username and password, it will get 2 exceptions back from the server. 1st exception will be for sending the shutdown command at protocol level 2 and the 2nd will be for shutting down the server succesfully. Server will also have 2 messages, first indicating that an invalid protocol level command was received and 2nd message saying that the server is shutdown. I will create a release note for this behavior. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@999119 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\t//All the commands except shutdown with username and password are at ", "\t//protocol level 1. ", "\tprivate final static int DEFAULT_PROTOCOL_VERSION = 1;", "\t// DERBY-2109: shutdown command now transmits optional user credentials", "\t//For shutdown with username/password, we have added a new protocol level", "\tprivate final static int SHUTDOWN_WITH_CREDENTIAL_PROTOCOL_VERSION = 2;", "\t//The highest protocol level is 2. The reason for it to be at 2 is ", "\t//the shutdown command with username/password", "\tprivate final static int MAX_ALLOWED_PROTOCOL_VERSION = 2;", "" ], "header": "@@ -129,10 +129,16 @@ public final class NetworkServerControlImpl {", "removed": [ "\t// command protocol version - you need to increase this number each time", "\t// the command protocol changes ", " // DERBY-2109: shutdown command now transmits user credentials", "\tprivate final static int PROTOCOL_VERSION = 2;" ] }, { "added": [ " try {", " writeCommandHeader(COMMAND_SHUTDOWN, SHUTDOWN_WITH_CREDENTIAL_PROTOCOL_VERSION);", " // DERBY-2109: transmit user credentials for System Privileges check", " writeLDString(userArg);", " writeLDString(passwordArg);", " send();", " readResult();", " } catch (Exception e) {", " \t//The shutdown command with protocol level 2 failed. If ", " \t//the username or password were supplied then we can't ", " \t//try the shutdown with protocol level 1 because protocol", " \t//leve 1 does not support username/password. Because of", " \t//that, we should simply throw the caught exception to the", " \t//client", " \tif(userArg != null || passwordArg != null)", " \t\tthrow e;", " //If no username and password is specified then we can try", " \t//shutdown with the old protocol level of 1 which is the ", " \t//default protocol level. But this can be tried only if the", " \t//exception for attempt of shutdown with protocol level 2", " \t//was DRDA_InvalidReplyHead. This can happen if we are ", " \t//dealing with an older Network server product which do not", " \t//recognize shutdown at protocol level 2.", " \tif (e.getMessage().indexOf(\"DRDA_InvalidReplyHead\") != -1)", " \t{", " try {", " closeSocket();", " setUpSocket();", " writeCommandHeader(COMMAND_SHUTDOWN);", " send();", " readResult();", " } catch (Exception e1) {", " \te1.initCause(e);", " \tthrow e1;", " }", " \t}", " \telse", " \t\tthrow e;", " }" ], "header": "@@ -1028,12 +1034,45 @@ public final class NetworkServerControlImpl {", "removed": [ " writeCommandHeader(COMMAND_SHUTDOWN);", " // DERBY-2109: transmit user credentials for System Privileges check", " writeLDString(userArg);", " writeLDString(passwordArg);", " send();", " readResult();" ] }, { "added": [ "\t\t\tif (version <= 0 || version > MAX_ALLOWED_PROTOCOL_VERSION)" ], "header": "@@ -1612,7 +1651,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\tif (version <= 0 || version > PROTOCOL_VERSION)" ] }, { "added": [ "\t\t\t\t\tif (version == SHUTDOWN_WITH_CREDENTIAL_PROTOCOL_VERSION) {", "\t\t\t\t\t\t//Protocol version of client is not at default protocol", "\t\t\t\t\t\t//of 1 because this version of shutdown command has", "\t\t\t\t\t\t//username and password supplied with it. When the", "\t\t\t\t\t\t//protocol version of client is ", "\t\t\t\t\t\t//SHUTDOWN_WITH_CREDENTIAL_PROTOCOL_VERSION, then we ", "\t\t\t\t\t\t//know to expect username and password", "\t\t\t\t\t\t// DERBY-2109: receive user credentials for shutdown", "\t\t\t\t\t\t// System Privileges check", "\t\t\t\t\t\tuserArg = reader.readCmdString();", "\t\t\t\t\t\tpasswordArg = reader.readCmdString();", "\t\t\t\t\t}" ], "header": "@@ -1645,10 +1684,18 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\t// DERBY-2109: receive user credentials for shutdown", "\t\t\t\t\t// System Privileges check", "\t\t\t\t\tuserArg = reader.readCmdString();", "\t\t\t\t\tpasswordArg = reader.readCmdString();" ] }, { "added": [ "\t * Write command header consisting of command header string and default", "\t * protocol version and command. At this point, all the commands except", "\t * shutdown with username/passwrod use default protocol version.", "\t{", "\t\twriteCommandHeader(command, DEFAULT_PROTOCOL_VERSION);", "\t}", "\t", "\t/**", "\t * Write command header consisting of command header string and passed", "\t * protocol version and command. At this point, all the commands except", "\t * shutdown with username/passwrod use default protocol version.", "\t *", "\t * @param command\tcommand to be written", "\t * @param protocol_version_for_command protocol version to be used", "\t * for the given command", "\t *", "\t * @exception Exception\tthrows an exception if an error occurs", "\t */", "\tprivate void writeCommandHeader(int command, int protocol_version_for_command) throws Exception", "\t\t\tcommandOs.writeByte((byte)((protocol_version_for_command & 0xf0) >> 8 ));", "\t\t\tcommandOs.writeByte((byte)(protocol_version_for_command & 0x0f));" ], "header": "@@ -2612,19 +2659,36 @@ public final class NetworkServerControlImpl {", "removed": [ "\t * Write command header consisting of command header string and protocol", "\t * version and command", "\t\t\tcommandOs.writeByte((byte)((PROTOCOL_VERSION & 0xf0) >> 8 ));", "\t\t\tcommandOs.writeByte((byte)(PROTOCOL_VERSION & 0x0f));" ] } ] } ]
derby-DERBY-2109-127ff35c
DERBY-2109: Commit Martin's refinement of DatabasePrincipal wildcarding. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@546683 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2109-204c0402
DERBY-2109 Major sub-set of patch 12 that requires a user name and password for network server shutdown. Also includes the code to check a permission when shutting down the network server but the actual call to check the permission is commented out. Contributed by: Martin Zaun Email: martin dot zaun at sun dot com git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@632502 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/drda/NetworkServerControl.java", "hunks": [ { "added": [ "\t<LI>shutdown [-h &lt;host&gt;][-p &lt;portnumber&gt;] [-ssl &lt;sslmode&gt;] [-user &lt;username&gt;] [-password &lt;password&gt;]: This shutdowns the network server with given user credentials on the host and port specified or on the local host and port 1527(default) if no host or port is specified. </LI> " ], "header": "@@ -50,8 +50,7 @@ import org.apache.derby.impl.drda.NetworkServerControlImpl;", "removed": [ "\t<LI>shutdown [-h &lt;host>][-p &lt;portnumber>] [-ssl &lt;sslmode&gt;]: This shutdowns the network \tserver on the host and port specified or on the local host and port ", "\t1527(default) if no host or port is specified. </LI> " ] }, { "added": [ "\t/**", "\t * Creates a NetworkServerControl object that is configured to control", "\t * a Network Server on a specified port and InetAddress with given", "\t * user credentials.", "\t *", "\t * @param address\t The IP address of the Network Server host.", "\t *\t\t\t\t\t address cannot be null.", "\t *", "\t * @param portNumber port number server is to used. If <= 0,", "\t *\t\t\t\t\t default port number is used", "\t *\t\t\t\t\t\t ", "\t * @param userName\t The user name for actions requiring authorization.", "\t *\t\t\t\t\t\t ", "\t * @param password\t The password for actions requiring authorization.", "\t *\t\t\t\t\t\t ", "\t * @throws\t\t\t Exception on error", "\t */", "\tpublic NetworkServerControl(InetAddress address, int portNumber,", "\t\t\t\t\t\t\t\tString userName, String password)", "\t\t\tthrows Exception", "\t{", "\t\tserverImpl = new NetworkServerControlImpl(address, portNumber,", "\t\t\t\t\t\t\t\t\t\t\t\t userName, password);", "\t}", "", "\t/**", "\t * Creates a NetworkServerControl object that is configured to control", "\t * a Network Server on the default host and the default port with given", "\t * user credentials.", "\t *", "\t * @param userName\t The user name for actions requiring authorization.", "\t *\t\t\t\t\t\t ", "\t * @param password\t The password for actions requiring authorization.", "\t *\t\t\t\t\t\t ", "\t * @throws\t\t\t Exception on error", "\t */", "\tpublic NetworkServerControl(String userName, String password)", "\t\t\tthrows Exception", "\t{", "\t\tserverImpl = new NetworkServerControlImpl(userName, password);", "\t}", "" ], "header": "@@ -186,6 +185,48 @@ public class NetworkServerControl{", "removed": [] }, { "added": [ "\t\tserverImpl = new NetworkServerControlImpl(address, portNumber);", "" ], "header": "@@ -209,12 +250,9 @@ public class NetworkServerControl{", "removed": [ "\t\t", "\t\tserverImpl = new NetworkServerControlImpl(address, ", "\t\t\t\t\t\t\t\t\t\tportNumber);", "", "\t" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "import java.security.Permission;", "import java.security.AccessControlException;" ], "header": "@@ -41,7 +41,9 @@ import javax.net.ssl.SSLSocketFactory;", "removed": [] }, { "added": [ "import org.apache.derby.security.SystemPermission;" ], "header": "@@ -58,6 +60,7 @@ import java.util.StringTokenizer;", "removed": [] }, { "added": [ "import org.apache.derby.impl.jdbc.Util;", "import org.apache.derby.iapi.jdbc.AuthenticationService;", "import org.apache.derby.iapi.reference.MessageId;", "import org.apache.derby.iapi.security.SecurityUtil;" ], "header": "@@ -78,6 +81,10 @@ import org.apache.derby.iapi.tools.i18n.LocalizedResource;", "removed": [] }, { "added": [ "\t{\"p\", \"d\", \"user\", \"password\", \"ld\", \"ea\", \"ep\", \"b\", \"h\", \"s\",", "\t\t \"noSecurityManager\", \"ssl\", \"slavehost\", \"slaveport\"};", "\tpublic final static int DASHARG_PASSWORD = 3;", "\tpublic final static int DASHARG_LOADSYSIBM = 4;", "\tpublic final static int DASHARG_ENCALG = 5;", "\tpublic final static int DASHARG_ENCPRV = 6;", "\tpublic final static int DASHARG_BOOTPASSWORD = 7;", "\tpublic final static int DASHARG_HOST = 8;", "\tpublic final static int DASHARG_SESSION = 9;", "\tpublic final static int DASHARG_UNSECURE = 10;", "\tprivate final static int DASHARG_SSL = 11;", "\tprivate final static int DASHARG_SLAVEHOST = 12;", "\tprivate final static int DASHARG_SLAVEPORT = 13;", " // DERBY-2109: shutdown command now transmits user credentials", "\tprivate final static int PROTOCOL_VERSION = 2;" ], "header": "@@ -124,25 +131,27 @@ public final class NetworkServerControlImpl {", "removed": [ "\t{\"p\",\"d\",\"u\",\"ld\",\"ea\",\"ep\", \"b\", \"h\", \"s\", \"noSecurityManager\", \"ssl\", ", "\t\"slavehost\", \"slaveport\"};", "\tpublic final static int DASHARG_LOADSYSIBM = 3;", "\tpublic final static int DASHARG_ENCALG = 4;", "\tpublic final static int DASHARG_ENCPRV = 5;", "\tpublic final static int DASHARG_BOOTPASSWORD = 6;", "\tpublic final static int DASHARG_HOST = 7;", "\tpublic final static int DASHARG_SESSION = 8;", "\tpublic final static int DASHARG_UNSECURE = 9;", "\tprivate final static int DASHARG_SSL = 10;", "\tprivate final static int DASHARG_SLAVEHOST = 11;", "\tprivate final static int DASHARG_SLAVEPORT = 12;", "\tprivate final static int PROTOCOL_VERSION = 1;" ] }, { "added": [ "\tprivate final static String DEFAULT_HOST = \"localhost\";" ], "header": "@@ -164,7 +173,7 @@ public final class NetworkServerControlImpl {", "removed": [ " private final static String DEFAULT_HOST = \"localhost\";" ] }, { "added": [ "\t// DERBY-2109: Note that derby JDBC clients have a default user name", " // \"APP\" (= Property.DEFAULT_USER_NAME) assigned if they don't provide", " // credentials. We could do the same for NetworkServerControl clients", " // here, but this class is robust enough to allow for null as default.", "\tprivate String userArg = null;", "\tprivate String passwordArg = null;" ], "header": "@@ -230,8 +239,12 @@ public final class NetworkServerControlImpl {", "removed": [ "\tprivate String userArg;", "\tprivate String passwordArg;" ] }, { "added": [ "\t * @param address InetAddress to listen on, throws NPE if null", "\t * @param portNumber portNumber to listen on, -1 use property or default", "\t\tthis();", "\t/**", "\t * Internal constructor for NetworkServerControl API. ", "\t * @param userName the user name for actions requiring authorization", "\t * @param password the password for actions requiring authorization", "\t * @throws Exception on error", "\t * @see NetworkServerControl", "\t */", "\tpublic NetworkServerControlImpl(String userName, String password)", "\t\tthrows Exception", "\t{", " this();", "\t\tthis.userArg = userName;", "\t\tthis.passwordArg = password;", "\t}", "", "\t/**", "\t * Internal constructor for NetworkServerControl API. ", "\t * @param address InetAddress to listen on, throws NPE if null", "\t * @param portNumber portNumber to listen on, -1 use property or default", "\t * @param userName the user name for actions requiring authorization", "\t * @param password the password for actions requiring authorization", "\t * @throws Exception on error", "\t * @see NetworkServerControl", "\t */", "\tpublic NetworkServerControlImpl(InetAddress address, int portNumber,", "\t\t\t\t\t\t\t\t\tString userName, String password)", "\t\tthrows Exception", "\t{", "\t\tthis(address, portNumber);", "\t\tthis.userArg = userName;", "\t\tthis.passwordArg = password;", "\t}", "" ], "header": "@@ -393,24 +406,55 @@ public final class NetworkServerControlImpl {", "removed": [ "", "\t * @param address - InetAddress to listen on, May not be null. Throws NPE if null", "\t * @param portNumber - portNumber to listen on, -1 use propert or default.", "\t\tinit();", "\t\tgetPropertyInfo();" ] }, { "added": [ "\t\t\t\t// tell driver to shutdown the engine", "\t\t\t\tif (cloudscapeDriver != null) {", "\t\t\t\t\t// DERBY-2109: pass user credentials for driver shutdown", "\t\t\t\t\tfinal Properties p = new Properties();", "\t\t\t\t\tif (userArg != null) {", "\t\t\t\t\t\tp.setProperty(\"user\", userArg);", "\t\t\t\t\t}", "\t\t\t\t\tif (passwordArg != null) {", "\t\t\t\t\t\tp.setProperty(\"password\", passwordArg);", "\t\t\t\t\t}", "\t\t\t\t\tcloudscapeDriver.connect(\"jdbc:derby:;shutdown=true\", p);", "\t\t\t\t}", "\t\t\t\t// If we can't shutdown Derby, perhaps, authentication has", "\t\t\t\t// failed or System Privileges weren't granted. We will just", "\t\t\t\t// print a message to the console and proceed." ], "header": "@@ -842,13 +886,22 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\tif (cloudscapeDriver != null)", "\t\t\t\t\tcloudscapeDriver.connect(\"jdbc:derby:;shutdown=true\",", "\t\t\t\t\t\t\t\t\t\t\t (Properties) null);", "\t\t\t\t// If we can't shutdown Derby. Perhaps authentication is", "\t\t\t\t// set to true or some other reason. We will just print a", "\t\t\t\t// message to the console and proceed." ] }, { "added": [], "header": "@@ -862,8 +915,6 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t", "" ] }, { "added": [ "\t\t// DERBY-2109: transmit user credentials for System Privileges check", "\t\twriteLDString(userArg);", "\t\twriteLDString(passwordArg);" ], "header": "@@ -947,6 +998,9 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " /**", " * Authenticates the user and checks for shutdown System Privileges.", " * No Network communication needed.", " *", " * To perform this check the following policy grant is required", " * <ul>", " * <li> to run the encapsulated test:", " * permission javax.security.auth.AuthPermission \"doAsPrivileged\";", " * </ul>", " * or a SQLException will be raised detailing the cause.", " * <p>", " * In addition, for the test to succeed", " * <ul>", " * <li> the given user needs to be covered by a grant:", " * principal org.apache.derby.authentication.SystemPrincipal \"...\" {}", " * <li> that lists a shutdown permission:", " * permission org.apache.derby.security.SystemPermission \"shutdown\";", " * </ul>", " * or it will fail with a SQLException detailing the cause.", " *", " * @param user The user to be checked for shutdown privileges", " * @throws SQLException if the privileges check fails", " */", " /**", " * @throws SQLException if authentication or privileges check fails", " */", " public void checkShutdownPrivileges() throws SQLException { ", " // get the system's authentication service", " final AuthenticationService auth", " = ((AuthenticationService)", " Monitor.findService(AuthenticationService.MODULE,", " \"authentication\"));", "", " // authenticate user", " if (auth != null) {", " final Properties finfo = new Properties();", " if (userArg != null) {", " finfo.setProperty(\"user\", userArg);", " }", " if (passwordArg != null) {", " finfo.setProperty(\"password\", passwordArg);", " }", " if (!auth.authenticate((String)null, finfo)) {", " // not a valid user", " throw Util.generateCsSQLException(", " SQLState.NET_CONNECT_AUTH_FAILED,", " MessageService.getTextMessage(MessageId.AUTH_INVALID));", " }", " }", "", " // approve action if not running under a security manager", " if (System.getSecurityManager() == null) {", " return;", " }", "", " // the check", " try {", " final Permission sp", " = new SystemPermission(SystemPermission.SHUTDOWN);", " // For porting the network server to J2ME/CDC, consider calling", " // abstract method InternalDriver.checkShutdownPrivileges(user)", " // instead of static SecurityUtil.checkUserHasPermission().", " // SecurityUtil.checkUserHasPermission(userArg, sp);", " } catch (AccessControlException ace) {", " throw Util.generateCsSQLException(", "\t\t\t\tSQLState.AUTH_SHUTDOWN_MISSING_PERMISSION,", "\t\t\t\tuserArg, (Object)ace); // overloaded method", " }", " }", "", "\tpublic void directShutdown() throws SQLException {", "\t\t// DERBY-2109: the public shutdown method now checks privileges", "\t\tcheckShutdownPrivileges();", "\t\tdirectShutdownInternal();", "\t}", "\t", "\t/*", "\t Shutdown the server directly (If you have the original object)", "\t No Network communication needed.", "\t*/", "\tprivate void directShutdownInternal() {", "\t\t// DERBY-2109: the direct, unchecked shutdown is made private" ], "header": "@@ -985,17 +1039,97 @@ public final class NetworkServerControlImpl {", "removed": [ "\tpublic void directShutdown() \t{", "\t\t" ] }, { "added": [ "\t *\tCommand: shutdown", "\t *\t\t// DERBY-2109: transmit user credentials for System Privileges check", "\t *\t\t2 bytes\t\t- length of user name", "\t *\t\tn bytes\t\t- user name", "\t *\t\t2 bytes\t\t- length of password", "\t *\t\tn bytes\t\t- password" ], "header": "@@ -1335,8 +1469,12 @@ public final class NetworkServerControlImpl {", "removed": [ "\t * \tCommand: shutdown", "\t * \tNo parameters" ] }, { "added": [ "\t\t\t\t\t// DERBY-2109: receive user credentials for shutdown", "\t\t\t\t\t// System Privileges check", "\t\t\t\t\tuserArg = reader.readCmdString();", "\t\t\t\t\tpasswordArg = reader.readCmdString();", "\t\t\t\t\ttry {", "\t\t\t\t\t\tcheckShutdownPrivileges();", "\t\t\t\t\t\tsendOK(writer);", "\t\t\t\t\t\tdirectShutdownInternal();", "\t\t\t\t\t} catch (SQLException sqle) {", "\t\t\t\t\t\tsendSQLMessage(writer, sqle, SQLERROR);", "\t\t\t\t\t\t// also print a message to the console", "\t\t\t\t\t\tconsolePropertyMessage(\"DRDA_ShutdownWarning.I\",", "\t\t\t\t\t\t\t\t\t\t\t sqle.getMessage());", "\t\t\t\t\t}" ], "header": "@@ -1451,8 +1589,20 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\t\tsendOK(writer);", "\t\t\t\t\tdirectShutdown();" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/jdbc/DRDAServerStarter.java", "hunks": [ { "added": [ "\tprivate String userArg = null;", "\tprivate String passwordArg = null;" ], "header": "@@ -84,6 +84,8 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [] }, { "added": [ "\t/**", "\t * Sets configuration information for the network server to be started.", "\t * @param address InetAddress to listen on", "\t * @param portNumber portNumber to listen on", "\t * @param userName the user name for actions requiring authorization", "\t * @param password the password for actions requiring authorization", "\t * @throws Exception on error", "\t * @see NetworkServerControl", "\t */", "\tpublic void setStartInfo(InetAddress listenAddress, int portNumber,", " String userName, String password,", " PrintWriter consoleWriter)", "\t{", "\t\tthis.userArg = userName;", "\t\tthis.passwordArg = password;", " setStartInfo(listenAddress, portNumber, consoleWriter);", " }", "" ], "header": "@@ -93,6 +95,24 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [] }, { "added": [ "\t\t\t\t\t\t\t\t return serverClass.getConstructor(", " new Class[]{String.class, String.class});", "\t\t\t\t\t\t\t\t\t\t\t\t Integer.TYPE,", " String.class,", " String.class});", " }" ], "header": "@@ -164,12 +184,16 @@ public final class DRDAServerStarter implements ModuleControl, Runnable", "removed": [ "\t\t\t\t\t\t\t\t return serverClass.getConstructor(null);", "\t\t\t\t\t\t\t\t\t\t\t\t Integer.TYPE});}" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ " final InetAddress host = InetAddress.getByName(config.getHostName());", " final int port = config.getPort();", " final String user = config.getUserName();", " final String password = config.getUserPassword();", " return new NetworkServerControl(host, port, user, password);", " NetworkServerControl control", " = new NetworkServerControl(host, port, user, password);" ], "header": "@@ -373,19 +373,20 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " return new NetworkServerControl", " (InetAddress.getByName(config.getHostName()), ", " config.getPort());", " NetworkServerControl control = new NetworkServerControl", " (InetAddress.getByName(config.getHostName()), ", " config.getPort());" ] }, { "added": [ " final InetAddress host = InetAddress.getByName(config.getHostName());", " final String user = config.getUserName();", " final String password = config.getUserPassword();", " return new NetworkServerControl(host, port, user, password);" ], "header": "@@ -408,9 +409,10 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " return new NetworkServerControl", " (InetAddress.getByName(config.getHostName()), ", " port);" ] }, { "added": [ " final String user = config.getUserName();", " final String password = config.getUserPassword();", " return new NetworkServerControl(user, password);" ], "header": "@@ -422,7 +424,9 @@ final public class NetworkServerTestSetup extends BaseTestSetup {", "removed": [ " return new NetworkServerControl();" ] } ] } ]
derby-DERBY-2109-5a9d458a
DERBY-2109 Another sub-set of code from the 12 patch in the issue. Framework code in InternalDriver and sub-classes to check permissions. Code to enforce engine shutdown permission in InternalDriver but commented out. Need to understand which test code in the patch may be affected. New error messages. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@632452 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/jdbc/Driver169.java", "hunks": [ { "added": [ "import java.security.Permission;", "import java.security.AccessControlException;", "" ], "header": "@@ -31,6 +31,9 @@ import java.sql.SQLException;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/jdbc/Driver20.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.security.SecurityUtil;" ], "header": "@@ -36,6 +36,7 @@ import org.apache.derby.iapi.jdbc.BrokeredConnectionControl;", "removed": [] }, { "added": [ "import java.security.Permission;", "import java.security.AccessControlException;", "" ], "header": "@@ -45,6 +46,9 @@ import java.sql.Driver;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/jdbc/InternalDriver.java", "hunks": [ { "added": [ "import org.apache.derby.security.SystemPermission;", "" ], "header": "@@ -44,6 +44,8 @@ import org.apache.derby.iapi.sql.ResultSet;", "removed": [] }, { "added": [ "import java.security.Permission;", "import java.security.AccessControlException;", "", "import org.apache.derby.iapi.util.IdUtil;", "" ], "header": "@@ -54,6 +56,11 @@ import java.sql.SQLException;", "removed": [] }, { "added": [ "\t\t\tif (shutdown) {\t\t\t\t" ], "header": "@@ -188,8 +195,7 @@ public abstract class InternalDriver implements ModuleControl {", "removed": [ "\t\t\tif (shutdown) {", "\t\t\t\t" ] }, { "added": [ "\t\t\t\t\t// check for shutdown privileges", " // Disabled until more of the patch can be applied.", "\t\t\t\t\t//final String user = IdUtil.getUserNameFromURLProps(finfo);", " //checkShutdownPrivileges(user);", "", "" ], "header": "@@ -217,7 +223,13 @@ public abstract class InternalDriver implements ModuleControl {", "removed": [] } ] } ]
derby-DERBY-2109-a4692155
DERBY-2109: JavaDoc @see-tag fixes. Patch file: derby-2109-03-javadoc-see-tags.diff git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@545514 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/authentication/DatabasePrincipal.java", "hunks": [ { "added": [ " * @see Principal#equals" ], "header": "@@ -54,7 +54,7 @@ public class DatabasePrincipal implements Principal, Serializable {", "removed": [ " * @see Principal.equal()" ] }, { "added": [ " * @see Principal#getName()" ], "header": "@@ -71,7 +71,7 @@ public class DatabasePrincipal implements Principal, Serializable {", "removed": [ " * @see Principal.getName()" ] }, { "added": [ " * @see Principal#hashCode()" ], "header": "@@ -81,7 +81,7 @@ public class DatabasePrincipal implements Principal, Serializable {", "removed": [ " * @see Principal.hashCode()" ] } ] }, { "file": "java/engine/org/apache/derby/security/DatabasePermission.java", "hunks": [ { "added": [ " * @see DatabasePermission#DatabasePermission(String,String)" ], "header": "@@ -47,7 +47,7 @@ import java.io.ObjectOutputStream;", "removed": [ " * @see DatabasePermission(String,String)" ] }, { "added": [ " * @see Permission#Permission(String)", " * @see java.io.FilePermission#FilePermission(String,String)" ], "header": "@@ -188,8 +188,8 @@ public class DatabasePermission extends Permission {", "removed": [ " * @see Permission(String)", " * @see FilePermission(String,String)" ] }, { "added": [ " * @see Permission#implies(Permission)" ], "header": "@@ -333,7 +333,7 @@ public class DatabasePermission extends Permission {", "removed": [ " * @see Permission.implies(Permission)" ] }, { "added": [ " * @see Permission#equals(Object)" ], "header": "@@ -388,7 +388,7 @@ public class DatabasePermission extends Permission {", "removed": [ " * @see Permission.equals(Object)" ] }, { "added": [ " * @see Permission#hashCode()" ], "header": "@@ -408,7 +408,7 @@ public class DatabasePermission extends Permission {", "removed": [ " * @see Permission.hashCode()" ] } ] }, { "file": "java/engine/org/apache/derby/security/SystemPermission.java", "hunks": [ { "added": [ " * @see BasicPermission#BasicPermission(String)" ], "header": "@@ -71,7 +71,7 @@ public class SystemPermission extends BasicPermission {", "removed": [ " * @see BasicPermission(String)" ] } ] } ]
derby-DERBY-2109-c0052e0a
DERBY-2109 Security Principals and Permission classes to support system level permissions in Derby through standard Java security policy. Committed a sub-set of patch 12 related to the security code without enabling any functionality. Note that the SystemPrivilegesPermissionTest is not added into the _Suite (as the complete patch does) as I think it will fail under J2ME. It passes with classes but fails with jars but that is to be expected as the Derby's permissions classes are not yet added into the jars, this will occur once they are used. Patch contributed by: Martin Zaun Email: martin dot zaun at sun dot com git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@632419 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/security/DatabasePermission.java", "hunks": [ { "added": [ "import java.security.PrivilegedAction;", "import java.security.PrivilegedExceptionAction;", "import java.security.PrivilegedActionException;", "import java.security.AccessController;" ], "header": "@@ -22,6 +22,10 @@", "removed": [] }, { "added": [ "final public class DatabasePermission extends Permission {", " /**", " * The location text matching any database anywhere.", " */", " static public final String URL_PATH_INCLUSIVE_STRING = \"<<ALL FILES>>\";", "", " /**", " * The path type character matching any database anywhere.", " */", " static public final char URL_PATH_INCLUSIVE_CHAR = 'I';", "" ], "header": "@@ -51,13 +55,23 @@ import java.io.ObjectOutputStream;", "removed": [ "public class DatabasePermission extends Permission {" ] }, { "added": [ " * The wildcard character matching any database in a directory.", " * The wildcard character matching any database under a directory", " * or its subdirectories." ], "header": "@@ -69,14 +83,13 @@ public class DatabasePermission extends Permission {", "removed": [ " * The wildcard character specifying arbitrarily named databases", " * under a directory path.", " * The wildcard character specifying arbitrarily named databases", " * anywhere under a path and its subdirectories." ] }, { "added": [ " * characters, or {@code \"<<ALL FILES>>\"} for the \"anywhere\" permission.", " * The canonical path is used when testing permissions with implies(),", " * where real directory locations, not just notational differences,", " * ought to be compared. Analog to java.io.FilePermission, the", " * canonical path is also used by equals() and hashCode() to support" ], "header": "@@ -120,10 +133,11 @@ public class DatabasePermission extends Permission {", "removed": [ " * characters. The canonical path is used when testing permissions", " * with implies(), where real directory locations, not just notational", " * differences, ought to be compared. Analog to java.io.FilePermission,", " * the canonical path is also used by equals() and hashCode() to support" ] }, { "added": [ " * or null if this permission's path does not have a parent directory." ], "header": "@@ -134,7 +148,7 @@ public class DatabasePermission extends Permission {", "removed": [ " * or null if this permission's path does not name a parent directory." ] }, { "added": [ " * Indicates whether the path denotes an inclusive, recursive, wildcard,", " * or single location.", " * If the path denotes an inclusive, recursive or wildcard location,", " * this field's value is URL_PATH_INCLUSIVE_CHAR, URL_PATH_RECURSIVE_CHAR,", " * or URL_PATH_WILDCARD_CHAR, respectively; otherwise, it's", " * URL_PATH_SEPARATOR_CHAR denoting a single location." ], "header": "@@ -143,13 +157,13 @@ public class DatabasePermission extends Permission {", "removed": [ " * Indicates whether the path denotes a recursive, wildcard, or single", " * location.", " * If the path denotes a recursive or wildcard location, this field's", " * value is URL_PATH_RECURSIVE_CHAR or URL_PATH_WILDCARD_CHAR,", " * respectively; otherwise, it's URL_PATH_SEPARATOR_CHAR denoting a", " * single location." ] }, { "added": [ " * <li> \"directory:location/*\" - matches any database in the", " * <li> \"directory:location/-\" - matches any database under", " * <li> \"directory:*\" - matches any database in the user's current", " * <li> \"directory:-\" - matches any database under the", " * <li> {@code \"directory:<<ALL FILES>>\"} matches any database anywhere." ], "header": "@@ -171,17 +185,16 @@ public class DatabasePermission extends Permission {", "removed": [ " * <li> \"directory:location/*\" - refers to any database in the", " * <li> \"directory:location/-\" - refers to any database anywhere under", " * <li> \"directory:*\" - refers to any database in the user's current", " * <li> \"directory:-\" - refers to any database anywhere under the", " * Note that in contrast to FilePermission, there is no reasonable use", " * for a special pathname \"<<ALL FILES>>\" matching all locations." ] }, { "added": [ " if (actions == null) {", " throw new NullPointerException(\"actions can't be null\");", " }", " if (actions.length() == 0) {", " throw new IllegalArgumentException(\"actions can't be empty\");" ], "header": "@@ -209,18 +222,14 @@ public class DatabasePermission extends Permission {", "removed": [ " // note that exception messages on the action list aren't localized,", " // as is the general rule with runtime exceptions indicating", " // internal coding errors", "", "\tif (actions == null) {", "\t throw new NullPointerException(\"actions can't be null\");", "\tif (actions.length() == 0) {", "\t throw new IllegalArgumentException(\"actions can't be empty\");", "\t}" ] }, { "added": [ " if (url == null) {", " throw new NullPointerException(\"URL can't be null\");", " }", " if (url.length() == 0) {", " throw new IllegalArgumentException(\"URL can't be empty\");" ], "header": "@@ -249,18 +258,14 @@ public class DatabasePermission extends Permission {", "removed": [ " // note that exception messages on the URL aren't localized,", " // as is the general rule with runtime exceptions indicating", " // internal coding errors", "", "\tif (url == null) {", "\t throw new NullPointerException(\"URL can't be null\");", "\tif (url.length() == 0) {", "\t throw new IllegalArgumentException(\"URL can't be empty\");", "\t}" ] }, { "added": [ " // check path for inclusive/relative/recursive/wildcard specifications,", " if (p.equals(URL_PATH_INCLUSIVE_STRING)) {", " // inclusive: \"<<ALL FILES>>\" --> 'I', \"<<ALL FILES>>\"", " pathType = URL_PATH_INCLUSIVE_CHAR;", " // p = p;", " } else if (p.equals(URL_PATH_RECURSIVE_STRING)) {" ], "header": "@@ -270,9 +275,13 @@ public class DatabasePermission extends Permission {", "removed": [ " // check path for relative/recursive/wildcard specifications,", " if (p.equals(URL_PATH_RECURSIVE_STRING)) {" ] }, { "added": [ " // canonicalize the path and assign parentPath", " if (pathType == URL_PATH_INCLUSIVE_CHAR) {", " path = URL_PATH_INCLUSIVE_STRING;", " //assert(parentPath == null);", " } else {", " // resolve against user's working directory if relative pathname;", " // the read access to the system property is encapsulated in a", " // doPrivileged() block to allow for confined codebase permission", " // grants", " if (p.startsWith(URL_PATH_RELATIVE_PREFIX)) {", " final String cwd = (String)AccessController.doPrivileged(", " new PrivilegedAction() {", " public Object run() {", " return System.getProperty(\"user.dir\");", " }", " });", " // concatenated path \"<cwd>/./<path>\" will be canonicalized", " p = cwd + URL_PATH_SEPARATOR_STRING + p;", " }", " final String absPath = p;", "", " // store canonicalized path as required for implies(Permission);", " // may throw IOException; canonicalization reads the \"user.dir\"", " // system property, which we encapsulate in a doPrivileged()", " // block to allow for confined codebase permission grants", " final File f;", " try {", " f = (File)AccessController.doPrivileged(", " new PrivilegedExceptionAction() {", " public Object run() throws IOException {", " return (new File(absPath)).getCanonicalFile();", " }", " });", " } catch (PrivilegedActionException pae) {", " // pae.getCause() should be an instance of IOException,", " // as only checked exceptions will be wrapped", " throw (IOException)pae.getCause();", " }", " path = f.getPath();", "", " // store canonicalized path of parent file as required for", " // implies(Permission); may throw IOException; note that", " // the path already denotes parent directory if of wildcard type:", " // for example, the parent of \"/a/-\" or \"/a/*\" is \"/a\"", " parentPath = ((pathType != URL_PATH_SEPARATOR_CHAR)", " ? path : f.getParent());", " //assert(pathType == URL_PATH_SEPARATOR_CHAR", " // || pathType == URL_PATH_WILDCARD_CHAR", " // || pathType == URL_PATH_RECURSIVE_CHAR", " // || pathType == URL_PATH_INCLUSIVE_CHAR);", " //assert(path != null);", " //assert(parentPath == null || parentPath != null);" ], "header": "@@ -294,29 +303,60 @@ public class DatabasePermission extends Permission {", "removed": [ " // resolve against user's working directory if relative pathname", " if (p.startsWith(URL_PATH_RELATIVE_PREFIX)) {", " final String cwd = System.getProperty(\"user.dir\");", " // concatenated path \"<cwd>/./<path>\" will be canonicalized", " p = cwd + URL_PATH_SEPARATOR_STRING + p;", " // store canonicalized path as required for implies(Permission);", " // may throw IOException ", " final File f = (new File(p)).getCanonicalFile();", " this.path = f.getPath();", "", " // store canonicalized path of parent file as required for", " // implies(Permission); may throw IOException; note that", " // the path already denotes parent directory if of wildcard type:", " // for example, the parent of \"/a/-\" or \"/a/*\" is \"/a\"", " this.parentPath = ((pathType != URL_PATH_SEPARATOR_CHAR)", " ? path : f.getParent());", "", " //assert (pathType == URL_PATH_SEPARATOR_CHAR", " // || pathType == URL_PATH_WILDCARD_CHAR", " // || pathType == URL_PATH_RECURSIVE_CHAR);", " //assert (path != null);" ] }, { "added": [ " // an inclusive permission implies any other", " if (this.pathType == URL_PATH_INCLUSIVE_CHAR) {", " return true;", " }", " //assert(this.pathType != URL_PATH_INCLUSIVE_CHAR);", "", " // a non-inclusive permission cannot imply an inclusive one", " if (that.pathType == URL_PATH_INCLUSIVE_CHAR) {", " return false;", " }", " //assert(that.pathType != URL_PATH_INCLUSIVE_CHAR);", "", " //assert(this.pathType != URL_PATH_RECURSIVE_CHAR);", " //assert(that.pathType != URL_PATH_RECURSIVE_CHAR);", " //assert(this.pathType != URL_PATH_WILDCARD_CHAR);", " //assert(that.pathType != URL_PATH_WILDCARD_CHAR);", " //assert(this.pathType == URL_PATH_SEPARATOR_CHAR);", " //assert(that.pathType == URL_PATH_SEPARATOR_CHAR);" ], "header": "@@ -345,36 +385,46 @@ public class DatabasePermission extends Permission {", "removed": [ " //assert (this.pathType != URL_PATH_RECURSIVE_CHAR);", " //assert (that.pathType != URL_PATH_RECURSIVE_CHAR);", " //System.out.println(\"\");", " ", " //assert (this.pathType != URL_PATH_WILDCARD_CHAR);", " //assert (that.pathType != URL_PATH_WILDCARD_CHAR);", " //assert (this.pathType == URL_PATH_SEPARATOR_CHAR);", " //assert (that.pathType == URL_PATH_SEPARATOR_CHAR);" ] } ] }, { "file": "java/engine/org/apache/derby/security/SystemPermission.java", "hunks": [ { "added": [ "final public class SystemPermission extends BasicPermission {", " * The server and engine shutdown permission.", " static public final String SHUTDOWN = \"shutdown\";" ], "header": "@@ -28,12 +28,12 @@ import java.util.HashSet;", "removed": [ "public class SystemPermission extends BasicPermission {", " * The engine shutdown permission.", " static public final String SHUTDOWN = \"shutdownEngine\";" ] } ] } ]
derby-DERBY-2110-77d89802
DERBY-2110 - correcting typos in a number of messages - fix involved also updating MessageBuilder.java, because the resulting dita file did not correctly replace all quotes when put into html. - also corrected BlobClob4BlobTest which has the string of message 40X0D hardcoded. - also updated errorCode.out masters, incl. for j9_13 and j9_22, even though that's not really needed anymore. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@479527 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyBuild/MessageBuilder.java", "hunks": [ { "added": [ " String displayText;", " if (rawText.indexOf('\\'')>=0)", " {", " displayText = replaceSpecialChars( escapeTextWithAQuote( rawText ) );", " displayText = plugInArgs( displayText , args );", "", " }", " else", " {", " displayText = plugInArgs( replaceSpecialChars( rawText), args ) ;", " }", "" ], "header": "@@ -552,13 +552,24 @@ public class MessageBuilder extends Task", "removed": [ " String displayText = replaceSpecialChars( plugInArgs( rawText, args ) );" ] }, { "added": [ " cookedArgs[ i ] = \"<varname>&lt;\" + rawArgs[ i ] + \"&gt;</varname>\";" ], "header": "@@ -643,7 +654,7 @@ public class MessageBuilder extends Task", "removed": [ " cookedArgs[ i ] = \"&lt;\" + rawArgs[ i ] + \"&gt;\";" ] }, { "added": [ "" ], "header": "@@ -729,6 +740,7 @@ public class MessageBuilder extends Task", "removed": [] } ] } ]
derby-DERBY-2110-a396cb11
DERBY-2110 - removing innocent spaces in the tags git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@480160 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/build/org/apache/derbyBuild/MessageBuilder.java", "hunks": [ { "added": [ " \" \\\"../dtd/reference.dtd\\\">\\n\";" ], "header": "@@ -84,7 +84,7 @@ public class MessageBuilder extends Task", "removed": [ " \" \\\"../../derby/docs/trunk/src/dtd/reference.dtd\\\">\\n\";" ] }, { "added": [ " \"the corresponding text in messages.xml and/or MessageBuilder.\\n\" +" ], "header": "@@ -107,7 +107,7 @@ public class MessageBuilder extends Task", "removed": [ " \"the corresponding text in MessageBuilder.\\n\" +" ] }, { "added": [ " if ( attributes.length() >0)", " _pw.println( \"<\" + tag + \" \" + attributes + \"/>\");", " else", " _pw.println( \"<\" + tag + \"/>\");" ], "header": "@@ -206,7 +206,10 @@ public class MessageBuilder extends Task", "removed": [ " _pw.println( \"<\" + tag + \" \" + attributes + \" />\");" ] }, { "added": [ " if (attributes.length() > 0)", " _pw.println( \"<\" + tag + \" \" + attributes + \">\");", " else", " _pw.println( \"<\" + tag + \">\");" ], "header": "@@ -233,7 +236,10 @@ public class MessageBuilder extends Task", "removed": [ " _pw.println( \"<\" + tag + \" \" + attributes + \" >\");" ] }, { "added": [ " if ( attributes.length() > 0 )", " _pw.print( \"<\" + tag + \" \" + attributes + \">\");", " else", " _pw.print( \"<\" + tag + \">\");" ], "header": "@@ -279,7 +285,10 @@ public class MessageBuilder extends Task", "removed": [ " _pw.print( \"<\" + tag + \" \" + attributes + \" >\");" ] } ] } ]
derby-DERBY-2112-2c140d81
DERBY-2112 - fix NPE on executeBatchRequestX when PreparedStatement has no parameters. Fix suggested by reporter, Cesar Devera. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@505700 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2114-03f15c03
DERBY-2114: Remove double synchronization in Clock Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@528370 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/services/cache/Clock.java", "hunks": [ { "added": [ "\tprivate final CacheStat stat;" ], "header": "@@ -104,7 +104,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\tpublic final CacheStat\t\t\tstat;" ] }, { "added": [ "\t\t\t} // synchronized(this)" ], "header": "@@ -238,7 +238,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\t}" ] }, { "added": [ "\t\t\t\t} // synchronized(this)", "\t\t\t} // if (item == null)" ], "header": "@@ -285,8 +285,8 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\t\t}", "\t\t\t}" ] }, { "added": [ "\t\t} // synchronized(this)" ], "header": "@@ -351,7 +351,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t}" ] }, { "added": [ " } // synchronized(this)" ], "header": "@@ -395,7 +395,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ " }" ] }, { "added": [ "\t\t} // synchronized(this)" ], "header": "@@ -443,7 +443,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t}" ] }, { "added": [ "\t\t\t\ttoShrink = shrinkSize(getCurrentSizeNoSync());", "\t\t} // synchronized(this)" ], "header": "@@ -505,9 +505,9 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\t\ttoShrink = shrinkSize( getCurrentSize());", "\t\t}" ] }, { "added": [ "\tprivate void release(CachedItem item) {" ], "header": "@@ -518,7 +518,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\tprotected void release(CachedItem item) {" ] }, { "added": [ "\t\t} // synchronized(this)" ], "header": "@@ -538,7 +538,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t}" ] }, { "added": [ "\t\t} // synchronized(this)" ], "header": "@@ -588,7 +588,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t}" ] }, { "added": [ "\t\t\t} // synchronized(this)" ], "header": "@@ -606,7 +606,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\t}" ] }, { "added": [ "\t\t\tlong toShrink = shrinkSize(getCurrentSizeNoSync());" ], "header": "@@ -640,7 +640,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\tlong toShrink = shrinkSize( getCurrentSize());" ] }, { "added": [ "\t\t} // synchronized(this)" ], "header": "@@ -675,7 +675,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t} // out of sync block" ] }, { "added": [ "\t\t\tlong toShrink = shrinkSize(getCurrentSizeNoSync());" ], "header": "@@ -726,7 +726,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\tlong toShrink = shrinkSize( getCurrentSize());" ] }, { "added": [ "\t\t\t} // for (int position = 0;...", "\t\t} // synchronized(this)" ], "header": "@@ -761,11 +761,11 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\t}", "\t\t}" ] }, { "added": [ "\t\t\t} // synchronized(this)" ], "header": "@@ -823,7 +823,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\t}" ] }, { "added": [ "\tprivate CachedItem findFreeItem() throws StandardException {" ], "header": "@@ -834,7 +834,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\tprotected CachedItem findFreeItem() throws StandardException {" ] }, { "added": [ "\t\t\t} // synchronized(this)" ], "header": "@@ -898,7 +898,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\t\t\t}" ] }, { "added": [ "\tprivate CachedItem rotateClock(float percentOfClock) throws StandardException" ], "header": "@@ -911,7 +911,7 @@ final class Clock implements CacheManager, Serviceable {", "removed": [ "\tprotected CachedItem rotateClock(float percentOfClock) throws StandardException" ] }, { "added": [ "\t\t\t\t\t\t\tif (useByteCount &&", "\t\t\t\t\t\t\t\t\tgetCurrentSizeNoSync() > maximumSize)" ], "header": "@@ -1011,7 +1011,8 @@ restartClock:", "removed": [ "\t\t\t\t\t\t\tif( useByteCount && getCurrentSize() > maximumSize)" ] }, { "added": [ " if (getCurrentSizeNoSync() > maximumSize &&", "\t\t\t\t\t\t\t\t\t\t0 < toShrink)" ], "header": "@@ -1073,7 +1074,8 @@ restartClock:", "removed": [ " if( getCurrentSize() > maximumSize && 0 < toShrink)" ] }, { "added": [ "\t\t\t\t} // synchronized(this)" ], "header": "@@ -1111,7 +1113,7 @@ restartClock:", "removed": [ "\t\t\t\t} // out of synchronized block" ] }, { "added": [ "\tprivate int getNumberKept() {" ], "header": "@@ -1230,7 +1232,7 @@ restartClock:", "removed": [ "\tpublic int getNumberKept() {" ] }, { "added": [ "\tprivate long removeIdentity(CachedItem item) {" ], "header": "@@ -1283,7 +1285,7 @@ restartClock:", "removed": [ "\tprotected long removeIdentity(CachedItem item) {" ] }, { "added": [ "\tprivate void cleanCache(Matchable partialKey) throws StandardException {" ], "header": "@@ -1315,7 +1317,7 @@ restartClock:", "removed": [ "\tprotected void cleanCache(Matchable partialKey) throws StandardException {" ] }, { "added": [ "\t\t\t} // synchronized(this)" ], "header": "@@ -1367,7 +1369,7 @@ innerscan:", "removed": [ "\t\t\t} // end of synchronized block" ] }, { "added": [ "\tprivate long shrinkSize(long currentSize) {" ], "header": "@@ -1386,7 +1388,7 @@ innerscan:", "removed": [ "\tprotected long shrinkSize(long currentSize) {" ] }, { "added": [ "\tprivate int performWork(boolean shrinkOnly)" ], "header": "@@ -1426,7 +1428,7 @@ innerscan:", "removed": [ "\tprotected int performWork(boolean shrinkOnly)" ] }, { "added": [ "\t\t\t\tlong currentSize = getCurrentSizeNoSync();" ], "header": "@@ -1439,7 +1441,7 @@ innerscan:", "removed": [ "\t\t\t\tlong currentSize = getCurrentSize();" ] }, { "added": [ "\t\t} // synchronized(this)" ], "header": "@@ -1456,7 +1458,7 @@ innerscan:", "removed": [ "\t\t}" ] }, { "added": [ "\t\t\tlong currentSize = getCurrentSizeNoSync();" ], "header": "@@ -1482,7 +1484,7 @@ innerscan:", "removed": [ " long currentSize = getCurrentSize();" ] }, { "added": [ " currentSize = getCurrentSizeNoSync();" ], "header": "@@ -1525,7 +1527,7 @@ innerscan:", "removed": [ " currentSize = getCurrentSize();" ] }, { "added": [ " currentSize = getCurrentSizeNoSync();" ], "header": "@@ -1559,7 +1561,7 @@ innerscan:", "removed": [ " currentSize = getCurrentSize();" ] }, { "added": [ "\t\t} // synchronized(this)" ], "header": "@@ -1586,7 +1588,7 @@ innerscan:", "removed": [ "\t\t} // end of sync block" ] }, { "added": [ "\t\tstat.currentSize = getCurrentSizeNoSync();" ], "header": "@@ -1635,7 +1637,7 @@ innerscan:", "removed": [ "\t\tstat.currentSize = getCurrentSize();" ] }, { "added": [ " shrink = (shrinkSize(getCurrentSizeNoSync()) > 0);" ], "header": "@@ -1671,7 +1673,7 @@ innerscan:", "removed": [ " shrink = ( shrinkSize( getCurrentSize()) > 0);" ] }, { "added": [ "", " private synchronized long getCurrentSize() {", " return getCurrentSizeNoSync();", " }", "", " private long getCurrentSizeNoSync() {", " if (!useByteCount) {", " }" ], "header": "@@ -1701,10 +1703,15 @@ innerscan:", "removed": [ " private synchronized long getCurrentSize()", " {", " if( ! useByteCount)" ] }, { "added": [ " } // synchronized(this)" ], "header": "@@ -1760,7 +1767,7 @@ innerscan:", "removed": [ " } // end of synchronization" ] } ] } ]
derby-DERBY-2114-f07c8c71
DERBY-2114: Let Clock embed a HashMap rather than inherit from Hashtable Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@519644 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/diag/StatementCache.java", "hunks": [ { "added": [ "", "import java.util.Iterator;", "import java.util.Collection;" ], "header": "@@ -39,11 +39,12 @@ import java.sql.SQLException;", "removed": [ "import org.apache.derby.impl.services.cache.CachedItem;", "import java.util.Enumeration;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/services/cache/CacheManager.java", "hunks": [ { "added": [ "import java.util.Collection;", "" ], "header": "@@ -27,6 +27,8 @@ import org.apache.derby.iapi.services.daemon.DaemonService;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/services/cache/Clock.java", "hunks": [ { "added": [ "import java.util.HashMap;", "import java.util.Iterator;", "import java.util.Collection;" ], "header": "@@ -41,7 +41,9 @@ import org.apache.derby.iapi.util.Operator;", "removed": [ "import java.util.Hashtable;" ] }, { "added": [ "final class Clock implements CacheManager, Serviceable {", "\tprivate final HashMap cache_;" ], "header": "@@ -97,12 +99,13 @@ import java.util.Properties;", "removed": [ "final class Clock extends Hashtable implements CacheManager, Serviceable {" ] }, { "added": [ "\tClock(CacheableFactory holderFactory, String name,", "\t\t int initialSize, long maximumSize, boolean useByteCount) {", "\t\tcache_ = new HashMap(initialSize, (float) 0.95);", "\t\tthis.useByteCount = useByteCount;" ], "header": "@@ -146,16 +149,12 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\tClock(CacheableFactory holderFactory,", " String name,", " int initialSize,", " long maximumSize,", " boolean useByteCount)", " {", " super(initialSize, (float) 0.95);", " this.useByteCount = useByteCount;" ] }, { "added": [ "\t\t\t\titem = (CachedItem) cache_.get(key);" ], "header": "@@ -224,7 +223,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\titem = (CachedItem) get(key);" ] }, { "added": [ "\t\t\t\t\tCachedItem inCacheItem = (CachedItem) cache_.get(key);" ], "header": "@@ -262,7 +261,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\t\tCachedItem inCacheItem = (CachedItem) get(key);" ] }, { "added": [ "\t\t\t\t\t\tcache_.put(key, item);", "\t\t\t\t\t\t\t\tif (cache_.size() > ((11 * maximumSize) / 10))", "\t\t\t\t\t\t\t\t\tSystem.out.println", "\t\t\t\t\t\t\t\t\t\t(\"memoryLeakTrace:Cache:\" + name +", "\t\t\t\t\t\t\t\t\t\t \" \" + cache_.size());" ], "header": "@@ -273,14 +272,16 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\t\t\tput(key, item);", "\t\t\t\t\t\t\t\tif (size() > ((11 * maximumSize) / 10))", "\t\t\t\t\t\t\t\t\tSystem.out.println(\"memoryLeakTrace:Cache:\" + name + \" \" + size());" ] }, { "added": [ "\t\t\titem = (CachedItem) cache_.get(key);" ], "header": "@@ -341,7 +342,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\titem = (CachedItem) get(key);" ] }, { "added": [ " item = (CachedItem) cache_.get(keys[i]);" ], "header": "@@ -390,7 +391,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ " item = (CachedItem) get(keys[i]);" ] }, { "added": [ "\t\t\tif (cache_.get(key) != null) {", "\t\t\tcache_.put(key, item);", "\t\t\t\t\tif (cache_.size() > ((11 * maximumSize) / 10))", "\t\t\t\t\t\tSystem.out.println", "\t\t\t\t\t\t\t(\"memoryLeakTrace:Cache:\" + name + \" \" +", "\t\t\t\t\t\t\t cache_.size());" ], "header": "@@ -423,21 +424,23 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\tif (get(key) != null) {", "\t\t\tput(key, item);", "\t\t\t\t\tif (size() > ((11 * maximumSize) / 10))", "\t\t\t\t\t\tSystem.out.println(\"memoryLeakTrace:Cache:\" + name + \" \" + size());" ] }, { "added": [ "\t\t\titem = (CachedItem) cache_.get(entry.getIdentity());" ], "header": "@@ -481,7 +484,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\titem = (CachedItem) get(entry.getIdentity());" ] }, { "added": [ "\t\t\t\tcache_.remove(entry.getIdentity());" ], "header": "@@ -493,7 +496,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\tremove(entry.getIdentity());" ] }, { "added": [ "\t\t\t\tcache_.remove(item.getEntry().getIdentity());" ], "header": "@@ -529,7 +532,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\tremove(item.getEntry().getIdentity());" ] }, { "added": [ "\t\t\titem = (CachedItem) cache_.get(entry.getIdentity());" ], "header": "@@ -568,7 +571,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\titem = (CachedItem) get(entry.getIdentity());" ] }, { "added": [ "\t\t\t\tcache_.remove(entry.getIdentity());" ], "header": "@@ -582,7 +585,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\tremove(entry.getIdentity());" ] }, { "added": [ "\t\t\t\tObject removed = cache_.remove(key);" ], "header": "@@ -801,7 +804,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\tObject removed = remove(key);" ] }, { "added": [ "\t\t\t\t\tcache_.put(entry.getIdentity(), item);" ], "header": "@@ -810,7 +813,7 @@ final class Clock extends Hashtable implements CacheManager, Serviceable {", "removed": [ "\t\t\t\t\tput(entry.getIdentity(), item);" ] }, { "added": [ "\t\tcache_.remove(item.getEntry().getIdentity());" ], "header": "@@ -1292,7 +1295,7 @@ restartClock:", "removed": [ "\t\tremove(item.getEntry().getIdentity());\t\t\t\t" ] }, { "added": [ "", "\t/**", "\t * Tell if a key exists in the cache.", "\t * @param k the key to test for", "\t * @return true if k is a key in the cache", "\t */", "\tpublic synchronized boolean containsKey(Object k) {", "\t\treturn cache_.containsKey(k);", "\t}", "", "\t/**", "\t * Return a Collection of the Cacheables currently in the", "\t * cache. The Collection is a snapshot (copy) so external", "\t * synchronization isn't required. Part of the CacheManager", "\t * interface.", "\t * @return a Collection of the cache elements.", "\t */", "\tpublic synchronized Collection values() {", "\t\tArrayList al = new ArrayList();", "\t\tfor (Iterator i = cache_.values().iterator(); i.hasNext();){", "\t\t\tal.add(((CachedItem)i.next()).getEntry());", "\t\t}", "\t\treturn al;", "\t}" ], "header": "@@ -1845,4 +1848,28 @@ innerscan:", "removed": [] } ] } ]
derby-DERBY-2116-0c0db14f
DERBY-2116: Test files missing svn:eol-style Set the svn:eol-style property to native. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@478891 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java", "hunks": [ { "added": [ "/*", " *", " * Derby - Class org.apache.derbyTesting.functionTests.util.SystemPropertyTestSetup", " *", " * Licensed to the Apache Software Foundation (ASF) under one or more", " * contributor license agreements. See the NOTICE file distributed with", " * this work for additional information regarding copyright ownership.", " * The ASF licenses this file to You under the Apache License, Version 2.0", " * (the \"License\"); you may not use this file except in compliance with", " * the License. You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, ", " * software distributed under the License is distributed on an ", " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ", " * either express or implied. See the License for the specific ", " * language governing permissions and limitations under the License.", " */", "package org.apache.derbyTesting.junit;", "", "import java.security.PrivilegedActionException;", "import java.util.Enumeration;", "import java.util.Properties;", "", "", "import junit.extensions.TestSetup;", "import junit.framework.Test;", "", "/**", " * Test decorator to set a set of system properties on setUp", " * and restore them to the previous values on tearDown.", " *", " */", "public class SystemPropertyTestSetup extends TestSetup {", "\t", "\tprivate Properties newValues;", "\tprivate Properties oldValues;", "\t", "\t/**", "\t * Create a test decorator that sets and restores the passed", "\t * in properties. Assumption is that the contents of", "\t * properties and values will not change during execution.", "\t * @param test test to be decorated", "\t * @param newValues properties to be set", "\t */", "\tpublic SystemPropertyTestSetup(Test test,", "\t\t\tProperties newValues)", "\t{", "\t\tsuper(test);", "\t\tthis.newValues = newValues;", "\t\tthis.oldValues = new Properties();", "\t}", "", "\t/**", "\t * For each property store the current value and", "\t * replace it with the new value, unless there is no change.", "\t */", " protected void setUp()", " throws java.lang.Exception", " {", " \tsetProperties(newValues);", " }", "", " /**", " * Revert the properties to their values prior to the setUp call.", " */", " protected void tearDown()", " throws java.lang.Exception", " {", " \t// Clear all the system properties set by the new set", " \t// that will not be reset by the old set.", " \tfor (Enumeration e = newValues.propertyNames(); e.hasMoreElements();)", " \t{", " \t\tString key = (String) e.nextElement();", " \t\tif (oldValues.getProperty(key) == null)", " \t\t BaseTestCase.removeSystemProperty(key);", " \t}", " \t// and then reset nay old values", " \tsetProperties(oldValues);", " newValues = null;", " oldValues = null;", " }", " ", " private void setProperties(Properties values)", " throws PrivilegedActionException", " {", " \tfor (Enumeration e = values.propertyNames(); e.hasMoreElements();)", " \t{", " \t\tString key = (String) e.nextElement();", " \t\tString value = values.getProperty(key);", " \t\tString old = BaseTestCase.getSystemProperty(key);", " \t\t", " \t\tboolean change;", " \t\tif (old != null)", " \t\t{", " // set, might need to be changed.", " change = !old.equals(value);", " ", " // If we are not processing the oldValues", " // then store in the oldValues. Reference equality is ok here.", " \t\t\tif (change && (values != oldValues))", " \t\t\t oldValues.setProperty(key, old);", " \t\t}", " \t\telse {", " \t\t\t// notset, needs to be set", " \t\t\tchange = true;", " \t\t}", " \t\t", " \t\tif (change) {", " \t\t\tBaseTestCase.setSystemProperty(key, value);", " \t\t}", " \t}", " }", "}" ], "header": "@@ -1,115 +1,115 @@", "removed": [ "/*", " *", " * Derby - Class org.apache.derbyTesting.functionTests.util.SystemPropertyTestSetup", " *", " * Licensed to the Apache Software Foundation (ASF) under one or more", " * contributor license agreements. See the NOTICE file distributed with", " * this work for additional information regarding copyright ownership.", " * The ASF licenses this file to You under the Apache License, Version 2.0", " * (the \"License\"); you may not use this file except in compliance with", " * the License. You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, ", " * software distributed under the License is distributed on an ", " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ", " * either express or implied. See the License for the specific ", " * language governing permissions and limitations under the License.", " */", "package org.apache.derbyTesting.junit;", "", "import java.security.PrivilegedActionException;", "import java.util.Enumeration;", "import java.util.Properties;", "", "", "import junit.extensions.TestSetup;", "import junit.framework.Test;", "", "/**", " * Test decorator to set a set of system properties on setUp", " * and restore them to the previous values on tearDown.", " *", " */", "public class SystemPropertyTestSetup extends TestSetup {", "\t", "\tprivate Properties newValues;", "\tprivate Properties oldValues;", "\t", "\t/**", "\t * Create a test decorator that sets and restores the passed", "\t * in properties. Assumption is that the contents of", "\t * properties and values will not change during execution.", "\t * @param test test to be decorated", "\t * @param newValues properties to be set", "\t */", "\tpublic SystemPropertyTestSetup(Test test,", "\t\t\tProperties newValues)", "\t{", "\t\tsuper(test);", "\t\tthis.newValues = newValues;", "\t\tthis.oldValues = new Properties();", "\t}", "", "\t/**", "\t * For each property store the current value and", "\t * replace it with the new value, unless there is no change.", "\t */", " protected void setUp()", " throws java.lang.Exception", " {", " \tsetProperties(newValues);", " }", "", " /**", " * Revert the properties to their values prior to the setUp call.", " */", " protected void tearDown()", " throws java.lang.Exception", " {", " \t// Clear all the system properties set by the new set", " \t// that will not be reset by the old set.", " \tfor (Enumeration e = newValues.propertyNames(); e.hasMoreElements();)", " \t{", " \t\tString key = (String) e.nextElement();", " \t\tif (oldValues.getProperty(key) == null)", " \t\t BaseTestCase.removeSystemProperty(key);", " \t}", " \t// and then reset nay old values", " \tsetProperties(oldValues);", " newValues = null;", " oldValues = null;", " }", " ", " private void setProperties(Properties values)", " throws PrivilegedActionException", " {", " \tfor (Enumeration e = values.propertyNames(); e.hasMoreElements();)", " \t{", " \t\tString key = (String) e.nextElement();", " \t\tString value = values.getProperty(key);", " \t\tString old = BaseTestCase.getSystemProperty(key);", " \t\t", " \t\tboolean change;", " \t\tif (old != null)", " \t\t{", " // set, might need to be changed.", " change = !old.equals(value);", " ", " // If we are not processing the oldValues", " // then store in the oldValues. Reference equality is ok here.", " \t\t\tif (change && (values != oldValues))", " \t\t\t oldValues.setProperty(key, old);", " \t\t}", " \t\telse {", " \t\t\t// notset, needs to be set", " \t\t\tchange = true;", " \t\t}", " \t\t", " \t\tif (change) {", " \t\t\tBaseTestCase.setSystemProperty(key, value);", " \t\t}", " \t}", " }", "}" ] } ] } ]
derby-DERBY-2118-83606560
DERBY-2118: Cleanup of ArrayInputStream - Patch which improves the clearLimit() method by removing the possibility that the byte array is ever null. - Instead of using null when creating an empty ArrayInputStream an empty array is used instead. - Remove some unused methods. - Change some callers of the 2-arg setLimit() to the 1-arg setLimit() as it is more efficient. - Fix a bug where setData() would not reset the position to zero (previously it was unmodified at a potentially invalid position) Contributed by Daniel John Debrunner. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@522167 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/ArrayInputStream.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.ReuseFactory;" ], "header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [] }, { "added": [ "\t/**", "\t * Create an ArrayInputStream with a zero length byte array.", "\t * The position is set to 0 and the limit is the entire byte array.", "\t *", "\t */", "\t\tthis(ReuseFactory.getZeroLenByteArray());", "\t/**", "\t * Create an ArrayInputStream with the passed in data.", "\t * The position is set to 0 and the limit is the entire byte array.", "\t * @param data", "\t */", "\t\tPosition is set to zero.", "\t\tstart = position = 0;", "\t\tend = data.length;" ], "header": "@@ -46,38 +47,40 @@ public final class ArrayInputStream extends InputStream implements LimitObjectIn", "removed": [ "\t\tthis(null);", "\tpublic ArrayInputStream(byte[] data, int offset, int length) throws IOException {", "\t\tthis(data);", "\t\tsetLimit(offset, length);", "\t}", "", "\t\tclearLimit();", "\t}", "", "\tpublic void setData(byte[] data, int offset, int length) throws IOException {", "\t\tpageData = data;", "\t\tsetLimit(offset, length);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java", "hunks": [ { "added": [ "\t\tinStream.setLimit(CONTAINER_INFO_SIZE);" ], "header": "@@ -795,7 +795,7 @@ abstract class FileContainer", "removed": [ "\t\tinStream.setLimit(0, CONTAINER_INFO_SIZE);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/log/FileLogger.java", "hunks": [ { "added": [ "\t\t\t\t\trawInput.setLimit(optionalDataLength);" ], "header": "@@ -986,7 +986,7 @@ public class FileLogger implements Logger {", "removed": [ "\t\t\t\t\trawInput.setLimit(savePosition, optionalDataLength);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/log/FlushedScanHandle.java", "hunks": [ { "added": [ "\t\t\trawInput.setLimit(dataLength);" ], "header": "@@ -136,7 +136,7 @@ public class FlushedScanHandle implements ScanHandle", "removed": [ "\t\t\trawInput.setLimit(rawInput.getPosition(), dataLength);" ] } ] } ]
derby-DERBY-2118-ca42415a
DERBY-2118: Make ArrayInputStream.setLimit(int,int) void git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@527830 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/ArrayInputStream.java", "hunks": [ { "added": [ "\tpublic void setLimit(int offset, int length) throws IOException {", "\t\tposition = start;", "\t\tif ((offset < 0) || (length < 0) || (end > pageData.length)) {" ], "header": "@@ -160,24 +160,16 @@ public final class ArrayInputStream extends InputStream implements LimitObjectIn", "removed": [ "\tpublic int setLimit(int offset, int length) throws IOException {", "", "\t\tif ((offset < 0) || (length < 0)) {", "\t\t\tstart = end = position = 0;", "\t\t\tthrow new EOFException();", "\t\t}", "\t\tif (end > pageData.length) {", "", "\t\tposition = start;", "", "\t\treturn length;" ] }, { "added": [ " if (end > pageData.length) {" ], "header": "@@ -189,12 +181,7 @@ public final class ArrayInputStream extends InputStream implements LimitObjectIn", "removed": [ " if (end <= pageData.length)", " {", " return;", " }", " else", " {" ] } ] } ]
derby-DERBY-212-ee2a8604
DERBY-212 Optimize some specific methods in Network Server to improve performance. Submitted by Knut Anders Hatlen git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@368333 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java", "hunks": [ { "added": [ "\t/** The value returned by the previous call to", "\t * <code>parsePKGNAMCSN()</code>. */", "\tprivate Pkgnamcsn prevPkgnamcsn = null;", "\t/** Current RDB Package Name. */", "\tprivate DRDAString rdbnam = new DRDAString(ccsidManager);", "\t/** Current RDB Collection Identifier. */", "\tprivate DRDAString rdbcolid = new DRDAString(ccsidManager);", "\t/** Current RDB Package Identifier. */", "\tprivate DRDAString pkgid = new DRDAString(ccsidManager);", "\t/** Current RDB Package Consistency Token. */", "\tprivate DRDAString pkgcnstkn = new DRDAString(ccsidManager);", "\t/** Current RDB Package Section Number. */", "\tprivate int pkgsn;" ], "header": "@@ -134,11 +134,19 @@ public class DRDAConnThread extends Thread {", "removed": [ "\tprivate String rdbnam;", "\tprivate String rdbcolid;", "\tprivate String pkgid;", "\tprivate String pkgcnstknStr;", "\tprivate int secnumber;" ] }, { "added": [ "\t\t\t\t\t\tPkgnamcsn pkgnamcsn = parseOPNQRY();" ], "header": "@@ -706,7 +714,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\t\t\t\t\tString pkgnamcsn = parseOPNQRY();" ] }, { "added": [ "\t * @return RDB Package Name, Consistency Token, and Section Number", "\tprivate Pkgnamcsn parseOPNQRY() throws DRDAProtocolException, SQLException", "\t\tPkgnamcsn pkgnamcsn = null;" ], "header": "@@ -1649,12 +1657,12 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t * @return package name consistency token", "\tprivate String parseOPNQRY() throws DRDAProtocolException, SQLException", "\t\tString pkgnamcsn = null;" ] }, { "added": [ "\tprivate void writePKGNAMCSN(byte[] pkgcnstkn) throws DRDAProtocolException", "\t\tif (rdbnam.length() <= CodePoint.RDBNAM_LEN &&", "\t\t\trdbcolid.length() <= CodePoint.RDBCOLID_LEN &&", "\t\t\tpkgid.length() <= CodePoint.PKGID_LEN)", "\t\t{\t// if none of RDBNAM, RDBCOLID and PKGID have a length of", "\t\t\t// more than 18, use fixed format", "\t\t\twriter.writeScalarPaddedBytes(pkgcnstkn,", "\t\t\t\t\t\t\t\t\t\t CodePoint.PKGCNSTKN_LEN, (byte) 0);", "\t\t\twriter.writeShort(pkgsn);", "\t\t\tint len = Math.max(CodePoint.RDBNAM_LEN, rdbnam.length());", "\t\t\twriter.writeShort(len);", "\t\t\twriter.writeScalarPaddedString(rdbnam, len);", "\t\t\tlen = Math.max(CodePoint.RDBCOLID_LEN, rdbcolid.length());", "\t\t\twriter.writeShort(len);", "\t\t\twriter.writeScalarPaddedString(rdbcolid, len);", "\t\t\tlen = Math.max(CodePoint.PKGID_LEN, pkgid.length());", "\t\t\twriter.writeShort(len);", "\t\t\twriter.writeScalarPaddedString(pkgid, len);", "\t\t\twriter.writeScalarPaddedBytes(pkgcnstkn,", "\t\t\t\t\t\t\t\t\t\t CodePoint.PKGCNSTKN_LEN, (byte) 0);", "\t\t\twriter.writeShort(pkgsn);", "\t\twritePKGNAMCSN(pkgcnstkn.getBytes());" ], "header": "@@ -1965,34 +1973,42 @@ public class DRDAConnThread extends Thread {", "removed": [ "\tprivate void writePKGNAMCSN(String pkgcnstknStr) throws DRDAProtocolException", "\t\tif (rdbcolid.length() == CodePoint.RDBCOLID_LEN && rdbnam.length() <= CodePoint.RDBNAM_LEN)", "\t\t{\t//fixed format", "\t\t\twriter.writeScalarPaddedString(pkgcnstknStr, CodePoint.PKGCNSTKN_LEN);", "\t\t\twriter.writeShort(secnumber);", "\t\t\twriter.writeShort(rdbnam.length());", "\t\t\twriter.writeScalarPaddedString(rdbnam, rdbnam.length());", "\t\t\twriter.writeShort(rdbcolid.length());", "\t\t\twriter.writeScalarPaddedString(rdbcolid, rdbcolid.length());", "\t\t\twriter.writeShort(pkgid.length());", "\t\t\twriter.writeScalarPaddedString(pkgid, pkgid.length());", "\t\t\twriter.writeScalarPaddedString(pkgcnstknStr, CodePoint.PKGCNSTKN_LEN);", "\t\t\twriter.writeShort(secnumber);", "\t\twritePKGNAMCSN(pkgcnstknStr);" ] }, { "added": [ "\t\tPkgnamcsn pkgnamcsn = null;" ], "header": "@@ -2021,7 +2037,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\tString pkgnamcsn = null;" ] }, { "added": [ "\t * PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required" ], "header": "@@ -3072,7 +3088,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t * PKGNAMCAN - RDB Package Name, Consistency Token, and Section Number - required" ] }, { "added": [ "\t\tPkgnamcsn pkgnamcsn = null;" ], "header": "@@ -3087,7 +3103,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\tString pkgnamcsn = null;" ] }, { "added": [ "\t\tPkgnamcsn pkgnamcsn = null;" ], "header": "@@ -3300,7 +3316,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\tString pkgnamcsn = null;" ] }, { "added": [ "\t\tPkgnamcsn pkgnamcsn = null;" ], "header": "@@ -3367,7 +3383,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\tString pkgnamcsn = null;" ] }, { "added": [ "\t\t\twritePKGNAMCSN(stmt.getResultSetPkgcnstkn(i).getBytes());" ], "header": "@@ -3792,7 +3808,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\t\twritePKGNAMCSN(stmt.getResultSetPkgcnstknStr(i));" ] }, { "added": [ "\t\tPkgnamcsn pkgnamcsn = null;" ], "header": "@@ -4296,7 +4312,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\tString pkgnamcsn = null;" ] }, { "added": [ "\t\t\t\t\tPkgnamcsn pkgnamcsn = parsePKGNAMCSN();" ], "header": "@@ -4385,7 +4401,7 @@ public class DRDAConnThread extends Thread {", "removed": [ "\t\t\t\t\tString pkgnamcsn = parsePKGNAMCSN();" ] }, { "added": [ "\t * @return <code>Pkgnamcsn</code> value", "\tprivate Pkgnamcsn parsePKGNAMCSN() throws DRDAProtocolException", "\t\t\treader.readString(rdbnam, CodePoint.RDBNAM_LEN, true);", "\t\t\treader.readString(rdbcolid, CodePoint.RDBCOLID_LEN, true);", "\t\t\treader.readString(pkgid, CodePoint.PKGID_LEN, true);", "\t\t\treader.readString(pkgcnstkn, CodePoint.PKGCNSTKN_LEN, false);", "\t\t\t\ttrace(\"pkgcnstkn = \" + pkgcnstkn);", "\t\t\tpkgsn = reader.readNetworkShort();", "\t\t\t\ttrace(\"pkgsn = \" + pkgsn);", "\t\t\treader.readString(rdbnam, length, true);", "\t\t\treader.readString(rdbcolid, length, true);", "\t\t\treader.readString(pkgid, CodePoint.PKGID_LEN, true);", "\t\t\treader.readString(pkgcnstkn, CodePoint.PKGCNSTKN_LEN, false);", "\t\t\t\ttrace(\"pkgcnstkn = \" + pkgcnstkn);", "\t\t\tpkgsn = reader.readNetworkShort();", "\t\t\t\ttrace(\"pkgsn = \" + pkgsn);", "", "\t\t// In most cases, the pkgnamcsn object is equal to the", "\t\t// previously returned object. To avoid allocation of a new", "\t\t// object in these cases, we first check to see if the old", "\t\t// object can be reused.", "\t\tif ((prevPkgnamcsn == null) ||", "\t\t\trdbnam.wasModified() ||", "\t\t\trdbcolid.wasModified() ||", "\t\t\tpkgid.wasModified() ||", "\t\t\tpkgcnstkn.wasModified() ||", "\t\t\t(prevPkgnamcsn.getPkgsn() != pkgsn))", "\t\t{", "\t\t\t// The byte array returned by pkgcnstkn.getBytes() might", "\t\t\t// be modified by DDMReader.readString() later, so we have", "\t\t\t// to create a copy of the array.", "\t\t\tbyte[] token = new byte[pkgcnstkn.length()];", "\t\t\tSystem.arraycopy(pkgcnstkn.getBytes(), 0, token, 0, token.length);", "", "\t\t\tprevPkgnamcsn =", "\t\t\t\tnew Pkgnamcsn(rdbnam.toString(), rdbcolid.toString(),", "\t\t\t\t\t\t\t pkgid.toString(), pkgsn,", "\t\t\t\t\t\t\t new ConsistencyToken(token));", "\t\t}", "", "\t\treturn prevPkgnamcsn;" ], "header": "@@ -4612,72 +4628,91 @@ public class DRDAConnThread extends Thread {", "removed": [ "\tprivate String parsePKGNAMCSN() throws DRDAProtocolException", "\t\trdbnam = null;", "\t\trdbcolid = null;", "\t\tpkgid = null;", "\t\tsecnumber = 0;", "", "\t\t\trdbnam = reader.readString(CodePoint.RDBNAM_LEN);", "\t\t\trdbcolid = reader.readString(CodePoint.RDBCOLID_LEN);", "\t\t\tpkgid = reader.readString(CodePoint.PKGID_LEN);", "\t\t\tpkgcnstknStr = reader.readString(CodePoint.PKGCNSTKN_LEN);", "\t\t\t\ttrace(\"pkgcnstkn = \" + pkgcnstknStr);", "\t\t\tsecnumber = reader.readNetworkShort();", "\t\t\t\ttrace(\"secnumber = \" + secnumber);", "\t\t\trdbnam = reader.readString(length);", "\t\t\trdbcolid = reader.readString(length);", "\t\t\tpkgid = reader.readString(CodePoint.PKGID_LEN);", "\t\t\tpkgcnstknStr = reader.readString(CodePoint.PKGCNSTKN_LEN);", "\t\t\t\ttrace(\"pkgcnstkn = \" + pkgcnstknStr);", "\t\t\tsecnumber = reader.readNetworkShort();", "\t\t\t\ttrace(\"secnumber = \" + secnumber);", "\t\t// Note: This string is parsed by DRDAStatement.buildDB2CursorName()", "\t\treturn rdbnam + \" \" + rdbcolid + \" \" + pkgid + \" \" + secnumber + \" \" + pkgcnstknStr;" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAResultSet.java", "hunks": [ { "added": [ "\tprotected ConsistencyToken pkgcnstkn; // Unique consistency token for ResultSet 0" ], "header": "@@ -80,7 +80,7 @@ class DRDAResultSet", "removed": [ "\tprotected String pkgcnstknStr; // Unique consistency token for ResultSet 0" ] }, { "added": [ "\tprotected void setPkgcnstkn(ConsistencyToken pkgcnstkn)", "\t\tthis.pkgcnstkn = pkgcnstkn;" ], "header": "@@ -119,9 +119,9 @@ class DRDAResultSet", "removed": [ "\tprotected void setPkgcnstknStr(String pkgcnstknStr)", "\t\tthis.pkgcnstknStr = pkgcnstknStr;" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAStatement.java", "hunks": [ { "added": [ "\tprivate Pkgnamcsn pkgnamcsn;\t\t// Package name/section # and consistency token", "\tprotected ConsistencyToken pkgcnstkn; // Consistency token for the first result set", " \tprotected int pkgsn;\t\t// section number" ], "header": "@@ -61,10 +61,10 @@ class DRDAStatement", "removed": [ "\tprivate String pkgnamcsn; // Package name/section # and consistency token", "\tprotected String pkgcnstknStr; // Consistency token for the first result set", " \tprotected String sectionNumber; // section number" ] }, { "added": [ "\tprotected void setPkgnamcsn(Pkgnamcsn pkgnamcsn)", "\t\tpkgid = pkgnamcsn.getPkgid();" ], "header": "@@ -628,16 +628,13 @@ class DRDAStatement", "removed": [ "\tprotected void setPkgnamcsn(String pkgnamcsn)", "\t\tStringTokenizer st = new StringTokenizer(pkgnamcsn);", "\t\tst.nextToken(); // rdbnam (disregard)", "\t\tst.nextToken(); // rdbcolid (disregard)", "\t\tpkgid = st.nextToken(); // pkgid" ] }, { "added": [ "\t\t\tpkgsn = pkgnamcsn.getPkgsn();", "\t\t\tthis.cursorName = \"SQL_CUR\" + shortPkgid + \"C\" + pkgsn ;", "\t\tthis.pkgcnstkn = pkgnamcsn.getPkgcnstkn();" ], "header": "@@ -661,15 +658,15 @@ class DRDAStatement", "removed": [ "\t\t\tsectionNumber = st.nextToken() ;", "\t\t\tthis.cursorName = \"SQL_CUR\" + shortPkgid + \"C\" + sectionNumber ;", "\t\tthis.pkgcnstknStr = st.nextToken();" ] }, { "added": [ "\tprotected Pkgnamcsn getPkgnamcsn() " ], "header": "@@ -695,7 +692,7 @@ class DRDAStatement", "removed": [ "\tprotected String getPkgnamcsn() " ] }, { "added": [ "\t\t\tConsistencyToken key = (ConsistencyToken) resultSetKeyList.get(rsNum);" ], "header": "@@ -726,7 +723,7 @@ class DRDAStatement", "removed": [ "\t\t\tString key = (String) resultSetKeyList.get(rsNum);" ] }, { "added": [ "\t\tConsistencyToken consistToken = getResultSetPkgcnstkn(rsNum);", "\t\tif (currentDrdaRs.pkgcnstkn == consistToken)" ], "header": "@@ -762,8 +759,8 @@ class DRDAStatement", "removed": [ "\t\tString consistToken = getResultSetPkgcnstknStr(rsNum);", "\t\tif (currentDrdaRs.pkgcnstknStr == consistToken)" ] }, { "added": [ "\tprotected void setCurrentDrdaResultSet(Pkgnamcsn pkgnamcsn)", "\t\tpkgid = pkgnamcsn.getPkgid();", "\t\tpkgsn = pkgnamcsn.getPkgsn();", "\t\tConsistencyToken consistToken = pkgnamcsn.getPkgcnstkn();" ], "header": "@@ -776,9 +773,11 @@ class DRDAStatement", "removed": [ "\tprotected void setCurrentDrdaResultSet(String pkgnamcsn)", "\t\tString consistToken = extractPkgcnstknStr(pkgnamcsn);" ] }, { "added": [ "\tprivate DRDAResultSet getDrdaResultSet(ConsistencyToken consistToken)", "\t\t\t currentDrdaRs.pkgcnstkn == consistToken ))" ], "header": "@@ -789,11 +788,11 @@ class DRDAStatement", "removed": [ "\tprivate DRDAResultSet getDrdaResultSet(String consistToken)", "\t\t\t currentDrdaRs.pkgcnstknStr == consistToken ))" ] }, { "added": [ "\t\tConsistencyToken consistToken = getResultSetPkgcnstkn(rsNum);" ], "header": "@@ -809,24 +808,10 @@ class DRDAStatement", "removed": [ "\t\tString consistToken = getResultSetPkgcnstknStr(rsNum);", "", "\t/*", "\t * get consistency token from pkgnamcsn", "\t */", "\tprivate String extractPkgcnstknStr(String pkgnamcsn)", "\t{", "\t\tStringTokenizer st = new StringTokenizer(pkgnamcsn);", "\t\tst.nextToken(); // rdbnam (disregard)", "\t\tst.nextToken(); // rdbcolid (disregard)", "\t\tpkgid = st.nextToken(); // pkgid", "\t\tsectionNumber = st.nextToken() ; // secno", "\t\treturn st.nextToken();", "\t}", "" ] }, { "added": [ "\tprotected ConsistencyToken addResultSet(ResultSet value, int holdValue) throws SQLException", "\t\tConsistencyToken newRsPkgcnstkn = calculateResultSetPkgcnstkn(rsNum);" ], "header": "@@ -836,13 +821,13 @@ class DRDAStatement", "removed": [ "\tprotected String addResultSet(ResultSet value, int holdValue) throws SQLException", "\t\tString newRsPkgcnstknStr = calculateResultSetPkgcnstknStr(rsNum);" ] }, { "added": [ "\t\t\t\tresultSetTable.put(pkgcnstkn, currentDrdaRs);", "\t\t\t\tresultSetKeyList.add(0, pkgcnstkn);", "\t\t\tresultSetTable.put(newRsPkgcnstkn, newDrdaRs);", "\t\t\tresultSetKeyList.add(rsNum, newRsPkgcnstkn);", "\t\tnewDrdaRs.setPkgcnstkn(newRsPkgcnstkn);", "\t\treturn newRsPkgcnstkn;" ], "header": "@@ -858,22 +843,22 @@ class DRDAStatement", "removed": [ "\t\t\t\tresultSetTable.put(pkgcnstknStr,currentDrdaRs);", "\t\t\t\tresultSetKeyList.add(0,pkgcnstknStr);", "\t\t\tresultSetTable.put(newRsPkgcnstknStr,newDrdaRs);", "\t\t\tresultSetKeyList.add(rsNum, newRsPkgcnstknStr);", "\t\tnewDrdaRs.setPkgcnstknStr(newRsPkgcnstknStr);", "\t\treturn newRsPkgcnstknStr;" ] }, { "added": [ "\tprotected ConsistencyToken getResultSetPkgcnstkn(int rsNum)", "\t\t\treturn pkgcnstkn;", "\t\t\treturn (ConsistencyToken) resultSetKeyList.get(rsNum);\t\t\t " ], "header": "@@ -890,12 +875,12 @@ class DRDAStatement", "removed": [ "\tprotected String getResultSetPkgcnstknStr(int rsNum)", "\t\t\treturn pkgcnstknStr;", "\t\t\treturn (String) resultSetKeyList.get(rsNum);\t\t\t " ] }, { "added": [ "\t\t\ts += indent + pkgid + pkgsn ;" ], "header": "@@ -1243,7 +1228,7 @@ class DRDAStatement", "removed": [ "\t\t\ts += indent + pkgid + sectionNumber ;" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/Database.java", "hunks": [ { "added": [ "\tprivate Hashtable stmtTable;\t\t// Hash table for storing statements" ], "header": "@@ -71,7 +71,7 @@ class Database", "removed": [ "\tHashtable stmtTable;\t\t// Hash table for storing statements" ] }, { "added": [ "\tprotected DRDAStatement getDefaultStatement(Pkgnamcsn pkgnamcsn) " ], "header": "@@ -156,7 +156,7 @@ class Database", "removed": [ "\tprotected DRDAStatement getDefaultStatement(String pkgnamcsn) " ] }, { "added": [ "\tprotected DRDAStatement newDRDAStatement(Pkgnamcsn pkgnamcsn)" ], "header": "@@ -171,7 +171,7 @@ class Database", "removed": [ "\tprotected DRDAStatement newDRDAStatement(String pkgnamcsn)" ] }, { "added": [ "\tprotected DRDAStatement getDRDAStatement(Pkgnamcsn pkgnamcsn) {", "\t\tDRDAStatement newStmt =", "\t\t\t(DRDAStatement) stmtTable.get(pkgnamcsn.getStatementKey());", "\t\tif (newStmt != null) {", "\t\t\tcurrentStatement = newStmt;", "\t\t\tcurrentStatement.setCurrentDrdaResultSet(pkgnamcsn);", "\t\t}", "\t\treturn newStmt;" ], "header": "@@ -192,30 +192,14 @@ class Database", "removed": [ "\tprotected DRDAStatement getDRDAStatement(String pkgnamcsn) ", "\t\tthrows SQLException", "\t{", "\t\t// Need to get the short version because resultSets have different", "\t\t// corelation ids.", "\t\tString key = getStmtKey(pkgnamcsn);", "\t\tDRDAStatement newStmt = null;", "", "\t\t// If our current statement doesn't match,retrieve the statement", "\t\t// and make it current if not null.", "\t\tif (currentStatement == null || ", "\t\t\t!key.equals(getStmtKey(currentStatement.getPkgnamcsn())));", "\t\t\t{", "\t\t\t\tnewStmt = (DRDAStatement) stmtTable.get(key);\t\t\t\t", "\t\t\t}", "\t\t\t", "\t\t\tif (newStmt != null)\t // don't blow away currentStatement if we can't find this one", "\t\t\t\tcurrentStatement = newStmt;", "\t\t\telse", "\t\t\t\treturn null;", "", "\t\t// Set the correct result set.", "\t\tcurrentStatement.setCurrentDrdaResultSet(pkgnamcsn);", "\t\treturn currentStatement;" ] }, { "added": [ "\t\tstmtTable.put(stmt.getPkgnamcsn().getStatementKey(), stmt);", "\t\tstmtTable.remove(stmt.getPkgnamcsn().getStatementKey());" ], "header": "@@ -262,12 +246,12 @@ class Database", "removed": [ "\t\tstmtTable.put(getStmtKey(stmt.getPkgnamcsn()), stmt);", "\t\tstmtTable.remove(stmt.getPkgnamcsn());" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/Pkgnamcsn.java", "hunks": [ { "added": [ "/*", " * Derby - class org.apache.derby.impl.drda.Pkgnamcsn", " *", " * Copyright 2005 The Apache Software Foundation or its licensors, as", " * applicable.", " *", " * Licensed under the Apache License, Version 2.0 (the \"License\"); you", " * may not use this file except in compliance with the License. You", " * may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, software", " * distributed under the License is distributed on an \"AS IS\" BASIS,", " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or", " * implied. See the License for the specific language governing", " * permissions and limitations under the License.", " *", " */", "", "package org.apache.derby.impl.drda;", "", "/**", " * Class representing a PKGNAMCSN object (RDB Package Name,", " * Consistency Token, and Section Number).", " */", "final class Pkgnamcsn {", " /** Database name. */", " private final String rdbnam;", " /** RDB Package Collection Identifier. */", " private final String rdbcolid;", " /** RDB Package Identifier. */", " private final String pkgid;", " /** RDB Package Section Number. */", " private final int pkgsn;", " /** RDB Package Consistency Token. */", " private final ConsistencyToken pkgcnstkn;", "", " /** Object which can be used for hashing when the consistency", " * token can be ignored. */", " private Object statementKey = null;", "", " /**", " * Create a new <code>Pkgnamcsn</code> instance.", " *", " * @param rdbnam database name", " * @param rdbcolid RDB Package Collection Identifier", " * @param pkgid RDB Package Identifier", " * @param pkgsn RDB Package Section Number", " * @param pkgcnstkn RDB Package Consistency Token", " */", " public Pkgnamcsn(String rdbnam, String rdbcolid, String pkgid,", " int pkgsn, ConsistencyToken pkgcnstkn) {", " this.rdbnam = rdbnam;", " this.rdbcolid = rdbcolid;", " this.pkgid = pkgid;", " this.pkgsn = pkgsn;", " this.pkgcnstkn = pkgcnstkn;", " }", "", " /**", " * Get RDBNAM.", " *", " * @return database name", " */", " public String getRdbnam() {", " return rdbnam;", " }", "", " /**", " * Get RDBCOLID.", " *", " * @return RDB Package Collection Identifier", " */", " public String getRdbcolid() {", " return rdbcolid;", " }", "", " /**", " * Get PKGID.", " *", " * @return RDB Package Identifier", " */", " public String getPkgid() {", " return pkgid;", " }", "", " /**", " * Get PKGSN.", " *", " * @return RDB Package Section Number", " */", " public int getPkgsn() {", " return pkgsn;", " }", "", " /**", " * Get PKGCNSTKN.", " *", " * @return RDB Package Consistency Token", " */", " public ConsistencyToken getPkgcnstkn() {", " return pkgcnstkn;", " }", "", " /**", " * Return string representation.", " *", " * @return a <code>String</code> value", " */", " public String toString() {", " return super.toString() + \"(\\\"\" + rdbnam + \"\\\", \\\"\" +", " rdbcolid + \"\\\", \\\"\" + pkgid + \"\\\", \" + pkgsn +", " \", \" + pkgcnstkn + \")\";", " }", "", " /**", " * Return an object which can be used as a key in a hash table", " * when the value of the consistency token can be ignored. The", " * object has <code>equals()</code> and <code>hashCode()</code>", " * methods which consider other objects returned from", " * <code>getStatementKey()</code> equal if RDBNAM, RDBCOLID, PKGID", " * and PKGSN are equal.", " *", " * @return an <code>Object</code> value", " * @see Database#getDRDAStatement(Pkgnamcsn)", " * @see Database#storeStatement(DRDAStatement)", " * @see Database#removeStatement(DRDAStatement)", " */", " public Object getStatementKey() {", " if (statementKey == null) {", " statementKey = new StatementKey();", " }", " return statementKey;", " }", "", " /**", " * Class for objects used as keys in the hash table", " * <code>stmtTable</code> found in the <code>Database</code>", " * class. The <code>equals()</code> and <code>hashCode()</code>", " * methods consider other <code>StatementKey</code> objects equal", " * to this object if they are associated with a", " * <code>Pkgnamcsn</code> object with the same values for RDBNAM,", " * RDBCOLID, PKGID and PKGSN.", " *", " * @see Database", " */", " private final class StatementKey {", " /** Cached hash code. */", " private int hash = 0;", " /**", " * Check whether RDBNAM, RDBCOLID, PKGID and PKGSN of another", " * <code>StatementKey</code> object matches this object.", " *", " * @param obj another object", " * @return true if the objects are equal", " */", " public boolean equals(Object obj) {", " if (StatementKey.this == obj) {", " return true;", " } else if (obj instanceof StatementKey) {", " return ((StatementKey) obj).isKeyFor(Pkgnamcsn.this);", " } else {", " return false;", " }", " }", " /**", " * Calculate hash code.", " *", " * @return hash code", " */", " public int hashCode() {", " if (hash == 0) {", " hash =", " rdbnam.hashCode() ^", " rdbcolid.hashCode() ^", " pkgid.hashCode() ^", " pkgsn;", " }", " return hash;", " }", " /**", " * Check whether this object can be used as a key for a", " * <code>Pkgnamcsn</code> object.", " *", " * @param p a <code>Pkgnamcsn</code> value", " * @return true if this object can be key for the", " * <code>Pkgnamcsn</code> object", " */", " private boolean isKeyFor(Pkgnamcsn p) {", " return", " rdbnam.equals(p.rdbnam) &&", " rdbcolid.equals(p.rdbcolid) &&", " pkgid.equals(p.pkgid) &&", " pkgsn == p.pkgsn;", " }", " }", "}" ], "header": "@@ -0,0 +1,198 @@", "removed": [] } ] } ]
derby-DERBY-2122-0fe7da6b
DERBY-2122: Optimize ContainerLock.isCompatible() and RowLock.isCompatible() Build a bit mask from the compatibility tables in ContainerLock and RowLock, and replace look-up in two-dimensional array with bitwise and. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@481181 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/store/raw/ContainerLock.java", "hunks": [ { "added": [ "\t/** Integer representation of the type of the lock. */", "\t/** Bit mask with one bit set. The position of the bit tells the type of", "\t * the lock. */", "\tprivate final int typeBit;", "\t/** Bit mask which represents the lock types that are compatible with this", "\t * lock type. */", "\tprivate final int compat;", "", "\t/** Number of types of container locks. */", "\tpublic static final int C_NUMBER = 5;", "", "\t/** Container lock compatibility table. */", "\tprivate static final boolean[][] C_COMPAT = {", "", "\t// Granted", "\t// Request \\\tCIS\t\tCIX\t\tCS\t\tCU\t\tCX ", "\t//\t", "\t/* CIS\t*/ {\ttrue,\ttrue,\ttrue,\tfalse,\tfalse },", "\t/* CIX\t*/ {\ttrue,\ttrue,\tfalse,\tfalse,\tfalse },", "\t/* CS\t*/ {\ttrue,\tfalse,\ttrue,\tfalse,\tfalse },", "\t/* CU\t*/\t{\tfalse,\tfalse,\ttrue,\tfalse,\tfalse },", "\t/* CX\t*/ {\tfalse,\tfalse,\tfalse,\tfalse,\tfalse }", "", "\t};", "\t\ttypeBit = (1 << type);", "\t\tint bitmask = 0;", "\t\tfor (int i = 0; i < C_NUMBER; i++) {", "\t\t\t// set a bit in bitmask for each compatible lock type", "\t\t\tif (C_COMPAT[type][i]) {", "\t\t\t\tbitmask |= (1 << i);", "\t\t\t}", "\t\t}", "\t\tcompat = bitmask;" ], "header": "@@ -34,10 +34,43 @@ package org.apache.derby.iapi.store.raw;", "removed": [] }, { "added": [], "header": "@@ -54,23 +87,6 @@ public final class ContainerLock {", "removed": [ "\t/** number of types of container locks */", "\tpublic static final int C_NUMBER = 5;", "", "\t/** Container lock compatability table */", "\tprivate static final boolean[][] C_COMPAT = {", "", "\t// Granted", "\t// Request \\\tCIS\t\tCIX\t\tCS\t\tCU\t\tCX ", "\t//\t", "\t/* CIS\t*/ {\ttrue,\ttrue,\ttrue,\tfalse,\tfalse },", "\t/* CIX\t*/ {\ttrue,\ttrue,\tfalse,\tfalse,\tfalse },", "\t/* CS\t*/ {\ttrue,\tfalse,\ttrue,\tfalse,\tfalse },", "\t/* CU\t*/\t{\tfalse,\tfalse,\ttrue,\tfalse,\tfalse },", "\t/* CX\t*/ {\tfalse,\tfalse,\tfalse,\tfalse,\tfalse }", "", "\t};", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/store/raw/RowLock.java", "hunks": [ { "added": [ "\t/** Integer representation of the type of the lock. */", "\t/** Bit mask with one bit set. The position of the bit tells the type of", "\t * the lock. */", "\tprivate final int typeBit;", "\t/** Bit mask which represents the lock types that are compatible with this", "\t * lock type. */", "\tprivate final int compat;", "\t/** Number of row locks. */", "\tpublic static final int R_NUMBER = 8;", "", "\t/** Row lock compatibility table. */", "\tpublic static final boolean[][] R_COMPAT = {", " // Granted", " // Request RS2 RS3 RU2 RU3 RIP RI RX2 RX3", " //", " /* RS2 */ {true, true, true, true, true, false, false, false },", " /* RS3 */ {true, true, true, true, false, false, false, false },", " /* RU2 */ {true, true, false, false, true, false, false, false },", " /* RU3 */ {true, true, false, false, false, false, false, false },", " /* RIP */ {true, false, true, false, true, true , true, false },", " /* RI */ {false, false, false, false, true, false, false, false },", " /* RX2 */ {false, false, false, false, true, false, false, false },", " /* RX3 */ {false, false, false, false, false, false, false, false }", "\t};", "" ], "header": "@@ -34,11 +34,36 @@ package org.apache.derby.iapi.store.raw;", "removed": [] }, { "added": [], "header": "@@ -56,24 +81,6 @@ public final class RowLock {", "removed": [ "\t/** Number of row locks */", "\tpublic static final int R_NUMBER = 8;", "", "\t/** Row lock compatability table */", "\tpublic static final boolean[][] R_COMPAT = {", " // Granted", " // Request RS2 RS3 RU2 RU3 RIP RI RX2 RX3", " //", " /* RS2 */ {true, true, true, true, true, false, false, false },", " /* RS3 */ {true, true, true, true, false, false, false, false },", " /* RU2 */ {true, true, false, false, true, false, false, false },", " /* RU3 */ {true, true, false, false, false, false, false, false },", " /* RIP */ {true, false, true, false, true, true , true, false },", " /* RI */ {false, false, false, false, true, false, false, false },", " /* RX2 */ {false, false, false, false, true, false, false, false },", " /* RX3 */ {false, false, false, false, false, false, false, false }", "\t};", "" ] }, { "added": [ "\t\ttypeBit = (1 << type);", "\t\tint bitmask = 0;", "\t\tfor (int i = 0; i < R_NUMBER; i++) {", "\t\t\t// set a bit in bitmask for each compatible lock type", "\t\t\tif (R_COMPAT[type][i]) {", "\t\t\t\tbitmask |= (1 << i);", "\t\t\t}", "\t\t}", "\t\tcompat = bitmask;" ], "header": "@@ -90,6 +97,15 @@ public final class RowLock {", "removed": [] }, { "added": [ "\t\treturn (granted.typeBit & compat) != 0;" ], "header": "@@ -103,13 +119,7 @@ public final class RowLock {", "removed": [ "", "\t\treturn isCompatible(granted.getType());", "\t}", "", "\tpublic boolean isCompatible(int granted) {", "", "\t\treturn R_COMPAT[getType()][granted];" ] } ] } ]
derby-DERBY-2123-21c2a9e3
DERBY-2123: Remove workaround for old JIT bug from StoredPage git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@480861 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java", "hunks": [ { "added": [], "header": "@@ -1492,7 +1492,6 @@ public class StoredPage extends CachedPage", "removed": [ " (ErrorObjectInput) null /* always null */, " ] }, { "added": [], "header": "@@ -1504,7 +1503,6 @@ public class StoredPage extends CachedPage", "removed": [ " (ErrorObjectInput) null /* always null */, " ] }, { "added": [], "header": "@@ -1527,7 +1525,6 @@ public class StoredPage extends CachedPage", "removed": [ " (ErrorObjectInput) null /* always null */, " ] }, { "added": [], "header": "@@ -1539,7 +1536,6 @@ public class StoredPage extends CachedPage", "removed": [ " (ErrorObjectInput) null /* always null */, " ] }, { "added": [], "header": "@@ -1683,7 +1679,6 @@ public class StoredPage extends CachedPage", "removed": [ " (ErrorObjectInput) null /* always null */, " ] }, { "added": [], "header": "@@ -1695,7 +1690,6 @@ public class StoredPage extends CachedPage", "removed": [ " (ErrorObjectInput) null /* always null */, " ] }, { "added": [ " null);" ], "header": "@@ -4346,7 +4340,7 @@ public class StoredPage extends CachedPage", "removed": [ " (ErrorObjectInput) null /* always null */, null);" ] }, { "added": [ " * header." ], "header": "@@ -4844,11 +4838,7 @@ public class StoredPage extends CachedPage", "removed": [ " * header. The inUserCode parameter here is only to get around a ", " * JDK 1.1.x (at least 1.1.7) JIT bug. If inUserCode was a local variable ", " * then it is not correctly set on an exception, the only time we care ", " * about its value. It seems to work when its a parameter. Null should ", " * always be passed in. This bug is fixed in the JDK 1.2 JIT." ] }, { "added": [ " * header." ], "header": "@@ -5075,12 +5065,7 @@ public class StoredPage extends CachedPage", "removed": [ " * header. The inUserCode parameter here is only to get around a ", " * JDK 1.1.x (at least 1.1.7) JIT bug. If inUserCode was a local variable ", " * then it is not correctly set on an exception, the only time we care ", " * about its value. It seems to work when its a parameter. Null should ", " * always be passed in. This bug is fixed in the JDK 1.2 JIT.", " * <p>" ] }, { "added": [], "header": "@@ -5097,7 +5082,6 @@ public class StoredPage extends CachedPage", "removed": [ " * @param inUserCode see comments above about jit bug. " ] }, { "added": [ "\t\tErrorObjectInput inUserCode = null;" ], "header": "@@ -5110,10 +5094,10 @@ public class StoredPage extends CachedPage", "removed": [ " ErrorObjectInput inUserCode, " ] }, { "added": [ "\t\tErrorObjectInput inUserCode = null;" ], "header": "@@ -5429,10 +5413,10 @@ public class StoredPage extends CachedPage", "removed": [ " ErrorObjectInput inUserCode, " ] } ] } ]
derby-DERBY-213-3292941a
DERBY-213 additional checkin to rearrange tests Moved procedure tests to lang/procedure.java so that resultset.java can run with J2ME Contributed by Philip Wilder git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@279420 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-213-e3acc4a0
DERBY-213 - ResultSet.next() after last row of FORWARD_ONLY cursor throws an SQL Exception with Network Server - Additional tests in jdbcapi/resultset.java - Change to special flag to fix a small NullPointerException - modified output files for resultset.out, updatableResultSet.out, holdCursorJDBC30, forupdate.out - Changes to ResultSet, Statement and Connection in the org.apache.derby.client.am package. These changes have the following effects: * FORWARD_ONLY ResultSets will no longer close implicitly after the last ResultSet has been retrieved. * Checks to see if an auto-commit should be performed have been moved to Statement to mimic embedded functionality. * Multiple ResultSets will now auto-commit if all ResultSets are closed if auto-commit is turned on. Contributed by Philip Wilder git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@264128 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/client/org/apache/derby/client/am/ResultSet.java", "hunks": [ { "added": [ " //", " //Aug 24, 2005: Auto-commit logic is no longer in the closeX() method. Insted it has been ", " //moved to Statement and is handled in a manner similar to the embedded driver." ], "header": "@@ -281,6 +281,9 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [] }, { "added": [], "header": "@@ -291,10 +294,6 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " // note: closeX is still called and this will cause the", " // result set to be closed on the client. any additional calls to", " // next() will fail checkForClosedResultSet(), the query terminating exception is", " // only thrown once." ] }, { "added": [ " } ", " ", " statement_.resultSetCommitting(this);", " ", " if (sqlException != null)" ], "header": "@@ -304,16 +303,17 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " }", " closeX(); // the auto commit logic is in closeX()", " if (sqlException != null) {", " }" ] }, { "added": [ " statement_.resultSetCommitting(this);" ], "header": "@@ -385,14 +385,13 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " flowAutoCommitIfNotAutoCommitted(); // in case of early close", " flowAutoCommitIfLastOpenMultipleResultSetWasJustClosed();" ] }, { "added": [ " boolean performedAutoCommit = writeCloseAndAutoCommit();", " readCloseAndAutoCommit(performedAutoCommit);", " private boolean writeCloseAndAutoCommit() throws SqlException {", " return statement_.resultSetCommitting(this, true);", " private void readCloseAndAutoCommit(boolean readAutoCommit) throws SqlException {", " readCursorClose_();", " if (readAutoCommit) " ], "header": "@@ -413,31 +412,28 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " writeCloseAndAutoCommitIfNotAutoCommitted();", " readCloseAndAutoCommitIfNotAutoCommitted();", " private void writeCloseAndAutoCommitIfNotAutoCommitted() throws SqlException {", " writeAutoCommitIfNotAutoCommitted();", " private void readCloseAndAutoCommitIfNotAutoCommitted() throws SqlException {", " if (generatedSection_ == null) { // none call statement result set case", " readCursorClose_();", " } else { // call statement result set(s) case", " readCursorClose_();", " }" ] }, { "added": [], "header": "@@ -463,13 +459,6 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " void flowAutoCommitIfNotAutoCommitted() throws SqlException {", " if (generatedSection_ == null && connection_.autoCommit_ && !autoCommitted_) {", " connection_.flowAutoCommit();", " markAutoCommitted();", " }", " }", "" ] }, { "added": [], "header": "@@ -484,25 +473,6 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [ " private void flowAutoCommitIfLastOpenMultipleResultSetWasJustClosed() throws SqlException {", " // After this call, the generatedSection_ is reset to null to avoid repeating the commit.", " if (generatedSection_ != null && statement_ != null && statement_.resultSetList_ != null) {", " int count = 0;", " for (int i = 0; i < statement_.resultSetList_.length; i++) {", " if (statement_.resultSetList_[i] == null) {", " count++;", " }", " }", " if (count == statement_.resultSetList_.length) {", " if (connection_.autoCommit_ && !autoCommitted_) {", " connection_.flowAutoCommit();", " markAutoCommitted();", " }", " }", " }", " generatedSection_ = null; // this is prevent a subsequent close() call from doing another autocommit.", " }", "" ] }, { "added": [ " /*", " * Aug 10, 2005: Do we really only want to only null out the one resultSet? ", " * The only time this method is called is from completeLocalCommit or ", " * completeLocalRollback, both of which affect *all* ResultSets ", " */" ], "header": "@@ -3005,6 +2975,11 @@ public abstract class ResultSet implements java.sql.ResultSet,", "removed": [] } ] } ]
derby-DERBY-2130-fa6bcd6b
DERBY-2130 - Optimizer performance slowdown from 10.1 to 10.2 Patch contributed by Army Brown git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1534465 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java", "hunks": [ { "added": [ " if (initJumpState() == READY_TO_JUMP)", " firstLookOrder = new int[numOptimizables];" ], "header": "@@ -223,13 +223,8 @@ class OptimizerImpl implements Optimizer", "removed": [ "\t\tif (numTablesInQuery > 6)", "\t\t{", "\t\t\tpermuteState = READY_TO_JUMP;", "\t\t\tfirstLookOrder = new int[numOptimizables];", "\t\t}", "\t\telse", "\t\t\tpermuteState = NO_JUMP;" ] }, { "added": [ " ", " /*", " * If we JUMPed permutations last round, it's possible that we timed out", " * before finishing all of the jump processing (most likely we ended in", " * the middle of a WALK_LOW). So reset the jump state here to make sure", " * we get a clean start. Failure to do so can lead to execution of", " * code-paths that are not expected and thus incorrect cost estimates", " * (most notably, an uninitialized bestCost, which we should never see).", " * DERBY-1905.", " */", " initJumpState();", " }", " ", " /**", " * Determine if we want to try \"jumping\" permutations with this", " * OptimizerImpl, and (re-)initialize the permuteState field accordingly.", " */", " private int initJumpState() {", " permuteState = (numTablesInQuery >= 6 ? READY_TO_JUMP : NO_JUMP);", " return permuteState;", " }" ], "header": "@@ -385,7 +380,27 @@ class OptimizerImpl implements Optimizer", "removed": [ "\t}" ] } ] } ]
derby-DERBY-2131-378aa34e
DERBY-2131: Use a privileged block when calling out to the JAXP parser so that users running with a security manager can insert XML values that reference external DTDs without encountering security exceptions. This patch does not include any tests; however, relevant test cases will be enabled as part of DERBY-1758. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@481117 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java", "hunks": [ { "added": [ " protected String serializeToString(final String xmlAsText)", " final ArrayList aList = new ArrayList();", "", " /* The call to dBuilder.parse() is a call to an external", " * (w.r.t. to Derby) JAXP parser. If the received XML", " * text references an external DTD, then the JAXP parser", " * will try to read that external DTD. Thus we wrap the", " * call to parse inside a privileged action to make sure", " * that the JAXP parser has the required permissions for", " * reading the DTD file.", " */", " java.security.AccessController.doPrivileged(", " new java.security.PrivilegedExceptionAction()", " {", " public Object run() throws Exception", " {", " aList.add(dBuilder.parse(", " new InputSource(new StringReader(xmlAsText))));", " return null;", " }", " });" ], "header": "@@ -307,12 +307,29 @@ public class SqlXmlUtil implements Formatable", "removed": [ " protected String serializeToString(String xmlAsText)", " ArrayList aList = new ArrayList();", " aList.add(dBuilder.parse(", " new InputSource(new StringReader(xmlAsText))));" ] } ] } ]
derby-DERBY-2131-95685b13
DERBY-2131 (partial): Change privileged block in SqlXmlUtil.serializeToString() so that it contains as little code as possible. Also adds a catch block around the privileged block to unwrap security exceptions. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@482303 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java", "hunks": [ { "added": [ " protected String serializeToString(String xmlAsText)", " ArrayList aList = new ArrayList();" ], "header": "@@ -307,10 +307,10 @@ public class SqlXmlUtil implements Formatable", "removed": [ " protected String serializeToString(final String xmlAsText)", " final ArrayList aList = new ArrayList();" ] }, { "added": [ " try {", "", " final InputSource is = new InputSource(new StringReader(xmlAsText));", " aList.add(java.security.AccessController.doPrivileged(", " new java.security.PrivilegedExceptionAction()", " public Object run() throws IOException, SAXException", " {", " return dBuilder.parse(is);", " }", " }));", "", " } catch (java.security.PrivilegedActionException pae) {", "", " /* Unwrap the privileged exception so that the user can", " * see what the underlying error is. For example, it could", " * be an i/o error from parsing the XML value, which can", " * happen if the XML value references an external DTD file", " * but the JAXP parser hits an i/o error when trying to read", " * the DTD. In that case we want to throw the i/o error", " * itself so that it does not appear as a security exception", " * to the user.", " */", " throw pae.getException();", "", " }" ], "header": "@@ -320,16 +320,32 @@ public class SqlXmlUtil implements Formatable", "removed": [ " java.security.AccessController.doPrivileged(", " new java.security.PrivilegedExceptionAction()", " {", " public Object run() throws Exception", " aList.add(dBuilder.parse(", " new InputSource(new StringReader(xmlAsText))));", " return null;", " }", " });" ] } ] } ]
derby-DERBY-2138-1e2aae03
DERBY-2138 (partial) Cleanup imports on impl/sql/execute classes that imported DataDictionaryContext without using it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483761 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java", "hunks": [ { "added": [ "import java.util.Enumeration;", "import java.util.Iterator;", "import java.util.List;", "import java.util.Properties;", "import org.apache.derby.catalog.DependableFinder;", "import org.apache.derby.catalog.IndexDescriptor;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl;", "import org.apache.derby.catalog.types.StatisticsImpl;", "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.iapi.services.io.StreamStorable;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.sql.Activation;", "import org.apache.derby.iapi.sql.PreparedStatement;", "import org.apache.derby.iapi.sql.ResultSet;", "import org.apache.derby.iapi.sql.StatementType;", "import org.apache.derby.iapi.sql.depend.DependencyManager;", "import org.apache.derby.iapi.sql.dictionary.CheckConstraintDescriptor;", "import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;", "import org.apache.derby.iapi.sql.dictionary.DependencyDescriptor;", "import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;", "import org.apache.derby.iapi.sql.dictionary.ReferencedKeyConstraintDescriptor;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;" ], "header": "@@ -21,55 +21,48 @@", "removed": [ "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.io.StreamStorable;", "", "", "import\torg.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;", "import org.apache.derby.iapi.sql.dictionary.ReferencedKeyConstraintDescriptor;", "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.sql.dictionary.DependencyDescriptor;", "import org.apache.derby.iapi.sql.dictionary.CheckConstraintDescriptor;", "import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;", "import org.apache.derby.impl.sql.catalog.DDColumnDependableFinder;", "", "import org.apache.derby.iapi.sql.StatementType;", "", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.types.DataValueFactory;", "", "import org.apache.derby.iapi.reference.SQLState;", "", "import org.apache.derby.iapi.sql.depend.Dependency;", "import org.apache.derby.iapi.sql.depend.DependencyManager;", "import org.apache.derby.iapi.sql.depend.Provider;", "import org.apache.derby.iapi.sql.depend.ProviderInfo;", "", "import org.apache.derby.iapi.reference.SQLState;", "", "import org.apache.derby.iapi.sql.execute.ExecutionFactory;", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java", "hunks": [ { "added": [ "import java.io.IOException;", "import java.io.ObjectInput;", "import java.io.ObjectOutput;", "import java.util.Properties;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.sql.Activation;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;" ], "header": "@@ -21,43 +21,27 @@", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "", "import org.apache.derby.iapi.services.stream.HeaderPrintWriter;", "", "import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;", "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;", "import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "", "", "import org.apache.derby.iapi.sql.Activation;", "", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.io.FormatableBitSet;", "", "import org.apache.derby.catalog.UUID;", "", "import java.io.ObjectOutput;", "import java.io.ObjectInput;", "import java.io.IOException;", "", "import java.util.Properties;", "" ] } ] } ]
derby-DERBY-2138-2bb479f1
DERBY-2138 Remove the DataDictionaryContext and instead use the fact there is a single DataDictionary per database. Cleanup DependableFinder to take a passed in reference to a data dictionary rather than trying to find the data dictionary from the context. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@487307 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/catalog/DependableFinder.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "" ], "header": "@@ -23,6 +23,9 @@ package org.apache.derby.catalog;", "removed": [] }, { "added": [ " * @param dd DataDictionary to use for lookup.", "\t * @exception StandardException\t\tthrown if the object cannot be found or on error o", " public\tDependable\tgetDependable(DataDictionary dd,", " UUID dependableObjectID) throws StandardException;" ], "header": "@@ -43,12 +46,14 @@ public interface DependableFinder", "removed": [ "\t * @exception SQLException\t\tthrown on error", "\tpublic\tDependable\tgetDependable(UUID dependableObjectID) throws SQLException;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [], "header": "@@ -54,7 +54,6 @@ import org.apache.derby.iapi.sql.conn.ConnectionUtil;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;" ] }, { "added": [], "header": "@@ -793,10 +792,6 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\t\tDataDictionaryContext ddc =", "\t\t\t(DataDictionaryContext) ContextService.getContext(DataDictionaryContext.CONTEXT_ID);", "\t\tDataDictionary dd = getDataDictionary();", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DDColumnDependableFinder.java", "hunks": [ { "added": [ "\t * Find a dependable object, which is essentially a table descriptor with" ], "header": "@@ -106,7 +106,7 @@ public class DDColumnDependableFinder extends DDdependableFinder", "removed": [ "\t * Get a dependable object, which is essentially a table descriptor with" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DDdependableFinder.java", "hunks": [ { "added": [ "import java.io.IOException;", "import java.io.ObjectInput;", "import java.io.ObjectOutput;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.io.Formatable;", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "import org.apache.derby.iapi.sql.dictionary.DefaultDescriptor;", " *\tClass for most DependableFinders in the core DataDictionary.", " * This class is stored in SYSDEPENDS for the finders for", " * the provider and dependent. It stores no state, its functionality", " * is driven off its format identifier." ], "header": "@@ -21,42 +21,27 @@", "removed": [ "import org.apache.derby.iapi.services.context.ContextManager;", "import org.apache.derby.iapi.services.context.ContextService;", "", "import org.apache.derby.iapi.services.monitor.Monitor;", "", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.io.StoredFormatIds;", "import org.apache.derby.iapi.services.io.Formatable;", "", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;", "import org.apache.derby.iapi.sql.dictionary.DefaultDescriptor;", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;", "", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.error.PublicAPI;", "", "import org.apache.derby.iapi.services.i18n.MessageService;", "", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.catalog.UUID;", "", "", "import java.io.ObjectOutput;", "import java.io.ObjectInput;", "import java.io.IOException;", " *\tClass for all DependableFinders in the core DataDictionary" ] }, { "added": [], "header": "@@ -70,9 +55,6 @@ public class DDdependableFinder implements\tDependableFinder, Formatable", "removed": [ "\tprivate transient DataDictionary\t\t\tdataDictionary;", "\tprivate transient UUIDFactory\t\t\t\tuuidFactory;", "" ] }, { "added": [], "header": "@@ -145,50 +127,6 @@ public class DDdependableFinder implements\tDependableFinder, Formatable", "removed": [ "\t/**", "\t *\tGets the AliasDescriptor associated with the passed-in object ID.", "\t *", "\t *\t@param\tdependableObjectID\tthe object ID of an Alias. Used to locate its AliasDescriptor", "\t *", "\t *\t@return\tthe associated AliasDescriptor", "\t * @exception java.sql.SQLException\t\tthrown on error", "\t */", "\tpublic final Dependable\tgetDependable(UUID dependableObjectID)", "\t\t throws java.sql.SQLException", "\t{", "\t\ttry ", "\t\t{", "\t\t\treturn getDependable(getDataDictionary(),dependableObjectID);", "\t\t} ", "\t\tcatch (StandardException se) ", "\t\t{", "\t\t\tthrow PublicAPI.wrapStandardException(se);", "\t\t}", "\t}", "", "\t/**", "\t * @see DependableFinder#getSQLObjectName", "\t * @exception java.sql.SQLException\t\tthrown on error", "\t */", "\tpublic final String\tgetSQLObjectName(String idString) throws java.sql.SQLException", "\t{", "", "\t\ttry {", "", "\t\t\t// This should really be getDependable(idString).getObjectName()", "\t\t\t// and then the sub-classes would not have to provide a getSQLObjectName", "\t\t\t// method. Currently getDependable(idString).getObjectName() would", "\t\t\t// not always return the same result - fix in main.", "", "\t\t\treturn getSQLObjectName(getDataDictionary(), recreateUUID(idString));", "\t\t} ", "\t\tcatch (StandardException se) ", "\t\t{", "\t\t\tthrow PublicAPI.wrapStandardException( se );", "\t\t}", "\t}", "", "" ] }, { "added": [ "\tpublic final Dependable getDependable(DataDictionary dd, UUID dependableObjectID)", " Dependable dependable = findDependable(dd, dependableObjectID);", " if (dependable == null)", " throw StandardException.newException(SQLState.LANG_OBJECT_NOT_FOUND,", " getSQLObjectType(), dependableObjectID);", " return dependable;", " }", " ", " ", " /**", " * Find the dependable for getDependable.", " * Can return a null references, in which case getDependable()", " * will thrown an exception.", " */", " Dependable findDependable(DataDictionary dd, UUID dependableObjectID)", " throws StandardException", " { ", " return dd.getAliasDescriptor(dependableObjectID);", " return dd.getConglomerateDescriptor(dependableObjectID);", " return dd.getConstraintDescriptor(dependableObjectID);", " if (cd != null)", " return new DefaultDescriptor(", " return null;", " return dd.getFileInfoDescriptor(dependableObjectID);", " return dd.getSchemaDescriptor(dependableObjectID, null);", " return dd.getSPSDescriptor(dependableObjectID);", " return dd.getTableDescriptor(dependableObjectID);", " return dd.getTriggerDescriptor(dependableObjectID);", " ", " return dd.getViewDescriptor(dependableObjectID);", " case StoredFormatIds.COLUMNS_PERMISSION_FINDER_V01_ID:", " return dd.getColumnPermissions(dependableObjectID);", " return dd.getTablePermissions(dependableObjectID);", " return dd.getRoutinePermissions(dependableObjectID);" ], "header": "@@ -248,94 +186,75 @@ public class DDdependableFinder implements\tDependableFinder, Formatable", "removed": [ "\t/**", "\t *\tGets the datadictionary for this connection.", "\t *", "\t *\t@return\tthe data dictionary for this connection", "\t *", "\t * @exception StandardException\t\tThrown on failure", "\t */", "\tprivate\tDataDictionary\tgetDataDictionary()", "\t\t\t\t\t\tthrows StandardException", "\t{", "\t\tif ( dataDictionary == null )", "\t {", "\t\t\tContextManager\t\t\t\tcm = ContextService.getFactory().getCurrentContextManager();", "\t\t\tDataDictionaryContext\t\tddc = (DataDictionaryContext)", "\t\t\t (cm.getContext(DataDictionaryContext.CONTEXT_ID));", "\t\t\tdataDictionary = ddc.getDataDictionary();", "\t\t}", "\t\treturn\tdataDictionary;", "\t}", "", "\t/**", "\t * Get the UUID for the given string", "\t *", "\t * @param idString the string", "\t *", "\t * @return the UUID", "\t */", "\tprivate UUID recreateUUID(String idString)", "\t{", "\t\tif (uuidFactory == null)", "\t\t{", "\t\t\tuuidFactory = Monitor.getMonitor().getUUIDFactory();", "\t\t}", "\t\treturn uuidFactory.recreateUUID(idString);", "\t}", "", "\tprotected Dependable getDependable(DataDictionary dd, UUID dependableObjectID)", "\t\t\t\treturn dd.getAliasDescriptor(dependableObjectID);", "\t\t\t\treturn dd.getConglomerateDescriptor(dependableObjectID);", "\t\t\t\treturn dd.getConstraintDescriptor(dependableObjectID);", "\t\t\t\tDefaultDescriptor ddi = new DefaultDescriptor(", "\t\t\t\treturn ddi;", "\t\t\t\treturn dd.getFileInfoDescriptor(dependableObjectID);", "\t\t\t\treturn dd.getSchemaDescriptor(dependableObjectID, null);", "\t\t\t\treturn dd.getSPSDescriptor(dependableObjectID);", "\t\t\t\treturn dd.getTableDescriptor(dependableObjectID);", "\t\t\t\treturn dd.getTriggerDescriptor(dependableObjectID);", "", "\t\t\t\treturn dd.getViewDescriptor(dependableObjectID);", "\t\t\tcase StoredFormatIds.COLUMNS_PERMISSION_FINDER_V01_ID:", "\t\t\t\treturn dd.getColumnPermissions(dependableObjectID);", "\t\t\t\treturn dd.getTablePermissions(dependableObjectID);", "\t\t\t\treturn dd.getRoutinePermissions(dependableObjectID);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [], "header": "@@ -39,7 +39,6 @@ import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;" ] }, { "added": [], "header": "@@ -642,9 +641,6 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t/* push a datadictionary context onto this stack */", "\t\tpushDataDictionaryContext(cm);", "" ] }, { "added": [], "header": "@@ -723,7 +719,6 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tcm.popContext(); // the data dictionary context; check that it is?" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\t\t\t\t\t\tgetDependable(dd," ], "header": "@@ -321,20 +321,10 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\t\t\t\t\ttry", "\t\t\t\t\t\t\t\t{", "\t\t\t\t\t\t\t\t\t\t\t\t\tgetDependable(", "\t\t\t\t\t\t\t\t}", "\t\t\t\t\t\t\t\tcatch(java.sql.SQLException te)", "\t\t\t\t\t\t\t\t{", "\t\t\t\t\t\t\t\t\tif (SanityManager.DEBUG)", "\t\t\t\t\t\t\t\t\t{", "\t\t\t\t\t\t\t\t\t\tSanityManager.THROWASSERT(\"unexpected java.sql.SQLException - \" + te);", "\t\t\t\t\t\t\t\t\t}", "\t\t\t\t\t\t\t\t}" ] }, { "added": [ "\t\t\t\t\tDependencyDescriptor dependDescr =", " (DependencyDescriptor) depsIterator.next();", " ", " DependableFinder providerFinder = dependDescr.getProviderFinder();", " DependableFinder dependentFinder = dependDescr.getDependentFinder();", " ", "", "\t\t\t\t\tdependStr[i++] =", " providerFinder.getDependable(dd, dependDescr.getProviderID()).getObjectName() +", " \", type \" + providerFinder.getSQLObjectType() +", " \", provides for \" +", " dependentFinder.getDependable(dd, dependDescr.getUUID()).getObjectName() +", " \", type \" + dependentFinder.getSQLObjectType() +", " \"\\n\";" ], "header": "@@ -1044,25 +1034,26 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\t\tDependencyDescriptor dd = (DependencyDescriptor)depsIterator.next();", "", "\t\t\t\t\tdependStr[i++] = new String(", "\t\t\t\t\t\t\t\t\tdd.getProviderFinder().getSQLObjectName(", "\t\t\t\t\t\t\t\t\t\tdd.getProviderID().toString()) +", "\t\t\t\t\t\t\t\t\t\", type \" +", "\t\t\t\t\t\t\t\t\tdd.getProviderFinder().getSQLObjectType() +", "\t\t\t\t\t\t\t\t\t\", provides for \" +", "\t\t\t\t\t\t\t\t\tdd.getDependentFinder().getSQLObjectName(", "\t\t\t\t\t\t\t\t\t\tdd.getUUID().toString()) +", "\t\t\t\t\t\t\t\t\t\", type \" +", "\t\t\t\t\t\t\t\t\tdd.getDependentFinder().getSQLObjectType() +", "\t\t\t\t\t\t\t\t\t\"\\n\");" ] }, { "added": [ "\t\t\t\t\ttempD = (Dependent) finder.getDependable(dd, depDesc.getUUID() );" ], "header": "@@ -1198,9 +1189,8 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\ttry {", "\t\t\t\t\ttempD = (Dependent) finder.getDependable( depDesc.getUUID() );" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/T_ConsistencyChecker.java", "hunks": [ { "added": [], "header": "@@ -24,7 +24,6 @@ package org.apache.derbyTesting.functionTests.util;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;" ] }, { "added": [ " /**", " * Run all of the consistency checkers which do not take parameters.", " * Actually, just run the ones that \"make sense\" to run. Today,", " * that is:", " * countOpens()", " *", " * @return String If an inconsistency is found, and if DEBUG is on, ", " * then a string will be returned with more info. ", " * If DEBUG is off, then a simple string will be ", " * returned stating whether or not there are open scans.", " *", " * @exception StandardException Thrown on error", " * @exception java.sql.SQLException Thrown on error", " */", " public static String runConsistencyChecker() throws StandardException, java.sql.SQLException", " {", " return countOpens() + countDependencies();", " }", "", " /**", " * Check to make sure that there are no open conglomerates, scans or sorts.", " *", " * @return String If an inconsistency is found, and if DEBUG is on, ", " * then a string will be returned with more info. ", " * If DEBUG is off, then a simple string will be ", " * returned stating whether or not there are open scans.", " *", " * @exception StandardException Thrown on error", " */", " public static String countOpens() throws StandardException", " {", " int numOpens = 0;", " LanguageConnectionContext lcc;", " String output = \"No open scans, etc.\\n\";", " TransactionController tc;", "", " lcc = (LanguageConnectionContext)", " ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);", " tc = lcc.getTransactionExecute();", "", " numOpens = tc.countOpens(TransactionController.OPEN_TOTAL);", "", " if (numOpens > 0)", " {", " }", "", " return output;", " }", "", " /**", " * Check to make sure that there are no active dependencies (stored or", " * in memory).", " *", " * @return String If an inconsistency is found, and if DEBUG is on, ", " * then a string will be returned with more info. ", " * If DEBUG is off, then a simple string will be ", " * returned stating whether or not there are open scans.", " *", " * @exception StandardException Thrown on error", " * @exception java.sql.SQLException Thrown on error", " */", " public static String countDependencies() throws StandardException, java.sql.SQLException", " {", " int numDependencies = 0;", " DataDictionary dd;", " DependencyManager dm;", " StringBuffer debugBuf = new StringBuffer();", "", " LanguageConnectionContext lcc = (LanguageConnectionContext)", " ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);", "", " dd = lcc.getDataDictionary();", " dm = dd.getDependencyManager();", "", " numDependencies = dm.countDependencies();", "", " if (numDependencies > 0)", " {", " debugBuf.append(numDependencies + \" dependencies found\");", " }", " else", " {", " debugBuf.append(\"No outstanding dependencies.\\n\");", " }", "", " return debugBuf.toString();", " }" ], "header": "@@ -447,103 +446,93 @@ public class T_ConsistencyChecker", "removed": [ "", "", "\t// following methods are originally from a different class - used in the test store/backupRestore1", "\t// original comment for that class:", "\t/**", "\t * This class provides static methods for checking the consistency of database", "\t * objects like tables.", "\t */", "", "\t/**", "\t * Run all of the consistency checkers which do not take parameters.", "\t * Actually, just run the ones that \"make sense\" to run. Today,", "\t * that is:", "\t *\t\tcountOpens()", "\t *", "\t * @return String\t\tIf an inconsistency is found, and if DEBUG is on, ", "\t *\t\t\t\t\t\tthen a string will be returned with more info. ", "\t *\t\t\t\t\t\tIf DEBUG is off, then a simple string will be ", "\t *\t\t\t\t\t\treturned stating whether or not there are open scans.", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t * @exception java.sql.SQLException\t\tThrown on error", "\t */", "\tpublic static String runConsistencyChecker() throws StandardException, java.sql.SQLException", "\t{", "\t\treturn countOpens() + countDependencies();", "\t}", "", "\t/**", "\t * Check to make sure that there are no open conglomerates, scans or sorts.", "\t *", "\t * @return String\t\tIf an inconsistency is found, and if DEBUG is on, ", "\t *\t\t\t\t\t\tthen a string will be returned with more info. ", "\t *\t\t\t\t\t\tIf DEBUG is off, then a simple string will be ", "\t *\t\t\t\t\t\treturned stating whether or not there are open scans.", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t */", "\tpublic static String countOpens() throws StandardException", "\t{", "\t\tint\t\t\t\t\t\tnumOpens = 0;", "\t\tLanguageConnectionContext lcc;", "\t\tString\t\t\t\t\toutput = \"No open scans, etc.\\n\";", "\t\tTransactionController\ttc;", "", "\t\tlcc = (LanguageConnectionContext)", "\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);", "\t\ttc = lcc.getTransactionExecute();", "", "\t\tnumOpens = tc.countOpens(TransactionController.OPEN_TOTAL);", "", "\t\tif (numOpens > 0)", "\t\t{", "\t\t}", "", "\t\treturn output;", "\t}", "", "\t/**", "\t * Check to make sure that there are no active dependencies (stored or", "\t * in memory).", "\t *", "\t * @return String\t\tIf an inconsistency is found, and if DEBUG is on, ", "\t *\t\t\t\t\t\tthen a string will be returned with more info. ", "\t *\t\t\t\t\t\tIf DEBUG is off, then a simple string will be ", "\t *\t\t\t\t\t\treturned stating whether or not there are open scans.", "\t *", "\t * @exception StandardException\t\tThrown on error", "\t * @exception java.sql.SQLException\t\tThrown on error", "\t */", "\tpublic static String countDependencies() throws StandardException, java.sql.SQLException", "\t{", "\t\tint\t\t\t\t\t\tnumDependencies = 0;", "\t\tDataDictionary\t\t\tdd;", "\t\tDataDictionaryContext\tddc;", "\t\tDependencyManager\t\tdm;", "\t\tStringBuffer\t\t\tdebugBuf = new StringBuffer();", "", "\t\tddc = (DataDictionaryContext)", "\t\t\t\t(ContextService.getContext(DataDictionaryContext.CONTEXT_ID));", "", "\t\tdd = ddc.getDataDictionary();", "\t\tdm = dd.getDependencyManager();", "", "\t\tnumDependencies = dm.countDependencies();", "", "\t\tif (numDependencies > 0)", "\t\t{", "\t\t\tdebugBuf.append(numDependencies + \" dependencies found\");", "\t\t}", "\t\telse", "\t\t{", "\t\t\tdebugBuf.append(\"No outstanding dependencies.\\n\");", "\t\t}", "", "\t\treturn debugBuf.toString();", "\t}" ] } ] } ]
derby-DERBY-2138-4841b0e3
DERBY-2138 (partial) Move the booting of the DataDictionary to BasicDatabase from LanguageConnectionFactory wihc makes more sense once there is a single dictionary per database. Change some calls to obtain a reference to the DataDictionary from Database instead of looking for the pushed DataDictionaryContext. DataDictionaryContext context is still pushed, this is an incremental step to removing it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@484841 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/db/Database.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionary;" ], "header": "@@ -25,6 +25,7 @@ import org.apache.derby.iapi.services.context.ContextManager;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [ " /**", " * DataDictionary for this database.", " */", " private DataDictionary dd;", " " ], "header": "@@ -115,6 +115,11 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [] }, { "added": [ " ", " dd = (DataDictionary)", " Monitor.bootServiceModule(create, this,", " DataDictionary.MODULE, startParams);" ], "header": "@@ -191,6 +196,10 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [] }, { "added": [ " ", " /**", " * Return the DataDictionary for this database, set up at boot time.", " */", " public final DataDictionary getDataDictionary()", " {", " return dd;", " }" ], "header": "@@ -287,6 +296,14 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [] }, { "added": [], "header": "@@ -615,12 +632,6 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\t\tDataDictionaryContext ddc =", "\t\t\t(DataDictionaryContext)ContextService.getContext(DataDictionaryContext.CONTEXT_ID);", "\t\tif (SanityManager.DEBUG)", "\t\t\tif (ddc == null) SanityManager.THROWASSERT(\"Class path change with no connection\");", "\t\tDataDictionary dd = ddc.getDataDictionary();", "" ] }, { "added": [ " getDataDictionary().invalidateAllSPSPlans();" ], "header": "@@ -654,15 +665,10 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "\t\t\tDataDictionaryContext ddc =", "\t\t\t\t(DataDictionaryContext)ContextService.getContext(DataDictionaryContext.CONTEXT_ID);", "\t\t\tif (SanityManager.DEBUG)", "\t\t\t\tif (ddc == null) SanityManager.THROWASSERT(\"Class path change with no connection\");", "\t\t\tDataDictionary dd = ddc.getDataDictionary();", "\t\t\tdd.invalidateAllSPSPlans();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [], "header": "@@ -52,7 +52,6 @@ import org.apache.derby.iapi.sql.conn.StatementContext;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java", "hunks": [ { "added": [], "header": "@@ -102,7 +102,6 @@ public class GenericLanguageConnectionFactory", "removed": [ "\tprotected \tDataDictionary\tdd;" ] }, { "added": [ "\t\tdb.getDataDictionary().pushDataDictionaryContext(cm);" ], "header": "@@ -170,7 +169,7 @@ public class GenericLanguageConnectionFactory", "removed": [ "\t\tpushDataDictionaryContext(cm);" ] }, { "added": [], "header": "@@ -263,11 +262,6 @@ public class GenericLanguageConnectionFactory", "removed": [ "\tprotected void pushDataDictionaryContext(ContextManager cm) {", "\t\t// we make sure there is a data dictionary context in place.", "\t\tdd.pushDataDictionaryContext(cm);", "\t}", "" ] }, { "added": [], "header": "@@ -319,8 +313,6 @@ public class GenericLanguageConnectionFactory", "removed": [ "\t\tbootDataDictionary(create, startParams);", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java", "hunks": [ { "added": [], "header": "@@ -48,7 +48,6 @@ import org.apache.derby.iapi.sql.depend.ProviderList;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;" ] }, { "added": [ " ", " /**", " * DataDictionary for this database.", " */", " private final DataDictionary dd;" ], "header": "@@ -75,6 +74,11 @@ import java.util.List;", "removed": [] }, { "added": [], "header": "@@ -149,7 +153,6 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\tDataDictionary\t\t\t\tdd = getDataDictionary();" ] }, { "added": [], "header": "@@ -181,8 +184,6 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\tDataDictionary\t\t\t\tdd = getDataDictionary();", "\t\t" ] }, { "added": [], "header": "@@ -300,7 +301,6 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\t\t\t\tDataDictionary dd = getDataDictionary();" ] }, { "added": [], "header": "@@ -443,7 +443,6 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\tDataDictionary\t\t\t dd = getDataDictionary();" ] }, { "added": [ "\t\t\tList storedDeps = dd.getAllDependencyDescriptorsList();" ], "header": "@@ -900,8 +899,7 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\tList storedDeps = getDataDictionary().", "\t\t\t\t\t\t\t\t\tgetAllDependencyDescriptorsList();" ] }, { "added": [ "\t\t\t\tList storedDeps = dd.getAllDependencyDescriptorsList();" ], "header": "@@ -1038,8 +1036,7 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\tList storedDeps =", "\t\t\t\t\t\t\tgetDataDictionary().getAllDependencyDescriptorsList();" ] }, { "added": [ "\tpublic BasicDependencyManager(DataDictionary dd) {", " this.dd = dd;" ], "header": "@@ -1095,7 +1092,8 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\tpublic BasicDependencyManager() {" ] }, { "added": [], "header": "@@ -1236,39 +1234,6 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t/**", "\t * Returns the DataDictionary to use.", "\t *", "\t * @return DataDictionary\tThe DataDictionary to use.", "\t */", "\tprivate DataDictionary getDataDictionary()", "\t{", "\t\tif (dataDictionary == null)", "\t\t{", "\t\t\tDataDictionaryContext\t ddc;", "\t\t\t", "\t\t\tddc = (DataDictionaryContext)", "\t\t\t\t\t\t(ContextService.getContext(DataDictionaryContext.CONTEXT_ID));", "", "", "\t\t\tdataDictionary = ddc.getDataDictionary();", "\t\t}", "", "\t\treturn dataDictionary;", "\t}", "", "\t/**", "\t * Returns the LanguageConnectionContext to use.", "\t *", "\t * @return LanguageConnectionContext\tThe LanguageConnectionContext to use.", "\t */", "\tprivate LanguageConnectionContext getLanguageConnectionContext()", "\t{", "\t\t// find the language context.", "\t\treturn (LanguageConnectionContext) ", "\t\t\t\tContextService.getContext(LanguageConnectionContext.CONTEXT_ID);", "\t}", "" ] }, { "added": [ "\t\t\t\t\t\t\t\tdd.getDependentsDescriptorList(" ], "header": "@@ -1347,8 +1312,7 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\t\t\t\tgetDataDictionary().", "\t\t\t\t\t\t\t\tgetDependentsDescriptorList(" ] }, { "added": [ "\t\t\t\t\t\t\t\tdd.getProvidersDescriptorList(" ], "header": "@@ -1400,8 +1364,7 @@ public class BasicDependencyManager implements DependencyManager {", "removed": [ "\t\t\t\t\t\t\tgetDataDictionary().", "\t\t\t\t\t\t\t\tgetProvidersDescriptorList(" ] } ] } ]
derby-DERBY-2138-62675ae2
DERBY-2138 (partial) More import cleanups in iapi/db git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483765 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/db/ConsistencyChecker.java", "hunks": [ { "added": [], "header": "@@ -24,7 +24,6 @@ package org.apache.derby.iapi.db;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;" ] }, { "added": [], "header": "@@ -34,8 +33,6 @@ import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;", "removed": [ "import org.apache.derby.iapi.sql.depend.DependencyManager;", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/db/OnlineCompress.java", "hunks": [ { "added": [], "header": "@@ -24,24 +24,17 @@ package org.apache.derby.iapi.db;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;", "import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;", "import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;", "import org.apache.derby.iapi.sql.depend.DependencyManager;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.types.DataValueFactory;", "" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/db/PropertyInfo.java", "hunks": [ { "added": [], "header": "@@ -30,7 +30,6 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;" ] }, { "added": [], "header": "@@ -39,7 +38,6 @@ import org.apache.derby.iapi.store.access.ConglomerateController;", "removed": [ "import org.apache.derby.iapi.reference.SQLState;" ] } ] } ]
derby-DERBY-2138-69373d6e
DERBY-2138 (partial) Cleanup imports in functionTests.util that imported DatadictionaryContext but did not use it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483766 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/TestPropertyInfo.java", "hunks": [ { "added": [ "import java.util.Properties;", "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;" ], "header": "@@ -21,24 +21,19 @@", "removed": [ "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.error.PublicAPI;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "", "import org.apache.derby.iapi.db.PropertyInfo;", "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;", "", "import java.util.Properties;", "" ] } ] } ]
derby-DERBY-2138-6fbf6699
DERBY-2138 (partial) Organize imports in impl/sql/catalog for classes that import DataDictionaryContext but do not use it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483762 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/SYSVIEWSRowFactory.java", "hunks": [ { "added": [ "import org.apache.derby.catalog.UUID;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.iapi.sql.dictionary.SystemColumn;", "import org.apache.derby.iapi.types.DataValueDescriptor;", "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.iapi.types.TypeId;" ], "header": "@@ -21,37 +21,21 @@", "removed": [ "import org.apache.derby.iapi.types.DataValueDescriptor;", "", "import org.apache.derby.iapi.types.TypeId;", "import org.apache.derby.iapi.sql.dictionary.SystemColumn;", "import org.apache.derby.catalog.TypeDescriptor;", "", "import org.apache.derby.iapi.types.DataValueFactory;", "import org.apache.derby.iapi.types.RowLocation;", "", "import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;", "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;", "", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.sql.execute.ExecIndexRow;", "", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.catalog.UUID;", "import org.apache.derby.catalog.IndexDescriptor;", "", "import java.util.Properties;" ] } ] } ]
derby-DERBY-2138-cacb73f0
DERBY-2138 (partial) Cleanup DependableFinder and associated classes by removing an unused method and adding comments to related classes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@486240 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/DDdependableFinder.java", "hunks": [ { "added": [], "header": "@@ -145,26 +145,6 @@ public class DDdependableFinder implements\tDependableFinder, Formatable", "removed": [ "", "\t/**", "\t * Gets the in-memory object associated with the passed-in object ID.", "\t *", "\t * @param\tdependableObjectID the UUID of the Dependable as a String.", "\t * \t\t\tUsed to locate that Dependable", "\t *", "\t * @return\tthe associated Dependable", "\t *", "\t * @exception java.sql.SQLException\t\tthrown on error", "\t */", "\tpublic\tfinal Dependable\tgetDependable(String dependableObjectID) throws java.sql.SQLException", "\t{", "\t\t/*", "\t\t** Call the specific implementation of getDependable", "\t\t** to do the work", "\t\t*/", "\t\treturn getDependable(recreateUUID(dependableObjectID));", "\t}", "" ] } ] } ]
derby-DERBY-2138-dee279ca
DERBY-2138 (partial) Couple of additional import cleanups for classes that imported DataDictionaryContext without using it. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483767 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/GenericStatement.java", "hunks": [ { "added": [ "import java.sql.Timestamp;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.services.loader.GeneratedClass;", "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "import org.apache.derby.iapi.services.stream.HeaderPrintWriter;", "import org.apache.derby.iapi.sql.Statement;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.conn.StatementContext;", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;" ], "header": "@@ -21,56 +21,26 @@", "removed": [ "import org.apache.derby.iapi.services.stream.HeaderPrintWriter;", "import org.apache.derby.iapi.reference.JDBC20Translation;", "import org.apache.derby.iapi.reference.JDBC30Translation;", "", "import org.apache.derby.iapi.sql.Activation;", "import org.apache.derby.iapi.types.DataTypeDescriptor;", "import org.apache.derby.iapi.sql.ResultSet;", "import org.apache.derby.iapi.sql.Statement;", "import org.apache.derby.iapi.sql.execute.ConstantAction;", "import org.apache.derby.iapi.sql.execute.ExecutionContext;", "import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;", "import org.apache.derby.iapi.sql.ParameterValueSet;", "", "import org.apache.derby.iapi.sql.conn.LanguageConnectionFactory;", "import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;", "import org.apache.derby.iapi.sql.conn.StatementContext;", "", "import org.apache.derby.iapi.sql.depend.Dependent;", "", "", "import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;", "import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;", "import org.apache.derby.iapi.sql.dictionary.DataDictionary;", "", "import org.apache.derby.iapi.services.compiler.JavaFactory;", "import org.apache.derby.iapi.services.uuid.UUIDFactory;", "import org.apache.derby.iapi.util.ByteArray;", "", "import org.apache.derby.iapi.error.StandardException;", "", "import org.apache.derby.iapi.services.monitor.Monitor;", "", "import org.apache.derby.iapi.services.context.Context;", "import org.apache.derby.iapi.services.context.ContextService;", "import org.apache.derby.iapi.services.context.ContextManager;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.services.loader.GeneratedClass;", "", "import java.sql.Timestamp;", "import java.sql.SQLWarning;", "" ] } ] } ]
derby-DERBY-2141-3fb95155
DERBY-2141 Made BaseContainerHandle.close() synchronized as it may be called concurrently by a stream passed outside the store and an abort triggered concurrently. Making it synchronized will allow the first close to do the proper work and the subsequent calls will just return with no work to do. Also made some of the fields private to convince myself no-one outside the class was counting on something being changed during close. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@537091 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java", "hunks": [ { "added": [ "\tprivate /*final*/ ContainerKey\t\tidentity;", "\tprivate boolean\t\t\t\t active;\t", "\tprotected BaseContainer\t\t container;" ], "header": "@@ -74,21 +74,21 @@ public class BaseContainerHandle extends Observable", "removed": [ "\tprotected /*final*/ ContainerKey\t\tidentity;", "\tprotected boolean\t\t\t\tactive;\t", "\tprotected BaseContainer\t\tcontainer;" ] }, { "added": [ "\tprivate\tLockingPolicy\t\t locking;", "\tprivate\tRawTransaction\t\t xact;", "\tprivate\tboolean\t\t forUpdate;", " /**", " * mode the conainter was opened in.", " **/", "\tprivate int mode;", "", "\tprivate PageActions\t\t actionsSet;", "\tprivate AllocationActions allocActionsSet;" ], "header": "@@ -97,27 +97,31 @@ public class BaseContainerHandle extends Observable", "removed": [ "\tprivate\tLockingPolicy\t\tlocking;", "\tprotected\tRawTransaction\t\txact;", "\tprivate\tboolean\t\tforUpdate;", "\tprotected int mode;\t// mode the container was opened in", "\tprotected PageActions\t\tactionsSet;", "\tprotected AllocationActions allocActionsSet;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/D_BaseContainerHandle.java", "hunks": [ { "added": [ " long container_id = ch.getId().getContainerId();", " ch.getTransaction().getDataFactory()," ], "header": "@@ -63,11 +63,11 @@ public class D_BaseContainerHandle extends DiagnosticableGeneric", "removed": [ " long container_id = ch.identity.getContainerId();", " ch.xact.getDataFactory()," ] } ] } ]
derby-DERBY-2141-5eee0018
DERBY-2141 (partial) BlobClob4BlobTest.testPositionBlob() fails with NullPointerException Preserve original stack trace for exceptions in JDBC 4.0 driver. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@501392 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java", "hunks": [ { "added": [ " // Generate an EmbedSQLException", " SQLException e =", " super.getSQLException(message, messageId, next, severity, t, args);", "", " // We want to preserve the stack trace of the original", " // exception. EmbedSQLException overrides printStackTrace() to achieve", " // this, but that won't help us when the EmbedSQLException is not the", " // first exception in the chain. Ideally, we would use initCause(), but", " // a comment in EmbedSQLException indicates that the cause of the", " // exception is not supposed to be serialized.", " if (t != null) {", " e.setStackTrace(t.getStackTrace());", " }", "", " return e;" ], "header": "@@ -131,7 +131,21 @@ public class SQLExceptionFactory40 extends SQLExceptionFactory {", "removed": [ "\t\treturn super.getSQLException( message, messageId, next, severity, t, args );" ] } ] } ]
derby-DERBY-2142-7106c74e
DERBY-2142 NullPointerException while using XAConnection/PooledConnection in a heavily contended multithreaded scenario Update code comments. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616575 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java", "hunks": [ { "added": [ "\t", "\tNotify listners that connection is closed.", "\t\t//DERBY-2142-Null out the connection handle BEFORE notifying listeners.", "\t\t//At time of the callback the PooledConnection must be ", "\t\t//disassociated from its previous logical connection.", "\t\t//If not there is a risk that the Pooled", "\t\t//Connection could be returned to the pool, ready for pickup by a ", "\t\t//new thread. This new thread then might obtain a java.sql.Connection ", "\t\t//whose reference might get assigned to the currentConnectionHandle ", "\t\t//field, meanwhile the previous thread completes the close making ", "\t\t//the newly assigned currentConnectionHandle null, resulting in an NPE." ], "header": "@@ -417,12 +417,21 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne", "removed": [ "\t\tNotify listners that connection is closed.", "\t\t//DERBY-2142 - Null out the connection handle BEFORE notifying listeners." ] } ] } ]
derby-DERBY-2142-e46ccc50
Expand the DataSourceTest testing added in DERBY-2142 to include closing the PooledConnection during a callback resulting from a close on its logical connection. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@619695 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2142-e57849fb
DERBY-2142 NullPointerException while using XAConnection/PooledConnection in a heavily contended multithreaded scenario core fix contributed by Asif Shahid with further suggestions from Dan Debrunner git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616141 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java", "hunks": [ { "added": [ " " ], "header": "@@ -337,23 +337,8 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne", "removed": [ "\t// my conneciton handle is being closed", "\tpublic synchronized void notifyClose()", "\t{", "\t\t// tell my listeners I am closed ", "\t\tif (eventListener != null && eventListener.size() > 0)", "\t\t{", "\t\t\tConnectionEvent closeEvent = new ConnectionEvent(this);", "\t\t\tfor (Enumeration e = eventListener.elements();", "\t\t\t\t e.hasMoreElements(); )", "\t\t\t{", "\t\t\t\tConnectionEventListener l =", "\t\t\t\t\t(ConnectionEventListener)e.nextElement();", "\t\t\t\tl.connectionClosed(closeEvent);", "\t\t\t}", "\t\t}", "\t}" ] }, { "added": [ "\t\t", "\t\tNotify listners that connection is closed.", "\tpublic synchronized boolean closingConnection() throws SQLException {\t ", "\t\t//DERBY-2142 - Null out the connection handle BEFORE notifying listeners.", "\t\t// tell my listeners I am closed ", "\t\tif (eventListener != null && eventListener.size() > 0)", "\t\t{", "\t\t\tConnectionEvent closeEvent = new ConnectionEvent(this);", "", "\t\t\tfor (Enumeration e = eventListener.elements();", "\t\t\t\t e.hasMoreElements(); )", "\t\t\t{", "\t\t\t\tConnectionEventListener l =", "\t\t\t\t\t(ConnectionEventListener)e.nextElement();", "\t\t\t\tl.connectionClosed(closeEvent);", "\t\t\t}", "\t\t}", "" ], "header": "@@ -431,13 +416,28 @@ class EmbedPooledConnection implements javax.sql.PooledConnection, BrokeredConne", "removed": [ "", "\tpublic boolean closingConnection() throws SQLException {", "\t\tnotifyClose();" ] } ] } ]
derby-DERBY-2142-fec3a1de
DERBY-2142 (test) Add a fixture (testPooledReuseOnClose) to DataSourceTest that tests the fix to DERBY-2142. It failed before revision 616141 and passed after for embedded, but fails for network client so it is disabled for that env. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@616177 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2145-2279e1ff
DERBY-2145 Fixed EmbedDatabaseMetaData.getFunctionColumns to match the changed numbers of parameters in the query git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@551878 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java", "hunks": [ { "added": [ " return doGetProcCols(catalog, ", " schemaPattern,", " functionNamePattern, ", " parameterNamePattern,\t", " \"getFunctionColumns\");" ], "header": "@@ -1633,17 +1633,11 @@ public class EmbedDatabaseMetaData extends ConnectionChild", "removed": [ "\t\t// Cannot use doGetProcCols() because our query requires", "\t\t// parameterNamePattern twice, because both LIKE and = is", "\t\t// required to select parameters with an empty parameter", "\t\t// name. That is, WHERE paramName LIKE ? will not match an", "\t\t// empty paramName, but WHERE paramName LIKE ? OR paramName =", "\t\t// ? will.", "\t\ts.setString(1, swapNull(schemaPattern));", "\t\ts.setString(2, swapNull(functionNamePattern));", "\t\ts.setString(3, swapNull(parameterNamePattern));", "\t\ts.setString(4, swapNull(parameterNamePattern));", "\t\treturn s.executeQuery();" ] } ] } ]
derby-DERBY-2149-b71ac67f
DERBY-2149: Replace Vectors and Hashtables with ArrayLists and HashMaps in RAMTransaction git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@491769 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/store/access/RAMTransaction.java", "hunks": [ { "added": [ "import java.util.HashMap;", "import java.util.Iterator;" ], "header": "@@ -22,10 +22,9 @@", "removed": [ "import java.util.Enumeration;", "import java.util.Hashtable;", "import java.util.Vector;" ] }, { "added": [ "\tprivate ArrayList scanControllers;", "\tprivate ArrayList conglomerateControllers;", "\tprivate ArrayList sorts;", "\tprivate ArrayList sortControllers;" ], "header": "@@ -117,10 +116,10 @@ public class RAMTransaction", "removed": [ "\tprivate Vector scanControllers;", "\tprivate Vector conglomerateControllers;", "\tprivate Vector sorts;", "\tprivate Vector sortControllers;" ] }, { "added": [ "\tprotected HashMap tempCongloms;" ], "header": "@@ -130,7 +129,7 @@ public class RAMTransaction", "removed": [ "\tprotected Hashtable tempCongloms = null;" ] }, { "added": [ "\t\tscanControllers = new ArrayList();", "\t\tconglomerateControllers = new ArrayList();" ], "header": "@@ -166,8 +165,8 @@ public class RAMTransaction", "removed": [ "\t\tscanControllers = new Vector();", "\t\tconglomerateControllers = new Vector();" ] }, { "added": [ " ScanManager sc = (ScanManager) scanControllers.get(i);" ], "header": "@@ -240,14 +239,13 @@ public class RAMTransaction", "removed": [ " Enumeration e;", " ScanManager sc = (ScanManager) scanControllers.elementAt(i);" ] }, { "added": [ " scanControllers.clear();" ], "header": "@@ -264,7 +262,7 @@ public class RAMTransaction", "removed": [ " scanControllers.removeAllElements();" ] }, { "added": [ " conglomerateControllers.get(i);" ], "header": "@@ -275,7 +273,7 @@ public class RAMTransaction", "removed": [ " conglomerateControllers.elementAt(i);" ] }, { "added": [ " conglomerateControllers.clear();" ], "header": "@@ -292,7 +290,7 @@ public class RAMTransaction", "removed": [ " conglomerateControllers.removeAllElements();" ] }, { "added": [ " // Loop from the end since the call to close() will remove the", " // element from the list.", " for (int i = sortControllers.size() - 1; i >= 0; i--)", " SortController sc = (SortController) sortControllers.get(i);", " sortControllers.clear();" ], "header": "@@ -300,13 +298,14 @@ public class RAMTransaction", "removed": [ " e = sortControllers.elements();", " while (e.hasMoreElements())", " SortController sc = (SortController) e.nextElement();", " sortControllers.removeAllElements();" ] }, { "added": [ " // Loop from the end since the call to drop() will remove the", " // element from the list.", " for (int i = sorts.size() - 1; i >= 0; i--)", " Sort sort = (Sort) sorts.get(i);", " sorts.clear();" ], "header": "@@ -314,14 +313,15 @@ public class RAMTransaction", "removed": [ " e = sorts.elements();", " while (e.hasMoreElements())", " Sort sort = (Sort) e.nextElement();", " sorts.removeAllElements();" ] }, { "added": [ "\t\tconglomerateControllers.add(cc);" ], "header": "@@ -494,7 +494,7 @@ public class RAMTransaction", "removed": [ "\t\tconglomerateControllers.addElement(cc);" ] }, { "added": [ "\t\tscanControllers.add(sm);" ], "header": "@@ -551,7 +551,7 @@ public class RAMTransaction", "removed": [ "\t\tscanControllers.addElement(sm);" ] }, { "added": [ " if (sorts.get(i) != null)" ], "header": "@@ -721,7 +721,7 @@ public class RAMTransaction", "removed": [ " if (sorts.elementAt(i) != null)" ] }, { "added": [ "\t\t\t\ttempCongloms = new HashMap();" ], "header": "@@ -849,7 +849,7 @@ public class RAMTransaction", "removed": [ "\t\t\t\ttempCongloms = new Hashtable();" ] }, { "added": [ " for (Iterator it = scanControllers.iterator(); it.hasNext(); )", " ScanController sc = (ScanController) it.next();", " for (Iterator it = conglomerateControllers.iterator();", " it.hasNext(); )", " (ConglomerateController) it.next();", " for (Iterator it = sortControllers.iterator(); it.hasNext(); )", " SortController sc = (SortController) it.next();" ], "header": "@@ -954,31 +954,28 @@ public class RAMTransaction", "removed": [ " Enumeration e;", " e = scanControllers.elements();", " while (e.hasMoreElements())", " ScanController sc = (ScanController) e.nextElement();", " e = conglomerateControllers.elements();", " while (e.hasMoreElements())", " (ConglomerateController) e.nextElement();", " e = sortControllers.elements();", " while (e.hasMoreElements())", " SortController sc = (SortController) e.nextElement();" ] }, { "added": [ " Sort sort = (Sort) sorts.get(i);" ], "header": "@@ -987,7 +984,7 @@ public class RAMTransaction", "removed": [ " Sort sort = (Sort) sorts.elementAt(i);" ] }, { "added": [ " for (Iterator it = tempCongloms.keySet().iterator();", " it.hasNext(); )", "\t\t\t\t\tLong conglomId = (Long) it.next();" ], "header": "@@ -1000,10 +997,10 @@ public class RAMTransaction", "removed": [ " e = tempCongloms.keys();", " while (e.hasMoreElements())", "\t\t\t\t\tLong conglomId = (Long) e.nextElement();" ] }, { "added": [ "\t\tscanControllers.add(sm);" ], "header": "@@ -1441,7 +1438,7 @@ public class RAMTransaction", "removed": [ "\t\tscanControllers.addElement(sm);" ] }, { "added": [ "\t\tscanControllers.add(sm);" ], "header": "@@ -1569,7 +1566,7 @@ public class RAMTransaction", "removed": [ "\t\tscanControllers.addElement(sm);" ] }, { "added": [ "\t\t\tsorts = new ArrayList();" ], "header": "@@ -1727,7 +1724,7 @@ public class RAMTransaction", "removed": [ "\t\t\tsorts = new Vector();" ] }, { "added": [ " sorts.add(sort);", " sorts.set(sortid, sort);" ], "header": "@@ -1735,12 +1732,12 @@ public class RAMTransaction", "removed": [ " sorts.addElement(sort);", " sorts.setElementAt(sort, sortid);" ] }, { "added": [ " Sort sort = (Sort) sorts.get((int) sortid);", " sorts.set((int) sortid, null);" ], "header": "@@ -1763,12 +1760,12 @@ public class RAMTransaction", "removed": [ " Sort sort = (Sort) sorts.elementAt((int) sortid);", " sorts.setElementAt(null, (int) sortid);" ] }, { "added": [ "\t\t\t|| (sort = ((Sort) sorts.get((int) id))) == null)" ], "header": "@@ -1855,7 +1852,7 @@ public class RAMTransaction", "removed": [ "\t\t\t|| (sort = ((Sort) sorts.elementAt((int) id))) == null)" ] }, { "added": [ "\t\t\tsortControllers = new ArrayList();", "\t\tsortControllers.add(sc);" ], "header": "@@ -1866,8 +1863,8 @@ public class RAMTransaction", "removed": [ "\t\t\tsortControllers = new Vector();", "\t\tsortControllers.addElement(sc);" ] }, { "added": [ "\t\t\t|| (sort = ((Sort) sorts.get((int) id))) == null)" ], "header": "@@ -1925,7 +1922,7 @@ public class RAMTransaction", "removed": [ "\t\t\t|| (sort = ((Sort) sorts.elementAt((int) id))) == null)" ] }, { "added": [ "\t\tscanControllers.add(sc);" ], "header": "@@ -1935,7 +1932,7 @@ public class RAMTransaction", "removed": [ "\t\tscanControllers.addElement(sc);" ] }, { "added": [ "\t\t\t|| (sort = ((Sort) sorts.get((int) id))) == null)" ], "header": "@@ -1952,7 +1949,7 @@ public class RAMTransaction", "removed": [ "\t\t\t|| (sort = ((Sort) sorts.elementAt((int) id))) == null)" ] }, { "added": [ "\t\tscanControllers.add(sc);" ], "header": "@@ -1962,7 +1959,7 @@ public class RAMTransaction", "removed": [ "\t\tscanControllers.addElement(sc);" ] }, { "added": [ " conglomerateControllers.remove(conglom_control);" ], "header": "@@ -2167,7 +2164,7 @@ public class RAMTransaction", "removed": [ " conglomerateControllers.removeElement(conglom_control);" ] }, { "added": [ " sortControllers.remove(sort_control);" ], "header": "@@ -2180,7 +2177,7 @@ public class RAMTransaction", "removed": [ " sortControllers.removeElement(sort_control);" ] }, { "added": [ " scanControllers.remove(scan);" ], "header": "@@ -2193,7 +2190,7 @@ public class RAMTransaction", "removed": [ " scanControllers.removeElement(scan);" ] }, { "added": [ " for (Iterator it = scanControllers.iterator(); it.hasNext(); )", " Object o = it.next();" ], "header": "@@ -2375,10 +2372,9 @@ public class RAMTransaction", "removed": [ "\t\tEnumeration e = scanControllers.elements();", "\t\twhile (e.hasMoreElements())", " Object o = e.nextElement();" ] } ] } ]
derby-DERBY-2150-44370a8d
DERBY-2150: Reduce use of synchronized collections in GenericLanguageConnectionContext Use HashMap instead of Hashtable. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497334 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java", "hunks": [ { "added": [], "header": "@@ -22,7 +22,6 @@", "removed": [ "import org.apache.derby.iapi.services.context.ContextManager;" ] }, { "added": [ "import java.util.Map;" ], "header": "@@ -35,25 +34,19 @@ import org.apache.derby.iapi.types.DataValueFactory;", "removed": [ "import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;", "import org.apache.derby.iapi.sql.ResultSet;", "import org.apache.derby.iapi.store.access.AccessFactory;", "import org.apache.derby.iapi.services.i18n.LocaleFinder;", "import java.util.Locale;", "import java.util.Hashtable;", "import java.util.Vector;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [], "header": "@@ -30,10 +30,8 @@ import org.apache.derby.impl.sql.execute.AutoincrementCounter;", "removed": [ "import org.apache.derby.impl.sql.conn.CachedStatement;", "import org.apache.derby.iapi.services.context.Context;" ] }, { "added": [], "header": "@@ -72,7 +70,6 @@ import org.apache.derby.iapi.sql.ResultSet;", "removed": [ "import org.apache.derby.iapi.store.access.AccessFactory;" ] }, { "added": [ "import java.util.HashMap;", "import java.util.Map;" ], "header": "@@ -84,12 +81,9 @@ import org.apache.derby.iapi.reference.Property;", "removed": [ "import java.util.Enumeration;", "import java.util.Hashtable;", "import java.util.Properties;", "import java.util.Stack;", "import java.io.Serializable;" ] }, { "added": [ "\tprivate HashMap autoincrementHT;" ], "header": "@@ -249,7 +243,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\tprivate Hashtable autoincrementHT;" ] }, { "added": [ "\tprivate HashMap autoincrementCacheHashtable;" ], "header": "@@ -258,7 +252,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\tprivate Hashtable autoincrementCacheHashtable;" ] }, { "added": [ "\t\t\tautoincrementCacheHashtable = new HashMap();" ], "header": "@@ -2925,7 +2919,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tautoincrementCacheHashtable = new Hashtable();" ] }, { "added": [ "\t\t\tautoincrementHT = new HashMap();", "\t\tfor (Iterator it = autoincrementCacheHashtable.keySet().iterator();", "\t\t\t it.hasNext(); )", "\t\t\tObject key = it.next();" ], "header": "@@ -2997,13 +2991,13 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tautoincrementHT = new Hashtable();", "\t\tfor (Enumeration e = autoincrementCacheHashtable.keys(); ", "\t\t\t e.hasMoreElements(); )", "\t\t\tObject key = e.nextElement();" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java", "hunks": [ { "added": [ "import java.util.HashMap;" ], "header": "@@ -22,6 +22,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/InternalTriggerExecutionContext.java", "hunks": [ { "added": [ "import java.util.Map;" ], "header": "@@ -40,6 +40,7 @@ import org.apache.derby.catalog.UUID;", "removed": [] }, { "added": [ "\t * Copy a map of autoincrement values into the trigger ", "\tpublic void copyHashtableToAIHT(Map from)", "", "\t\taiHT.putAll(from);" ], "header": "@@ -619,22 +620,17 @@ public class InternalTriggerExecutionContext implements TriggerExecutionContext,", "removed": [ "\t * Copy a hashtable of autoincrement values into the trigger ", "\tpublic void copyHashtableToAIHT(Hashtable from)", "\t\tfor (Enumeration e = from.keys(); e.hasMoreElements(); )", "\t\t{", "\t\t\tObject key = e.nextElement();", "\t\t\tObject value = from.get(key);", "\t\t\taiHT.put(key, value);", "\t\t\t//\t\t\tSystem.out.println(\" in itec:chte-- \" + key + \" \" + value);", "\t\t}" ] } ] } ]
derby-DERBY-2150-bbf601d9
DERBY-2150: Reduce use of synchronized collections in GenericLanguageConnectionContext Replace Vectors with ArrayLists. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@495164 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [ "import java.util.Iterator;" ], "header": "@@ -86,8 +86,8 @@ import java.util.List;", "removed": [ "import java.util.Vector;" ] }, { "added": [ "\tprivate final ArrayList acts;", "\t/** The maximum size of acts since the last time it was trimmed. Used to", "\t * determine whether acts should be trimmed to reclaim space. */", "\tprivate int maxActsSize;" ], "header": "@@ -114,8 +114,11 @@ public class GenericLanguageConnectionContext", "removed": [ "\tprivate final Vector acts;" ] }, { "added": [ "\tprivate ArrayList stmtValidators;", "\tprivate ArrayList triggerExecutionContexts;", "\tprivate ArrayList triggerTables;" ], "header": "@@ -230,9 +233,9 @@ public class GenericLanguageConnectionContext", "removed": [ "\tprivate Vector stmtValidators;", "\tprivate Vector triggerExecutionContexts;", "\tprivate Vector triggerTables;" ] }, { "added": [ "\t\tacts = new ArrayList();" ], "header": "@@ -278,7 +281,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tacts = new Vector();" ] }, { "added": [ "\t\tstmtValidators = new ArrayList();", "\t\ttriggerExecutionContexts = new ArrayList();", "\t\ttriggerTables = new ArrayList();" ], "header": "@@ -310,9 +313,9 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tstmtValidators = new Vector();", "\t\ttriggerExecutionContexts = new Vector();", "\t\ttriggerTables = new Vector();" ] }, { "added": [ "\t\tacts.add(a);", "", "\t\tif (acts.size() > maxActsSize) {", "\t\t\tmaxActsSize = acts.size();", "\t\t}" ], "header": "@@ -428,7 +431,11 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tacts.addElement(a);" ] }, { "added": [ "\t\t\t\tActivation a1 = (Activation) acts.get(i);" ], "header": "@@ -445,7 +452,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\t\tActivation a1 = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\tacts.remove(a);", "\t\tif (maxActsSize > 20 && (maxActsSize > 2 * acts.size())) {", "\t\t\tmaxActsSize = acts.size();" ], "header": "@@ -760,12 +767,11 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tacts.removeElement(a);", "", "\t\tint capacity = acts.capacity();", "\t\tif (capacity > 20 && (capacity > 2 * acts.size())) {" ] }, { "added": [ "\t\t\t\t Activation a = (Activation) acts.get(i);" ], "header": "@@ -794,7 +800,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\t\t Activation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\t\tActivation a = (Activation) acts.get(i);" ], "header": "@@ -1519,7 +1525,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tActivation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\t\tActivation a = (Activation) acts.get(i);" ], "header": "@@ -1547,7 +1553,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tActivation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\t\tActivation a = (Activation) acts.get(i);" ], "header": "@@ -1586,7 +1592,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tActivation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\t\tActivation a = (Activation) acts.get(i);" ], "header": "@@ -1643,7 +1649,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tActivation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\t\tActivation a = (Activation) acts.get(i);" ], "header": "@@ -1680,7 +1686,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tActivation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\tstmtValidators.add(validator);" ], "header": "@@ -2104,7 +2110,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tstmtValidators.addElement(validator);" ] }, { "added": [ "\t\tboolean foundElement = stmtValidators.remove(validator);" ], "header": "@@ -2118,7 +2124,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tboolean foundElement = stmtValidators.removeElement(validator);" ] }, { "added": [ "\t\ttriggerExecutionContexts.add(tec);" ], "header": "@@ -2150,7 +2156,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\ttriggerExecutionContexts.addElement(tec);" ] }, { "added": [ "\t\tboolean foundElement = triggerExecutionContexts.remove(tec);" ], "header": "@@ -2169,7 +2175,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tboolean foundElement = triggerExecutionContexts.removeElement(tec);" ] }, { "added": [ "\t\t\t\t(TriggerExecutionContext)triggerExecutionContexts.get(", "\t\t\t\t\ttriggerExecutionContexts.size() - 1);\t" ], "header": "@@ -2188,7 +2194,8 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\t\t(TriggerExecutionContext)triggerExecutionContexts.lastElement();\t" ] }, { "added": [ "\t\t\tfor (Iterator it = stmtValidators.iterator(); it.hasNext(); )", "\t\t\t\t((ExecutionStmtValidator)it.next())", "\t\t\t\t\t.validateStatement(constantAction);" ], "header": "@@ -2211,9 +2218,10 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tfor (Enumeration e = stmtValidators.elements(); e.hasMoreElements(); )", "\t\t\t\t((ExecutionStmtValidator)e.nextElement()).validateStatement(constantAction);" ] }, { "added": [ "\t\ttriggerTables.add(td);" ], "header": "@@ -2228,7 +2236,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\ttriggerTables.addElement(td);" ] }, { "added": [ "\t\tboolean foundElement = triggerTables.remove(td);" ], "header": "@@ -2238,7 +2246,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\tboolean foundElement = triggerTables.removeElement(td);" ] }, { "added": [ "\t\t\t(TableDescriptor)triggerTables.get(triggerTables.size() - 1);" ], "header": "@@ -2259,7 +2267,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\t(TableDescriptor)triggerTables.lastElement();" ] }, { "added": [ "\t\t\t\tActivation a = (Activation) acts.get(i);" ], "header": "@@ -2687,7 +2695,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\t\tActivation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\t\tActivation a = (Activation) acts.get(i);" ], "header": "@@ -2738,7 +2746,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\tActivation a = (Activation) acts.elementAt(i);" ] }, { "added": [ "\t\t\t\t(InternalTriggerExecutionContext)triggerExecutionContexts.get(i);" ], "header": "@@ -2878,7 +2886,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\t\t\t(InternalTriggerExecutionContext)triggerExecutionContexts.elementAt(i);" ] }, { "added": [ "\t\treturn (Activation)acts.get(acts.size() - 1);" ], "header": "@@ -3065,7 +3073,7 @@ public class GenericLanguageConnectionContext", "removed": [ "\t\treturn (Activation)acts.lastElement();" ] } ] } ]
derby-DERBY-2151-bf9a1af0
DERBY-2151: Fixer-upper utility to help convert ij canon tests to JUnit This patch modifies SQLToJUnit.java so that it quietly skips entirely blank lines. Prior to this patch, such lines could cause SQLToJUnit to throw a NullPointerException. An example of a canon with entirely blank lines is tests/lang/groupBy.sql. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@573432 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/SQLToJUnit.java", "hunks": [ { "added": [ " // Skip entirely blank lines:", " while (nextline != null)", " {", " nextline = nextline.trim();", " if (nextline.length() == 0)", " nextline = ijScript.readLine();\t", " else", " break;", " }" ], "header": "@@ -1170,11 +1170,19 @@ public class SQLToJUnit", "removed": [ " \t\tnextline = nextline.trim();" ] } ] } ]
derby-DERBY-2152-6c7bf483
DERBY-2152: Clean-up patch that does the following: 1. Creates a new "init()" method for NewInvocationNode that is specifically targeted for mapping VTI "tables" and VTI "table functions" to their corresponding class names. The new init() method takes both a TableDescriptor and a TableName, exactly one of which must be null. If the TableDescriptor is null then we will resolve the TableName to a VTI "table function"; if the TableName is null then we will resolve the TableDescriptor to a VTI "table". Thus VTI classes are now consistently resolved inside the NewInvocationNode class. 2. Updates NodeFactory.mapTableAsVTI() to make use of the new "init()" method in NewInvocationNode. mapTableAsVTI() used to take as a parameter the resolved VTI class name; now it just passes the received TableDescriptor to the new init() method in NewInvocationNode and the latter resolves the VTI class. 3. Combines the getVTIClassForTable() and getVTIClassForTableFunction() methods of DataDictionary into a new method, "getVTIClass()", that takes a TableDescriptor and a boolean value. The boolean indicates the kind of mapping to do--"table" or "table function"--while the TableDescriptor holds the schema and name information used for resolving the class. This resolves the inconsistency between the argument styles used in the old getVTIClassFor*() methods. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@494993 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/compile/NodeFactory.java", "hunks": [ { "added": [], "header": "@@ -610,7 +610,6 @@ public abstract class NodeFactory", "removed": [ "\t * @param vtiClass Java class name for virtual table" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t\t\tif (getVTIClass(td, false) != null)" ], "header": "@@ -1700,7 +1700,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tif (getVTIClassForTable(td) != null)" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/NewInvocationNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;" ], "header": "@@ -36,7 +36,7 @@ import org.apache.derby.iapi.services.i18n.MessageService;", "removed": [ "import org.apache.derby.iapi.sql.dictionary.DataDictionary;" ] }, { "added": [ "\t * <li>javaClassName\t\tThe full package.class name of the class</li>" ], "header": "@@ -68,9 +68,7 @@ public class NewInvocationNode extends MethodCallNode", "removed": [ "\t * <li>javaClassName\t\tThe full package.class name of the class", "\t * \t \t(as a String), or else a TableName object", "\t * \t\tthat maps to the full class name </li>" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java", "hunks": [ { "added": [ "\t * for the given table descriptor. The mapping of the table descriptor", "\t * to a specific VTI class name will occur as part of the \"init\"", "\t * phase for the NewInvocationNode that we create here." ], "header": "@@ -678,7 +678,9 @@ public class NodeFactoryImpl extends NodeFactory implements ModuleControl, Modul", "removed": [ "\t * for the given table descriptor using the passed in vti class name." ] }, { "added": [], "header": "@@ -690,7 +692,6 @@ public class NodeFactoryImpl extends NodeFactory implements ModuleControl, Modul", "removed": [ "\t\t\tString vtiClass," ] } ] } ]
derby-DERBY-2152-b0db1404
DERBY-2152: Support diagnostic "table functions" for querying Derby diagnostic VTIs that take parameters. The table functions are exposed via the TABLE constructor syntax: SELECT <rcList> from TABLE ( <sysdiag-schema>.<vti-table-name> (<arg-list>) ) [ AS ] corrlationName Note that: a. We only support VTI table function names that are in the SYSCS_DIAG schema b. The correlation name *is* required, though use of the "AS" keyword is optional (section 7.6 of the SQL 2003 spec, "<table primary>"). c. The argument list can be empty if the underlying VTI supports it. The VTI table names that have been added are as follows: SYSCS_DIAG.SPACE_TABLE maps to org.apache.derby.diag.SpaceTable SYSCS_DIAG.ERROR_LOG_READER maps to org.apache.derby.diag.ErrorLogReader SYSCS_DIAG.STATEMENT_DURATION maps to org.apache.derby.diag.StatementDuration git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@488827 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "\t\t\tif (getVTIClassForTable(td) != null)" ], "header": "@@ -1781,7 +1781,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\t\t\tif (getVTIClass(td) != null)" ] }, { "added": [ "\tprivate String[][] DIAG_VTI_TABLE_CLASSES =" ], "header": "@@ -10408,7 +10408,7 @@ public final class\tDataDictionaryImpl", "removed": [ "\tprivate String[][] DIAG_VTI_CLASSES =" ] }, { "added": [ "\tprivate String[][] DIAG_VTI_TABLE_FUNCTION_CLASSES =", "\t{", "\t\t\t{\"SPACE_TABLE\", \"org.apache.derby.diag.SpaceTable\"},", "\t\t\t{\"ERROR_LOG_READER\", \"org.apache.derby.diag.ErrorLogReader\"},", "\t\t\t{\"STATEMENT_DURATION\", \"org.apache.derby.diag.StatementDuration\"},", "\t};", "", "\t * @see DataDictionary#getVTIClassForTable(TableDescriptor)", "\tpublic String getVTIClassForTable(TableDescriptor td)", "\t\tthrows StandardException {" ], "header": "@@ -10418,10 +10418,18 @@ public final class\tDataDictionaryImpl", "removed": [ "\t * @see org.apache.derby.iapi.sql.dictionary.DataDictionary#getVTIClass(org.apache.derby.iapi.sql.dictionary.TableDescriptor)", "\tpublic String getVTIClass(TableDescriptor td) throws StandardException {" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/NewInvocationNode.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;", "import org.apache.derby.iapi.sql.dictionary.TableDescriptor;" ], "header": "@@ -37,6 +37,8 @@ import org.apache.derby.iapi.services.i18n.MessageService;", "removed": [] }, { "added": [ "\t * <li>javaClassName\t\tThe full package.class name of the class", "\t * \t \t(as a String), or else a TableName object", "\t * \t\tthat maps to the full class name </li>" ], "header": "@@ -68,7 +70,9 @@ public class NewInvocationNode extends MethodCallNode", "removed": [ "\t * <li>javaClassName\t\tThe full package.class name of the class</li>" ] } ] } ]
derby-DERBY-2153-a6fa53ba
DERBY-2153: 1. Create a new JUnit utility file, junit/JAXPFinder.java, that is only instantiated when all required XML classes are in the classpath. 2. Move the import of DocumentBuilderFactory out of junit/XML.java and into junit/JAXPFinder.java. This extra level of indirection combined with the conditional instantiation of JAXPFinder ensures that we do not attempt to instantiate a DocumentBuilderFactory unless we have the necessary JAXP classes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483532 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/XML.java", "hunks": [ { "added": [], "header": "@@ -36,14 +36,6 @@ import java.sql.SQLException;", "removed": [ "/* The following import is for a JDBC 3.0 JAXP class, which means that", " * this file can only be built with 1.4 or later (see build.xml in", " * this directory). This means that 1.3 JVMs will not be able to", " * instantiate this class--but since 1.3 is deprecated as of 10.3,", " * we do not worry about that here.", " */", "import javax.xml.parsers.DocumentBuilderFactory;", "" ] }, { "added": [], "header": "@@ -98,14 +90,6 @@ public class XML {", "removed": [ " /**", " * String form of the URL for the jar file in the user's classpath", " * that holds the JAXP implementation in use. If the implementation", " * is embedded within, or endorsed by, the JVM, then we will set this", " * field to be an empty string.", " */", " private static String jaxpURLString = null;", "" ] } ] } ]
derby-DERBY-2158-c1e3d96e
DERBY-2158 - ensure test.lang.UpdatableResultSetTest runs with JSR169 jvms - modified test to use JDBC.vmSupportsJSR169 rather than its own mechanisms to check for existence of java.math.BigDecimal - added one more required check git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497026 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2162-4a08a159
DERBY-2162/DERBY-5618: Close the URLClassLoader when tests are done with it so that file handles are freed and the jar files can be deleted. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1582220 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/ClasspathSetup.java", "hunks": [ { "added": [ "import java.io.Closeable;", "import java.io.IOException;", "import java.security.PrivilegedExceptionAction;" ], "header": "@@ -19,10 +19,13 @@", "removed": [] }, { "added": [ " private URLClassLoader _newClassLoader;" ], "header": "@@ -49,6 +52,7 @@ public class ClasspathSetup extends TestSetup", "removed": [] }, { "added": [ " public ClasspathSetup(Test test, URL resource)" ], "header": "@@ -61,7 +65,7 @@ public class ClasspathSetup extends TestSetup", "removed": [ " public ClasspathSetup( Test test, URL resource ) throws Exception" ] }, { "added": [ " _newClassLoader = new URLClassLoader( new URL[] { _resource }, _originalClassLoader );", " Thread.currentThread().setContextClassLoader( _newClassLoader );" ], "header": "@@ -84,9 +88,9 @@ public class ClasspathSetup extends TestSetup", "removed": [ " URLClassLoader newClassLoader = new URLClassLoader( new URL[] { _resource }, _originalClassLoader );", " Thread.currentThread().setContextClassLoader( newClassLoader );" ] }, { "added": [ " protected void tearDown() throws Exception", " new PrivilegedExceptionAction<Void>()", " public Void run() throws IOException", "", " // On Java 7 and higher, URLClassLoader implements the", " // Closable interface and has a close() method. Use that", " // method, if it's available, to free all resources", " // associated with the class loader. DERBY-2162.", " if (_newClassLoader instanceof Closeable) {", " ((Closeable) _newClassLoader).close();", " }", "", " _originalClassLoader = null;", " _newClassLoader = null;", " _resource = null;", " }", " /**", " * Check whether this platform supports closing a {@code URLClassLoader}.", " *", " * @return {@code true} if {@code URLClassLoader} has a {@code close()}", " * method (Java 7 and higher), or {@code false} otherwise", " */", " public static boolean supportsClose() {", " return Closeable.class.isAssignableFrom(URLClassLoader.class);", " }", "}" ], "header": "@@ -94,22 +98,42 @@ public class ClasspathSetup extends TestSetup", "removed": [ " protected void tearDown()", " new PrivilegedAction<Void>()", " public Void run()", " ", " }", "}" ] } ] } ]
derby-DERBY-2164-1985a182
DERBY-2164 (partial) Remove AccessFactory (store) from LanguageConnectionFactory and instead code can find the AccessFactory from the Transaction object. The AccessFactory getAccessManager() method already existed but was not exposed at the highest level. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@483822 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/diag/LockTable.java", "hunks": [ { "added": [], "header": "@@ -33,7 +33,6 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [ "import org.apache.derby.iapi.sql.conn.LanguageConnectionFactory;" ] }, { "added": [], "header": "@@ -98,7 +97,6 @@ public class LockTable extends VTITemplate implements VTICosting {", "removed": [ "\tprivate LanguageConnectionFactory lcf;" ] } ] }, { "file": "java/engine/org/apache/derby/diag/TransactionTable.java", "hunks": [ { "added": [], "header": "@@ -21,12 +21,8 @@", "removed": [ "import org.apache.derby.iapi.services.monitor.Monitor;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.store.access.AccessFactory;" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionFactory.java", "hunks": [ { "added": [], "header": "@@ -24,7 +24,6 @@ package org.apache.derby.iapi.sql.conn;", "removed": [ "import org.apache.derby.iapi.store.access.AccessFactory;" ] }, { "added": [], "header": "@@ -34,7 +33,6 @@ import org.apache.derby.iapi.sql.compile.CompilerContext;", "removed": [ "import org.apache.derby.iapi.sql.Activation;" ] }, { "added": [], "header": "@@ -48,9 +46,6 @@ import org.apache.derby.iapi.sql.LanguageFactory;", "removed": [ "import java.io.InputStream;", "", "import java.util.Locale;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/services/locks/Deadlock.java", "hunks": [ { "added": [], "header": "@@ -21,15 +21,11 @@", "removed": [ "import org.apache.derby.iapi.services.locks.Lockable;", "import org.apache.derby.iapi.services.sanity.SanityManager;", "", "import org.apache.derby.iapi.sql.conn.LanguageConnectionFactory;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java", "hunks": [ { "added": [], "header": "@@ -111,7 +111,6 @@ public class GenericLanguageConnectionFactory", "removed": [ "\tprivate \tAccessFactory\t\t\taf;" ] }, { "added": [], "header": "@@ -236,14 +235,6 @@ public class GenericLanguageConnectionFactory", "removed": [ "\t/**", "\t\tGet the AccessFactory to use with this language connection", "\t */", "\tpublic AccessFactory\tgetAccessFactory() ", "\t{", "\t\treturn af;", "\t}\t", "" ] }, { "added": [], "header": "@@ -334,8 +325,6 @@ public class GenericLanguageConnectionFactory", "removed": [ "\t\tsetStore();", "" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/util/T_Access.java", "hunks": [ { "added": [], "header": "@@ -21,13 +21,9 @@", "removed": [ "import org.apache.derby.iapi.error.StandardException; ", "import org.apache.derby.iapi.sql.conn.LanguageConnectionFactory;", "import org.apache.derby.iapi.store.access.TransactionController;", "import org.apache.derby.iapi.error.PublicAPI;" ] }, { "added": [ "\t\treturn lcc.getTransactionExecute().getAccessManager();" ], "header": "@@ -40,8 +36,7 @@ public class T_Access", "removed": [ "\t\tLanguageConnectionFactory lcf = lcc.getLanguageConnectionFactory();", "\t\treturn (AccessFactory)lcf.getAccessFactory();" ] } ] } ]
derby-DERBY-2164-a96a2ab6
DERBY-2164 (partial) Add the actual storeless implementation files that I thought had been added under revision 497593 (they were marked as A but did not get added into the commit for some reason). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497667 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/storeless/org/apache/derby/impl/storeless/StorelessService.java", "hunks": [ { "added": [ "/*", "", " Derby - Class org.apache.impl.storeless.StorelessService", "", " Licensed to the Apache Software Foundation (ASF) under one or more", " contributor license agreements. See the NOTICE file distributed with", " this work for additional information regarding copyright ownership.", " The ASF licenses this file to You under the Apache License, Version 2.0", " (the \"License\"); you may not use this file except in compliance with", " the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing, software", " distributed under the License is distributed on an \"AS IS\" BASIS,", " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", " See the License for the specific language governing permissions and", " limitations under the License.", "", " */", "package org.apache.derby.impl.storeless;", "", "import java.io.IOException;", "import java.util.Enumeration;", "import java.util.Properties;", "", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.reference.EngineType;", "import org.apache.derby.iapi.reference.Property;", "import org.apache.derby.iapi.services.monitor.PersistentService;", "import org.apache.derby.io.StorageFactory;", "", "/**", " * PersistentService for the storeless engine.", " * Type is 'storeless' which will correspond to", " * the JDBC URL 'jdbc:derby:storeless'.", " *", " */", "public class StorelessService implements PersistentService {", "\t", "\tpublic StorelessService()", "\t{", "\t}", "\t", "\tpublic String getType() {", "\t\treturn \"storeless\";", "\t}", "", "\tpublic Enumeration getBootTimeServices() {", "\t\treturn null;", "\t}", "", "\tpublic Properties getServiceProperties(String serviceName, Properties defaultProperties) throws StandardException {", "\t\t", "\t\tProperties service = new Properties(defaultProperties);", "\t\tservice.setProperty(Property.SERVICE_PROTOCOL,", " \"org.apache.derby.database.Database\");", "\t\tservice.setProperty(EngineType.PROPERTY,", " Integer.toString(getEngineType()));", "\t\treturn service;", "\t}", "", "\tpublic void saveServiceProperties(String serviceName, StorageFactory storageFactory, Properties properties, boolean replace) throws StandardException {", "\t\t// TODO Auto-generated method stub", "\t\t", "\t}", "", "\tpublic void saveServiceProperties(String serviceName, Properties properties, boolean replace) throws StandardException {", "\t\t// TODO Auto-generated method stub", "\t\t", "\t}", "", "\tpublic String createServiceRoot(String name, boolean deleteExisting) throws StandardException {", "\t\t// TODO Auto-generated method stub", "\t\treturn null;", "\t}", "", "\tpublic boolean removeServiceRoot(String serviceName) {", "\t\t// TODO Auto-generated method stub", "\t\treturn false;", "\t}", "", "\tpublic String getCanonicalServiceName(String name) {", "\t\treturn name;", "\t}", "", "\tpublic String getUserServiceName(String serviceName) {", "\t\t// TODO Auto-generated method stub", "\t\treturn null;", "\t}", "", "\tpublic boolean isSameService(String serviceName1, String serviceName2) {", "\t\t// TODO Auto-generated method stub", "\t\treturn serviceName1.equals(serviceName2);", "\t}", "", "\tpublic boolean hasStorageFactory() {", "\t\t// TODO Auto-generated method stub", "\t\treturn false;", "\t}", "", "\tpublic StorageFactory getStorageFactoryInstance(boolean useHome, String databaseName, String tempDirName, String uniqueName) throws StandardException, IOException {", "\t\t// TODO Auto-generated method stub", "\t\treturn null;", "\t}", "", " protected int getEngineType() {", " return EngineType.STORELESS_ENGINE;", " }", "}" ], "header": "@@ -0,0 +1,110 @@", "removed": [] } ] } ]
derby-DERBY-2164-dcd3fecf
DERBY-2164 Add some comments to EngineType class and clean up its use. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@487742 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/monitor/Monitor.java", "hunks": [ { "added": [ "\t\tint\t\tengineType = EngineType.STANDALONE_DB;" ], "header": "@@ -733,8 +733,7 @@ public class Monitor {", "removed": [ "\t\tboolean\tretval = false;", "\t\tint\t\tengineType = EngineType.NONE;" ] }, { "added": [ " ", " /**", " * Is engineType a match for desiredType. A match exists", " * if the bit intersect of the two values is no zero.", " */", "\tpublic static boolean isDesiredType(int engineType, int desiredType) {", "\t\treturn (engineType & desiredType) != 0;" ], "header": "@@ -743,8 +742,13 @@ public class Monitor {", "removed": [ "\tpublic static boolean isDesiredType(int engineType, int desiredProperty) {", "\t\treturn (engineType & desiredProperty) != 0;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/db/BasicDatabase.java", "hunks": [ { "added": [ " return Monitor.isDesiredCreateType(startParams, getEngineType());" ], "header": "@@ -141,9 +141,7 @@ public class BasicDatabase implements ModuleControl, ModuleSupportable, Property", "removed": [ "", "\t\treturn Monitor.isDesiredCreateType(startParams, org.apache.derby.iapi.reference.EngineType.NONE);", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.EngineType;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.EngineType;" ], "header": "@@ -40,6 +40,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.EngineType;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] }, { "added": [ " return Monitor.isDesiredType(startParams,", " EngineType.STANDALONE_DB | EngineType.STORELESS_ENGINE);" ], "header": "@@ -81,7 +82,8 @@ public class GenericExecutionFactory", "removed": [ "\t\treturn\tMonitor.isDesiredType( startParams, org.apache.derby.iapi.reference.EngineType.NONE);" ] } ] } ]
derby-DERBY-2166-1f718563
DERBY-2166 Implement proper handling of SocketTimeoutException in DRDAConnThread. Submitted by Bernt M. Johnsen git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497748 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DDMReader.java", "hunks": [ { "added": [ "\t\t\t} catch (java.net.SocketTimeoutException ste) {", "", " // Transport the timeout out through the layers. This", " // exception is caught in DRDAConnThread.run();", " throw new DRDASocketTimeoutException(agent);", "", "\t\t\t} catch (java.io.IOException ioe) {", " agent.markCommunicationsFailure(\"DDMReader.fill()\",", " \"InputStream.read()\", ioe.getMessage(), \"*\");", "\t\t\t} finally {" ], "header": "@@ -1896,12 +1896,16 @@ class DDMReader", "removed": [ "\t\t\t}", "\t\t\tcatch (java.io.IOException ioe) {", "\t\t\t\tagent.markCommunicationsFailure (\"DDMReader.fill()\",", "\t\t\t\t \"InputStream.read()\", ioe.getMessage(), \"*\");", "\t\t\t}", "\t\t\tfinally {" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java", "hunks": [ { "added": [ " protected static String DRDA_Timeout= \"DRDA_Timeout\";" ], "header": "@@ -101,6 +101,7 @@ class DRDAProtocolException extends Exception", "removed": [] }, { "added": [ "", "\terrorInfoTable.put(DRDA_Timeout,", "\t\t\t new DRDAProtocolExceptionInfo(", "\t\t\t\t\t\t\t 0,", "\t\t\t\t\t\t\t 0,", "\t\t\t\t\t\t\t NO_ASSOC_ERRCD,", "\t\t\t\t\t\t\t false));", "" ], "header": "@@ -201,6 +202,14 @@ class DRDAProtocolException extends Exception", "removed": [] }, { "added": [ "/**", " * Class used to transport that fact that we had a timeout and should", " * *NOT* disconnect the connection.", " * See DRDAConnThread.run()", " */", "class DRDASocketTimeoutException extends DRDAProtocolException {", " DRDASocketTimeoutException(DRDAConnThread t) {", " super(DRDA_Timeout,t,0,0);", " }", "}" ], "header": "@@ -387,7 +396,13 @@ class DRDAProtocolException extends Exception", "removed": [ "", "", "", "" ] } ] } ]
derby-DERBY-217-7cf2315a
DERBY-217 add some batch test cases for the setXXX methods to jdbcapi/parameterMapping test. Work in progress, need another commit to add the remaining setXXX methods. git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@190127 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-217-a9d1988a
DERBY-217 Finish adding batch test cases for setXXX methods in jdbcapi/parameterMapping.java git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@219679 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-218-3108420e
committing patch for DERBY-218, relaxed durability option - for ksunithaghm@gmail.com. A little background: Sometime earlier on the list, Dan posted a fix to make derby go faster with relaxed durability with some flags. The post is at http://article.gmane.org/gmane.comp.apache.db.derby.user/681/match=relaxed+durability This mode is very useful for unit testing or at development time when recoverability is not required. Basically in this mode, syncs are disabled for logs, data writes at checkpoint, page allocation when file is grown; - what this means is that data is not flushed all the way to the disk and in most cases i/o cost is not involved. Note, code already exists in Derby to do this. So for Derby 218, This patch addresses the following requirements: 1) Have a single property to enable this relaxed durability mode, so it is easy for users to enable it. 2) Print message to derby.log that this mode is enabled 3) A way to report boot errors that may be because of this option being enabled. What this maps to is - have a marker to recognize that database was booted in this mode, and then on subsequent boot; if errors happen during recovery - report a message that it could have happened because of this mode being set. Thanks Suresh for your comments. I have attached a new patch that takes care of them and as well as the property name change as discussed on the list. So now, 1)To enable this no syncs mode, the property setting is derby.system.durability=test If it is set to any other value other than test, then this property setting is ignored and the system will default to the usual mode where all syncs happen correctly. 2) If database is booted in this mode then the flag to indicate this mode is being used is set in log.ctrl file and it will not change after that.Thus there wont be any switching between this mode ( no syncs) to default ( all syncs) mode because we cannot guarantee that the database will be in a consistent state once its booted in this no sync mode.. 3) This flag is now written out as part of the log control flags in log.ctrl file instead of using a spare byte. git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@169538 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/reference/MessageId.java", "hunks": [ { "added": [ " String LOG_WAS_IN_DURABILITY_TESTMODE_NO_SYNC = \"L020\"; // database was running in", " // derby.system.durability set to test ", " String LOG_DURABILITY_TESTMODE_NO_SYNC_ERR = \"L021\"; // hint that error could be because ", " // derby.system.durability was set to test" ], "header": "@@ -58,7 +58,10 @@ public interface MessageId {", "removed": [ "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java", "hunks": [ { "added": [ " \"----------------------------------------------------------------\";", " // disable syncing of data during page allocation.", " boolean dataNotSyncedAtAllocation = false;", " // disable syncing of data during checkpoint.", " boolean dataNotSyncedAtCheckpoint = false;" ], "header": "@@ -177,13 +177,13 @@ public class BaseDataFileFactory", "removed": [ "\t\"----------------------------------------------------------------\";", " // debug only flag - disable syncing of data during page allocation.", " boolean dataNotSyncedAtAllocation;", " // debug only flag - disable syncing of data during checkpoint.", " boolean dataNotSyncedAtCheckpoint;" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java", "hunks": [ { "added": [ " if (!dataFactory.dataNotSyncedAtAllocation)" ], "header": "@@ -325,15 +325,8 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc", "removed": [ " if (Performance.MEASURE)", " {", " if (!dataFactory.dataNotSyncedAtAllocation)", " fileData.sync( false);", " }", " else", " {", " }" ] }, { "added": [ " if (!dataFactory.dataNotSyncedAtAllocation)", " fileData.sync(false);", " \t\t\t\t}" ], "header": "@@ -504,16 +497,9 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc", "removed": [ " if (Performance.MEASURE)", " {", " if (!dataFactory.dataNotSyncedAtAllocation)", " fileData.sync( false);", " }", " else", " {", " fileData.sync( false);", " }", "\t\t\t\t}" ] } ] }, { "file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java", "hunks": [ { "added": [ "\t", " /**", " * When the derby.system.durability property is set to 'test', the store ", " * system will not force sync calls in the following cases", " * - for the log file at each commit", " * - for the log file before data page is forced to disk", " * - for page allocation when file is grown", " * - for data writes during checkpoint", " * This means it is possible that the recovery system may not work properly,", " * committed transactions may be lost, and/or database may not", " * be in a consistent state.", " * In order that we recognize this case that the database was previously", " * at any time booted in this mode, this value is written out", " * into the log control file. This will help prevent us from ", " * wasting time to resolve issues in such cases. ", " * @see org.apache.derby.iapi.reference.Property#DURABILITY_PROPERTY", " * This value is written as part of the log control file flags byte.", " */", " private static final byte IS_DURABILITY_TESTMODE_NO_SYNC_FLAG = 0x2;", "\t", " /**", " * keeps track of if the database was booted previously at any time with ", " * derby.system.durability=test", " */", " private static boolean wasDBInDurabilityTestModeNoSync = false;", " " ], "header": "@@ -265,7 +265,32 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "" ] }, { "added": [ " // disable syncing of log file when running in derby.system.durability=test" ], "header": "@@ -362,7 +387,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ " // debug only flag - disable syncing of log file for debugging performance." ] }, { "added": [ " \t" ], "header": "@@ -403,8 +428,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "", "\t" ] }, { "added": [ " // done with recovery ", " " ], "header": "@@ -1194,8 +1218,8 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "\t\t// done with recovery", "" ] }, { "added": [ " " ], "header": "@@ -1207,6 +1231,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [] }, { "added": [ "", "\t\tif (onDiskBeta) ", " flags |= IS_BETA_FLAG;", " ", " // When database is booted with derby.system.durability=test,", " // this mode does not guarantee that ", " // - database will recover ", " // - committed transactions will not be lost", " // - database will be in a consistent state", " // Hence necessary to keep track of this state so we don't ", " // waste time resolving issues in such cases.", " // wasDBInDurabilityTestModeNoSync has information if database was", " // previously booted at any time in this mode", " if (logNotSynced || wasDBInDurabilityTestModeNoSync)", " flags |= IS_DURABILITY_TESTMODE_NO_SYNC_FLAG;", " \t\tdaos.writeByte(flags);", " \t\tlong spare = 0;", " ", " daos.writeByte(0);" ], "header": "@@ -2136,16 +2161,31 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "\t\tif (onDiskBeta) flags |= IS_BETA_FLAG;", "\t\tdaos.writeByte(flags);", "\t\tlong spare = 0;", "\t\tdaos.writeByte(0);" ] }, { "added": [ "\t\t\t\t", "\t\t\t\t// check if the database was booted previously at any time with", " // derby.system.durability=test mode", " // If yes, then on a boot error we report that this setting is", " // probably the cause for the error and also log a warning", " // in the derby.log that this mode was set previously", " wasDBInDurabilityTestModeNoSync = ", " (flags & IS_DURABILITY_TESTMODE_NO_SYNC_FLAG) != 0;", "", " if (SanityManager.DEBUG) {", " if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))", " SanityManager.DEBUG(LogToFile.DBG_FLAG,", " \"log control file, was derby.system.durability set to test = \" +", " wasDBInDurabilityTestModeNoSync);", " }", " ", "\t\t\t\t" ], "header": "@@ -2281,9 +2321,24 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "", "" ] }, { "added": [ " // If derby.system.durability=test is set,then set flag to ", " // disable sync of log records at commit and log file before ", " // data page makes it to disk", " if (Property.DURABILITY_TESTMODE_NO_SYNC.equalsIgnoreCase(", " PropertyUtil.getSystemProperty(Property.DURABILITY_PROPERTY)))", " {", "\t\t // disable syncing of log.", "\t\t logNotSynced = true;", " \t\t //if log not being synced;files shouldn't be open in write sync mode", "\t\t isWriteSynced = false;\t" ], "header": "@@ -2794,19 +2849,17 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "\t\tif (Performance.MEASURE)", "\t\t{", "\t\t\t// debug only flag - disable syncing of log.", "\t\t\tlogNotSynced = ", "\t\t\t\tPropertyUtil.getSystemBoolean(Property.STORAGE_LOG_NOT_SYNCED);", "\t\t\tif (logNotSynced)", "\t\t\t{", "\t\t\t\tMonitor.logMessage(\"logNotSynced = true\");", "\t\t\t\t//if log is Not being synced;files should not be open in write sync mode", "\t\t\t\tisWriteSynced = false;", "\t\t\t}", "\t\t\t" ] }, { "added": [ "\t\t\t\t\tcheckpointInstant = ", " readControlFile(logControlFileName, startParams);", "", "\t\t\t\t\t// in case system was running previously with ", " // derby.system.durability=test then print a message ", " // to the derby log", " if (wasDBInDurabilityTestModeNoSync)", " {", " // print message stating that the database was", " // previously atleast at one time running with", " // derby.system.durability=test mode", " Monitor.logMessage(MessageService.getTextMessage(", "\t\t\t \t\tMessageId.LOG_WAS_IN_DURABILITY_TESTMODE_NO_SYNC,", "\t\t\t \t\tProperty.DURABILITY_PROPERTY,", " Property.DURABILITY_TESTMODE_NO_SYNC));", " }", "\t\t\t\t\t\t", " {", " readControlFile(", " getMirrorControlFileName(), startParams);", " }" ], "header": "@@ -2829,11 +2882,30 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "\t\t\t\t\tcheckpointInstant = readControlFile(logControlFileName, startParams);", "\t\t\t\t\t\t\t\t\treadControlFile(getMirrorControlFileName(), startParams);" ] }, { "added": [ " logErrMsgForDurabilityTestModeNoSync();", "\t\t\t\t\t// If logFileNumber > 1, we are not going to write that ", " // file just yet. Just leave it be and carry on. Maybe ", " // when we get there it can be deleted." ], "header": "@@ -2879,13 +2951,14 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "\t\t\t\t\t// If logFileNumber > 1, we are not going to write that file just", "\t\t\t\t\t// yet. Just leave it be and carry on. Maybe when we get there it", "\t\t\t\t\t// can be deleted." ] }, { "added": [ " logErrMsgForDurabilityTestModeNoSync();" ], "header": "@@ -2913,6 +2986,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [] }, { "added": [ "\t\t\tif (isWriteSynced)" ], "header": "@@ -3576,7 +3650,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "\t\t\tif(isWriteSynced)" ] }, { "added": [ "\t\t\t\tif (!logNotSynced)", "\t\t\t\t logOut.syncLogAccessFile();" ], "header": "@@ -3584,15 +3658,8 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [ "\t\t\t\tif (Performance.MEASURE)", "\t\t\t\t{", "\t\t\t\t\tif (!logNotSynced)", "\t\t\t\t\t\tlogOut.syncLogAccessFile();", "\t\t\t\t}", "\t\t\t\telse", "\t\t\t\t{", "\t\t\t\t\tlogOut.syncLogAccessFile();", "\t\t\t\t}" ] }, { "added": [ " \tlogErrMsgForDurabilityTestModeNoSync();" ], "header": "@@ -3925,6 +3992,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [] }, { "added": [ "\t\tlogErrMsgForDurabilityTestModeNoSync();" ], "header": "@@ -3936,6 +4004,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,", "removed": [] } ] } ]
derby-DERBY-2183-25a40e5f
DERBY-2183: Trigger recompilation problem when not qualified with schema This patch was contributed by Yip Ng (yipng168@gmail.com) The problem was that the compilation schema for the SPS was never set during its recompilation, it was using the current schema to perform the recompilation which is not correct. It should have use the SPS's compilation schema to do the recompilation when we push the compiler context. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@492353 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java", "hunks": [ { "added": [ "\t * the passed in schema sd as the default schema", "\t * For the parameter sd, there are 3 possible values(of interest) that can ", "\t * get passed into this method:", "\t * ", "\t * a) A null SchemaDescriptor which indicates to the system to use the ", "\t * CURRENT SCHEMA as the compilation schema.", "\t * ", "\t * b) A SchemaDescriptor with its UUID == null, this indicates that either ", "\t * the schema has not been physically created yet or that the LCC's ", "\t * getDefaultSchema() is not yet up-to-date with its actual UUID. ", "\t * The system will use the CURRENT SCHEMA as the compilation schema. ", "\t * ", "\t * c) A SchemaDescriptor with its UUID != null, this means that the schema ", "\t * has been physically created. The system will use this schema as the ", "\t * compilation schema (e.g.: for trigger or view recompilation cases, ", "\t * etc.). ", "\t * ", "\t * The compiler context's compilation schema will be set accordingly based ", "\t * on the given input above. " ], "header": "@@ -1810,13 +1810,31 @@ public class GenericLanguageConnectionContext", "removed": [ "\t * the passed in default schema as the default schema" ] } ] } ]
derby-DERBY-2191-17711ecf
DERBY-2191: Cleanup of FormatableBitSet Re-wrote anySetBit and anySetBit(int beyondBit) to use a single loop and removed special handling of the last byte. Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@501095 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\tprivate static int umul8(int i) { return (i<<3); }" ], "header": "@@ -93,6 +93,7 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [ "\t * A utility method which treats the byte argument as an 8-bit", "\t * bitset and finds the first set bit in that byte. Assumes that", "\t * at least one bit in v is set (v!=0).", "\t * @param a non-zero byte to check for set bits", "\t * @return the zero-based index of the first set bit in the argument byte", "\tprivate static byte firstSet(byte v) {", "\t\tif ((v & 0x80) != 0) {", "\t\t\treturn 0;", "\t\tif ((v & 0x40) != 0) {", "\t\t\treturn 1;", "\t\tif ((v & 0x20) != 0) {", "\t\t\treturn 2;", "\t\t}", "\t\tif ((v & 0x10) != 0) {", "\t\t\treturn 3;", "\t\t}", "\t\tif ((v & 0x8) != 0) {", "\t\t\treturn 4;", "\t\t}", "\t\tif ((v & 0x4) != 0) {", "\t\t\treturn 5;", "\t\t}", "\t\tif ((v & 0x2) != 0) {", "\t\t\treturn 6;", "\t\t}", "\t\treturn 7;", "\t}", "\t/**", "\t * If any bit is set, return the zero-based bit index of the first", "\t * bit that is set. If no bit is set, return -1. By using", "\t * anySetBit() and anySetBit(beyondBit), one can quickly go thru", "\t * the entire bit array to return all set bit.", "\t *", "\t * @return the zero-based index of the first bit that is set, or", "\t * -1 if no bit is set", "\t */", "\tpublic int anySetBit() {", "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(invariantHolds(), \"broken invariant\");", "\t\t}", "\t\tfinal int numbytes = getLengthInBytes();", "\t\tfor (int i = 0; i < numbytes; ++i) {", "\t\t\tfinal byte v = value[i];", "\t\t\tif (v == 0) continue;", "\t\t\treturn (umul8(i) + firstSet(v));", "\t\t}" ], "header": "@@ -642,42 +643,56 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t * If any bit is set, return the bit number of a bit that is set.", "\t * If no bit is set, return -1; ", "\t *", "\t * @return the bit number of a bit that is set, or -1 if no bit is set", "\tpublic int anySetBit()", "\t{", "\t\tint numbytes = getLengthInBytes();", "\t\tint bitpos;", "", "\t\tfor (int i = 0; i < numbytes-1; i++)", "\t\t{", "\t\t\tif (value[i] != 0)", "\t\t\t{", "\t\t\t\tfor (int j = 0; j < 8; j++)", "\t\t\t\t{", "\t\t\t\t\tbitpos = 7-j;", "\t\t\t\t\tif (((1 << bitpos) & value[i]) != 0)", "\t\t\t\t\t\treturn ((i*8)+j);", "\t\t\t\t}", "\t\t\t}", "", "", "\t\t// only the top part of the last byte is relevant", "\t\tbyte mask = (byte)(0xFF << (8-bitsInLastByte));", "\t\tif ((value[numbytes-1] & mask) != 0)", "\t\t{", "\t\t\tfor (int j = 0; j < bitsInLastByte; j++)", "\t\t\t{", "\t\t\t\tbitpos = 7-j;", "\t\t\t\tif (((1 << bitpos) & value[numbytes-1]) != 0)", "\t\t\t\t\treturn ((numbytes-1)*8)+j;", "\t\t\t}" ] } ] } ]
derby-DERBY-2191-3f2dd5cf
DERBY-2191: Cleanup of FormatableBitSet Simplified grow() by removing an unneeded special case. Added ASSERT(invariantHolds()) to grow() and shrink(). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@504460 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(invariantHolds(), \"broken invariant\");", "\t\t}", "" ], "header": "@@ -291,6 +291,10 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [ "\t\tif (newNumBytes > value.length) {", "\t\t\tint oldNumBytes = getLengthInBytes();" ], "header": "@@ -299,37 +303,17 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\tint delta = n - lengthAsBits;", "\t\tint oldNumBytes = getLengthInBytes();", "", "\t\t/*", "\t\t** If we have enough space in the left over bits,", "\t\t** then all we need to do is change the modulo.", "\t\t*/", "\t\tif ((oldNumBytes != 0) &&", "\t\t (8 - this.bitsInLastByte) >= delta)", "\t\t{", "\t\t\tthis.bitsInLastByte += delta;", "\t\t\tlengthAsBits = n;", "\t\t\treturn;", "\t\t}", "", "\t\tif (newNumBytes <= value.length) {", "\t\t\t// ensure the bits are zeroed", "\t\t\tfor (int i = oldNumBytes; i < newNumBytes; i++)", "\t\t\t\tvalue[i] = 0;", "\t\t} else {", "", "" ] }, { "added": [ "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(invariantHolds(), \"broken invariant\");", "\t\t}", "" ], "header": "@@ -348,6 +332,10 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] } ] } ]
derby-DERBY-2191-59b0bbac
DERBY-2191: Cleanup of FormatableBitSet This patch re-writes the method getNumBitsSet() to do a byte-by-byte calculation. Contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@501334 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\t\tif (SanityManager.DEBUG) {", "\t\t\tSanityManager.ASSERT(invariantHolds(),\"broken invariant\");", "\t\tint bitsSet = 0;", "\t\tfinal int numbytes = getLengthInBytes();", "\t\tfor (int i = 0; i < numbytes; ++i) {", "\t\t\tbyte v = value[i];", "", "\t\t\t// \"Truth table\", bits set in half-nibble (2 bits):", "\t\t\t// A | A>>1 | A-=A>>1 | bits set", "\t\t\t// ------------------------------", "\t\t\t// 00 | 00 | 0 | 0", "\t\t\t// 01 | 00 | 1 | 1", "\t\t\t// 10 | 01 | 1 | 1", "\t\t\t// 11 | 01 | 2 | 2", "", "\t\t\t// Calculate bits set in each half-nibble in parallel", "\t\t\t// |ab|cd|ef|gh|", "\t\t\t// - |>a|&c|&e|&g|>", "\t\t\t// ----------------", "\t\t\t// = |ij|kl|mn|op|", "\t\t\tv -= ((v >> 1) & 0x55);", "", "\t\t\t// Add the upper and lower half-nibbles together and store", "\t\t\t// in each nibble", "\t\t\t// |&&|kl|&&|op|", "\t\t\t//+ |>>|ij|&&|mn|>>", "\t\t\t//-----------------", "\t\t\t//= |0q|rs|0t|uv|", "\t\t\tv = (byte)((v & 0x33) + ((v >> 2) & 0x33));", "", "\t\t\t// Add the nibbles together", "\t\t\t// |&&&&|&tuv|", "\t\t\t//+ |>>>>|0qrs|>>>>", "\t\t\t//-----------------", "\t\t\t//= |0000|wxyz|", "\t\t\tv = (byte)((v & 0x7) + (v >> 4));", "\t\t\tbitsSet += v;", "\t\t}", "\t\treturn bitsSet;" ], "header": "@@ -829,17 +829,46 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\tint count = 0;", "", "\t\tfor (int index = getLength() - 1; index >= 0; index--)", "\t\t{", "\t\t\tif (isSet(index))", "\t\t\t{", "\t\t\t\tcount++;", "\t\t\t}", "", "\t\treturn count;" ] } ] } ]
derby-DERBY-2191-65a2bbd9
DERBY-2191: Cleanup of FormatableBitSet Use unsigned int operations to calculate positions. Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@500177 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\tprivate\tbyte\tbitsInLastByte;", "\tprivate final void checkPosition(int p) {" ], "header": "@@ -70,11 +70,11 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\tprivate\tshort\tbitsInLastByte;", "\tprivate void checkPosition(int p) {" ] }, { "added": [ "\t// Division, multiplication and remainder calcuation of a positive", "\t// number with a power of two can be done using shifts and bit", "\t// masking. The compiler attempts this optimization but since Java", "\t// does not have unsigned ints it will also have to create code to", "\t// handle negative values. In this class the argument is", "\t// frequently an array index or array length, which is known not", "\t// to be negative. These utility methods allow us to perform", "\t// \"unsigned\" operations with 8. Hopefully the extra function call", "\t// will be inlined by the compiler.", "\tprivate static int udiv8(int i) { return (i>>3); }", "\tprivate static byte umod8(int i) { return (byte)(i&0x7); }", "" ], "header": "@@ -82,6 +82,18 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [ "\t\tif (numBits < 0) {", "\t\t\tthrow new", "\t\t\tIllegalArgumentException(\"Bit set size \"+ numBits +", "\t\t\t\t\t\t\t\t\t \" is not allowed\");", "\t\t}" ], "header": "@@ -95,6 +107,11 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [ "\t\tif (n < 0) {", "\t\t\tthrow new", "\t\t\tIllegalArgumentException(\"Bit set size \"+ n +", "\t\t\t\t\t\t\t\t\t \" is not allowed\");", "\t\t}" ], "header": "@@ -324,6 +341,11 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [ "\t\tfinal int byteIndex = udiv8(position);", "\t\tfinal byte bitIndex = umod8(position);", "\t\treturn ((value[byteIndex] & (0x80>>bitIndex)) != 0);", "" ], "header": "@@ -494,13 +516,12 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "", "\t\tint bytepos = position / 8;", "\t\tint bitpos = 7 - (position % 8);", "", "\t\treturn ((value[bytepos] & (1 << bitpos)) != 0);" ] }, { "added": [ "\t\tfinal int byteIndex = udiv8(position);", "\t\tfinal byte bitIndex = umod8(position);", "\t\tvalue[byteIndex] |= (0x80>>bitIndex);" ], "header": "@@ -521,11 +542,9 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "", "\t\tint bytepos = position / 8;", "\t\tint bitpos = 7 - (position % 8);", "", "\t\tvalue[bytepos] |= (1 << bitpos);" ] }, { "added": [ "\t\tfinal int byteIndex = udiv8(position);", "\t\tfinal byte bitIndex = umod8(position);", "\t\tvalue[byteIndex] &= ~(0x80>>bitIndex);" ], "header": "@@ -537,11 +556,9 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "", "\t\tint bytepos = position / 8;", "\t\tint bitpos = 7 - (position % 8);", "", "\t\tvalue[bytepos] &= ~(1 << bitpos);" ] } ] } ]
derby-DERBY-2191-72a3df4a
DERBY-2191: Remove unused methods in FormatableBitSet Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497396 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [], "header": "@@ -113,27 +113,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t/**", "\t * Constructs a Bit from an array of bytes.", "\t *", "\t * @param newValue\tThe array of bytes to make up the new Bit", "\t * @param numBits\tThe number of bits", "\t */", "\tpublic FormatableBitSet(byte[] newValue, int numBits)", "\t{", "\t\tbitsInLastByte = numBitsInLastByte(numBits);", "\t\tlengthAsBits = numBits;", "", "\t\tint lenInBytes = numBytesFromBits(numBits);", "", "\t\tif (lenInBytes == newValue.length) {", "\t\t\tvalue = newValue;", "\t\t} else {", "\t\t\tvalue = new byte[lenInBytes];", "\t\t\tSystem.arraycopy(newValue, 0, value, 0, newValue.length);", "\t\t}", "\t}", "" ] }, { "added": [], "header": "@@ -436,96 +415,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t/**", "\t * Bit concatenation.", "\t *", "\t * @param other \tthe other bit to append to this", "\t *", "\t * @return Bit -- the newly concatenated bit", "\t *", "\t */", "\tpublic FormatableBitSet concatenate(FormatableBitSet other)", "\t{", "\t\tint\t\tnewLen;", "\t\tint\t\totherLen;", "\t\tint\t\tprevLen;", "\t\tint\t\tprevLenBytes;", "\t\tint\t\tnewLenBytes;", "\t\tint otherLenBytes;", "\t\tint\t\ti, j;", "\t\tbyte[]\tnewValue;", "\t\tbyte[]\totherValue;", "\t\tint\t\tshiftBits;", "\t\tint\t\tinByte;", "", "", "\t\tprevLen = this.getLength();", "\t\tprevLenBytes = this.getLengthInBytes();", "\t\totherLen = other.getLength();", "\t\totherValue = other.getByteArray();", "\t\totherLenBytes = other.getLengthInBytes();", "\t\tnewLen = prevLen + otherLen;", "\t\tnewLenBytes = numBytesFromBits(newLen);", "\t\tnewValue = new byte[newLenBytes];", "", "", "\t\t/*", "\t\t** Copy over the entire array in this.value", "\t\t** to newLenBytes.", "\t\t*/", "\t\tfor (i = 0; i < prevLenBytes; i++)", "\t\t{", "\t\t\tnewValue[i] = this.value[i];", "\t\t}", "", "\t\t/*", "\t\t** Now if we have any bits left over", "\t\t** we need to shift them, and keep", "\t\t** shifting everything down. Be careful", "\t\t** to handle the case where the bit", "\t\t** used to have length 0.", "\t\t*/", "\t\tshiftBits = (prevLen == 0) ? 8 : this.bitsInLastByte;", "\t\tfor (j = 0; j < otherLenBytes; j++, i++)", "\t\t{", "\t\t\tif (shiftBits == 8)", "\t\t\t{", "\t\t\t\tnewValue[i] = otherValue[j];", "\t\t\t}", "\t\t\telse", "\t\t\t{", "\t\t\t\t/*", "\t\t\t\t** Convert to an int because it will get converted", "\t\t\t\t** on the shift anyway.", "\t\t\t\t*/", "\t\t\t\tinByte = (int)otherValue[j];", "", "\t\t\t\t/*", "\t\t\t\t** Mask off the high bits in case they are now", "\t\t\t\t** turned on if we had the sign bit on.", "\t\t\t\t*/", "\t\t\t\tinByte &= (0x100 - 1);", "", "\t\t\t\t/*", "\t\t\t\t** Use the high order bits to finish off", "\t\t\t\t** the last byte", "\t\t\t\t*/", "\t\t\t\tnewValue[i-1] |= (inByte >>> shiftBits);", "", "\t /*", "\t\t ** Start the next one with whatever is left, unless", "\t\t ** there is nothing left.", "\t */", "\t if (i < newLenBytes)", "\t\t\t\t{", "\t\t newValue[i] |= (inByte << (8 - shiftBits));", "\t\t\t\t}", "\t\t\t}", "\t\t}", "", "\t\treturn new FormatableBitSet(newValue, newLen);", "\t}", "" ] }, { "added": [], "header": "@@ -695,104 +584,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t/**", "\t * Translate a hex character to a byte.", "\t *", "\t * @param hexChar\tA character with the value [0-9a-fA-F].", "\t *", "\t * @return\tA byte with the numeric value corresponding to the hex character", "\t */", "\tprivate static byte", "\thexCharToByte(char hexChar)", "\t{", "\t\tbyte\tbyteValue;", "", "\t\tswitch (hexChar)", "\t\t{", "\t\t case '0':", "\t\t\tbyteValue = 0;", "\t\t\tbreak;", "", "\t\t case '1':", "\t\t\tbyteValue = 1;", "\t\t\tbreak;", "", "\t\t case '2':", "\t\t\tbyteValue = 2;", "\t\t\tbreak;", "", "\t\t case '3':", "\t\t\tbyteValue = 3;", "\t\t\tbreak;", "", "\t\t case '4':", "\t\t\tbyteValue = 4;", "\t\t\tbreak;", "", "\t\t case '5':", "\t\t\tbyteValue = 5;", "\t\t\tbreak;", "", "\t\t case '6':", "\t\t\tbyteValue = 6;", "\t\t\tbreak;", "", "\t\t case '7':", "\t\t\tbyteValue = 7;", "\t\t\tbreak;", "", "\t\t case '8':", "\t\t\tbyteValue = 8;", "\t\t\tbreak;", "", "\t\t case '9':", "\t\t\tbyteValue = 9;", "\t\t\tbreak;", "", "\t\t case 'a':", "\t\t case 'A':", "\t\t\tbyteValue = 0xA;", "\t\t\tbreak;", "", "\t\t case 'b':", "\t\t case 'B':", "\t\t\tbyteValue = 0xB;", "\t\t\tbreak;", "", "\t\t case 'c':", "\t\t case 'C':", "\t\t\tbyteValue = 0xC;", "\t\t\tbreak;", "", "\t\t case 'd':", "\t\t case 'D':", "\t\t\tbyteValue = 0xD;", "\t\t\tbreak;", "", "\t\t case 'e':", "\t\t case 'E':", "\t\t\tbyteValue = 0xE;", "\t\t\tbreak;", "", "\t\t case 'f':", "\t\t case 'F':", "\t\t\tbyteValue = 0xF;", "\t\t\tbreak;", "", "\t\t default:", "\t\t\t if (SanityManager.DEBUG)", "\t\t\t {", "\t\t\t\t SanityManager.THROWASSERT(\"illegal char = \" + hexChar);", "\t\t\t }", "\t\t \tthrow new IllegalArgumentException();", "\t\t}", "", "\t\treturn byteValue;", "\t}", "", "private static char[] decodeArray = {'0', '1', '2', '3', '4', '5', '6', '7',", "\t\t\t\t\t\t\t\t'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};", "" ] } ] } ]
derby-DERBY-2191-85644631
DERBY-2191: Cleanup of FormatableBitSet Removal of dead code. Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@489053 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\t\tint obByteLen = otherBit.getLengthInBytes();", "\t\tfor (int i = 0; i < obByteLen-1; i++)", "\t\t\tvalue[i] |= otherBit.value[i];", "\t\t", "\t\t// do the last byte bit by bit", "\t\tfor (int i = (obByteLen-1)*8; i < otherLength; i++)", "\t\t\tif (otherBit.isSet(i))", "\t\t\t\tset(i);" ], "header": "@@ -1050,31 +1050,14 @@ private static char[] decodeArray = {'0', '1', '2', '3', '4', '5', '6', '7',", "removed": [ "\t\tif (otherBit instanceof FormatableBitSet)", "\t\t{", "\t\t\t// we know the bit ordering, optimize this ", "\t\t\tFormatableBitSet ob = (FormatableBitSet)otherBit;", "\t\t\tint obByteLen = ob.getLengthInBytes();", "\t\t\tfor (int i = 0; i < obByteLen-1; i++)", "\t\t\t\tvalue[i] |= ob.value[i];", "", "\t\t\t// do the last byte bit by bit", "\t\t\tfor (int i = (obByteLen-1)*8; i < otherLength; i++)", "\t\t\t\tif (otherBit.isSet(i))", "\t\t\t\t\tset(i);", "\t\t}", "\t\telse", "\t\t{", "\t\t\t// we don't know the bit ordering, call thru the interface and go", "\t\t\t// thru bit by bit", "\t\t\t// this bit impl's length >= other bit's length", "", "\t\t\tfor (int i = 0; i < otherLength; i++)", "\t\t\t{", "\t\t\t\tif (otherBit.isSet(i))", "\t\t\t\t\tset(i);", "\t\t\t}", "\t\t}" ] } ] } ]
derby-DERBY-2191-8a6ea6dc
DERBY-2191: Cleanup of FormatableBitSet - Fixed bug in shrink() causing some unused bits to not be cleared. - Fixed bug in shrink() causing ArrayIndexOutOfBoundsException when shrinking to 0. - Throw exception when shrinking to a size larger than the current size or growing to negative size. Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@502185 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\t * Grow (widen) a FormatableBitSet so that it contains at least N", "\t * bits. If the bitset already has more than n bits, this is a", "\t * noop. Negative values of n are not allowed.", "\t * ASSUMPTIONS: that all extra bits in the last byte are", "\t * zero.", " \t\tif (n < 0) {", " \t\t\tthrow new IllegalArgumentException(\"Bit set cannot grow from \"+", " \t\t\t\t\t\t\t\t\t\t\t lengthAsBits+\" to \"+n+\" bits\");", " \t\t}", "\t\tif (n <= lengthAsBits) {", " \t\t\treturn;", " \t\t}", "", "\t\tint delta = n - lengthAsBits;" ], "header": "@@ -278,23 +278,28 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t * Grow (widen) a FormatableBitSet to N bis", "\t * ASSUMPTIONS: that all extra bits in the last byte", "\t * are zero.", "\t\tif (n <= this.getLength())", "\t\t\treturn;", "", "\t\tint delta = n - this.getLength();", "", "" ] } ] } ]
derby-DERBY-2191-8bb781c8
DERBY-2191: Cleanup of FormatableBitSet Ensure that value is never null and remove redundant checks for (value == null). Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@496719 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.util.ReuseFactory;" ], "header": "@@ -22,6 +22,7 @@", "removed": [] }, { "added": [ "\t// value is never null. An empty bitset is represented by a", "\t// zero-length array." ], "header": "@@ -67,6 +68,8 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [ "\t\tvalue = ReuseFactory.getZeroLenByteArray();" ], "header": "@@ -77,6 +80,7 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [], "header": "@@ -167,11 +171,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\tif (value == null)", "\t\t{", "\t\t\treturn 0;", "\t\t}", "" ] }, { "added": [], "header": "@@ -219,9 +218,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\tif (value == null)", "\t\t\treturn null;", "" ] }, { "added": [], "header": "@@ -238,16 +234,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t/**", "\t * Set the value of the byte array", "\t *", "\t * @return\tThe value of the byte array", "\t */", "\tpublic boolean isNull()", "\t{", "\t\treturn this.value == null;", "\t}", "" ] }, { "added": [], "header": "@@ -263,12 +249,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\tif (value == null)", "\t\t{", "\t\t\tinitializeBits(n);", "\t\t\treturn;", "\t\t}", "" ] }, { "added": [], "header": "@@ -322,20 +302,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\t/*", "\t\t** Sanity check: we shouldn't shrink down to", "\t\t** nothing.", "\t\t*/", "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tif (value == null)", "\t\t\t{", "\t\t\t\tSanityManager.THROWASSERT(\"Attempt to shrink a null Bit\"+", "\t\t\t\t\t\t\" -- caller should have known better probably\");", "\t\t\t\treturn null;", "\t\t\t}", "\t\t}", "" ] }, { "added": [], "header": "@@ -413,18 +379,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\t/*", "\t\t** By convention, nulls sort low, and null == null", "\t\t*/", "\t\tif (this.value == null || otherb == null)", "\t\t{", "\t\t\tif (this.value != null)\t// otherb == null", "\t\t\t\treturn 1;", "\t\t\tif (otherb != null)\t\t// this.value == null", "\t\t\t\treturn -1;", "\t\t\treturn 0;\t\t\t\t// both null", "\t\t}", "" ] }, { "added": [], "header": "@@ -581,9 +535,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ " if( null == value)", " return 0;", " " ] }, { "added": [], "header": "@@ -710,9 +661,6 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\tif (value == null) ", " return;", "" ] } ] } ]
derby-DERBY-2191-9fdfb400
DERBY-2191: Cleanup of FormatableBitSet * remove unused import * simplify calculation in numBytesFromBits() * removed unused variables in toString() git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497003 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [], "header": "@@ -24,7 +24,6 @@ package org.apache.derby.iapi.services.io;", "removed": [ "import java.io.InputStream;" ] }, { "added": [ "\tprivate static int numBytesFromBits(int bits) {", "\t\treturn (bits + 7) >> 3;" ], "header": "@@ -675,10 +674,8 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\tprotected static int", "\tnumBytesFromBits(int bits)", "\t{", "\t\treturn (bits == 0) ? 0 : ((bits - 1) / 8) + 1;" ] } ] } ]
derby-DERBY-2191-a517b4e5
DERBY-2191: Cleanup of FormatableBitSet Added unit tests. Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@496312 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/unitTests/junit/_Suite.java", "hunks": [ { "added": [ "/*", "", " Derby - Class org.apache.derbyTesting.unitTests.junit._Suite", "", " Licensed to the Apache Software Foundation (ASF) under one", " or more contributor license agreements. See the NOTICE file", " distributed with this work for additional information", " regarding copyright ownership. The ASF licenses this file", " to you under the Apache License, Version 2.0 (the", " \"License\"); you may not use this file except in compliance", " with the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing,", " software distributed under the License is distributed on an", " \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY", " KIND, either express or implied. See the License for the", " specific language governing permissions and limitations", " under the License", "*/", "package org.apache.derbyTesting.unitTests.junit;", "", "import java.sql.SQLException;", "", "import org.apache.derbyTesting.junit.BaseTestCase;", "", "import junit.framework.Test;", "import junit.framework.TestSuite;", "", "/**", " * Suite to run all JUnit tests in this package:", " * org.apache.derbyTesting.unitTests.junit", " *", " */", "public class _Suite extends BaseTestCase {", "", " /**", " * Use suite method instead.", " */", " private _Suite(String name) {", " super(name);", " }", "", " public static Test suite() throws SQLException {", "", " TestSuite suite = new TestSuite(\"JUnit unit tests\");", "", " suite.addTest(FormatableBitSetTest.suite());", "", " return suite;", " }", "}" ], "header": "@@ -0,0 +1,53 @@", "removed": [] } ] } ]
derby-DERBY-2191-aa13c704
DERBY-2191: Make boundary checking more consistent in FormatableBitSet Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497398 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\tprivate void checkPosition(int p) {", "\t\tif (p < 0 || lengthAsBits <= p) {", "\t\t\tthrow new", "\t\t\t\tIllegalArgumentException(\"Bit position \"+p+", "\t\t\t\t\t\t\t\t\t\t \" is outside the legal range\");", "\t\t}", "\t}", "" ], "header": "@@ -74,6 +74,14 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] }, { "added": [ "\t\tcheckPosition(position);", "\t\tint bytepos = position / 8;", "\t\tint bitpos = 7 - (position % 8);", "\t\treturn ((value[bytepos] & (1 << bitpos)) != 0);" ], "header": "@@ -446,29 +454,12 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "\t\tif (SanityManager.DEBUG)", "\t\t{", "\t\t\tif (position >= this.getLength())", " {", " SanityManager.THROWASSERT(", " \"Attempt to get a bit position (\" + position +", " \")\" +", " \"that exceeds the max length (\" + this.getLength() + \")\");", " }", "\t\t}", "\t\ttry {", "", "\t\t\tint bytepos = position / 8;", "\t\t\tint bitpos = 7 - (position % 8);", "", "\t\t\treturn ((value[bytepos] & (1 << bitpos)) != 0);", "\t\t} catch (ArrayIndexOutOfBoundsException e) {", "\t\t\t// Should not happen, handle it just in case not all cases are tested", "\t\t\t// by insane server.", "\t\t\treturn false;", "\t\t}" ] }, { "added": [ "\t\tcheckPosition(position);" ], "header": "@@ -490,21 +481,7 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [ "", "\t\tif (SanityManager.DEBUG)", "\t\t{", " if (position >= this.getLength())", " {", " SanityManager.THROWASSERT(", "\t\t\t\t \"Attempt to set a bit position that exceeds the max length (\"", " + this.getLength() + \")\");", " }", "\t\t}", "", "\t\t// Should not happen, handle it just in case not all cases are tested", "\t\t// by insane server.", "\t\tif (position >= getLength())", "\t\t\tgrow(position);" ] } ] } ]
derby-DERBY-2191-c7205c15
DERBY-2191: Cleanup of FormatableBitSet Changed the bitset operator methods or(), and() and xor() so that they follow the same pattern. All are now performing the operation bytewise, and there is no special handling of the last partial byte. The patch also adds a method called invariantHolds() that checks if the class' invariant is maintained (for use in the unit test). Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@498772 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/services/io/FormatableBitSet.java", "hunks": [ { "added": [ "\t/**", "\t * This method returns true if the following conditions hold:", "\t * 1. The number of bits in the bitset will fit into the allocated", "\t * byte array. 2. 'lengthAsBits' and 'bitsInLastByte' are", "\t * consistent. 3. All unused bits in the byte array are", "\t * unset. This represents an invariant for the class, so this", "\t * method should always return true.", "\t *", "\t * The method is public, but is primarily intended for testing and", "\t * ASSERTS.", "\t * @returns true if invariant holds, false otherwise", "\t */", "\tpublic boolean invariantHolds() {", "\t\t// Check that all bits will fit in byte array", "\t\tfinal int arrayLengthAsBits = value.length*8;", "\t\tif (lengthAsBits > arrayLengthAsBits) { return false; }", "", "\t\t// Check consistency of 'lengthAsBits' and 'bitsInLastByte'", "\t\tfinal int partialByteIndex = (lengthAsBits-1)/8;", "\t\tif (bitsInLastByte != (lengthAsBits - (8*partialByteIndex))) {", "\t\t\treturn false;", "\t\t}", "\t\t// Special case for empty bitsets since they will have", "\t\t// 'partialByteIndex'==0, but this isn't a legal index into", "\t\t// the byte array", "\t\tif (value.length==0) { return true; }", "", "\t\t// Check that the last used (possibly partial) byte doesn't", "\t\t// contain any unused bit positions that are set.", "\t\tbyte partialByte = value[partialByteIndex];", "\t\tpartialByte <<= bitsInLastByte; // must be zero after shift", "", "\t\t// Check the remaining completely unused bytes (if any)", "\t\tfor (int i = partialByteIndex+1; i < value.length; ++i) {", "\t\t\tpartialByte |= value[i];", "\t\t}", "\t\treturn (partialByte==0);", "\t}", "" ], "header": "@@ -149,6 +149,45 @@ public final class FormatableBitSet implements Formatable, Cloneable", "removed": [] } ] } ]
derby-DERBY-2191-e9575468
DERBY-2191: More test cases for FormatableBitSet.getNumBitsSet() git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@501368 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2193-97fdc36e
DERBY-2193: Add line numbers and file names to import error messages. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@528492 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/impl/load/Import.java", "hunks": [ { "added": [ "import org.apache.derby.iapi.reference.SQLState;", "import org.apache.derby.iapi.error.StandardException;", "import org.apache.derby.iapi.error.PublicAPI;", "" ], "header": "@@ -31,6 +31,10 @@ import java.sql.ResultSetMetaData;", "removed": [] }, { "added": [ " private static int _importCounter;", " private static Hashtable _importers = new Hashtable();", "", " private String inputFileName;" ], "header": "@@ -40,7 +44,10 @@ import java.util.*;", "removed": [ "\tprivate String inputFileName;" ] }, { "added": [ " boolean lobsInExtFile,", " int importCounter ) throws SQLException " ], "header": "@@ -50,7 +57,8 @@ public class Import extends ImportAbstract{", "removed": [ " boolean lobsInExtFile) throws SQLException " ] }, { "added": [ " _importers.put( new Integer( importCounter ), this );", " " ], "header": "@@ -62,6 +70,8 @@ public class Import extends ImportAbstract{", "removed": [] }, { "added": [ " private static void performImport", " (Connection connection, ", " String schemaName, ", " String insertColumnList, ", " String columnIndexes,", " String tableName, ", " String inputFileName, ", " String columnDelimiter, ", " String characterDelimiter, ", " String codeset, ", " short replace, ", " boolean lobsInExtFile)", " {", " Integer importCounter = new Integer( bumpImportCounter() );", " ", " try {", " if (connection == null)", " throw LoadError.connectionNull();", " ", " ", " ", " if (tableName == null)", " throw LoadError.entityNameMissing();", " ", " ", " ColumnInfo columnInfo = new ColumnInfo(connection , schemaName ,", " tableName, insertColumnList, ", " columnIndexes, COLUMNNAMEPREFIX);", " ", " /* special handling of single quote delimiters", " * Single quote should be writeen with an extra quote otherwise sql will", " * throw syntac error.", " * i.e to recognize a quote it has to be appended with extra quote ('')", " */", " if(characterDelimiter!=null && characterDelimiter.equals(\"'\"))", " characterDelimiter = \"''\";", " if(columnDelimiter !=null && columnDelimiter.equals(\"'\"))", " columnDelimiter = \"''\";", " ", " ", " StringBuffer sb = new StringBuffer(\"new \");", " sb.append(\"org.apache.derby.impl.load.Import\");", " sb.append(\"(\") ; ", " sb.append(\t(inputFileName !=null ? \"'\" + inputFileName + \"'\" : null));", " sb.append(\",\") ;", " sb.append(\t(columnDelimiter !=null ? \"'\" + columnDelimiter + \"'\" : null));", " sb.append(\",\") ;", " sb.append(\t(characterDelimiter !=null ? \"'\" + characterDelimiter + \"'\" : null));", " sb.append(\",\") ;", " sb.append(\t(codeset !=null ? \"'\" + codeset + \"'\" : null));", " sb.append(\", \");", " sb.append( columnInfo.getExpectedNumberOfColumnsInFile());", " sb.append(\", \");", " sb.append( \"'\" + columnInfo.getExpectedVtiColumnTypesAsString() + \"'\");", " sb.append(\", \");", " sb.append(lobsInExtFile);", " sb.append(\", \");", " sb.append( importCounter.intValue() );", " sb.append(\" )\") ;", " ", " String importvti = sb.toString();", " ", " // delimit the table and schema names with quotes.", " // because they might have been created as quoted", " // identifiers(for example when reserved words are used, names are quoted)", " ", " // Import procedures are to be called with case-senisitive names. ", " // Incase of delimited table names, they need to be passed as defined", " // and when they are not delimited, they need to be passed in upper", " // case, because all undelimited names are stored in the upper case ", " // in the database. ", " ", " String entityName = (schemaName == null ? \"\\\"\"+ tableName + \"\\\"\" : ", " \"\\\"\" + schemaName + \"\\\"\" + \".\" + \"\\\"\" + tableName + \"\\\"\"); ", " ", " String insertModeValue;", " if(replace > 0)", " insertModeValue = \"replace\";", " else", " insertModeValue = \"bulkInsert\";", " ", " String cNamesWithCasts = columnInfo.getColumnNamesWithCasts();", " String insertColumnNames = columnInfo.getInsertColumnNames();", " if(insertColumnNames !=null)", " insertColumnNames = \"(\" + insertColumnNames + \") \" ;", " else", " insertColumnNames = \"\";", " String insertSql = \"INSERT INTO \" + entityName + insertColumnNames + ", " \" --DERBY-PROPERTIES insertMode=\" + insertModeValue + \"\\n\" +", " \" SELECT \" + cNamesWithCasts + \" from \" + ", " importvti + \" AS importvti\" ;", " ", " //prepare the import statement to hit any errors before locking the table", " PreparedStatement ips = connection.prepareStatement(insertSql);", " ", " //lock the table before perfoming import, because there may ", " //huge number of lockes aquired that might have affect on performance ", " //and some possible dead lock scenarios.", " Statement statement = connection.createStatement();", " String lockSql = \"LOCK TABLE \" + entityName + \" IN EXCLUSIVE MODE\";", " statement.executeUpdate(lockSql);", " ", " //execute the import operaton.", " try {", " ips.executeUpdate();", " }", " catch (Throwable t)", " {", " throw formatImportError( (Import) _importers.get( importCounter ), inputFileName, t );", " }", " statement.close();", " ips.close();", " }", " finally", " {", " //", " // The importer was put into a hashtable so that we could look up", " // line numbers for error messages. The Import constructor put", " // the importer in the hashtable. Now garbage collect that entry.", " //", " _importers.remove( importCounter );", " }", " }" ], "header": "@@ -159,111 +169,130 @@ public class Import extends ImportAbstract{", "removed": [ "\tprivate static void performImport(Connection connection, ", " String schemaName, ", " String insertColumnList, ", " String columnIndexes,", " String tableName, ", " String inputFileName, ", " String columnDelimiter, ", " String characterDelimiter, ", " String codeset, ", " short replace, ", " boolean lobsInExtFile)", "\t{", "", "\t\tif (connection == null)", "\t\t\tthrow LoadError.connectionNull();", "\t\t", "\t", "\t\t", "\t\tif (tableName == null)", "\t\t\tthrow LoadError.entityNameMissing();", "\t\t", "", "\t\tColumnInfo columnInfo = new ColumnInfo(connection , schemaName ,", "\t\t\t\t\t\t\t\t\t\t\t tableName, insertColumnList, ", "\t\t\t\t\t\t\t\t\t\t\t columnIndexes, COLUMNNAMEPREFIX);", "", "\t\t/* special handling of single quote delimiters", "\t\t * Single quote should be writeen with an extra quote otherwise sql will", "\t\t * throw syntac error.", "\t\t * i.e to recognize a quote it has to be appended with extra quote ('')", "\t\t */", "\t\tif(characterDelimiter!=null && characterDelimiter.equals(\"'\"))", "\t\t\tcharacterDelimiter = \"''\";", "\t\tif(columnDelimiter !=null && columnDelimiter.equals(\"'\"))", "\t\t\tcolumnDelimiter = \"''\";", "\t\t", "", "\t\tStringBuffer sb = new StringBuffer(\"new \");", "\t\tsb.append(\"org.apache.derby.impl.load.Import\");", "\t\tsb.append(\"(\") ; ", "\t\tsb.append(\t(inputFileName !=null ? \"'\" + inputFileName + \"'\" : null));", "\t\tsb.append(\",\") ;", "\t\tsb.append(\t(columnDelimiter !=null ? \"'\" + columnDelimiter + \"'\" : null));", "\t\tsb.append(\",\") ;", "\t\tsb.append(\t(characterDelimiter !=null ? \"'\" + characterDelimiter + \"'\" : null));", "\t\tsb.append(\",\") ;", "\t\tsb.append(\t(codeset !=null ? \"'\" + codeset + \"'\" : null));", "\t\tsb.append(\", \");", " sb.append( columnInfo.getExpectedNumberOfColumnsInFile());", " sb.append(\", \");", " sb.append( \"'\" + columnInfo.getExpectedVtiColumnTypesAsString() + \"'\");", " sb.append(\", \");", " sb.append(lobsInExtFile);", "\t\tsb.append(\" )\") ;", "", "\t\tString importvti = sb.toString();", "", "\t\t// delimit the table and schema names with quotes.", "\t\t// because they might have been created as quoted", "\t\t// identifiers(for example when reserved words are used, names are quoted)", "\t\t", "\t\t// Import procedures are to be called with case-senisitive names. ", "\t\t// Incase of delimited table names, they need to be passed as defined", "\t\t// and when they are not delimited, they need to be passed in upper", "\t\t// case, because all undelimited names are stored in the upper case ", "\t\t// in the database. ", "", "\t\tString entityName = (schemaName == null ? \"\\\"\"+ tableName + \"\\\"\" : ", "\t\t\t\t\t\t\t \"\\\"\" + schemaName + \"\\\"\" + \".\" + \"\\\"\" + tableName + \"\\\"\"); ", "", "\t\tString insertModeValue;", "\t\tif(replace > 0)", "\t\t\tinsertModeValue = \"replace\";", "\t\telse", "\t\t\tinsertModeValue = \"bulkInsert\";", "", "\t\tString cNamesWithCasts = columnInfo.getColumnNamesWithCasts();", "\t\tString insertColumnNames = columnInfo.getInsertColumnNames();", "\t\tif(insertColumnNames !=null)", "\t\t\tinsertColumnNames = \"(\" + insertColumnNames + \") \" ;", "\t\telse", "\t\t\tinsertColumnNames = \"\";", "\t\tString insertSql = \"INSERT INTO \" + entityName + insertColumnNames + ", "\t\t\t\" --DERBY-PROPERTIES insertMode=\" + insertModeValue + \"\\n\" +", "\t\t\t\" SELECT \" + cNamesWithCasts + \" from \" + ", "\t\t\timportvti + \" AS importvti\" ;", "", "\t\t//prepare the import statement to hit any errors before locking the table", "\t\tPreparedStatement ips = connection.prepareStatement(insertSql);", "\t\t", "\t\t//lock the table before perfoming import, because there may ", "\t\t//huge number of lockes aquired that might have affect on performance ", "\t\t//and some possible dead lock scenarios.", "\t\tStatement statement = connection.createStatement();", "\t\tString lockSql = \"LOCK TABLE \" + entityName + \" IN EXCLUSIVE MODE\";", "\t\tstatement.executeUpdate(lockSql);", "", "\t\t//execute the import operaton.", "\t\tips.executeUpdate();", "\t\tstatement.close();", "\t\tips.close();", "", "\t}", "" ] } ] }, { "file": "java/engine/org/apache/derby/impl/load/ImportAbstract.java", "hunks": [ { "added": [ " int lineNumber = 0;" ], "header": "@@ -45,6 +45,7 @@ abstract class ImportAbstract extends VTITemplate {", "removed": [] } ] } ]
derby-DERBY-2193-ca42bbe1
DERBY-2193-03: Adjust the import/export lob tests which assert different results based on the vm level. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@529322 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2196-0aa77692
DERBY-2196: Commit derby-2196-02-install-01.diff, which installs a security manager when the network server is booted without one. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@506751 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/drda/NetworkServerControl.java", "hunks": [ { "added": [ "import java.net.URL;" ], "header": "@@ -23,6 +23,7 @@ package org.apache.derby.drda;", "removed": [] }, { "added": [ "", "\tprivate final static String DERBYNET_JAR = \"derbynet.jar\";", "\tprivate final static String POLICY_FILENAME = \"server.policy\";", "\tprivate final static String POLICY_FILE_PROPERTY = \"java.security.policy\";", "", " private NetworkServerControlImpl serverImpl;" ], "header": "@@ -167,7 +168,12 @@ public class NetworkServerControl{", "removed": [ "\tprivate NetworkServerControlImpl serverImpl;" ] }, { "added": [ "", " //", " // The following variable lets us preserve the error printing behavior", " // seen before we started installing a security manager. Errors can be", " // raised as we figure out whether we need to install a security manager", " // and during the actual installation of the security manager. We need", " // to print out these errors. The old error printing behavior assumed", " // that all errors were generated inside NetworkServerControlImpl and", " // were reported there.", " //", " boolean printErrors = true;", " ", " ", " int command = server.parseArgs( args );", "", " //", " // In order to run secure-by-default, we install a security manager", " // if one isn't already installed. This feature is described by DERBY-2196.", " //", " if ( needsSecurityManager( server, command ) )", " {", " verifySecurityState( server );", " installSecurityManager( server );", " }", "", " //", " // From this point on, NetworkServerControlImpl is responsible for", " // printing errors.", " //", " printErrors = false;", " server.executeWork( command );", "\t\t\t\t!e.getMessage().equals(NetworkServerControlImpl.UNEXPECTED_ERR) ||", "\t\t\t\tprintErrors", "\t\t\t)" ], "header": "@@ -233,16 +239,48 @@ public class NetworkServerControl{", "removed": [ " \t\tserver.executeWork(args);", "\t\t\t\t!e.getMessage().equals(NetworkServerControlImpl.UNEXPECTED_ERR))" ] } ] }, { "file": "java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java", "hunks": [ { "added": [ "\tpublic final static int COMMAND_START = 0;", "\tpublic final static int COMMAND_SHUTDOWN = 1;", "\tpublic final static int COMMAND_TRACE = 2;", "\tpublic final static int COMMAND_TRACEDIRECTORY = 3;", "\tpublic final static int COMMAND_TESTCONNECTION = 4;", "\tpublic final static int COMMAND_LOGCONNECTIONS = 5;", "\tpublic final static int COMMAND_SYSINFO = 6;", "\tpublic final static int COMMAND_RUNTIME_INFO = 7;", "\tpublic final static int COMMAND_MAXTHREADS = 8;", "\tpublic final static int COMMAND_TIMESLICE = 9;", "\tpublic final static int COMMAND_PROPERTIES = 10;", "\tpublic final static int COMMAND_UNKNOWN = -1;", "\tpublic final static String [] DASHARGS =", "\t{\"p\",\"d\",\"u\",\"ld\",\"ea\",\"ep\", \"b\", \"h\", \"s\", \"unsecure\"};", "\tpublic final static int DASHARG_PORT = 0;", "\tpublic final static int DASHARG_DATABASE = 1;", "\tpublic final static int DASHARG_USER = 2;", "\tpublic final static int DASHARG_LOADSYSIBM = 3;", "\tpublic final static int DASHARG_ENCALG = 4;", "\tpublic final static int DASHARG_ENCPRV = 5;", "\tpublic final static int DASHARG_BOOTPASSWORD = 6;", "\tpublic final static int DASHARG_HOST = 7;", "\tpublic final static int DASHARG_SESSION = 8;", "\tpublic final static int DASHARG_UNSECURE = 9;" ], "header": "@@ -83,29 +83,30 @@ public final class NetworkServerControlImpl {", "removed": [ "\tprivate final static int COMMAND_START = 0;", "\tprivate final static int COMMAND_SHUTDOWN = 1;", "\tprivate final static int COMMAND_TRACE = 2;", "\tprivate final static int COMMAND_TRACEDIRECTORY = 3;", "\tprivate final static int COMMAND_TESTCONNECTION = 4;", "\tprivate final static int COMMAND_LOGCONNECTIONS = 5;", "\tprivate final static int COMMAND_SYSINFO = 6;", "\tprivate final static int COMMAND_RUNTIME_INFO = 7;", "\tprivate final static int COMMAND_MAXTHREADS = 8;", "\tprivate final static int COMMAND_TIMESLICE = 9;", "\tprivate final static int COMMAND_PROPERTIES = 10;", "\tprivate final static int COMMAND_UNKNOWN = -1;", "\tprivate final static String [] DASHARGS =", "\t{\"p\",\"d\",\"u\",\"ld\",\"ea\",\"ep\", \"b\", \"h\", \"s\"};", "\tprivate final static int DASHARG_PORT = 0;", "\tprivate final static int DASHARG_DATABASE = 1;", "\tprivate final static int DASHARG_USER = 2;", "\tprivate final static int DASHARG_LOADSYSIBM = 3;", "\tprivate final static int DASHARG_ENCALG = 4;", "\tprivate final static int DASHARG_ENCPRV = 5;", "\tprivate final static int DASHARG_BOOTPASSWORD = 6;", "\tprivate final static int DASHARG_HOST = 7;", "\tprivate final static int DASHARG_SESSION = 8;" ] }, { "added": [ "\tprivate boolean unsecureArg;" ], "header": "@@ -204,6 +205,7 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " /**", " * Get the host where we listen for connections.", " */", " public String getHost() { return hostArg; }", "", " /**", " * Return true if the customer forcibly overrode our decision to install a", " * default SecurityManager.", " */", " public boolean runningUnsecure() { return unsecureArg; }", " " ], "header": "@@ -330,6 +332,17 @@ public final class NetworkServerControlImpl {", "removed": [] }, { "added": [ " /**", " * Parse the command-line arguments. As a side-effect, fills in various instance", " * fields. This method was carved out of executeWork() so that", " * NetworkServerControl can figure out whether to install a security manager", " * before the server actually comes up. This is part of the work for DERBY-2196.", " *", " * @param args\tarray of arguments indicating command to be executed", " *", " * @return the command to be executed", " */", " public int parseArgs(String args[]) throws Exception", " {", " // For convenience just use NetworkServerControlImpls log writer for user messages", " logWriter = makePrintWriter(System.out);", "", " int command = COMMAND_START; ", " if (args.length > 0)", " command = findCommand(args);", " else", " {", " consolePropertyMessage(\"DRDA_NoArgs.U\");", " }", "", " return command;", " }", "", "\t * @param command The command to execute. The command itself was determined by an earlier call to parseArgs().", "\tpublic void executeWork(int command) throws Exception" ], "header": "@@ -1757,27 +1770,42 @@ public final class NetworkServerControlImpl {", "removed": [ "\t * @param args\tarray of arguments indicating command to be executed", "\tpublic void executeWork(String args[]) throws Exception", "\t\t// For convenience just use NetworkServerControlImpls log writer for user messages", "\t\tlogWriter = makePrintWriter(System.out);", "\t\t", "\t\tint command = 0; ", "\t\tif (args.length > 0)", "\t\t\tcommand = findCommand(args);", "\t\telse", "\t\t{", "\t\t\tconsolePropertyMessage(\"DRDA_NoArgs.U\");", "\t\t}", "" ] }, { "added": [ "\t\t\t\tif ( dashArg != DASHARG_UNSECURE ) { pos++ ; }" ], "header": "@@ -1962,7 +1990,7 @@ public final class NetworkServerControlImpl {", "removed": [ "\t\t\t\tpos++;" ] }, { "added": [ "", "\t\t\tcase DASHARG_UNSECURE:", "\t\t\t\tunsecureArg = true;", "\t\t\t\tbreak;", "" ], "header": "@@ -2038,6 +2066,11 @@ public final class NetworkServerControlImpl {", "removed": [] } ] } ]
derby-DERBY-2196-7093bb67
DERBY-3083: To fix regression introduced by DERBY-2196, do not fail server startup if derbynet.jar cannot be found. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@597125 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/drda/NetworkServerControl.java", "hunks": [ { "added": [ " * <li>Classes live in the jar files which we expect..</li>" ], "header": "@@ -545,6 +545,7 @@ public class NetworkServerControl{", "removed": [] }, { "added": [ " (!server.runningUnsecure()) &&", " (packagingLooksGood())", " /**", " * Return true if the server lives in the expected jar file. This", " * is meant to address DERBY-3083. We expect that the URL of", " * the jar which contains NetworkServerControl will end with the", " * string \"derbynet.jar\". If this is true, then getCodeSourcePrefix()", " * will return a prefix which can be substituted into the default", " * server policy file and so end up granting permissions to the server jar file.", " */", " private static boolean packagingLooksGood()", " throws Exception", " {", " String derbyNetURL = NetworkServerControl.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();", "", " return derbyNetURL.endsWith( DERBYNET_JAR );", " }", "", "" ], "header": "@@ -554,10 +555,28 @@ public class NetworkServerControl{", "removed": [ " (!server.runningUnsecure())" ] } ] } ]
derby-DERBY-2196-e0f1ffe2
DERBY-2196: Commit secure-server tests in derby-2196-03-tests-01.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@509693 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java", "hunks": [ { "added": [ "import java.io.InputStream;" ], "header": "@@ -24,6 +24,7 @@ import java.net.InetAddress;", "removed": [] }, { "added": [ " /** Wait maximum 1 minute for server to start */", " private static final long WAIT_TIME = 60000;", " ", " /** Sleep for 50 ms before pinging the network server (again) */", " private static final int SLEEP_TIME = 50;", "", " private static long waitTime = WAIT_TIME;", " ", "", " private final boolean useSeparateProcess;", " private final boolean serverShouldComeUp;", " private final InputStream[] inputStreamHolder;", " private final String[] systemProperties;", " private final String[] startupArgs;" ], "header": "@@ -42,8 +43,22 @@ import org.apache.derby.drda.NetworkServerControl;", "removed": [] }, { "added": [ "", " this.systemProperties = null;", " this.startupArgs = null;", " this.useSeparateProcess = false;", " this.serverShouldComeUp = true;", " this.inputStreamHolder = null;", "}", "", " /**", " * Decorator for starting up with specific command args.", " */", " public NetworkServerTestSetup", " (", " Test test,", " String[] systemProperties,", " String[] startupArgs,", " boolean useSeparateProcess,", " boolean serverShouldComeUp,", " InputStream[] inputStreamHolder", " )", " {", " super(test);", " ", " this.asCommand = true;", "", " this.systemProperties = systemProperties;", " this.startupArgs = startupArgs;", " this.useSeparateProcess = true;", " this.serverShouldComeUp = serverShouldComeUp;", " this.inputStreamHolder = inputStreamHolder;" ], "header": "@@ -51,6 +66,36 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [] }, { "added": [ "", " if (useSeparateProcess)", " { startSeparateProcess(); }", " else if (asCommand)", " { startWithCommand(); }", " { startWithAPI(); }", " if ( serverShouldComeUp ) { waitForServerStart(networkServerController); }" ], "header": "@@ -60,13 +105,15 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [ " ", " if (asCommand)", " startWithCommand();", " startWithAPI();", " waitForServerStart(networkServerController);" ] }, { "added": [], "header": "@@ -89,7 +136,6 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [ " " ] }, { "added": [ "", " String[] args = getDefaultStartupArgs();", " ", " org.apache.derby.drda.NetworkServerControl.main( args );", " private void startSeparateProcess() throws Exception", " {", " StringBuffer buffer = new StringBuffer();", " String classpath = BaseTestCase.getSystemProperty( \"java.class.path\" );", "", " buffer.append( \"java -classpath \" );", " buffer.append( classpath );", " buffer.append( \" \" );", "", " int count = systemProperties.length;", " for ( int i = 0; i < count; i++ )", " {", " buffer.append( \" -D\" );", " buffer.append( systemProperties[ i ] );", " }", "", " buffer.append( \" org.apache.derby.drda.NetworkServerControl \" );", "", " String[] defaultArgs = getDefaultStartupArgs();", "", " count = defaultArgs.length;", " for ( int i = 0; i < count; i++ )", " {", " buffer.append( \" \" );", " buffer.append( defaultArgs[ i ] );", " }", "", " count = startupArgs.length;", " for ( int i = 0; i < count; i++ )", " {", " buffer.append( \" \" );", " buffer.append( startupArgs[ i ] );", " }", "", " final String command = buffer.toString();", "", " Process serverProcess = (Process) AccessController.doPrivileged", " (", " new PrivilegedAction()", " {", " public Object run()", " {", " Process result = null;", " try {", " result = Runtime.getRuntime().exec( command );", " } catch (Exception ex) {", " ex.printStackTrace();", " }", " ", " return result;", " }", " }", " );", "", " inputStreamHolder[ 0 ] = serverProcess.getInputStream();", " }", "", "" ], "header": "@@ -101,24 +147,78 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [ " org.apache.derby.drda.NetworkServerControl.main(", " new String[] {", " \"start\",", " \"-h\",", " config.getHostName(),", " \"-p\",", " Integer.toString(config.getPort())", " }); " ] }, { "added": [ " if ( serverOutput != null ) { serverOutput.close(); }", " /**", " * Get the default command arguments for booting the network server.", " */", " public static String[] getDefaultStartupArgs()", " {", " TestConfiguration config = TestConfiguration.getCurrent();", " ", " return new String[] {", " \"start\",", " \"-h\",", " config.getHostName(),", " \"-p\",", " Integer.toString(config.getPort())", " };", " }", " ", " " ], "header": "@@ -130,22 +230,31 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [ " serverOutput.close();", " ", " /** Wait maximum 1 minute for server to start */", " private static final int WAIT_TIME = 60000;", " ", " /** Sleep for 50 ms before pinging the network server (again) */", " private static final int SLEEP_TIME = 50;", " ", " " ] }, { "added": [ " /**", " * Set the number of milliseconds to wait before declaring server startup", " * a failure.", " * ", " */", " public static void setWaitTime( long newWaitTime )", " {", " waitTime = newWaitTime;", " }", " " ], "header": "@@ -172,6 +281,16 @@ final public class NetworkServerTestSetup extends TestSetup {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java", "hunks": [ { "added": [ " /**", " * Return the name of the default policy.", " */", " public static String getDefaultPolicy()", " {", " return \"org/apache/derbyTesting/functionTests/util/derby_tests.policy\";", " }", "" ], "header": "@@ -119,6 +119,14 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " public final static int DEFAULT_PORT = 1527;", " public final static String DEFAULT_HOSTNAME = \"localhost\";" ], "header": "@@ -66,9 +66,9 @@ public class TestConfiguration {", "removed": [ " private final static int DEFAULT_PORT = 1527;", " private final static String DEFAULT_HOSTNAME = \"localhost\";" ] } ] } ]
derby-DERBY-2197-ebb21c44
DERBY-2197 - minor javadoc fixes to problems caused by removing of interfaces with previous checkin (496960). git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497536 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/store/raw/Page.java", "hunks": [ { "added": [ " <P>" ], "header": "@@ -37,7 +37,7 @@ import org.apache.derby.iapi.types.DataValueDescriptor;", "removed": [ " <P>" ] }, { "added": [ "\t<LI> Not using a handle after a deleteAtSlot()." ], "header": "@@ -53,7 +53,7 @@ import org.apache.derby.iapi.types.DataValueDescriptor;", "removed": [ "\t<LI> Not using a handle after a delete()." ] }, { "added": [], "header": "@@ -762,12 +762,6 @@ public interface Page", "removed": [ "\t/**", "\t\tMark the record identified by slot as deleted or undeleted according to the", "\t\tdelete flag.", "", "", "\t*/" ] }, { "added": [], "header": "@@ -803,7 +797,6 @@ public interface Page", "removed": [ " * @see Page#delete" ] }, { "added": [], "header": "@@ -958,7 +951,6 @@ public interface Page", "removed": [ "\t\t@see Page#update" ] } ] } ]
derby-DERBY-2200-c3bf4ea6
DERBY-2200: Add performance tests to Derby using the junit perf framework This patch (derby2200.p1.diff.txt) adds -- few simple performance tests using the junit perf framework. -- small addition to the reporting in JDBCPerfTestCase to indicate the framework the test is running in. Patch contributed by Sunitha Kambhampati. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@491786 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2201-638f1b48
DERBY-2201: Allow scalar functions to return LOBs. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@745202 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/types/BitDataValue.java", "hunks": [ { "added": [ "import java.sql.Blob;", "" ], "header": "@@ -21,6 +21,8 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataValueFactory.java", "hunks": [ { "added": [ "import java.sql.Blob;", "import java.sql.Clob;" ], "header": "@@ -25,6 +25,8 @@ import org.apache.derby.iapi.types.RowLocation;", "removed": [] }, { "added": [ "", " /**", " * Get a SQL Blob with the given value. A null argument means", " * get a SQL null value. Uses the previous value (if", " * non-null) to hold the return value.", " *", " * @exception StandardException Thrown on error", " */", " BitDataValue getBlobDataValue(Blob value,", " BitDataValue previous)", " throws StandardException;" ], "header": "@@ -144,6 +146,17 @@ public interface DataValueFactory", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java", "hunks": [ { "added": [ "import java.sql.Blob;", "import java.sql.Clob;", "import java.sql.SQLException;" ], "header": "@@ -54,7 +54,10 @@ import org.apache.derby.iapi.reference.Attribute;", "removed": [] }, { "added": [ " public BitDataValue getBlobDataValue(Blob value, BitDataValue previous)", " throws StandardException", " {", " if (previous == null) { return new SQLBlob(value); }", " previous.setValue(value);", " return previous;", " }", "" ], "header": "@@ -469,6 +472,14 @@ abstract class DataValueFactoryImpl implements DataValueFactory, ModuleControl", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLBinary.java", "hunks": [ { "added": [ "import java.sql.Blob;" ], "header": "@@ -49,6 +49,7 @@ import java.io.ObjectInput;", "removed": [] }, { "added": [ "\t /*", "\t * value as a blob", "\t */", " Blob _blobValue;", " " ], "header": "@@ -119,6 +120,11 @@ abstract class SQLBinary", "removed": [] }, { "added": [ "\tSQLBinary(Blob val)", "\t{", "\t\tsetValue( val );", "\t}", "", " ", " _blobValue = null;", "\t\tstream = null;", "\t\tstreamValueLength = -1;", "\t}", "", "\tpublic final void setValue(Blob theValue)", "\t{", "\t\tdataValue = null;", " _blobValue = theValue;" ], "header": "@@ -154,10 +160,25 @@ abstract class SQLBinary", "removed": [] }, { "added": [ "\tpublic final InputStream\tgetStream() throws StandardException" ], "header": "@@ -188,7 +209,7 @@ abstract class SQLBinary", "removed": [ "\tpublic final InputStream\tgetStream()" ] }, { "added": [ "\t\t\tif ((dataValue == null) && (_blobValue != null) )", " {", " dataValue = _blobValue.getBytes( 1L, getBlobLength() );", " ", " _blobValue = null;", " \t\t\t\tstream = null;", "\t\t\t\tstreamValueLength = -1;", " }", "\t\t\telse if ((dataValue == null) && (stream != null) )", " {", " _blobValue = null;" ], "header": "@@ -206,14 +227,23 @@ abstract class SQLBinary", "removed": [ "\t\t\tif ((dataValue == null) && (stream != null)) {", " " ] }, { "added": [ "\t\tcatch (SQLException se) { throw StandardException.plainWrapException( se ); }", "", " /**", " * Return a JDBC Blob. Only implemented to support DERBY-2201.", " */", " public Object getObject()", " throws StandardException", " {", " // the generated code for the DERBY-2201 codepath expects to get a Blob", " // back.", "", " if ( _blobValue != null ) { return _blobValue; }", " else { return super.getObject(); }", " }", " " ], "header": "@@ -223,9 +253,24 @@ abstract class SQLBinary", "removed": [] }, { "added": [ " if ( _blobValue != null ) { return getBlobLength(); }", "\t\telse if (stream != null) {" ], "header": "@@ -233,7 +278,8 @@ abstract class SQLBinary", "removed": [ "\t\tif (stream != null) {" ] }, { "added": [ "\t\treturn (dataValue == null) && (stream == null) && (_blobValue == null);" ], "header": "@@ -284,7 +330,7 @@ abstract class SQLBinary", "removed": [ "\t\treturn (dataValue == null) && (stream == null);" ] }, { "added": [ " if ( _blobValue != null )", " {", " writeBlob( out );", " return;", " }", " int len = dataValue.length;", "", " writeLength( out, len );", "\t\tout.write(dataValue, 0, dataValue.length);", "\t}", "", "\t/** ", "\t\tSerialize a blob using the 8.1 encoding. Not called if null.", "\t * @exception IOException\t\tio exception", "\t */", "\tprivate void writeBlob(ObjectOutput out) throws IOException", "\t{", " try {", " int len = getBlobLength();", " InputStream is = _blobValue.getBinaryStream();", " ", " writeLength( out, len );", "", " for ( int i = 0; i < len; i++ )", " {", " out.write( is.read() );", " }", " }", " catch (StandardException se) { throw new IOException( se.getMessage() ); }", " catch (SQLException se) { throw new IOException( se.getMessage() ); }", " }", " ", "\t/** ", "\t\tWrite the length if", "\t\tusing the 8.1 encoding.", "", "\t * @exception IOException\t\tio exception", "\t */", " private void writeLength( ObjectOutput out, int len ) throws IOException", " {" ], "header": "@@ -295,8 +341,47 @@ abstract class SQLBinary", "removed": [ "\t\tint len = dataValue.length;" ] }, { "added": [ " }" ], "header": "@@ -312,8 +397,7 @@ abstract class SQLBinary", "removed": [ "\t\tout.write(dataValue, 0, dataValue.length);", "\t}" ] }, { "added": [ " _blobValue = null;" ], "header": "@@ -327,6 +411,7 @@ abstract class SQLBinary", "removed": [] }, { "added": [ " _blobValue = null;" ], "header": "@@ -347,6 +432,7 @@ abstract class SQLBinary", "removed": [] }, { "added": [ " _blobValue = null;" ], "header": "@@ -451,6 +537,7 @@ abstract class SQLBinary", "removed": [] }, { "added": [ " if ( _blobValue != null )", " {", " SQLBinary self = (SQLBinary) getNewNull();", " self.setValue(_blobValue);", " return self;", " }", "\t\tif (stream == null) { return getClone(); }", " " ], "header": "@@ -532,8 +619,14 @@ abstract class SQLBinary", "removed": [ "\t\tif (stream == null)", "\t\t\treturn getClone();" ] }, { "added": [ " _blobValue = null;" ], "header": "@@ -582,6 +675,7 @@ abstract class SQLBinary", "removed": [] }, { "added": [ " _blobValue = null;" ], "header": "@@ -613,6 +707,7 @@ abstract class SQLBinary", "removed": [] }, { "added": [ " _blobValue = theValueBinary._blobValue;" ], "header": "@@ -623,6 +718,7 @@ abstract class SQLBinary", "removed": [] }, { "added": [ " if ( _blobValue != null ) { variableLength = -1; }", "\t\telse if (stream == null)" ], "header": "@@ -1027,7 +1123,8 @@ abstract class SQLBinary", "removed": [ "\t\tif (stream == null)" ] }, { "added": [ "\t\t\tif ((stream == null) && (_blobValue == null) )" ], "header": "@@ -1052,7 +1149,7 @@ abstract class SQLBinary", "removed": [ "\t\t\tif (stream == null)" ] }, { "added": [ "\t\t\t\t\t\t\"value is null, stream or blob is not null\");" ], "header": "@@ -1060,7 +1157,7 @@ abstract class SQLBinary", "removed": [ "\t\t\t\t\t\t\"value is null, stream is not null\");" ] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLChar.java", "hunks": [ { "added": [ "import java.io.Reader;", "import java.sql.Clob;" ], "header": "@@ -62,6 +62,8 @@ import java.io.ObjectInput;", "removed": [] }, { "added": [ "The state may be in char[], a String, a Clob, or an unread stream, depending" ], "header": "@@ -83,7 +85,7 @@ The SQLChar represents a CHAR value with UCS_BASIC collation.", "removed": [ "The state may be in char[], a String, or an unread stream, depending" ] }, { "added": [ " /**", " * The value as a user-created Clob", " */", " protected Clob _clobValue;", " " ], "header": "@@ -177,6 +179,11 @@ public class SQLChar", "removed": [] }, { "added": [ " public SQLChar(Clob val)", " {", " setValue( val );", " }", "" ], "header": "@@ -203,6 +210,11 @@ public class SQLChar", "removed": [] }, { "added": [ " _clobValue = null;" ], "header": "@@ -533,6 +545,7 @@ public class SQLChar", "removed": [] }, { "added": [ " if ( _clobValue != null ) { return _clobValue; }", " else { return getString(); }" ], "header": "@@ -546,7 +559,8 @@ public class SQLChar", "removed": [ " return getString();" ] }, { "added": [ " if ( _clobValue != null ) { return getClobLength(); }" ], "header": "@@ -585,6 +599,7 @@ public class SQLChar", "removed": [] }, { "added": [ " } else if (_clobValue != null) {", "", " try {", " value = _clobValue.getSubString( 1L, getClobLength() );", " _clobValue = null;", " }", " catch (SQLException se) { throw StandardException.plainWrapException( se ); }", " " ], "header": "@@ -665,6 +680,14 @@ public class SQLChar", "removed": [] }, { "added": [ " return ((value == null) && (rawLength == -1) && (stream == null) && (_clobValue == null));" ], "header": "@@ -750,7 +773,7 @@ public class SQLChar", "removed": [ " return ((value == null) && (rawLength == -1) && (stream == null));" ] }, { "added": [ " //", " // This handles the case that a CHAR or VARCHAR value was populated from", " // a user Clob.", " //", " if ( _clobValue != null )", " {", " writeClobUTF( out );", " return;", " }", " " ], "header": "@@ -809,6 +832,16 @@ public class SQLChar", "removed": [] }, { "added": [ " writeUTF(out, strlen, isRaw, null );" ], "header": "@@ -851,7 +884,7 @@ public class SQLChar", "removed": [ " writeUTF(out, strlen, isRaw);" ] }, { "added": [ " * @param characterReader Reader from _clobValue if it exists", " final boolean isRaw, Reader characterReader)" ], "header": "@@ -862,10 +895,11 @@ public class SQLChar", "removed": [ " final boolean isRaw)" ] }, { "added": [ " int c;", "", " if ( characterReader != null ) { c = characterReader.read(); }", " else { c = isRaw ? data[i] : lvalue.charAt(i); }", " " ], "header": "@@ -873,7 +907,11 @@ public class SQLChar", "removed": [ " int c = isRaw ? data[i] : lvalue.charAt(i);" ] }, { "added": [ "", " boolean isUserClob = ( _clobValue != null );", "", " try {", "", " boolean isRaw = rawLength >= 0;", " // Assume isRaw, update afterwards if required.", " int strLen = rawLength;", " if (!isRaw) {", " if ( isUserClob ) { strLen = rawGetClobLength(); }", " else { strLen = value.length(); }", " }", " // Generate the header and invoke the encoding routine.", " StreamHeaderGenerator header = getStreamHeaderGenerator();", " int toEncodeLen = header.expectsCharCount() ? strLen : -1;", " header.generateInto(out, toEncodeLen);", "", " Reader characterReader = null;", " if ( isUserClob ) { characterReader = _clobValue.getCharacterStream(); }", " ", " writeUTF(out, strLen, isRaw, characterReader );", " header.writeEOF(out, toEncodeLen);", " ", " if ( isUserClob ) { characterReader.close(); }", " }", " catch (SQLException se)", " {", " IOException ioe = new IOException( se.getMessage() );", " ioe.initCause( se );", "", " throw ioe;" ], "header": "@@ -904,18 +942,38 @@ public class SQLChar", "removed": [ " boolean isRaw = rawLength >= 0;", " // Assume isRaw, update afterwards if required.", " int strLen = rawLength;", " if (!isRaw) {", " strLen = value.length();", " // Generate the header and invoke the encoding routine.", " StreamHeaderGenerator header = getStreamHeaderGenerator();", " int toEncodeLen = header.expectsCharCount() ? strLen : -1;", " header.generateInto(out, toEncodeLen);", " writeUTF(out, strLen, isRaw);", " header.writeEOF(out, toEncodeLen);" ] }, { "added": [ " if ((stream == null) && (_clobValue == null)) { return getClone(); }", " ", "" ], "header": "@@ -1268,10 +1326,11 @@ readingLoop:", "removed": [ " if (stream == null)", " return getClone();" ] }, { "added": [ " public void setValue(Clob theValue)", " {", " stream = null;", " rawLength = -1;", " cKey = null;", " value = null;", "", " _clobValue = theValue;", " }", "", " _clobValue = null;" ], "header": "@@ -1343,11 +1402,22 @@ readingLoop:", "removed": [] }, { "added": [ " if ( theValue instanceof SQLChar )", " {", " SQLChar that = (SQLChar) theValue;", "", " if ( that._clobValue != null )", " {", " setValue( that._clobValue );", " return;", " }", " }" ], "header": "@@ -1585,6 +1655,16 @@ readingLoop:", "removed": [] }, { "added": [ " if ( (_clobValue == null ) && (getString() == null) )" ], "header": "@@ -1719,7 +1799,7 @@ readingLoop:", "removed": [ " if (getString() == null)" ] }, { "added": [ " this._clobValue = other._clobValue;" ], "header": "@@ -2929,6 +3009,7 @@ readingLoop:", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLClob.java", "hunks": [ { "added": [ "\tpublic SQLClob(Clob val)", "\t{", "\t\tsuper(val);", "\t}", "" ], "header": "@@ -160,6 +160,11 @@ public class SQLClob", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/SQLVarchar.java", "hunks": [ { "added": [ "import java.sql.Clob;" ], "header": "@@ -21,6 +21,7 @@", "removed": [] } ] }, { "file": "java/engine/org/apache/derby/iapi/types/StringDataValue.java", "hunks": [ { "added": [ "import java.sql.Clob;", "" ], "header": "@@ -21,6 +21,8 @@", "removed": [] } ] }, { "file": "java/testing/org/apache/derbyTesting/unitTests/store/T_Recovery.java", "hunks": [ { "added": [ "\t\t\tDataValueDescriptor col0 = new SQLChar((String)null);", "\t\t\tDataValueDescriptor col3 = new SQLChar((String)null);" ], "header": "@@ -742,10 +742,10 @@ public class T_Recovery extends T_Generic {", "removed": [ "\t\t\tDataValueDescriptor col0 = new SQLChar(null);", "\t\t\tDataValueDescriptor col3 = new SQLChar(null);" ] } ] } ]
derby-DERBY-2207-5990b20b
DERBY-3073 SQL roles: add parser support Patch DERBY-3073-part4, which: - lifts restriction on role names to 30 chars; it is now 128 as for other identifiers, cf. discussion with Dan in DERBY-2207. - reserves the SYS prefix on role names RolesTest is updated with modified/new tests for this. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@630124 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2213-21a3353d
DERBY-2213 (partial) Add a set of utilities in junit.Derby that allows test code to determine which Derby functionality is available, so that tests can exclude themselves if they require tools, engine, client and/or server. Allows the junit tests to be setup so that they be run with different classpaths that are a subset of the full set of jars. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@492822 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java", "hunks": [ { "added": [ " URL junit = getURL(junit.framework.Test.class);", " if (junit != null)", " classPathSet.setProperty(\"derbyTesting.junit\", junit.toExternalForm());", " // Load indirectly so we don't need ant-junit.jar at compile time.", " URL antjunit = getURL(\"org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner\");", " if (antjunit != null)", " classPathSet.setProperty(\"derbyTesting.antjunit\", antjunit.toExternalForm());", "" ], "header": "@@ -236,21 +236,15 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [ " URL junit = null;", " junit = getURL(junit.framework.Test.class);", " classPathSet.setProperty(\"derbyTesting.junit\", junit == null ? \"\" : junit.toString());", " URL antjunit = null;", " Class antjunitclass = null;", " try {", " \t// Load indirectly so we don't need ant-junit.jar at compile time.", " antjunitclass = Class.forName(\"org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner\");", " antjunit = getURL(antjunitclass);", " classPathSet.setProperty(\"derbyTesting.antjunit\", antjunit == null ? \"\" : antjunit.toString());", " } catch (java.lang.ClassNotFoundException e) {", " \t// Not running in Ant, do nothing.", " antjunit = null;", " }" ] }, { "added": [ "\t\tURL derby = getURL(\"org.apache.derby.jdbc.EmbeddedSimpleDataSource\");", " if (derby != null)", "\t\t classPathSet.setProperty(\"derbyTesting.codejar\", stripJar(derby));", "\t\tURL client = getURL(\"org.apache.derby.jdbc.ClientDataSource\");", "\t\tif (client != null)", "\t\t classPathSet.setProperty(\"derbyTesting.clientjar\", stripJar(client));" ], "header": "@@ -279,22 +273,13 @@ public final class SecurityManagerSetup extends TestSetup {", "removed": [ "\t\tURL derby = null;", "\t\ttry {", "\t\t\tderby = getURL(org.apache.derby.jdbc.EmbeddedSimpleDataSource.class);", "\t\t} catch (java.lang.NoClassDefFoundError e) {", "\t\t\tderby = testing;", "\t\t}\t\t", "\t\tclassPathSet.setProperty(\"derbyTesting.codejar\", stripJar(derby));", "\t\tURL client = null;", "\t\ttry {", "\t\t\tclient = getURL(org.apache.derby.jdbc.ClientDataSource.class);", "\t\t} catch (java.lang.NoClassDefFoundError e) {", "\t\t\tclient = derby;", "\t\t}", "\t\t", "\t\tclassPathSet.setProperty(\"derbyTesting.clientjar\", stripJar(client));" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " // Need to have network server and client and not", " // running in J2ME (JSR169).", " if (!(Derby.hasClient() && Derby.hasServer())", " || JDBC.vmSupportsJSR169())", " return new TestSuite(\"empty: no network server support\");" ], "header": "@@ -250,8 +250,11 @@ public class TestConfiguration {", "removed": [ " if (JDBC.vmSupportsJSR169())", " return new TestSuite();" ] } ] } ]
derby-DERBY-2213-ea8303d4
DERBY-2213 Change RoutineTest and TimeHandlingTest not to depend on derbytools.jar. Ensure IJRunScriptTest runs only if derbytools.jar is present. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@494951 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2215-a1af992b
DERBY-2215 Change ChangeConfigurationSetup to be an abstract class that allows subclasses to generate the new TestConfiguration operation at setUp time. Create three sub-classes to handle changing the database name, changing the connection handling and switching to a client server configuration. This ensures that nested changing of configurations works correctly by creating new configurations based upon the current at the time of setUp. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@493180 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/ChangeUserSetup.java", "hunks": [ { "added": [ "final class ChangeUserSetup extends ChangeConfigurationSetup {" ], "header": "@@ -28,11 +28,10 @@ import junit.framework.Test;", "removed": [ "final class ChangeUserSetup extends TestSetup {", " private TestConfiguration old;" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/DatabaseChangeSetup.java", "hunks": [ { "added": [ " * Derby - Class org.apache.derbyTesting.junit.DatabaseChangeSetup" ], "header": "@@ -1,6 +1,6 @@", "removed": [ " * Derby - Class org.apache.derbyTesting.junit.ChangeConfigurationSetup" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/ServerSetup.java", "hunks": [ { "added": [ " * Derby - Class org.apache.derbyTesting.junit.ServerSetup" ], "header": "@@ -1,6 +1,6 @@", "removed": [ " * Derby - Class org.apache.derbyTesting.junit.ChangeConfigurationSetup" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java", "hunks": [ { "added": [ " return new ServerSetup(test, DEFAULT_HOSTNAME, DEFAULT_PORT);" ], "header": "@@ -255,17 +255,10 @@ public class TestConfiguration {", "removed": [ " ", " TestConfiguration config = TestConfiguration.getCurrent();", " ", " TestConfiguration derbyClientConfig =", " new TestConfiguration(config, JDBCClient.DERBYNETCLIENT,", " DEFAULT_HOSTNAME, DEFAULT_PORT);", " return new ChangeConfigurationSetup(derbyClientConfig, test);", "" ] }, { "added": [], "header": "@@ -280,8 +273,6 @@ public class TestConfiguration {", "removed": [ " TestConfiguration config = TestConfiguration.getCurrent();", "" ] }, { "added": [ "", " return new DatabaseChangeSetup(new DropDatabaseSetup(test), dbName);" ], "header": "@@ -291,10 +282,8 @@ public class TestConfiguration {", "removed": [ " TestConfiguration newDBconfig = ", " new TestConfiguration(config, dbName);", " return new ChangeConfigurationSetup(newDBconfig,", " new DropDatabaseSetup(test));" ] }, { "added": [ " { " ], "header": "@@ -332,11 +321,7 @@ public class TestConfiguration {", "removed": [ " {", " TestConfiguration config = TestConfiguration.getCurrent();", " TestConfiguration newDBconfig = ", " new TestConfiguration(config, DEFAULT_DBNAME_SQL);", " " ] }, { "added": [ " return new DatabaseChangeSetup(setSQLAuthMode, DEFAULT_DBNAME_SQL);" ], "header": "@@ -348,7 +333,7 @@ public class TestConfiguration {", "removed": [ " return new ChangeConfigurationSetup(newDBconfig, setSQLAuthMode);" ] }, { "added": [ " return new ConnectorSetup(test,", " \"org.apache.derbyTesting.junit.XADataSourceConnector\");" ], "header": "@@ -364,22 +349,8 @@ public class TestConfiguration {", "removed": [ " // Copy the current configuration by creating one", " // with the same database name", " TestConfiguration config = TestConfiguration.getCurrent();", " TestConfiguration newConfig = ", " new TestConfiguration(config, config.getDatabaseName());", " ", " try {", " newConfig.connector = (Connector) Class.forName(", " \"org.apache.derbyTesting.junit.XADataSourceConnector\").newInstance();", " } catch (Exception e) {", " Assert.fail(e.getMessage());", " }", " ", " newConfig.connector.setConfiguration(newConfig);", " ", " return new ChangeConfigurationSetup(newConfig, test);" ] }, { "added": [ " TestConfiguration(TestConfiguration copy, JDBCClient client," ], "header": "@@ -399,7 +370,7 @@ public class TestConfiguration {", "removed": [ " private TestConfiguration(TestConfiguration copy, JDBCClient client," ] }, { "added": [ " Connector connector;" ], "header": "@@ -787,7 +758,7 @@ public class TestConfiguration {", "removed": [ " private Connector connector;" ] } ] } ]
derby-DERBY-2220-09b38be4
DERBY-2220: Uncommitted transactions executed through XAResource will hold locks after the application terminates (or crashes during the transaction). Abort the global transaction on a derby server when the network socket is closed. Patch contributed by Julius Stroffek. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@517131 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/drda/org/apache/derby/impl/drda/DRDAXAProtocol.java", "hunks": [ { "added": [ " /** Holds the Xid of the global transaction associated with", " * the corresponding DRDAConnThread (and connection itself). */", " private Xid xid;" ], "header": "@@ -37,6 +37,9 @@ class DRDAXAProtocol {", "removed": [] }, { "added": [ " xid = null;" ], "header": "@@ -44,7 +47,7 @@ class DRDAXAProtocol {", "removed": [ "" ] }, { "added": [ "\t\t\t\trollbackTransaction(xid, true);" ], "header": "@@ -142,7 +145,7 @@ class DRDAXAProtocol {", "removed": [ "\t\t\t\trollbackTransaction(xid);" ] }, { "added": [ " this.xid = xid;" ], "header": "@@ -239,6 +242,7 @@ class DRDAXAProtocol {", "removed": [] }, { "added": [ "\t * Rollback transaction. Optionally send SYNCCRD response.", " * @param sendSYNCCRD Indicates whether the function should", " * send a SYNCCRD response", "\tprivate void rollbackTransaction(Xid xid, boolean sendSYNCCRD) throws DRDAProtocolException", "\t\t\trollbackLocalTransaction(sendSYNCCRD);", "\t\t\trollbackXATransaction(xid, sendSYNCCRD);", "\t * Rollback a local transaction. Optionally send SYNCCRD response.", " * @param sendSYNCCRD Indicates whether the function should", " * send a SYNCCRD response", "\t * @throws DRDAProtocolException", "\tprivate void rollbackLocalTransaction(boolean sendSYNCCRD) throws DRDAProtocolException" ], "header": "@@ -319,24 +323,29 @@ class DRDAXAProtocol {", "removed": [ "\t * Rollback transaction", "\tprivate void rollbackTransaction(Xid xid) throws DRDAProtocolException", "\t\t\trollbackLocalTransaction();", "\t\t\trollbackXATransaction(xid);", "\t * Rollback a local transaction", "\tprivate void rollbackLocalTransaction() throws DRDAProtocolException" ] }, { "added": [ " if (sendSYNCCRD) {", " writeSYNCCRD(CodePoint.SYNCTYPE_COMMITTED,", " xaRetVal, null);", " }", "\t * Rollback the xa transaction. Optionally send SYNCCRD response.", " * @param sendSYNCCRD Indicates whether the function should", " * send a SYNCCRD response", "\tprivate void rollbackXATransaction(Xid xid, boolean sendSYNCCRD) throws DRDAProtocolException" ], "header": "@@ -351,18 +360,21 @@ class DRDAXAProtocol {", "removed": [ "\t\twriteSYNCCRD(CodePoint.SYNCTYPE_COMMITTED, ", "\t\t\t\t\t xaRetVal, null);", "", "\t * Rollback the xa transaction. Send SYNCCRD response.", "\tprivate void rollbackXATransaction(Xid xid) throws DRDAProtocolException" ] }, { "added": [ " if (sendSYNCCRD) {", " writeSYNCCRD(CodePoint.SYNCTYPE_ROLLBACK,", " xaRetVal, null);", " }" ], "header": "@@ -377,9 +389,10 @@ class DRDAXAProtocol {", "removed": [ "\t\twriteSYNCCRD(CodePoint.SYNCTYPE_ROLLBACK,", "\t\t\t\t\t xaRetVal, null);", "\t\t" ] }, { "added": [ " xid = null;" ], "header": "@@ -396,6 +409,7 @@ class DRDAXAProtocol {", "removed": [] }, { "added": [ " /**", " * This function rollbacks the current global transaction associated", " * with the XAResource or a local transaction. The function should", " * be called only in exceptional cases - like client socket", " * is closed. */", " void rollbackCurrentTransaction()", " {", " if (xid != null) {", " boolean local = ( xid.getFormatId() == -1);", " try {", " // if the transaction is not local disassociate the transaction from", " // the connection first because the rollback can not be performed", " // on a transaction associated with the XAResource", " try {", " if (!local) {", " XAResource xaResource = getXAResource();", " // this will throw the XAException (because TMFAIL", " // will throw an exception)", " xaResource.end(xid, XAResource.TMFAIL);", " }", " } catch (XAException e) {", " // do not print out the exception generally thrown", " // when TMFAIL flag is present", " if (e.errorCode < XAException.XA_RBBASE", " || e.errorCode > XAException.XA_RBEND) {", " connThread.getServer().consoleExceptionPrint(e);", " }", " }", " rollbackTransaction(xid, false);", " } catch (DRDAProtocolException e) {", " // because we do not dump any DRDA stuff to the socket", " // the exception can not be thrown in this case", " // However, we will dump the exception to the console", " connThread.getServer().consoleExceptionPrint(e);", " }", " xid = null;", " }", " }", "}" ], "header": "@@ -658,15 +672,44 @@ class DRDAXAProtocol {", "removed": [ "}", "", "", "", "", "", "", "", "", "" ] } ] } ]
derby-DERBY-2222-7b5fc1ef
DERBY-2222: 'show indexes in SCHEMANAME' does not work with the client driver. Patch file: DERBY-2222-3.diff Patch contributed by Jørgen Løland. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@536100 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/ij/ijResult.java", "hunks": [ { "added": [ "import java.util.List;" ], "header": "@@ -28,6 +28,7 @@ import java.sql.PreparedStatement;", "removed": [] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java", "hunks": [ { "added": [ "import java.util.List;" ], "header": "@@ -28,6 +28,7 @@ import java.sql.Statement;", "removed": [] }, { "added": [ "\tpublic boolean isMultipleResultSetResult(){ return false; }", "\tpublic List getMultipleResultSets() { return null; }" ], "header": "@@ -42,12 +43,14 @@ abstract class ijResultImpl implements ijResult {", "removed": [] } ] }, { "file": "java/tools/org/apache/derby/impl/tools/ij/utilMain.java", "hunks": [ { "added": [ "import java.util.List;" ], "header": "@@ -33,6 +33,7 @@ import org.apache.derby.iapi.services.info.ProductGenusNames;", "removed": [] } ] }, { "file": "java/tools/org/apache/derby/tools/JDBCDisplayUtil.java", "hunks": [ { "added": [ "import java.util.ArrayList;", "import java.util.List;" ], "header": "@@ -39,6 +39,8 @@ import java.sql.Types;", "removed": [] }, { "added": [ " /**", " @param out the place to write to", " @param resultSets List of ResultSet to display", " @param conn the Connection against which the ResultSet was retrieved", " @param displayColumns Column numbers to display, or null if all", " @param displayColumnWidths Column widths, in characters, if displayColumns is specified.", "", " @exception SQLException on JDBC access failure", " */", " static public void DisplayMultipleResults(PrintWriter out, List resultSets,", " Connection conn,", " int[] displayColumns,", " int[] displayColumnWidths)", " throws SQLException", " {", " indent_DisplayResults( out, resultSets, conn, 0, displayColumns, ", " displayColumnWidths);", " }", " /**", " @param out the place to write to", " @param rs the ResultSet to display", " @param conn the Connection against which the ResultSet was retrieved", " @param displayColumns Column numbers to display, or null if all", " @param displayColumnWidths Column widths, in characters, if displayColumns is specified.", "", " @exception SQLException on JDBC access failure", " */" ], "header": "@@ -287,15 +289,34 @@ public class JDBCDisplayUtil {", "removed": [ "\t/**", "\t\t@param out the place to write to", "\t\t@param rs the ResultSet to display", "\t\t@param conn the Connection against which the ResultSet was retrieved", "\t @param displayColumns Column numbers to display, or null if all", "\t @param displayColumnWidths Column widths, in characters, if displayColumns is specified.", "\t\t@exception SQLException on JDBC access failure", "\t */" ] }, { "added": [ " static private void indent_DisplayResults", " (PrintWriter out, ResultSet rs, Connection conn, int indentLevel, ", " int[] displayColumns, int[] displayColumnWidths)", " throws SQLException {", " List resultSets = new ArrayList();", " resultSets.add(rs);", " indent_DisplayResults( out, resultSets, conn, 0, displayColumns, ", " displayColumnWidths);", " }", " static private void indent_DisplayResults", " (PrintWriter out, List resultSets, Connection conn, int indentLevel, ", " int[] displayColumns, int[] displayColumnWidths)", " throws SQLException {", " ResultSetMetaData rsmd = null;", " //get metadata from the first ResultSet", " if (resultSets != null && resultSets.size() > 0)", "\t\t\trsmd = ((ResultSet)resultSets.get(0)).getMetaData();", " ", " checkNotNull(rsmd, \"ResultSetMetaData\");", " Vector nestedResults;", " int numberOfRowsSelected = 0;", "", " // autocommit must be off or the nested cursors", " // are closed when the outer statement completes.", " if (!conn.getAutoCommit())", " nestedResults = new Vector();", " else", " nestedResults = null;", "", " if(displayColumnWidths == null)", " displayColumnWidths = getColumnDisplayWidths(rsmd,", "\t\t\t\t\t\t\t\t\t\t\t\t\t\t displayColumns,true);", "", " int len = indent_DisplayBanner(out,rsmd, indentLevel, displayColumns,", " displayColumnWidths);", "", " // When displaying rows, keep going past errors", " // unless/until the maximum # of errors is reached.", " int retry = 0;", "", " ResultSet rs = null;", " boolean doNext = true;", " for (int i = 0; i< resultSets.size(); i++) {", " rs = (ResultSet)resultSets.get(i);", " doNext = true;", " while (doNext){", " try {", " doNext = rs.next();", " if (doNext) {", " ", " DisplayRow(out, rs, rsmd, len, nestedResults, conn, ", " indentLevel, displayColumns, ", " displayColumnWidths);", " ShowWarnings(out, rs);", " numberOfRowsSelected++;", " }", " } catch (SQLException e) {", " // REVISIT: might want to check the exception", " // and for some, not bother with the retry.", " if (++retry > MAX_RETRIES)", " throw e;", " else", " ShowSQLException(out, e);", " }", " }", " }", " if (showSelectCount == true) {", " if (numberOfRowsSelected == 1) {", " out.println();", " indentedPrintLine( out, indentLevel, LocalizedResource.getMessage(\"UT_1RowSelec\"));", " } else if (numberOfRowsSelected >= 0) {", " out.println();", " indentedPrintLine( out, indentLevel, ", " LocalizedResource.getMessage(\"UT_0RowsSelec\", LocalizedResource.getNumber(numberOfRowsSelected)));", " }", " }", "", " DisplayNestedResults(out, nestedResults, conn, indentLevel );", " nestedResults = null;", " }" ], "header": "@@ -304,66 +325,90 @@ public class JDBCDisplayUtil {", "removed": [ "\tstatic private void indent_DisplayResults", "\t(PrintWriter out, ResultSet rs, Connection conn, int indentLevel, ", "\t int[] displayColumns, int[] displayColumnWidths)", "\t\tthrows SQLException {", "\t\tResultSetMetaData rsmd = rs.getMetaData();", "\t\tcheckNotNull(rsmd, \"ResultSetMetaData\");", "\t\tVector nestedResults;", " int numberOfRowsSelected = 0;", "", "\t\t// autocommit must be off or the nested cursors", "\t\t// are closed when the outer statement completes.", "\t\tif (!conn.getAutoCommit())", "\t\t\tnestedResults = new Vector();", "\t\telse", "\t\t\tnestedResults = null;", "\t\tif(displayColumnWidths == null)", "\t\t\tdisplayColumnWidths = getColumnDisplayWidths(rsmd, displayColumns,true);", "\t\t", "\t\tint len = indent_DisplayBanner(out,rsmd, indentLevel, displayColumns,", "\t\t\t\t\t\t\t\t\t displayColumnWidths);", "\t\t// When displaying rows, keep going past errors", "\t\t// unless/until the maximum # of errors is reached.", "\t\tboolean doNext = true;", "\t\tint retry = 0;", "\t\twhile (doNext) {", "\t\t\ttry {", "\t\t\t\tdoNext = rs.next();", "\t\t\t\tif (doNext) {", "\t\t \t\tDisplayRow(out, rs, rsmd, len, nestedResults, conn, ", "\t\t\t\t\t\t\t indentLevel, displayColumns, ", "\t\t\t\t\t\t\t displayColumnWidths);", "\t\t\t\t\tShowWarnings(out, rs);", "\t\t\t\t\tnumberOfRowsSelected++;", "\t\t\t\t}", "\t\t\t} catch (SQLException e) {", "\t\t\t\t// REVISIT: might want to check the exception", "\t\t\t\t// and for some, not bother with the retry.", "\t\t\t\tif (++retry > MAX_RETRIES)", "\t\t\t\t\tthrow e;", "\t\t\t\telse", "\t\t\t\t\tShowSQLException(out, e);", "\t\t\t}", "\t\t}", "\t\tif (showSelectCount == true) {", "\t\t if (numberOfRowsSelected == 1) {", "\t\t\t out.println();", "\t\t\t indentedPrintLine( out, indentLevel, LocalizedResource.getMessage(\"UT_1RowSelec\"));", "\t\t } else if (numberOfRowsSelected >= 0) {", "\t\t\t out.println();", "\t\t indentedPrintLine( out, indentLevel, ", "\t\t\tLocalizedResource.getMessage(\"UT_0RowsSelec\", LocalizedResource.getNumber(numberOfRowsSelected)));", "\t\t }", "\t\t}", "\t\tDisplayNestedResults(out, nestedResults, conn, indentLevel );", "\t\tnestedResults = null;", "\t}" ] } ] } ]
derby-DERBY-2222-e5ca925a
DERBY-2222: JavaDoc/formatting fixes. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@536111 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/tools/JDBCDisplayUtil.java", "hunks": [ { "added": [ " @param resultSets list of <code>ResultSet</code>s to display", " @param conn the connection against which the <code>ResultSet</code>s", " were retrieved", " @param displayColumns column numbers to display, <code>null</code> if all", " @param displayColumnWidths column widths, in characters, if", " <code>displayColumns</code> is specified" ], "header": "@@ -291,10 +291,12 @@ public class JDBCDisplayUtil {", "removed": [ " @param resultSets List of ResultSet to display", " @param conn the Connection against which the ResultSet was retrieved", " @param displayColumns Column numbers to display, or null if all", " @param displayColumnWidths Column widths, in characters, if displayColumns is specified." ] }, { "added": [ " indent_DisplayResults( out, resultSets, conn, 0, displayColumns,", " @param rs the <code>ResultSet</code> to display", " @param conn the connection against which the <code>ResultSet</code>", " was retrieved", " @param displayColumns column numbers to display, <code>null</code> if all", " @param displayColumnWidths column widths, in characters, if", " <code>displayColumns</code> is specified" ], "header": "@@ -304,16 +306,18 @@ public class JDBCDisplayUtil {", "removed": [ " indent_DisplayResults( out, resultSets, conn, 0, displayColumns, ", " @param rs the ResultSet to display", " @param conn the Connection against which the ResultSet was retrieved", " @param displayColumns Column numbers to display, or null if all", " @param displayColumnWidths Column widths, in characters, if displayColumns is specified." ] }, { "added": [ " (PrintWriter out, ResultSet rs, Connection conn, int indentLevel," ], "header": "@@ -326,7 +330,7 @@ public class JDBCDisplayUtil {", "removed": [ " (PrintWriter out, ResultSet rs, Connection conn, int indentLevel, " ] }, { "added": [ " (PrintWriter out, List resultSets, Connection conn, int indentLevel," ], "header": "@@ -336,7 +340,7 @@ public class JDBCDisplayUtil {", "removed": [ " (PrintWriter out, List resultSets, Connection conn, int indentLevel, " ] }, { "added": [ " rsmd = ((ResultSet)resultSets.get(0)).getMetaData();", "" ], "header": "@@ -344,8 +348,8 @@ public class JDBCDisplayUtil {", "removed": [ "\t\t\trsmd = ((ResultSet)resultSets.get(0)).getMetaData();", " " ] }, { "added": [ " displayColumns,true);" ], "header": "@@ -359,7 +363,7 @@ public class JDBCDisplayUtil {", "removed": [ "\t\t\t\t\t\t\t\t\t\t\t\t\t\t displayColumns,true);" ] }, { "added": [ "", " DisplayRow(out, rs, rsmd, len, nestedResults, conn,", " indentLevel, displayColumns," ], "header": "@@ -377,9 +381,9 @@ public class JDBCDisplayUtil {", "removed": [ " ", " DisplayRow(out, rs, rsmd, len, nestedResults, conn, ", " indentLevel, displayColumns, " ] }, { "added": [ " indentedPrintLine(out, indentLevel,", " LocalizedResource.getMessage(\"UT_1RowSelec\"));", " indentedPrintLine(out, indentLevel,", " LocalizedResource.getMessage(\"UT_0RowsSelec\",", " LocalizedResource.getNumber(numberOfRowsSelected)));" ], "header": "@@ -397,11 +401,13 @@ public class JDBCDisplayUtil {", "removed": [ " indentedPrintLine( out, indentLevel, LocalizedResource.getMessage(\"UT_1RowSelec\"));", " indentedPrintLine( out, indentLevel, ", " LocalizedResource.getMessage(\"UT_0RowsSelec\", LocalizedResource.getNumber(numberOfRowsSelected)));" ] } ] } ]
derby-DERBY-2224-0070f973
DERBY-2224 - update j9_foundation master/canons to weme 6.1 (J2ME 1.1) results - this change includes a change to ij because java.math.BigDecimal is now available, but JSR169 does not support methods like ResultSet.getBigDecimal(...). - this change also accepts incorrect behavior in timestampArith.java, which is covered in DERBY-2225. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497678 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java", "hunks": [ { "added": [ "import java.lang.reflect.*;", " * like J2ME/CDC/Foundation Profile 1.0, which do not have BigDecimal class, or", " * JSR169 Profile, which does not support method calls using BigDecimal (such ", " * as ResultSet.getBigDecimal(..).", " * " ], "header": "@@ -25,12 +25,16 @@ import java.sql.SQLException;", "removed": [ " * like J2ME/CDC/Foundation Profile, which do not have BigDecimal class. " ] } ] }, { "file": "java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java", "hunks": [ { "added": [ "import java.lang.reflect.Method;" ], "header": "@@ -23,6 +23,7 @@ package org.apache.derby.iapi.tools.i18n;", "removed": [] }, { "added": [ "\tprivate static final boolean SUPPORTS_BIG_DECIMAL_CALLS;", "\t\tboolean supportsBigDecimalCalls;", "\t\t\t// This class attempts to make a call to a ", "\t\t\t// ResultSet.getBigDecimal method, which may not be available.", "\t\t\t// For instance, java.math.BigDecimal is not available with", "\t\t\t// J2ME/CDC/Foundation 1.0 profile.", "\t\t\tsupportsBigDecimalCalls = true;", "\t\t\t// And no methods using BigDecimal are available with JSR169 spec.", "\t\t\tMethod getbd = ResultSet.class.getMethod(\"getBigDecimal\", new Class[] {int.class});", "\t\t\tsupportsBigDecimalCalls = true;", "\t\t\tsupportsBigDecimalCalls = false;", "\t\tSUPPORTS_BIG_DECIMAL_CALLS = supportsBigDecimalCalls;" ], "header": "@@ -45,17 +46,24 @@ import java.sql.Types;", "removed": [ "\tprivate static final boolean HAVE_BIG_DECIMAL;", "\t\tboolean haveBigDecimal;", "\t\t\thaveBigDecimal = true;", "\t\t\thaveBigDecimal = false;", "\t\tHAVE_BIG_DECIMAL = haveBigDecimal;" ] }, { "added": [ "\t\t\telse if (SUPPORTS_BIG_DECIMAL_CALLS && (type == Types.NUMERIC || type == Types.DECIMAL)) {" ], "header": "@@ -331,7 +339,7 @@ public final class LocalizedResource implements java.security.PrivilegedAction", "removed": [ "\t\t\telse if (HAVE_BIG_DECIMAL && (type == Types.NUMERIC || type == Types.DECIMAL)) {" ] } ] } ]
derby-DERBY-2224-e45787f7
DERBY-2224 - making old testharness support newer j2ME version git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@496847 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java", "hunks": [ { "added": [ " \ttestJVM = (jvmName.startsWith(\"j9_foundation\") ? \"foundation\" : \"j9\"); " ], "header": "@@ -687,7 +687,7 @@ public class RunList", "removed": [ " \ttestJVM = (jvmName.equals(\"j9_foundation\") ? \"foundation\" : \"j9\"); " ] }, { "added": [ "\t\t\telse if (j9config.equals(\"foun11\"))", "\t\t\t\tjvmName=\"j9_foundation11\";" ], "header": "@@ -712,6 +712,8 @@ public class RunList", "removed": [] }, { "added": [ " \ttestJVM = (jvmName.startsWith(\"j9_foundation\") ? \"foundation\" : \"j9\");" ], "header": "@@ -784,7 +786,7 @@ public class RunList", "removed": [ " \ttestJVM = (jvmName.equals(\"j9_foundation\") ? \"foundation\" : \"j9\");" ] } ] }, { "file": "java/testing/org/apache/derbyTesting/functionTests/harness/j9_foundation11.java", "hunks": [ { "added": [ "/*", "", " Derby - Class org.apache.derbyTesting.functionTests.harness.j9_foundation11", "", " Licensed to the Apache Software Foundation (ASF) under one or more", " contributor license agreements. See the NOTICE file distributed with", " this work for additional information regarding copyright ownership.", " The ASF licenses this file to You under the Apache License, Version 2.0", " (the \"License\"); you may not use this file except in compliance with", " the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", " Unless required by applicable law or agreed to in writing, software", " distributed under the License is distributed on an \"AS IS\" BASIS,", " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", " See the License for the specific language governing permissions and", " limitations under the License.", "", " */", "", "package org.apache.derbyTesting.functionTests.harness;", "import java.util.Vector;", "import java.util.StringTokenizer;", "import java.util.Properties;", "", "/**", " <p>This class is for IBM's J9 jdk 1.3., foundation class library; v 2.3 (weme6.1)", "", " */", "public class j9_foundation11 extends jvm {", "", " public String getName(){return \"j9_foundation11\";}", " public j9_foundation11(boolean noasyncgc, boolean verbosegc, boolean noclassgc,", " long ss, long oss, long ms, long mx, String classpath, String prof,", " boolean verify, boolean noverify, boolean nojit, Vector D) {", " super(noasyncgc,verbosegc,noclassgc,ss,oss,ms,mx,classpath,prof,", "\t\tverify,noverify,nojit,D);", " }", " // more typical use:", " public j9_foundation11(String classpath, Vector D) {", " super(classpath,D);", " }", " // more typical use:", " public j9_foundation11(long ms, long mx, String classpath, Vector D) {", " super(ms,mx,classpath,D);", " }", " // actual use", " public j9_foundation11() {", "\tProperties sp = System.getProperties();", "\tString srvJvm = sp.getProperty(\"serverJvm\");", "\tif ((srvJvm!=null) && (srvJvm.toUpperCase().startsWith(\"J9\")))", "\t{", "\t\tString wshome = guessWSHome();", "\t\t// note, may have to use separator instead of hardcoding the slashes...", "\t\tsetJavaCmd(wshome+\"/weme6.1/bin/j9\");", "\t}", "\telse", "\t\tsetJavaCmd(\"j9\");", " }", "", " // return the command line to invoke this VM. The caller then adds", " // the class and program arguments.", " public Vector getCommandLine() ", " {", " StringBuffer sb = new StringBuffer();", " Vector v = super.getCommandLine();", " appendOtherFlags(sb);", " String s = sb.toString();", " StringTokenizer st = new StringTokenizer(s);", " while (st.hasMoreTokens())", " {", " v.addElement(st.nextToken());", " }", " return v;", "\t}", "", " public void appendOtherFlags(StringBuffer sb)", " {", " Properties sp = System.getProperties();", " String bootcp = sp.getProperty(\"bootcp\");", " String srvJvm = sp.getProperty(\"serverJvm\");", " // if we're coming in to be the server jvm for networkserver testing on j9,", " // bootcp is null, so we need to try to setup the bootclasspath from scratch", " // for now, assume we're only interested in doing this for weme6.1_foundation, worry about", " // newer versions, multiple class libraries, or multiple releases later.", " sb.append(\" -jcl:foun11\");", "", " if ((srvJvm !=null ) && (srvJvm.toUpperCase().startsWith(\"J9\")))", " {", " String pathsep = System.getProperty(\"path.separator\");", " String wshome = guessWSHome();", " // note, assuming jclFoundation classes sit under weme6.1/lib/jclFoundation11", " // and that jdbc.jar sits under weme6.1/lib", " // note, may have to switch to sep instead of hardcoding the slashes...", " sb.append(\" -Xbootclasspath/a:\" + wshome + \"/weme6.1/lib/jclFoundation11/classes.zip\"", " + pathsep + wshome + \"/weme6.1/lib/jclFoundation11/locale.zip\"", " + pathsep + wshome + \"/weme6.1/lib/jdbc.jar\");", " } ", " else", " sb.append(\" -Xbootclasspath/a:\" + bootcp);", " if (noasyncgc) warn(\"j9_foundation does not support noasyncgc\");", " if (verbosegc) sb.append(\" -verbose:gc\");", " if (noclassgc) warn(\"j9_foundation does not support noclassgc\");", " if (ss>=0) warn(\"j9_foundation does not support ss\");", " if (oss>=0) warn(\"j9_foundation does not support oss\");", " if (ms>=0) {", " sb.append(\" -Xss\");", " sb.append(ms);", "\t\t //sb.append(\"k\");", " }", " if (mx>=0) {", " sb.append(\" -Xmx\");", " sb.append(mx);", "\t\t //sb.append(\"k\");", " }", " if (classpath!=null) warn(\"j9_foundation does not support classpath, use -Xbootclasspath,-Xbootclasspath/p,-Xbootclasspath/a\"); ", " if (prof!=null) warn(\"j9_foundation does not support prof\");", " if (verify) sb.append(\" -verify\");", " if (noverify) warn(\"j9_foundation does not support noverify\");", " if (nojit) sb.append(\" -Xnojit\");", " if (D != null)", " for (int i=0; i<D.size();i++) {", "\t sb.append(\" -D\");", "\t sb.append((String)(D.elementAt(i)));", " }", " }", "\tpublic String getDintro() { return \"-D\"; }", "", "//\tprotected void setSecurityProps()", "//\t{", "//\t\tSystem.out.println(\"Note: J9 (foundation) tests do not run with security manager\");\t\t", "//\t}", "", "}" ], "header": "@@ -0,0 +1,135 @@", "removed": [] } ] } ]
derby-DERBY-2225-0070f973
DERBY-2224 - update j9_foundation master/canons to weme 6.1 (J2ME 1.1) results - this change includes a change to ij because java.math.BigDecimal is now available, but JSR169 does not support methods like ResultSet.getBigDecimal(...). - this change also accepts incorrect behavior in timestampArith.java, which is covered in DERBY-2225. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@497678 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java", "hunks": [ { "added": [ "import java.lang.reflect.*;", " * like J2ME/CDC/Foundation Profile 1.0, which do not have BigDecimal class, or", " * JSR169 Profile, which does not support method calls using BigDecimal (such ", " * as ResultSet.getBigDecimal(..).", " * " ], "header": "@@ -25,12 +25,16 @@ import java.sql.SQLException;", "removed": [ " * like J2ME/CDC/Foundation Profile, which do not have BigDecimal class. " ] } ] }, { "file": "java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java", "hunks": [ { "added": [ "import java.lang.reflect.Method;" ], "header": "@@ -23,6 +23,7 @@ package org.apache.derby.iapi.tools.i18n;", "removed": [] }, { "added": [ "\tprivate static final boolean SUPPORTS_BIG_DECIMAL_CALLS;", "\t\tboolean supportsBigDecimalCalls;", "\t\t\t// This class attempts to make a call to a ", "\t\t\t// ResultSet.getBigDecimal method, which may not be available.", "\t\t\t// For instance, java.math.BigDecimal is not available with", "\t\t\t// J2ME/CDC/Foundation 1.0 profile.", "\t\t\tsupportsBigDecimalCalls = true;", "\t\t\t// And no methods using BigDecimal are available with JSR169 spec.", "\t\t\tMethod getbd = ResultSet.class.getMethod(\"getBigDecimal\", new Class[] {int.class});", "\t\t\tsupportsBigDecimalCalls = true;", "\t\t\tsupportsBigDecimalCalls = false;", "\t\tSUPPORTS_BIG_DECIMAL_CALLS = supportsBigDecimalCalls;" ], "header": "@@ -45,17 +46,24 @@ import java.sql.Types;", "removed": [ "\tprivate static final boolean HAVE_BIG_DECIMAL;", "\t\tboolean haveBigDecimal;", "\t\t\thaveBigDecimal = true;", "\t\t\thaveBigDecimal = false;", "\t\tHAVE_BIG_DECIMAL = haveBigDecimal;" ] }, { "added": [ "\t\t\telse if (SUPPORTS_BIG_DECIMAL_CALLS && (type == Types.NUMERIC || type == Types.DECIMAL)) {" ], "header": "@@ -331,7 +339,7 @@ public final class LocalizedResource implements java.security.PrivilegedAction", "removed": [ "\t\t\telse if (HAVE_BIG_DECIMAL && (type == Types.NUMERIC || type == Types.DECIMAL)) {" ] } ] } ]
derby-DERBY-2226-68535119
DERBY-2226: Move column bitset computation to IndexToBaseRowNode Patch contributed by Dyre Tjeldvoll. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@496645 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java", "hunks": [ { "added": [ "\t\t@param allColRefItem A saved item for a bitImpl of columns", "\t\t\t\t\t\t\t\tthat are referenced in the underlying", "\t\t\t\t\t\t\t\tindex and heap. -1 if no item.", "\t\t@param heapOnlyColRefItem A saved item for a bitImpl of", "\t\t\t\t\t\t\t\tcolumns that are referenced in the", "\t\t\t\t\t\t\t\tunderlying heap only. -1 if no item.", "" ], "header": "@@ -1006,9 +1006,13 @@ public interface ResultSetFactory {", "removed": [ "\t\t@param indexColRefItem\tA saved item for a bitImpl of columns that", "\t\t\t\t\t\t\t\tare referenced in the underlying index. -1 if", "\t\t\t\t\t\t\t\tno item." ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java", "hunks": [ { "added": [ "\tprivate FormatableBitSet\tallReferencedCols;", "\tprivate FormatableBitSet\theapOnlyReferencedCols;" ], "header": "@@ -68,6 +68,8 @@ public class IndexToBaseRowNode extends FromTable", "removed": [] }, { "added": [ "", "\t\tif (this.indexReferencedCols == null) {", "\t\t\tthis.allReferencedCols = this.heapReferencedCols;", "\t\t\theapOnlyReferencedCols = this.heapReferencedCols;", "\t\t}", "\t\telse {", "\t\t\tthis.allReferencedCols =", "\t\t\t\tnew FormatableBitSet(this.heapReferencedCols);", "\t\t\tthis.allReferencedCols.or(this.indexReferencedCols);", "\t\t\theapOnlyReferencedCols =", "\t\t\t\tnew FormatableBitSet(allReferencedCols);", "\t\t\theapOnlyReferencedCols.xor(this.indexReferencedCols);", "\t\t}" ], "header": "@@ -89,6 +91,19 @@ public class IndexToBaseRowNode extends FromTable", "removed": [] }, { "added": [ "\t\tint allColRefItem = -1;", "\t\tif (allReferencedCols != null)", "\t\t\tallColRefItem = acb.addItem(allReferencedCols);", "\t\t}", "\t\tint heapOnlyColRefItem = -1;", "\t\tif (heapOnlyReferencedCols != null)", "\t\t{", "\t\t\theapOnlyColRefItem = acb.addItem(heapOnlyReferencedCols);" ], "header": "@@ -187,14 +202,19 @@ public class IndexToBaseRowNode extends FromTable", "removed": [ "\t\tint indexColRefItem = -1;", "\t\tif (indexReferencedCols != null)", "\t\t\tindexColRefItem = acb.addItem(indexReferencedCols);" ] }, { "added": [ "", "\t\tmb.push(allColRefItem);", "\t\tmb.push(heapOnlyColRefItem);", "" ], "header": "@@ -218,7 +238,10 @@ public class IndexToBaseRowNode extends FromTable", "removed": [ "\t\tmb.push(indexColRefItem);" ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java", "hunks": [ { "added": [ "\t\t\t\t\t\t\t\tint allColRefItem,", "\t\t\t\t\t\t\t\tint heapOnlyColRefItem," ], "header": "@@ -738,7 +738,8 @@ public class GenericResultSetFactory implements ResultSetFactory", "removed": [ "\t\t\t\t\t\t\t\tint indexColRefItem," ] } ] }, { "file": "java/engine/org/apache/derby/impl/sql/execute/IndexRowToBaseRowResultSet.java", "hunks": [ { "added": [ "import org.apache.derby.impl.sql.GenericPreparedStatement;" ], "header": "@@ -36,6 +36,7 @@ import org.apache.derby.iapi.types.DataValueDescriptor;", "removed": [] }, { "added": [], "header": "@@ -75,7 +76,6 @@ class IndexRowToBaseRowResultSet extends NoPutResultSetImpl", "removed": [ "\tprivate FormatableBitSet accessedIndexCols;" ] }, { "added": [], "header": "@@ -87,7 +87,6 @@ class IndexRowToBaseRowResultSet extends NoPutResultSetImpl", "removed": [ "\tprivate ExecRow\t\t\t\t\tcompactRow;" ] }, { "added": [ "\t\t\t\t\tint allColRefItem,", "\t\t\t\t\tint heapOnlyColRefItem," ], "header": "@@ -117,7 +116,8 @@ class IndexRowToBaseRowResultSet extends NoPutResultSetImpl", "removed": [ "\t\t\t\t\tint indexColRefItem," ] }, { "added": [ "\t\tfinal GenericPreparedStatement gp =", "\t\t\t(GenericPreparedStatement)a.getPreparedStatement();", "\t\tfinal Object[] saved = gp.getSavedObjects();", "", "\t\tscoci = (StaticCompiledOpenConglomInfo)saved[scociItem];" ], "header": "@@ -126,8 +126,11 @@ class IndexRowToBaseRowResultSet extends NoPutResultSetImpl", "removed": [ " scoci = (StaticCompiledOpenConglomInfo)(activation.getPreparedStatement().", "\t\t\t\t\t\tgetSavedObject(scociItem));" ] }, { "added": [ "\t\tif (heapColRefItem != -1) {", "\t\t\tthis.accessedHeapCols = (FormatableBitSet)saved[heapColRefItem];", "\t\tif (allColRefItem != -1) {", "\t\t\tthis.accessedAllCols = (FormatableBitSet)saved[allColRefItem];", "", "\t\tindexCols = ", "\t\t\t((ReferencedColumnsDescriptorImpl)", "\t\t\t saved[indexColMapItem]).getReferencedColumnPositions();", "\t\t// Note that getCompactRow will assign its return value to the", "\t\t// variable compactRow which can be accessed through", "\t\t// inheritance. Hence we need not collect the return value", "\t\t// of the method.", "\t\tgetCompactRow(resultRow, accessedAllCols, ", "\t\t\t\t\t (FormatableBitSet)null, false);", "\t\tif (accessedHeapCols == null) {", "\t\telse {", "\t\t\tfinal DataValueDescriptor[] resultRowArray =", "\t\t\t\tresultRow.getRowArray();", "\t\t\tfinal FormatableBitSet heapOnly =", "\t\t\t\t(FormatableBitSet)saved[heapOnlyColRefItem];", "\t\t\tfinal int heapOnlyLen = heapOnly.getLength();", "", "\t\t\t// Need a separate DataValueDescriptor array in this case", "\t\t\trowArray =", " \t\t\t\tnew DataValueDescriptor[heapOnlyLen];", "\t\t\tfinal int minLen = Math.min(resultRowArray.length, heapOnlyLen);", "", "\t\t\t// Make a copy of the relevant part of rowArray", "\t\t\tfor (int i = 0; i < minLen; ++i) {", "\t\t\t\tif (resultRowArray[i] != null && heapOnly.isSet(i)) {", "\t\t\t\t\trowArray[i] = resultRowArray[i];", "\t}" ], "header": "@@ -142,76 +145,58 @@ class IndexRowToBaseRowResultSet extends NoPutResultSetImpl", "removed": [ "\t\tthis.accessedHeapCols = null;", "\t\tif (heapColRefItem != -1)", "\t\t{", "\t\t\tthis.accessedHeapCols = (FormatableBitSet)(a.getPreparedStatement().", "\t\t\t\t\t\tgetSavedObject(heapColRefItem));", "\t\tif (indexColRefItem != -1)", "\t\t{", "\t\t\tthis.accessedIndexCols = (FormatableBitSet)(a.getPreparedStatement().", "\t\t\t\t\t\tgetSavedObject(indexColRefItem));", "\t\tif (accessedIndexCols == null)", "\t\t\taccessedAllCols = accessedHeapCols;", "\t\telse", "\t\t{", "\t\t\taccessedAllCols = new FormatableBitSet(accessedHeapCols);", "\t\t\taccessedAllCols.or(accessedIndexCols);", "\t\t}", "\t\t\t", "\t\tindexCols = ((ReferencedColumnsDescriptorImpl) (a.getPreparedStatement().", "\t\t\t\t\t\tgetSavedObject(indexColMapItem))).getReferencedColumnPositions();", "\t\tcompactRow =", "\t\t\tgetCompactRow(resultRow,", "\t\t\t\t\t\t\taccessedHeapCols,", "\t\t\t\t\t\t\taccessedIndexCols,", "\t\t\t\t\t\t\tfalse);", "\t\tif (accessedHeapCols == null)", "\t\t{", "\t\telse", "\t\t{", "\t\t\tint arraySize = accessedHeapCols.getNumBitsSet();", "\t\t\tint accessedHeapColsSize = accessedHeapCols.size();", "", "\t\t\trowArray = new DataValueDescriptor[accessedHeapColsSize];", "\t\t\t// Now, fill in rowArray with the desired columns", "\t\t\tint partialIndex = 0;", "\t\t\tint numFromIndex = 0;", "\t\t\tfor (int index = 0; index < accessedHeapColsSize; index++)", "\t\t\t{", "\t\t\t\tif (accessedIndexCols != null && accessedIndexCols.get(index))", "\t\t\t\t{", "\t\t\t\t\tnumFromIndex++;", "\t\t\t\t\tcontinue;", "\t\t\t\t}", "\t\t\t\tif (accessedHeapCols.get(index))", "\t\t\t\t{", "\t\t\t\t\trowArray[index] =", "\t\t\t\t\t\tresultRow.getRowArray()[index];", "\t\t\t\t\tpartialIndex++;", "", "", " }" ] } ] } ]
derby-DERBY-2228-3b118182
DERBY-2228 Fix ij's util class to make correct determination if running on J2SE or JSR 169. Also set DECIMAL parameter in PreparedStatement using setString and retry using setLong if a conversion error occurs. This fixes the NullPointerExcecption seen in DERBY-680. Previously the code was using the ResultSetMetaData which was incorrect, as it has no relationship to the types of the parameters. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@498842 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/tools/org/apache/derby/impl/tools/ij/util.java", "hunks": [ { "added": [ "\tprivate static boolean IS_AT_LEAST_JDBC2;", "\t\tboolean isAtLeastJDBC2;", " // Need to test to see if this is", " // currently JDBC 2 or JSR169.", " // Checking for BigDecimal doesn't work because", " // BigDecimal exists in J2ME/CDC/Foundation 1.1", " Class.forName(\"java.sql.Driver\");", "\t\t\tisAtLeastJDBC2 = true;", "\t\t\tisAtLeastJDBC2 = false;", "\t\tIS_AT_LEAST_JDBC2 = isAtLeastJDBC2;" ], "header": "@@ -54,17 +54,21 @@ import java.util.Locale;", "removed": [ "\tprivate static boolean HAVE_BIG_DECIMAL;", "\t\tboolean haveBigDecimal;", "\t\t\tClass.forName(\"java.math.BigDecimal\");", "\t\t\thaveBigDecimal = true;", "\t\t\thaveBigDecimal = false;", "\t\tHAVE_BIG_DECIMAL = haveBigDecimal;" ] }, { "added": [ "\t\t\t\t\tif (util.IS_AT_LEAST_JDBC2)" ], "header": "@@ -647,7 +651,7 @@ AppUI.out.println(\"SIZE=\"+l);", "removed": [ "\t\t\t\t\tif (util.HAVE_BIG_DECIMAL)" ] }, { "added": [ "\t\t\t\t\t\t// an integral type. Of course in JSR169 we have", " // no way to determine the parameter types,", " // ParameterMetaData is not supported.", " // So convert as string, and on a conversion error", " // try as a long.", " ", " try {", " ps.setString(c, rs.getString(c));", " } catch (SQLException e) {", " // 22018 - invalid format", " if (\"22018\".equals(e.getSQLState()))", " ps.setLong(c, rs.getLong(c));", " else", " throw e;", " }\t\t\t\t\t\t" ], "header": "@@ -660,21 +664,21 @@ AppUI.out.println(\"SIZE=\"+l);", "removed": [ "\t\t\t\t\t\t// an integral type.", "\t\t\t\t\t\tswitch (ps.getMetaData().getColumnType(c))", "\t\t\t\t\t\t{", "\t\t\t\t\t\tcase Types.BIGINT:", "\t\t\t\t\t\t\tps.setLong(c, rs.getLong(c));", "\t\t\t\t\t\t break;", "\t\t\t\t\t\tcase Types.INTEGER:", "\t\t\t\t\t\tcase Types.SMALLINT:", "\t\t\t\t\t\tcase Types.TINYINT:", "\t\t\t\t\t\t\tps.setInt(c, rs.getInt(c));", "\t\t\t\t\t\t\tbreak;", "\t\t\t\t\t\tdefault:", "\t\t\t\t\t\t\tps.setString(c,rs.getString(c));", "\t\t\t\t\t\t break;", "\t\t\t\t\t\t}\t\t\t\t\t\t\t\t" ] } ] } ]
derby-DERBY-2242-011514c5
DERBY-2242 (partial) edit comments git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@596396 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-03974e35
DERBY-2242 (partial) Add testing of the ODBC getTables to DatabaseMetaDataTest to mimic the old odbc_metadata.java. Add checking of the nullability of the ResultSets returned for meta data. Includes some utility methods in JDBC. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@502760 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " ", " /**", " * Check the nullability of the column definitions for", " * the ResultSet matches the expected values.", " * @param rs", " * @param nullability", " * @throws SQLException ", " */", " public static void assertNullability(ResultSet rs,", " boolean[] nullability) throws SQLException", " {", " ResultSetMetaData rsmd = rs.getMetaData();", " int actualCols = rsmd.getColumnCount();", "", " Assert.assertEquals(\"Unexpected column count:\",", " nullability.length, rsmd.getColumnCount());", "", " for (int i = 0; i < actualCols; i++)", " {", " int expected = nullability[i] ?", " ResultSetMetaData.columnNullable : ResultSetMetaData.columnNoNulls;", " Assert.assertEquals(\"Column nullability do not match for column \" + (i+1),", " expected, rsmd.isNullable(i+1));", " } ", " }" ], "header": "@@ -522,6 +522,31 @@ public class JDBC {", "removed": [] }, { "added": [ " ", " /**", " * Assert two result sets have the same contents.", " * MetaData is determined from rs1, thus if rs2 has extra", " * columns they will be ignored. The metadata for the", " * two ResultSets are not compared.", " * <BR>", " * The compete ResultSet is walked for both ResultSets,", " * and they are both closed.", " * <BR>", " * Columns are compared as primitive ints or longs or as", " * Strings. Code needs more work to handle BLOB/CLOB columns.", " */", " public static void assertSameContents(ResultSet rs1, ResultSet rs2)", " throws SQLException {", " ResultSetMetaData rsmd = rs1.getMetaData();", " int columnCount = rsmd.getColumnCount();", " while (rs1.next()) {", " Assert.assertTrue(rs2.next());", " for (int col = 1; col <= columnCount; col++) {", " switch (rsmd.getColumnType(col)) {", " case Types.SMALLINT:", " case Types.INTEGER:", " Assert.assertEquals(rs1.getInt(col), rs2.getInt(col));", " break;", " case Types.BIGINT:", " Assert.assertEquals(rs1.getLong(col), rs2.getLong(col));", " break;", " default:", " Assert.assertEquals(rs1.getString(col), rs2.getString(col));", " break;", " }", " Assert.assertEquals(rs1.wasNull(), rs2.wasNull());", " }", " }", " Assert.assertFalse(rs2.next());", " ", " rs1.close();", " rs2.close();", " }" ], "header": "@@ -716,6 +741,46 @@ public class JDBC {", "removed": [] } ] } ]
derby-DERBY-2242-040d4bd4
DERBY-2242 (partial); adding tests for *AreVisible and remainder for *AreDetected tests. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@596070 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-19cabb83
DERBY-2242 (partial) Add more fixtures to DatabaseMetaDataTest that cover almost all the methods that do not return a ResultSet. Add a utility method to JDBC to allow simple checking of data types for a returned ResultSet. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@496555 13f79535-47bb-0310-9956-ffa450edef68
[ { "file": "java/testing/org/apache/derbyTesting/junit/JDBC.java", "hunks": [ { "added": [ " /**", " * Takes a result set and an array of expected column types", " * from java.sql.Types ", " * and asserts that the column types in the result", " * set metadata match the number, order, and names of those", " * in the array.", " * ", " * No length information for variable length types", " * can be passed. For ResultSets from JDBC DatabaseMetaData", " * the specification only indicates the types of the", " * columns, not the length.", " *", " * @param rs ResultSet for which we're checking column names.", " * @param expectedTypes Array of expected column types.", " */", " public static void assertColumnTypes(ResultSet rs,", " int[] expectedTypes) throws SQLException", " {", " ResultSetMetaData rsmd = rs.getMetaData();", " int actualCols = rsmd.getColumnCount();", "", " Assert.assertEquals(\"Unexpected column count:\",", " expectedTypes.length, rsmd.getColumnCount());", "", " for (int i = 0; i < actualCols; i++)", " {", " Assert.assertEquals(\"Column types do not match for column \" + (i+1),", " expectedTypes[i], rsmd.getColumnType(i+1));", " }", " }" ], "header": "@@ -469,7 +469,36 @@ public class JDBC {", "removed": [ " " ] } ] } ]
derby-DERBY-2242-1a2a78d2
DERBY-2242 (partial) test for getBestRowIdentifier modifications; adding bug numbers; splitting off helper methods; adjusting comments; reinstating table brit17 into main test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@592626 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-1ba0984d
DERBY-2242 ; remove metadata.java, metadata_test.java and odbc_metadata.java. Test has been converted to junit test DatabaseMetaDataTest. Also removed master file PhaseTester.out, orphaned from rev 407396 (DERBY-514) git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@597464 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-29f4885a
DERBY-2242 (partial) moved over tests from metadata_test.java for get*Keys, getCrossReference. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@596577 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-30f8bce0
DERBY-2242 (partial) - convert tests for getBestRowIdentifier from bestrowidentifier.sql and metadata.java - step 1; add to DatabaseMetaDataTest. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@592240 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-3f677d15
DERBY-2744 DERBY-2242 Remove the testing of the new JDBC 4.0 DatabaseMetaData functions from the harness based metadata tests that are already covered by the JUnit jdbc4.TestDbMetaData test. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@543544 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-42d8676c
DERBY-2242 (partial) Add some more test cases and fixtures to DatabaseMetaDataTest git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@496508 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-6254f17a
DERBY-2242 (partial) Add testing of getColumns() to DatabaseMetaDataTest git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@502719 13f79535-47bb-0310-9956-ffa450edef68
[]
derby-DERBY-2242-73e0fab3
DERBY-2242 (partial) tests for getIndexInfo. Also modified some comments. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@596033 13f79535-47bb-0310-9956-ffa450edef68
[]