use of org.springframework.core.NestedIOException in project spring-integration by spring-projects.
the class WhiteListDeserializingConverter method deserialize.
protected Object deserialize(ByteArrayInputStream inputStream) throws IOException {
try {
ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.defaultDeserializerClassLoader) {
@Override
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
Class<?> clazz = super.resolveClass(classDesc);
checkWhiteList(clazz);
return clazz;
}
};
return objectInputStream.readObject();
} catch (ClassNotFoundException ex) {
throw new NestedIOException("Failed to deserialize object type", ex);
}
}
use of org.springframework.core.NestedIOException in project spring-integration by spring-projects.
the class SftpSession method list.
@Override
public LsEntry[] list(String path) throws IOException {
Assert.state(this.channel != null, "session is not connected");
try {
Vector<?> lsEntries = this.channel.ls(path);
if (lsEntries != null) {
LsEntry[] entries = new LsEntry[lsEntries.size()];
for (int i = 0; i < lsEntries.size(); i++) {
Object next = lsEntries.get(i);
Assert.state(next instanceof LsEntry, "expected only LsEntry instances from channel.ls()");
entries[i] = (LsEntry) next;
}
return entries;
}
} catch (SftpException e) {
throw new NestedIOException("Failed to list files", e);
}
return new LsEntry[0];
}
use of org.springframework.core.NestedIOException in project spring-integration by spring-projects.
the class SftpSession method read.
@Override
public void read(String source, OutputStream os) throws IOException {
Assert.state(this.channel != null, "session is not connected");
try {
InputStream is = this.channel.get(source);
FileCopyUtils.copy(is, os);
} catch (SftpException e) {
throw new NestedIOException("failed to read file " + source, e);
}
}
Aggregations