mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Removed trailing whitespace.
This commit is contained in:
@@ -53,14 +53,14 @@ public interface GuacamoleReader {
|
||||
* this does not guarantee an entire instruction is available. If a full
|
||||
* instruction is not available, this function can return true, and a call
|
||||
* to read() will still block.
|
||||
*
|
||||
*
|
||||
* @return true if instruction data is available for reading, false
|
||||
* otherwise.
|
||||
* @throws GuacamoleException If an error occurs while checking for
|
||||
* available data.
|
||||
*/
|
||||
public boolean available() throws GuacamoleException;
|
||||
|
||||
|
||||
/**
|
||||
* Reads at least one complete Guacamole instruction, returning a buffer
|
||||
* containing one or more complete Guacamole instructions and no
|
||||
|
@@ -93,7 +93,7 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
|
||||
|
||||
// Length of element
|
||||
int elementLength = 0;
|
||||
|
||||
|
||||
// Resume where we left off
|
||||
int i = parseStart;
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
|
||||
|
||||
// Get terminator
|
||||
char terminator = buffer[i + elementLength];
|
||||
|
||||
|
||||
// Move to character after terminator
|
||||
i += elementLength + 1;
|
||||
|
||||
@@ -139,19 +139,19 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
|
||||
System.arraycopy(buffer, i, buffer, 0, usedLength);
|
||||
|
||||
return instruction;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Handle invalid terminator characters
|
||||
else if (terminator != ',')
|
||||
throw new GuacamoleServerException("Element terminator of instruction was not ';' nor ','");
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Otherwise, read more data
|
||||
else
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Otherwise, parse error
|
||||
@@ -189,14 +189,14 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
|
||||
|
||||
// Get instruction
|
||||
char[] instructionBuffer = read();
|
||||
|
||||
|
||||
// If EOF, return EOF
|
||||
if (instructionBuffer == null)
|
||||
return null;
|
||||
|
||||
|
||||
// Start of element
|
||||
int elementStart = 0;
|
||||
|
||||
|
||||
// Build list of elements
|
||||
LinkedList<String> elements = new LinkedList<String>();
|
||||
while (elementStart < instructionBuffer.length) {
|
||||
@@ -232,14 +232,14 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
|
||||
|
||||
// Append element to list of elements
|
||||
elements.addLast(element);
|
||||
|
||||
|
||||
// Read terminator after element
|
||||
elementStart += length;
|
||||
char terminator = instructionBuffer[elementStart];
|
||||
|
||||
// Continue reading instructions after terminator
|
||||
elementStart++;
|
||||
|
||||
|
||||
// If we've reached the end of the instruction
|
||||
if (terminator == ';')
|
||||
break;
|
||||
@@ -248,7 +248,7 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
|
||||
|
||||
// Pull opcode off elements list
|
||||
String opcode = elements.removeFirst();
|
||||
|
||||
|
||||
// Create instruction
|
||||
GuacamoleInstruction instruction = new GuacamoleInstruction(
|
||||
Operation.fromOpcode(opcode),
|
||||
|
@@ -79,7 +79,7 @@ public interface GuacamoleSocket {
|
||||
/**
|
||||
* Returns whether this GuacamoleSocket is open and can be used for reading
|
||||
* and writing.
|
||||
*
|
||||
*
|
||||
* @return true if this GuacamoleSocket is open, false otherwise.
|
||||
*/
|
||||
public boolean isOpen();
|
||||
|
@@ -149,7 +149,7 @@ public class GuacamoleTunnel {
|
||||
/**
|
||||
* Returns the GuacamoleSocket used by this GuacamoleTunnel for reading
|
||||
* and writing.
|
||||
*
|
||||
*
|
||||
* @return The GuacamoleSocket used by this GuacamoleTunnel.
|
||||
*/
|
||||
public GuacamoleSocket getSocket() {
|
||||
@@ -158,7 +158,7 @@ public class GuacamoleTunnel {
|
||||
|
||||
/**
|
||||
* Release all resources allocated to this GuacamoleTunnel.
|
||||
*
|
||||
*
|
||||
* @throws GuacamoleException if an error occurs while releasing
|
||||
* resources.
|
||||
*/
|
||||
@@ -168,11 +168,11 @@ public class GuacamoleTunnel {
|
||||
|
||||
/**
|
||||
* Returns whether this GuacamoleTunnel is open, or has been closed.
|
||||
*
|
||||
*
|
||||
* @return true if this GuacamoleTunnel is open, false if it is closed.
|
||||
*/
|
||||
public boolean isOpen() {
|
||||
return socket.isOpen();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class InetGuacamoleSocket implements GuacamoleSocket {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(InetGuacamoleSocket.class);
|
||||
|
||||
|
||||
private GuacamoleReader reader;
|
||||
private GuacamoleWriter writer;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class InetGuacamoleSocket implements GuacamoleSocket {
|
||||
try {
|
||||
|
||||
logger.debug("Connecting to guacd at {}:{}.", hostname, port);
|
||||
|
||||
|
||||
// Get address
|
||||
SocketAddress address = new InetSocketAddress(
|
||||
InetAddress.getByName(hostname),
|
||||
@@ -136,6 +136,6 @@ public class InetGuacamoleSocket implements GuacamoleSocket {
|
||||
public boolean isOpen() {
|
||||
return !sock.isClosed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ public abstract class FileGuacamoleProperty implements GuacamoleProperty<File> {
|
||||
|
||||
@Override
|
||||
public File parseValue(String value) throws GuacamoleException {
|
||||
|
||||
|
||||
// If no property provided, return null.
|
||||
if (value == null)
|
||||
return null;
|
||||
|
@@ -141,6 +141,6 @@ public class GuacamoleProperties {
|
||||
throw new GuacamoleServerException("Property " + property.getName() + " is required.");
|
||||
|
||||
return value;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket {
|
||||
args[i] = value;
|
||||
else
|
||||
args[i] = "";
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Send args
|
||||
@@ -111,7 +111,7 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket {
|
||||
/**
|
||||
* Returns the GuacamoleConfiguration used to configure this
|
||||
* ConfiguredGuacamoleSocket.
|
||||
*
|
||||
*
|
||||
* @return The GuacamoleConfiguration used to configure this
|
||||
* ConfiguredGuacamoleSocket.
|
||||
*/
|
||||
|
@@ -49,7 +49,7 @@ import java.util.HashMap;
|
||||
public class GuacamoleConfiguration implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private String protocol;
|
||||
private HashMap<String, String> parameters = new HashMap<String, String>();
|
||||
|
||||
|
@@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory;
|
||||
public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(GuacamoleHTTPTunnelServlet.class);
|
||||
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
|
||||
handleTunnelRequest(request, response);
|
||||
@@ -72,7 +72,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
/**
|
||||
* Sends an error on the given HTTP response with the given integer error
|
||||
* code.
|
||||
*
|
||||
*
|
||||
* @param response The HTTP response to use to send the error.
|
||||
* @param code The HTTP status code of the error.
|
||||
* @throws ServletException If an error prevents sending of the error
|
||||
@@ -98,7 +98,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Dispatches every HTTP GET and POST request to the appropriate handler
|
||||
* function based on the query string.
|
||||
@@ -132,7 +132,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
session.attachTunnel(tunnel);
|
||||
|
||||
logger.info("Connection from {} succeeded.", request.getRemoteAddr());
|
||||
|
||||
|
||||
try {
|
||||
// Send UUID to client
|
||||
response.getWriter().print(tunnel.getUUID().toString());
|
||||
@@ -140,7 +140,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
catch (IOException e) {
|
||||
throw new GuacamoleServerException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Failed to connect
|
||||
@@ -233,7 +233,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
// Ensure tunnel is open
|
||||
if (!tunnel.isOpen())
|
||||
throw new GuacamoleResourceNotFoundException("Tunnel is closed.");
|
||||
|
||||
|
||||
// Obtain exclusive read access
|
||||
GuacamoleReader reader = tunnel.acquireReader();
|
||||
|
||||
@@ -273,7 +273,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
// Close tunnel immediately upon EOF
|
||||
if (message == null)
|
||||
tunnel.close();
|
||||
|
||||
|
||||
// End-of-instructions marker
|
||||
out.write("0.;");
|
||||
out.flush();
|
||||
@@ -292,11 +292,11 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
|
||||
// Log typically frequent I/O error if desired
|
||||
logger.debug("Error writing to servlet output stream", e);
|
||||
|
||||
|
||||
// Detach and close
|
||||
session.detachTunnel(tunnel);
|
||||
tunnel.close();
|
||||
|
||||
|
||||
}
|
||||
finally {
|
||||
tunnel.releaseReader();
|
||||
@@ -345,7 +345,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
||||
char[] buffer = new char[8192];
|
||||
|
||||
int length;
|
||||
while (tunnel.isOpen() &&
|
||||
while (tunnel.isOpen() &&
|
||||
(length = input.read(buffer, 0, buffer.length)) != -1)
|
||||
writer.write(buffer, 0, length);
|
||||
|
||||
|
@@ -54,7 +54,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class GuacamoleSession {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(GuacamoleSession.class);
|
||||
|
||||
|
||||
private ConcurrentMap<String, GuacamoleTunnel> tunnels;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user