mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Improved error message when file/URI is mistyped.
git-svn-id: https://zxing.googlecode.com/svn/trunk@598 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
6f8a5f49ca
commit
7e022edf66
|
@ -26,6 +26,7 @@ import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
|
@ -89,7 +90,12 @@ public final class CommandLineRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean decode(URI uri, Hashtable<DecodeHintType, Object> hints) throws IOException {
|
private static boolean decode(URI uri, Hashtable<DecodeHintType, Object> hints) throws IOException {
|
||||||
BufferedImage image = ImageIO.read(uri.toURL());
|
BufferedImage image;
|
||||||
|
try {
|
||||||
|
image = ImageIO.read(uri.toURL());
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
throw new FileNotFoundException("Resource not found: " + uri);
|
||||||
|
}
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
System.err.println(uri.toString() + ": Could not load image");
|
System.err.println(uri.toString() + ": Could not load image");
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue