r1044 - xwiki/trunk/src/main/java/com/xpn/xwiki/render

Nguyen Viet Chung chungnv at users.forge.objectweb.org
Wed Apr 12 08:51:40 CEST 2006


Author: chungnv
Date: 2006-04-12 08:51:40 +0200 (Wed, 12 Apr 2006)
New Revision: 1044

Modified:
   xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiVelocityRenderer.java
Log:
Fixed bug 200 . "Document ending with a Velocity comment and no carriage return throws an exception"

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiVelocityRenderer.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiVelocityRenderer.java	2006-04-11 09:13:11 UTC (rev 1043)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiVelocityRenderer.java	2006-04-12 06:51:40 UTC (rev 1044)
@@ -1,25 +1,25 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author ludovic
- * @author sdumitriu
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author ludovic
+ * @author sdumitriu
+ */
 
 package com.xpn.xwiki.render;
 
@@ -74,6 +74,13 @@
         VelocityContext vcontext = null;
         try {
             String name = doc.getFullName();
+
+            int index1 = content.lastIndexOf("\n");
+            int index2 = content.lastIndexOf("##");
+            if(index1<index2){
+                content = content + "\n";
+            }
+            
             content = context.getUtil().substitute("s/#include\\(/\\\\#include\\(/go", content);
             vcontext = prepareContext(context);
 





More information about the Xwiki-notifications mailing list