diff options
author | Dinesh Bolkensteyn <dinesh@dinsoft.net> | 2011-10-21 09:38:50 +0200 |
---|---|---|
committer | Dinesh Bolkensteyn <dinesh@dinsoft.net> | 2011-10-21 11:32:40 +0200 |
commit | 21f551456f598eadad88db6ae866a99f0757dfc4 (patch) | |
tree | 2c459ae54d19978287a6cfb71e4d63b0c2063dc5 | |
parent | a664dcbc02f26a049564c3e1c7793df6ab3d3d30 (diff) | |
download | sonarqube-21f551456f598eadad88db6ae866a99f0757dfc4.tar.gz sonarqube-21f551456f598eadad88db6ae866a99f0757dfc4.zip |
SONAR-2923, SONAR-2632 Add javadoc and quiet close reader
-rw-r--r-- | sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java | 31 | ||||
-rw-r--r-- | sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java | 12 |
2 files changed, 25 insertions, 18 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 8f42fa7979b..de3d67a4f0c 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java @@ -54,21 +54,24 @@ public class CodeBuffer implements CharSequence { } protected CodeBuffer(Reader initialCodeReader, CodeReaderConfiguration configuration) { - lastChar = -1; - cursor = new Cursor(); - tabWidth = configuration.getTabWidth(); + Reader reader = null; - /* Setup the filters on the reader */ - Reader reader = initialCodeReader; - for (CodeReaderFilter<?> codeReaderFilter : configuration.getCodeReaderFilters()) { - reader = new Filter(reader, codeReaderFilter, configuration); + try { + lastChar = -1; + cursor = new Cursor(); + tabWidth = configuration.getTabWidth(); + + /* Setup the filters on the reader */ + reader = initialCodeReader; + for (CodeReaderFilter<?> codeReaderFilter : configuration.getCodeReaderFilters()) { + reader = new Filter(reader, codeReaderFilter, configuration); + } + + fillBuffer(reader); + } + finally { + if (reader != null) IOUtils.closeQuietly(reader); } - - /* Buffer the whole reader */ - fillBuffer(reader); - - /* Clean-up */ - IOUtils.closeQuietly(reader); } private void fillBuffer(Reader reader) { @@ -135,7 +138,7 @@ public class CodeBuffer implements CharSequence { } /** - * Do not use in new code. Used to close the stream + * @deprecated in 2.12, do not use anymore. */ @Deprecated public final void close() { diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java index 8964ab2a046..1e1301b4e66 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java @@ -27,6 +27,12 @@ import java.util.List; * Configuration parameters used by a CodeReader to handle some specificities. */ public class CodeReaderConfiguration { + + /** + * @deprecated in 2.12, do not use anymore. + */ + @Deprecated + public final static int DEFAULT_BUFFER_CAPACITY = 8000; public final static int DEFAULT_TAB_WIDTH = 1; @@ -35,8 +41,7 @@ public class CodeReaderConfiguration { private List<CodeReaderFilter<?>> codeReaderFilters = new ArrayList<CodeReaderFilter<?>>(); /** - * Do not use in new code. Used to get the buffer capacity - * + * @deprecated in 2.12, do not use anymore. * @return the constant Integer.MAX_VALUE */ @Deprecated @@ -45,8 +50,7 @@ public class CodeReaderConfiguration { } /** - * Do not use in new code. Used to set the buffer capacity. Now has no effect - * + * @deprecated in 2.12, do not use anymore. * @param bufferCapacity * the bufferCapacity to set */ |