license headers and other minor cleanups

This commit is contained in:
Shikhar Bhushan
2010-03-06 01:19:43 +01:00
parent b41920843c
commit 95ea040768
22 changed files with 13 additions and 250 deletions

View File

@@ -40,8 +40,8 @@ import net.schmizz.concurrent.ExceptionChainer;
import java.io.IOException; import java.io.IOException;
/** /**
* Most exceptions in {@code org.apache.commons.net.ssh} are instances of this class. An {@link SSHException} is itself * Most exceptions in the {@code net.schmizz.sshj} package are instances of this class. An {@link SSHException} is
* an {@link IOException} and can be caught like that if this level of granularity is not desired. * itself an {@link IOException} and can be caught like that if this level of granularity is not desired.
*/ */
public class SSHException public class SSHException
extends IOException { extends IOException {
@@ -59,10 +59,6 @@ public class SSHException
private final DisconnectReason reason; private final DisconnectReason reason;
public SSHException() {
this(DisconnectReason.UNKNOWN, null, null);
}
public SSHException(DisconnectReason code) { public SSHException(DisconnectReason code) {
this(code, null, null); this(code, null, null);
} }
@@ -94,10 +90,6 @@ public class SSHException
this(DisconnectReason.UNKNOWN, null, cause); this(DisconnectReason.UNKNOWN, null, cause);
} }
public int getDisconnectCode() {
return reason.toInt();
}
public DisconnectReason getDisconnectReason() { public DisconnectReason getDisconnectReason() {
return reason; return reason;
} }
@@ -117,7 +109,7 @@ public class SSHException
final String cls = getClass().getName(); final String cls = getClass().getName();
final String code = reason != DisconnectReason.UNKNOWN ? "[" + reason + "] " : ""; final String code = reason != DisconnectReason.UNKNOWN ? "[" + reason + "] " : "";
final String msg = getMessage() != null ? getMessage() : ""; final String msg = getMessage() != null ? getMessage() : "";
return cls + (code.equals("") && msg.equals("") ? "" : ": ") + code + msg; return cls + (code.isEmpty() && msg.isEmpty() ? "" : ": ") + code + msg;
} }
} }

View File

@@ -32,10 +32,6 @@ public class ConnectionException
} }
}; };
public ConnectionException() {
super();
}
public ConnectionException(DisconnectReason code) { public ConnectionException(DisconnectReason code) {
super(code); super(code);
} }

View File

