Return-Path: Delivered-To: apmail-velocity-commits-archive@locus.apache.org Received: (qmail 45091 invoked from network); 10 Aug 2007 00:24:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Aug 2007 00:24:53 -0000 Received: (qmail 80700 invoked by uid 500); 10 Aug 2007 00:24:52 -0000 Delivered-To: apmail-velocity-commits-archive@velocity.apache.org Received: (qmail 80670 invoked by uid 500); 10 Aug 2007 00:24:52 -0000 Mailing-List: contact commits-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@velocity.apache.org Delivered-To: mailing list commits@velocity.apache.org Received: (qmail 80661 invoked by uid 99); 10 Aug 2007 00:24:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2007 17:24:52 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 00:24:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B70AD1A981D; Thu, 9 Aug 2007 17:24:29 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r564440 - /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Date: Fri, 10 Aug 2007 00:24:29 -0000 To: commits@velocity.apache.org From: nbubna@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070810002429.B70AD1A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Aug 9 17:24:28 2007 New Revision: 564440 URL: http://svn.apache.org/viewvc?view=rev&rev=564440 Log: fix style issues Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/BrowserTool.java URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/BrowserTool.java?view=diff&rev=564440&r1=564439&r2=564440 ============================================================================== --- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/BrowserTool.java (original) +++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Thu Aug 9 17:24:28 2007 @@ -85,7 +85,7 @@ throw new NullPointerException("request should not be null"); } userAgent = request.getHeader("User-Agent"); - if(userAgent == null) { + if (userAgent == null) { userAgent = ""; } else { userAgent = userAgent.toLowerCase(); @@ -863,7 +863,7 @@ { try { - if(version != null) + if (version != null) { return; /* parsing of version already done */ } @@ -885,22 +885,28 @@ + "[^\\s]*)" /* Throw away the remaining */ , Pattern.COMMENTS).matcher(userAgent); - if(v.find()) + if (v.find()) { version = v.group(1); try { majorVersion = Integer.parseInt(v.group(2)); String minor = v.group(3); - if(minor.startsWith("0"))minorVersion = 0; - else minorVersion = Integer.parseInt(minor); + if (minor.startsWith("0")) + { + minorVersion = 0; + } + else + { + minorVersion = Integer.parseInt(minor); + } } - catch(NumberFormatException nfe) + catch (NumberFormatException nfe) {} } /* Firefox versionning */ - if(test("firefox")) + if (test("firefox")) { Matcher fx = Pattern.compile( "/" @@ -914,23 +920,29 @@ + "[^\\s]*)" /* Throw away the remaining */ , Pattern.COMMENTS) .matcher(userAgent); - if(fx.find()) + if (fx.find()) { version = fx.group(1); try { majorVersion = Integer.parseInt(fx.group(2)); String minor = fx.group(3); - if(minor.startsWith("0"))minorVersion = 0; - else minorVersion = Integer.parseInt(minor); + if (minor.startsWith("0")) + { + minorVersion = 0; + } + else + { + minorVersion = Integer.parseInt(minor); + } } - catch(NumberFormatException nfe) + catch (NumberFormatException nfe) {} } } /* IE versionning */ - if(test("compatible")) + if (test("compatible")) { Matcher ie = Pattern.compile( "compatible;" @@ -950,23 +962,29 @@ + "[^\\s]*)" /* Throw away remaining dots and digits */ , Pattern.COMMENTS) .matcher(userAgent); - if(ie.find()) + if (ie.find()) { version = ie.group(1); try { majorVersion = Integer.parseInt(ie.group(2)); String minor = ie.group(3); - if(minor.startsWith("0"))minorVersion = 0; - else minorVersion = Integer.parseInt(minor); + if (minor.startsWith("0")) + { + minorVersion = 0; + } + else + { + minorVersion = Integer.parseInt(minor); + } } - catch(NumberFormatException nfe) + catch (NumberFormatException nfe) {} } } /* Safari versionning*/ - if(getSafari()) + if (getSafari()) { Matcher safari = Pattern.compile( "safari/" @@ -980,7 +998,7 @@ /* Minor version number is digits after first dot */ , Pattern.COMMENTS) .matcher(userAgent); - if(safari.find()) + if (safari.find()) { version = safari.group(1); try @@ -989,13 +1007,13 @@ majorVersion = sv / 100; minorVersion = sv % 100; } - catch(NumberFormatException nfe) + catch (NumberFormatException nfe) {} } } /* Gecko-powered Netscape (i.e. Mozilla) versions */ - if(getGecko() && getNetscape() && test("netscape")) + if (getGecko() && getNetscape() && test("netscape")) { Matcher netscape = Pattern.compile( "netscape/" @@ -1009,23 +1027,29 @@ + "[^\\s]*)" /* Throw away the remaining */ , Pattern.COMMENTS) .matcher(userAgent); - if(netscape.find()) + if (netscape.find()) { version = netscape.group(1); try { majorVersion = Integer.parseInt(netscape.group(2)); String minor = netscape.group(3); - if(minor.startsWith("0"))minorVersion = 0; - else minorVersion = Integer.parseInt(minor); + if (minor.startsWith("0")) + { + minorVersion = 0; + } + else + { + minorVersion = Integer.parseInt(minor); + } } - catch(NumberFormatException nfe) + catch (NumberFormatException nfe) {} } } /* last try if version not found */ - if(version == null) + if (version == null) { Matcher mv = Pattern.compile( "[\\w]+/" @@ -1034,7 +1058,7 @@ /* Major version number is every digit before the first dot */ , Pattern.COMMENTS) .matcher(userAgent); - if(mv.find()) + if (mv.find()) { version = mv.group(1); try @@ -1042,33 +1066,39 @@ majorVersion = Integer.parseInt(version); minorVersion = 0; } - catch(NumberFormatException nfe) + catch (NumberFormatException nfe) {} } } /* gecko engine version */ - if(getGecko()) + if (getGecko()) { Matcher g = Pattern.compile( "\\([^)]*rv:(([\\d]*)\\.([\\d]*).*?)\\)" ).matcher(userAgent); - if(g.find()) + if (g.find()) { geckoVersion = g.group(1); try { geckoMajorVersion = Integer.parseInt(g.group(2)); String minor = g.group(3); - if(minor.startsWith("0"))geckoMinorVersion = 0; - else geckoMinorVersion = Integer.parseInt(minor); + if (minor.startsWith("0")) + { + geckoMinorVersion = 0; + } + else + { + geckoMinorVersion = Integer.parseInt(minor); + } } - catch(NumberFormatException nfe) + catch (NumberFormatException nfe) {} } } } - catch(PatternSyntaxException nfe) + catch (PatternSyntaxException nfe) { // where should I log ?! }