[Yanel-commits] rev 25939 - in
public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder:
. utils
simon at wyona.com
simon at wyona.com
Thu Jul 12 15:49:00 CEST 2007
Author: simon
Date: 2007-07-12 15:48:59 +0200 (Thu, 12 Jul 2007)
New Revision: 25939
Modified:
public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java
public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java
public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/WarFetcher.java
Log:
replaced inpustream with string to get the updatelink for the updateinformation
Modified: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java 2007-07-12 12:43:35 UTC (rev 25938)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java 2007-07-12 13:48:59 UTC (rev 25939)
@@ -255,6 +255,7 @@
} catch (Exception e) {
log.error(e.getMessage(), e);
htmlBodyContent.append("<p>Failed to get install information. Exception: " + e.getMessage() + "</p>");
+ return;
}
if (!installInfo.getInstalltype().equals("bin-snapshot")) {
@@ -267,7 +268,8 @@
updateInfo = getUpdateInfo();
} catch (Exception e) {
log.error(e.getMessage(), e);
- htmlBodyContent.append("<p>Failed to get update information. Exception: " + e.getMessage() + "</p>"); // TODO: handle exception
+ htmlBodyContent.append("<p>Failed to get update information. Exception: " + e.getMessage() + "</p>");
+ return;
}
String idVersionRevisionCurent = installInfo.getId() + "-v-" + installInfo.getVersion() + "-r-" + installInfo.getRevision();
@@ -418,16 +420,12 @@
}
private InstallInfo getInstallInfo() throws Exception {
- InstallInfo installInfo = null;
- return installInfo = new InstallInfo(request);
+ return new InstallInfo(request);
}
private UpdateInfo getUpdateInfo() throws Exception {
- UpdateInfo updateInfo = null;
- URL UpdateRdfUrl = new URL(getInstallInfo().getUpdateURL());
- InputStream updateRdfIn = UpdateRdfUrl.openStream();
- return updateInfo = new UpdateInfo(updateRdfIn, getInstallInfo());
+ return new UpdateInfo(getInstallInfo().getUpdateURL(), getInstallInfo());
}
private HashMap getBestUpdater() throws Exception {
Modified: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java 2007-07-12 12:43:35 UTC (rev 25938)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java 2007-07-12 13:48:59 UTC (rev 25939)
@@ -9,6 +9,7 @@
import java.io.File;
import java.io.InputStream;
import java.io.FileInputStream;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -29,16 +30,25 @@
private String updateManagerNS = "http://www.wyona.org/update-manager/1.0#";
- public UpdateInfo(InputStream in, InstallInfo installInfo) throws Exception{
+ public UpdateInfo(String updateRdfUrlString, InstallInfo installInfo) throws Exception{
if (installInfo == null) {
throw new Exception("InstallInfo should not be null");
}
- if (in == null) {
+ if (updateRdfUrlString == null) {
throw new Exception("InputStream should not be null");
}
+
+ URL updateRdfUrl = new URL(updateRdfUrlString);
+ InputStream updateRdfIn = null;
+ try {
+ updateRdfIn = updateRdfUrl.openStream();
+ } catch (Exception e) {
+ throw new Exception("Could not get update information from: " + updateRdfUrlString);
+ }
+
Model model = ModelFactory.createDefaultModel();
//read the RDF/XML file
- model.read(in, "");
+ model.read(updateRdfIn, "");
this.updateRdfModel = model;
this.installInfo = installInfo;
Modified: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/WarFetcher.java
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/WarFetcher.java 2007-07-12 12:43:35 UTC (rev 25938)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/WarFetcher.java 2007-07-12 13:48:59 UTC (rev 25939)
@@ -74,9 +74,7 @@
JarURLConnection URLcon=(JarURLConnection)(updateWarUrl.openConnection());
JarFile jar=URLcon.getJarFile();
- URL UpdateRdfUrl = new URL(installInfo.getUpdateURL());
- InputStream updateRdfIn = UpdateRdfUrl.openStream();
- UpdateInfo updateInfo = new UpdateInfo(updateRdfIn, installInfo);
+ UpdateInfo updateInfo = new UpdateInfo(installInfo.getUpdateURL(), installInfo);
HashMap versionDetails = updateInfo.getUpdateVersionDetail("updateLink", updateLink);
String version = (String) versionDetails.get("version");
String revision = (String) versionDetails.get("revision");
More information about the Yanel-commits
mailing list