/hg/icedtea-web: Fixed "could not clear cache" message and cache...
Jacob Wisor
gitne at gmx.de
Thu Sep 5 02:28:21 PDT 2013
Jiri Vanek wrote:
> On 09/04/2013 07:49 PM, aazores at icedtea.classpath.org wrote:
>> changeset bb8132ebc241 in /hg/icedtea-web
>> details:
>> http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=bb8132ebc241
>>
>> author: Andrew Azores <aazores at redhat.com>
>> date: Wed Sep 04 13:48:42 2013 -0400
>>
>> Fixed "could not clear cache" message and cache location in
>> CacheReproducer
>>
>>
>> diffstat:
>>
>>
>> ChangeLog
>> | 8 +
>>
>> netx/net/sourceforge/jnlp/config/Defaults.java
>> | 2 +-
>>
>> tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java
>> | 95 +++++----
>> 3 files changed, 64 insertions(+), 41 deletions(-)
>>
>> diffs (228 lines):
>>
>> diff -r 6c0e37585a5e -r bb8132ebc241 ChangeLog
>> --- a/ChangeLog Wed Sep 04 12:22:16 2013 -0400
>> +++ b/ChangeLog Wed Sep 04 13:48:42 2013 -0400
>> @@ -1,3 +1,11 @@
>> +2013-09-04 Andrew Azores <aazores at redhat.com>
>> +
>> + * netx/net/sourceforge/jnlp/config/Defaults.java:
>> (USER_CACHE_HOME) made
>> + public for use in CacheReproducer
>> + *
>> tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest:
>> + updated "could not clear cache" message and cache location. Other
>> minor
>> + cleanup
>> +
>> 2013-09-04 Andrew Azores <aazores at redhat.com>
>>
>> * netx/net/sourceforge/jnlp/security/SecurityDialogs.java:
>> diff -r 6c0e37585a5e -r bb8132ebc241
>> netx/net/sourceforge/jnlp/config/Defaults.java
>> --- a/netx/net/sourceforge/jnlp/config/Defaults.java Wed Sep 04
>> 12:22:16 2013 -0400
>> +++ b/netx/net/sourceforge/jnlp/config/Defaults.java Wed Sep 04
>> 13:48:42 2013 -0400
>> @@ -55,7 +55,7 @@
>> final static String SYSTEM_HOME = System.getProperty("java.home");
>> final static String SYSTEM_SECURITY = SYSTEM_HOME +
>> File.separator + "lib" + File.separator + "security";
>> final static String USER_CONFIG_HOME;
>> - final static String USER_CACHE_HOME;
>> + public final static String USER_CACHE_HOME;
>> final static String USER_SECURITY;
>> final static String LOCKS_DIR =
>> System.getProperty("java.io.tmpdir") + File.separator
>> + System.getProperty("user.name") + File.separator +
>> "netx" + File.separator
>> diff -r 6c0e37585a5e -r bb8132ebc241
>> tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java
>>
>> ---
>> a/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java
>> Wed Sep 04 12:22:16 2013 -0400
>> +++
>> b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java
>> Wed Sep 04 13:48:42 2013 -0400
>> @@ -44,11 +44,13 @@
>> import java.io.UnsupportedEncodingException;
>> import java.util.Arrays;
>> import java.util.List;
>> +import java.util.PropertyResourceBundle;
>> import java.util.regex.Matcher;
>> import java.util.regex.Pattern;
>> import net.sourceforge.jnlp.ServerAccess;
>> -import net.sourceforge.jnlp.ServerAccess.ProcessResult;
>> +import net.sourceforge.jnlp.ProcessResult;
>> import net.sourceforge.jnlp.annotations.KnownToFail;
>> +import net.sourceforge.jnlp.config.Defaults;
>> import org.junit.AfterClass;
>> import org.junit.Assert;
>>
>> @@ -60,24 +62,37 @@
>> private static final List<String> clear = Arrays.asList(new
>> String[]{server.getJavawsLocation(), "-Xclearcache",
>> ServerAccess.HEADLES_OPTION});
>> private static final List<String> trustedVerboses =
>> Arrays.asList(new String[]{"-Xtrustall",
>> ServerAccess.HEADLES_OPTION,"-verbose"});
>> private static final List<String> verbosed = Arrays.asList(new
>> String[]{"-verbose", ServerAccess.HEADLES_OPTION});
>> - private static final String home = System.getProperty("user.home");
>> - private static final String name = System.getProperty("user.name");
>> - private static final String tmp =
>> System.getProperty("java.io.tmpdir");
>> - private static final File icedteaDir = new File(home + "/" +
>> ".icedtea");
>> - private static final File icedteaCache = new File(icedteaDir,
>> "cache");
>> - private static final File icedteaCacheFile = new
>> File(icedteaCache, "recently_used");
>> - private static final File netxLock = new File(tmp + "/" + name +
>> "/netx/locks/netx_running");
>> +
>> private static final String lre = "LruCacheException";
>> private static final String ioobe = "IndexOutOfBoundsException";
>> private static final String corruptRegex = "\\d{13}";
>> private static final Pattern corruptPatern =
>> Pattern.compile(corruptRegex);
>> private static final String corruptString = "156dsf1562kd5";
>>
>> - String testS = "#netx file\n"
>> - + "#Mon Dec 12 16:20:46 CET 2011\n"
>> - +
>> "1323703236508,0=/home/xp13/.icedtea/cache/0/http/localhost/ReadPropertiesBySignedHack.jnlp\n"
>>
>> - +
>> "1323703243086,2=/home/xp14/.icedtea/cache/2/http/localhost/ReadProperties.jar\n"
>>
>> - +
>> "1323703243082,1=/home/xp15/.icedtea/cache/1/http/localhost/ReadPropertiesBySignedHack.jar";
>>
>> + private static final File icedteaCache = new
>> File(Defaults.USER_CACHE_HOME, "cache");
>> + private static final File icedteaCacheFile = new
>> File(icedteaCache, "recently_used");
>> + private static final File netxLock = new
>> File(System.getProperty("java.io.tmpdir"),
>> + System.getProperty("user.name") + File.separator +
>> + "netx" + File.separator +
>> + "locks" + File.separator +
>> + "netx_running");
>> +
>> + private static final String messageResourcePath =
>> "net/sourceforge/jnlp/resources/Messages.properties";
>> + private static PropertyResourceBundle messageBundle = null;
>> +
>> + static {
>> + try {
>> + messageBundle =
>> + new
>> PropertyResourceBundle(CacheReproducerTest.class.getClassLoader().getResourceAsStream(messageResourcePath));
>>
>> + } catch (IOException e) {
>> + }
>> + }
>> +
>
> Pleae NEVER consume an exception.
>
> In this case the
>
> } catch (IOException ex) {
> throw new RuntimeException(ex);
> }
Throwing a chained RuntimeException is going to disrupt the program's flow. So,
I would rather advise
} catch (IOException e) {
e.printStackTrace();
}
This will make IOException at least visible on stderr and preserve what has been
previously intended, namely continuing program execution undisrupted.
> Would be the best. You can push this without any other review (unless
> you think about different fix)
Regards,
Jacob
More information about the distro-pkg-dev
mailing list