[libbluray-devel] Check context when creating images
hpi1
git at videolan.org
Fri Dec 4 09:58:37 CET 2015
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Dec 3 14:59:37 2015 +0200| [7a9ff39c37e8551772be42f2c05faa57d581413d] | committer: hpi1
Check context when creating images
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=7a9ff39c37e8551772be42f2c05faa57d581413d
---
src/libbluray/bdj/java/java/awt/BDToolkitBase.java | 23 ++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/libbluray/bdj/java/java/awt/BDToolkitBase.java b/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
index dc61bef..0f5e3e0 100644
--- a/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
@@ -124,6 +124,10 @@ abstract class BDToolkitBase extends Toolkit {
}
public Image getImage(String filename) {
+ if (BDJXletContext.getCurrentContext() == null) {
+ logger.error("getImage(): no context " + Logger.dumpStack());
+ }
+
if (cachedImages.containsKey(filename))
return (Image)cachedImages.get(filename);
Image newImage = createImage(filename);
@@ -133,6 +137,10 @@ abstract class BDToolkitBase extends Toolkit {
}
public Image getImage(URL url) {
+ if (BDJXletContext.getCurrentContext() == null) {
+ logger.error("getImage(): no context " + Logger.dumpStack());
+ }
+
if (cachedImages.containsKey(url))
return (Image)cachedImages.get(url);
Image newImage = createImage(url);
@@ -142,6 +150,10 @@ abstract class BDToolkitBase extends Toolkit {
}
public Image createImage(String filename) {
+ if (BDJXletContext.getCurrentContext() == null) {
+ logger.error("createImage(): no context " + Logger.dumpStack());
+ }
+
if (!new File(filename).isAbsolute()) {
String home = BDJXletContext.getCurrentXletHome();
if (home != null) {
@@ -161,6 +173,9 @@ abstract class BDToolkitBase extends Toolkit {
}
public Image createImage(URL url) {
+ if (BDJXletContext.getCurrentContext() == null) {
+ logger.error("createImage(): no context " + Logger.dumpStack());
+ }
ImageProducer ip = new URLImageSource(url);
Image newImage = createImage(ip);
return newImage;
@@ -169,12 +184,20 @@ abstract class BDToolkitBase extends Toolkit {
public Image createImage(byte[] imagedata,
int imageoffset,
int imagelength) {
+
+ if (BDJXletContext.getCurrentContext() == null) {
+ logger.error("createImage(): no context " + Logger.dumpStack());
+ }
+
ImageProducer ip = new ByteArrayImageSource(imagedata, imageoffset, imagelength);
Image newImage = createImage(ip);
return newImage;
}
public Image createImage(ImageProducer producer) {
+ if (BDJXletContext.getCurrentContext() == null) {
+ logger.error("createImage(): no context " + Logger.dumpStack());
+ }
return new BDImageConsumer(producer);
}
More information about the libbluray-devel
mailing list