mirror of https://github.com/apache/jclouds.git
Merge pull request #926 from andrewgaul/to-string-and-close-exception-handling
Propagate exceptions from toStringAndClose
This commit is contained in:
commit
3a2905ee1e
|
@ -41,10 +41,6 @@ import java.util.concurrent.ExecutionException;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.jclouds.logging.Logger;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.io.CharStreams;
|
import com.google.common.io.CharStreams;
|
||||||
import com.google.common.io.InputSupplier;
|
import com.google.common.io.InputSupplier;
|
||||||
|
@ -135,11 +131,6 @@ public class Strings2 {
|
||||||
checkNotNull(input, "input");
|
checkNotNull(input, "input");
|
||||||
try {
|
try {
|
||||||
return new String(toByteArray(input), Charsets.UTF_8);
|
return new String(toByteArray(input), Charsets.UTF_8);
|
||||||
} catch (IOException e) {
|
|
||||||
logger.warn(e, "Failed to read from stream");
|
|
||||||
return null;
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
return null;
|
|
||||||
} finally {
|
} finally {
|
||||||
closeQuietly(input);
|
closeQuietly(input);
|
||||||
}
|
}
|
||||||
|
@ -149,9 +140,6 @@ public class Strings2 {
|
||||||
return new ByteArrayInputStream(in.getBytes(Charsets.UTF_8));
|
return new ByteArrayInputStream(in.getBytes(Charsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
|
||||||
private static Logger logger = Logger.NULL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replaces tokens that are expressed as <code>{token}</code>
|
* replaces tokens that are expressed as <code>{token}</code>
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue