Patch for Review: Netx utilizing offline-allowed tag
Deepak Bhole
dbhole at redhat.com
Wed Dec 9 10:59:57 PST 2009
* Man Wong <mwong at redhat.com> [2009-12-03 15:02]:
> This patch fixes the behaviour of netx such that it will no longer launch the jnlp file when system is offline and offline-allowed tag does not exist.
>
> Changelog:
> 2009-12-03 Man Lung Wong <mwong at redhat.com>
>
> * rt/net/sourceforge/jnlp/Launcher.java
> (launch): No longer launches when system offline and offline-allowed tag does not exist.
>
> Any comments?
>
> Thanks,
>
> Man Lung Wong
>
> diff -r eb51df7af234 rt/net/sourceforge/jnlp/Launcher.java
> --- a/rt/net/sourceforge/jnlp/Launcher.java Wed Dec 02 10:40:55 2009 +0100
> +++ b/rt/net/sourceforge/jnlp/Launcher.java Wed Dec 02 10:44:59 2009 -0500
> @@ -19,14 +19,11 @@
>
> import java.applet.Applet;
> import java.awt.Container;
> -import java.io.BufferedInputStream;
> -import java.io.File;
> -import java.io.IOException;
> -import java.io.InputStream;
> +import java.io.*;
> import java.lang.management.ManagementFactory;
> import java.lang.management.ThreadMXBean;
> import java.lang.reflect.Method;
> -import java.net.URL;
> +import java.net.*;
> import java.util.LinkedList;
> import java.util.List;
> import java.util.jar.JarFile;
> @@ -187,6 +184,21 @@
> */
> public ApplicationInstance launch(JNLPFile file, Container cont) throws LaunchException {
> TgThread tg;
> +
> + //First checks whether offline-allowed tag is specified inside the jnlp
> + //file.
> + if (!file.getInformation().isOfflineAllowed()) {
> + try {
> + //Checks the offline/online status of the system.
> + //If system is offline do not launch.
> + InetAddress.getByName(file.getSourceLocation().getHost());
> +
> + } catch (UnknownHostException ue) {
> + return null;
> + } catch (Exception e) {
> + System.err.println(e);
> + }
> + }
>
> if (file instanceof PluginBridge && cont != null)
> tg = new TgThread(file, cont, true);
If launch() returns null, what happens? Is it handled gracefully? If
not, we should have it print a message stating why the launch failed..
Deepak
More information about the distro-pkg-dev
mailing list