This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 142277 - Refactoring doesn't work with SVG file in MIDP Project
Summary: Refactoring doesn't work with SVG file in MIDP Project
Status: NEW
Alias: None
Product: javame
Classification: Unclassified
Component: Visual Designer (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker with 1 vote (vote)
Assignee: Karol Harezlak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-30 17:33 UTC by Andrei Chistiakov
Modified: 2014-08-04 10:47 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Chistiakov 2008-07-30 17:33:06 UTC
Product Version: NetBeans IDE Dev (Build 200807300201)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b13
System: Windows XP version 5.1 running on x86; Cp1251; ru_RU (nb)

To reproduce:
- create Mobile Application without HelloMIDlet;
- create SVG image and Visual MIDlet in default package;
- add SVG Form to the MIDlet;
- attach SVG Image to the SVG Form;
- bind Started to SVG Form;
- create 'abc' package in the project;
- select both Image and MIDlet, 'Cut' them and perform 'Paste->Refactor Move' to 'abc';
- run the project, launch the MIDlet in emulator.

Emulator throws exception as it can't find SVG Image.

...
startApp threw an Exception
java.lang.NullPointerException
java.lang.NullPointerException
        at com.sun.perseus.model.SVGImageImpl.createImage(SVGImageImpl.java:467)
        at javax.microedition.m2g.SVGImage.createImage(SVGImage.java:221)
        at abc.VisualMIDlet.getSvgImage(VisualMIDlet.java:113)
        at abc.VisualMIDlet.getSvgForm(VisualMIDlet.java:96)
        at abc.VisualMIDlet.startMIDlet(VisualMIDlet.java:54)
        at abc.VisualMIDlet.startApp(VisualMIDlet.java:149)
        at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
        at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
        at com.sun.midp.main.Main.runLocalClass(Main.java:466)
        at com.sun.midp.main.Main.main(Main.java:120)

Refactoring is not supported for SVG Image file in a MIDP Project.
Comment 1 Karol Harezlak 2008-08-01 15:13:34 UTC
It is reproducable every time or only with some particular SVG File, it could also mean that SVG file is broken and
perseus cant create image. 
Comment 2 Andrei Chistiakov 2008-08-01 15:28:25 UTC
It doesn't depend on content of SVG file.
Comment 3 Andrei Chistiakov 2008-08-01 15:32:01 UTC
The problem is that after refactoring, the generated method below still tries to find the file in hello package.
Changing hello to abc fixes the problem.

    public SVGImage getSvgImage() {
        if (svgImage == null) {
            // write pre-init user code here
            try {
                svgImage = (SVGImage) SVGImage.createImage(getClass().getResourceAsStream("/hello/newImage.svg"), null);
            } catch (java.io.IOException e) {
                e.printStackTrace();
            }
            // write post-init user code here
        }
        return svgImage;
    }
Comment 4 Karol Harezlak 2009-01-07 10:17:30 UTC
Yes I have to agree this type of refactoring it is not well supported. Unfortunately to cove all cases of refactoring
with images, fonts, svg files etc. would be extremely time consuming so I think we are not going to support it unless
somebody will dedicate a lot of time to implement proper refactoring and cover all possible scenarios. I'm marking this
as enhancement.   
Comment 5 Christian Lenz 2014-08-04 10:47:41 UTC
Tested with a maven project and a HTML5 project, would call CTRL + R to refactor a tag but nothing happens :(. Thought it will be handled as a XML file. Voted for this. I'm using NB 8.0 Nightly 20140804.


Regards

Chris