diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java index 98e84dcd1..9c2fa40e1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java @@ -117,8 +117,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock block) { OnlineShareWidget widget = block.getWidget(); - OnlineShareWidget parentPackage = widget.getParentPackage(); - if (parentPackage != null && StringUtils.isNotEmpty(parentPackage.getThemeName())) { + String themeName = widget.getThemeName(); + if (StringUtils.isNotEmpty(themeName)) { suitableThemeNamePane.setVisible(true); - suitableThemeNameLabel.setText(parentPackage.getThemeName()); + suitableThemeNameLabel.setText(themeName); } else { suitableThemeNamePane.setVisible(false); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java index 69401c9c2..0b2a6954a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.share.util; import com.fr.base.theme.FormTheme; -import com.fr.base.theme.TemplateTheme; import com.fr.design.DesignerEnvManager; import com.fr.design.extra.PluginConstants; import com.fr.form.share.base.CancelCheck; @@ -15,7 +14,6 @@ import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReaderHelper; import com.fr.stable.xml.XMLableReader; -import com.fr.third.javax.xml.stream.XMLStreamException; import com.fr.third.org.apache.http.HttpEntity; import com.fr.third.org.apache.http.HttpException; import com.fr.third.org.apache.http.HttpStatus; @@ -30,11 +28,12 @@ import com.fr.third.org.apache.http.impl.client.HttpClients; import org.jetbrains.annotations.NotNull; import javax.crypto.Cipher; +import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.security.KeyFactory; import java.security.interfaces.RSAPublicKey; @@ -147,8 +146,16 @@ public class DownloadUtils { } if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { HttpEntity entity = fileRes.getEntity(); - InputStream content = entity.getContent(); - XMLableReader reader = XMLReaderHelper.createXMLableReader(content, XMLPrintWriter.XML_ENCODER); + + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent())); + StringBuilder stringBuilder = new StringBuilder(); + String line; + while ((line = bufferedReader.readLine()) != null) { + stringBuilder.append(line); + } + + String content = stringBuilder.toString(); + XMLableReader reader = XMLReaderHelper.createXMLableReader(new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)), XMLPrintWriter.XML_ENCODER); FormTheme theme = new FormTheme(); reader.readXMLObject(theme);