You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2009/04/27 13:25:17 UTC
svn commit: r768927 [1/2] - in /mina/trunk:
core/src/main/java/org/apache/mina/core/filterchain/
core/src/main/java/org/apache/mina/core/future/
core/src/main/java/org/apache/mina/core/polling/
core/src/main/java/org/apache/mina/core/service/ core/src/...
Author: elecharny
Date: Mon Apr 27 11:25:15 2009
New Revision: 768927
URL: http://svn.apache.org/viewvc?rev=768927&view=rev
Log:
Replaced tabs by spaces
Modified:
mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java
mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/IoFilterAdapter.java
mina/trunk/core/src/main/java/org/apache/mina/core/future/IoFuture.java
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoAcceptor.java
mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoConnector.java
mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateProtocolDecoder.java
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java
mina/trunk/core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java
mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java
mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java
mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/Subnet.java
mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LogLevel.java
mina/trunk/core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java
mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/ProxyConnector.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventType.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractAuthLogicHandler.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpAuthenticationMethods.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyConstants.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyResponse.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/basic/HttpBasicAuthLogicHandler.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/digest/HttpDigestAuthLogicHandler.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/HttpNTLMAuthLogicHandler.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/IoBufferDecoder.java
mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramConnector.java
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java
mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv4Test.java
mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv6Test.java
mina/trunk/core/src/test/java/org/apache/mina/proxy/NTLMTest.java
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramRecyclerTest.java
mina/trunk/example/src/main/java/org/apache/mina/example/proxy/ClientToProxyIoHandler.java
mina/trunk/example/src/test/java/org/apache/mina/example/proxy/Socks5GSSAPITestServer.java
mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/StateMachineProxyBuilder.java
mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprDatagramSession.java
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprLibrary.java
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSession.java
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketSession.java
mina/trunk/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialConnector.java
mina/trunk/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java Mon Apr 27 11:25:15 2009
@@ -820,7 +820,7 @@
}
public String toString() {
- return EntryImpl.this.nextEntry.name;
+ return EntryImpl.this.nextEntry.name;
}
};
}
@@ -847,34 +847,34 @@
@Override
public String toString() {
- StringBuilder sb = new StringBuilder();
-
- // Add the current filter
- sb.append("('").append(getName()).append('\'');
-
- // Add the previous filter
- sb.append(", prev: '");
+ StringBuilder sb = new StringBuilder();
+
+ // Add the current filter
+ sb.append("('").append(getName()).append('\'');
+
+ // Add the previous filter
+ sb.append(", prev: '");
- if (prevEntry != null) {
+ if (prevEntry != null) {
sb.append(prevEntry.name);
sb.append(':');
sb.append(prevEntry.getFilter().getClass().getSimpleName());
- } else {
- sb.append("null");
- }
-
- // Add the next filter
- sb.append("', next: '");
+ } else {
+ sb.append("null");
+ }
+
+ // Add the next filter
+ sb.append("', next: '");
- if (nextEntry != null) {
+ if (nextEntry != null) {
sb.append(nextEntry.name);
sb.append(':');
sb.append(nextEntry.getFilter().getClass().getSimpleName());
- } else {
- sb.append("null");
- }
-
- sb.append("')");
+ } else {
+ sb.append("null");
+ }
+
+ sb.append("')");
return sb.toString();
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/IoFilterAdapter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/IoFilterAdapter.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/IoFilterAdapter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/IoFilterAdapter.java Mon Apr 27 11:25:15 2009
@@ -145,6 +145,6 @@
}
public String toString() {
- return this.getClass().getSimpleName();
+ return this.getClass().getSimpleName();
}
}
\ No newline at end of file
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/future/IoFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/future/IoFuture.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/future/IoFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/future/IoFuture.java Mon Apr 27 11:25:15 2009
@@ -32,7 +32,6 @@
* @version $Rev:671827 $, $Date:2008-06-26 09:49:48 +0100 (jeu., 26 juin 2008) $
*/
public interface IoFuture {
-
/**
* Returns the {@link IoSession} which is associated with this future.
*/
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java Mon Apr 27 11:25:15 2009
@@ -549,7 +549,7 @@
private void process() throws Exception {
for (Iterator<T> i = selectedSessions(); i.hasNext();) {
- T session = i.next();
+ T session = i.next();
process(session);
i.remove();
}
@@ -716,9 +716,9 @@
maxWrittenBytes - writtenBytes,
currentTime);
if (localWrittenBytes > 0 && ((IoBuffer)message).hasRemaining() ) {
- // the buffer isn't empty, we re-interest it in writing
- writtenBytes += localWrittenBytes;
- setInterestedInWrite(session, true);
+ // the buffer isn't empty, we re-interest it in writing
+ writtenBytes += localWrittenBytes;
+ setInterestedInWrite(session, true);
return false;
}
} else if (message instanceof FileRegion) {
@@ -836,7 +836,7 @@
SessionState state = state(session);
switch (state) {
case OPEN:
- updateTrafficControl(session);
+ updateTrafficControl(session);
break;
case CLOSED:
break;
@@ -853,7 +853,7 @@
}
public void updateTrafficControl(T session) {
- try {
+ try {
setInterestedInRead(session, !session.isReadSuspended());
} catch (Exception e) {
IoFilterChain filterChain = session.getFilterChain();
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoAcceptor.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoAcceptor.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoAcceptor.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoAcceptor.java Mon Apr 27 11:25:15 2009
@@ -62,19 +62,19 @@
protected final Object bindLock = new Object();
/**
- * Constructor for {@link AbstractIoAcceptor}. You need to provide a default
- * session configuration and an {@link Executor} for handling I/O events. If
- * null {@link Executor} is provided, a default one will be created using
- * {@link Executors#newCachedThreadPool()}.
+ * Constructor for {@link AbstractIoAcceptor}. You need to provide a default
+ * session configuration and an {@link Executor} for handling I/O events. If
+ * null {@link Executor} is provided, a default one will be created using
+ * {@link Executors#newCachedThreadPool()}.
*
- * {@see AbstractIoService#AbstractIoService(IoSessionConfig, Executor)}
- *
- * @param sessionConfig
- * the default configuration for the managed {@link IoSession}
- * @param executor
- * the {@link Executor} used for handling execution of I/O
- * events. Can be <code>null</code>.
- */
+ * {@see AbstractIoService#AbstractIoService(IoSessionConfig, Executor)}
+ *
+ * @param sessionConfig
+ * the default configuration for the managed {@link IoSession}
+ * @param executor
+ * the {@link Executor} used for handling execution of I/O
+ * events. Can be <code>null</code>.
+ */
protected AbstractIoAcceptor(IoSessionConfig sessionConfig, Executor executor) {
super(sessionConfig, executor);
defaultLocalAddresses.add(null);
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoConnector.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoConnector.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoConnector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoConnector.java Mon Apr 27 11:25:15 2009
@@ -47,19 +47,19 @@
private SocketAddress defaultRemoteAddress;
/**
- * Constructor for {@link AbstractIoConnector}. You need to provide a default
- * session configuration and an {@link Executor} for handling I/O events. If
- * null {@link Executor} is provided, a default one will be created using
- * {@link Executors#newCachedThreadPool()}.
+ * Constructor for {@link AbstractIoConnector}. You need to provide a default
+ * session configuration and an {@link Executor} for handling I/O events. If
+ * null {@link Executor} is provided, a default one will be created using
+ * {@link Executors#newCachedThreadPool()}.
*
- * {@see AbstractIoService#AbstractIoService(IoSessionConfig, Executor)}
- *
- * @param sessionConfig
- * the default configuration for the managed {@link IoSession}
- * @param executor
- * the {@link Executor} used for handling execution of I/O
- * events. Can be <code>null</code>.
- */
+ * {@see AbstractIoService#AbstractIoService(IoSessionConfig, Executor)}
+ *
+ * @param sessionConfig
+ * the default configuration for the managed {@link IoSession}
+ * @param executor
+ * the {@link Executor} used for handling execution of I/O
+ * events. Can be <code>null</code>.
+ */
protected AbstractIoConnector(IoSessionConfig sessionConfig, Executor executor) {
super(sessionConfig, executor);
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java Mon Apr 27 11:25:15 2009
@@ -139,8 +139,7 @@
/**
* Returns a value of whether or not this service is active
*
- * @return
- * whether of not the service is active.
+ * @return whether of not the service is active.
*/
boolean isActive();
@@ -148,8 +147,7 @@
* Returns the time when this service was activated. It returns the last
* time when this service was activated if the service is not active now.
*
- * @return
- * The time by using {@link System#currentTimeMillis()}
+ * @return The time by using {@link System#currentTimeMillis()}
*/
long getActivationTime();
@@ -175,16 +173,14 @@
/**
* Returns the number of bytes scheduled to be written
*
- * @return
- * The number of bytes scheduled to be written
+ * @return The number of bytes scheduled to be written
*/
int getScheduledWriteBytes();
/**
* Returns the number of messages scheduled to be written
*
- * @return
- * The number of messages scheduled to be written
+ * @return The number of messages scheduled to be written
*/
int getScheduledWriteMessages();
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java Mon Apr 27 11:25:15 2009
@@ -589,7 +589,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public final void resumeRead() {
+ public final void resumeRead() {
readSuspended = false;
if (isClosing() || !isConnected()) {
return;
@@ -601,7 +601,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public final void resumeWrite() {
+ public final void resumeWrite() {
writeSuspended = false;
if (isClosing() || !isConnected()) {
return;
@@ -613,14 +613,14 @@
* {@inheritDoc}
*/
public boolean isReadSuspended() {
- return readSuspended;
+ return readSuspended;
}
/**
* {@inheritDoc}
*/
public boolean isWriteSuspended() {
- return writeSuspended;
+ return writeSuspended;
}
/**
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java Mon Apr 27 11:25:15 2009
@@ -39,8 +39,8 @@
*/
public class IdleStatusChecker {
- // the list of session to check
- private final Set<AbstractIoSession> sessions =
+ // the list of session to check
+ private final Set<AbstractIoSession> sessions =
new ConcurrentHashSet<AbstractIoSession>();
/* create a task you can execute in the transport code,
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateProtocolDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateProtocolDecoder.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateProtocolDecoder.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateProtocolDecoder.java Mon Apr 27 11:25:15 2009
@@ -67,7 +67,7 @@
} else if (this.session != session) {
throw new IllegalStateException(
getClass().getSimpleName() + " is a stateful decoder. " +
- "You have to create one per session.");
+ "You have to create one per session.");
}
undecodedBuffers.offer(in);
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java Mon Apr 27 11:25:15 2009
@@ -205,7 +205,7 @@
buf.flip();
buf.limit(buf.limit() - matchCount);
try {
- writeText(session, buf.getString(ctx.getDecoder()), out);
+ writeText(session, buf.getString(ctx.getDecoder()), out);
} finally {
buf.clear();
}
@@ -263,7 +263,7 @@
buf.flip();
buf.limit(buf.limit() - matchCount);
try {
- writeText(session, buf.getString(ctx.getDecoder()), out);
+ writeText(session, buf.getString(ctx.getDecoder()), out);
} finally {
buf.clear();
}
@@ -301,7 +301,7 @@
* @param out the upstream {@code ProtocolDecoderOutput}.
*/
protected void writeText(IoSession session, String text, ProtocolDecoderOutput out) {
- out.write(text);
+ out.write(text);
}
private class Context {
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java Mon Apr 27 11:25:15 2009
@@ -216,10 +216,10 @@
return duplicatePduProbability;
}
- /**
- * not functional ATM
- * @param duplicatePduProbability
- */
+ /**
+ * not functional ATM
+ * @param duplicatePduProbability
+ */
public void setDuplicatePduProbability(int duplicatePduProbability) {
this.duplicatePduProbability = duplicatePduProbability;
}
@@ -291,10 +291,10 @@
public int getResendPduLasterProbability() {
return resendPduLasterProbability;
}
- /**
- * not functional ATM
- * @param resendPduLasterProbability
- */
+ /**
+ * not functional ATM
+ * @param resendPduLasterProbability
+ */
public void setResendPduLasterProbability(int resendPduLasterProbability) {
this.resendPduLasterProbability = resendPduLasterProbability;
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java Mon Apr 27 11:25:15 2009
@@ -123,21 +123,21 @@
* Blocks the specified endpoint.
*/
public void block(InetAddress address) {
- if (address == null) {
- throw new NullPointerException("Adress to block can not be null");
- }
+ if (address == null) {
+ throw new NullPointerException("Adress to block can not be null");
+ }
- block(new Subnet(address, 32));
+ block(new Subnet(address, 32));
}
/**
* Blocks the specified subnet.
*/
public void block(Subnet subnet) {
- if(subnet == null) {
- throw new NullPointerException("Subnet can not be null");
- }
-
+ if(subnet == null) {
+ throw new NullPointerException("Subnet can not be null");
+ }
+
blacklist.add(subnet);
}
@@ -145,11 +145,11 @@
* Unblocks the specified endpoint.
*/
public void unblock(InetAddress address) {
- if (address == null) {
- throw new NullPointerException("Adress to unblock can not be null");
- }
-
- unblock(new Subnet(address, 32));
+ if (address == null) {
+ throw new NullPointerException("Adress to unblock can not be null");
+ }
+
+ unblock(new Subnet(address, 32));
}
/**
@@ -235,13 +235,13 @@
private boolean isBlocked(IoSession session) {
SocketAddress remoteAddress = session.getRemoteAddress();
if (remoteAddress instanceof InetSocketAddress) {
- InetAddress address = ((InetSocketAddress) remoteAddress).getAddress();
+ InetAddress address = ((InetSocketAddress) remoteAddress).getAddress();
// check all subnets
for(Subnet subnet : blacklist) {
- if(subnet.inSubnet(address)) {
- return true;
- }
+ if(subnet.inSubnet(address)) {
+ return true;
+ }
}
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java Mon Apr 27 11:25:15 2009
@@ -57,8 +57,8 @@
* Constructor that takes in a specified wait time.
*
* @param allowedInterval
- * The number of milliseconds a client is allowed to wait
- * before making another successful connection
+ * The number of milliseconds a client is allowed to wait
+ * before making another successful connection
*
*/
public ConnectionThrottleFilter(long allowedInterval) {
@@ -71,8 +71,8 @@
* This value is measured in milliseconds.
*
* @param allowedInterval
- * The number of milliseconds a client is allowed to wait
- * before making another successful connection
+ * The number of milliseconds a client is allowed to wait
+ * before making another successful connection
*/
public void setAllowedInterval(long allowedInterval) {
this.allowedInterval = allowedInterval;
@@ -83,9 +83,9 @@
* to continue
*
* @param session
- * The new session that will be verified
+ * The new session that will be verified
* @return
- * True if the session meets the criteria, otherwise false
+ * True if the session meets the criteria, otherwise false
*/
protected boolean isConnectionOk(IoSession session) {
SocketAddress remoteAddress = session.getRemoteAddress();
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/Subnet.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/Subnet.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/Subnet.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/firewall/Subnet.java Mon Apr 27 11:25:15 2009
@@ -32,91 +32,91 @@
*/
public class Subnet {
- private static final int IP_MASK = 0x80000000;
- private static final int BYTE_MASK = 0xFF;
+ private static final int IP_MASK = 0x80000000;
+ private static final int BYTE_MASK = 0xFF;
- private InetAddress subnet;
- private int subnetInt;
- private int subnetMask;
- private int suffix;
-
- /**
- * Creates a subnet from CIDR notation. For example, the subnet
- * 192.168.0.0/24 would be created using the {@link InetAddress}
- * 192.168.0.0 and the mask 24.
- * @param subnet The {@link InetAddress} of the subnet
- * @param mask The mask
- */
- public Subnet(InetAddress subnet, int mask) {
- if(subnet == null) {
- throw new NullPointerException("Subnet address can not be null");
- }
- if(!(subnet instanceof Inet4Address)) {
- throw new IllegalArgumentException("Only IPv4 supported");
- }
-
- if(mask < 0 || mask > 32) {
- throw new IllegalArgumentException("Mask has to be an integer between 0 and 32");
- }
-
- this.subnet = subnet;
- this.subnetInt = toInt(subnet);
- this.suffix = mask;
-
- // binary mask for this subnet
- this.subnetMask = IP_MASK >> (mask - 1);
- }
-
- /**
- * Converts an IP address into an integer
- */
- private int toInt(InetAddress inetAddress) {
- byte[] address = inetAddress.getAddress();
- int result = 0;
- for (int i = 0; i < address.length; i++) {
- result <<= 8;
- result |= address[i] & BYTE_MASK;
- }
- return result;
- }
-
- /**
- * Converts an IP address to a subnet using the provided
- * mask
- * @param address The address to convert into a subnet
- * @return The subnet as an integer
- */
- private int toSubnet(InetAddress address) {
- return toInt(address) & subnetMask;
- }
-
- /**
- * Checks if the {@link InetAddress} is within this subnet
- * @param address The {@link InetAddress} to check
- * @return True if the address is within this subnet, false otherwise
- */
- public boolean inSubnet(InetAddress address) {
- return toSubnet(address) == subnetInt;
- }
-
- /**
- * @see Object#toString()
- */
- @Override
- public String toString() {
- return subnet.getHostAddress() + "/" + suffix;
- }
-
- @Override
- public boolean equals(Object obj) {
- if(!(obj instanceof Subnet)) {
- return false;
- }
-
- Subnet other = (Subnet) obj;
-
- return other.subnetInt == subnetInt && other.suffix == suffix;
- }
+ private InetAddress subnet;
+ private int subnetInt;
+ private int subnetMask;
+ private int suffix;
+
+ /**
+ * Creates a subnet from CIDR notation. For example, the subnet
+ * 192.168.0.0/24 would be created using the {@link InetAddress}
+ * 192.168.0.0 and the mask 24.
+ * @param subnet The {@link InetAddress} of the subnet
+ * @param mask The mask
+ */
+ public Subnet(InetAddress subnet, int mask) {
+ if(subnet == null) {
+ throw new NullPointerException("Subnet address can not be null");
+ }
+ if(!(subnet instanceof Inet4Address)) {
+ throw new IllegalArgumentException("Only IPv4 supported");
+ }
+
+ if(mask < 0 || mask > 32) {
+ throw new IllegalArgumentException("Mask has to be an integer between 0 and 32");
+ }
+
+ this.subnet = subnet;
+ this.subnetInt = toInt(subnet);
+ this.suffix = mask;
+
+ // binary mask for this subnet
+ this.subnetMask = IP_MASK >> (mask - 1);
+ }
+
+ /**
+ * Converts an IP address into an integer
+ */
+ private int toInt(InetAddress inetAddress) {
+ byte[] address = inetAddress.getAddress();
+ int result = 0;
+ for (int i = 0; i < address.length; i++) {
+ result <<= 8;
+ result |= address[i] & BYTE_MASK;
+ }
+ return result;
+ }
+
+ /**
+ * Converts an IP address to a subnet using the provided
+ * mask
+ * @param address The address to convert into a subnet
+ * @return The subnet as an integer
+ */
+ private int toSubnet(InetAddress address) {
+ return toInt(address) & subnetMask;
+ }
+
+ /**
+ * Checks if the {@link InetAddress} is within this subnet
+ * @param address The {@link InetAddress} to check
+ * @return True if the address is within this subnet, false otherwise
+ */
+ public boolean inSubnet(InetAddress address) {
+ return toSubnet(address) == subnetInt;
+ }
+
+ /**
+ * @see Object#toString()
+ */
+ @Override
+ public String toString() {
+ return subnet.getHostAddress() + "/" + suffix;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(!(obj instanceof Subnet)) {
+ return false;
+ }
+
+ Subnet other = (Subnet) obj;
+
+ return other.subnetInt == subnetInt && other.suffix == suffix;
+ }
-
+
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LogLevel.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LogLevel.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LogLevel.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LogLevel.java Mon Apr 27 11:25:15 2009
@@ -32,50 +32,50 @@
/**
* {@link LogLevel} which logs messages on the TRACE level.
*/
- TRACE(5),
-
+ TRACE(5),
+
/**
* {@link LogLevel} which logs messages on the DEBUG level.
*/
- DEBUG(4),
-
+ DEBUG(4),
+
/**
* {@link LogLevel} which logs messages on the INFO level.
*/
- INFO(3),
-
+ INFO(3),
+
/**
* {@link LogLevel} which logs messages on the WARN level.
*/
- WARN(2),
-
+ WARN(2),
+
/**
* {@link LogLevel} which logs messages on the ERROR level.
*/
- ERROR(1),
-
+ ERROR(1),
+
/**
* {@link LogLevel} which will not log any information
*/
- NONE(0);
+ NONE(0);
- /** The internal numeric value associated with the log level */
- private int level;
-
- /**
- * Create a new instance of a LogLevel.
- *
- * @param level The log level
- */
- private LogLevel(int level) {
- this.level = level;
- }
-
-
- /**
- * @return The numeric value associated with the log level
- */
- public int getLevel() {
- return level;
- }
+ /** The internal numeric value associated with the log level */
+ private int level;
+
+ /**
+ * Create a new instance of a LogLevel.
+ *
+ * @param level The log level
+ */
+ private LogLevel(int level) {
+ this.level = level;
+ }
+
+
+ /**
+ * @return The numeric value associated with the log level
+ */
+ public int getLevel() {
+ return level;
+ }
}
\ No newline at end of file
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java Mon Apr 27 11:25:15 2009
@@ -58,7 +58,7 @@
public void onPreAdd(IoFilterChain parent, String name,
NextFilter nextFilter) throws Exception {
Class<? extends IoFilterAdapter> clazz = getClass();
- if (parent.contains(clazz)) {
+ if (parent.contains(clazz)) {
throw new IllegalStateException(
"Only one " + clazz.getName() + " is permitted.");
}
@@ -82,7 +82,7 @@
if (getMessageClass().isInstance(message)) {
- T stream = getMessageClass().cast(message);
+ T stream = getMessageClass().cast(message);
IoBuffer buffer = getNextBuffer(stream);
if (buffer == null) {
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java Mon Apr 27 11:25:15 2009
@@ -75,7 +75,7 @@
@Override
protected Class<InputStream> getMessageClass() {
- return InputStream.class;
+ return InputStream.class;
}
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/ProxyConnector.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/ProxyConnector.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/ProxyConnector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/ProxyConnector.java Mon Apr 27 11:25:15 2009
@@ -53,8 +53,8 @@
* performs any necessary handshaking with the proxy before allowing data to flow
* normally. During the handshake, any outgoing write requests are buffered.
*
- * @see http://www.nabble.com/Meta-Transport%3A-an-idea-on-implementing-reconnection-and-proxy-td12969001.html
- * @see http://issues.apache.org/jira/browse/DIRMINA-415
+ * @see http://www.nabble.com/Meta-Transport%3A-an-idea-on-implementing-reconnection-and-proxy-td12969001.html
+ * @see http://issues.apache.org/jira/browse/DIRMINA-415
*
* @author The Apache MINA Project (dev@mina.apache.org)
* @version $Rev$, $Date$
@@ -230,7 +230,7 @@
// Removes an old ProxyFilter instance from the chain
if (connector.getFilterChain().contains(className)) {
- connector.getFilterChain().remove(className);
+ connector.getFilterChain().remove(className);
}
// Insert the ProxyFilter as the first filter in the filter chain builder
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventType.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventType.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventType.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventType.java Mon Apr 27 11:25:15 2009
@@ -35,7 +35,7 @@
private final int id;
private IoSessionEventType(int id) {
- this.id = id;
+ this.id = id;
}
/**
@@ -44,7 +44,7 @@
* @return the event id
*/
public int getId() {
- return id;
+ return id;
}
/**
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java Mon Apr 27 11:25:15 2009
@@ -282,7 +282,7 @@
LOGGER.debug(" get proxyIoSession: " + proxyIoSession);
proxyIoSession.setProxyFilter(this);
- // Create a HTTP proxy handler and start handshake.
+ // Create a HTTP proxy handler and start handshake.
ProxyLogicHandler handler = proxyIoSession.getHandler();
// This test prevents from loosing handler conversationnal state when
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractAuthLogicHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractAuthLogicHandler.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractAuthLogicHandler.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractAuthLogicHandler.java Mon Apr 27 11:25:15 2009
@@ -113,7 +113,7 @@
* @param headers the request headers
*/
public static void addKeepAliveHeaders(Map<String, List<String>> headers) {
- StringUtilities.addValueToHeader(headers, "Keep-Alive",
+ StringUtilities.addValueToHeader(headers, "Keep-Alive",
HttpProxyConstants.DEFAULT_KEEP_ALIVE_TIME, true);
StringUtilities.addValueToHeader(headers, "Proxy-Connection",
"keep-Alive", true);
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpAuthenticationMethods.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpAuthenticationMethods.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpAuthenticationMethods.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpAuthenticationMethods.java Mon Apr 27 11:25:15 2009
@@ -40,7 +40,7 @@
private final int id;
private HttpAuthenticationMethods(int id) {
- this.id = id;
+ this.id = id;
}
/**
@@ -48,7 +48,7 @@
* @return the id
*/
public int getId() {
- return id;
+ return id;
}
/**
@@ -58,8 +58,8 @@
* @return a new logic handler
*/
public AbstractAuthLogicHandler getNewHandler(ProxyIoSession proxyIoSession)
- throws ProxyAuthException {
- return getNewHandler(this.id, proxyIoSession);
+ throws ProxyAuthException {
+ return getNewHandler(this.id, proxyIoSession);
}
/**
@@ -70,21 +70,21 @@
* @return a new logic handler
*/
public static AbstractAuthLogicHandler getNewHandler(
- int method, ProxyIoSession proxyIoSession)
- throws ProxyAuthException {
-
- if (method == BASIC.id)
- return new HttpBasicAuthLogicHandler(proxyIoSession);
- else
- if (method == DIGEST.id)
- return new HttpDigestAuthLogicHandler(proxyIoSession);
- else
- if (method == NTLM.id)
- return new HttpNTLMAuthLogicHandler(proxyIoSession);
- else
- if (method == NO_AUTH.id)
- return new HttpNoAuthLogicHandler(proxyIoSession);
- else
- return null;
- }
+ int method, ProxyIoSession proxyIoSession)
+ throws ProxyAuthException {
+
+ if (method == BASIC.id)
+ return new HttpBasicAuthLogicHandler(proxyIoSession);
+ else
+ if (method == DIGEST.id)
+ return new HttpDigestAuthLogicHandler(proxyIoSession);
+ else
+ if (method == NTLM.id)
+ return new HttpNTLMAuthLogicHandler(proxyIoSession);
+ else
+ if (method == NO_AUTH.id)
+ return new HttpNoAuthLogicHandler(proxyIoSession);
+ else
+ return null;
+ }
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyConstants.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyConstants.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyConstants.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyConstants.java Mon Apr 27 11:25:15 2009
@@ -30,8 +30,8 @@
/**
* The HTTP CONNECT verb.
- */
- public final static String CONNECT = "CONNECT";
+ */
+ public final static String CONNECT = "CONNECT";
/**
* The HTTP GET verb.
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java Mon Apr 27 11:25:15 2009
@@ -104,13 +104,13 @@
*/
public HttpProxyRequest(final InetSocketAddress endpointAddress,
final String httpVersion, final Map<String, List<String>> headers) {
- this.httpVerb = HttpProxyConstants.CONNECT;
+ this.httpVerb = HttpProxyConstants.CONNECT;
if (!endpointAddress.isUnresolved()) {
- this.httpURI = endpointAddress.getHostName() + ":"
- + endpointAddress.getPort();
+ this.httpURI = endpointAddress.getHostName() + ":"
+ + endpointAddress.getPort();
} else {
- this.httpURI = endpointAddress.getAddress().getHostAddress() + ":"
- + endpointAddress.getPort();
+ this.httpURI = endpointAddress.getAddress().getHostAddress() + ":"
+ + endpointAddress.getPort();
}
this.httpVersion = httpVersion;
@@ -198,7 +198,7 @@
public synchronized final String getHost() {
if (host == null) {
if (getEndpointAddress() != null &&
- !getEndpointAddress().isUnresolved()) {
+ !getEndpointAddress().isUnresolved()) {
host = getEndpointAddress().getHostName();
}
@@ -254,15 +254,15 @@
* {@link ProxyAuthException}.
*/
public void checkRequiredProperties(String... propNames) throws ProxyAuthException {
- StringBuilder sb = new StringBuilder();
- for (String propertyName : propNames) {
- if (properties.get(propertyName) == null) {
- sb.append(propertyName).append(' ');
- }
- }
+ StringBuilder sb = new StringBuilder();
+ for (String propertyName : propNames) {
+ if (properties.get(propertyName) == null) {
+ sb.append(propertyName).append(' ');
+ }
+ }
if (sb.length() > 0) {
- sb.append("property(ies) missing in request");
- throw new ProxyAuthException(sb.toString());
+ sb.append("property(ies) missing in request");
+ throw new ProxyAuthException(sb.toString());
}
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyResponse.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyResponse.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyResponse.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyResponse.java Mon Apr 27 11:25:15 2009
@@ -30,9 +30,9 @@
* @since MINA 2.0.0-M3
*/
public class HttpProxyResponse {
- /**
- * The HTTP response protocol version.
- */
+ /**
+ * The HTTP response protocol version.
+ */
public final String httpVersion;
/**
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java Mon Apr 27 11:25:15 2009
@@ -69,7 +69,7 @@
authHandler.doHandshake(nextFilter);
} else {
if (requestSent) {
- // Safety check
+ // Safety check
throw new ProxyAuthException(
"Authentication request already sent");
}
@@ -99,96 +99,96 @@
* @param response the proxy response
*/
private void autoSelectAuthHandler(final HttpProxyResponse response)
- throws ProxyAuthException {
- // Get the Proxy-Authenticate header
- List<String> values = response.getHeaders().get("Proxy-Authenticate");
- ProxyIoSession proxyIoSession = getProxyIoSession();
-
- if (values == null || values.size() == 0) {
- authHandler = HttpAuthenticationMethods.NO_AUTH
- .getNewHandler(proxyIoSession);
-
- } else if (getProxyIoSession().getPreferedOrder() == null) {
- // No preference order set for auth mechanisms
- int method = -1;
-
- // Test which auth mechanism to use. First found is the first used
- // that's why we test in a decreasing security quality order.
- for (String proxyAuthHeader : values) {
- proxyAuthHeader = proxyAuthHeader.toLowerCase();
-
- if (proxyAuthHeader.contains("ntlm")) {
- method = HttpAuthenticationMethods.NTLM.getId();
- break;
- } else if (proxyAuthHeader.contains("digest")
- && method != HttpAuthenticationMethods.NTLM.getId()) {
- method = HttpAuthenticationMethods.DIGEST.getId();
- } else if (proxyAuthHeader.contains("basic") && method == -1) {
- method = HttpAuthenticationMethods.BASIC.getId();
- }
- }
-
- if (method != -1) {
- try {
- authHandler = HttpAuthenticationMethods.getNewHandler(
- method, proxyIoSession);
- } catch (Exception ex) {
- logger.debug("Following exception occured:", ex);
- }
- }
-
- if (authHandler == null) {
- authHandler = HttpAuthenticationMethods.NO_AUTH
- .getNewHandler(proxyIoSession);
- }
-
- } else {
- for (HttpAuthenticationMethods method : proxyIoSession
- .getPreferedOrder()) {
- if (authHandler != null) {
- break;
- }
-
- if (method == HttpAuthenticationMethods.NO_AUTH) {
- authHandler = HttpAuthenticationMethods.NO_AUTH
- .getNewHandler(proxyIoSession);
- break;
- }
-
- for (String proxyAuthHeader : values) {
- proxyAuthHeader = proxyAuthHeader.toLowerCase();
-
- try {
- // test which auth mechanism to use
- if (proxyAuthHeader.contains("basic")
- && method == HttpAuthenticationMethods.BASIC) {
- authHandler = HttpAuthenticationMethods.BASIC
- .getNewHandler(proxyIoSession);
- break;
- } else if (proxyAuthHeader.contains("digest")
- && method == HttpAuthenticationMethods.DIGEST) {
- authHandler = HttpAuthenticationMethods.DIGEST
- .getNewHandler(proxyIoSession);
- break;
- } else if (proxyAuthHeader.contains("ntlm")
- && method == HttpAuthenticationMethods.NTLM) {
- authHandler = HttpAuthenticationMethods.NTLM
- .getNewHandler(proxyIoSession);
- break;
- }
- } catch (Exception ex) {
- logger.debug("Following exception occured:", ex);
- }
- }
- }
-
- }
-
- if (authHandler == null) {
- throw new ProxyAuthException(
- "Unknown authentication mechanism(s): " + values);
- }
- }
+ throws ProxyAuthException {
+ // Get the Proxy-Authenticate header
+ List<String> values = response.getHeaders().get("Proxy-Authenticate");
+ ProxyIoSession proxyIoSession = getProxyIoSession();
+
+ if (values == null || values.size() == 0) {
+ authHandler = HttpAuthenticationMethods.NO_AUTH
+ .getNewHandler(proxyIoSession);
+
+ } else if (getProxyIoSession().getPreferedOrder() == null) {
+ // No preference order set for auth mechanisms
+ int method = -1;
+
+ // Test which auth mechanism to use. First found is the first used
+ // that's why we test in a decreasing security quality order.
+ for (String proxyAuthHeader : values) {
+ proxyAuthHeader = proxyAuthHeader.toLowerCase();
+
+ if (proxyAuthHeader.contains("ntlm")) {
+ method = HttpAuthenticationMethods.NTLM.getId();
+ break;
+ } else if (proxyAuthHeader.contains("digest")
+ && method != HttpAuthenticationMethods.NTLM.getId()) {
+ method = HttpAuthenticationMethods.DIGEST.getId();
+ } else if (proxyAuthHeader.contains("basic") && method == -1) {
+ method = HttpAuthenticationMethods.BASIC.getId();
+ }
+ }
+
+ if (method != -1) {
+ try {
+ authHandler = HttpAuthenticationMethods.getNewHandler(
+ method, proxyIoSession);
+ } catch (Exception ex) {
+ logger.debug("Following exception occured:", ex);
+ }
+ }
+
+ if (authHandler == null) {
+ authHandler = HttpAuthenticationMethods.NO_AUTH
+ .getNewHandler(proxyIoSession);
+ }
+
+ } else {
+ for (HttpAuthenticationMethods method : proxyIoSession
+ .getPreferedOrder()) {
+ if (authHandler != null) {
+ break;
+ }
+
+ if (method == HttpAuthenticationMethods.NO_AUTH) {
+ authHandler = HttpAuthenticationMethods.NO_AUTH
+ .getNewHandler(proxyIoSession);
+ break;
+ }
+
+ for (String proxyAuthHeader : values) {
+ proxyAuthHeader = proxyAuthHeader.toLowerCase();
+
+ try {
+ // test which auth mechanism to use
+ if (proxyAuthHeader.contains("basic")
+ && method == HttpAuthenticationMethods.BASIC) {
+ authHandler = HttpAuthenticationMethods.BASIC
+ .getNewHandler(proxyIoSession);
+ break;
+ } else if (proxyAuthHeader.contains("digest")
+ && method == HttpAuthenticationMethods.DIGEST) {
+ authHandler = HttpAuthenticationMethods.DIGEST
+ .getNewHandler(proxyIoSession);
+ break;
+ } else if (proxyAuthHeader.contains("ntlm")
+ && method == HttpAuthenticationMethods.NTLM) {
+ authHandler = HttpAuthenticationMethods.NTLM
+ .getNewHandler(proxyIoSession);
+ break;
+ }
+ } catch (Exception ex) {
+ logger.debug("Following exception occured:", ex);
+ }
+ }
+ }
+
+ }
+
+ if (authHandler == null) {
+ throw new ProxyAuthException(
+ "Unknown authentication mechanism(s): " + values);
+ }
+ }
/**
* Handle a HTTP response from the proxy server.
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/basic/HttpBasicAuthLogicHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/basic/HttpBasicAuthLogicHandler.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/basic/HttpBasicAuthLogicHandler.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/basic/HttpBasicAuthLogicHandler.java Mon Apr 27 11:25:15 2009
@@ -54,8 +54,8 @@
super(proxyIoSession);
((HttpProxyRequest) request).checkRequiredProperties(
- HttpProxyConstants.USER_PROPERTY,
- HttpProxyConstants.PWD_PROPERTY);
+ HttpProxyConstants.USER_PROPERTY,
+ HttpProxyConstants.PWD_PROPERTY);
}
/**
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/digest/HttpDigestAuthLogicHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/digest/HttpDigestAuthLogicHandler.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/digest/HttpDigestAuthLogicHandler.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/digest/HttpDigestAuthLogicHandler.java Mon Apr 27 11:25:15 2009
@@ -78,8 +78,8 @@
super(proxyIoSession);
((HttpProxyRequest) request).checkRequiredProperties(
- HttpProxyConstants.USER_PROPERTY,
- HttpProxyConstants.PWD_PROPERTY);
+ HttpProxyConstants.USER_PROPERTY,
+ HttpProxyConstants.PWD_PROPERTY);
}
@Override
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/HttpNTLMAuthLogicHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/HttpNTLMAuthLogicHandler.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/HttpNTLMAuthLogicHandler.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/HttpNTLMAuthLogicHandler.java Mon Apr 27 11:25:15 2009
@@ -61,10 +61,10 @@
super(proxyIoSession);
((HttpProxyRequest) request).checkRequiredProperties(
- HttpProxyConstants.USER_PROPERTY,
- HttpProxyConstants.PWD_PROPERTY,
- HttpProxyConstants.DOMAIN_PROPERTY,
- HttpProxyConstants.WORKSTATION_PROPERTY);
+ HttpProxyConstants.USER_PROPERTY,
+ HttpProxyConstants.PWD_PROPERTY,
+ HttpProxyConstants.DOMAIN_PROPERTY,
+ HttpProxyConstants.WORKSTATION_PROPERTY);
}
/**
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java Mon Apr 27 11:25:15 2009
@@ -115,7 +115,7 @@
String line;
do {
- line = reader.readLine();
+ line = reader.readLine();
} while ((line != null) && (line.length() != 0));
reader.close();
@@ -269,7 +269,7 @@
* @return a new byte array holding the data pointed by the security buffer
*/
public final static byte[] readSecurityBufferTarget(
- byte[] msg, int securityBufferOffset) {
+ byte[] msg, int securityBufferOffset) {
byte[] securityBuffer = new byte[8];
System.arraycopy(msg, securityBufferOffset, securityBuffer, 0, 8);
@@ -355,21 +355,21 @@
while (infoBlock[pos] != 0) {
out.print("---\nType " + infoBlock[pos] + ": ");
switch (infoBlock[pos]) {
- case 1:
- out.println("Server name");
- break;
- case 2:
- out.println("Domain name");
- break;
- case 3:
- out.println("Fully qualified DNS hostname");
- break;
- case 4:
- out.println("DNS domain name");
- break;
- case 5:
- out.println("Parent DNS domain name");
- break;
+ case 1:
+ out.println("Server name");
+ break;
+ case 2:
+ out.println("Domain name");
+ break;
+ case 3:
+ out.println("Fully qualified DNS hostname");
+ break;
+ case 4:
+ out.println("DNS domain name");
+ break;
+ case 5:
+ out.println("Parent DNS domain name");
+ break;
}
byte[] len = new byte[2];
System.arraycopy(infoBlock, pos + 2, len, 0, 2);
@@ -419,8 +419,8 @@
//TOSEE breaks tests
/*int flags = serverFlags != null ? serverFlags |
- FLAG_NEGOTIATE_WORKSTATION_SUPPLIED |
- FLAG_NEGOTIATE_DOMAIN_SUPPLIED : DEFAULT_FLAGS;*/
+ FLAG_NEGOTIATE_WORKSTATION_SUPPLIED |
+ FLAG_NEGOTIATE_DOMAIN_SUPPLIED : DEFAULT_FLAGS;*/
int flags = serverFlags != null ? serverFlags : DEFAULT_FLAGS;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -475,7 +475,7 @@
baos.write(osVersion);
}
//else
- // baos.write(DEFAULT_OS_VERSION);
+ // baos.write(DEFAULT_OS_VERSION);
// Order is not mandatory since a pointer is given in the security buffers
baos.write(targetName);
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java Mon Apr 27 11:25:15 2009
@@ -139,15 +139,15 @@
}
} else {
host = request.getHost() != null ?
- request.getHost().getBytes("ASCII") : null;
+ request.getHost().getBytes("ASCII") : null;
- if (host != null) {
- len += 1 + host.length;
- addressType = SocksProxyConstants.DOMAIN_NAME_ADDRESS_TYPE;
- } else {
- throw new IllegalArgumentException("SocksProxyRequest object " +
- "has no suitable endpoint information");
- }
+ if (host != null) {
+ len += 1 + host.length;
+ addressType = SocksProxyConstants.DOMAIN_NAME_ADDRESS_TYPE;
+ } else {
+ throw new IllegalArgumentException("SocksProxyRequest object " +
+ "has no suitable endpoint information");
+ }
}
IoBuffer buf = IoBuffer.allocate(len);
@@ -158,9 +158,9 @@
buf.put(addressType);
if (host == null) {
- buf.put(request.getIpAddress());
+ buf.put(request.getIpAddress());
} else {
- buf.put((byte) host.length);
+ buf.put((byte) host.length);
buf.put(host);
}
@@ -185,29 +185,29 @@
Socks5LogicHandler.SELECTED_AUTH_METHOD)).byteValue();
switch (method) {
- case SocksProxyConstants.NO_AUTH:
- // In this case authentication is immediately considered as successfull
- // Next writeRequest() call will send the proxy request
- getSession().setAttribute(HANDSHAKE_STEP,
- SocksProxyConstants.SOCKS5_REQUEST_STEP);
- break;
-
- case SocksProxyConstants.GSSAPI_AUTH:
- return encodeGSSAPIAuthenticationPacket(request);
-
- case SocksProxyConstants.BASIC_AUTH:
- // The basic auth scheme packet is sent
- byte[] user = request.getUserName().getBytes("ASCII");
- byte[] pwd = request.getPassword().getBytes("ASCII");
- IoBuffer buf = IoBuffer.allocate(3 + user.length + pwd.length);
-
- buf.put(SocksProxyConstants.BASIC_AUTH_SUBNEGOTIATION_VERSION);
- buf.put((byte) user.length);
- buf.put(user);
- buf.put((byte) pwd.length);
- buf.put(pwd);
-
- return buf;
+ case SocksProxyConstants.NO_AUTH:
+ // In this case authentication is immediately considered as successfull
+ // Next writeRequest() call will send the proxy request
+ getSession().setAttribute(HANDSHAKE_STEP,
+ SocksProxyConstants.SOCKS5_REQUEST_STEP);
+ break;
+
+ case SocksProxyConstants.GSSAPI_AUTH:
+ return encodeGSSAPIAuthenticationPacket(request);
+
+ case SocksProxyConstants.BASIC_AUTH:
+ // The basic auth scheme packet is sent
+ byte[] user = request.getUserName().getBytes("ASCII");
+ byte[] pwd = request.getPassword().getBytes("ASCII");
+ IoBuffer buf = IoBuffer.allocate(3 + user.length + pwd.length);
+
+ buf.put(SocksProxyConstants.BASIC_AUTH_SUBNEGOTIATION_VERSION);
+ buf.put((byte) user.length);
+ buf.put(user);
+ buf.put((byte) pwd.length);
+ buf.put(pwd);
+
+ return buf;
}
return null;
@@ -224,7 +224,7 @@
final SocksProxyRequest request) throws GSSException {
GSSContext ctx = (GSSContext) getSession().getAttribute(GSS_CONTEXT);
if (ctx == null) {
- // first step in the authentication process
+ // first step in the authentication process
GSSManager manager = GSSManager.getInstance();
GSSName serverName = manager.createName(request
.getServiceKerberosName(), null);
@@ -342,7 +342,7 @@
}
if ((step == SocksProxyConstants.SOCKS5_GREETING_STEP ||
- step == SocksProxyConstants.SOCKS5_AUTH_STEP)
+ step == SocksProxyConstants.SOCKS5_AUTH_STEP)
&& buf.remaining() >= 2) {
handleResponse(nextFilter, buf, step);
} else if (step == SocksProxyConstants.SOCKS5_REQUEST_STEP
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java Mon Apr 27 11:25:15 2009
@@ -163,7 +163,8 @@
*/
public synchronized final String getHost() {
if (host == null) {
- InetSocketAddress adr = getEndpointAddress();
+ InetSocketAddress adr = getEndpointAddress();
+
if ( adr != null && !adr.isUnresolved()) {
host = getEndpointAddress().getHostName();
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java Mon Apr 27 11:25:15 2009
@@ -30,15 +30,15 @@
*/
public class ByteUtilities {
- /**
+ /**
* Returns the integer represented by up to 4 bytes in network byte order.
*
- * @param buf the buffer to read the bytes from
- * @param start
- * @param count
- * @return
- */
- public static int networkByteOrderToInt(byte[] buf, int start, int count) {
+ * @param buf the buffer to read the bytes from
+ * @param start
+ * @param count
+ * @return
+ */
+ public static int networkByteOrderToInt(byte[] buf, int start, int count) {
if (count > 4) {
throw new IllegalArgumentException(
"Cannot handle more than 4 bytes");
@@ -54,31 +54,31 @@
return result;
}
- /**
+ /**
* Encodes an integer into up to 4 bytes in network byte order.
*
- * @param num the int to convert to a byte array
- * @param count the number of reserved bytes for the write operation
- * @return the resulting byte array
- */
- public static byte[] intToNetworkByteOrder(int num, int count) {
- byte[] buf = new byte[count];
- intToNetworkByteOrder(num, buf, 0, count);
-
- return buf;
- }
-
- /**
+ * @param num the int to convert to a byte array
+ * @param count the number of reserved bytes for the write operation
+ * @return the resulting byte array
+ */
+ public static byte[] intToNetworkByteOrder(int num, int count) {
+ byte[] buf = new byte[count];
+ intToNetworkByteOrder(num, buf, 0, count);
+
+ return buf;
+ }
+
+ /**
* Encodes an integer into up to 4 bytes in network byte order in the
* supplied buffer starting at <code>start</code> offset and writing
* <code>count</code> bytes.
*
- * @param num the int to convert to a byte array
- * @param buf the buffer to write the bytes to
- * @param start the offset from beginning for the write operation
- * @param count the number of reserved bytes for the write operation
- */
- public static void intToNetworkByteOrder(int num, byte[] buf, int start,
+ * @param num the int to convert to a byte array
+ * @param buf the buffer to write the bytes to
+ * @param start the offset from beginning for the write operation
+ * @param count the number of reserved bytes for the write operation
+ */
+ public static void intToNetworkByteOrder(int num, byte[] buf, int start,
int count) {
if (count > 4) {
throw new IllegalArgumentException(
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/IoBufferDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/IoBufferDecoder.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/IoBufferDecoder.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/IoBufferDecoder.java Mon Apr 27 11:25:15 2009
@@ -35,14 +35,14 @@
*/
public class IoBufferDecoder {
- /**
- * The class holding the decoding context.
- */
+ /**
+ * The class holding the decoding context.
+ */
public class DecodingContext {
- /**
- * The buffered data.
- */
+ /**
+ * The buffered data.
+ */
private IoBuffer decodedBuffer;
/**
Modified: mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java Mon Apr 27 11:25:15 2009
@@ -38,19 +38,19 @@
*/
public class StringUtilities {
- /**
+ /**
* A directive is a parameter of the digest authentication process.
* Returns the value of a directive from the map. If mandatory is true and the
* value is null, then it throws an {@link AuthenticationException}.
*
- * @param directivesMap the directive's map
- * @param directive the name of the directive we want to retrieve
- * @param mandatory is the directive mandatory
- * @return the mandatory value as a String
- * @throws AuthenticationException if mandatory is true and if
- * directivesMap.get(directive) == null
- */
- public static String getDirectiveValue(
+ * @param directivesMap the directive's map
+ * @param directive the name of the directive we want to retrieve
+ * @param mandatory is the directive mandatory
+ * @return the mandatory value as a String
+ * @throws AuthenticationException if mandatory is true and if
+ * directivesMap.get(directive) == null
+ */
+ public static String getDirectiveValue(
HashMap<String, String> directivesMap, String directive,
boolean mandatory) throws AuthenticationException {
String value = directivesMap.get(directive);
@@ -66,14 +66,14 @@
return value;
}
- /**
+ /**
* Copy the directive to the {@link StringBuilder} if not null.
* (A directive is a parameter of the digest authentication process.)
*
- * @param directives the directives map
- * @param sb the output buffer
- * @param directive the directive name to look for
- */
+ * @param directives the directives map
+ * @param sb the output buffer
+ * @param directive the directive name to look for
+ */
public static void copyDirective(HashMap<String, String> directives,
StringBuilder sb, String directive) {
String directiveValue = directives.get(directive);
Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramConnector.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramConnector.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramConnector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramConnector.java Mon Apr 27 11:25:15 2009
@@ -76,9 +76,9 @@
* @since 2.0.0-M4
*/
public NioDatagramConnector(Class<? extends IoProcessor<NioSession>> processorClass,
- int processorCount) {
- super(new DefaultDatagramSessionConfig(), processorClass, processorCount);
- }
+ int processorCount) {
+ super(new DefaultDatagramSessionConfig(), processorClass, processorCount);
+ }
/**
* Constructor for {@link NioDatagramConnector} with default configuration with default configuration which will use a built-in
@@ -92,11 +92,11 @@
* @see org.apache.mina.core.service.SimpleIoProcessorPool#DEFAULT_SIZE
* @since 2.0.0-M4
*/
- public NioDatagramConnector(Class<? extends IoProcessor<NioSession>> processorClass) {
- super(new DefaultDatagramSessionConfig(), processorClass);
- }
+ public NioDatagramConnector(Class<? extends IoProcessor<NioSession>> processorClass) {
+ super(new DefaultDatagramSessionConfig(), processorClass);
+ }
- public TransportMetadata getTransportMetadata() {
+ public TransportMetadata getTransportMetadata() {
return NioDatagramSession.METADATA;
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java Mon Apr 27 11:25:15 2009
@@ -224,7 +224,7 @@
* @param keys
*/
private IoSessionIterator(Set<SelectionKey> keys) {
- iterator = keys.iterator();
+ iterator = keys.iterator();
}
/**
@@ -247,7 +247,7 @@
* {@inheritDoc}
*/
public void remove() {
- iterator.remove();
+ iterator.remove();
}
}
}
\ No newline at end of file
Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java Mon Apr 27 11:25:15 2009
@@ -103,9 +103,9 @@
* @since 2.0.0-M4
*/
public NioSocketConnector(Class<? extends IoProcessor<NioSession>> processorClass,
- int processorCount) {
- super(new DefaultSocketSessionConfig(), processorClass, processorCount);
- }
+ int processorCount) {
+ super(new DefaultSocketSessionConfig(), processorClass, processorCount);
+ }
/**
* Constructor for {@link NioSocketConnector} with default configuration with default configuration which will use a built-in
@@ -119,11 +119,11 @@
* @see org.apache.mina.core.service.SimpleIoProcessorPool#DEFAULT_SIZE
* @since 2.0.0-M4
*/
- public NioSocketConnector(Class<? extends IoProcessor<NioSession>> processorClass) {
- super(new DefaultSocketSessionConfig(), processorClass);
- }
+ public NioSocketConnector(Class<? extends IoProcessor<NioSession>> processorClass) {
+ super(new DefaultSocketSessionConfig(), processorClass);
+ }
- /**
+ /**
* {@inheritDoc}
*/
@Override
Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java Mon Apr 27 11:25:15 2009
@@ -46,9 +46,9 @@
*/
public final class VmPipeConnector extends AbstractIoConnector {
- // object used for checking session idle
- private IdleStatusChecker idleChecker;
-
+ // object used for checking session idle
+ private IdleStatusChecker idleChecker;
+
/**
* Creates a new instance.
*/
@@ -143,8 +143,8 @@
@Override
protected IoFuture dispose0() throws Exception {
- // stop the idle checking task
- idleChecker.getNotifyingTask().cancel();
+ // stop the idle checking task
+ idleChecker.getNotifyingTask().cancel();
return null;
}
Modified: mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv4Test.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv4Test.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv4Test.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv4Test.java Mon Apr 27 11:25:15 2009
@@ -33,72 +33,72 @@
*/
public class SubnetIPv4Test extends TestCase {
- public void test24() throws UnknownHostException {
- InetAddress a = InetAddress.getByName("127.2.3.0");
- InetAddress b = InetAddress.getByName("127.2.3.4");
- InetAddress c = InetAddress.getByName("127.2.3.255");
- InetAddress d = InetAddress.getByName("127.2.4.4");
-
- Subnet mask = new Subnet(a, 24);
-
- assertTrue(mask.inSubnet(a));
- assertTrue(mask.inSubnet(b));
- assertTrue(mask.inSubnet(c));
- assertFalse(mask.inSubnet(d));
- }
+ public void test24() throws UnknownHostException {
+ InetAddress a = InetAddress.getByName("127.2.3.0");
+ InetAddress b = InetAddress.getByName("127.2.3.4");
+ InetAddress c = InetAddress.getByName("127.2.3.255");
+ InetAddress d = InetAddress.getByName("127.2.4.4");
+
+ Subnet mask = new Subnet(a, 24);
+
+ assertTrue(mask.inSubnet(a));
+ assertTrue(mask.inSubnet(b));
+ assertTrue(mask.inSubnet(c));
+ assertFalse(mask.inSubnet(d));
+ }
- public void test16() throws UnknownHostException {
- InetAddress a = InetAddress.getByName("127.2.0.0");
- InetAddress b = InetAddress.getByName("127.2.3.4");
- InetAddress c = InetAddress.getByName("127.2.129.255");
- InetAddress d = InetAddress.getByName("127.3.4.4");
-
- Subnet mask = new Subnet(a, 16);
-
- assertTrue(mask.inSubnet(a));
- assertTrue(mask.inSubnet(b));
- assertTrue(mask.inSubnet(c));
- assertFalse(mask.inSubnet(d));
- }
-
- public void testSingleIp() throws UnknownHostException {
- InetAddress a = InetAddress.getByName("127.2.3.4");
- InetAddress b = InetAddress.getByName("127.2.3.3");
- InetAddress c = InetAddress.getByName("127.2.3.255");
- InetAddress d = InetAddress.getByName("127.2.3.0");
-
- Subnet mask = new Subnet(a, 32);
-
- assertTrue(mask.inSubnet(a));
- assertFalse(mask.inSubnet(b));
- assertFalse(mask.inSubnet(c));
- assertFalse(mask.inSubnet(d));
- }
-
- public void testToString() throws UnknownHostException {
- InetAddress a = InetAddress.getByName("127.2.3.0");
- Subnet mask = new Subnet(a, 24);
-
- assertEquals("127.2.3.0/24", mask.toString());
- }
+ public void test16() throws UnknownHostException {
+ InetAddress a = InetAddress.getByName("127.2.0.0");
+ InetAddress b = InetAddress.getByName("127.2.3.4");
+ InetAddress c = InetAddress.getByName("127.2.129.255");
+ InetAddress d = InetAddress.getByName("127.3.4.4");
+
+ Subnet mask = new Subnet(a, 16);
+
+ assertTrue(mask.inSubnet(a));
+ assertTrue(mask.inSubnet(b));
+ assertTrue(mask.inSubnet(c));
+ assertFalse(mask.inSubnet(d));
+ }
+
+ public void testSingleIp() throws UnknownHostException {
+ InetAddress a = InetAddress.getByName("127.2.3.4");
+ InetAddress b = InetAddress.getByName("127.2.3.3");
+ InetAddress c = InetAddress.getByName("127.2.3.255");
+ InetAddress d = InetAddress.getByName("127.2.3.0");
+
+ Subnet mask = new Subnet(a, 32);
+
+ assertTrue(mask.inSubnet(a));
+ assertFalse(mask.inSubnet(b));
+ assertFalse(mask.inSubnet(c));
+ assertFalse(mask.inSubnet(d));
+ }
+
+ public void testToString() throws UnknownHostException {
+ InetAddress a = InetAddress.getByName("127.2.3.0");
+ Subnet mask = new Subnet(a, 24);
+
+ assertEquals("127.2.3.0/24", mask.toString());
+ }
- public void testToStringLiteral() throws UnknownHostException {
- InetAddress a = InetAddress.getByName("localhost");
- Subnet mask = new Subnet(a, 32);
-
- assertEquals("127.0.0.1/32", mask.toString());
- }
-
-
- public void testEquals() throws UnknownHostException {
- Subnet a = new Subnet(InetAddress.getByName("127.2.3.4"), 32);
- Subnet b = new Subnet(InetAddress.getByName("127.2.3.4"), 32);
- Subnet c = new Subnet(InetAddress.getByName("127.2.3.5"), 32);
- Subnet d = new Subnet(InetAddress.getByName("127.2.3.5"), 24);
-
- assertTrue(a.equals(b));
- assertFalse(a.equals(c));
- assertFalse(a.equals(d));
- assertFalse(a.equals(null));
- }
+ public void testToStringLiteral() throws UnknownHostException {
+ InetAddress a = InetAddress.getByName("localhost");
+ Subnet mask = new Subnet(a, 32);
+
+ assertEquals("127.0.0.1/32", mask.toString());
+ }
+
+
+ public void testEquals() throws UnknownHostException {
+ Subnet a = new Subnet(InetAddress.getByName("127.2.3.4"), 32);
+ Subnet b = new Subnet(InetAddress.getByName("127.2.3.4"), 32);
+ Subnet c = new Subnet(InetAddress.getByName("127.2.3.5"), 32);
+ Subnet d = new Subnet(InetAddress.getByName("127.2.3.5"), 24);
+
+ assertTrue(a.equals(b));
+ assertFalse(a.equals(c));
+ assertFalse(a.equals(d));
+ assertFalse(a.equals(null));
+ }
}
Modified: mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv6Test.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv6Test.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv6Test.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/filter/firewall/SubnetIPv6Test.java Mon Apr 27 11:25:15 2009
@@ -38,16 +38,16 @@
// Test Data
private static final String TEST_V6ADDRESS = "1080:0:0:0:8:800:200C:417A";
- public void testIPv6() throws UnknownHostException {
- InetAddress a = InetAddress.getByName(TEST_V6ADDRESS);
-
- assertTrue(a instanceof Inet6Address);
- try {
- new Subnet(a, 24);
- fail("IPv6 not supported");
- } catch(IllegalArgumentException e) {
- // signifies a successful test execution
+ public void testIPv6() throws UnknownHostException {
+ InetAddress a = InetAddress.getByName(TEST_V6ADDRESS);
+
+ assertTrue(a instanceof Inet6Address);
+ try {
+ new Subnet(a, 24);
+ fail("IPv6 not supported");
+ } catch(IllegalArgumentException e) {
+ // signifies a successful test execution
Assert.assertTrue(true);
- }
- }
+ }
+ }
}
Modified: mina/trunk/core/src/test/java/org/apache/mina/proxy/NTLMTest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/proxy/NTLMTest.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/proxy/NTLMTest.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/proxy/NTLMTest.java Mon Apr 27 11:25:15 2009
@@ -117,8 +117,8 @@
if (os != null && os.toUpperCase().contains("WINDOWS") &&
"5.1".equals(System.getProperty("os.version"))) {
String hex = asHex(NTLMUtilities.getOsVersion());
- assertEquals("0501", hex.substring(0, 4));
- assertEquals(16, hex.length());
+ assertEquals("0501", hex.substring(0, 4));
+ assertEquals(16, hex.length());
}
}
Modified: mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramRecyclerTest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramRecyclerTest.java?rev=768927&r1=768926&r2=768927&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramRecyclerTest.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramRecyclerTest.java Mon Apr 27 11:25:15 2009
@@ -86,7 +86,7 @@
// This doesn't mean that the acceptor-side connection is also closed.
// The life cycle of the acceptor-side connection is managed by the recycler.
future.getSession().close(true);
- future.getSession().getCloseFuture().awaitUninterruptibly();
+ future.getSession().getCloseFuture().awaitUninterruptibly();
Assert.assertTrue(future.getSession().getCloseFuture().isClosed());
// Wait until the acceptor-side connection is closed.