Mercurial > hg > Members > nobuyasu > jungle-network
changeset 127:292538b1de32
Fixed BulletinBoardJungleManager bug
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 11 Jan 2014 08:40:55 +0900 |
parents | 31be4d597859 |
children | 48d342e72dd7 |
files | src/main/java/app/bbs/BullentInBoardJungleManager.java |
diffstat | 1 files changed, 16 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/app/bbs/BullentInBoardJungleManager.java Sat Jan 11 08:10:41 2014 +0900 +++ b/src/main/java/app/bbs/BullentInBoardJungleManager.java Sat Jan 11 08:40:55 2014 +0900 @@ -46,19 +46,23 @@ throw new IllegalStateException(); } } - JungleTree tree = jungle.getTreeByName(treeName); - JungleTreeEditor editor = tree.getLocalTreeEditor(); + Either<Error, JungleTreeEditor> either = null; + do { + JungleTree tree = jungle.getTreeByName(treeName); + JungleTreeEditor editor = tree.getLocalTreeEditor(); - int pos = calculatePosition(tree.getRootNode(), netLog.getTimeStamp()); - Either<Error, JungleTreeEditor> either = JungleUpdater.edit(editor, netLog, pos); - if(either.isA()) { - throw new IllegalStateException(); - } - editor = either.b(); - either = editor.success(); - if(either.isA()) { - throw new IllegalStateException(); - } + /* + * Merge. + */ + int pos = calculatePosition(tree.getRootNode(), netLog.getTimeStamp()); + either = JungleUpdater.edit(editor, netLog, pos); + if(either.isA()) { + throw new IllegalStateException(); + } + + editor = either.b(); + either = editor.success(); + }while(either.isA()); return either; }