Handle null images
This commit is contained in:
parent
b42951fcb5
commit
c026fc44b5
4 changed files with 17 additions and 4 deletions
|
|
@ -101,6 +101,7 @@ public class AWSS3MapStorage extends MapStorage {
|
||||||
GetObjectResponse rsp = obj.getResponse();
|
GetObjectResponse rsp = obj.getResponse();
|
||||||
TileRead tr = new TileRead();
|
TileRead tr = new TileRead();
|
||||||
byte[] buf = obj.getBytes();
|
byte[] buf = obj.getBytes();
|
||||||
|
if (buf == null) { return null; }
|
||||||
tr.image = new BufferInputStream(buf);
|
tr.image = new BufferInputStream(buf);
|
||||||
tr.format = ImageEncoding.fromContentType(rsp.getContentType());
|
tr.format = ImageEncoding.fromContentType(rsp.getContentType());
|
||||||
Map<String, String> meta = rsp.getMetadata();
|
Map<String, String> meta = rsp.getMetadata();
|
||||||
|
|
|
||||||
|
|
@ -132,8 +132,12 @@ public class MicrosoftSQLMapStorage extends MapStorage {
|
||||||
rslt.lastModified = rs.getLong("LastUpdate");
|
rslt.lastModified = rs.getLong("LastUpdate");
|
||||||
rslt.format = MapType.ImageEncoding.fromOrd(rs.getInt("Format"));
|
rslt.format = MapType.ImageEncoding.fromOrd(rs.getInt("Format"));
|
||||||
byte[] img = rs.getBytes("Image");
|
byte[] img = rs.getBytes("Image");
|
||||||
|
if (img == null) {
|
||||||
|
rslt = null;
|
||||||
|
} else {
|
||||||
rslt.image = new BufferInputStream(img);
|
rslt.image = new BufferInputStream(img);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException x) {
|
} catch (SQLException x) {
|
||||||
|
|
|
||||||
|
|
@ -138,8 +138,12 @@ public class PostgreSQLMapStorage extends MapStorage {
|
||||||
rslt.lastModified = rs.getLong("LastUpdate");
|
rslt.lastModified = rs.getLong("LastUpdate");
|
||||||
rslt.format = MapType.ImageEncoding.fromOrd(rs.getInt("Format"));
|
rslt.format = MapType.ImageEncoding.fromOrd(rs.getInt("Format"));
|
||||||
byte[] img = rs.getBytes("Image");
|
byte[] img = rs.getBytes("Image");
|
||||||
|
if (img == null) {
|
||||||
|
rslt = null;
|
||||||
|
} else {
|
||||||
rslt.image = new BufferInputStream(img);
|
rslt.image = new BufferInputStream(img);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException x) {
|
} catch (SQLException x) {
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,12 @@ public class SQLiteMapStorage extends MapStorage {
|
||||||
// Trim trailing zeros from padding by BLOB field
|
// Trim trailing zeros from padding by BLOB field
|
||||||
while((len > 0) && (img[len-1] == '\0')) len--;
|
while((len > 0) && (img[len-1] == '\0')) len--;
|
||||||
}
|
}
|
||||||
|
if (img == null) {
|
||||||
|
rslt = null;
|
||||||
|
} else {
|
||||||
rslt.image = new BufferInputStream(img, len);
|
rslt.image = new BufferInputStream(img, len);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException x) {
|
} catch (SQLException x) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue