jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: rev 46982 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core: . state
Date Tue, 21 Sep 2004 13:49:16 GMT
Author: stefan
Date: Tue Sep 21 06:49:16 2004
New Revision: 46982

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/Test.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/state/SessionItemStateManager.java
Log:
fixing bug that occurs when
- an existing property 'x' is removed
- a new property 'x' is added 
- the modifications are saved

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/Test.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/Test.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/Test.java	Tue Sep 21
06:49:16 2004
@@ -34,12 +34,22 @@
     private static final String LOG_CONFIG_FILE_NAME = "log4j.properties";
 
     public static void main(String[] args) throws Exception {
-	String factoryHomeDir = System.getProperty("user.dir");
-	//String factoryHomeDir = new File("../src/conf").getCanonicalPath();
-
-	PropertyConfigurator.configure(factoryHomeDir + "/" + LOG_CONFIG_FILE_NAME);
+	// location of config.xml & log4j.properties
+	String configDir = System.getProperty("config.dir");
+	if (configDir == null) {
+	    // fallback to cwd
+	    configDir = System.getProperty("user.dir");
+	}
+	PropertyConfigurator.configure(configDir + "/" + LOG_CONFIG_FILE_NAME);
+	String configFile = configDir + "/" + RepositoryFactory.DEFAULT_CONFIG_FILE;
+
+	// repository factory home dir
+	String factoryHomeDir = System.getProperty("repository.factory.home");
+	if (factoryHomeDir == null) {
+	    // fallback to cwd
+	    factoryHomeDir = System.getProperty("user.dir");
+	}
 
-	String configFile = factoryHomeDir + "/" + RepositoryFactory.DEFAULT_CONFIG_FILE;
 	RepositoryFactory rf = RepositoryFactory.create(configFile, factoryHomeDir);
 	Repository r = rf.getRepository("localfs");
 	Session session = r.login(new SimpleCredentials("anonymous", "".toCharArray()), null);
@@ -185,8 +195,7 @@
 	    root.save();
 	}
 */
-	String date1 = "2003-07-28T06:18:57.848+01:00";
-	root.setProperty("date", new DateValue(new StringValue(date1).getDate()));
+	root.setProperty("date", DateValue.valueOf("2003-07-28T06:18:57.848+01:00"));
 	Property p = root.getProperty("date");
 	Value val = p.getValue();
 	Calendar d = val.getDate();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/state/SessionItemStateManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/state/SessionItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/state/SessionItemStateManager.java
Tue Sep 21 06:49:16 2004
@@ -178,7 +178,14 @@
 	    throws NoSuchItemStateException, ItemStateException {
 	// first check if the specified item has been transiently removed
 	if (transientStateMgr.hasItemStateInAttic(id)) {
-	    throw new NoSuchItemStateException(id.toString());
+	    /**
+	     * check if there's new transient state for the specified item
+	     * (e.g. if a property with name 'x' has been removed and a new
+	     * property with same name has been created);
+	     * this will throw a NoSuchItemStateException if there's no new
+	     * transient state
+	     */
+	    return transientStateMgr.getItemState(id);
 	}
 	try {
 	    // check if there's transient state for the specified item

Mime
View raw message