@@ -102,9 +102,9 @@ public abstract class AbstractChannel
private volatile boolean autoExpand = false; private volatile boolean autoExpand = false;
protected AbstractChannel(String type, Connection conn) { protected AbstractChannel(Connection conn, String type) {
this.type = type;
this.conn = conn; this.conn = conn;
this.type = type;
this.trans = conn.getTransport(); this.trans = conn.getTransport();
id = conn.nextID(); id = conn.nextID();

View File

@@ -51,8 +51,8 @@ public abstract class AbstractDirectChannel
extends AbstractChannel extends AbstractChannel
implements Channel.Direct { implements Channel.Direct {
protected AbstractDirectChannel(String name, Connection conn) { protected AbstractDirectChannel(Connection conn, String type) {
super(name, conn); super(conn, type);
/* /*
* We expect to receive channel open confirmation/rejection and want to be able to next this packet. * We expect to receive channel open confirmation/rejection and want to be able to next this packet.

View File

@@ -37,7 +37,7 @@ public class LocalPortForwarder {
private final Socket sock; private final Socket sock;
private DirectTCPIPChannel(Connection conn, Socket sock) { private DirectTCPIPChannel(Connection conn, Socket sock) {
super("direct-tcpip", conn); super(conn, "direct-tcpip");
this.sock = sock; this.sock = sock;
} }

View File

@@ -67,7 +67,7 @@ public class
private ChannelInputStream err = new ChannelInputStream(this, trans, lwin); private ChannelInputStream err = new ChannelInputStream(this, trans, lwin);
public SessionChannel(Connection conn) { public SessionChannel(Connection conn) {
super("session", conn); super(conn, "session");
} }
public void allocateDefaultPTY() public void allocateDefaultPTY()

View File

@@ -54,9 +54,9 @@ public abstract class AbstractForwardedChannel
* First 2 args are standard; the others can be parsed from a CHANNEL_OPEN packet. * First 2 args are standard; the others can be parsed from a CHANNEL_OPEN packet.
*/ */
protected AbstractForwardedChannel(String type, Connection conn, int recipient, int remoteWinSize, protected AbstractForwardedChannel(Connection conn, String type, int recipient, int remoteWinSize,
int remoteMaxPacketSize, String origIP, int origPort) { int remoteMaxPacketSize, String origIP, int origPort) {
super(type, conn); super(conn, type);
this.origIP = origIP; this.origIP = origIP;
this.origPort = origPort; this.origPort = origPort;
init(recipient, remoteWinSize, remoteMaxPacketSize); init(recipient, remoteWinSize, remoteMaxPacketSize);

View File

@@ -130,7 +130,7 @@ public class RemotePortForwarder
public ForwardedTCPIPChannel(Connection conn, int recipient, int remoteWinSize, int remoteMaxPacketSize, public ForwardedTCPIPChannel(Connection conn, int recipient, int remoteWinSize, int remoteMaxPacketSize,
Forward fwd, String origIP, int origPort) Forward fwd, String origIP, int origPort)
throws TransportException { throws TransportException {
super(TYPE, conn, recipient, remoteWinSize, remoteMaxPacketSize, origIP, origPort); super(conn, TYPE, recipient, remoteWinSize, remoteMaxPacketSize, origIP, origPort);
this.fwd = fwd; this.fwd = fwd;
} }

View File

@@ -35,7 +35,7 @@ public class X11Forwarder
public X11Channel(Connection conn, int recipient, int remoteWinSize, int remoteMaxPacketSize, String origIP, public X11Channel(Connection conn, int recipient, int remoteWinSize, int remoteMaxPacketSize, String origIP,
int origPort) { int origPort) {
super(TYPE, conn, recipient, remoteWinSize, remoteMaxPacketSize, origIP, origPort); super(conn, TYPE, recipient, remoteWinSize, remoteMaxPacketSize, origIP, origPort);
} }
} }

View File

@@ -34,10 +34,6 @@ public class SFTPException
}; };
public SFTPException() {
super();
}
public SFTPException(DisconnectReason code) { public SFTPException(DisconnectReason code) {
super(code); super(code);
} }

View File

@@ -53,10 +53,6 @@ public class TransportException
} }
}; };
public TransportException() {
super();
}
public TransportException(DisconnectReason code) { public TransportException(DisconnectReason code) {
super(code); super(code);
} }

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth; package net.schmizz.sshj.userauth;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth; package net.schmizz.sshj.userauth;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth; package net.schmizz.sshj.userauth;
@@ -54,10 +34,6 @@ public class UserAuthException
}; };
public UserAuthException() {
super();
}
public UserAuthException(DisconnectReason code) { public UserAuthException(DisconnectReason code) {
super(code); super(code);
} }

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth.method; package net.schmizz.sshj.userauth.method;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth.method; package net.schmizz.sshj.userauth.method;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth.method; package net.schmizz.sshj.userauth.method;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth.method; package net.schmizz.sshj.userauth.method;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth.method; package net.schmizz.sshj.userauth.method;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth.method; package net.schmizz.sshj.userauth.method;

View File

@@ -12,26 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* This file may incorporate work covered by the following copyright and
* permission notice:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
package net.schmizz.sshj.userauth.method; package net.schmizz.sshj.userauth.method;

View File

@@ -16,7 +16,6 @@
package net.schmizz.sshj.userauth.password; package net.schmizz.sshj.userauth.password;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map;
/** Static utility method and factories */ /** Static utility method and factories */
public class PasswordUtils { public class PasswordUtils {
@@ -53,16 +52,4 @@ public class PasswordUtils {
}; };
} }
public static PasswordFinder createResourceBased(final Map<Resource<?>, String> passwordMap) {
return new PasswordFinder() {
public char[] reqPassword(Resource<?> resource) {
return passwordMap.get(resource).toCharArray();
}
public boolean shouldRetry(Resource<?> resource) {
return false;
}
};
}
} }