aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-channel/src/main
diff options
context:
space:
mode:
authorfmallet <freddy.mallet@gmail.com>2010-11-25 20:23:16 +0000
committerfmallet <freddy.mallet@gmail.com>2010-11-25 20:23:16 +0000
commit9e6291e748bd2020d82989e8344f98305ee34b91 (patch)
treee10d6bb810e82028181cb6291be747e4637e6a02 /sonar-channel/src/main
parent8ccd8b6a76f817de4fee9ed539648fd118a5f034 (diff)
downloadsonarqube-9e6291e748bd2020d82989e8344f98305ee34b91.tar.gz
sonarqube-9e6291e748bd2020d82989e8344f98305ee34b91.zip
fix SONAR-2010 : the Integer.MAX_VALUE is returned only when the buffer can't contain all characters.
Diffstat (limited to 'sonar-channel/src/main')
-rw-r--r--sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java b/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java
index acabfb14467..0b5a72822ba 100644
--- a/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java
+++ b/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java
@@ -93,7 +93,7 @@ public class CodeBuffer implements CharSequence {
return character;
}
- private final void updateCursorPosition(int character) {
+ private void updateCursorPosition(int character) {
if (character == LF || character == CR) {
if ((lastChar != LF && lastChar != CR) || lastChar == character || lastChar == LF) {
cursor.line++;
@@ -241,15 +241,14 @@ public class CodeBuffer implements CharSequence {
}
/**
- * Warning : this method always returns Integer.MAX_VALUE
- * as the length of the stream can't be known before having consumed
- * all characters.
+ * Warning : this method always returns Integer.MAX_VALUE as the length of the stream can't be known before having consumed all
+ * characters.
*
- * Integer.MAX_VALUE is returned to prevent regular expression matchers
- * to stop consuming the stream of characters (see http://jira.codehaus.org/browse/SONAR-2010)
+ * Integer.MAX_VALUE is returned to prevent regular expression matchers to stop consuming the stream of characters (see
+ * http://jira.codehaus.org/browse/SONAR-2010)
*/
public final int length() {
- return Integer.MAX_VALUE;
+ return (bufferSize == bufferCapacity ? Integer.MAX_VALUE : bufferSize);
}
public final CharSequence subSequence(int start, int end) {
@@ -267,7 +266,7 @@ public class CodeBuffer implements CharSequence {
return result.toString();
}
- public final class Cursor {
+ public final class Cursor implements Cloneable {
private int line = 1;
private int column = 0;