Hi,
After using my little SVG based Splash class code OK for 7 months, I'm suddenly experiencing a NullPointerException in my Nokia 6210 Navigator causing the application to abort in the render() method. See code below. I use the NetBeans 6.7.1 IDE.
Running in the emulator, see Output below, it reports the NullPointerException the first time the image is loaded but continues and succeeds next time. However, my SVG based mainMenu class works OK.
HOWEVER, if I comment out the SVG Splash class in the StartApp(), the same NullPointerException problem will instead happen in the mainMenu class instead, and in the same way.
So, it looks like this is a problem the first time an SVG image is created.
See NetBeans 6.7.1 Output below.
What can be the problem?
/Per
OUTPUT NetBeans 6.7.1
*********************
pre-init:
pre-load-properties:
exists.config.active:
exists.netbeans.user:
exists.user.properties.file:
load-properties:
exists.platform.active:
exists.platform.configuration:
exists.platform.profile:
basic-init:
cldc-pre-init:
cldc-init:
cdc-init:
ricoh-pre-init:
ricoh-init:
semc-pre-init:
semc-init:
savaje-pre-init:
savaje-init:
sjmc-pre-init:
sjmc-init:
cdc-hi-pre-init:
cdc-hi-init:
nokiaS80-pre-init:
nokiaS80-init:
nsicom-pre-init:
nsicom-init:
post-init:
init:
conditional-clean-init:
conditional-clean:
deps-jar:
pre-preprocess:
do-preprocess:
Pre-processing 0 file(s) into C:\Documents and Settings\admin\My Documents\NetBeansProjects\SoftAlarmR100\build\preprocessed directory.
post-preprocess:
preprocess:
pre-compile:
extract-libs:
do-compile:
post-compile:
compile:
pre-obfuscate:
proguard-init:
skip-obfuscation:
proguard:
post-obfuscate:
obfuscate:
lwuit-build:
pre-preverify:
do-preverify:
Preverifying 18 file(s) into C:\Documents and Settings\admin\My Documents\NetBeansProjects\SoftAlarmR100\build\preverified directory.
post-preverify:
preverify:
pre-jar:
set-password-init:
set-keystore-password:
set-alias-password:
set-password:
create-jad:
add-configuration:
add-profile:
do-extra-libs:
nokiaS80-prepare-j9:
nokiaS80-prepare-manifest:
nokiaS80-prepare-manifest-no-icon:
nokiaS80-create-manifest:
jad-jsr211-properties.check:
jad-jsr211-properties:
semc-build-j9:
do-jar:
Building jar: C:\Documents and Settings\admin\My Documents\NetBeansProjects\SoftAlarmR100\dist\SoftAlarmR100.jar
nsicom-create-manifest:
do-jar-no-manifest:
update-jad:
Updating application descriptor: C:\Documents and Settings\admin\My Documents\NetBeansProjects\SoftAlarmR100\dist\SoftAlarmR100.jad
Generated "C:\Documents and Settings\admin\My Documents\NetBeansProjects\SoftAlarmR100\dist\SoftAlarmR100.jar" is 347354 bytes.
ricoh-init-dalp:
ricoh-add-app-icon:
ricoh-build-dalp-with-icon:
ricoh-build-dalp-without-icon:
ricoh-build-dalp:
savaje-prepare-icon:
savaje-build-jnlp:
post-jar:
jar:
pre-run:
netmon.check:
open-netmon:
cldc-run:
Copying 1 file to C:\Documents and Settings\admin\My Documents\NetBeansProjects\SoftAlarmR100\dist\nbrun188544583382957287
Copying 1 file to C:\Documents and Settings\admin\My Documents\NetBeansProjects\SoftAlarmR100\dist\nbrun188544583382957287
Jad URL for OTA execution: http://localhost:8082/servlet/org.ne...tAlarmR100.jad
Starting emulator in execution mode
Running with storage root temp.SonyEricsson_JP8_240x320_Emu124
Running with locale: Swedish_Sweden.1252
***************SVGSplash 1*************
Using Pisces Renderer (native version)
>>>>>>>>>>>> loadStarting : true
>>>>>>>>>>>> loadComplete : true
>>>>>>>>>>>> loadingFailed: false
>>>>>>>>>>>> loadStarting : true
>>>>>>>>>>>> loadComplete : true
>>>>>>>>>>>> loadingFailed: false
Uncaught exception java/lang/NullPointerException.
***************SVGSplash 2*************
***************SVGSplash 1*************
***************SVGSplash 2*************
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
Warning: To avoid potential deadlock, operations that may block, such as
networking, should be performed in a different thread than the
commandAction() handler.
***************SVGMenuCreate 1*************
***************SVGMenuCreate 2*************
Execution completed.
43862590 bytecodes executed
2398 thread switches
1782 classes in the system (including system classes)
0 dynamic objects allocated (0 bytes)
0 garbage collections (0 bytes collected)
ricoh-run:
semc-icon-assembly:
semc-ppro-emulator:
semc-do-run:
semc-run:
savaje-run:
sjmc-run:
nokiaS80-run:
nsicom-run:
cdc-hi-run:
profiler.check:
open-profiler:
run:
BUILD SUCCESSFUL (total time: 35 seconds)
-----------------------------------------------
CODE:
*****
public SVGshowSplash (SoftAlarmR100 midlet) {
this.midlet = midlet;
setFullScreenMode(true);
width = getWidth();
height = getHeight();
/*
* Open the Input stream
*/
try {
svgImage = (SVGImage) SVGImage.createImage(getClass().getResourceAsStream("/SplashBetaKilsbergenVikern 240x320.svg"), null);
}
catch (Exception e) {
alertUser = new Alert("Splash svgImage create error", e.toString() ,null,null);
alertUser.setTimeout(5000);
alertUser.setType(AlertType.ERROR);
Display.getDisplay(midlet).setCurrent(alertUser);}
scalableImage = svgImage;
sg = ScalableGraphics.createInstance();
sg.setRenderingQuality(ScalableGraphics.RENDERING_QUALITY_HIGH);
}
public void paint(Graphics g){
// clear the display
//g.setColor( 255, 255, 255 );
sg.bindTarget(g);
System.out.print(" ***************SVGSplash 1************* \n");
sg.render(0,0, svgImage);
System.out.print(" ***************SVGSplash 2************* \n");
sg.releaseTarget();
} //g
public void hideNotify()
{
}
public void showNotify()
{
}
/********************************************
* Handle screen size change
********************************************/
protected void sizeChanged(int width,int height)
{
svgImage.setViewportWidth( width );
svgImage.setViewportHeight( height );
repaint();
}

Reply With Quote


