You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2005/07/24 22:58:35 UTC
svn commit: r224658 -
/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/io/BeanWriter.java
Author: rdonkin
Date: Sun Jul 24 13:58:32 2005
New Revision: 224658
URL: http://svn.apache.org/viewcvs?rev=224658&view=rev
Log:
Added check for security exception.
Modified:
jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/io/BeanWriter.java
Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/io/BeanWriter.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/io/BeanWriter.java?rev=224658&r1=224657&r2=224658&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/io/BeanWriter.java (original)
+++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/io/BeanWriter.java Sun Jul 24 13:58:32 2005
@@ -78,10 +78,28 @@
*/
public class BeanWriter extends AbstractBeanWriter {
+ /**
+ * Gets the default EOL string.
+ * @return EOL string, not null
+ */
+ private static final String getEOL() {
+ // just wraps call in an exception check for access restricted environments
+ String result = "\n";
+ try {
+ System.getProperty( "line.separator", "\n" );
+ } catch (SecurityException se) {
+ Log log = LogFactory.getLog( BeanWriter.class );
+ log.warn("Cannot load line separator property: " + se.getMessage());
+ log.trace("Caused by: ", se);
+ }
+ return result;
+ }
+
+
/** Where the output goes */
private Writer writer;
/** text used for end of lines. Defaults to <code>\n</code>*/
- private static final String EOL = System.getProperty( "line.separator", "\n" );
+ private static final String EOL = getEOL();
/** text used for end of lines. Defaults to <code>\n</code>*/
private String endOfLine = EOL;
/** indentation text */
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org