Browse Source

无jira任务,修复无网的时候报4个nul的问题

master
vito 8 years ago
parent
commit
9326872cf3
  1. 13
      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

13
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 TEMP_FILE = "temp.zip";
public static final String CONNECTION_404 = "404";
/**
* 下载插件
@ -130,7 +131,7 @@ public class PluginHelper {
//将所有未配置好的资源文件依赖准备好
private static void checkDependenceEnv(Plugin plugin) throws PluginDependenceException {
PluginDependence dependence = plugin.getDependence();
if (dependence == null){
if (dependence == null) {
return;
}
@ -138,14 +139,14 @@ public class PluginHelper {
String currentID = dependence.getCurrentPluginID();
List<PluginDependenceUnit> list = dependence.getDependPlugins();
for (int i = 0;list != null && i < list.size(); i++){
for (int i = 0; list != null && i < list.size(); i++) {
PluginDependenceUnit dependenceUnit = list.get(i);
if (!dependenceUnit.checkFileEnv()){
if (!dependenceUnit.checkFileEnv()) {
needInstallDependence.add(dependenceUnit);
}
}
if (needInstallDependence.isEmpty()){
if (needInstallDependence.isEmpty()) {
return;
}
@ -156,14 +157,16 @@ public class PluginHelper {
/**
* 构造一个下载UI
*
* @param currentID
* @param list
* @throws PluginDependenceException
*/
private static void installDependenceOnline(String currentID, List<PluginDependenceUnit> list) throws PluginDependenceException{
private static void installDependenceOnline(String currentID, List<PluginDependenceUnit> list) throws PluginDependenceException {
DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, list);
ui.installOnline();
}
/**
* 从选中的压缩文件中安装插件
*

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

@ -65,18 +65,17 @@ public class PluginsReaderFromStore {
* @return 插件信息
*/
public static Plugin[] readPluginsForUpdate() throws Exception {
String resText;
try {
String resText = null;
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.update");
if (StringUtils.isNotEmpty(url)) {
HashMap<String, String> para = new HashMap<String, String>();
para.put("plugins", PluginLoader.getLoader().pluginsToString());
//只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件.
para.put("jarTime", GeneralUtils.readBuildNO());
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.update"), para);
HttpClient httpClient = new HttpClient(url, para);
resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8;
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)) {
try {
@ -93,7 +92,6 @@ public class PluginsReaderFromStore {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error"));
}
}
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;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
@ -26,8 +27,14 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override
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();
} 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;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
@ -38,7 +39,10 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override
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)) {
url.append("&cid=").append(category.split("-")[1]);
}
@ -54,6 +58,9 @@ public class GetPluginFromStoreExecutor implements Executor {
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
} else {
result = PluginHelper.CONNECTION_404;
}
}
}
};

Loading…
Cancel
Save