diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index 7bcad336f..5639b5957 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -818,14 +818,17 @@ public class ShareMainPane extends JPanel { @Override public void insertString(int offset, String str, AttributeSet attrSet) throws BadLocationException { if (str == null) { - return; + throw new BadLocationException(null, offset); } int count = str.length(); for (int i = 0; i < count; i++) { char c = str.charAt(i); if (allowCharAsString.indexOf(c) < 0) { java.awt.Toolkit.getDefaultToolkit().beep(); - return; + // REPORT-63194 + // 合成文本,如中文等存在输入-删除-替换的机制 JTextComponent#replaceInputMethodText() + // 所以这里不能直接return,而应该抛出异常中断后续字符处理,否则在处理中文等合成文本时会导致原有字符被删除 + throw new BadLocationException(str, offset); } } super.insertString(offset, str, attrSet);