From: <no...@us...> - 2003-06-09 13:23:40
|
Log Message: ----------- Fixed checkstyle warnings Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host: DocumentTest.java StyleTest.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/host: Window.java HTMLElement.java Document.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript: JavaScriptEngine.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html: HtmlPage.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit: ScriptEngine.java Revision Data ------------- Index: Window.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Window.java 28 May 2003 23:29:56 -0000 1.18 +++ Window.java 9 Jun 2003 13:23:07 -0000 1.19 @@ -464,7 +464,8 @@ final HtmlPage page = (HtmlPage)webWindow_.getEnclosedPage(); if ( newValue instanceof Function ) { page.setOnLoadAttribute( newValue ); - } else { + } + else { getLog().error( "Invalid value set to window.onload. Value class: " + newValue.getClass () ); } } Index: HTMLElement.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/host/HTMLElement.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- HTMLElement.java 28 May 2003 23:29:56 -0000 1.10 +++ HTMLElement.java 9 Jun 2003 13:23:07 -0000 1.11 @@ -141,10 +141,12 @@ // Append the child to the parent element if ( parentXmlNode.appendChild(childXmlNode) == null ) { appendedChild = null; - } else { + } + else { appendedChild = childObject; } - } else { + } + else { appendedChild = null; } return appendedChild; @@ -163,8 +165,9 @@ if ( parentXmlNode == null ) { return null; } - if ( ! ( parentXmlNode instanceof Element ) ) { - getLog().warn( "Parent XML node is not an Element. Only Elements are currently supported. Parent class: " + parentXmlNode.getClass() ); + if ( ( parentXmlNode instanceof Element ) == false ) { + getLog().warn( "Parent XML node is not an Element. Only Elements are currently supported. Parent class: " + + parentXmlNode.getClass() ); return null; } final Element parentXmlElement = (Element) parentXmlNode; Index: Document.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Document.java 27 May 2003 21:23:10 -0000 1.19 +++ Document.java 9 Jun 2003 13:23:07 -0000 1.20 @@ -276,7 +276,8 @@ * @return the list of elements */ public Object jsFunction_getElementsByTagName( final String tagName ) { - final List list = getHtmlElementOrDie().getPage().getHtmlElementsByTagNames(Collections.singletonList(tagName.toLowerCase())); + final HtmlPage page = getHtmlElementOrDie().getPage(); + final List list = page.getHtmlElementsByTagNames(Collections.singletonList(tagName.toLowerCase())); final ListIterator iterator = list.listIterator(); while(iterator.hasNext()) { final HtmlElement htmlElement = (HtmlElement)iterator.next(); Index: HtmlPage.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- HtmlPage.java 27 May 2003 23:23:27 -0000 1.44 +++ HtmlPage.java 9 Jun 2003 13:23:08 -0000 1.45 @@ -1057,7 +1057,8 @@ } executeJavaScriptIfPossible(onLoadScript, "body.onLoad", false, null); } - } else { + } + else { final ScriptEngine engine = getWebClient().getScriptEngine(); engine.callFunction( this, onLoad, null, new Object [0], null ); } Index: DocumentTest.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/DocumentTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- DocumentTest.java 2 Jun 2003 13:02:07 -0000 1.11 +++ DocumentTest.java 9 Jun 2003 13:23:06 -0000 1.12 @@ -870,7 +870,9 @@ webClient.setWebConnection( webConnection ); final String firstContent - = "<html><body><script type=\"text/javascript\">alert(document.getElementsByTagName('script').length);</script></body></html>"; + = "<html><body><script type=\"text/javascript\">" + + "alert(document.getElementsByTagName('script').length);" + + "</script></body></html>"; webConnection.setResponse( new URL("http://first"), firstContent, 200, "OK", "text/html", Collections.EMPTY_LIST ); Index: StyleTest.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/StyleTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- StyleTest.java 7 May 2003 10:38:53 -0000 1.1 +++ StyleTest.java 9 Jun 2003 13:23:06 -0000 1.2 @@ -71,7 +71,8 @@ + " style.color = 'pink';\n" + " alert(style.color);\n" + "}\n</script></head>" - + "<body onload='doTest()'><div id='div1' style='color: black;background:blue;foo:bar'>foo</div></body></html>"; + + "<body onload='doTest()'>" + + "<div id='div1' style='color: black;background:blue;foo:bar'>foo</div></body></html>"; webConnection.setResponse( new URL("http://first"), firstContent, 200, "OK", "text/html", Collections.EMPTY_LIST ); Index: JavaScriptEngine.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- JavaScriptEngine.java 27 May 2003 23:23:27 -0000 1.15 +++ JavaScriptEngine.java 9 Jun 2003 13:23:07 -0000 1.16 @@ -147,7 +147,7 @@ * @return The JavaScript execution scope. */ private Scriptable getScope( - final PageInfo pageInfo, final HtmlElement htmlElementScope ) { + final PageInfo pageInfo, final HtmlElement htmlElementScope ) { Scriptable scope; if( htmlElementScope == null ) { @@ -232,7 +232,12 @@ * @return The result of the function call. */ public Object callFunction( - final HtmlPage htmlPage, final Object javaScriptFunction, final Object thisObject, Object [] args, final HtmlElement htmlElementScope ) { + final HtmlPage htmlPage, + final Object javaScriptFunction, + final Object thisObject, + final Object [] args, + final HtmlElement htmlElementScope ) { + final PageInfo pageInfo = getPageInfo(htmlPage); final Scriptable scope = getScope( pageInfo, htmlElementScope ); Index: ScriptEngine.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/ScriptEngine.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ScriptEngine.java 27 May 2003 23:23:27 -0000 1.9 +++ ScriptEngine.java 9 Jun 2003 13:23:08 -0000 1.10 @@ -89,7 +89,11 @@ * @return The result of the function call. */ public abstract Object callFunction( - final HtmlPage htmlPage, final Object javaScriptFunction, final Object thisObject, Object [] args, final HtmlElement htmlElementScope ); + final HtmlPage htmlPage, + final Object javaScriptFunction, + final Object thisObject, + final Object [] args, + final HtmlElement htmlElementScope ); /** |
From: <no...@us...> - 2003-06-09 13:24:20
|
Log Message: ----------- Fixed checkstyle warnings Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit: SanityCheck.java Revision Data ------------- Index: SanityCheck.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/SanityCheck.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SanityCheck.java 29 May 2003 12:00:46 -0000 1.2 +++ SanityCheck.java 9 Jun 2003 13:24:18 -0000 1.3 @@ -22,7 +22,7 @@ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> */ public class SanityCheck extends WebTestCase { - private static final BrowserVersion BrowserVersion_ = BrowserVersion.MOZILLA_1_0; + private static final BrowserVersion BROWSER_VERSION = BrowserVersion.MOZILLA_1_0; /** * Create an instance. @@ -49,7 +49,7 @@ * @throws Exception If something goes wrong. */ public void testYahooMail() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); assertInstanceOf(webClient.getPage( new URL( "http://mail.yahoo.com/" ) ), HtmlPage.class); } @@ -59,7 +59,7 @@ * @throws Exception If something goes wrong. */ public void testYahoo() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); assertInstanceOf( webClient.getPage( new URL( "http://yahoo.com/" ) ), HtmlPage.class ); } @@ -69,7 +69,7 @@ * @throws Exception If something goes wrong. */ public void testIBM() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); webClient.setRedirectEnabled( true ); final HtmlPage page = (HtmlPage)webClient.getPage( new URL( "http://www.ibm.com/" ) ); assertEquals( "http://www.ibm.com/us/", page.getWebResponse().getUrl().toExternalForm() ); @@ -81,7 +81,7 @@ * @throws Exception If something goes wrong. */ public void testAlphaWorks() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); assertInstanceOf(webClient.getPage(new URL( "http://www.alphaworks.ibm.com" ) ), HtmlPage.class); } @@ -91,7 +91,7 @@ * @throws Exception If something goes wrong. */ public void testCNN() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); assertInstanceOf( webClient.getPage( new URL( "http://www.cnn.com" ) ), HtmlPage.class); } @@ -101,7 +101,7 @@ * @throws Exception If something goes wrong. */ public void testToyotaCanada() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); assertInstanceOf(webClient.getPage( new URL( "http://www.toyota.ca" ) ), HtmlPage.class); } @@ -112,9 +112,11 @@ */ public void testSourceForge_secure() throws Exception { try { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); webClient.setPrintContentOnFailingStatusCode(true); - assertInstanceOf( webClient.getPage( new URL( "https://sourceforge.net/projects/htmlunit/" ) ), HtmlPage.class ); + assertInstanceOf( + webClient.getPage( new URL( "https://sourceforge.net/projects/htmlunit/" ) ), + HtmlPage.class ); } catch( final MalformedURLException e ) { System.out.println("Skipping https test: "+getName()); @@ -128,7 +130,7 @@ */ public void testYahooLogin_secure() throws Exception { try { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); final HtmlPage page = (HtmlPage)webClient.getPage( new URL( "https://login.yahoo.com/" ) ); final HtmlForm form = page.getFormByName("login_form"); assertNotNull(form); @@ -144,7 +146,7 @@ * @throws Exception If something goes wrong. */ public void testAmazonCanada() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); assertInstanceOf( webClient.getPage( new URL( "http://www.amazon.ca/" ) ), HtmlPage.class ); } @@ -154,7 +156,7 @@ * @throws Exception If something goes wrong. */ public void testCnnAfterHours() throws Exception { - final WebClient webClient = new WebClient(BrowserVersion_); + final WebClient webClient = new WebClient(BROWSER_VERSION); assertInstanceOf( webClient.getPage( new URL( "http://money.cnn.com/markets/afterhours/" ) ), HtmlPage.class ); } |