Revision: 1404
http://japi.svn.sourceforge.net/japi/?rev=1404&view=rev
Author: christianhujer
Date: 2010-04-11 10:44:37 +0000 (Sun, 11 Apr 2010)
Log Message:
-----------
Remove trailing end of line characters of code lines for log output.
Modified Paths:
--------------
tools/archStat/trunk/src/prj/net/sf/japi/archstat/LogEntry.java
Modified: tools/archStat/trunk/src/prj/net/sf/japi/archstat/LogEntry.java
===================================================================
--- tools/archStat/trunk/src/prj/net/sf/japi/archstat/LogEntry.java 2010-04-11 10:19:34 UTC (rev 1403)
+++ tools/archStat/trunk/src/prj/net/sf/japi/archstat/LogEntry.java 2010-04-11 10:44:37 UTC (rev 1404)
@@ -68,7 +68,7 @@
*/
public LogEntry(final File file, @Nullable final String line, @Nullable final Integer lineNumber, @Nullable final Integer column, @NotNull final MessageType messageType, @NotNull final String messageId, @NotNull final String message) {
this.file = file;
- this.line = line;
+ this.line = removeEOL(line);
this.lineNumber = lineNumber;
this.column = column;
this.messageType = messageType;
@@ -76,6 +76,19 @@
this.message = message;
}
+ /** Returns a String with any trailing end of line characters removed.
+ * Trailing whitespace other than EOL characters are not removed.
+ * This method currently treats LF and CR as EOL characters.
+ * @param line Line from which to remove trailing end of line characters, maybe <code>null</code>
+ * @return The line with trailing end of line characters removed.
+ */
+ private static String removeEOL(@Nullable final String line) {
+ if (line != null) {
+ return line.replaceAll("[\n\r]+$", "");
+ }
+ return line;
+ }
+
/** Creates a LogEntry.
* @param file File for which this LogEntry is being logged.
* @param messageType Message Type.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|