Browse Source

Merge pull request #391 in BA/design from ~VITO/design:master to master

* commit '9326872cf3de145789b973bc6c62d8baf116a342':
  无jira任务,修复无网的时候报4个nul的问题
master
superman 8 years ago
parent
commit
1c622a6670
  1. 3
      designer_base/src/com/fr/design/extra/PluginHelper.java
  2. 10
      designer_base/src/com/fr/design/extra/PluginsReaderFromStore.java
  3. 9
      designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  4. 9
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

3
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -38,6 +38,7 @@ public class PluginHelper {
//插件依赖的下载位置 //插件依赖的下载位置
public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence"; public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence";
public static final String TEMP_FILE = "temp.zip"; public static final String TEMP_FILE = "temp.zip";
public static final String CONNECTION_404 = "404";
/** /**
* 下载插件 * 下载插件
@ -156,6 +157,7 @@ public class PluginHelper {
/** /**
* 构造一个下载UI * 构造一个下载UI
*
* @param currentID * @param currentID
* @param list * @param list
* @throws PluginDependenceException * @throws PluginDependenceException
@ -164,6 +166,7 @@ public class PluginHelper {
DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, list); DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, list);
ui.installOnline(); ui.installOnline();
} }
/** /**
* 从选中的压缩文件中安装插件 * 从选中的压缩文件中安装插件
* *

10
designer_base/src/com/fr/design/extra/PluginsReaderFromStore.java

@ -65,18 +65,17 @@ public class PluginsReaderFromStore {
* @return 插件信息 * @return 插件信息
*/ */
public static Plugin[] readPluginsForUpdate() throws Exception { public static Plugin[] readPluginsForUpdate() throws Exception {
String resText; String resText = null;
try { String url = SiteCenter.getInstance().acquireUrlByKind("plugin.update");
if (StringUtils.isNotEmpty(url)) {
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("plugins", PluginLoader.getLoader().pluginsToString()); para.put("plugins", PluginLoader.getLoader().pluginsToString());
//只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件. //只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件.
para.put("jarTime", GeneralUtils.readBuildNO()); para.put("jarTime", GeneralUtils.readBuildNO());
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.update"), para); HttpClient httpClient = new HttpClient(url, para);
resText = httpClient.getResponseText(); resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8; String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet); resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
} catch (Exception e) {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_PluginMarket_Coding"));
} }
if (StringUtils.isNotEmpty(resText)) { if (StringUtils.isNotEmpty(resText)) {
try { try {
@ -93,7 +92,6 @@ public class PluginsReaderFromStore {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error")); throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error"));
} }
} }
return pluginsToUpdate.toArray(new Plugin[pluginsToUpdate.size()]); return pluginsToUpdate.toArray(new Plugin[pluginsToUpdate.size()]);
} }

9
designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -1,5 +1,6 @@
package com.fr.design.extra.exe; package com.fr.design.extra.exe;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
@ -26,8 +27,14 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.category")); String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category");
if (url != null) {
HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText(); result = httpClient.getResponseText();
} else {
result = PluginHelper.CONNECTION_404;
}
} }
} }
}; };

9
designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -1,5 +1,6 @@
package com.fr.design.extra.exe; package com.fr.design.extra.exe;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
@ -38,7 +39,10 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
StringBuilder url = new StringBuilder(SiteCenter.getInstance().acquireUrlByKind("plugin.plist")); String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist");
if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder();
url.append(plistUrl);
if (StringUtils.isNotBlank(category)) { if (StringUtils.isNotBlank(category)) {
url.append("&cid=").append(category.split("-")[1]); url.append("&cid=").append(category.split("-")[1]);
} }
@ -54,6 +58,9 @@ public class GetPluginFromStoreExecutor implements Executor {
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
} else {
result = PluginHelper.CONNECTION_404;
}
} }
} }
}; };

Loading…
Cancel
Save