From 128e4ab199fba4b47a9b537ded2cb89b38333bea Mon Sep 17 00:00:00 2001 From: orbiter Date: Sun, 19 Mar 2006 01:33:20 +0000 Subject: [PATCH] - in serverSystem: maxPathLength is now a variable, not a method - upon startup the calculated maximum path length is shown git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1932 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/plasmaCrawlWorker.java | 2 +- source/de/anomic/plasma/plasmaHTCache.java | 2 +- source/de/anomic/server/serverSystem.java | 11 ++++++----- source/yacy.java | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/de/anomic/plasma/plasmaCrawlWorker.java b/source/de/anomic/plasma/plasmaCrawlWorker.java index b70ab629f..ae0c225b2 100644 --- a/source/de/anomic/plasma/plasmaCrawlWorker.java +++ b/source/de/anomic/plasma/plasmaCrawlWorker.java @@ -358,7 +358,7 @@ public final class plasmaCrawlWorker extends Thread { //long contentLength = res.responseHeader.contentLength(); htCache = cacheManager.newEntry(requestDate, depth, url, name, requestHeader, res.status, res.responseHeader, initiator, profile); - if (htCache.cacheFile.getAbsolutePath().length() > serverSystem.maxPathLength()) { + if (htCache.cacheFile.getAbsolutePath().length() > serverSystem.maxPathLength) { remote.close(); log.logInfo("REJECTED URL " + url.toString() + " because path too long '" + cacheManager.cachePath.getAbsolutePath() + "'"); diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java index 200d31a42..32588eb55 100644 --- a/source/de/anomic/plasma/plasmaHTCache.java +++ b/source/de/anomic/plasma/plasmaHTCache.java @@ -742,7 +742,7 @@ public final class plasmaHTCache { // we cannot match that here in the cache file path and therefore omit writing into the cache if (this.cacheFile.getParentFile().isFile() || this.cacheFile.isDirectory()) { return "path_ambiguous"; } if (this.cacheFile.toString().indexOf("..") >= 0) { return "path_dangerous"; } - if (this.cacheFile.getAbsolutePath().length() > serverSystem.maxPathLength()) { return "path too long"; } + if (this.cacheFile.getAbsolutePath().length() > serverSystem.maxPathLength) { return "path too long"; } // -CGI access in request // CGI access makes the page very individual, and therefore not usable in caches diff --git a/source/de/anomic/server/serverSystem.java b/source/de/anomic/server/serverSystem.java index 6bc002512..50dda18f9 100644 --- a/source/de/anomic/server/serverSystem.java +++ b/source/de/anomic/server/serverSystem.java @@ -67,6 +67,9 @@ public final class serverSystem { public static boolean isUnixFS = false; public static boolean canExecUnix = false; + // calculated system constants + public static int maxPathLength = 65535; + // Macintosh-specific statics private static Class macMRJFileUtils = null; private static Class macMRJOSType = null; @@ -116,17 +119,15 @@ public final class serverSystem { //e.printStackTrace(); macMRJFileUtils = null; macMRJOSType = null; } + + // set up maximum path length accoring to system + if (systemOS == systemWindows) maxPathLength = 255; else maxPathLength = 65535; } public static boolean isWindows() { return systemOS == systemWindows; } - public static int maxPathLength() { - if (systemOS == systemWindows) return 255; - return 65535; - } - public static Object getMacOSTS(String s) { if ((isMacArchitecture) && (macMRJFileUtils != null)) try { if ((s == null) || (s.equals(blankTypeString))) return macMRJOSNullObj; diff --git a/source/yacy.java b/source/yacy.java index 890dc3ffa..6251a37f4 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -221,6 +221,7 @@ public final class yacy { serverLog.logConfig("STARTUP", "java version " + System.getProperty("java.version", "no-java-version")); serverLog.logConfig("STARTUP", "Application Root Path: " + homePath); serverLog.logConfig("STARTUP", "Time Zone: UTC" + serverDate.UTCDiffString() + "; UTC+0000 is " + System.currentTimeMillis()); + serverLog.logConfig("STARTUP", "Maximum file systen path length: " + serverSystem.maxPathLength); // create data folder final File dataFolder = new File(homePath, "DATA");