ConcurrentModificationException on reverse engineering

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Nov 08 2003 - 18:07:39 EST

  • Next message: Andrus Adamchik: "Re: distributed transactions"

    At least 3 users reported a stack trace reverse engineering the
    database from CayenneModeler using MySQL. New JIRA bug report can be
    found here:

    http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-9

    I did some investigation and found that this is really a MySQL
    Connector-J bug. It happens on driver version 3.1.0 Alpha and does not
    happen on 3.0.6. i submitted a bug to MySQL. Hopefully they'll fix it.
    Cayenne user choices are:

    1. Use a stable driver instead of Alpha (I know that at least 3.0.6
    works)
    2. Manually recompile the driver with my patch below.

    Andrus

    ---
    ../tmp/mysql-connector-java-3.1.0-alpha/mysql-connector-java-3.1.0-
    alpha/com/mysql/jdbc/Connection.java
    +++ mysql-connector-java-3.1.0-alpha/com/mysql/jdbc/Connection.java
    ..-2532,8 +2532,12 @@
           */
          private void closeAllOpenStatements() throws SQLException {
              SQLException postponedException = null;
    +
    + // must iterate over the copy of the statements map,
    + // since each statement will try to remove itself from the map
    + // resulting in ConcurrentModificationException

    - for (Iterator iter = this.openStatements.keySet().iterator();
    + for (Iterator iter = new
    ArrayList(this.openStatements.keySet()).iterator();
                      iter.hasNext();) {
                  Statement stmt = (Statement) iter.next();



    This archive was generated by hypermail 2.0.0 : Sat Nov 08 2003 - 18:07:46 EST