| Chunk |
|---|
| Conflicting content |
|---|
String lockedBy = toSave.getLockedBy();
/*System.out.print("locked by = " + lockedBy);
String identity = getThreadLocalRequest().getRemoteAddr();
boolean failed = false;
Document toSave;
<<<<<<< HEAD
PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction t = pm.currentTransaction();
try {
t.begin();
if (stringKey == null) {
toSave = new Document(doc);
} else {
Key key = KeyFactory.stringToKey(stringKey);
toSave = pm.getObjectById(Document.class, key);
toSave.update(doc);
toSave.unlock();
=======
//String identity = getThreadLocalRequest().getRemoteAddr();
pm = PMF.get().getPersistenceManager();
Transaction t = pm.currentTransaction();
try {
t.begin();
if (stringKey == null) {
toSave = new Document(doc);
pm.makePersistent(toSave);
} else {
Key key = KeyFactory.stringToKey(stringKey);
toSave = pm.getObjectById(Document.class, key);
System.out.print("identity = " + identity);
System.out.print(lockedBy.equals(identity));*/
if (lockedBy.equals(identity)) {
toSave.update(doc);
toSave.unlock();
pm.makePersistent(toSave);
} else {
failed = true;
}
}
t.commit();
} finally {
if (t.isActive()) {
t.rollback();
}
pm.close();
>>>>>>> 43e21b8af1e8641353f750c1694c6a4c696a7f4a
}
if (!failed) {
return toSave.getUnlocked(); |
| Solution content |
|---|
Document toSave;
PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction t = pm.currentTransaction();
try {
t.begin();
if (stringKey == null) {
toSave = new Document(doc);
pm.makePersistent(toSave);
} else {
Key key = KeyFactory.stringToKey(stringKey);
toSave = pm.getObjectById(Document.class, key);
String lockedBy = toSave.getLockedBy();
String identity = getThreadLocalRequest().getRemoteAddr();
if (lockedBy.equals(identity)) {
toSave.update(doc);
toSave.unlock();
pm.makePersistent(toSave);
} else {
throw new LockExpired();
}
} |
| File |
|---|
| CollaboratorServiceImpl.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| If statement |
| Method invocation |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
if (toSave.isLocked()) {
throw new LockUnavailable(key + " is locked");
} else {
<<<<<<< HEAD
toSave.lock(new Date(System.currentTimeMillis() + 60000L),
"BMG");
=======
//UserService userService = UserServiceFactory.getUserService();
toSave.lock(new Date(System.currentTimeMillis() + 30000L), identity);
>>>>>>> 43e21b8af1e8641353f750c1694c6a4c696a7f4a
pm.makePersistent(toSave); |
| Solution content |
|---|
if (toSave.isLocked()) {
throw new LockUnavailable(key + " is locked");
} else {
toSave.lock(new Date(System.currentTimeMillis() + 60000L),
identity);
pm.makePersistent(toSave);
}
|
| File |
|---|
| CollaboratorServiceImpl.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Comment |
| Method invocation |