aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Meyer <[email protected]>2012-04-10 19:10:43 +0200
committerThomas Meyer <[email protected]>2012-04-10 19:10:43 +0200
commitb942de5bc239dded7694330f6f7c9d25e4352b03 (patch)
treedd578a6894b9534b4ad283b9e0381cb5206eaa94
parent055577a36255b0ae4dc130793c12f5207c11bd2c (diff)
Validate the recently_used file at every load. This will fix the StringIndex-
OutOfBoundsException for a corrupted path entry thrown in CacheUtil.pathToURLPath(). This Exception was catched in RessourceTracker.Downloader.run() and only printed in debug mode.
-rw-r--r--ChangeLog21
-rw-r--r--Makefile.am16
-rw-r--r--netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java67
-rw-r--r--netx/net/sourceforge/jnlp/cache/CacheUtil.java143
-rw-r--r--netx/net/sourceforge/jnlp/resources/Messages.properties9
-rw-r--r--tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java93
6 files changed, 222 insertions, 127 deletions
diff --git a/ChangeLog b/ChangeLog
index 58c4189..24c6ec5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2012-06-04 Jiri Vanek <[email protected]>
+ Thomas Meyer <[email protected]>
+
+ * makefile.am: (stamps/run-netx-dist-tests.stamp) and
+ (run-reproducers-test-code-coverage.stamp)
+ now using $(javaws) variable instead of plaintext javaws
+ * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java: (checkData) new
+ method checking for sanity of cache entries
+ (load) now checks for data sanity after loading, and stores without
+ corrupted items if necessary
+ (Comparator.compare) for sorting lru items. Now redundant checking for
+ sanity removed
+ * netx/net/sourceforge/jnlp/cache/CacheUtil.java: (getCacheFile) don't
+ call lruHandler.store twice for new cache entries
+ (getCacheFileIfExist) removed iteration and cleaning mechanism
+ * netx/net/sourceforge/jnlp/resources/Messages.properties: modified
+ cache messages
+ * tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java
+ Added test for checking corrupted path in entry and all tests adapted for
+ exception thrown only in debug mode
+
2012-04-04 Danesh Dadachanji <[email protected]>
Change the name of JarSigner to JarCertVerifier to make it more
relevant to the purpose of the file.
diff --git a/Makefile.am b/Makefile.am
index c4edc06..b8a41a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -565,7 +565,7 @@ stamps/run-netx-dist-tests.stamp: stamps/netx-dist.stamp extra-lib/about.jar sta
cd $(JNLP_TESTS_ENGINE_DIR) ; \
class_names=`cat $(REPRODUCERS_CLASS_NAMES)` ; \
CLASSPATH=$(NETX_DIR)/lib/classes.jar:$(JUNIT_JAR):$(JUNIT_RUNNER_JAR):. \
- $(BOOT_DIR)/bin/java -Dtest.server.dir=$(JNLP_TESTS_SERVER_DEPLOYDIR) -Djavaws.build.bin=$(DESTDIR)$(bindir)/javaws \
+ $(BOOT_DIR)/bin/java -Dtest.server.dir=$(JNLP_TESTS_SERVER_DEPLOYDIR) -Djavaws.build.bin=$(DESTDIR)$(bindir)/$(javaws) \
-Xbootclasspath:$(RUNTIME) CommandLine $$class_names \
> stdout.log 2> stderr.log ; \
cat stdout.log ; \
@@ -676,9 +676,9 @@ if WITH_EMMA
$(BOOT_DIR)/bin/jar -cf $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar * ; \
popd ; \
rm -rf $$instructed_dir ; \
- echo "patching javaws" ; \
- cat $$javaws_backup | sed "s,$(LAUNCHER_BOOTCLASSPATH),$$nw_bootclasspath," > $(DESTDIR)$(bindir)/javaws ; \
- chmod 777 $(DESTDIR)$(bindir)/javaws ; \
+ echo "patching $(javaws)" ; \
+ cat $$javaws_backup | sed "s,$(LAUNCHER_BOOTCLASSPATH),$$nw_bootclasspath," > $(DESTDIR)$(bindir)/$(javaws) ; \
+ chmod 777 $(DESTDIR)$(bindir)/$(javaws) ; \
testcases_srcs=( ) ; \
k=0 ; \
types=(simple signed); \
@@ -697,7 +697,7 @@ if WITH_EMMA
class_names=`cat $(REPRODUCERS_CLASS_NAMES)` ; \
$(BOOT_DIR)/bin/java \
-Dtest.server.dir=$(JNLP_TESTS_SERVER_DEPLOYDIR) \
- -Djavaws.build.bin=$(DESTDIR)$(bindir)/javaws \
+ -Djavaws.build.bin=$(DESTDIR)$(bindir)/$(javaws) \
-Xbootclasspath:$(RUNTIME) -cp $(EMMA_JAR) emmarun \
-raw \
-cp $(NETX_DIR)/lib/classes.jar \
@@ -727,9 +727,9 @@ if WITH_EMMA
-r xml \
"$${testcases_srcs[@]}" ; \
echo "restoring javaws and netx.jar in $(DESTDIR)" ; \
- rm -f $(DESTDIR)$(bindir)/javaws $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar ; \
- rm -f $(DESTDIR)$(bindir)/javaws; \
- mv $$javaws_backup $(DESTDIR)$(bindir)/javaws; \
+ rm -f $(DESTDIR)$(bindir)/$(javaws) $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar ; \
+ rm -f $(DESTDIR)$(bindir)/$(javaws); \
+ mv $$javaws_backup $(DESTDIR)$(bindir)/$(javaws); \
mv $$netx_backup $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar ; \
mv $(JNLP_TESTS_ENGINE_DIR)/tests-output.xml $(JNLP_TESTS_ENGINE_DIR)/tests-output_withEmma.xml ; \
mv $(JNLP_TESTS_ENGINE_DIR)/tests-output.xml_noEmma $(JNLP_TESTS_ENGINE_DIR)/tests-output.xml ; \
diff --git a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
index e148bd3..a1eef67 100644
--- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
+++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
@@ -36,6 +36,7 @@ exception statement from your version.
*/
package net.sourceforge.jnlp.cache;
+import java.util.Set;
import static net.sourceforge.jnlp.runtime.Translator.R;
import java.io.File;
@@ -45,6 +46,7 @@ import java.nio.channels.OverlappingFileLockException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
@@ -107,6 +109,57 @@ enum CacheLRUWrapper {
*/
public synchronized void load() {
cacheOrder.load();
+ /*
+ * clean up possibly corrupted entries
+ */
+ if (checkData()) {
+ if (JNLPRuntime.isDebug()) {
+ new LruCacheException().printStackTrace();
+ }
+ System.out.println(R("CFakeCache"));
+ store();
+ System.out.println(R("CFakedCache"));
+ }
+ }
+
+ /**
+ * check content of cacheOrder and remove invalid/corrupt entries
+ *
+ * @return true, if cache was coruupted and affected entry removed
+ */
+ private boolean checkData () {
+ boolean modified = false;
+ Set<Entry<Object, Object>> q = cacheOrder.entrySet();
+ for (Iterator<Entry<Object, Object>> it = q.iterator(); it.hasNext();) {
+ Entry<Object, Object> currentEntry = it.next();
+
+ final String key = (String) currentEntry.getKey();
+ final String path = (String) currentEntry.getValue();
+
+ // 1. check key format: "milliseconds,number"
+ try {
+ String sa[] = key.split(",");
+ Long l1 = Long.parseLong(sa[0]);
+ Long l2 = Long.parseLong(sa[1]);
+ } catch (Exception ex) {
+ it.remove();
+ modified = true;
+ continue;
+ }
+
+ // 2. check path format - does the path look correct?
+ if (path != null) {
+ if (path.indexOf(cacheDir) < 0) {
+ it.remove();
+ modified = true;
+ }
+ } else {
+ it.remove();
+ modified = true;
+ }
+ }
+
+ return modified;
}
/**
@@ -174,15 +227,11 @@ enum CacheLRUWrapper {
Collections.sort(entries, new Comparator<Entry<String, String>>() {
@Override
public int compare(Entry<String, String> e1, Entry<String, String> e2) {
- try {
- Long t1 = Long.parseLong(e1.getKey().split(",")[0]);
- Long t2 = Long.parseLong(e2.getKey().split(",")[0]);
-
- int c = t1.compareTo(t2);
- return c < 0 ? 1 : (c > 0 ? -1 : 0);
- } catch (Exception e) {
- throw new LruCacheException(R("Corrupt LRU file entries"));
- }
+ Long t1 = Long.parseLong(e1.getKey().split(",")[0]);
+ Long t2 = Long.parseLong(e2.getKey().split(",")[0]);
+
+ int c = t1.compareTo(t2);
+ return c < 0 ? 1 : (c > 0 ? -1 : 0);
}
});
return entries;
diff --git a/netx/net/sourceforge/jnlp/cache/CacheUtil.java b/netx/net/sourceforge/jnlp/cache/CacheUtil.java
index 320b0f2..2e9aaaa 100644
--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java
+++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java
@@ -307,8 +307,8 @@ public class CacheUtil {
cacheFile = getCacheFileIfExist(urlToPath(source, ""));
if (cacheFile == null) { // We did not find a copy of it.
cacheFile = makeNewCacheFile(source, version);
- }
- lruHandler.store();
+ } else
+ lruHandler.store();
lruHandler.unlock();
}
return cacheFile;
@@ -323,48 +323,16 @@ public class CacheUtil {
private static File getCacheFileIfExist(File urlPath) {
synchronized (lruHandler) {
File cacheFile = null;
- int tries = 0;
- List<Entry<String, String>> entries = null;
- do {
- try {
- tries++;
- entries = lruHandler.getLRUSortedEntries();
- } catch (LruCacheException ex) {
- if (tries == 1) {
- ex.printStackTrace();
- System.out.println(R("CFakeCache"));
- lruHandler.clearLRUSortedEntries();
- lruHandler.store();
- System.out.println(R("CFakedCache"));
- } else if (tries == 2) {
- ex.printStackTrace();
- System.out.println(R("CStillCorupted"));
- boolean clearingresult = CacheUtil.clearCache();
- if (!clearingresult) {
- throw new InternalError(R("CCleaningUnsuccessful"));
- }
- System.out.println(R("CClearedReloading"));
- lruHandler.clearLRUSortedEntries();
- lruHandler.store();
- System.out.println(R("CReloadRestarting"));
-
- } else {
- throw new InternalError(R("CStillBroken"));
- }
-
- }
- } while (entries == null);
+ List<Entry<String, String>> entries = lruHandler.getLRUSortedEntries();
// Start searching from the most recent to least recent.
for (Entry<String, String> e : entries) {
final String key = e.getKey();
final String path = e.getValue();
- if (path != null) {
- if (pathToURLPath(path).equals(urlPath.getPath())) { // Match found.
- cacheFile = new File(path);
- lruHandler.updateEntry(key);
- break; // Stop searching since we got newest one already.
- }
+ if (pathToURLPath(path).equals(urlPath.getPath())) { // Match found.
+ cacheFile = new File(path);
+ lruHandler.updateEntry(key);
+ break; // Stop searching since we got newest one already.
}
}
return cacheFile;
@@ -561,6 +529,7 @@ public class CacheUtil {
* This will remove all old cache items.
*/
public static void cleanCache() {
+
if (okToClearCache()) {
// First we want to figure out which stuff we need to delete.
HashSet<String> keep = new HashSet<String>();
@@ -579,57 +548,55 @@ public class CacheUtil {
for (Entry<String, String> e : lruHandler.getLRUSortedEntries()) {
// Check if the item is contained in cacheOrder.
final String key = e.getKey();
- final String value = e.getValue();
-
- if (value != null) {
- File file = new File(value);
- PropertiesFile pf = new PropertiesFile(new File(value + ".info"));
- boolean delete = Boolean.parseBoolean(pf.getProperty("delete"));
-
- /*
- * This will get me the root directory specific to this cache item.
- * Example:
- * cacheDir = /home/user1/.icedtea/cache
- * file.getPath() = /home/user1/.icedtea/cache/0/http/www.example.com/subdir/a.jar
- * rStr first becomes: /0/http/www.example.com/subdir/a.jar
- * then rstr becomes: /home/user1/.icedtea/cache/0
- */
- String rStr = file.getPath().substring(cacheDir.length());
- rStr = cacheDir + rStr.substring(0, rStr.indexOf(File.separatorChar, 1));
- long len = file.length();
-
- if (keep.contains(file.getPath().substring(rStr.length()))) {
- lruHandler.removeEntry(key);
- continue;
- }
-
- /*
- * we remove entries from our lru if any of the following condition is met.
- * Conditions:
- * - delete: file has been marked for deletion.
- * - !file.isFile(): if someone tampered with the directory, file doesn't exist.
- * - maxSize >= 0 && curSize + len > maxSize: If a limit was set and the new size
- * on disk would exceed the maximum size.
- */
- if (delete || !file.isFile() || (maxSize >= 0 && curSize + len > maxSize)) {
- lruHandler.removeEntry(key);
- remove.add(rStr);
- } else {
- curSize += len;
- keep.add(file.getPath().substring(rStr.length()));
-
- for (File f : file.getParentFile().listFiles()) {
- if (!(f.equals(file) || f.equals(pf.getStoreFile()))){
- try {
- FileUtils.recursiveDelete(f, f);
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- }
+ final String path = e.getValue();
+
+ File file = new File(path);
+ PropertiesFile pf = new PropertiesFile(new File(path + ".info"));
+ boolean delete = Boolean.parseBoolean(pf.getProperty("delete"));
+
+ /*
+ * This will get me the root directory specific to this cache item.
+ * Example:
+ * cacheDir = /home/user1/.icedtea/cache
+ * file.getPath() = /home/user1/.icedtea/cache/0/http/www.example.com/subdir/a.jar
+ * rStr first becomes: /0/http/www.example.com/subdir/a.jar
+ * then rstr becomes: /home/user1/.icedtea/cache/0
+ */
+ String rStr = file.getPath().substring(cacheDir.length());
+ rStr = cacheDir + rStr.substring(0, rStr.indexOf(File.separatorChar, 1));
+ long len = file.length();
+
+ if (keep.contains(file.getPath().substring(rStr.length()))) {
+ lruHandler.removeEntry(key);
+ continue;
+ }
+
+ /*
+ * we remove entries from our lru if any of the following condition is met.
+ * Conditions:
+ * - delete: file has been marked for deletion.
+ * - !file.isFile(): if someone tampered with the directory, file doesn't exist.
+ * - maxSize >= 0 && curSize + len > maxSize: If a limit was set and the new size
+ * on disk would exceed the maximum size.
+ */
+ if (delete || !file.isFile() || (maxSize >= 0 && curSize + len > maxSize)) {
+ lruHandler.removeEntry(key);
+ remove.add(rStr);
+ continue;
+ }
+
+ curSize += len;
+ keep.add(file.getPath().substring(rStr.length()));
+
+ for (File f : file.getParentFile().listFiles()) {
+ if (!(f.equals(file) || f.equals(pf.getStoreFile()))) {
+ try {
+ FileUtils.recursiveDelete(f, f);
+ } catch (IOException e1) {
+ e1.printStackTrace();
}
}
- } else {
- lruHandler.removeEntry(key);
+
}
}
lruHandler.store();
diff --git a/netx/net/sourceforge/jnlp/resources/Messages.properties b/netx/net/sourceforge/jnlp/resources/Messages.properties
index a0801b6..9866fe7 100644
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties
@@ -192,13 +192,8 @@ CChooseCache=Choose a cache directory...
CChooseCacheInfo=Netx needs a location for storing cache files.
CChooseCacheDir=Cache directory
CCannotClearCache=Can not clear cache at this time
-CFakeCache=Cache is corrupt. Disabling.
-CFakedCache=Cache is corrupt and has been disabled. It is strongly recommended that you run 'javaws -Xclearcache' and rerun your application as soon as possible.
-CStillCorupted=Cache is still corrupt, clearing it.
-CCleaningUnsuccessful=Unable to clear cache due to running javaws instance. Please try to shut down all instances of javaws, run 'javaws -Xclearcache', and rerun your jnlp file
-CClearedReloading=Cache cleared, re-loading.
-CReloadRestarting=Cache re-loaded and application re-starting. It is strongly recommended that you run 'javaws -Xclearcache' and re-run your application as soon as possible.
-CStillBroken=Unable to fix corrupt cache. Please shutdown all javaws instances, run 'javaws -Xclearcache', and re-start your application.
+CFakeCache=Cache is corrupt. Fixing.
+CFakedCache=Cache is corrupt and has been fixed. It is strongly recommended that you run 'javaws -Xclearcache' and rerun your application as soon as possible.
# Security
SFileReadAccess=The application has requested read access to {0}. Do you want to allow this action?
diff --git a/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java b/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java
index 2631001..9b1fe29 100644
--- a/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java
+++ b/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java
@@ -57,7 +57,8 @@ public class CacheReproducerTest {
private static final ServerAccess server = new ServerAccess();
private static final List<String> clear = Arrays.asList(new String[]{server.getJavawsLocation(), "-Xclearcache", ServerAccess.HEADLES_OPTION});
- private static final List<String> trusted = Arrays.asList(new String[]{"-Xtrustall", 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");
@@ -66,10 +67,17 @@ public class CacheReproducerTest {
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";
+
@Test
public void cacheIsWorkingTest() throws Exception {
clearAndEvaluateCache();
@@ -131,6 +139,10 @@ public class CacheReproducerTest {
Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should not be empty", icedteaCacheFile.length() > 0);
}
+ /**
+ * This is breaking integer numbers in first part of cache file item
+ * @throws Exception
+ */
@Test
public void coruptAndRunCache1() throws Exception {
clearAndEvaluateCache();
@@ -146,9 +158,13 @@ public class CacheReproducerTest {
assertLruExceptionNOTappeared(pr2);
}
+ /**
+ * This is breaking integer numbers in first part of cache file item
+ * @throws Exception
+ */
@Test
public void coruptAndRunCache2() throws Exception {
- clearAndEvaluateCache();
+ clearAndEvaluateCache();
evaluateSimpleTest1OkCache(runSimpleTest1());
assertCacheIsNotEmpty();
breakCache1();
@@ -164,6 +180,33 @@ public class CacheReproducerTest {
assertLruExceptionNOTappeared(pr2);
}
+ /**
+ * 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);
+ assertLruExceptionAppeared(pr);
+ evaluateSimpleTest1OkCache(pr);
+ ProcessResult pr3 = runSimpleTest1();
+ evaluateSimpleTest1OkCache(pr3);
+ assertLruExceptionNOTappeared(pr3);
+ clearAndEvaluateCache();
+ ProcessResult pr2 = runSimpleTest1();
+ evaluateSimpleTest1OkCache(pr2);
+ assertLruExceptionNOTappeared(pr2);
+ }
+
+ private void assertAoobNOTappeared(ProcessResult pr2) {
+ Assert.assertFalse("serr should NOT contain " + ioobe, pr2.stderr.contains(ioobe));
+ }
+
private void assertLruExceptionNOTappeared(ProcessResult pr2) {
Assert.assertFalse("serr should NOT contain " + lre, pr2.stderr.contains(lre));
}
@@ -174,7 +217,7 @@ public class CacheReproducerTest {
@Test
public void coruptAndRunCache1Signed() throws Exception {
- clearAndEvaluateCache();
+ clearAndEvaluateCache();
evaluateSimpleTest1OkCache(runSimpleTest1());
assertCacheIsNotEmpty();
breakCache1();
@@ -189,7 +232,7 @@ public class CacheReproducerTest {
@Test
public void coruptAndRunCache2Signed() throws Exception {
- clearAndEvaluateCache();
+ clearAndEvaluateCache();
evaluateSimpleTest1OkCache(runSimpleTest1());
assertCacheIsNotEmpty();
breakCache1();
@@ -217,7 +260,7 @@ public class CacheReproducerTest {
try {
System.out.println("connecting deadlocktest request");
System.err.println("connecting deadlocktest request");
- ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/deadlocktest.jnlp");
+ ServerAccess.ProcessResult pr = server.executeJavawsHeadless(verbosed, "/deadlocktest.jnlp");
System.out.println(pr.stdout);
System.err.println(pr.stderr);
} catch (Exception ex) {
@@ -236,7 +279,7 @@ public class CacheReproducerTest {
}
- //next four tests are designed to ensure, that corupted cache wil not break already loaded cached files
+ //next four tests are designed to ensure, that corrupted cache will not break already loaded cached files
public static final String CR1 = "CacheReproducer1";
public static final String CR2 = "CacheReproducer2";
public static final String CR11 = "CacheReproducer1_1";
@@ -327,14 +370,9 @@ public class CacheReproducerTest {
}
@Test
- public void assertBreakersAreWorking() {
- String s = "#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";
+ public void assertBreakers1AreWorking() {
+ String s=testS;
String sp[] = s.split("\n");
-
String ss[] = breakAll(s).split("\n");
for (int i = 0; i < 2; i++) {
Assert.assertEquals(sp[i], ss[i]);
@@ -378,6 +416,25 @@ public class CacheReproducerTest {
return s;
}
+ @Test
+ public void assertBreakers2AreWorking() {
+ String s=testS;
+ String sp[] = s.split("\n");
+ String ss[] = breakPaths (s).split("\n");
+ for (int i = 0; i < 2; i++) {
+ Assert.assertEquals(sp[i], ss[i]);
+
+ }
+ for (int i = 2; i < ss.length; i++) {
+ Assert.assertNotSame(sp[i], ss[i]);
+
+ }
+ }
+
+ private static String breakPaths(String s) {
+ return s.replaceAll(home+".*", "/ho");
+ }
+
private static void breakCache1() throws IOException {
String s = loadCacheFile();
s = breakAll(s);
@@ -390,8 +447,14 @@ public class CacheReproducerTest {
ServerAccess.saveFile(s, icedteaCacheFile);
}
+ private static void breakCache3() throws IOException {
+ String s = loadCacheFile();
+ s = breakPaths(s);
+ ServerAccess.saveFile(s, icedteaCacheFile);
+ }
+
private static ServerAccess.ProcessResult runSimpleTest1() throws Exception {
- return runSimpleTest1(null, "simpletest1");
+ return runSimpleTest1(verbosed, "simpletest1");
}
private static ServerAccess.ProcessResult runSimpleTest1(List<String> args, String s) throws Exception {
@@ -408,7 +471,7 @@ public class CacheReproducerTest {
}
private static ServerAccess.ProcessResult runSimpleTestSigned(String id) throws Exception {
- return runSimpleTest1(trusted, id);
+ return runSimpleTest1(trustedVerboses, id);
}
private static void evaluateSimpleTest1OkCache(ServerAccess.ProcessResult pr2) throws Exception {