Browse Source

REPORT-26263 切换远程目录到tomcat,放置一段时间切回本地,出现切换失败的弹窗,实际切换成功

修复 npe 。
final/10.0
Harrison 5 years ago
parent
commit
e5fd1dc1d1
  1. 8
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  2. 20
      designer-form/src/test/java/com/fr/design/mainframe/JFormTest.java

8
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -543,8 +543,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
*/ */
public boolean canUndo() { public boolean canUndo() {
//报表块最多撤销至编辑报表块的第一步,不能撤销表单中的操作 //报表块最多撤销至编辑报表块的第一步,不能撤销表单中的操作
boolean inECUndoForm = undoState.getFormReportType() == BaseUndoState.STATE_BEFORE_FORM_REPORT && formDesign.isReportBlockEditing(); boolean inECUndoForm = undoState != null
return !inECUndoForm && this.getUndoManager().canUndo(); && undoState.getFormReportType() == BaseUndoState.STATE_BEFORE_FORM_REPORT
&& formDesign.isReportBlockEditing();
return !inECUndoForm
&& this.getUndoManager() != null
&& this.getUndoManager().canUndo();
} }
// 返回当前的body, // 返回当前的body,

20
designer-form/src/test/java/com/fr/design/mainframe/JFormTest.java

@ -0,0 +1,20 @@
package com.fr.design.mainframe;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
public class JFormTest {
@Test
public void testRun() {
JForm mockForm = EasyMock.partialMockBuilder(JForm.class).addMockedMethod("getUndoManager").createMock();
try {
mockForm.canUndo();
} catch (Exception e) {
Assert.fail();
}
}
}
Loading…
Cancel
Save