Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change handle to byte[]. Fix interoperability issue with Tectia SSH Serv... #150

Merged
merged 1 commit into from
Sep 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/schmizz/sshj/sftp/RemoteDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public class RemoteDirectory
extends RemoteResource {

public RemoteDirectory(Requester requester, String path, String handle) {
public RemoteDirectory(Requester requester, String path, byte[] handle) {
super(requester, path, handle);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/schmizz/sshj/sftp/RemoteFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class RemoteFile
extends RemoteResource {

public RemoteFile(Requester requester, String path, String handle) {
public RemoteFile(Requester requester, String path, byte[] handle) {
super(requester, path, handle);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ public int getOutgoingPacketOverhead() {
return 1 + // packet type
4 + // request id
4 + // next length
handle.length() + // next
handle.length + // next
8 + // file offset
4 + // data length
4; // packet length
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/schmizz/sshj/sftp/RemoteResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public abstract class RemoteResource

protected final Requester requester;
protected final String path;
protected final String handle;
protected final byte[] handle;

protected RemoteResource(Requester requester, String path, String handle) {
protected RemoteResource(Requester requester, String path, byte[] handle) {
this.requester = requester;
this.path = path;
this.handle = handle;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/schmizz/sshj/sftp/SFTPEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ private Response doRequest(Request req)

public RemoteFile open(String path, Set<OpenMode> modes, FileAttributes fa)
throws IOException {
final String handle = doRequest(
final byte[] handle = doRequest(
newRequest(PacketType.OPEN).putString(path).putUInt32(OpenMode.toMask(modes)).putFileAttributes(fa)
).ensurePacketTypeIs(PacketType.HANDLE).readString();
).ensurePacketTypeIs(PacketType.HANDLE).readBytes();
return new RemoteFile(this, path, handle);
}

Expand All @@ -150,9 +150,9 @@ public RemoteFile open(String filename)

public RemoteDirectory openDir(String path)
throws IOException {
final String handle = doRequest(
final byte[] handle = doRequest(
newRequest(PacketType.OPENDIR).putString(path)
).ensurePacketTypeIs(PacketType.HANDLE).readString();
).ensurePacketTypeIs(PacketType.HANDLE).readBytes();
return new RemoteDirectory(this, path, handle);
}

Expand Down