Code formating and whitespace cleanup
[jpim.git] / src / de / j32 / avmfritz / LoginXML.java
index 82766c3..c5ec76b 100644 (file)
@@ -16,59 +16,60 @@ import de.j32.util.XmlUtil;
 
 public class LoginXML
 {
-       Document xml_;
-       
-       public LoginXML(InputStream is) 
-               throws SAXException, IOException
-       {
-               xml_ = XmlUtil.parse(is);
-       }
-       
-       public boolean iswriteaccess()
-               throws SAXException
-       {
-               try {
-                       return xml_.getElementsByTagName("iswriteaccess").item(0).getTextContent().equals("1"); 
-               }
-               catch (NullPointerException e) {
-                       throw new SAXException();
-               }
-       }
-       
-       public String sid() 
-               throws SAXException
-       {
-               try {
-                       return Util.nonnull(xml_.getElementsByTagName("SID").item(0).getTextContent());
-               }
-               catch (NullPointerException e) {
-                       throw new SAXException();
-               }
-       }
-       
-       public String challenge()
-               throws SAXException
-       {
-               try {
-                       return Util.nonnull(xml_.getElementsByTagName("Challenge").item(0).getTextContent());
-               }
-               catch (NullPointerException e) {
-                       throw new SAXException();
-               }
-       }
-       
-       public String response(String password)
-               throws SAXException
-       {
-               try {
-                       String c = challenge();
-                       MessageDigest md = MessageDigest.getInstance("MD5");
-                       md.update((c + "-" + password).getBytes("UTF-16LE"));
-                       return c + "-" + new HexBinaryAdapter().marshal(md.digest()).toLowerCase();
-               } catch (NoSuchAlgorithmException e) {
-                       throw new AssertionError("missing MD5 implementation");
-               } catch (UnsupportedEncodingException e) {
-                       throw new AssertionError("missing UTF-16LE encoding");
-               }
-       }
+    Document xml_;
+
+    public LoginXML(InputStream is) throws SAXException, IOException
+    {
+        xml_ = XmlUtil.parse(is);
+    }
+
+    public boolean iswriteaccess() throws SAXException
+    {
+        try {
+            return xml_.getElementsByTagName("iswriteaccess").item(0)
+                    .getTextContent().equals("1");
+        }
+        catch (NullPointerException e) {
+            throw new SAXException();
+        }
+    }
+
+    public String sid() throws SAXException
+    {
+        try {
+            return Util.nonnull(xml_.getElementsByTagName("SID").item(0)
+                    .getTextContent());
+        }
+        catch (NullPointerException e) {
+            throw new SAXException();
+        }
+    }
+
+    public String challenge() throws SAXException
+    {
+        try {
+            return Util.nonnull(xml_.getElementsByTagName("Challenge").item(0)
+                    .getTextContent());
+        }
+        catch (NullPointerException e) {
+            throw new SAXException();
+        }
+    }
+
+    public String response(String password) throws SAXException
+    {
+        try {
+            String c = challenge();
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.update((c + "-" + password).getBytes("UTF-16LE"));
+            return c + "-"
+                    + new HexBinaryAdapter().marshal(md.digest()).toLowerCase();
+        }
+        catch (NoSuchAlgorithmException e) {
+            throw new AssertionError("missing MD5 implementation");
+        }
+        catch (UnsupportedEncodingException e) {
+            throw new AssertionError("missing UTF-16LE encoding");
+        }
+    }
 }