SF.net SVN: htmlunit: [3139] trunk/htmlunit/src/main/java/com/ gargoylesoftware/htmlunit

View: New views
1 Messages — Rating Filter:   Alert me  

SF.net SVN: htmlunit: [3139] trunk/htmlunit/src/main/java/com/ gargoylesoftware/htmlunit

by asashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Revision: 3139
          http://htmlunit.svn.sourceforge.net/htmlunit/?rev=3139&view=rev
Author:   asashour
Date:     2008-07-01 03:37:40 -0700 (Tue, 01 Jul 2008)

Log Message:
-----------
Tiny little enhancements (thanks to Ganymede)

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CSSStyleDeclaration.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FormField.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HTMLCollection.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java 2008-07-01 10:17:41 UTC (rev 3138)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java 2008-07-01 10:37:40 UTC (rev 3139)
@@ -141,9 +141,7 @@
         if (jsResult == null && page == null) {
             return null;
         }
-        else {
-            return new ScriptResult(jsResult, page);
-        }
+        return new ScriptResult(jsResult, page);
     }
 
 }

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2008-07-01 10:17:41 UTC (rev 3138)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2008-07-01 10:37:40 UTC (rev 3139)
@@ -1458,10 +1458,8 @@
             // no new webresponse to produce
             return webWindow.getEnclosedPage().getWebResponse();
         }
-        else {
-            final String contentString = scriptResult.getJavaScriptResult().toString();
-            return new StringWebResponse(contentString, charset, url);
-        }
+        final String contentString = scriptResult.getJavaScriptResult().toString();
+        return new StringWebResponse(contentString, charset, url);
     }
 
     /**

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CSSStyleDeclaration.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CSSStyleDeclaration.java 2008-07-01 10:17:41 UTC (rev 3138)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CSSStyleDeclaration.java 2008-07-01 10:37:40 UTC (rev 3139)
@@ -308,7 +308,6 @@
      *        if <tt>false</tt>, the keys are delimiter-separated (i.e. <tt>font-size</tt>).
      * @return a sorted map containing style elements, keyed on style element name
      */
-    @SuppressWarnings("unchecked")
     protected Map<String, StyleElement> getStyleMap(final boolean camelCase) {
         final Map<String, StyleElement> styleMap = new LinkedHashMap<String, StyleElement>();
         final String styleAttribute = jsElement_.getHtmlElementOrDie().getAttributeValue("style");
@@ -4183,16 +4182,15 @@
             // Case-sensitive.
             return dec.getStyleAttribute(name, true);
         }
-        else {
-            // Case-insensitive.
-            final Map<String, StyleElement> map = dec.getStyleMap(true);
-            for (final String key : map.keySet()) {
-                if (key.equalsIgnoreCase(name)) {
-                    return map.get(key).getValue();
-                }
-            }
-            return "";
+
+        // Case-insensitive.
+        final Map<String, StyleElement> map = dec.getStyleMap(true);
+        for (final String key : map.keySet()) {
+         if (key.equalsIgnoreCase(name)) {
+         return map.get(key).getValue();
+         }
         }
+        return "";
     }
 
     /**
@@ -4281,21 +4279,16 @@
                 dec.removeStyleAttribute(lastName);
                 return true;
             }
-            else {
-                return false;
-            }
+            return false;
         }
-        else {
-            // Case-sensitive.
-            final String s = dec.getStyleAttribute(name, true);
-            if (s.length() > 0) {
-                dec.removeStyleAttribute(name);
-                return true;
-            }
-            else {
-                return false;
-            }
+
+        // Case-sensitive.
+        final String s = dec.getStyleAttribute(name, true);
+        if (s.length() > 0) {
+         dec.removeStyleAttribute(name);
+         return true;
         }
+        return false;
     }
 
     /**
@@ -4508,9 +4501,7 @@
             if (e != null) {
                 return new Long(index_).compareTo(e.index_);
             }
-            else {
-                return 1;
-            }
+            return 1;
         }
     }
 

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FormField.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FormField.java 2008-07-01 10:17:41 UTC (rev 3138)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FormField.java 2008-07-01 10:37:40 UTC (rev 3139)
@@ -98,9 +98,7 @@
         if (form == null) {
             return null;
         }
-        else {
-            return (HTMLFormElement) getScriptableFor(form);
-        }
+        return (HTMLFormElement) getScriptableFor(form);
     }
 
     /**

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HTMLCollection.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HTMLCollection.java 2008-07-01 10:17:41 UTC (rev 3138)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HTMLCollection.java 2008-07-01 10:37:40 UTC (rev 3139)
@@ -229,7 +229,6 @@
      * Gets the HTML elements from cache or retrieve them at first call.
      * @return the list of {@link HtmlElement} contained in this collection
      */
-    @SuppressWarnings("unchecked")
     protected List<Object> getElements() {
         if (cachedElements_ == null) {
             cachedElements_ = computeElements();
@@ -510,7 +509,6 @@
      * {@inheritDoc}.
      */
     @Override
-    @SuppressWarnings("unused")
     public Object[] getIds() {
         final List<String> idList = new ArrayList<String>();
 

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java 2008-07-01 10:17:41 UTC (rev 3138)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java 2008-07-01 10:37:40 UTC (rev 3139)
@@ -247,26 +247,23 @@
         if (hash != null) {
             return "#" + hash;
         }
-        else {
-            return "";
-        }
+        return "";
     }
 
     private String getHash(final boolean encoded) {
         if (hash_ == null || hash_.length() == 0) {
             return null;
         }
-        else {
-            if (encoded) {
-                try {
-                    return URIUtil.encodeQuery(hash_);
-                }
-                catch (final URIException e) {
-                    getLog().error(e.getMessage(), e);
-                }
-            }
-            return hash_;
+
+        if (encoded) {
+         try {
+         return URIUtil.encodeQuery(hash_);
+         }
+         catch (final URIException e) {
+         getLog().error(e.getMessage(), e);
+         }
         }
+        return hash_;
     }
 
     /**


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop