[jsword-svn] r1855 - in trunk: common/src/main/java/org/crosswire/common/util jsword/src/main/java/org/crosswire/jsword/book/install/sword
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Sun May 11 20:03:15 MST 2008
Author: dmsmith
Date: 2008-05-11 20:03:15 -0700 (Sun, 11 May 2008)
New Revision: 1855
Modified:
trunk/common/src/main/java/org/crosswire/common/util/WebResource.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java
Log:
Fixed parameterized error messages when app is offline.
Modified: trunk/common/src/main/java/org/crosswire/common/util/WebResource.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/WebResource.java 2008-05-12 00:05:51 UTC (rev 1854)
+++ trunk/common/src/main/java/org/crosswire/common/util/WebResource.java 2008-05-12 03:03:15 UTC (rev 1855)
@@ -149,7 +149,8 @@
try
{
// Execute the method.
- if (client.executeMethod(method) == HttpStatus.SC_OK)
+ int status = client.executeMethod(method);
+ if (status == HttpStatus.SC_OK)
{
in = method.getResponseBodyAsStream();
@@ -164,10 +165,15 @@
count = in.read(buf);
}
}
+ else
+ {
+ String reason = HttpStatus.getStatusText(status);
+ Reporter.informUser(this, UserMsg.MISSING_FILE, new Object[] { reason + ':' + uri.getPath() });
+ }
}
catch (IOException e)
{
- throw new LucidException(UserMsg.MISSING_FILE, e);
+ throw new LucidException(UserMsg.MISSING_FILE, e, new Object[] { uri.toString() });
}
finally
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java 2008-05-12 00:05:51 UTC (rev 1854)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java 2008-05-12 03:03:15 UTC (rev 1855)
@@ -79,19 +79,24 @@
/* @Override */
protected void download(Progress job, String dir, String file, URI dest) throws InstallException
{
+ URI uri;
try
{
- URI uri = new URI(NetUtil.PROTOCOL_HTTP, host, dir + '/' + file, null);
+ uri = new URI(NetUtil.PROTOCOL_HTTP, host, dir + '/' + file, null);
+ }
+ catch (URISyntaxException e1)
+ {
+ throw new InstallException(UserMsg.MISSING_FILE, e1, new Object[] { dir + '/' + file });
+ }
+
+ try
+ {
copy(job, uri, dest);
}
catch (LucidException ex)
{
- throw new InstallException(UserMsg.MISSING_FILE, ex);
+ throw new InstallException(UserMsg.MISSING_FILE, ex, new Object[] { uri.toString() });
}
- catch (URISyntaxException e)
- {
- assert false : e;
- }
}
/**
More information about the jsword-svn
mailing list