From 182d70f604ada283eac66543e37ea6e347247c8b Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 20 May 2022 14:27:38 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-71957=20=E7=BB=84=E4=BB=B6=E5=A4=8D?= =?UTF-8?q?=E7=94=A8-=E5=88=9B=E5=BB=BA=E7=BB=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=90=8E=E6=8F=90=E7=A4=BA=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=88=9B=E5=BB=BA=E5=A4=B1=E8=B4=A5=EF=BC=8C?= =?UTF-8?q?=E4=B8=94=E6=97=A5=E5=BF=97=E6=9C=89=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 生成组件时需要使用组件名称作为文件名创建临时文件,而组件名称中可能 包含不合法字符,导致临时文件创建失败。虽然这种文件创建失败的情况 只会在特定操作系统上出现,但考虑到共享组件跨平台应用的可能性,因此 需要统一检查组件名称的合法性,以便在使用时能使用此名称创建文件。 若创建组件时名称非法,则给出提示。 【改动思路】 同上 【review建议】 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 ea5298cf26..6ec3fa61e6 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 @@ -32,6 +32,7 @@ import com.fr.design.mainframe.share.ui.base.ui.PlaceHolderUI; import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.share.effect.EffectItemGroup; import com.fr.design.share.utils.ShareDialogUtils; +import com.fr.file.FileCommonUtils; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.bean.StyleThemeBean; import com.fr.form.share.constants.ShareComponentConstants; @@ -581,6 +582,15 @@ public class ShareMainPane extends JPanel { Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); return false; } + if (FileCommonUtils.isFileNameValid(name)) { + FineJOptionPane.showMessageDialog( + shareDialog, + Toolkit.i18nText("Fine-Design_Share_Generate_Failure_Illegal_Component_Name_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon")); + return false; + } if (upload && StringUtils.isEmpty(content.getText())) { FineJOptionPane.showMessageDialog(shareDialog, Toolkit.i18nText("Fine-Design_Share_Lack_Content"), Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));