1 57 58 package org.apache.soap.encoding.soapenc; 59 60 83 public class FPDeserUtil 84 { 85 private FPDeserUtil() 87 { 88 } 89 90 public static Float newFloat(String value) 92 { 93 Float res = null; 94 try { 95 res = new Float (value); 96 } catch (NumberFormatException e) { 97 if (value.equals("INF") 98 || value.toLowerCase().equals("infinity")) { 99 return new Float (Float.POSITIVE_INFINITY); 100 } else if (value.equals("-INF") 101 || value.toLowerCase().equals("-infinity")) { 102 return new Float (Float.NEGATIVE_INFINITY); 103 } else if (value.equals("NaN")) { 104 return new Float (Float.NaN); 105 } 106 throw e; 107 } 108 return res; 109 } 110 111 public static Double newDouble(String value) 112 { 113 Double res = null; 114 try { 115 res = new Double (value); 116 } catch (NumberFormatException e) { 117 if (value.equals("INF") 118 || value.toLowerCase().equals("infinity")) { 119 return new Double (Double.POSITIVE_INFINITY); 120 } else if (value.equals("-INF") 121 || value.toLowerCase().equals("-infinity")) { 122 return new Double (Double.NEGATIVE_INFINITY); 123 } else if (value.equals("NaN")) { 124 return new Double (Double.NaN); 125 } 126 throw e; 127 } 128 return res; 129 } 130 } 131 | Popular Tags |