From 3601afa5b8b1083c4e89b954d91fd4d2b3ba654f Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Fri, 26 Apr 2013 11:29:04 +0200 Subject: Fixed regressed unittest and "cause", Fixed compilation under jdk6, Silenced unittests --- .../sourceforge/jnlp/NullJnlpFileException.java | 42 ++++++++++++++++++---- netx/net/sourceforge/jnlp/SecurityDesc.java | 3 ++ netx/net/sourceforge/jnlp/util/JarFile.java | 6 ++-- netx/net/sourceforge/jnlp/util/StreamUtils.java | 4 +-- 4 files changed, 44 insertions(+), 11 deletions(-) (limited to 'netx') diff --git a/netx/net/sourceforge/jnlp/NullJnlpFileException.java b/netx/net/sourceforge/jnlp/NullJnlpFileException.java index 9c67f61..58c4d87 100644 --- a/netx/net/sourceforge/jnlp/NullJnlpFileException.java +++ b/netx/net/sourceforge/jnlp/NullJnlpFileException.java @@ -1,14 +1,42 @@ package net.sourceforge.jnlp; -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. -/** - * - * @author jvanek +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + public class NullJnlpFileException extends NullPointerException { public NullJnlpFileException() { diff --git a/netx/net/sourceforge/jnlp/SecurityDesc.java b/netx/net/sourceforge/jnlp/SecurityDesc.java index 927917a..51b58bb 100644 --- a/netx/net/sourceforge/jnlp/SecurityDesc.java +++ b/netx/net/sourceforge/jnlp/SecurityDesc.java @@ -149,6 +149,9 @@ public class SecurityDesc { * @param downloadHost the download host (can always connect to) */ public SecurityDesc(JNLPFile file, Object type, String downloadHost) { + if (file == null) { + throw new NullJnlpFileException(); + } this.file = file; this.type = type; this.downloadHost = downloadHost; diff --git a/netx/net/sourceforge/jnlp/util/JarFile.java b/netx/net/sourceforge/jnlp/util/JarFile.java index 8eee518..f90cba3 100644 --- a/netx/net/sourceforge/jnlp/util/JarFile.java +++ b/netx/net/sourceforge/jnlp/util/JarFile.java @@ -36,14 +36,16 @@ exception statement from your version. */ package net.sourceforge.jnlp.util; +import java.io.Closeable; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.zip.ZipFile; import net.sourceforge.jnlp.runtime.JNLPRuntime; -public class JarFile extends java.util.jar.JarFile { +//in jdk6 java.util.jar.JarFile is not Closeable - fixing +//overwritening class can add duplicate occurence of interface so this should be perfectly safe +public class JarFile extends java.util.jar.JarFile implements Closeable{ public JarFile(String name) throws IOException { super(name); diff --git a/netx/net/sourceforge/jnlp/util/StreamUtils.java b/netx/net/sourceforge/jnlp/util/StreamUtils.java index 7dd7a92..6692d1c 100644 --- a/netx/net/sourceforge/jnlp/util/StreamUtils.java +++ b/netx/net/sourceforge/jnlp/util/StreamUtils.java @@ -73,8 +73,8 @@ public class StreamUtils { } } } - - + + public static String readStreamAsString(InputStream stream) throws IOException { InputStreamReader is = new InputStreamReader(stream); StringBuilder sb = new StringBuilder(); -- cgit v1.2.3