Sonar Fixes, Formatting
[aaf/authz.git] / misc / rosetta / src / main / java / org / onap / aaf / misc / rosetta / XmlEscape.java
index 1b0eec0..15f4205 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * 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.
@@ -28,7 +28,7 @@ import java.util.TreeMap;
 
 public class XmlEscape {
     private XmlEscape() {}
-    
+
     private static final TreeMap<String,Integer> charMap; // see initialization at end
     private static final TreeMap<Integer,String> intMap; // see initialization at end
 
@@ -36,13 +36,13 @@ public class XmlEscape {
         try {
             int c;
             StringBuilder esc = new StringBuilder();
-            for(int cnt = 0;cnt<9 /*max*/; ++cnt) {
-                if((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence");
-                if(c!=';') { 
+            for (int cnt = 0;cnt<9 /*max*/; ++cnt) {
+                if ((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence");
+                if (c!=';') {
                     esc.append((char)c);
                 } else { // evaluate
                     Integer i = charMap.get(esc.toString());
-                    if(i==null) {
+                    if (i==null) {
                         // leave in nasty XML format for now.
                         sb.append('&');
                         sb.append(esc);
@@ -53,36 +53,36 @@ public class XmlEscape {
                     break;
                 }
             }
-            
-            
+
+
         } catch (IOException e) {
             throw new ParseException(e);
         }
     }
-    
+
     public static void xmlEscape(StringBuilder sb, int chr) {
         sb.append('&');
         sb.append(intMap.get(chr));
         sb.append(';');
     }
-    
+
     public static String convert(StringBuilder insb) {
         int idx, ch;
         StringBuilder sb=null;
-        for(idx=0;idx<insb.length();++idx) {
+        for (idx=0;idx<insb.length();++idx) {
             ch = insb.charAt(idx);
-            if(ch>=160 || ch==34 || ch==38 || ch==39 || ch==60 || ch==62) {
+            if (ch>=160 || ch==34 || ch==38 || ch==39 || ch==60 || ch==62) {
                 sb = new StringBuilder();
                 sb.append(insb,0,idx);
                 break;
             }
         }
-        
-        if(sb==null)return insb.toString();
-            
-        for(int i=idx;i<insb.length();++i) {
+
+        if (sb==null)return insb.toString();
+
+        for (int i=idx;i<insb.length();++i) {
             ch = insb.charAt(i);
-            if(ch<160) {
+            if (ch<160) {
                 switch(ch) {
                     case 34: sb.append("&quot;"); break;
                     case 38: sb.append("&amp;"); break;
@@ -94,7 +94,7 @@ public class XmlEscape {
                 }
             } else { // use map
                 String s = intMap.get(ch);
-                if(s==null)sb.append((char)ch);
+                if (s==null)sb.append((char)ch);
                 else {
                     sb.append('&');
                     sb.append(s);
@@ -361,9 +361,9 @@ public class XmlEscape {
         charMap.put("clubs",9827);
         charMap.put("hearts",9829);
         charMap.put("diams",9830);
-        
-        for( Entry<String, Integer> es: charMap.entrySet()) {
-            if(es.getValue()>=160); // save small space... note that no longer has amp, etc.
+
+        for ( Entry<String, Integer> es: charMap.entrySet()) {
+            if (es.getValue()>=160); // save small space... note that no longer has amp, etc.
             intMap.put(es.getValue(), es.getKey());
         }
     }