diff --git a/case-server/src/main/java/com/xiaoju/framework/handler/Room.java b/case-server/src/main/java/com/xiaoju/framework/handler/Room.java index 4aadc89..a2e5c9e 100644 --- a/case-server/src/main/java/com/xiaoju/framework/handler/Room.java +++ b/case-server/src/main/java/com/xiaoju/framework/handler/Room.java @@ -197,10 +197,10 @@ private void undo() { if(undoPosition == 0) LOGGER.error("不能再进行undoPosition操作"); else{ - undoPosition --; - redoPosition --; - broadcastRoomMessage(CaseMessageType.EDITOR, undoDiffs.get(undoPosition)); try { + undoPosition --; + redoPosition --; + broadcastRoomMessage(CaseMessageType.EDITOR, undoDiffs.get(undoPosition)); JsonNode target = JsonPatch.apply(jsonMapper.readTree(undoDiffs.get(undoPosition)), jsonMapper.readTree(testCaseContent)); testCaseContent = target.toString(); } catch (Exception e) { @@ -217,8 +217,8 @@ private void redo() { if(redoPosition == undoDiffs.size()) LOGGER.error("不能再进行redoPosition操作"); else{ - broadcastRoomMessage(CaseMessageType.EDITOR, redoDiffs.get(redoPosition)); try { + broadcastRoomMessage(CaseMessageType.EDITOR, redoDiffs.get(redoPosition)); JsonNode target = JsonPatch.apply(jsonMapper.readTree(redoDiffs.get(undoPosition)), jsonMapper.readTree(testCaseContent)); testCaseContent = target.toString(); } catch (Exception e) {