changeset 130:652a6dff6288

Fixed
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Sat, 11 Jan 2014 09:10:02 +0900
parents 1a3edba05f50
children aa98fc3ec85f
files src/main/java/app/bbs/NetworkJungleBulletinBoard.java src/main/java/app/bbs/PersistentJungleBulletinBoard.java
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/app/bbs/NetworkJungleBulletinBoard.java	Sat Jan 11 09:08:41 2014 +0900
+++ b/src/main/java/app/bbs/NetworkJungleBulletinBoard.java	Sat Jan 11 09:10:02 2014 +0900
@@ -79,7 +79,6 @@
 		if(either.isA()){
 			throw new IllegalStateException();
 		}
-
 		editor = either.b();
 		Either<Error,JungleTreeEditor> result = editor.success();
 		if(result.isA()){
@@ -99,8 +98,8 @@
 				_e = _e.getAttributes().put("author",ByteBuffer.wrap(_author.getBytes())).b();
 				_e = _e.getAttributes().put("mes",ByteBuffer.wrap(_initMessage.getBytes())).b();
 				_e = _e.getAttributes().put("key",ByteBuffer.wrap(_editKey.getBytes())).b();
-				ByteBuffer t2Buffer = ByteBuffer.allocate(16);
-				_e = _e.getAttributes().put("timestamp",t2Buffer.putLong(timestamp)).b();
+				ByteBuffer tBuffer2 = ByteBuffer.allocate(16);
+				_e = _e.getAttributes().put("timestamp",tBuffer2.putLong(timestamp)).b();
 				return DefaultEither.newB(_e);
 			}
 		};
--- a/src/main/java/app/bbs/PersistentJungleBulletinBoard.java	Sat Jan 11 09:08:41 2014 +0900
+++ b/src/main/java/app/bbs/PersistentJungleBulletinBoard.java	Sat Jan 11 09:10:02 2014 +0900
@@ -129,11 +129,17 @@
 			throw new IllegalStateException();
 		}
 		editor = either.b();
+		final long timestamp = new Date().getTime();
+		ByteBuffer tBuffer = ByteBuffer.allocate(16);
+		either = editor.putAttribute(root.add(0),"timestamp", tBuffer.putLong(timestamp));		
+		if(either.isA()){
+			throw new IllegalStateException();
+		}
+		editor = either.b();
 		Either<Error,JungleTreeEditor> result = editor.success();
 		if(result.isA()){
 			throw new IllegalStateException();
 		}
-		final long timestamp = new Date().getTime();
 
 		
 		tree = jungle.getTreeByName(_name);
@@ -149,8 +155,8 @@
 				_e = _e.getAttributes().put("author",ByteBuffer.wrap(_author.getBytes())).b();
 				_e = _e.getAttributes().put("mes",ByteBuffer.wrap(_initMessage.getBytes())).b();
 				_e = _e.getAttributes().put("key",ByteBuffer.wrap(_editKey.getBytes())).b();
-				ByteBuffer tBuffer = ByteBuffer.allocate(16);
-				_e = _e.getAttributes().put("timestamp",tBuffer.putLong(timestamp)).b();
+				ByteBuffer tBuffer2 = ByteBuffer.allocate(16);
+				_e = _e.getAttributes().put("timestamp",tBuffer2.putLong(timestamp)).b();
 				return DefaultEither.newB(_e);
 			}
 		};