Author: simoneg
Date: Thu Jul 16 20:59:11 2009
New Revision: 794854

URL: http://svn.apache.org/viewvc?rev=794854&view=rev
Log:
LABS-373 : buffer also when using outsider as last key char

Modified:
    
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/URLRewritingStream.java
    
labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/utils/XMLRewritingTest.java

Modified: 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/URLRewritingStream.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/URLRewritingStream.java?rev=794854&r1=794853&r2=794854&view=diff
==============================================================================
--- 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/URLRewritingStream.java
 (original)
+++ 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/URLRewritingStream.java
 Thu Jul 16 20:59:11 2009
@@ -139,11 +139,8 @@
                        if (!buffering) {
                                buffering = checkKeys(b);
                                if (buffering) {
-                                       super.write(b);                         
-                                       inject();
-                                       buffering = false;
-                                       cleanChecks();
-                                       return;                                 
                        
+                                       super.write(b);
+                                       inside = true;
                                }
                        }
                }
@@ -186,13 +183,15 @@
        private final void inject() throws IOException {
                injecting  = true;
                try {
-                       int stpos = 0; 
-                       boolean chop = intbuff[0] == '\'' || intbuff[0] == '"';
-                       if (chop) {
-                               super.write(intbuff[0]);
+                       int stpos = 0;
+                       if (intbuff[0] == outsider) {
+                               stpos++;
+                       }
+                       if (intbuff[stpos] == '\'' || intbuff[stpos] == '"') {
+                               super.write(intbuff[stpos]);
                                stpos++;
                        }
-                       String accontent = new String(intbuff, chop ? 1 : 0, 
intbuffpos);
+                       String accontent = new String(intbuff, stpos, 
intbuffpos);
                        if (accontent.startsWith("magma:") || 
(!accontent.startsWith("/") && accontent.indexOf(':') == -1 && 
!accontent.startsWith("#"))) {
                                if (this.alwaysAbsolute) {
                                        send(this.absolute);

Modified: 
labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/utils/XMLRewritingTest.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/utils/XMLRewritingTest.java?rev=794854&r1=794853&r2=794854&view=diff
==============================================================================
--- 
labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/utils/XMLRewritingTest.java
 (original)
+++ 
labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/utils/XMLRewritingTest.java
 Thu Jul 16 20:59:11 2009
@@ -34,7 +34,8 @@
        public static final String[] 
        SET1 = {"<elem>ciao</elem>", 
"<elem>/context/current/place/ciao</elem>"},
        SET2 = {"<elem url=\"ciao\">test</elem>", "<elem 
url=\"/context/current/place/ciao\">test</elem>"},
-       SET3 = {"<withattrs some='attr' another='attr'>test</withattrs>", 
"<withattrs some='attr' 
another='attr'>/context/current/place/test</withattrs>"};
+       SET3 = {"<withattrs some='attr' another='attr'>test</withattrs>", 
"<withattrs some='attr' 
another='attr'>/context/current/place/test</withattrs>"},
+       SET4 = {"<elem>magma:/ciao</elem>", "<elem>/context/ciao</elem>"};
                
        @Theory
        public void rewriteTest(String[] set) throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to