From 66cea01ce10a57fb4de4fa1cf1eb05fe4a38645b Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 12 May 2022 10:45:39 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-71449=20=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E4=B8=8D=E5=A4=8D=E5=88=B6=E6=96=B0=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=EF=BC=8C=E2=80=9C=E5=89=AA=E8=B4=B4=E7=89=88?= =?UTF-8?q?=E2=80=9D=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86=E4=BC=9A=E5=8F=98?= =?UTF-8?q?=E5=8C=96=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E3=80=91=E7=B2=98=E8=B4=B4=E7=9A=84=E6=97=B6=E5=80=99=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=81=9Aclone=E5=A4=84=E7=90=86=EF=BC=8C=E5=81=87?= =?UTF-8?q?=E5=A6=82=E4=BF=AE=E6=94=B9=E7=B2=98=E8=B4=B4=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=8C=E4=BC=9A=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=89=E5=89=AA=E5=88=87=E6=9D=BF=E9=87=8C?= =?UTF-8?q?=E5=AD=98=E7=9A=84Tableda=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=91=E6=B7=BB=E5=8A=A0=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E6=97=B6TableData=E7=9A=84clone=E9=80=BB=E8=BE=91=20=E3=80=90r?= =?UTF-8?q?eview=E5=BB=BA=E8=AE=AE=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/TableDataTreePane.java | 5 ++++- .../paste/TableDataFollowingPasteUtils.java | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index e425751772..112adff560 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -1133,7 +1133,10 @@ public class TableDataTreePane extends BasicTableDataTreePane { // 处理数据集名称 String dsName = getNoRepeatedDsName4Paste(dataWrapperEntry.getKey()); AbstractTableDataWrapper wrapper = dataWrapperEntry.getValue(); - addDataPane(TableDataFollowingPasteUtils.generateTableDataPaneWhenPaste(wrapper), dsName); + AbstractTableDataPane tableDataPane = TableDataFollowingPasteUtils.generateTableDataPaneWhenPaste(wrapper); + if (tableDataPane != null) { + addDataPane(tableDataPane, dsName); + } } } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java index a9b3b70ad7..4c39e28545 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java @@ -66,7 +66,10 @@ public class TableDataFollowingPasteUtils { continue; } AbstractTableDataWrapper tableDataWrapper = new TemplateTableDataWrapper(dataWrapperEntry.getValue(), dsName); - tableDataTreePane.addDataPane(generateTableDataPaneWhenPaste(tableDataWrapper), dsName); + AbstractTableDataPane tableDataPane = generateTableDataPaneWhenPaste(tableDataWrapper); + if (tableDataPane != null) { + tableDataTreePane.addDataPane(tableDataPane, dsName); + } } } @@ -372,11 +375,16 @@ public class TableDataFollowingPasteUtils { * 生成粘贴(新建)时使用的AbstractTableDataPane * 主要是为了处理StoreProcedure,它在远程情况下,无法及时获取参数。这边因为是复制粘贴,所以直接用原TableData的参数即可 * @param tableDataWrapper wrapper - * @return AbstractTableDataPane + * @return AbstractTableDataPane,当TableData clone失败时,方法返回null */ + @Nullable public static AbstractTableDataPane generateTableDataPaneWhenPaste(AbstractTableDataWrapper tableDataWrapper) { // 粘贴时再做一次TableData的clone - AbstractTableDataWrapper clonedWrapper = new TemplateTableDataWrapper(cloneTableData(tableDataWrapper.getTableData())); + TableData clonedTableData = cloneTableData(tableDataWrapper.getTableData()); + if (clonedTableData == null) { + return null; + } + AbstractTableDataWrapper clonedWrapper = new TemplateTableDataWrapper(clonedTableData); AbstractTableDataPane tableDataPane = clonedWrapper.creatTableDataPane(); TableData tableData = clonedWrapper.getTableData(); if (tableData instanceof StoreProcedure) {