Skip to content

Commit

Permalink
Merge pull request #150 from dkocher/master
Browse files Browse the repository at this point in the history
Change handle to byte[]. Fix interoperability issue with Tectia SSH Serv...
  • Loading branch information
shikhar committed Sep 18, 2014
2 parents ef5a54d + d37b54b commit af0d873
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
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

0 comments on commit af0d873

Please sign in to comment.