Author: ajaquith
Date: Thu Feb 5 05:06:09 2009
New Revision: 741001
URL: http://svn.apache.org/viewvc?rev=741001&view=rev
Log:
Additional tweaks to CommentedProperties, and fixes to 4 more failing unit
tests. Removed some erroneous linebreaks in the Russian version of
default.properties.
Modified:
incubator/jspwiki/trunk/ChangeLog
incubator/jspwiki/trunk/etc/i18n/templates/default_ru.properties
incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/util/CommentedProperties.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/util/CommentedPropertiesTest.java
Modified: incubator/jspwiki/trunk/ChangeLog
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=741001&r1=741000&r2=741001&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Thu Feb 5 05:06:09 2009
@@ -1,3 +1,10 @@
+2009-02-05 Andrew Jaquith <ajaquith AT apache DOT org>
+
+ * 3.0.0-svn-62
+
+ * Additional tweaks to CommentedProperties, and fixes to 4 more
failing unit tests.
+ Removed some erroneous linebreaks in the Russian version of
default.properties.
+
2009-02-04 Andrew Jaquith <ajaquith AT apache DOT org>
* 3.0.0-svn-61
Modified: incubator/jspwiki/trunk/etc/i18n/templates/default_ru.properties
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/templates/default_ru.properties?rev=741001&r1=741000&r2=741001&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/templates/default_ru.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/templates/default_ru.properties Thu Feb 5
05:06:09 2009
@@ -5,8 +5,7 @@
#
# Common things
-common.nopage=
-\u042d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430
\u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.
\u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0432\u0430\u043c
\u0435\u0435 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c {0}?
+common.nopage=\u042d\u0442\u0430
\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435
\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.
\u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0432\u0430\u043c
\u0435\u0435 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c {0}?
common.createit=\u0441\u043e\u0437\u0434\u0430\u0442\u044c
common.more=\u0411\u043e\u043b\u044c\u0448\u0435...
@@ -32,8 +31,7 @@
comment.title.comment={0}:
\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: {1}
comment.tab.discussionpage=\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430
\u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0439
comment.tab.addcomment=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c
\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439
-comment.edithelpmissing=
-\u041f\u043e\u0445\u043e\u0436\u0435
\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 {0}
\u0443\u0442\u0435\u0440\u044f\u043d\u0430. \
+comment.edithelpmissing=\u041f\u043e\u0445\u043e\u0436\u0435
\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 {0}
\u0443\u0442\u0435\u0440\u044f\u043d\u0430. \
\u0412\u0430\u043c \u043d\u0430\u0434\u043e
\u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c
\u0438\u043d\u0441\u0442\u0430\u043b\u044f\u0446\u0438\u044e...\
<br /><br />\
\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435
\u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c
\u0442\u0435\u043a\u0441\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b
\
@@ -261,8 +259,7 @@
login.register.tab=\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f
\u043d\u043e\u0432\u043e\u0433\u043e
\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f
login.tab.help=\u041f\u043e\u043c\u043e\u0449\u044c
-login.loginhelpmissing=
-\u041f\u043e\u0445\u043e\u0436\u0435
\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 {0}
\u043f\u043e\u0442\u0435\u0440\u044f\u043d\u0430. \
+login.loginhelpmissing=\u041f\u043e\u0445\u043e\u0436\u0435
\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 {0}
\u043f\u043e\u0442\u0435\u0440\u044f\u043d\u0430. \
\u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b
\u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c
\u0438\u043d\u0441\u0442\u0430\u043b\u044f\u0446\u0438\u044e...\
<br /><br />\
\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435
\u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c
\u0442\u0435\u043a\u0441\u0442 \u0441 \
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=741001&r1=741000&r2=741001&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Thu Feb 5
05:06:09 2009
@@ -77,7 +77,7 @@
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "61";
+ public static final String BUILD = "62";
/**
* This is the generic version string you should use
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/util/CommentedProperties.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/util/CommentedProperties.java?rev=741001&r1=741000&r2=741001&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/java/org/apache/wiki/util/CommentedProperties.java
(original)
+++
incubator/jspwiki/trunk/src/java/org/apache/wiki/util/CommentedProperties.java
Thu Feb 5 05:06:09 2009
@@ -177,7 +177,7 @@
{
for( String comment : commentList )
{
- if ( BLANK_LINE_DETECTOR.matcher( comment ).matches() )
+ if( BLANK_LINE_DETECTOR.matcher( comment ).matches() )
{
writer.write( comment );
}
@@ -190,7 +190,7 @@
}
}
}
-
+
private void writeText( BufferedWriter writer, Object entry, EscapeMode
mode ) throws IOException
{
String e = entry.toString();
@@ -229,7 +229,7 @@
break;
}
case ' ': {
- if ( leadingSpaces || mode == EscapeMode.KEY )
+ if( (mode == EscapeMode.ENTRY && leadingSpaces) || mode ==
EscapeMode.KEY )
{
writer.write( '\\' );
}
@@ -240,10 +240,9 @@
case '#':
case '!':
case '=':
- case ':':
- {
+ case ':': {
leadingSpaces = false;
- if ( mode == EscapeMode.KEY )
+ if( mode == EscapeMode.KEY )
{
writer.write( '\\' );
}
@@ -399,7 +398,11 @@
* {...@link #load(Reader)} or {...@link #load(InputStream)} methods,
<em>or</em>
* as supplied to t...@link #setProperty(String, String, String)} method.
* The leading <code>#</code> or <code>!</code> characters are not
- * included.
+ * included, but everything after these characters, including whitespace,
is
+ * returned. If the comment spans more than one line, the String returned
+ * will contain line separator characters separating each line. The line
+ * separator characters will be specific to the JRE platform in use, as
+ * returned by the System property <code>line.separator</code>.
*
* @param key the key to look up
* @return the list of strings representing the comment, each item of which
Modified:
incubator/jspwiki/trunk/tests/java/org/apache/wiki/util/CommentedPropertiesTest.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/util/CommentedPropertiesTest.java?rev=741001&r1=741000&r2=741001&view=diff
==============================================================================
---
incubator/jspwiki/trunk/tests/java/org/apache/wiki/util/CommentedPropertiesTest.java
(original)
+++
incubator/jspwiki/trunk/tests/java/org/apache/wiki/util/CommentedPropertiesTest.java
Thu Feb 5 05:06:09 2009
@@ -73,24 +73,23 @@
assertTrue( m_props.toString().indexOf( "newProp=newValue2" ) != -1 );
}
- public void testSetMultilineProperty() throws Exception
+ public void testSetEscapedProperty() throws Exception
{
CommentedProperties props = new CommentedProperties();
- props.put( "foo", "This is a\r\nmultiline\nproperty\rwith 4 lines." );
+ props.put( "foo", "This is an\r\nescaped\nline\rwith 4 separator
characters." );
File outFile = createFile( "test2.properties" );
OutputStream out = new FileOutputStream( outFile );
props.store( out, null );
// Make sure that the line was escaped properly
- String cr = System.getProperty( "line.separator" );
String propString = props.toString();
- assertEquals( "foo=This is a \\" + cr +"multiline \\" + cr + "property
\\" + cr + "with 4 lines.\n", propString );
+ assertEquals( "foo=This is an\\r\\nescaped\\nline\\rwith 4 separator
characters.\n", propString );
- // Reload and make sure the property is parsed in as 1 line
+ // Reload and make sure the property is parsed in as 4 lines
props = new CommentedProperties();
InputStream in =
CommentedPropertiesTest.class.getClassLoader().getResourceAsStream(
"test2.properties" );
props.load( in );
- assertEquals( "This is a multiline property with 4 lines.", props.get(
"foo" ) );
+ assertEquals( "This is an\r\nescaped\nline\rwith 4 separator
characters.", props.get( "foo" ) );
// Delete the test file
File file = getFile( "test2.properties" );
@@ -103,12 +102,12 @@
public void testGetComment()
{
String cr = System.getProperty( "line.separator" );
- assertEquals( "This is a sample properties file with comments",
m_props.getComment( "testProp1" ) );
- assertEquals( "This is a comment" + cr + "with two lines",
m_props.getComment( "testProp2" ) );
- assertEquals( "This is a property with no value", m_props.getComment(
"testProp3" ) );
- assertEquals( "Two final properties", m_props.getComment( "testProp4"
) );
+ assertEquals( " This is a sample properties file with comments",
m_props.getComment( "testProp1" ) );
+ assertEquals( " This is a comment" + cr + " with two lines",
m_props.getComment( "testProp2" ) );
+ assertEquals( " This is a property with no value", m_props.getComment(
"testProp3" ) );
+ assertEquals( " Two final properties", m_props.getComment( "testProp4"
) );
assertEquals( null, m_props.getComment( "testProp5" ) );
- assertEquals( "This is a property that spans more than 1 line",
m_props.getComment( "testProp6" ) );
+ assertEquals( " This is a property that spans more than 1 line",
m_props.getComment( "testProp6" ) );
}
public void testSetComment()
@@ -118,7 +117,7 @@
assertEquals( "This is a comment", m_props.getComment( "testProp7" ) );
// Make sure it was actually added to the string returned by toString()
- assertTrue( m_props.toString().contains( "# This is a
comment\ntestProp7=TestValue" ) );
+ assertTrue( m_props.toString().contains( "#This is a
comment\ntestProp7=TestValue" ) );
}
public void testMultilineProperties()