Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 268CF200C11 for ; Sat, 4 Feb 2017 15:49:03 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1C2C6160B63; Sat, 4 Feb 2017 14:49:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 831BC160B56 for ; Sat, 4 Feb 2017 15:49:02 +0100 (CET) Received: (qmail 53165 invoked by uid 500); 4 Feb 2017 14:49:01 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 53154 invoked by uid 99); 4 Feb 2017 14:49:01 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Feb 2017 14:49:01 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 28D433A0F99 for ; Sat, 4 Feb 2017 14:49:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1781676 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java Date: Sat, 04 Feb 2017 14:49:00 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170204144901.28D433A0F99@svn01-us-west.apache.org> archived-at: Sat, 04 Feb 2017 14:49:03 -0000 Author: sebb Date: Sat Feb 4 14:49:00 2017 New Revision: 1781676 URL: http://svn.apache.org/viewvc?rev=1781676&view=rev Log: Use constant instead of magic number Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java?rev=1781676&r1=1781675&r2=1781676&view=diff ============================================================================== --- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java (original) +++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java Sat Feb 4 14:49:00 2017 @@ -78,6 +78,8 @@ public class UrlValidator implements Ser private static final long serialVersionUID = 7557161713937335013L; + private static final int MAX_UNSIGNED_16_BIT_INT = 0xFFFF; // port max + /** * Allows all validly formatted schemes to pass validation instead of * supplying a set of valid schemes. @@ -416,7 +418,7 @@ public class UrlValidator implements Ser if (port != null && port.length() > 0) { try { int iPort = Integer.parseInt(port); - if (iPort < 0 || iPort > 0xFFFF) { + if (iPort < 0 || iPort > MAX_UNSIGNED_16_BIT_INT) { return false; } } catch (NumberFormatException nfe) {