diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-04 10:42:21 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-04 10:42:21 +0100 |
commit | a14a0644c2a27ddec22f23925578a40aa6fa8302 (patch) | |
tree | aa5c078cc8ec7c4e2020960ad9a343fb7e79a16c /sonar-channel | |
parent | 0f44a42b85093a3dcef64b52f6e15337b119ec88 (diff) | |
download | sonarqube-a14a0644c2a27ddec22f23925578a40aa6fa8302.tar.gz sonarqube-a14a0644c2a27ddec22f23925578a40aa6fa8302.zip |
Upgrade copyright headers
Diffstat (limited to 'sonar-channel')
11 files changed, 79 insertions, 79 deletions
diff --git a/sonar-channel/src/main/java/org/sonar/channel/Channel.java b/sonar-channel/src/main/java/org/sonar/channel/Channel.java index 198ad995f61..b646a023435 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/Channel.java +++ b/sonar-channel/src/main/java/org/sonar/channel/Channel.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java b/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java index 59b3f810807..5422def73a3 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java +++ b/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java b/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java index 6ebb0507373..aaab3cf97c8 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java +++ b/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java @@ -1,70 +1,70 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-
-package org.sonar.channel;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ChannelDispatcher<OUTPUT> extends Channel<OUTPUT> {
-
- private static final Logger logger = LoggerFactory.getLogger(ChannelDispatcher.class);
- private final boolean failIfNoChannelToConsumeOneCharacter;
-
- @SuppressWarnings("rawtypes")
- private final Channel[] channels;
-
- @SuppressWarnings("rawtypes")
- public ChannelDispatcher(List<Channel> tokenizers) {
- this(tokenizers, false);
- }
-
- @SuppressWarnings("rawtypes")
- public ChannelDispatcher(List<Channel> tokenizers, boolean failIfNoChannelToConsumeOneCharacter) {
- this.channels = tokenizers.toArray(new Channel[0]); // NOSONAR, lack of performance is not an issue here
- this.failIfNoChannelToConsumeOneCharacter = failIfNoChannelToConsumeOneCharacter;
- }
-
- public boolean consume(CodeReader code, OUTPUT output) {
- int nextChar = code.peek();
- while (nextChar != -1) {
- boolean channelConsumed = false;
- for (Channel<OUTPUT> channel : channels) {
- if (channel.consume(code, output)) {
- channelConsumed = true;
- break;
- }
- }
- if ( !channelConsumed) {
- String message = "None of the channel has been able to handle character '" + (char) code.peek() + "' (decimal value " + code.peek()
- + ") at line " + code.getLinePosition() + ", column " + code.getColumnPosition();
- if (failIfNoChannelToConsumeOneCharacter) {
- throw new IllegalStateException(message);
- }
- logger.debug(message);
- code.pop();
- }
- nextChar = code.peek();
- }
- return true;
- }
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ + +package org.sonar.channel; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ChannelDispatcher<OUTPUT> extends Channel<OUTPUT> { + + private static final Logger logger = LoggerFactory.getLogger(ChannelDispatcher.class); + private final boolean failIfNoChannelToConsumeOneCharacter; + + @SuppressWarnings("rawtypes") + private final Channel[] channels; + + @SuppressWarnings("rawtypes") + public ChannelDispatcher(List<Channel> tokenizers) { + this(tokenizers, false); + } + + @SuppressWarnings("rawtypes") + public ChannelDispatcher(List<Channel> tokenizers, boolean failIfNoChannelToConsumeOneCharacter) { + this.channels = tokenizers.toArray(new Channel[0]); // NOSONAR, lack of performance is not an issue here + this.failIfNoChannelToConsumeOneCharacter = failIfNoChannelToConsumeOneCharacter; + } + + public boolean consume(CodeReader code, OUTPUT output) { + int nextChar = code.peek(); + while (nextChar != -1) { + boolean channelConsumed = false; + for (Channel<OUTPUT> channel : channels) { + if (channel.consume(code, output)) { + channelConsumed = true; + break; + } + } + if ( !channelConsumed) { + String message = "None of the channel has been able to handle character '" + (char) code.peek() + "' (decimal value " + code.peek() + + ") at line " + code.getLinePosition() + ", column " + code.getColumnPosition(); + if (failIfNoChannelToConsumeOneCharacter) { + throw new IllegalStateException(message); + } + logger.debug(message); + code.pop(); + } + nextChar = code.peek(); + } + return true; + } }
\ No newline at end of file diff --git a/sonar-channel/src/main/java/org/sonar/channel/ChannelException.java b/sonar-channel/src/main/java/org/sonar/channel/ChannelException.java index 1b1f4c9f3d0..fc43af06b04 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/ChannelException.java +++ b/sonar-channel/src/main/java/org/sonar/channel/ChannelException.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or 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 0b5a72822ba..5515e7eb284 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeBuffer.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java b/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java index 73a2172fbeb..2c93f35fc0b 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or 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 4976a0ea6ba..bd543207ea9 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderConfiguration.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java index 65c2c1db204..76030df244f 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-channel/src/main/java/org/sonar/channel/EndMatcher.java b/sonar-channel/src/main/java/org/sonar/channel/EndMatcher.java index e74d2b76643..c506b9f9dee 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/EndMatcher.java +++ b/sonar-channel/src/main/java/org/sonar/channel/EndMatcher.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-channel/src/test/java/org/sonar/channel/CodeBufferTest.java b/sonar-channel/src/test/java/org/sonar/channel/CodeBufferTest.java index 840a7f46f03..b028184c7c5 100644 --- a/sonar-channel/src/test/java/org/sonar/channel/CodeBufferTest.java +++ b/sonar-channel/src/test/java/org/sonar/channel/CodeBufferTest.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-channel/src/test/java/org/sonar/channel/CodeReaderTest.java b/sonar-channel/src/test/java/org/sonar/channel/CodeReaderTest.java index 0064443fd05..a748cfa6f83 100644 --- a/sonar-channel/src/test/java/org/sonar/channel/CodeReaderTest.java +++ b/sonar-channel/src/test/java/org/sonar/channel/CodeReaderTest.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or |