Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B9FB511050 for ; Thu, 27 Mar 2014 05:38:23 +0000 (UTC) Received: (qmail 62178 invoked by uid 500); 27 Mar 2014 05:38:23 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 62146 invoked by uid 500); 27 Mar 2014 05:38:21 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 62139 invoked by uid 99); 27 Mar 2014 05:38:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2014 05:38:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2014 05:38:16 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8E1A4238890D; Thu, 27 Mar 2014 05:37:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1582194 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Assert.java Date: Thu, 27 Mar 2014 05:37:54 -0000 To: commits@logging.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140327053754.8E1A4238890D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ggregory Date: Thu Mar 27 05:37:54 2014 New Revision: 1582194 URL: http://svn.apache.org/r1582194 Log: The code and Javadoc do not match. Make the behavior like the same Java 7 Objects API. Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Assert.java Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Assert.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Assert.java?rev=1582194&r1=1582193&r2=1582194&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Assert.java (original) +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Assert.java Thu Mar 27 05:37:54 2014 @@ -27,7 +27,7 @@ public final class Assert { * Throws a {@code NullPointerException} if the specified parameter is * {@code null}, otherwise returns the specified parameter. *

- * On Java 7, just use Objects#requireNonNull() + * On Java 7, just use {@code Objects.requireNonNull(T, String)} *

*

* Usage: @@ -36,27 +36,27 @@ public final class Assert { * // earlier you would write this: * public SomeConstructor(Object param) { * if (param == null) { - * throw new NullPointerException(name + " is null"); + * throw new NullPointerException("param"); * } * this.field = param; * } * * // now you can do the same in one line: * public SomeConstructor(Object param) { - * this.field = Assert.requireNonNull(param); + * this.field = Assert.requireNonNull("param"); * } * * * @param the type of the parameter to check and return - * @param checkMe the parameter to check - * @param name name of the parameter to use in the error message if + * @param object the parameter to check + * @param message name of the parameter to use in the error message if * {@code null} * @return the specified parameter */ - public static T requireNonNull(final T checkMe, final String name) { - if (checkMe == null) { - throw new NullPointerException(name + " is null"); + public static T requireNonNull(final T object, final String message) { + if (object == null) { + throw new NullPointerException(message); } - return checkMe; + return object; } }