git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
working
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
utils
/
serial
/
Importer.java
diff --git
a/src/be/nikiroo/utils/serial/Importer.java
b/src/be/nikiroo/utils/serial/Importer.java
index eec30b24b754b248c9ebf55af950cefa1d4c97cf..f7fece064d6028d8fca8ff5a742cf997f52f52b2 100644
(file)
--- a/
src/be/nikiroo/utils/serial/Importer.java
+++ b/
src/be/nikiroo/utils/serial/Importer.java
@@
-75,11
+75,18
@@
public class Importer {
if (in == null) {
throw new NullPointerException("InputStream is null");
}
if (in == null) {
throw new NullPointerException("InputStream is null");
}
- if (stream.eof()) {
- throw new NullPointerException("InputStream is empty");
- }
+ boolean first = true;
while (stream.next()) {
while (stream.next()) {
+ if (stream.eof()) {
+ if (first) {
+ throw new NullPointerException(
+ "InputStream empty, normal termination");
+ }
+ return this;
+ }
+ first = false;
+
boolean zip = stream.startsWiths("ZIP:");
boolean b64 = stream.startsWiths("B64:");
boolean zip = stream.startsWiths("ZIP:");
boolean b64 = stream.startsWiths("B64:");
@@
-142,6
+149,10
@@
public class Importer {
// TODO use the stream, Luke
String line = IOUtils.readSmallStream(in);
// TODO use the stream, Luke
String line = IOUtils.readSmallStream(in);
+ if (line.isEmpty()) {
+ return false;
+ }
+
if (line.equals("{")) { // START: new child if needed
if (link != null) {
child = new Importer(map);
if (line.equals("{")) { // START: new child if needed
if (link != null) {
child = new Importer(map);