Remove use of Apache Commons.

This commit is contained in:
Michael Jumper
2012-03-26 11:14:27 -07:00
parent fd4b4610ae
commit 4b72a166ec
2 changed files with 13 additions and 10 deletions

View File

@@ -43,13 +43,6 @@
<version>1.6.1</version> <version>1.6.1</version>
</dependency> </dependency>
<!-- Apache Commons -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -44,7 +44,6 @@ import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.GuacamoleServerException; import net.sourceforge.guacamole.GuacamoleServerException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction; import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation; import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
import org.apache.commons.lang3.ArrayUtils;
/** /**
* A GuacamoleReader which wraps a standard Java Reader, using that Reader as * A GuacamoleReader which wraps a standard Java Reader, using that Reader as
@@ -202,8 +201,19 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
LinkedList<String> elements = new LinkedList<String>(); LinkedList<String> elements = new LinkedList<String>();
while (elementStart < instructionBuffer.length) { while (elementStart < instructionBuffer.length) {
// Find end of length // Find end of length
int lengthEnd = ArrayUtils.indexOf(instructionBuffer, '.', elementStart); int lengthEnd = -1;
for (int i=elementStart; i<instructionBuffer.length; i++) {
if (instructionBuffer[i] == '.') {
lengthEnd = i;
break;
}
}
// read() is required to return a complete instruction. If it does
// not, this is a severe internal error.
if (lengthEnd == -1)
throw new GuacamoleServerException("Read returned incomplete instruction.");
// Parse length // Parse length
int length = Integer.parseInt(new String( int length = Integer.parseInt(new String(