polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [09/14] zest-qi4j git commit: Added check for Entity existence in FileEntityStore.
Date Tue, 09 Jun 2015 23:58:07 GMT
Added check for Entity existence in FileEntityStore.


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/e4b725a8
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/e4b725a8
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/e4b725a8

Branch: refs/heads/develop
Commit: e4b725a8e7e9e909c9d3c40c25efcc0a2f1b231b
Parents: 568fa2f
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Wed Jun 3 12:26:32 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Wed Jun 3 12:26:32 2015 +0800

----------------------------------------------------------------------
 .../java/org/qi4j/entitystore/file/FileEntityStoreMixin.java    | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/e4b725a8/extensions/entitystore-file/src/main/java/org/qi4j/entitystore/file/FileEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/src/main/java/org/qi4j/entitystore/file/FileEntityStoreMixin.java
b/extensions/entitystore-file/src/main/java/org/qi4j/entitystore/file/FileEntityStoreMixin.java
index f335669..2151e98 100644
--- a/extensions/entitystore-file/src/main/java/org/qi4j/entitystore/file/FileEntityStoreMixin.java
+++ b/extensions/entitystore-file/src/main/java/org/qi4j/entitystore/file/FileEntityStoreMixin.java
@@ -44,6 +44,7 @@ import org.qi4j.io.Receiver;
 import org.qi4j.io.Sender;
 import org.qi4j.library.fileconfig.FileConfiguration;
 import org.qi4j.spi.entitystore.BackupRestore;
+import org.qi4j.spi.entitystore.EntityAlreadyExistsException;
 import org.qi4j.spi.entitystore.EntityNotFoundException;
 import org.qi4j.spi.entitystore.EntityStoreException;
 import org.qi4j.spi.entitystore.helpers.MapEntityStore;
@@ -216,6 +217,10 @@ public class FileEntityStoreMixin
                             super.close();
                             byte[] stateArray = this.toString().getBytes( "UTF-8" );
                             File dataFile = getDataFile( ref );
+                            if( dataFile.exists() )
+                            {
+                                throw new EntityAlreadyExistsException(ref);
+                            }
                             store( dataFile, stateArray );
                         }
                     };


Mime
View raw message