aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-channel
diff options
context:
space:
mode:
authorFreddy Mallet <freddy.mallet@gmail.com>2011-10-21 16:11:11 +0200
committerFreddy Mallet <freddy.mallet@gmail.com>2011-10-21 16:11:11 +0200
commit23fc53ba0c81948db767e3046e725b6ac224f8cf (patch)
treee7d1e874e4fe9b87a8b42f24471db0ef3368930e /sonar-channel
parent458d2753afde373236abfd4d09b7f3a4714bf63a (diff)
downloadsonarqube-23fc53ba0c81948db767e3046e725b6ac224f8cf.tar.gz
sonarqube-23fc53ba0c81948db767e3046e725b6ac224f8cf.zip
SONAR-2632 for backward compatibility reason with COBOL plugin, we should stop reading a stream of characters as soon as the read(..) method returns -1 or 0
Diffstat (limited to 'sonar-channel')
-rw-r--r--sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java5
1 files changed, 3 insertions, 2 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 de3d67a4f0c..2093644b756 100644
--- a/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java
+++ b/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java
@@ -78,9 +78,10 @@ public class CodeBuffer implements CharSequence {
try {
StringBuilder sb = new StringBuilder();
char[] buffer = new char[4096];
- int read;
- while ((read = reader.read(buffer)) != -1) {
+ int read = reader.read(buffer);
+ while(read != -1 && read != 0) {
sb.append(buffer, 0, read);
+ read = reader.read(buffer);
}
this.buffer = new char[sb.length()];
sb.getChars(0, sb.length(), this.buffer, 0);