joafip-svn Mailing List for java data object persistence in file (Page 19)
Brought to you by:
luc_peuvrier
You can subscribe to this list here.
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
(102) |
Nov
(52) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2012 |
Jan
(4) |
Feb
|
Mar
(14) |
Apr
(116) |
May
(100) |
Jun
(14) |
Jul
|
Aug
|
Sep
(30) |
Oct
|
Nov
(108) |
Dec
(2) |
|
From: <luc...@us...> - 2011-10-30 03:09:17
|
Revision: 2954
http://joafip.svn.sourceforge.net/joafip/?rev=2954&view=rev
Author: luc_peuvrier
Date: 2011-10-30 03:09:09 +0000 (Sun, 30 Oct 2011)
Log Message:
-----------
fix done, code cleaner
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -539,6 +539,9 @@
}
public void setIsLoaded() throws ObjectIOException {
+ // out of constructor, no more acceded, to do before set is
+ // loaded
+ acceded = false;
if (proxyIntanceOrEnhanced) {
/*
* set loaded state can call save and object is referenced only by
@@ -549,6 +552,13 @@
}
}
+ public void newInstanceAndCreatedBySave(final StorageInfo storageInfo)
+ throws ObjectIOException {
+ unWeakReferenceOnObject();
+ setStorageInfo(storageInfo);
+ setIsLoaded();
+ }
+
public void unloadAfterSave() throws ObjectIOException,
ObjectIOInvalidClassException {
if (proxyIntanceOrEnhanced && !acceded) {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -68,7 +68,7 @@
throw new ImportException(exportFile + " does not exists");
}
final SAXParserFactory factory = SAXParserFactory.newInstance();
- // FIXMELUC ___________why not validating
+ // FIXMELUC ____why not validating
factory.setValidating(false);
factory.setNamespaceAware(true);
final SchemaFactory schemaFactory = SchemaFactory
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -443,7 +443,7 @@
final List<ReferenceChange> referenceChangeList)
throws ObjectIOException {
final boolean stateChanged;
- // FIXMELUC ___________only for exclusive das
+ // FIXMELUC ____only for exclusive das
if (originalReferenced.referenceLost()) {
stateChanged = true;
} else {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -280,32 +280,13 @@
if (constructed) {
assert getProxyCallBack(instanceCreated) != NULL_PROXY_CALL_BACK_INSTANCE;
- // FIXMELUC ___________unweak needed ?
assert objectAndPersistInfo.isNotWeak();
- // objectAndPersistInfo.unWeakReferenceOnObject();
- // out of constructor, no more acceded, to do before set is
- // loaded
- objectAndPersistInfo.acceded = false;
- // set is loaded is last operation for auto save
- setIsLoaded(instanceCreated);
+ objectAndPersistInfo.setIsLoaded();
}
} else {
- // FIXMELUC ___________one method for objectAndPersistInfo action
// created by save
assert constructed;
- objectAndPersistInfo.unWeakReferenceOnObject();
- objectIOManager
- .dataRecordIdentifierAssociatedToObjectSetted(objectAndPersistInfo);
- objectAndPersistInfo.setStorageInfo(storageInfo);
- /*
- * FIXMELUC __for setIsLoaded, call of
- * objectAndPersistInfo.setIsLoaded() should be good to, may be
- * better
- */
- // out of constructor, no more acceded, to do before set is loaded
- objectAndPersistInfo.acceded = false;
- // set is loaded is last operation for auto save
- setIsLoaded(instanceCreated);
+ objectAndPersistInfo.newInstanceAndCreatedBySave(storageInfo);
}
return objectAndPersistInfo;
}
@@ -383,17 +364,18 @@
return loaded;
}
- public static void setIsLoaded(final Object object) throws ProxyException {
- try {
- if (useJavaAgent) {
- StaticProxyCallBack.setIsLoaded(object);
- } else if (isProxy(object)) {
- ((IProxyCallBackProxyDelegation) object).setIsLoaded$JOAFIP$();
- }
- } catch (ObjectIOException exception) {
- throw new ProxyException(exception);
- }
- }
+ // public static void setIsLoaded(final Object object) throws ProxyException
+ // {
+ // try {
+ // if (useJavaAgent) {
+ // StaticProxyCallBack.setIsLoaded(object);
+ // } else if (isProxy(object)) {
+ // ((IProxyCallBackProxyDelegation) object).setIsLoaded$JOAFIP$();
+ // }
+ // } catch (ObjectIOException exception) {
+ // throw new ProxyException(exception);
+ // }
+ // }
public static void setIsLoadedNoSave(final Object object)
throws ProxyException {
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -74,6 +74,7 @@
filePersistence = new FilePersistence(
"net/sf/joafip/service/joafip_for_test.properties", true);
filePersistence.addToNotCheckMethod(Bob1.class);
+ filePersistence.addToNotCheckMethod(Bob1Substitute.class);
session = filePersistence.createDataAccessSession();
// Logger.getLogger(ProxyCallBackInterceptEnd.class).setLevel(Level.DEBUG);
// Logger.getLogger(StoreSaver3.class).setLevel(Level.DEBUG);
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -102,10 +102,9 @@
if (logger.debugEnabled) {
logger.debug("begin set free memory");
}
- // FIXMELUC _________to reactivate win xp jvm 32 bits
// yes, only 512Ko of free memory, on Xp 32 bits jvm
MEMORY_EATER.setFreeMemory(512 * 1024);
- // FIXMELUC _________to test win 7 with 64 bits jvm
+ // FIXMELUC ____to test win 7 with 64 bits jvm
// MEMORY_EATER.setFreeMemory(4 * 1024 * 1024);
if (logger.debugEnabled) {
logger.debug("end end set free memory");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-30 03:09:17
|
Revision: 2954
http://joafip.svn.sourceforge.net/joafip/?rev=2954&view=rev
Author: luc_peuvrier
Date: 2011-10-30 03:09:09 +0000 (Sun, 30 Oct 2011)
Log Message:
-----------
fix done, code cleaner
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-29 20:06:19
|
Revision: 2953
http://joafip.svn.sourceforge.net/joafip/?rev=2953&view=rev
Author: luc_peuvrier
Date: 2011-10-29 20:06:13 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
do not write data record if data does not change
added toNotCheckMethod(Class<?> clazz) to IFilePersistence
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java
trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2011-10-29 16:24:23 UTC (rev 2952)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2011-10-29 20:06:13 UTC (rev 2953)
@@ -650,6 +650,11 @@
}
@Override
+ public void addToNotCheckMethod(final Class<?> clazz) {
+ store.addToNotCheckMethod(clazz);
+ }
+
+ @Override
public void addToNotCheckMethod(final Method method) {
store.addToNotCheckMethod(method);
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2011-10-29 16:24:23 UTC (rev 2952)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2011-10-29 20:06:13 UTC (rev 2953)
@@ -613,6 +613,8 @@
*/
void setForceEnhance(String[] objectClassNames);
+ void addToNotCheckMethod(Class<?> clazz);
+
void addToNotCheckMethod(Method method);
void addToNotCheckMethod(Constructor<?> constructor);
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2011-10-29 16:24:23 UTC (rev 2952)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2011-10-29 20:06:13 UTC (rev 2953)
@@ -245,6 +245,8 @@
void setForceEnhance(String objectClassName);
+ void addToNotCheckMethod(Class<?> clazz);
+
void addToNotCheckMethod(Method method);
void addToNotCheckMethod(Constructor<?> constructor);
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-29 16:24:23 UTC (rev 2952)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-29 20:06:13 UTC (rev 2953)
@@ -661,6 +661,7 @@
}
}
+ @Override
public void addToNotCheckMethod(final Class<?> clazz) {
final Constructor<?>[] constructors = clazz.getDeclaredConstructors();
for (Constructor<?> constructor : constructors) {
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java 2011-10-29 16:24:23 UTC (rev 2952)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java 2011-10-29 20:06:13 UTC (rev 2953)
@@ -73,6 +73,7 @@
}
filePersistence = new FilePersistence(
"net/sf/joafip/service/joafip_for_test.properties", true);
+ filePersistence.addToNotCheckMethod(Bob1.class);
session = filePersistence.createDataAccessSession();
// Logger.getLogger(ProxyCallBackInterceptEnd.class).setLevel(Level.DEBUG);
// Logger.getLogger(StoreSaver3.class).setLevel(Level.DEBUG);
Modified: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java
===================================================================
--- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2011-10-29 16:24:23 UTC (rev 2952)
+++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2011-10-29 20:06:13 UTC (rev 2953)
@@ -18,6 +18,7 @@
import java.io.File;
import java.io.FilenameFilter;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -238,16 +239,20 @@
created = true;
heapRecord = createHeapRecordForData(data.length,
dataRecordIdentifier);
+ heapRecord.setDataAssociated(data);
} else {
created = false;
- // FIXMELUC ___________data not change case
- if (data.length != heapRecord.getDataAssociatedSize()) {
+ if (data.length == heapRecord.getDataAssociatedSize()) {
+ if (!Arrays.equals(data, heapRecord.getDataAssociated())) {
+ heapRecord.setDataAssociated(data);
+ }
+ } else {
deleteDataRecord(dataRecordIdentifier);
heapRecord = createHeapRecordForData(data.length,
dataRecordIdentifier);
+ heapRecord.setDataAssociated(data);
}
}
- heapRecord.setDataAssociated(data);
if (logger.debugEnabled) {
logger.debug("create heap record #" + dataRecordIdentifier
+ FOR_DATA_SIZE + data.length);
Modified: trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java
===================================================================
--- trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java 2011-10-29 16:24:23 UTC (rev 2952)
+++ trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java 2011-10-29 20:06:13 UTC (rev 2953)
@@ -1003,7 +1003,8 @@
public void deleteExistingNode(final IRBTNode<E> nodeToDelete)
throws RBTException {
// ASSERTX
- assert isNodeAttachedToTree(nodeToDelete) : "node to delete must be attached to the tree";
+ assert isNodeAttachedToTree(nodeToDelete) : "node to delete must be attached to the tree "
+ + nodeToDelete.getClass().getName();
rootNode = nodeManager.getRootNode();
privateDeleteExistingNode(nodeToDelete);
nodeManager.setRootNode(rootNode);
@@ -1308,7 +1309,8 @@
public int index(final IRBTNode<E> node) throws RBTException {
assertManageNodeIndex();
// ASSERTX
- assert isNodeAttachedToTree(node) : "node must be attached to the tree";
+ assert isNodeAttachedToTree(node) : "node must be attached to the tree "
+ + node.getClass().getName();
int index;
IRBTNode<E> current = node;
if (current.isSentinel()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-29 20:06:19
|
Revision: 2953
http://joafip.svn.sourceforge.net/joafip/?rev=2953&view=rev
Author: luc_peuvrier
Date: 2011-10-29 20:06:13 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
do not write data record if data does not change
added toNotCheckMethod(Class<?> clazz) to IFilePersistence
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java
trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-29 16:24:29
|
Revision: 2952
http://joafip.svn.sourceforge.net/joafip/?rev=2952&view=rev
Author: luc_peuvrier
Date: 2011-10-29 16:24:23 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
add byte code check for prsistence constraints
Modified Paths:
--------------
trunk/joafip-testsuite/src/main/java/net/sf/joafip/service/rel400/ServiceRel400Tests.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-29 16:24:29
|
Revision: 2952
http://joafip.svn.sourceforge.net/joafip/?rev=2952&view=rev
Author: luc_peuvrier
Date: 2011-10-29 16:24:23 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
add byte code check for prsistence constraints
Modified Paths:
--------------
trunk/joafip-testsuite/src/main/java/net/sf/joafip/service/rel400/ServiceRel400Tests.java
Modified: trunk/joafip-testsuite/src/main/java/net/sf/joafip/service/rel400/ServiceRel400Tests.java
===================================================================
--- trunk/joafip-testsuite/src/main/java/net/sf/joafip/service/rel400/ServiceRel400Tests.java 2011-10-29 16:17:34 UTC (rev 2951)
+++ trunk/joafip-testsuite/src/main/java/net/sf/joafip/service/rel400/ServiceRel400Tests.java 2011-10-29 16:24:23 UTC (rev 2952)
@@ -24,6 +24,7 @@
suite.addTestSuite(TestFileManagementOptions.class);
suite.addTestSuite(TestConstructEntrySetIteratorOfPMapKeyNavigableSet.class);
suite.addTestSuite(TestPHashMapNewInstance.class);
+ suite.addTestSuite(TestPrivateAccess.class);
// $JUnit-END$
return suite;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-29 16:17:43
|
Revision: 2951
http://joafip.svn.sourceforge.net/joafip/?rev=2951&view=rev
Author: luc_peuvrier
Date: 2011-10-29 16:17:34 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
add byte code check for prsistence constraints
Modified Paths:
--------------
trunk/joafip/doc/_todo.txt
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfoAttributes.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNodeMethod.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ClassConstraintChecker.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ICheckMethodListener.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/OpcodeInterpreter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestObjectReferenceLink.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ForTestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/TestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionArrayListNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashMapNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashSetNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashSetNosubsWithG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashTableNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionLinkedHashSetNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionLinkedHashSetNosubsWithG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionLinkedListNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTreeMapNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTreeSetNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTreeSetNosubsWithG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTroveHashMapNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionVectorNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/subs/TestStoreCollectionTreeMapSubsNoG.java
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PHashMapEntrySet.java
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PHashMapKeySet.java
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/support/tree/TreeSupport.java
trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java
trunk/joafip-testsuite/src/main/java/net/sf/joafip/service/rel400/ServiceRel400Tests.java
Added Paths:
-----------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/MethodId.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodListener.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Element.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/ElementKo.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPHashMapNewInstance.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPrivateAccess.java
Removed Paths:
-------------
trunk/joafip/doc/current.txt
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/CheckMethodListener.java
Modified: trunk/joafip/doc/_todo.txt
===================================================================
--- trunk/joafip/doc/_todo.txt 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/doc/_todo.txt 2011-10-29 16:17:34 UTC (rev 2951)
@@ -80,7 +80,8 @@
persistence constraint check at enhancement for proxy creation
==> update http://joafip.sourceforge.net/presentation/ppojo.html#prules
- check done at enhancement -> exception
-- private are intercepted, correct the doc
+-- check direct field access
+-- check private method invocation
upgrade Maven plugins :
maven-jar-plugin ..................................... 2.3.1 -> 2.3.2
Deleted: trunk/joafip/doc/current.txt
===================================================================
--- trunk/joafip/doc/current.txt 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/doc/current.txt 2011-10-29 16:17:34 UTC (rev 2951)
@@ -1,7 +0,0 @@
-108738, 118200, 132948, 142808, 165872
-
- 1 1010 1000 1100 0010
- 1 1100 1101 1011 1000
- 10 0000 0111 0101 0100
-1 0100 0010 1000 0000 1000
- 10 1000 0111 1111 0000
\ No newline at end of file
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -650,19 +650,19 @@
}
@Override
- public void addNotCheckedMethod(final Method method) {
- store.addNotCheckedMethod(method);
+ public void addToNotCheckMethod(final Method method) {
+ store.addToNotCheckMethod(method);
}
@Override
- public void addNotCheckedMethod(final Constructor<?> constructor) {
- store.addNotCheckedMethod(constructor);
+ public void addToNotCheckMethod(final Constructor<?> constructor) {
+ store.addToNotCheckMethod(constructor);
}
@Override
- public void addNotCheckedMethod(final String objectClassName,
+ public void addToNotCheckMethod(final String objectClassName,
final String absoluteMethodName) {
- store.addNotCheckedMethod(objectClassName, absoluteMethodName);
+ store.addToNotCheckMethod(objectClassName, absoluteMethodName);
}
@Override
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -613,11 +613,11 @@
*/
void setForceEnhance(String[] objectClassNames);
- void addNotCheckedMethod(Method method);
+ void addToNotCheckMethod(Method method);
- void addNotCheckedMethod(Constructor<?> constructor);
+ void addToNotCheckMethod(Constructor<?> constructor);
- void addNotCheckedMethod(String objectClassName, String absoluteMethodName);
+ void addToNotCheckMethod(String objectClassName, String absoluteMethodName);
/**
* set object input output manager for a class<br>
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -270,7 +270,7 @@
private final Exception creationTrace = new Exception("creation trace");
- private final Set<String> notCheckedMethodSet = new TreeSet<String>();
+ private final Set<String> toNotCheckMethodSet = new TreeSet<String>();
private boolean keptInMemory;
@@ -935,8 +935,8 @@
forceEnhance = true;
}
- public void addNotCheckedMethod(final String absoluteMethodName) {
- notCheckedMethodSet.add(absoluteMethodName);
+ public void addToNotCheckMethod(final String absoluteMethodName) {
+ toNotCheckMethodSet.add(absoluteMethodName);
}
public void setSubstituted(final ClassInfo substituteClassInfo,
@@ -981,8 +981,8 @@
return forceEnhance;
}
- public Set<String> getNotCheckedMethod() {
- return notCheckedMethodSet;
+ public Set<String> getToNotCheckMethodSet() {
+ return toNotCheckMethodSet;
}
public boolean isNotStorable() {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfoAttributes.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfoAttributes.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfoAttributes.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -57,7 +57,7 @@
private boolean forceEnhance;
- private final Set<String> notCheckedMethodSet = new TreeSet<String>();
+ private final Set<String> toNotCheckMethodSet = new TreeSet<String>();
private Class<?> substituteObjectClass;
@@ -141,16 +141,16 @@
forceEnhance = true;
}
- public void addNotCheckedMethod(final String absoluteMethodName) {
- notCheckedMethodSet.add(absoluteMethodName);
+ public void addToNotCheckMethod(final String absoluteMethodName) {
+ toNotCheckMethodSet.add(absoluteMethodName);
}
public boolean isForceEnhance() {
return forceEnhance;
}
- public Set<String> getNotCheckedMethodSet() {
- return notCheckedMethodSet;
+ public Set<String> getToNotCheckMethodSet() {
+ return toNotCheckMethodSet;
}
public void setSubstituteObjectManager(
Added: trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/MethodId.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/MethodId.java (rev 0)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/MethodId.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * 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 net.sf.joafip.store.entity.proxy;
+
+import net.sf.joafip.NotStorableClass;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+public class MethodId implements Comparable<MethodId> {
+
+ private final String methodName;
+
+ private final String desc;
+
+ public MethodId(final String methodName, final String desc) {
+ super();
+ this.methodName = methodName;
+ this.desc = desc;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ @Override
+ public int compareTo(final MethodId other) {
+ int compareTo = methodName.compareTo(other.methodName);
+ if (compareTo == 0) {
+ compareTo = desc.compareTo(other.desc);
+ }
+ return compareTo;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((desc == null) ? 0 : desc.hashCode());
+ result = prime * result
+ + ((methodName == null) ? 0 : methodName.hashCode());
+ return result;
+ }
+
+ @SuppressWarnings("PMD")
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ MethodId other = (MethodId) obj;
+ if (desc == null) {
+ if (other.desc != null)
+ return false;
+ } else if (!desc.equals(other.desc))
+ return false;
+ if (methodName == null) {
+ if (other.methodName != null)
+ return false;
+ } else if (!methodName.equals(other.methodName))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("MethodId [methodName=");
+ builder.append(methodName);
+ builder.append(", desc=");
+ builder.append(desc);
+ builder.append("]");
+ return builder.toString();
+ }
+}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -196,4 +196,8 @@
protected String mnemonic() {
return OPCODE_INTERPRETER.mnemonic(opcode);
}
+
+ public boolean isOwnedMethodCallOfOtherInstance() {
+ return false;
+ }
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNodeMethod.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNodeMethod.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNodeMethod.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -33,19 +33,57 @@
@NotStorableClass
public class OpcodeNodeMethod extends OpcodeNode {
+ private final String className;
+
+ private final String methodName;
+
private final String desc;
+ private final boolean ownedMethodCall;
+
+ private boolean ownedMethodCallOfOtherInstance;
+
public OpcodeNodeMethod(final int opcode, final int address,
final int lineNumber, final OpcodeNode previousOpcode,
- final String desc) {
+ final boolean ownedMethodCall, final String className,
+ final String methodName, final String desc) {
super(opcode, address, lineNumber, previousOpcode);
+ this.ownedMethodCall = ownedMethodCall;
+ this.className = className;
+ this.methodName = methodName;
this.desc = desc;
}
@Override
protected StackElement interprete(final StackElement currentStackElement)
throws EnhanceException {
- return OPCODE_INTERPRETER.interpreteInvoke(opcode, desc,
- currentStackElement);
+ final StackElement pointer = OPCODE_INTERPRETER.interpreteInvoke(
+ opcode, ownedMethodCall, desc, currentStackElement);
+ if (!OPCODE_INTERPRETER.isInternalCall()) {
+ ownedMethodCallOfOtherInstance = true;
+ }
+ return pointer;
}
+
+ @Override
+ public boolean isOwnedMethodCallOfOtherInstance() {
+ return ownedMethodCallOfOtherInstance;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " " + methodName + " " + desc;
+ }
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -245,11 +245,11 @@
void setForceEnhance(String objectClassName);
- void addNotCheckedMethod(Method method);
+ void addToNotCheckMethod(Method method);
- void addNotCheckedMethod(Constructor<?> constructor);
+ void addToNotCheckMethod(Constructor<?> constructor);
- void addNotCheckedMethod(String objectClassName, String absoluteMethodName);
+ void addToNotCheckMethod(String objectClassName, String absoluteMethodName);
/**
* set object input output manager for a class<br>
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -661,36 +661,39 @@
}
}
- public void addNotCheckedMethod(final Class<?> clazz) {
+ public void addToNotCheckMethod(final Class<?> clazz) {
final Constructor<?>[] constructors = clazz.getDeclaredConstructors();
for (Constructor<?> constructor : constructors) {
- addNotCheckedMethod(constructor);
+ addToNotCheckMethod(constructor);
}
final Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
- addNotCheckedMethod(method);
+ addToNotCheckMethod(method);
}
}
- public void addNotCheckedMethod(final Method method) {
+ @Override
+ public void addToNotCheckMethod(final Method method) {
final String className = method.getDeclaringClass().getName();
final String methodName = method.getName();
final String methodDescriptor = Type.getMethodDescriptor(method);
- addNotCheckedMethod(className, className + "#" + methodName
+ addToNotCheckMethod(className, className + "#" + methodName
+ methodDescriptor);
}
- public void addNotCheckedMethod(final Constructor<?> constructor) {
+ @Override
+ public void addToNotCheckMethod(final Constructor<?> constructor) {
final String className = constructor.getDeclaringClass().getName();
final String methodDescriptor = Type
.getConstructorDescriptor(constructor);
- addNotCheckedMethod(className, className + "#<init>" + methodDescriptor);
+ addToNotCheckMethod(className, className + "#<init>" + methodDescriptor);
}
- public void addNotCheckedMethod(final String objectClassName,
+ @Override
+ public void addToNotCheckMethod(final String objectClassName,
final String absoluteMethodName) {
synchronized (mutex) {
- classInfoFactory.addNotCheckedMethod(objectClassName,
+ classInfoFactory.addToNotCheckMethod(objectClassName,
absoluteMethodName);
}
}
Copied: trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodListener.java (from rev 2947, trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/CheckMethodListener.java)
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodListener.java (rev 0)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodListener.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * 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 net.sf.joafip.store.service.bytecode.proxy;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.store.entity.proxy.DirectAccessInfo;
+import net.sf.joafip.store.entity.proxy.MethodId;
+import net.sf.joafip.store.entity.proxy.OpcodeNode;
+import net.sf.joafip.store.entity.proxy.OpcodeNodeMethod;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+public class CheckMethodListener implements ICheckMethodListener {
+
+ private final Set<DirectAccessInfo> directAccessSet = new TreeSet<DirectAccessInfo>();
+
+ private final Map<String, List<OpcodeNode>> codeOfMethod = new TreeMap<String, List<OpcodeNode>>();
+
+ private final Set<String> fullyVisitedMethodSet = new TreeSet<String>();
+
+ private final List<OpcodeNodeMethod> ownedMethodCallOfOtherInstanceList = new LinkedList<OpcodeNodeMethod>();
+
+ private final Set<MethodId> privateMethodSet = new TreeSet<MethodId>();
+
+ private transient List<OpcodeNode> opcodeList;
+
+ @Override
+ public void directAccess(final DirectAccessInfo directAccessInfo) {
+ directAccessSet.add(directAccessInfo);
+ }
+
+ public boolean hasDirectAccess() {
+ return true ^ directAccessSet.isEmpty();
+ }
+
+ public Set<DirectAccessInfo> getDirectAccessSet() {
+ return directAccessSet;
+ }
+
+ @Override
+ public void beginVisit(final String methodAbsoluteName) {
+ opcodeList = new LinkedList<OpcodeNode>();
+ codeOfMethod.put(methodAbsoluteName, opcodeList);
+ }
+
+ @Override
+ public void currentOpcode(final OpcodeNode currentOpcodeNode) {
+ opcodeList.add(currentOpcodeNode);
+ }
+
+ @Override
+ public void codeVisisted(final String methodAbsoluteName) {
+ fullyVisitedMethodSet.add(methodAbsoluteName);
+ }
+
+ @Override
+ public void endVisit(final String methodAbsoluteName) {
+ // no implementation
+ }
+
+ @Override
+ public void addOwnedMethodCallOfOtherInstance(
+ final OpcodeNodeMethod currentOpcodeNode) {
+ ownedMethodCallOfOtherInstanceList.add(currentOpcodeNode);
+ }
+
+ public void addPrivateMethodName(final String methodName, final String desc) {
+ privateMethodSet.add(new MethodId(methodName, desc));
+ }
+
+ public List<OpcodeNodeMethod> getOtherInstancePrivateCallList() {
+ final List<OpcodeNodeMethod> list = new LinkedList<OpcodeNodeMethod>();
+ for (OpcodeNodeMethod opcodeNodeMethod : ownedMethodCallOfOtherInstanceList) {
+ final MethodId key =
+ /**/new MethodId(opcodeNodeMethod.getMethodName(),// NOPMD
+ opcodeNodeMethod.getDesc());
+ if (privateMethodSet.contains(key)) {
+ list.add(opcodeNodeMethod);
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public String unassembled(final String methodAbsoluteName) {
+ final StringBuilder stringBuilder = new StringBuilder();
+ final List<OpcodeNode> list = codeOfMethod.get(methodAbsoluteName);
+ unassembled(methodAbsoluteName, list, stringBuilder);
+ return stringBuilder.toString();
+ }
+
+ public String unassembled() {
+ final StringBuilder stringBuilder = new StringBuilder();
+ for (Map.Entry<String, List<OpcodeNode>> entry : codeOfMethod
+ .entrySet()) {
+ final String methodAbsoluteName = entry.getKey();
+ final List<OpcodeNode> list = entry.getValue();
+ unassembled(methodAbsoluteName, list, stringBuilder);
+ }
+ return stringBuilder.toString();
+ }
+
+ private void unassembled(final String methodAbsoluteName,
+ final List<OpcodeNode> list, final StringBuilder stringBuilder) {
+ stringBuilder.append(methodAbsoluteName);
+ stringBuilder.append('\n');
+ if (list == null) {
+ stringBuilder.append("has not the code ...");
+ } else {
+ for (OpcodeNode opcodeNode : list) {
+ stringBuilder.append(opcodeNode.toString());
+ stringBuilder.append('\n');
+ }
+ if (!fullyVisitedMethodSet.contains(methodAbsoluteName)) {
+ stringBuilder.append("ending code not available\n");
+ }
+ }
+ stringBuilder.append('\n');
+ }
+}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -90,12 +90,15 @@
private transient Set<Label> handlerEntrySet;
+ private final String className;
+
private final String methodAbsoluteName;
public CheckMethodVisitor(final ICheckMethodListener listener,
- final String methodAbsoluteName) {
+ final String className, final String methodAbsoluteName) {
super();
this.listener = listener;
+ this.className = className;
this.methodAbsoluteName = methodAbsoluteName;
}
@@ -169,7 +172,9 @@
listener.currentOpcode(currentOpcodeNode);
currentOpcodeNode.setBeforeExecutionStackElement(stackElement);
stackElement = currentOpcodeNode.interprete();
-
+ if (currentOpcodeNode.isOwnedMethodCallOfOtherInstance()) {
+ listener.addOwnedMethodCallOfOtherInstance((OpcodeNodeMethod) currentOpcodeNode);
+ }
if (currentOpcodeNode.isDirectAccess()) {
notifyDirectAccess(currentOpcodeNode);
}
@@ -287,8 +292,11 @@
@Override
public void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc) {
+ final boolean ownedMethodCall = owner.replace('/', '.').equals(
+ className);
currentOpcodeNode = new OpcodeNodeMethod(opcode, currentAddress++,
- currentLineNumber, currentOpcodeNode, desc);
+ currentLineNumber, currentOpcodeNode, ownedMethodCall,
+ className, name, desc);
opcodeByLabelUpdate();
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ClassConstraintChecker.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ClassConstraintChecker.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ClassConstraintChecker.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -25,6 +25,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -38,10 +39,10 @@
import net.sf.joafip.asm.Opcodes;
import net.sf.joafip.service.ClassLoaderProvider;
import net.sf.joafip.store.entity.proxy.DirectAccessInfo;
+import net.sf.joafip.store.entity.proxy.OpcodeNodeMethod;
import net.sf.joafip.store.service.bytecode.EnhanceException;
import net.sf.joafip.store.service.classinfo.ClassInfoException;
import net.sf.joafip.store.service.classinfo.ClassInfoFactory;
-import net.sf.joafip.store.service.proxy.CheckMethodListener;
/**
*
@@ -61,7 +62,7 @@
private transient CheckMethodListener checkMethodListener;
- private transient Set<String> notCheckedMethod;
+ private transient Set<String> toNotCheckMethodSet;
public static ClassConstraintChecker getInstance() {
return INSTANCE;
@@ -86,8 +87,8 @@
while (currentClassName != null && checkedSet.add(currentClassName)) {
// while (!Object.class.getName().equals(currentClassName)) {
try {
- notCheckedMethod = classInfoFactory
- .getNotCheckedMethod(currentClassName);
+ toNotCheckMethodSet = classInfoFactory
+ .getToNotCheckMethodSet(currentClassName);
checkCurrentClass();
currentClassName = classInfoFactory
.superClassName(currentClassName);
@@ -97,27 +98,48 @@
throw new EnhanceException(exception);
}
}
- if (checkMethodListener.hasDirectAccess()) {
+
+ final List<OpcodeNodeMethod> list = checkMethodListener
+ .getOtherInstancePrivateCallList();
+ if (checkMethodListener.hasDirectAccess() || !list.isEmpty()) {
final StringBuilder stringBuilder = new StringBuilder();
- stringBuilder.append("direct field access:\n");
- // String previousMethodAbsoluteName = null;
- for (DirectAccessInfo directAccessInfo : checkMethodListener
- .getDirectAccessSet()) {
- stringBuilder.append(directAccessInfo.toString());
+ stringBuilder.append('\n');
+ if (!list.isEmpty()) {
+ stringBuilder.append("private method call:\n");
+ for (OpcodeNodeMethod opcodeNodeMethod : list) {
+ stringBuilder.append(opcodeNodeMethod.getClassName());
+ stringBuilder.append('#');
+ stringBuilder.append(opcodeNodeMethod.getMethodName());
+ stringBuilder.append(' ');
+ stringBuilder.append(opcodeNodeMethod.getDesc());
+ stringBuilder.append(" line ");
+ stringBuilder.append(opcodeNodeMethod.getLineNumber());
+ stringBuilder.append('\n');
+ }
+ }
+
+ if (checkMethodListener.hasDirectAccess()) {
+ stringBuilder.append("direct field access:\n");
+ // String previousMethodAbsoluteName = null;
+ for (DirectAccessInfo directAccessInfo : checkMethodListener
+ .getDirectAccessSet()) {
+ stringBuilder.append(directAccessInfo.toString());
+ stringBuilder.append('\n');
+ // if (previousMethodAbsoluteName != null
+ // && !previousMethodAbsoluteName.equals(directAccessInfo
+ // .getMethodAbsoluteName())) {
+ // stringBuilder.append(checkMethodListener
+ // .unassembled(directAccessInfo
+ // .getMethodAbsoluteName()));
+ // }
+ // previousMethodAbsoluteName = directAccessInfo
+ // .getMethodAbsoluteName();
+ }
+ // stringBuilder.append(checkMethodListener
+ // .unassembled(previousMethodAbsoluteName));
stringBuilder.append('\n');
- // if (previousMethodAbsoluteName != null
- // && !previousMethodAbsoluteName.equals(directAccessInfo
- // .getMethodAbsoluteName())) {
- // stringBuilder.append(checkMethodListener
- // .unassembled(directAccessInfo
- // .getMethodAbsoluteName()));
- // }
- // previousMethodAbsoluteName = directAccessInfo
- // .getMethodAbsoluteName();
}
- // stringBuilder.append(checkMethodListener
- // .unassembled(previousMethodAbsoluteName));
- stringBuilder.append('\n');
+
throw new EnhanceException(stringBuilder.toString());
}
}
@@ -164,12 +186,16 @@
@Override
public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
+ if ((access & Opcodes.ACC_PRIVATE) == Opcodes.ACC_PRIVATE
+ && !"<init>".equals(name)) {
+ checkMethodListener.addPrivateMethodName(name, desc);
+ }
final String methodAbsoluteName = currentClassName + "#" + name + desc;
final CheckMethodVisitor visitor;
if ((access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE)) == 0
- && !notCheckedMethod.contains(methodAbsoluteName)) {
+ && !toNotCheckMethodSet.contains(methodAbsoluteName)) {
visitor = new CheckMethodVisitor(checkMethodListener,
- methodAbsoluteName);
+ currentClassName, methodAbsoluteName);
} else {
visitor = null;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ICheckMethodListener.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ICheckMethodListener.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ICheckMethodListener.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -24,6 +24,7 @@
import net.sf.joafip.store.entity.proxy.DirectAccessInfo;
import net.sf.joafip.store.entity.proxy.OpcodeNode;
+import net.sf.joafip.store.entity.proxy.OpcodeNodeMethod;
/**
*
@@ -50,4 +51,6 @@
void directAccess(DirectAccessInfo directAccessInfo);
+ void addOwnedMethodCallOfOtherInstance(OpcodeNodeMethod currentOpcodeNode);
+
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/OpcodeInterpreter.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/OpcodeInterpreter.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/OpcodeInterpreter.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -609,6 +609,8 @@
return INSTANCE;
}
+ private boolean internalCall;
+
private OpcodeInterpreter() {
super();
}
@@ -1040,7 +1042,8 @@
return pop(currentStackElement, type);
}
- public StackElement interpreteInvoke(final int opcode, final String desc,
+ public StackElement interpreteInvoke(final int opcode,
+ final boolean ownedMethodCall, final String desc,
final StackElement currentStackElement) throws EnhanceException {
// INVOKEVIRTUAL
// ..., objectref, [arg1, [arg2 ...]] ...
@@ -1057,11 +1060,14 @@
for (int index = types.length - 1; index >= 0; index--) {
pointer = pop(pointer, typeFromAsmType(types[index]));
}
- if (opcode != Opcodes.INVOKESTATIC) {
+ if (opcode == Opcodes.INVOKESTATIC) {
+ internalCall = true;
+ } else {
if (!EnumStackEltType.REF.equals(pointer.getType())) {
throw new EnhanceException("bad type " + pointer.getType()
+ " for opcode " + opcode);
}
+ internalCall = !ownedMethodCall || pointer.isThisReference();
pointer = pop(pointer);
}
final Type returnType = Type.getReturnType(desc);
@@ -1071,6 +1077,10 @@
return pointer;
}
+ public boolean isInternalCall() {
+ return internalCall;
+ }
+
public StackElement multiANewArray(final int dims,
final StackElement currentStackElement) throws EnhanceException {
// ..., count1, [count2, ...] => ..., arrayref
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -385,10 +385,10 @@
classInfo.setForceEnhance();
}
- final Set<String> notCheckedMethodSet = classInfoAttributes
- .getNotCheckedMethodSet();
- for (String absoluteMethodName : notCheckedMethodSet) {
- classInfo.addNotCheckedMethod(absoluteMethodName);
+ final Set<String> toNotCheckMethodSet = classInfoAttributes
+ .getToNotCheckMethodSet();
+ for (String absoluteMethodName : toNotCheckMethodSet) {
+ classInfo.addToNotCheckMethod(absoluteMethodName);
}
if (classInfoAttributes.haveSubstituteObjectManager()) {
@@ -430,21 +430,21 @@
}
@Override
- public void addNotCheckedMethod(final String objectClassName,
+ public void addToNotCheckMethod(final String objectClassName,
final String absoluteMethodName) {
final ClassInfo classInfo = classInfoMap.get(objectClassName);
if (classInfo == null) {
final ClassInfoAttributes classInfoAttributes = getOrCreateClassInfoAttribute(objectClassName);
- classInfoAttributes.addNotCheckedMethod(absoluteMethodName);
+ classInfoAttributes.addToNotCheckMethod(absoluteMethodName);
} else {
- classInfo.addNotCheckedMethod(absoluteMethodName);
+ classInfo.addToNotCheckMethod(absoluteMethodName);
}
}
- public Set<String> getNotCheckedMethod(final String className)
+ public Set<String> getToNotCheckMethodSet(final String className)
throws ClassInfoException, ClassNotFoundException {
final ClassInfo classInfo = getClassInfo(className);
- return classInfo.getNotCheckedMethod();
+ return classInfo.getToNotCheckMethodSet();
}
@Override
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -74,7 +74,7 @@
void setForceEnhance(String objectClassName);
- void addNotCheckedMethod(String objectClassName, String absoluteMethodName);
+ void addToNotCheckMethod(String objectClassName, String absoluteMethodName);
void setNoLazyLoad(String objectClassName);
Deleted: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/CheckMethodListener.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/CheckMethodListener.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/CheckMethodListener.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -1,123 +0,0 @@
-/*
- * Copyright 2011 Luc Peuvrier
- *
- * This file is a part of JOAFIP.
- *
- * JOAFIP is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License.
- *
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
- * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
- *
- * JOAFIP is distributed in the hope that it will be useful, but
- * 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 net.sf.joafip.store.service.proxy;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import net.sf.joafip.NotStorableClass;
-import net.sf.joafip.store.entity.proxy.DirectAccessInfo;
-import net.sf.joafip.store.entity.proxy.OpcodeNode;
-import net.sf.joafip.store.service.bytecode.proxy.ICheckMethodListener;
-
-/**
- *
- * @author luc peuvrier
- *
- */
-@NotStorableClass
-public class CheckMethodListener implements ICheckMethodListener {
-
- private final Set<DirectAccessInfo> directAccessSet = new TreeSet<DirectAccessInfo>();
-
- private final Map<String, List<OpcodeNode>> codeOfMethod = new TreeMap<String, List<OpcodeNode>>();
-
- private final Set<String> fullyVisitedMethodSet = new TreeSet<String>();
-
- private transient List<OpcodeNode> opcodeList;
-
- @Override
- public void directAccess(final DirectAccessInfo directAccessInfo) {
- directAccessSet.add(directAccessInfo);
- }
-
- public boolean hasDirectAccess() {
- return true ^ directAccessSet.isEmpty();
- }
-
- public Set<DirectAccessInfo> getDirectAccessSet() {
- return directAccessSet;
- }
-
- @Override
- public void beginVisit(final String methodAbsoluteName) {
- opcodeList = new LinkedList<OpcodeNode>();
- codeOfMethod.put(methodAbsoluteName, opcodeList);
- }
-
- @Override
- public void currentOpcode(final OpcodeNode currentOpcodeNode) {
- opcodeList.add(currentOpcodeNode);
- }
-
- @Override
- public void codeVisisted(final String methodAbsoluteName) {
- fullyVisitedMethodSet.add(methodAbsoluteName);
- }
-
- @Override
- public void endVisit(final String methodAbsoluteName) {
- // no implementation
- }
-
- @Override
- public String unassembled(final String methodAbsoluteName) {
- final StringBuilder stringBuilder = new StringBuilder();
- final List<OpcodeNode> list = codeOfMethod.get(methodAbsoluteName);
- unassembled(methodAbsoluteName, list, stringBuilder);
- return stringBuilder.toString();
- }
-
- public String unassembled() {
- final StringBuilder stringBuilder = new StringBuilder();
- for (Map.Entry<String, List<OpcodeNode>> entry : codeOfMethod
- .entrySet()) {
- final String methodAbsoluteName = entry.getKey();
- final List<OpcodeNode> list = entry.getValue();
- unassembled(methodAbsoluteName, list, stringBuilder);
- }
- return stringBuilder.toString();
- }
-
- private void unassembled(final String methodAbsoluteName,
- final List<OpcodeNode> list, final StringBuilder stringBuilder) {
- stringBuilder.append(methodAbsoluteName);
- stringBuilder.append('\n');
- if (list == null) {
- stringBuilder.append("has not the code ...");
- } else {
- for (OpcodeNode opcodeNode : list) {
- stringBuilder.append(opcodeNode.toString());
- stringBuilder.append('\n');
- }
- if (!fullyVisitedMethodSet.contains(methodAbsoluteName)) {
- stringBuilder.append("ending code not available\n");
- }
- }
- stringBuilder.append('\n');
- }
-}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -280,10 +280,11 @@
if (constructed) {
assert getProxyCallBack(instanceCreated) != NULL_PROXY_CALL_BACK_INSTANCE;
- //FIXMELUC ___________unweak needed ?
+ // FIXMELUC ___________unweak needed ?
assert objectAndPersistInfo.isNotWeak();
- //objectAndPersistInfo.unWeakReferenceOnObject();
- // out of constructor, no more acceded, to do before set is loaded
+ // objectAndPersistInfo.unWeakReferenceOnObject();
+ // out of constructor, no more acceded, to do before set is
+ // loaded
objectAndPersistInfo.acceded = false;
// set is loaded is last operation for auto save
setIsLoaded(instanceCreated);
Added: trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Element.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Element.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Element.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * 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 net.sf.joafip.entity.rel400;
+
+import java.util.Collections;
+import java.util.List;
+
+import net.sf.joafip.StorableClass;
+import net.sf.joafip.java.util.PArrayList;
+import net.sf.joafip.store.service.proxy.IInstanceFactory;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@StorableClass
+public class Element {
+
+ private List<String> additionalNamespaces;
+
+ private final IInstanceFactory instanceFactory;
+
+ public Element(final IInstanceFactory instanceFactory) {
+ super();
+ this.instanceFactory = instanceFactory;
+ }
+
+ public static Element newInstance(final IInstanceFactory instanceFactory) {
+ final Element element;
+ if (instanceFactory == null) {
+ element = new Element(instanceFactory);
+ } else {
+ element = (Element) instanceFactory.newInstance(Element.class,
+ new Class<?>[] { IInstanceFactory.class },
+ new Object[] { instanceFactory });
+ }
+ return element;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addNameSpace(final String nameSpace) {
+ if (additionalNamespaces == null) {
+ additionalNamespaces = PArrayList.newInstance(instanceFactory);
+ }
+ additionalNamespaces.add(nameSpace);
+ }
+
+ // can not be private, see clone
+ protected void setAdditionalNamespaces(
+ final List<String> additionalNamespaces) {
+ this.additionalNamespaces = additionalNamespaces;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<String> getAdditionalNamespacesList() {
+ List<String> list;
+ if (additionalNamespaces == null) {
+ list = Collections.EMPTY_LIST;
+ } else {
+ list = Collections.unmodifiableList(additionalNamespaces);
+ }
+ return list;
+ }
+
+ public List<String> getAdditionalNamespaces() {
+ return additionalNamespaces;
+ }
+
+ @SuppressWarnings({ "unchecked", "PMD" })
+ @Override
+ public Element clone() {
+ final Element element = Element.newInstance(instanceFactory);
+ if (additionalNamespaces != null) {
+ // setAdditionalNamespaces protected to intercept for load
+ element.setAdditionalNamespaces(PArrayList.newInstance(
+ instanceFactory, additionalNamespaces));
+ }
+ return element;
+ }
+}
Added: trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/ElementKo.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/ElementKo.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/ElementKo.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * 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 net.sf.joafip.entity.rel400;
+
+import java.util.Collections;
+import java.util.List;
+
+import net.sf.joafip.StorableClass;
+import net.sf.joafip.java.util.PArrayList;
+import net.sf.joafip.store.service.proxy.IInstanceFactory;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@StorableClass
+public class ElementKo {
+
+ private List<String> additionalNamespaces;
+
+ private final IInstanceFactory instanceFactory;
+
+ public ElementKo(final IInstanceFactory instanceFactory) {
+ super();
+ this.instanceFactory = instanceFactory;
+ }
+
+ public static ElementKo newInstance(final IInstanceFactory instanceFactory) {
+ final ElementKo element;
+ if (instanceFactory == null) {
+ element = new ElementKo(instanceFactory);
+ } else {
+ element = (ElementKo) instanceFactory.newInstance(ElementKo.class,
+ new Class<?>[] { IInstanceFactory.class },
+ new Object[] { instanceFactory });
+ }
+ return element;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addNameSpace(final String nameSpace) {
+ if (additionalNamespaces == null) {
+ additionalNamespaces = PArrayList.newInstance(instanceFactory);
+ }
+ additionalNamespaces.add(nameSpace);
+ }
+
+ // private to check class enhancement verification
+ private void setAdditionalNamespaces(final List<String> additionalNamespaces) {
+ this.additionalNamespaces = additionalNamespaces;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<String> getAdditionalNamespacesList() {
+ List<String> list;
+ if (additionalNamespaces == null) {
+ list = Collections.EMPTY_LIST;
+ } else {
+ list = Collections.unmodifiableList(additionalNamespaces);
+ }
+ return list;
+ }
+
+ public List<String> getAdditionalNamespaces() {
+ return additionalNamespaces;
+ }
+
+ @SuppressWarnings({ "unchecked", "PMD" })
+ @Override
+ public ElementKo clone() {
+ final ElementKo element = ElementKo.newInstance(instanceFactory);
+ if (additionalNamespaces != null) {
+ // the call of setAdditionalNamespaces private method is a problem
+ // for persistence
+ element.setAdditionalNamespaces(PArrayList.newInstance(
+ instanceFactory, additionalNamespaces));
+ }
+ return element;
+ }
+}
Added: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPHashMapNewInstance.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPHashMapNewInstance.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPHashMapNewInstance.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * 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 net.sf.joafip.service.rel400;
+
+import net.sf.joafip.AbstractDeleteFileTestCase;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.StorableAccess;
+import net.sf.joafip.TestConstant;
+import net.sf.joafip.TestException;
+import net.sf.joafip.java.util.PHashMap;
+import net.sf.joafip.reflect.HelperReflect;
+import net.sf.joafip.reflect.ReflectException;
+import net.sf.joafip.service.FilePersistenceBuilder;
+import net.sf.joafip.service.FilePersistenceClassNotFoundException;
+import net.sf.joafip.service.FilePersistenceDataCorruptedException;
+import net.sf.joafip.service.FilePersistenceException;
+import net.sf.joafip.service.FilePersistenceInvalidClassException;
+import net.sf.joafip.service.FilePersistenceNotSerializableException;
+import net.sf.joafip.service.FilePersistenceRuntimeException;
+import net.sf.joafip.service.FilePersistenceTooBigForSerializationException;
+import net.sf.joafip.service.IExclusiveDataAccessSession;
+import net.sf.joafip.service.IFilePersistence;
+import net.sf.joafip.store.service.proxy.IInstanceFactory;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+@StorableAccess
+public class TestPHashMapNewInstance extends AbstractDeleteFileTestCase
+ implements IInstanceFactory {
+
+ public TestPHashMapNewInstance() throws TestException {
+ super();
+ }
+
+ public TestPHashMapNewInstance(final String name) throws TestException {
+ super(name);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testNoProxy() {
+ final PHashMap map = PHashMap.newInstance(this);
+ assertNotNull("must succeed create an iterator", map.keySet()
+ .iterator());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testWithProxy() throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException, TestException,
+ FilePersistenceTooBigForSerializationException {
+ final FilePersistenceBuilder builder = new FilePersistenceBuilder();
+ builder.setPathName(TestConstant.getWinRamDiskRuntimeDir());
+ builder.setProxyMode(true);
+ final IFilePersistence filePersistence = builder.build();
+ final IExclusiveDataAccessSession session = filePersistence
+ .createExclusiveDataAccessSession();
+ final IInstanceFactory instancefactory = session.getInstanceFactory();
+ session.open();
+ final PHashMap map = PHashMap.newInstance(instancefactory);
+ assertNotNull("must succeed create an iterator", map.keySet()
+ .iterator());
+ session.close();
+ filePersistence.close();
+ }
+
+ @Override
+ public Object newInstance(final Class<?> objectClass,
+ final Class<?>[] parameterTypes, final Object[] initargs) {
+ try {
+ return HelperReflect.getInstance().newInstanceConstruct(
+ objectClass, parameterTypes, initargs);
+ } catch (ReflectException exception) {
+ throw new FilePersistenceRuntimeException(exception);
+ }
+ }
+
+ @Override
+ public Object newInstance(final Class<?> objectClass) {
+ try {
+ return HelperReflect.getInstance().newInstanceDefaultConstructor(
+ objectClass);
+ } catch (ReflectException exception) {
+ throw new FilePersistenceRuntimeException(exception);
+ }
+ }
+}
Added: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPrivateAccess.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPrivateAccess.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPrivateAccess.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (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.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * 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 net.sf.joafip.service.rel400;
+
+import java.util.List;
+
+import net.sf.joafip.AbstractDeleteFileTestCase;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.StorableAccess;
+import net.sf.joafip.TestConstant;
+import net.sf.joafip.TestException;
+import net.sf.joafip.entity.rel400.Element;
+import net.sf.joafip.entity.rel400.ElementKo;
+import net.sf.joafip.service.FilePersistenceBuilder;
+import net.sf.joafip.service.FilePersistenceClassNotFoundException;
+import net.sf.joafip.service.FilePersistenceDataCorruptedException;
+import net.sf.joafip.service.FilePersistenceException;
+import net.sf.joafip.service.FilePersistenceInvalidClassException;
+import net.sf.joafip.service.FilePersistenceNotSerializableException;
+import net.sf.joafip.service.FilePersistenceTooBigForSerializationException;
+import net.sf.joafip.service.IExclusiveDataAccessSession;
+import net.sf.joafip.service.IFilePersistence;
+import net.sf.joafip.store.service.bytecode.EnhanceException;
+import net.sf.joafip.store.service.proxy.IInstanceFactory;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+@StorableAccess
+public class TestPrivateAccess extends AbstractDeleteFileTestCase {
+
+ private static final String BAD_CONTENT = "bad content";
+ private static final String HELLO = "hello";
+
+ public TestPrivateAccess() throws TestException {
+ super();
+ }
+
+ public TestPrivateAccess(final String name) throws TestException {
+ super(name);
+ }
+
+ public void testOkClass() throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceTooBigForSerializationException, TestException {
+ final FilePersistenceBuilder builder = new FilePersistenceBuilder();
+ builder.setPathName(TestConstant.getWinRamDiskRuntimeDir());
+ builder.setProxyMode(true);
+ final IFilePersistence filePersistence = builder.build();
+ filePersistence.setAutoSaveEnabled(true);
+ // 0 for immediate saving
+ filePersistence.autoSaveSetup(0);
+ final IExclusiveDataAccessSession session = filePersistence
+ .createExclusiveDataAccessSession();
+ session.open();
+ final IInstanceFactory instanceFactory = session.getInstanceFactory();
+
+ final Element element = Element.newInstance(instanceFactory);
+ element.addNameSpace(HELLO);
+ final Element clone = element.clone();
+ List<String> list = clone.getAdditionalNamespaces();
+ assertEquals(BAD_CONTENT, HELLO, list.get(0));
+ list = clone.getAdditionalNamespacesList();
+ assertEquals(BAD_CONTENT, HELLO, list.get(0));
+
+ session.close();
+ filePersistence.close();
+ }
+
+ public void testKoClass() throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceTooBigForSerializationException, TestException {
+ final FilePersistenceBuilder builder = new FilePersistenceBuilder();
+ builder.setPathName(TestConstant.getWinRamDiskRuntimeDir());
+ builder.setProxyMode(true);
+ final IFilePersistence filePersistence = builder.build();
+ filePersistence.setAutoSaveEnabled(true);
+ // 0 for immediate saving
+ filePersistence.autoSaveSetup(0);
+ final IExclusiveDataAccessSession session = filePersistence
+ .createExclusiveDataAccessSession();
+ session.open();
+ final IInstanceFactory instanceFactory = session.getInstanceFactory();
+
+ try {
+ ElementKo.newInstance(instanceFactory);
+ fail("must fail because of method ElementKo#setAdditionnalNamespaces");
+ } catch (Exception exception) {
+ Throwable current = exception;
+ while (current != null
+ && !EnhanceException.class.equals(current.getClass())) {
+ current = current.getCause();
+ }
+ if (current == null) {
+ fail("EnhanceException expected");
+ }
+ }
+
+ // element.addNameSpace(HELLO);
+ // final ElementKo clone = element.clone();
+ //
+ // List<String> list = clone.getAdditionalNamespaces();
+ // assertEquals(BAD_CONTENT, HELLO, list.get(0));
+ // list = clone.getAdditionalNamespacesList();
+ // assertEquals(BAD_CONTENT, HELLO, list.get(0));
+
+ session.close();
+ filePersistence.close();
+ }
+}
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestObjectReferenceLink.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestObjectReferenceLink.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestObjectReferenceLink.java 2011-10-29 16:17:34 UTC (rev 2951)
@@ -83,6 +83,7 @@
StoreDataCorruptedException, ObjectIOClassNotFoundException,
ObjectIODataCorruptedException, HeapException,
StoreTooBigForSerializationException {
+ store.addToNotCheckMethod(Bob1.class);
Bob1 bob1 = new Bob1();
store.setRoot(bob1);
store.save(true, false);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java 2011-10-28 03:28:45 UTC (rev 2950)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.ja...
[truncated message content] |
|
From: <luc...@us...> - 2011-10-29 16:17:41
|
Revision: 2951
http://joafip.svn.sourceforge.net/joafip/?rev=2951&view=rev
Author: luc_peuvrier
Date: 2011-10-29 16:17:34 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
add byte code check for prsistence constraints
Modified Paths:
--------------
trunk/joafip/doc/_todo.txt
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfoAttributes.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNodeMethod.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ClassConstraintChecker.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/ICheckMethodListener.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/OpcodeInterpreter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestObjectReferenceLink.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ForTestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/TestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionArrayListNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashMapNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashSetNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashSetNosubsWithG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionHashTableNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionLinkedHashSetNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionLinkedHashSetNosubsWithG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionLinkedListNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTreeMapNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTreeSetNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTreeSetNosubsWithG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionTroveHashMapNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/nosubs/TestStoreCollectionVectorNosubsNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/collection/subs/TestStoreCollectionTreeMapSubsNoG.java
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PHashMapEntrySet.java
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PHashMapKeySet.java
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/support/tree/TreeSupport.java
trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java
trunk/joafip-testsuite/src/main/java/net/sf/joafip/service/rel400/ServiceRel400Tests.java
Added Paths:
-----------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/MethodId.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodListener.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Element.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/ElementKo.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPHashMapNewInstance.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestPrivateAccess.java
Removed Paths:
-------------
trunk/joafip/doc/current.txt
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/CheckMethodListener.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:28:51
|
Revision: 2950
http://joafip.svn.sourceforge.net/joafip/?rev=2950&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:28:45 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
PSubList marked storable
Modified Paths:
--------------
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PSubList.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:28:51
|
Revision: 2950
http://joafip.svn.sourceforge.net/joafip/?rev=2950&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:28:45 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
PSubList marked storable
Modified Paths:
--------------
trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PSubList.java
Modified: trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PSubList.java
===================================================================
--- trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PSubList.java 2011-10-28 03:19:25 UTC (rev 2949)
+++ trunk/joafip-collection/src/main/java/net/sf/joafip/java/util/PSubList.java 2011-10-28 03:28:45 UTC (rev 2950)
@@ -28,6 +28,7 @@
import java.util.ListIterator;
import java.util.NoSuchElementException;
+import net.sf.joafip.StorableClass;
import net.sf.joafip.store.service.proxy.IInstanceFactory;
/**
@@ -36,6 +37,7 @@
*
* @param <E>
*/
+@StorableClass
public class PSubList<E> extends PAbstractList<E> {
private static final String UNCHECKED = "unchecked";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:19:32
|
Revision: 2949
http://joafip.svn.sourceforge.net/joafip/?rev=2949&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:19:25 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
acceded flag management changed for new instance construct
Modified Paths:
--------------
trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:19:32
|
Revision: 2949
http://joafip.svn.sourceforge.net/joafip/?rev=2949&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:19:25 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
acceded flag management changed for new instance construct
Modified Paths:
--------------
trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java
Modified: trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java
===================================================================
--- trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java 2011-10-28 03:19:01 UTC (rev 2948)
+++ trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java 2011-10-28 03:19:25 UTC (rev 2949)
@@ -24,10 +24,10 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import net.sf.joafip.service.rel300.TestSubstitutionWithMethodInterception0;
+import net.sf.joafip.service.rel300.TestSubstitutionWithMethodInterception1;
+import net.sf.joafip.service.rel300.TestSubstitutionWithMethodInterception2;
import net.sf.joafip.service.rel400.TestAutoSave;
-import net.sf.joafip.service.rel400.TestRuntime310Garbage;
-import net.sf.joafip.store.service.proxy.TestProxyCreation;
-import net.sf.joafip.store.service.proxy.TestProxyCreationConstructed;
/**
*
@@ -44,9 +44,9 @@
public static Test suite() {
final TestSuite suite = new TestSuite("in error Tests");
// $JUnit-BEGIN$
- suite.addTestSuite(TestProxyCreation.class);
- suite.addTestSuite(TestProxyCreationConstructed.class);
- suite.addTestSuite(TestRuntime310Garbage.class);
+ suite.addTestSuite(TestSubstitutionWithMethodInterception0.class);
+ suite.addTestSuite(TestSubstitutionWithMethodInterception1.class);
+ suite.addTestSuite(TestSubstitutionWithMethodInterception2.class);
suite.addTestSuite(TestAutoSave.class);
// suite.addTest(xxxx.suite());
// $JUnit-END$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:19:07
|
Revision: 2948
http://joafip.svn.sourceforge.net/joafip/?rev=2948&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:19:01 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
fixme changed
Modified Paths:
--------------
trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:19:07
|
Revision: 2948
http://joafip.svn.sourceforge.net/joafip/?rev=2948&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:19:01 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
fixme changed
Modified Paths:
--------------
trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java
Modified: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java
===================================================================
--- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2011-10-28 03:18:00 UTC (rev 2947)
+++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2011-10-28 03:19:01 UTC (rev 2948)
@@ -240,7 +240,7 @@
dataRecordIdentifier);
} else {
created = false;
- // FIXMELUC _____________data not change case
+ // FIXMELUC ___________data not change case
if (data.length != heapRecord.getDataAssociatedSize()) {
deleteDataRecord(dataRecordIdentifier);
heapRecord = createHeapRecordForData(data.length,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:18:06
|
Revision: 2947
http://joafip.svn.sourceforge.net/joafip/?rev=2947&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:18:00 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
acceded flag management changed for new instance construct
Modified Paths:
--------------
trunk/joafip/src/test/java/net/sf/joafip/service/rel300/AbstractTestSubstitutionWithMethodInterception.java
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel300/AbstractTestSubstitutionWithMethodInterception.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel300/AbstractTestSubstitutionWithMethodInterception.java 2011-10-28 03:17:00 UTC (rev 2946)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel300/AbstractTestSubstitutionWithMethodInterception.java 2011-10-28 03:18:00 UTC (rev 2947)
@@ -117,8 +117,10 @@
final IExclusiveDataAccessSession session = filePersistence
.createExclusiveDataAccessSession();
session.open();
+ saveDone = false;
final BobContainer bobContainer = BobContainer.newBobContainer(session
.getInstanceFactory());
+ assertSaved();
assertTrue("must be a proxy",
ProxyManager2.isProxyOrEnhanced(bobContainer));
// not be loaded because of auto save
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:18:06
|
Revision: 2947
http://joafip.svn.sourceforge.net/joafip/?rev=2947&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:18:00 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
acceded flag management changed for new instance construct
Modified Paths:
--------------
trunk/joafip/src/test/java/net/sf/joafip/service/rel300/AbstractTestSubstitutionWithMethodInterception.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:17:06
|
Revision: 2946
http://joafip.svn.sourceforge.net/joafip/?rev=2946&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:17:00 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
do not unload if object acceded (running in it)
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-28 03:15:36 UTC (rev 2945)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-28 03:17:00 UTC (rev 2946)
@@ -551,7 +551,7 @@
public void unloadAfterSave() throws ObjectIOException,
ObjectIOInvalidClassException {
- if (proxyIntanceOrEnhanced) {
+ if (proxyIntanceOrEnhanced && !acceded) {
assert assertProxyCallBack(proxyCallBack);
proxyCallBack.unload$JOAFIP$();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:17:06
|
Revision: 2946
http://joafip.svn.sourceforge.net/joafip/?rev=2946&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:17:00 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
do not unload if object acceded (running in it)
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:15:43
|
Revision: 2945
http://joafip.svn.sourceforge.net/joafip/?rev=2945&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:15:36 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
fixme changed
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:15:42
|
Revision: 2945
http://joafip.svn.sourceforge.net/joafip/?rev=2945&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:15:36 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
fixme changed
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java 2011-10-28 03:14:59 UTC (rev 2944)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java 2011-10-28 03:15:36 UTC (rev 2945)
@@ -443,7 +443,7 @@
final List<ReferenceChange> referenceChangeList)
throws ObjectIOException {
final boolean stateChanged;
- // FIXMELUC ________________________only for exclusive das
+ // FIXMELUC ___________only for exclusive das
if (originalReferenced.referenceLost()) {
stateChanged = true;
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:15:05
|
Revision: 2944
http://joafip.svn.sourceforge.net/joafip/?rev=2944&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:14:59 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
fixme changed
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:15:05
|
Revision: 2944
http://joafip.svn.sourceforge.net/joafip/?rev=2944&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:14:59 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
fixme changed
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-28 03:14:11 UTC (rev 2943)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-28 03:14:59 UTC (rev 2944)
@@ -68,7 +68,7 @@
throw new ImportException(exportFile + " does not exists");
}
final SAXParserFactory factory = SAXParserFactory.newInstance();
- // FIXMELUC _______________why not validating
+ // FIXMELUC ___________why not validating
factory.setValidating(false);
factory.setNamespaceAware(true);
final SchemaFactory schemaFactory = SchemaFactory
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:14:17
|
Revision: 2943
http://joafip.svn.sourceforge.net/joafip/?rev=2943&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:14:11 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
acceded flag management changed for new instance construct
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:14:17
|
Revision: 2943
http://joafip.svn.sourceforge.net/joafip/?rev=2943&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:14:11 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
acceded flag management changed for new instance construct
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-28 03:13:13 UTC (rev 2942)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-28 03:14:11 UTC (rev 2943)
@@ -280,9 +280,13 @@
if (constructed) {
assert getProxyCallBack(instanceCreated) != NULL_PROXY_CALL_BACK_INSTANCE;
- // set is loaded last for auto save
- objectAndPersistInfo.setIsLoaded();
+ //FIXMELUC ___________unweak needed ?
+ assert objectAndPersistInfo.isNotWeak();
+ //objectAndPersistInfo.unWeakReferenceOnObject();
+ // out of constructor, no more acceded, to do before set is loaded
objectAndPersistInfo.acceded = false;
+ // set is loaded is last operation for auto save
+ setIsLoaded(instanceCreated);
}
} else {
// FIXMELUC ___________one method for objectAndPersistInfo action
@@ -297,9 +301,10 @@
* objectAndPersistInfo.setIsLoaded() should be good to, may be
* better
*/
- // set is loaded last for auto save
+ // out of constructor, no more acceded, to do before set is loaded
+ objectAndPersistInfo.acceded = false;
+ // set is loaded is last operation for auto save
setIsLoaded(instanceCreated);
- objectAndPersistInfo.acceded = false;
}
return objectAndPersistInfo;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-28 03:13:20
|
Revision: 2942
http://joafip.svn.sourceforge.net/joafip/?rev=2942&view=rev
Author: luc_peuvrier
Date: 2011-10-28 03:13:13 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
to break infinite loop in case of problems
Modified Paths:
--------------
trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java
Modified: trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java
===================================================================
--- trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java 2011-10-27 01:46:02 UTC (rev 2941)
+++ trunk/joafip-rbtree/src/main/java/net/sf/joafip/redblacktree/service/RedBlackTree.java 2011-10-28 03:13:13 UTC (rev 2942)
@@ -46,11 +46,15 @@
// complexity
Iterable<IRBTNode<E>>, Serializable {
+ private static final String MAX_DEPTH_REACHED = "max depth reached";
+
/**
*
*/
private static final long serialVersionUID = -3573347853060581283L;
+ private static final int MAX_DEPTH = 64;
+
private static final String INDEX_OUT_OF_BOUND = "index out of bound";
public static final boolean BLACK = true;
@@ -177,6 +181,7 @@
IRBTNode<E> current = rootNode = nodeManager.getRootNode();
IRBTNode<E> found = null;
if (current != null) {
+ int depth = 0;
while (!current.isSentinel() && (!uniqueValue || found == null)) {
final int compareTo = current.compareTo(referenceElement);
if (compareTo == 0) {
@@ -187,6 +192,9 @@
} else {
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
return found;
@@ -201,6 +209,7 @@
IRBTNode<E> current = rootNode = nodeManager.getRootNode();
IRBTNode<E> found = null;
if (current != null) {
+ int depth = 0;
while (!current.isSentinel() && (!uniqueValue || found == null)) {
final int compareTo = current.compareTo(referenceElement);
if (compareTo == 0) {
@@ -211,6 +220,9 @@
} else {
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
return found;
@@ -232,6 +244,7 @@
IRBTNode<E> closestGreater = null;
boolean found = false;
if (current != null) {
+ int depth = 0;
int compareTo;
while (!found && !current.isSentinel()) {
compareTo = current.compareTo(referenceElement);
@@ -245,6 +258,9 @@
} else {
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
if (!uniqueValue && found) {
while (!current.isSentinel()) {
@@ -257,6 +273,9 @@
} else {
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
}
@@ -278,6 +297,7 @@
IRBTNode<E> current = nodeManager.getRootNode();
IRBTNode<E> strictlyGreater = null;
if (current != null) {
+ int depth = 0;
while (!current.isSentinel()) {
final int compareTo = current.compareTo(referenceElement);
if (compareTo > 0) {
@@ -286,6 +306,9 @@
} else {
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
rootNode = null;// NOPMD unreference
@@ -311,10 +334,14 @@
if (current.isSentinel()) {
current = null;// NOPMD
} else {
+ int depth = 0;
IRBTNode<E> right = current.getRight();
while (!right.isSentinel()) {
current = right;
right = current.getRight();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
}
@@ -358,10 +385,14 @@
if (current.isSentinel()) {
current = null;// NOPMD
} else {
+ int depth = 0;
IRBTNode<E> left = current.getLeft();
while (!left.isSentinel()) {
current = left;
left = current.getLeft();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
}
@@ -401,6 +432,7 @@
IRBTNode<E> current = nodeManager.getRootNode();
IRBTNode<E> closestLess = null;
if (current != null) {
+ int depth = 0;
boolean found = false;
int compareTo;
while (!found && !current.isSentinel()) {
@@ -415,6 +447,9 @@
closestLess = current;
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
if (!uniqueValue && found) {
while (!current.isSentinel()) {
@@ -427,6 +462,9 @@
} else {
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
}
@@ -447,6 +485,7 @@
IRBTNode<E> current = nodeManager.getRootNode();
IRBTNode<E> strictlyLess = null;
if (current != null) {
+ int depth = 0;
while (!current.isSentinel()) {
final int compareTo = current.compareTo(referenceElement);
if (compareTo >= 0) {
@@ -455,6 +494,9 @@
strictlyLess = current;
current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
return strictlyLess;
@@ -482,6 +524,7 @@
int comparison = 0;
// search for new node's parent.
if (current != null) {
+ int depth = 0;
while (!current.isSentinel()) {
parent = current;
comparison = nodeToAppend.compareTo(current);
@@ -494,6 +537,9 @@
} else if (comparison < 0) {
current = current.getLeft();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
if (exist && uniqueValue) {
@@ -535,6 +581,7 @@
int comparison = 0;
// search for new node's parent.
if (current != null) {
+ int depth = 0;
while (!toReplace && !current.isSentinel()) {
parent = current;
comparison = nodeToAppendOrSubstitute.compareTo(current);
@@ -549,6 +596,9 @@
toReplace = true;
// current = current.getRight();
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
@@ -621,6 +671,7 @@
int comparison = 0;
// search for new node's parent.
if (current != null) {
+ int depth = 0;
while (toAppend && !current.isSentinel()) {
parent = current;
comparison = nodeToAppend.compareTo(current);
@@ -635,6 +686,9 @@
*/
toAppend = false;
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
final boolean appendToRight = comparison >= 0;
@@ -699,9 +753,13 @@
if (child != null && !child.isSentinel()) {// NOPMD
parent = child;
child = parent.getRight();
+ int depth = 0;
while (child != null && !child.isSentinel()) {
parent = child;
child = parent.getRight();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
appendInternal(nodeToInsert, parent, true);
} else {
@@ -742,9 +800,13 @@
if (child != null && !child.isSentinel()) {// NOPMD
parent = child;
child = parent.getLeft();
+ int depth = 0;
while (child != null && !child.isSentinel()) {
parent = child;
child = parent.getLeft();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
appendInternal(nodeToInsert, parent, false);
} else {
@@ -985,8 +1047,12 @@
* predecessor of the node to delete.
*/
substitute = node.getLeft();
+ int depth = 0;
while (!substitute.getRight().isSentinel()) {
substitute = substitute.getRight();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
child = substitute.getLeft();
@@ -1116,10 +1182,14 @@
if (node.getLeft().isSentinel()) {
IRBTNode<E> currentNode = node;
IRBTNode<E> parent = currentNode.getParent();
+ int depth = 0;
while (parent != null && !parent.isSentinel()
&& currentNode == parent.getLeft()) {
currentNode = parent;
parent = currentNode.getParent();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
previous = parent;
} else {
@@ -1143,10 +1213,14 @@
if (node.getRight().isSentinel()) {
IRBTNode<E> currentNode = node;
IRBTNode<E> parent = currentNode.getParent();
+ int depth = 0;
while (parent != null && !parent.isSentinel()
&& currentNode == parent.getRight()) {
currentNode = parent;
parent = currentNode.getParent();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
next = parent;
} else {
@@ -1177,8 +1251,12 @@
throws RBTException {
IRBTNode<E> currentNode = node;
IRBTNode<E> left;
+ int depth = 0;
while (!(left = currentNode.getLeft()).isSentinel()) {// NOPMD
currentNode = left;
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
return currentNode;
}
@@ -1187,8 +1265,12 @@
throws RBTException {
IRBTNode<E> currentNode = node;
IRBTNode<E> right;
+ int depth = 0;
while (!(right = currentNode.getRight()).isSentinel()) { // NOPMD
currentNode = right;
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
return currentNode;
}
@@ -1235,6 +1317,7 @@
final IRBTNode<E> left = current.getLeft();
index = left.isSentinel() ? 0 : (left.getNumberOfChild() + 1);
IRBTNode<E> parent = current.getParent();
+ int depth = 0;
while (parent != null) {
if (parent.getRight() == current) {
final IRBTNode<E> parentLeft = parent.getLeft();
@@ -1243,6 +1326,9 @@
}
current = parent;
parent = parent.getParent();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
rootNode = null;// NOPMD unreference
return index;
@@ -1286,6 +1372,7 @@
currentNodeIndex = currentLeft.isSentinel() ? 0 : (currentLeft
.getNumberOfChild() + 1);
+ int depth = 0;
while (index != currentNodeIndex) {
if (index < currentNodeIndex) {
/*
@@ -1312,6 +1399,9 @@
currentNodeIndex += (currentLeft.isSentinel() ? 0
: (currentLeft.getNumberOfChild() + 1)) + 1;
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
return currentNode;
}
@@ -1333,6 +1423,7 @@
IRBTNode<E> currentNode = node;
IRBTNode<E> currentNodeParent = currentNode.getParent();
IRBTNode<E> currentNodeParentParent;
+ int depth = 0;
while (currentNodeParent != null // NOPMD
&& currentNodeParent.isRed()
&& (currentNodeParentParent = currentNodeParent.getParent()) != null) {
@@ -1393,6 +1484,9 @@
leftRotation(currentNodeParentParent);
}
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
rootNode.setBlack();
}
@@ -1414,6 +1508,7 @@
assert parentNode != null && !parentNode.isSentinel() : "parent node can not be null nor sentinel";
IRBTNode<E> node = childNode;
IRBTNode<E> parent = parentNode;
+ int depth = 0;
while (node != rootNode && node.isBlack()) {// NOPMD
if (node == parent.getLeft()) {
// Rebalance left side.
@@ -1494,6 +1589,9 @@
node = rootNode; // Finished.
}
}
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
node.setBlack();
}
@@ -1601,18 +1699,26 @@
private void incrementNumberOfChild(final IRBTNode<E> node)
throws RBTException {
IRBTNode<E> current = node;
+ int depth = 0;
while (current != null) {
current.setNumberOfChild(current.getNumberOfChild() + 1);
current = current.getParent();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
private void decrementNumberOfChild(final IRBTNode<E> node)
throws RBTException {
IRBTNode<E> current = node;
+ int depth = 0;
while (current != null) {
current.setNumberOfChild(current.getNumberOfChild() - 1);
current = current.getParent();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
}
@@ -1641,9 +1747,13 @@
throws RBTException {
IRBTNode<E> current = node;
IRBTNode<E> parent = node.getParent();
+ int depth = 0;
while (parent != null) {
current = parent;
parent = current.getParent();
+ if (++depth == MAX_DEPTH) {
+ throw new RBTException(MAX_DEPTH_REACHED);
+ }
}
return current == nodeManager.getRootNode();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|