[RFC] Fix IndexOutOfBoundException because of corrupted entry in recently_used file
Jiri Vanek
jvanek at redhat.com
Tue Apr 10 01:19:36 PDT 2012
On 04/10/2012 12:04 AM, Thomas Meyer wrote:
> Am Freitag, den 06.04.2012, 12:01 +0200 schrieb Jiri Vanek:
> + /**
> + * This is breaking paths in second part of cache file item
> + * @throws Exception
> + */
> + @Test
> + public void coruptAndRunCache3() throws Exception {
> + clearAndEvaluateCache();
> + evaluateSimpleTest1OkCache(runSimpleTest1());
> + assertCacheIsNotEmpty();
> + breakCache3();
> + ProcessResult pr = runSimpleTest1();
> + assertAoobNOTappeared(pr);
>
> In the current code the StringIndexOutOfBoundsExceptions is only printed
> in verbose mode in netx/net/sourceforge/jnlp/cache/ResourceTracker.java
> in the private class Downloader in this catch:
Yy, and patch is launching javaws in verbose mode;)
>
> try {
>
> // Resource processing involves writing to files
> // (cache entry trackers, the files themselves, etc.)
> // and it therefore needs to be privileged
>
> final Resource fResource = resource;
> AccessController.doPrivileged(new PrivilegedAction<Void>() {
> public Void run() {
> processResource(fResource);
> return null;
> }
> });
>
> } catch (Exception ex) {
> if (JNLPRuntime.isDebug())
> -> ex.printStackTrace();
> }
>
> the Exception itself is thrown at CacheUtil.getCacheFileIfExist() -> pathToURLPath()
>
> private static String pathToURLPath(String path) {
> int len = cacheDir.length();
> int index = path.indexOf(File.separatorChar, len + 1);
> -> return path.substring(index);
> }
>
> + assertLruExceptionAppeared(pr);
> + evaluateSimpleTest1OkCache(pr);
> + ProcessResult pr3 = runSimpleTest1();
> + evaluateSimpleTest1OkCache(pr3);
> + assertLruExceptionNOTappeared(pr3);
> + clearAndEvaluateCache();
> + ProcessResult pr2 = runSimpleTest1();
> + evaluateSimpleTest1OkCache(pr2);
> + assertLruExceptionNOTappeared(pr2);
> + }
>
> I'm not sure if this test case does the right thing.
so I thing it does....
>
> kind regards
> thomas
>
>
>
More information about the distro-pkg-dev
mailing list