ToStringStyle setArrayEnd handled null incorrectly
bug 31933, fix from Masato Tezuka git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@138011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2463fd3380
commit
cd9922ef8b
|
@ -1,4 +1,4 @@
|
|||
$Id: RELEASE-NOTES.txt,v 1.33 2004/10/16 21:06:18 scolebourne Exp $
|
||||
$Id: RELEASE-NOTES.txt,v 1.34 2004/12/28 23:13:03 scolebourne Exp $
|
||||
|
||||
Commons Lang Package
|
||||
Version 2.1
|
||||
|
@ -120,4 +120,5 @@ BUG FIXES:
|
|||
31395 DateUtils.truncate oddity at the far end of the Date spectrum
|
||||
31478 Compile error with JDK 5 "enum" is a keyword
|
||||
31572 o.a.c.lang.enum.ValuedEnum: 'enum'is a keyword in JDK1.5.0
|
||||
31933 ToStringStyle setArrayEnd handled null incorrectly
|
||||
|
||||
|
|
|
@ -329,6 +329,9 @@ limitations under the License.
|
|||
<contributor>
|
||||
<name>Arun Mammen Thomas</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Masato Tezuka</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Jeff Varszegi</name>
|
||||
</contributor>
|
||||
|
|
|
@ -61,8 +61,9 @@ import org.apache.commons.lang.SystemUtils;
|
|||
* @author Stephen Colebourne
|
||||
* @author Gary Gregory
|
||||
* @author Pete Gieser
|
||||
* @author Masato Tezuka
|
||||
* @since 1.0
|
||||
* @version $Id: ToStringStyle.java,v 1.35 2004/10/16 18:20:46 scolebourne Exp $
|
||||
* @version $Id: ToStringStyle.java,v 1.36 2004/12/28 23:13:03 scolebourne Exp $
|
||||
*/
|
||||
public abstract class ToStringStyle implements Serializable {
|
||||
|
||||
|
@ -1632,8 +1633,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param arrayEnd the new array end text
|
||||
*/
|
||||
protected void setArrayEnd(String arrayEnd) {
|
||||
if (arrayStart == null) {
|
||||
arrayStart = "";
|
||||
if (arrayEnd == null) {
|
||||
arrayEnd = "";
|
||||
}
|
||||
this.arrayEnd = arrayEnd;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ import junit.textui.TestRunner;
|
|||
/**
|
||||
* Test suite for the Lang Builder package.
|
||||
*
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @version $Id: BuilderTestSuite.java,v 1.7 2004/02/18 23:00:51 ggregory Exp $
|
||||
* @author Stephen Colebourne
|
||||
* @version $Id: BuilderTestSuite.java,v 1.8 2004/12/28 23:13:03 scolebourne Exp $
|
||||
*/
|
||||
public class BuilderTestSuite extends TestCase {
|
||||
|
||||
|
@ -57,6 +57,7 @@ public class BuilderTestSuite extends TestCase {
|
|||
suite.addTest(MultiLineToStringStyleTest.suite());
|
||||
suite.addTest(SimpleToStringStyleTest.suite());
|
||||
suite.addTest(StandardToStringStyleTest.suite());
|
||||
suite.addTest(ToStringStyleTest.suite());
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.lang.builder;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
/**
|
||||
* Test case for ToStringStyle.
|
||||
*
|
||||
* @author Masato Tezuka
|
||||
* @version $Id: ToStringStyleTest.java,v 1.1 2004/12/28 23:13:03 scolebourne Exp $
|
||||
*/
|
||||
public class ToStringStyleTest extends TestCase {
|
||||
|
||||
public ToStringStyleTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestRunner.run(suite());
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(ToStringStyleTest.class);
|
||||
suite.setName("ToStringStyle Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
private static class ToStringStyleImpl extends ToStringStyle {
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testSetArrayStart() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setArrayStart(null);
|
||||
assertEquals("", style.getArrayStart());
|
||||
}
|
||||
|
||||
public void testSetArrayEnd() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setArrayEnd(null);
|
||||
assertEquals("", style.getArrayEnd());
|
||||
}
|
||||
|
||||
public void testSetArraySeparator() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setArraySeparator(null);
|
||||
assertEquals("", style.getArraySeparator());
|
||||
}
|
||||
|
||||
public void testSetContentStart() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setContentStart(null);
|
||||
assertEquals("", style.getContentStart());
|
||||
}
|
||||
|
||||
public void testSetContentEnd() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setContentEnd(null);
|
||||
assertEquals("", style.getContentEnd());
|
||||
}
|
||||
|
||||
public void testSetFieldNameValueSeparator() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setFieldNameValueSeparator(null);
|
||||
assertEquals("", style.getFieldNameValueSeparator());
|
||||
}
|
||||
|
||||
public void testSetFieldSeparator() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setFieldSeparator(null);
|
||||
assertEquals("", style.getFieldSeparator());
|
||||
}
|
||||
|
||||
public void testSetNullText() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setNullText(null);
|
||||
assertEquals("", style.getNullText());
|
||||
}
|
||||
|
||||
public void testSetSizeStartText() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setSizeStartText(null);
|
||||
assertEquals("", style.getSizeStartText());
|
||||
}
|
||||
|
||||
public void testSetSizeEndText() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setSizeEndText(null);
|
||||
assertEquals("", style.getSizeEndText());
|
||||
}
|
||||
|
||||
public void testSetSummaryObjectStartText() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setSummaryObjectStartText(null);
|
||||
assertEquals("", style.getSummaryObjectStartText());
|
||||
}
|
||||
|
||||
public void testSetSummaryObjectEndText() {
|
||||
ToStringStyle style = new ToStringStyleImpl();
|
||||
style.setSummaryObjectEndText(null);
|
||||
assertEquals("", style.getSummaryObjectEndText());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue