Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-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 8736817BAF for ; Thu, 19 Nov 2015 17:23:33 +0000 (UTC) Received: (qmail 39435 invoked by uid 500); 19 Nov 2015 17:23:33 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 39362 invoked by uid 500); 19 Nov 2015 17:23:33 -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 39353 invoked by uid 99); 19 Nov 2015 17:23:33 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 17:23:33 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id C8E25C0EC7 for ; Thu, 19 Nov 2015 17:23:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.79 X-Spam-Level: * X-Spam-Status: No, score=1.79 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id E4vth42xBcUi for ; Thu, 19 Nov 2015 17:23:31 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 62BC020EBA for ; Thu, 19 Nov 2015 17:23:30 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 81EDDE00B6 for ; Thu, 19 Nov 2015 17:23:29 +0000 (UTC) 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 F40573A019A for ; Thu, 19 Nov 2015 17:23:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1715221 - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java Date: Thu, 19 Nov 2015 17:23:28 -0000 To: commits@commons.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151119172328.F40573A019A@svn01-us-west.apache.org> Author: bdelacretaz Date: Thu Nov 19 17:23:28 2015 New Revision: 1715221 URL: http://svn.apache.org/viewvc?rev=1715221&view=rev Log: IO-487 - include class name in InvalidClassException Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java commons/proper/io/trunk/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java?rev=1715221&r1=1715220&r2=1715221&view=diff ============================================================================== --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java Thu Nov 19 17:23:28 2015 @@ -93,7 +93,7 @@ public class ValidatingObjectInputStream * @throws InvalidClassException */ protected void invalidClassNameFound(String className) throws InvalidClassException{ - throw new InvalidClassException("Class name not accepted"); + throw new InvalidClassException("Class name not accepted: " + className); } @Override Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java?rev=1715221&r1=1715220&r2=1715221&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java Thu Nov 19 17:23:28 2015 @@ -18,6 +18,8 @@ */ package org.apache.commons.io.serialization; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.junit.Assert.assertEquals; import java.io.ByteArrayInputStream; @@ -86,6 +88,18 @@ public class ValidatingObjectInputStream } @Test + public void exceptionIncludesClassName() throws Exception { + try { + assertSerialization( + willClose(new ValidatingObjectInputStream(testStream))); + fail("Expected an InvalidClassException"); + } catch(InvalidClassException ice) { + final String name = OurTestClass.class.getName(); + assertTrue("Expecting message to contain " + name, ice.getMessage().contains(name)); + } + } + + @Test public void acceptCustomMatcher() throws Exception { assertSerialization( willClose(new ValidatingObjectInputStream(testStream))