Clover Coverage Report - Kuali Student 1.2-M2-SNAPSHOT (Aggregated)
Coverage timestamp: Fri Apr 22 2011 04:03:20 EST
../../../../../../../img/srcFileCovDistChart0.png 53% of files have more coverage
7   47   4   1.75
0   23   0.57   4
4     1  
1    
 
  SerializationUtils       Line # 24 7 0% 4 11 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    package org.kuali.student.common.ui.server.serialization;
17   
18    /**
19    * This is a description of what this class does - hjohnson don't forget to fill this in.
20    *
21    * @author Kuali Student Team (kuali-student@googlegroups.com)
22    *
23    */
 
24    public class SerializationUtils {
25    // Server Side String utils
 
26  0 toggle public static String escapeForSingleQuotedJavaScriptString( String s )
27    {
28  0 s = escapeScriptTags( s ); // <script> -> <xxxscript>
29  0 s = escapeBackslash( s );
30  0 s = escapeSingleQuotes( s );
31  0 return s;
32    }
 
33  0 toggle public static String escapeScriptTags( String s )
34    {
35  0 return s
36    .replaceAll("(?si)<\\s*script.*?>", "<xxxscript>")
37    .replaceAll("(?si)</\\s*script\\s*>", "</xxxscript>");
38    }
 
39  0 toggle public static String escapeBackslash( String s )
40    {
41  0 return s.replaceAll("\\\\","\\\\\\\\" );
42    }
 
43  0 toggle public static String escapeSingleQuotes( String s ) {
44  0 return s.replaceAll("'","\\\\'" );
45    }
46   
47    }