You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2012/03/14 15:45:07 UTC
svn commit: r1300567 - in /empire-db/trunk: CHANGELOG.txt
empire-db/src/main/java/org/apache/empire/commons/Attributes.java
empire-db/src/main/java/org/apache/empire/commons/Options.java
empire-db/src/main/java/org/apache/empire/db/DBCommand.java
Author: doebele
Date: Wed Mar 14 14:45:07 2012
New Revision: 1300567
URL: http://svn.apache.org/viewvc?rev=1300567&view=rev
Log:
EMPIREDB-136
clone() bugfix
Modified:
empire-db/trunk/CHANGELOG.txt
empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Attributes.java
empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Options.java
empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
Modified: empire-db/trunk/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/empire-db/trunk/CHANGELOG.txt?rev=1300567&r1=1300566&r2=1300567&view=diff
==============================================================================
--- empire-db/trunk/CHANGELOG.txt (original)
+++ empire-db/trunk/CHANGELOG.txt Wed Mar 14 14:45:07 2012
@@ -21,6 +21,7 @@ Release 2.2.1:
* [EMPIREDB-123] - Allow to specify the character column length in bytes (Non-Unicode) or chars (Unicode) for DDL generation
** Bugfix
+ * [EMPIREDB-136] - DBCommand.clone() modified to produce an independent clone of the original command.
* [EMPIREDB-135] - Suppress column alias inside concatenations
* [EMPIREDB-132] - Fix support for CLOB data type in Postgre SQL
* [EMPIREDB-130] - Prepared Statements: Convert Enums to String to avoid SQLException
Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Attributes.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Attributes.java?rev=1300567&r1=1300566&r2=1300567&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Attributes.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Attributes.java Wed Mar 14 14:45:07 2012
@@ -30,7 +30,7 @@ import org.w3c.dom.Element;
* This class holds a map of objects which are identified by a case insensitive key string.
*
*/
-public class Attributes extends AbstractSet<Attributes.Attribute> implements Serializable
+public class Attributes extends AbstractSet<Attributes.Attribute> implements Cloneable, Serializable
{
public static final class Attribute implements Serializable
{
@@ -117,6 +117,15 @@ public class Attributes extends Abstract
}
@Override
+ public Attributes clone()
+ {
+ Attributes clone = new Attributes();
+ if (attributes!=null)
+ clone.attributes = new ArrayList<Attributes.Attribute>(attributes);
+ return clone;
+ }
+
+ @Override
public Iterator<Attribute> iterator()
{
return (attributes!=null ? list().iterator() : emptyIterator);
Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Options.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Options.java?rev=1300567&r1=1300566&r2=1300567&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Options.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/Options.java Wed Mar 14 14:45:07 2012
@@ -23,10 +23,9 @@ import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
-import org.apache.empire.commons.Attributes.Attribute;
import org.apache.empire.xml.XMLUtil;
import org.w3c.dom.Element;
@@ -38,7 +37,7 @@ import org.w3c.dom.Element;
* where the entry value is used as the key for the set and thus must be unique.<BR>
* <P>
*/
-public class Options extends AbstractSet<OptionEntry> implements Serializable
+public class Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable
{
private static final long serialVersionUID = 1L;
@@ -54,13 +53,18 @@ public class Options extends AbstractSet
public Options()
{
// Default constructor
- // TODO clean up this class as it is quite messy (add vs set, object vs key, ...)
}
public Options(Options other)
{
this.addAll(other);
}
+
+ @Override
+ public Options clone()
+ {
+ return new Options(this);
+ }
public Options(OptionEntry [] entries)
{
Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java?rev=1300567&r1=1300566&r2=1300567&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java Wed Mar 14 14:45:07 2012
@@ -32,6 +32,7 @@ import org.apache.empire.db.expr.compare
import org.apache.empire.db.expr.join.DBJoinExpr;
import org.apache.empire.db.expr.join.DBJoinExprEx;
import org.apache.empire.db.expr.set.DBSetExpr;
+import org.apache.empire.exceptions.InternalException;
import org.apache.empire.exceptions.MiscellaneousErrorException;
import org.apache.empire.exceptions.ObjectNotValidException;
import org.slf4j.Logger;
@@ -136,11 +137,37 @@ public abstract class DBCommand extends
{
try
{
- return (DBCommand)super.clone();
- } catch(CloneNotSupportedException e)
- {
+ DBCommand clone = (DBCommand)super.clone();
+ clone.db = db;
+ // Clone lists
+ if (select!=null)
+ clone.select = new ArrayList<DBColumnExpr>(select);
+ if (set!=null)
+ clone.set = new ArrayList<DBSetExpr>(set);
+ if (joins!=null)
+ clone.joins = new ArrayList<DBJoinExpr>(joins);
+ if (where!=null)
+ clone.where = new ArrayList<DBCompareExpr>(where);
+ if (groupBy!=null)
+ clone.groupBy = new ArrayList<DBColumnExpr>(groupBy);
+ if (having!=null)
+ clone.having = new ArrayList<DBCompareExpr>(having);
+ if (cmdParams!=null)
+ { // clone params
+ clone.paramUsageCount = 0;
+ clone.cmdParams = new Vector<DBCmdParam>();
+ for (DBCmdParam p : cmdParams)
+ {
+ DBCmdParam param = new DBCmdParam(this, p.getDataType(), p.getValue());
+ clone.cmdParams.add(param);
+ }
+ }
+ // done
+ return clone;
+
+ } catch (CloneNotSupportedException e) {
log.error("Cloning DBCommand object failed!", e);
- return null;
+ throw new InternalException(e);
}
}
SVN problems
Posted by Rainer Döbele <do...@esteam.de>.
Hi all,
I am recently experiencing SVN problems - which have started since we moved from the incubator.
Access to SVN is very slow - and it seems to get worse every day.
For example browsing the trunk from within Eclipse is an nightmare.
It takes minutes after every click before I the next branch opens.
And today I have checked in some code, and now on a different machine it tells me there are no changes.
Not sure whether my changes got lost (EMPIREDB-136).
The changes are listed in JIRA but the svn-viewer also seems to have a problem to display the files.
Is anyone else having these problems?
I am using this repository location:
https://svn.apache.org/repos/asf/empire-db
Regards,
Rainer
> from: doebele@apache.org [mailto:doebele@apache.org]
> to: commits@empire-db.apache.org
> re: svn commit: r1300567 - in /empire-db/trunk: CHANGELOG.txt
> empire-db/src/main/java/org/apache/empire/commons/Attributes.java
> empire-db/src/main/java/org/apache/empire/commons/Options.java empire-
> db/src/main/java/org/apache/empire/db/DBCommand.java
>
> Author: doebele
> Date: Wed Mar 14 14:45:07 2012
> New Revision: 1300567
>
> URL: http://svn.apache.org/viewvc?rev=1300567&view=rev
> Log:
> EMPIREDB-136
> clone() bugfix
>
> Modified:
> empire-db/trunk/CHANGELOG.txt
> empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Attributes.java
> empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Options.java
> empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/db/DBCommand.java
>
> Modified: empire-db/trunk/CHANGELOG.txt
> URL: http://svn.apache.org/viewvc/empire-
> db/trunk/CHANGELOG.txt?rev=1300567&r1=1300566&r2=1300567&view=diff
> =======================================================================
> =======
> --- empire-db/trunk/CHANGELOG.txt (original)
> +++ empire-db/trunk/CHANGELOG.txt Wed Mar 14 14:45:07 2012
> @@ -21,6 +21,7 @@ Release 2.2.1:
> * [EMPIREDB-123] - Allow to specify the character column length in
> bytes (Non-Unicode) or chars (Unicode) for DDL generation
>
> ** Bugfix
> + * [EMPIREDB-136] - DBCommand.clone() modified to produce an
> independent clone of the original command.
> * [EMPIREDB-135] - Suppress column alias inside concatenations
> * [EMPIREDB-132] - Fix support for CLOB data type in Postgre SQL
> * [EMPIREDB-130] - Prepared Statements: Convert Enums to String to
> avoid SQLException
>
> Modified: empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Attributes.java
> URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Attributes.java?rev=1300567&
> r1=1300566&r2=1300567&view=diff
> =======================================================================
> =======
> --- empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Attributes.java (original)
> +++ empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/At
> +++ tributes.java Wed Mar 14 14:45:07 2012
> @@ -30,7 +30,7 @@ import org.w3c.dom.Element;
> * This class holds a map of objects which are identified by a case
> insensitive key string.
> *
> */
> -public class Attributes extends AbstractSet<Attributes.Attribute>
> implements Serializable
> +public class Attributes extends AbstractSet<Attributes.Attribute>
> +implements Cloneable, Serializable
> {
> public static final class Attribute implements Serializable
> {
> @@ -117,6 +117,15 @@ public class Attributes extends Abstract
> }
>
> @Override
> + public Attributes clone()
> + {
> + Attributes clone = new Attributes();
> + if (attributes!=null)
> + clone.attributes = new
> ArrayList<Attributes.Attribute>(attributes);
> + return clone;
> + }
> +
> + @Override
> public Iterator<Attribute> iterator()
> {
> return (attributes!=null ? list().iterator() : emptyIterator);
>
> Modified: empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Options.java
> URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Options.java?rev=1300567&r1=
> 1300566&r2=1300567&view=diff
> =======================================================================
> =======
> --- empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Options.java (original)
> +++ empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/commons/Op
> +++ tions.java Wed Mar 14 14:45:07 2012
> @@ -23,10 +23,9 @@ import java.util.AbstractSet; import
> java.util.ArrayList; import java.util.HashSet; import
> java.util.Iterator; -import java.util.Set; import java.util.Map.Entry;
> +import java.util.Set;
>
> -import org.apache.empire.commons.Attributes.Attribute;
> import org.apache.empire.xml.XMLUtil;
> import org.w3c.dom.Element;
>
> @@ -38,7 +37,7 @@ import org.w3c.dom.Element;
> * where the entry value is used as the key for the set and thus must
> be unique.<BR>
> * <P>
> */
> -public class Options extends AbstractSet<OptionEntry> implements
> Serializable
> +public class Options extends AbstractSet<OptionEntry> implements
> +Cloneable, Serializable
> {
> private static final long serialVersionUID = 1L;
>
> @@ -54,13 +53,18 @@ public class Options extends AbstractSet
> public Options()
> {
> // Default constructor
> - // TODO clean up this class as it is quite messy (add vs set,
> object vs key, ...)
> }
>
> public Options(Options other)
> {
> this.addAll(other);
> }
> +
> + @Override
> + public Options clone()
> + {
> + return new Options(this);
> + }
>
> public Options(OptionEntry [] entries)
> {
>
> Modified: empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/db/DBCommand.java
> URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/db/DBCommand.java?rev=1300567&r1=130
> 0566&r2=1300567&view=diff
> =======================================================================
> =======
> --- empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/db/DBCommand.java (original)
> +++ empire-db/trunk/empire-
> db/src/main/java/org/apache/empire/db/DBComma
> +++ nd.java Wed Mar 14 14:45:07 2012
> @@ -32,6 +32,7 @@ import org.apache.empire.db.expr.compare import
> org.apache.empire.db.expr.join.DBJoinExpr;
> import org.apache.empire.db.expr.join.DBJoinExprEx;
> import org.apache.empire.db.expr.set.DBSetExpr;
> +import org.apache.empire.exceptions.InternalException;
> import org.apache.empire.exceptions.MiscellaneousErrorException;
> import org.apache.empire.exceptions.ObjectNotValidException;
> import org.slf4j.Logger;
> @@ -136,11 +137,37 @@ public abstract class DBCommand extends
> {
> try
> {
> - return (DBCommand)super.clone();
> - } catch(CloneNotSupportedException e)
> - {
> + DBCommand clone = (DBCommand)super.clone();
> + clone.db = db;
> + // Clone lists
> + if (select!=null)
> + clone.select = new ArrayList<DBColumnExpr>(select);
> + if (set!=null)
> + clone.set = new ArrayList<DBSetExpr>(set);
> + if (joins!=null)
> + clone.joins = new ArrayList<DBJoinExpr>(joins);
> + if (where!=null)
> + clone.where = new ArrayList<DBCompareExpr>(where);
> + if (groupBy!=null)
> + clone.groupBy = new ArrayList<DBColumnExpr>(groupBy);
> + if (having!=null)
> + clone.having = new ArrayList<DBCompareExpr>(having);
> + if (cmdParams!=null)
> + { // clone params
> + clone.paramUsageCount = 0;
> + clone.cmdParams = new Vector<DBCmdParam>();
> + for (DBCmdParam p : cmdParams)
> + {
> + DBCmdParam param = new DBCmdParam(this,
> p.getDataType(), p.getValue());
> + clone.cmdParams.add(param);
> + }
> + }
> + // done
> + return clone;
> +
> + } catch (CloneNotSupportedException e) {
> log.error("Cloning DBCommand object failed!", e);
> - return null;
> + throw new InternalException(e);
> }
> }
>
>