diff -r e8341834febd launcher/launchers.in --- a/launcher/launchers.in Thu Jun 06 17:07:28 2013 +0200 +++ b/launcher/launchers.in Fri Jun 07 17:01:31 2013 +0200 @@ -9,9 +9,18 @@ PROGRAM_NAME=@PROGRAM_NAME@ CP=@JRE@/lib/rt.jar +CONFIG_HOME=$XDG_CONFIG_HOME +if [ "x$CONFIG_HOME" = "x" ] ; then + CONFIG_HOME=~/.config +fi; PROPERTY_NAME=deployment.jre.dir CUSTOM_JRE_REGEX="^$PROPERTY_NAME *= *" -CUSTOM_JRE=`grep "$CUSTOM_JRE_REGEX" ~/.icedtea/deployment.properties 2>/dev/null | sed "s/$CUSTOM_JRE_REGEX//g"` +CUSTOM_JRE=`grep "$CUSTOM_JRE_REGEX" $CONFIG_HOME/icedtea-web/deployment.properties 2>/dev/null | sed "s/$CUSTOM_JRE_REGEX//g"` +#now check in legacy one +if [ "x$CUSTOM_JRE" = "x" ] ; then + CUSTOM_JRE=`grep "$CUSTOM_JRE_REGEX" ~/.icedtea/deployment.properties 2>/dev/null | sed "s/$CUSTOM_JRE_REGEX//g"` +fi; +#now check in global one if [ "x$CUSTOM_JRE" = "x" ] ; then CUSTOM_JRE=`grep "$CUSTOM_JRE_REGEX" /etc/.java/.deploy/deployment.properties 2>/dev/null | sed "s/$CUSTOM_JRE_REGEX//g"` fi; diff -r e8341834febd netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java --- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Fri Jun 07 17:01:31 2013 +0200 @@ -62,7 +62,7 @@ * @author Andrew Su (asu@redhat.com, andrew.su@utoronto.ca) * */ -enum CacheLRUWrapper { +public enum CacheLRUWrapper { INSTANCE; private int lockCount = 0; @@ -80,8 +80,10 @@ * accessed) followed by folder of item. value = path to file. */ private PropertiesFile cacheOrder = new PropertiesFile( - new File(cacheDir + File.separator + "recently_used")); + new File(cacheDir + File.separator + CACHE_INDEX_FILE_NAME)); + public static final String CACHE_INDEX_FILE_NAME = "recently_used"; + private CacheLRUWrapper(){ File f = cacheOrder.getStoreFile(); if (!f.exists()) { diff -r e8341834febd netx/net/sourceforge/jnlp/config/Defaults.java --- a/netx/net/sourceforge/jnlp/config/Defaults.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/config/Defaults.java Fri Jun 07 17:01:31 2013 +0200 @@ -51,28 +51,43 @@ * This class stores the default configuration */ public class Defaults { + + 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; + 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 + + "locks"; + final static File userFile; + + static { + String configHome = System.getProperty("user.home"); + String cacheHome = System.getProperty("user.home"); + String XDG_CONFIG_HOME = System.getenv("XDG_CONFIG_HOME"); + String XDG_CACHE_HOME = System.getenv("XDG_CACHE_HOME"); + if (XDG_CONFIG_HOME != null){ + configHome=XDG_CONFIG_HOME; + } + if (XDG_CACHE_HOME != null){ + cacheHome=XDG_CACHE_HOME; + } + USER_CONFIG_HOME = configHome + File.separator + DeploymentConfiguration.DEPLOYMENT_CONFIG_DIR; + USER_CACHE_HOME = cacheHome + File.separator + DeploymentConfiguration.DEPLOYMENT_CACHE_DIR; + USER_SECURITY = USER_CONFIG_HOME + File.separator + "security"; + userFile = new File(USER_CONFIG_HOME + File.separator + DeploymentConfiguration.DEPLOYMENT_PROPERTIES); + } /** * Get the default settings for deployment */ public static Map> getDefaults() { - File userFile = new File(System.getProperty("user.home") + File.separator + DeploymentConfiguration.DEPLOYMENT_DIR - + File.separator + DeploymentConfiguration.DEPLOYMENT_PROPERTIES); - SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkRead(userFile.toString()); } - final String SYSTEM_HOME = System.getProperty("java.home"); - final String SYSTEM_SECURITY = SYSTEM_HOME + File.separator + "lib" + File.separator + "security"; - - final String USER_HOME = System.getProperty("user.home") + File.separator + DeploymentConfiguration.DEPLOYMENT_DIR; - final String USER_SECURITY = USER_HOME + File.separator + "security"; - - final String LOCKS_DIR = System.getProperty("java.io.tmpdir") + File.separator - + System.getProperty("user.name") + File.separator + "netx" + File.separator - + "locks"; /* * This is more or less a straight copy from the deployment @@ -90,12 +105,12 @@ { DeploymentConfiguration.KEY_USER_CACHE_DIR, BasicValueValidators.getFilePathValidator(), - USER_HOME + File.separator + "cache" + USER_CACHE_HOME + File.separator + "cache" }, { DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR, BasicValueValidators.getFilePathValidator(), - USER_HOME + File.separator + "pcache" + USER_CACHE_HOME + File.separator + "pcache" }, { DeploymentConfiguration.KEY_SYSTEM_CACHE_DIR, @@ -105,12 +120,12 @@ { DeploymentConfiguration.KEY_USER_LOG_DIR, BasicValueValidators.getFilePathValidator(), - USER_HOME + File.separator + "log" + USER_CONFIG_HOME + File.separator + "log" }, { DeploymentConfiguration.KEY_USER_TMP_DIR, BasicValueValidators.getFilePathValidator(), - USER_HOME + File.separator + "tmp" + USER_CACHE_HOME + File.separator + "tmp" }, { DeploymentConfiguration.KEY_USER_LOCKS_DIR, diff -r e8341834febd netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java --- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Fri Jun 07 17:01:31 2013 +0200 @@ -36,6 +36,7 @@ import java.util.Set; import javax.naming.ConfigurationException; +import net.sourceforge.jnlp.cache.CacheLRUWrapper; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.util.FileUtils; @@ -48,8 +49,10 @@ */ public final class DeploymentConfiguration { - public static final String DEPLOYMENT_DIR = ".icedtea"; - public static final String DEPLOYMENT_CONFIG = "deployment.config"; + public static final String DEPLOYMENT_SUBDIR_DIR = "icedtea-web"; + public static final String DEPLOYMENT_CACHE_DIR = ".cache" + File.separator + DEPLOYMENT_SUBDIR_DIR; + public static final String DEPLOYMENT_CONFIG_DIR = ".config" + File.separator + DEPLOYMENT_SUBDIR_DIR; + public static final String DEPLOYMENT_CONFIG_FILE = "deployment.config"; public static final String DEPLOYMENT_PROPERTIES = "deployment.properties"; public static final String APPLET_TRUST_SETTINGS = ".appletTrustSettings"; @@ -181,7 +184,7 @@ private File userPropertiesFile = null; /*default user file*/ - public static final File USER_DEPLOYMENT_PROPERTIES_FILE = new File(System.getProperty("user.home") + File.separator + DEPLOYMENT_DIR + public static final File USER_DEPLOYMENT_PROPERTIES_FILE = new File(System.getProperty("user.home") + File.separator + DEPLOYMENT_CONFIG_DIR + File.separator + DEPLOYMENT_PROPERTIES); /** the current deployment properties */ @@ -206,7 +209,7 @@ } public static File getAppletTrustUserSettingsPath() { - return new File(System.getProperty("user.home") + File.separator + DEPLOYMENT_DIR + return new File(System.getProperty("user.home") + File.separator + DEPLOYMENT_CONFIG_DIR + File.separator + APPLET_TRUST_SETTINGS); } @@ -251,7 +254,7 @@ if (systemConfigFile != null) { if (loadSystemConfiguration(systemConfigFile)) { if (JNLPRuntime.isDebug()) { - System.out.println("System level " + DEPLOYMENT_CONFIG + " is mandatory: " + systemPropertiesMandatory); + System.out.println("System level " + DEPLOYMENT_CONFIG_FILE + " is mandatory: " + systemPropertiesMandatory); } /* Second, read the System level deployment.properties file */ systemProperties = loadProperties(ConfigType.System, systemPropertiesFile, @@ -414,7 +417,7 @@ */ private File findSystemConfigFile() { File etcFile = new File(File.separator + "etc" + File.separator + ".java" + File.separator - + "deployment" + File.separator + DEPLOYMENT_CONFIG); + + "deployment" + File.separator + DEPLOYMENT_CONFIG_FILE); if (etcFile.isFile()) { return etcFile; } @@ -435,10 +438,10 @@ File jreFile; if (jrePath != null) { jreFile = new File(jrePath + File.separator + "lib" - + File.separator + DEPLOYMENT_CONFIG); + + File.separator + DEPLOYMENT_CONFIG_FILE); } else { jreFile = new File(System.getProperty("java.home") + File.separator + "lib" - + File.separator + DEPLOYMENT_CONFIG); + + File.separator + DEPLOYMENT_CONFIG_FILE); } if (jreFile.isFile()) { return jreFile; @@ -681,4 +684,118 @@ + (value.isLocked() ? " [LOCKED]" : "")); } } + + public static void move14AndOlderFilesTo15StructureCatched() { + try{ + move14AndOlderFilesTo15Structure(); + }catch(Throwable t){ + System.err.println("Critical error during converting old files to new. Continuing"); + t.printStackTrace(); + } + + } + private static void move14AndOlderFilesTo15Structure() { + int errors = 0; + String PRE_15_DEPLOYMENT_DIR = ".icedtea"; + String LEGACY_USER_HOME = System.getProperty("user.home") + File.separator + PRE_15_DEPLOYMENT_DIR; + File legacyUserDir = new File(LEGACY_USER_HOME); + if (legacyUserDir.exists()) { + System.out.println("Legacy configuration and cache found. Those will be now transported to new location"); + System.out.println("You should not see this message next time you run icedtea-web!"); + System.out.println("Your custom dirs will not be touched and will work"); + System.out.println("-----------------------------------------------"); + + System.out.println("Preparing new directories:"); + System.out.println(" "+Defaults.USER_CONFIG_HOME); + File f1 = new File(Defaults.USER_CONFIG_HOME); + errors += resultToStd(f1.mkdirs()); + System.out.println(" "+Defaults.USER_CACHE_HOME); + File f2 = new File(Defaults.USER_CACHE_HOME); + errors += resultToStd(f2.mkdirs()); + + String legacySecurity = LEGACY_USER_HOME + File.separator + "security"; + String currentSecurity = Defaults.USER_SECURITY; + errors += moveLegacyToCurrent(legacySecurity, currentSecurity); + + String legacyCache = LEGACY_USER_HOME + File.separator + "cache"; + String currentCache = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_CACHE_DIR).getDefaultValue(); + errors += moveLegacyToCurrent(legacyCache, currentCache); + System.out.println("Adapting " + CacheLRUWrapper.CACHE_INDEX_FILE_NAME + " to new destination"); + //replace all legacyCache by currentCache in new recently_used + try { + File f = new File(currentCache,CacheLRUWrapper.CACHE_INDEX_FILE_NAME); + String s = FileUtils.loadFileAsString(f); + s = s.replace(legacyCache, currentCache); + FileUtils.saveFile(s, f); + } catch (IOException ex) { + ex.printStackTrace(); + errors++; + } + + String legacyPcahceDir = LEGACY_USER_HOME + File.separator + "pcache"; + String currentPcacheDir = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR).getDefaultValue(); + errors += moveLegacyToCurrent(legacyPcahceDir, currentPcacheDir); + + String legacyLogDir = LEGACY_USER_HOME + File.separator + "log"; + String currentLogDir = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_LOG_DIR).getDefaultValue(); + errors += moveLegacyToCurrent(legacyLogDir, currentLogDir); + + String legacyProperties = LEGACY_USER_HOME + File.separator + DEPLOYMENT_PROPERTIES; + String currentProperties = Defaults.USER_CONFIG_HOME + File.separator + DEPLOYMENT_PROPERTIES; + errors += moveLegacyToCurrent(legacyProperties, currentProperties); + + String legacyPropertiesOld = LEGACY_USER_HOME + File.separator + DEPLOYMENT_PROPERTIES + ".old"; + String currentPropertiesOld = Defaults.USER_CONFIG_HOME + File.separator + DEPLOYMENT_PROPERTIES + ".old"; + errors += moveLegacyToCurrent(legacyPropertiesOld, currentPropertiesOld); + + + String legacyAppletTrust = LEGACY_USER_HOME + File.separator + APPLET_TRUST_SETTINGS; + String currentAppletTrust = getAppletTrustUserSettingsPath().getAbsolutePath(); + errors += moveLegacyToCurrent(legacyAppletTrust, currentAppletTrust); + + String legacyTmp = LEGACY_USER_HOME + File.separator + "tmp"; + String currentTmp = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_TMP_DIR).getDefaultValue(); + errors += moveLegacyToCurrent(legacyTmp, currentTmp); + + System.out.println("Removing now empty " + LEGACY_USER_HOME); + errors+=resultToStd(legacyUserDir.delete()); + + if (errors!=0){ + System.out.println("There occureed "+errors+" errors"); + System.out.println("Please double check content of old data in "+LEGACY_USER_HOME+" with "); + System.out.println("new "+Defaults.USER_CONFIG_HOME+" and "+Defaults.USER_CACHE_HOME); + System.out.println("To disable this check again, please remove "+LEGACY_USER_HOME); + } + + } + + } + + private static int moveLegacyToCurrent(String legacy, String current) { + System.out.println("Moving " + legacy + " to " + current); + File cf = new File(current); + File old = new File(legacy); + if (cf.exists()){ + System.out.println("Warning! Destination "+current+" exists!"); + } + if (old.exists()) { + boolean moved = old.renameTo(cf); + return resultToStd(moved); + } else { + System.out.println("Source "+legacy+" do not exists, nothing to do"); + return 0; + } + + } + + private static int resultToStd(boolean securityMove) { + if (securityMove) { + System.out.println("OK"); + return 0; + } else { + System.out.println("ERROR"); + return 1; + } + } + } diff -r e8341834febd netx/net/sourceforge/jnlp/controlpanel/CachePane.java --- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Fri Jun 07 17:01:31 2013 +0200 @@ -49,6 +49,7 @@ import javax.swing.table.TableRowSorter; import net.sourceforge.jnlp.cache.CacheDirectory; +import net.sourceforge.jnlp.cache.CacheLRUWrapper; import net.sourceforge.jnlp.cache.DirectoryNode; import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; @@ -202,7 +203,7 @@ } private void updateRecentlyUsed(File f) { - File recentlyUsedFile = new File(location + File.separator + "recently_used"); + File recentlyUsedFile = new File(location + File.separator + CacheLRUWrapper.CACHE_INDEX_FILE_NAME); PropertiesFile pf = new PropertiesFile(recentlyUsedFile); pf.load(); Enumeration en = pf.keys(); diff -r e8341834febd netx/net/sourceforge/jnlp/controlpanel/CommandLine.java --- a/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java Fri Jun 07 17:01:31 2013 +0200 @@ -453,6 +453,7 @@ * @param args the command line arguments to this program */ public static void main(String[] args) throws Exception { + DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched(); if (args.length == 0) { ControlPanel.main(new String[] {}); } else { diff -r e8341834febd netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java --- a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Fri Jun 07 17:01:31 2013 +0200 @@ -399,6 +399,7 @@ } public static void main(String[] args) throws Exception { + DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched(); final DeploymentConfiguration config = new DeploymentConfiguration(); try { config.load(); diff -r e8341834febd netx/net/sourceforge/jnlp/runtime/Boot.java --- a/netx/net/sourceforge/jnlp/runtime/Boot.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Fri Jun 07 17:01:31 2013 +0200 @@ -33,6 +33,7 @@ import net.sourceforge.jnlp.ParserSettings; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.UpdatePolicy; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.security.viewer.CertificateViewer; import net.sourceforge.jnlp.services.ServiceUtil; @@ -113,6 +114,7 @@ * Launch the JNLP file specified by the command-line arguments. */ public static void main(String[] argsIn) { + DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched(); args = argsIn; if (null != getOption("-viewer")) { diff -r e8341834febd netx/net/sourceforge/jnlp/runtime/Boot13.java --- a/netx/net/sourceforge/jnlp/runtime/Boot13.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/runtime/Boot13.java Fri Jun 07 17:01:31 2013 +0200 @@ -19,6 +19,7 @@ import java.lang.reflect.*; import java.net.*; import java.security.*; +import net.sourceforge.jnlp.config.DeploymentConfiguration; /** * Allows a Policy and SecurityManager to be set in JRE1.3 without @@ -70,6 +71,7 @@ } public static void main(final String args[]) throws Exception { + DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched(); URL cs = Boot13.class.getProtectionDomain().getCodeSource().getLocation(); // instead of using a custom loadClass search order, we could // put the classes in a boot/ subdir of the JAR and load diff -r e8341834febd netx/net/sourceforge/jnlp/util/FileUtils.java --- a/netx/net/sourceforge/jnlp/util/FileUtils.java Thu Jun 06 17:07:28 2013 +0200 +++ b/netx/net/sourceforge/jnlp/util/FileUtils.java Fri Jun 07 17:01:31 2013 +0200 @@ -16,12 +16,20 @@ package net.sourceforge.jnlp.util; +import java.io.BufferedReader; +import java.io.BufferedWriter; import static net.sourceforge.jnlp.runtime.Translator.R; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; import java.io.RandomAccessFile; +import java.io.Writer; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; @@ -369,4 +377,67 @@ } return lock; } + + /** + * helping dummy method to save String as file + * + * @param content + * @param f + * @throws IOException + */ + public static void saveFile(String content, File f) throws IOException { + saveFile(content, f, "utf-8"); + } + public static void saveFile(String content, File f,String encoding) throws IOException { + Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),encoding)); + output.write(content); + output.flush(); + output.close(); + } + + /** + * utility method which can read from any stream as one long String + * + * @param input stream + * @return stream as string + * @throws IOException if connection can't be established or resource does not exist + */ + public static String getContentOfStream(InputStream is,String encoding) throws IOException { + try { + BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding)); + StringBuilder sb = new StringBuilder(); + while (true) { + String s = br.readLine(); + if (s == null) { + break; + } + sb.append(s).append("\n"); + + } + return sb.toString(); + } finally { + is.close(); + } + + } + + /** + * utility method which can read from any stream as one long String + * + * @param input stream + * @return stream as string + * @throws IOException if connection can't be established or resource does not exist + */ + public static String getContentOfStream(InputStream is) throws IOException { + return getContentOfStream(is, "UTF-8"); + + } + + public static String loadFileAsString(File f) throws IOException { + return getContentOfStream(new FileInputStream(f)); + } + + public static String loadFileAsString(File f, String encoding) throws IOException { + return getContentOfStream(new FileInputStream(f), encoding); + } } diff -r e8341834febd plugin/icedteanp/java/sun/applet/PluginMain.java --- a/plugin/icedteanp/java/sun/applet/PluginMain.java Thu Jun 06 17:07:28 2013 +0200 +++ b/plugin/icedteanp/java/sun/applet/PluginMain.java Fri Jun 07 17:01:31 2013 +0200 @@ -98,7 +98,7 @@ System.err.println("Invalid pipe names provided. Refusing to proceed."); System.exit(1); } - + DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched(); try { PluginStreamHandler streamHandler = connect(args[0], args[1]); boolean redirectStreams = System.getenv().containsKey("ICEDTEAPLUGIN_DEBUG"); diff -r e8341834febd tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java Thu Jun 06 17:07:28 2013 +0200 +++ b/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java Fri Jun 07 17:01:31 2013 +0200 @@ -55,7 +55,7 @@ .getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR)).getPath(); // does no DeploymentConfiguration exist for this file name? - private final String cacheIndexFileName = "recently_used"; + private final String cacheIndexFileName = CacheLRUWrapper.CACHE_INDEX_FILE_NAME; private final int noEntriesCacheFile = 1000; diff -r e8341834febd tests/netx/unit/net/sourceforge/jnlp/util/PropertiesFileTest.java --- a/tests/netx/unit/net/sourceforge/jnlp/util/PropertiesFileTest.java Thu Jun 06 17:07:28 2013 +0200 +++ b/tests/netx/unit/net/sourceforge/jnlp/util/PropertiesFileTest.java Fri Jun 07 17:01:31 2013 +0200 @@ -43,6 +43,7 @@ import java.io.IOException; import java.nio.channels.FileLock; import java.nio.channels.OverlappingFileLockException; +import net.sourceforge.jnlp.cache.CacheLRUWrapper; import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; @@ -61,7 +62,7 @@ .getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR)).getPath(); // does no DeploymentConfiguration exist for this file name? - private final String cacheIndexFileName = "recently_used"; + private final String cacheIndexFileName = CacheLRUWrapper.CACHE_INDEX_FILE_NAME; private final PropertiesFile cacheIndexFile = new PropertiesFile(new File(cacheDir + File.separatorChar + cacheIndexFileName)); private final int noEntriesCacheFile = 1000; diff -r e8341834febd tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Thu Jun 06 17:07:28 2013 +0200 +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Fri Jun 07 17:01:31 2013 +0200 @@ -60,6 +60,7 @@ import net.sourceforge.jnlp.browsertesting.Browsers; import net.sourceforge.jnlp.closinglisteners.AutoErrorClosingListener; import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener; +import net.sourceforge.jnlp.util.FileUtils; import org.junit.Assert; /** @@ -418,22 +419,7 @@ * @throws IOException if connection can't be established or resource does not exist */ public static String getContentOfStream(InputStream is,String encoding) throws IOException { - try { - BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding)); - StringBuilder sb = new StringBuilder(); - while (true) { - String s = br.readLine(); - if (s == null) { - break; - } - sb.append(s).append("\n"); - - } - return sb.toString(); - } finally { - is.close(); - } - + return FileUtils.getContentOfStream(is, encoding); } /** @@ -444,7 +430,7 @@ * @throws IOException if connection can't be established or resource does not exist */ public static String getContentOfStream(InputStream is) throws IOException { - return getContentOfStream(is, "UTF-8"); + return FileUtils.getContentOfStream(is); } @@ -491,13 +477,10 @@ * @throws IOException */ public static void saveFile(String content, File f) throws IOException { - saveFile(content, f, "utf-8"); + FileUtils.saveFile(content, f); } public static void saveFile(String content, File f,String encoding) throws IOException { - Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),encoding)); - output.write(content); - output.flush(); - output.close(); + FileUtils.saveFile(content, f, encoding); } /**