i'm trying on the tutorial at http://tools.osmosis.gr/blog/archives/2005/03/birt_rcp_viewer_1.html

i have a openReportEditor method as shown below:

private void openReportEditor() {

        serverUrlText.setText("[URL="http://127.0.0.1/"][COLOR=#0000ff]http://127.0.0.1[/COLOR][/URL]:8181/birt/");
String uri = serverUrlText.getText();

        ReportEditorInput input = new ReportEditorInput();
        input.setUri(uri);

        OpenNewBrowserAction action = new OpenNewBrowserAction(input);
        action.run();}

when i have created a button and i would like to call the openReportEditor. i did it in this way,

button2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
openReportEditor();
     }

but the exception of ' java.lang.NullPointerException' is caught.
how to fix it?? thanks.

Recommended Answers

All 2 Replies

Trace the problem. Find out which object is null then find out where or why its not being initialized

the stack trace caught exception:

(1)  button2.addSelectionListener(new SelectionListener() {
                        public void widgetSelected(SelectionEvent e) {
                            openReportEditor();
                        }

(2) private void openReportEditor(){

        serverUrlText.setText("http://127.0.0.1:8181/birt/");
        String uri = serverUrlText.getText();

        ReportEditorInput input = new ReportEditorInput();
        input.setUri(uri);

        OpenNewBrowserAction action = new   
        OpenNewBrowserAction(input);
        action.run();

and other stack trace is as shown below:

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
    at my.com.shinyang.logging.ui.MainWindow.run(MainWindow.java:13)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
    at org.eclipse.core.launcher.Main.run(Main.java:973)
    at org.eclipse.core.launcher.Main.main(Main.java:948)

what's going on??? can anyone help???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.