Author: tdraier
Date: Tue Nov 28 17:14:05 2006
New Revision: 15795

URL: https://svndev.jahia.net/websvn/listing.php?sc=1&rev=15795&repname=jahia
Log:
better check to avoid empty files on sync

Modified:
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/bin/GetFile.java

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/bin/GetFile.java
URL: 
https://svndev.jahia.net/websvn/diff.php?path=/branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/bin/GetFile.java&rev=15795&repname=jahia
==============================================================================
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/bin/GetFile.java 
(original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/bin/GetFile.java Tue 
Nov 28 17:14:05 2006
@@ -1,22 +1,23 @@
-/*
- * Copyright 2002-2006 Jahia Ltd
- *
- * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE 
(JCDDL), 
- * Version 1.0 (the "License"), or (at your option) any later version; you may 
- * not use this file except in compliance with the License. You should have 
- * received a copy of the License along with this program; if not, you may 
obtain 
- * a copy of the License at 
- *
- *  http://www.jahia.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
+/*
+ * Copyright 2002-2006 Jahia Ltd
+ *
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE 
(JCDDL), 
+ * Version 1.0 (the "License"), or (at your option) any later version; you may 
+ * not use this file except in compliance with the License. You should have 
+ * received a copy of the License along with this program; if not, you may 
obtain 
+ * a copy of the License at 
+ *
+ *  http://www.jahia.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
  */package org.jahia.bin;
 
 import org.jahia.services.deamons.filewatcher.FileListSync;
+import org.apache.log4j.Logger;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -34,6 +35,8 @@
  * To change this template use File | Settings | File Templates.
  */
 public class GetFile extends HttpServlet {
+    private static Logger logger = Logger.getLogger(GetFile.class);
+
     protected void doGet(HttpServletRequest httpServletRequest, 
HttpServletResponse httpServletResponse) throws ServletException, IOException {
         String key = httpServletRequest.getParameter("key");
         if (FileListSync.getInstance().getKey().equals(key)) {
@@ -45,6 +48,9 @@
             while ( (i=is.read(buff))>0) {
                 os.write(buff,0,i);
             }
+        } else {
+            logger.error("Synchronization error, incompatiable keys - check 
your sync config");
+            httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
         }
     }
 }

Reply via email to