Minor bug fixes
 - Fixed bug preventing non-blank receiver properties from being set to blank (except for 'name' field)
 - Now only logging in VFS receiver panel if the file size grows or the file is truncated (not every time the file is examined for changes)
 - Fixed bug causing a specified receiver configuration to be loaded twice if loaded from the receiver configuration/selection screen
 - Updated LogFilePatternReceiver timestamp regexp support to escape dots in timestamps


git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/companions/receivers/trunk@985797 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java b/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java
index 9a2a6a2..88325f4 100644
--- a/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java
+++ b/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java
@@ -554,7 +554,7 @@
         try {
             regexpPattern = compiler.compile(regexp);
         } catch (MalformedPatternException mpe) {
-            throw new RuntimeException("Bad pattern: " + regexp);
+            throw new RuntimeException("Bad pattern: " + regexp, mpe);
         }
     }
 
@@ -603,7 +603,10 @@
   private String convertTimestamp() {
     //some locales (for example, French) generate timestamp text with characters not included in \w -
     // now using \S (all non-whitespace characters) instead of /w 
-    return util.substitute("s/("+VALID_DATEFORMAT_CHAR_PATTERN+")+/\\\\S+/g", timestampFormat);
+    String result = util.substitute("s/("+VALID_DATEFORMAT_CHAR_PATTERN+")+/\\\\S+/g", timestampFormat);
+    //make sure dots in timestamp are escaped
+    result = globalReplace(".", "\\.", result);
+    return result;
   }
 
     protected void setHost(String host) {
@@ -802,13 +805,18 @@
     {
         int propLength = oldString.length();
         int startPos = inputString.indexOf(oldString);
+        if (startPos == -1)
+        {
+            getLogger().info("string: " + oldString + " not found in input: " + inputString + " - returning input");
+            return inputString;
+        }
         if (startPos == 0)
-    {
-        inputString = inputString.substring(propLength);
-        inputString = newString + inputString;
-    } else {
-        inputString = inputString.substring(0, startPos) + newString + inputString.substring(startPos + propLength);
-    }
+        {
+            inputString = inputString.substring(propLength);
+            inputString = newString + inputString;
+        } else {
+            inputString = inputString.substring(0, startPos) + newString + inputString.substring(startPos + propLength);
+        }
         return inputString;
     }