Example usage for java.lang NullPointerException getMessage

List of usage examples for java.lang NullPointerException getMessage

Introduction

In this page you can find the example usage for java.lang NullPointerException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.apache.zeppelin.socket.NotebookServer.java

@Override
public void onGetParagraphRunners(String noteId, String paragraphId, RemoteWorksEventListener callback) {
    Notebook notebookIns = notebook();/*from   w  w  w . j  av a  2 s. c  o m*/
    List<InterpreterContextRunner> runner = new LinkedList<>();

    if (notebookIns == null) {
        LOG.info("intepreter request notebook instance is null");
        callback.onFinished(notebookIns);
    }

    try {
        Note note = notebookIns.getNote(noteId);
        if (note != null) {
            if (paragraphId != null) {
                Paragraph paragraph = note.getParagraph(paragraphId);
                if (paragraph != null) {
                    runner.add(paragraph.getInterpreterContextRunner());
                }
            } else {
                for (Paragraph p : note.getParagraphs()) {
                    runner.add(p.getInterpreterContextRunner());
                }
            }
        }
        callback.onFinished(runner);
    } catch (NullPointerException e) {
        LOG.warn(e.getMessage());
        callback.onError();
    }
}

From source file:io.hops.hopsworks.api.zeppelin.socket.NotebookServerImpl.java

@Override
public void onGetParagraphRunners(String noteId, String paragraphId,
        RemoteInterpreterProcessListener.RemoteWorksEventListener callback) {
    Notebook notebookIns = notebook();//from  w ww  .  j  a  va2s . c  o m
    List<InterpreterContextRunner> runner = new LinkedList<>();

    if (notebookIns == null) {
        LOG.info("intepreter request notebook instance is null");
        callback.onFinished(notebookIns);
    }

    try {
        Note note = notebookIns.getNote(noteId);
        if (note != null) {
            if (paragraphId != null) {
                Paragraph paragraph = note.getParagraph(paragraphId);
                if (paragraph != null) {
                    runner.add(paragraph.getInterpreterContextRunner());
                }
            } else {
                for (Paragraph p : note.getParagraphs()) {
                    runner.add(p.getInterpreterContextRunner());
                }
            }
        }
        callback.onFinished(runner);
    } catch (NullPointerException e) {
        LOG.log(Level.SEVERE, e.getMessage());
        callback.onError();
    }
}

From source file:de.sub.goobi.forms.ProzesskopieForm.java

/**
 * The function isCalendarButtonShowing tells whether the calendar button
 * shall show up or not as read-only property "calendarButtonShowing".
 *
 * @return whether the calendar button shall show
 *//* w w w  . ja  v a 2s  .c  om*/
public boolean isCalendarButtonShowing() {
    try {
        return ConfigOpac.getDoctypeByName(docType).isNewspaper();
    } catch (NullPointerException e) {
        // may occur if user continues to interact with the page across a
        // restart of the servlet container
        return false;
    } catch (FileNotFoundException e) {
        logger.error("Error while reading von opac-config", e);
        Helper.setFehlerMeldung("Error while reading von opac-config", e.getMessage());
        return false;
    }
}

From source file:org.openbaton.clients.interfaces.client.openstack.OpenstackClient.java

@Override
public boolean deleteFlavor(VimInstance vimInstance, String extId) throws VimDriverException {
    log.debug("Deleting Flavor with ExtId: " + extId + " from VimInstance with name: " + vimInstance.getName());
    try {/*  w ww.  j  a  v a2s  . com*/
        NovaApi novaApi = ContextBuilder.newBuilder("openstack-nova").endpoint(vimInstance.getAuthUrl())
                .credentials(vimInstance.getTenant() + ":" + vimInstance.getUsername(),
                        vimInstance.getPassword())
                .modules(modules).overrides(overrides).buildApi(NovaApi.class);
        FlavorApi flavorApi = novaApi.getFlavorApi(getZone(vimInstance));
        flavorApi.delete(extId);
        boolean isDeleted;
        try {
            DeploymentFlavour flavour = getFlavorById(vimInstance, extId);
            if (flavour.getFlavour_key() == null) {
                throw new NullPointerException();
            }
            isDeleted = false;
            log.warn("Not deleted Flavor with ExtId: " + extId + " from VimInstance with name: "
                    + vimInstance.getName());
        } catch (NullPointerException e) {
            isDeleted = true;
            log.info("Deleted Flavor with ExtId: " + extId + " from VimInstance with name: "
                    + vimInstance.getName());
        }
        return isDeleted;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new VimDriverException(e.getMessage());
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * verfgbare Sprachen in Men eintragen Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui
 * //from w w w .j av  a  2 s  . com
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 18.12.2011
 * @param programLocale
 */
private void initLanuageMenu(Locale programLocale) {
    ResourceBundle rb;
    Enumeration<String> enu;
    String key = null;
    String cmd = null;
    try {
        lg.debug("try init language menu...");
        ignoreAction = true;
        // Lies die Resource aus
        rb = ResourceBundle.getBundle("de.dmarcini.submatix.pclogger.lang.languages");
        // Alle KEYS lesen
        enu = rb.getKeys();
        try {
            lg.debug("try init language menuitems...");
            while (enu.hasMoreElements()) {
                JMenuItem menuItem = new JMenuItem();
                key = enu.nextElement();
                cmd = rb.getString(key);
                menuItem.setText(key);
                menuItem.addActionListener(this);
                menuItem.setActionCommand(cmd);
                menuItem.addMouseMotionListener(this);
                mnLanguages.add(menuItem);
            }
            lg.debug("try init language menuitems...done");
        } catch (NullPointerException ex) {
            lg.error("NULL POINTER EXCEPTION <" + ex.getMessage() + ">");
            statusTextField.setText("ERROR set language strings");
            System.out.println("ERROR set language strings <" + ex.getMessage() + "> ABORT!");
            System.exit(-1);
        } catch (MissingResourceException ex) {
            lg.error("MISSING RESOURCE EXCEPTION <" + ex.getMessage() + ">");
            statusTextField.setText("ERROR set language strings");
            System.out.println("ERROR set language strings <" + ex.getMessage() + "> ABORT!");
            System.exit(-1);
        } catch (ClassCastException ex) {
            lg.error("CLASS CAST EXCEPTION <" + ex.getMessage() + ">");
            statusTextField.setText("ERROR set language strings");
            System.out.println("ERROR set language strings <" + ex.getMessage() + "> ABORT!");
            System.exit(-1);
        } finally {
            ignoreAction = false;
        }
    } catch (NullPointerException ex) {
        lg.error("NULL POINTER EXCEPTION <" + ex.getMessage() + ">");
        statusTextField.setText("ERROR set language strings");
        System.out.println("ERROR set language strings <" + ex.getMessage() + "> ABORT!");
        System.exit(-1);
    } catch (MissingResourceException ex) {
        lg.error("MISSING RESOURCE EXCEPTION <" + ex.getMessage() + ">");
        statusTextField.setText("ERROR set language strings - the given key can be found");
        System.out.println(
                "ERROR set language strings - the given key can be found <" + ex.getMessage() + "> ABORT!");
        System.exit(-1);
    } catch (ClassCastException ex) {
        lg.error("CLASS CAST EXCEPTION <" + ex.getMessage() + ">");
        statusTextField.setText("ERROR set language strings");
        System.out.println("ERROR set language strings <" + ex.getMessage() + "> ABORT!");
        System.exit(-1);
    } finally {
        ignoreAction = false;
    }
    lg.debug("try init language menu...done");
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Zeige eine Fehlermeldung mit Hinweistext ind Icon Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * //from   w w  w .ja  va 2  s .c  o m
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 25.06.2012
 * @param header
 * @param message
 */
private void showErrorDialog(String message) {
    ImageIcon icon = null;
    try {
        icon = new ImageIcon(MainCommGUI.class.getResource("/de/dmarcini/submatix/pclogger/res/Terminate.png"));
        JOptionPane.showMessageDialog(this, message, LangStrings.getString("MainCommGUI.errorDialog.headline"),
                JOptionPane.INFORMATION_MESSAGE, icon);
    } catch (NullPointerException ex) {
        statusTextField.setText("ERROR showErrorBox");
        lg.error("ERROR showErrorBox <" + ex.getMessage() + "> ABORT!");
        return;
    } catch (MissingResourceException ex) {
        statusTextField.setText("ERROR showErrorBox");
        lg.error("ERROR showErrorBox <" + ex.getMessage() + "> ABORT!");
        return;
    } catch (ClassCastException ex) {
        statusTextField.setText("ERROR showErrorBox");
        lg.error("ERROR showErrorBox <" + ex.getMessage() + "> ABORT!");
        return;
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Zeige eine klein Info ber das Proggi an Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui Project: SubmatixBTForPC Package:
 * de.dmarcini.submatix.pclogger.gui/*from  ww w .  j  a v  a 2s.  com*/
 * 
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 05.01.2012
 */
private void showInfoDialog() {
    try {
        ProgramInfoDialog pDial = new ProgramInfoDialog();
        pDial.showDialog();
    } catch (NullPointerException ex) {
        statusTextField.setText("ERROR showInfoDialog");
        lg.error("ERROR showInfoDialog <" + ex.getMessage() + "> ABORT!");
        return;
    } catch (MissingResourceException ex) {
        statusTextField.setText("ERROR showInfoDialog");
        lg.error("ERROR showInfoDialog <" + ex.getMessage() + "> ABORT!");
        return;
    } catch (ClassCastException ex) {
        statusTextField.setText("ERROR showInfoDialog");
        lg.error("ERROR showInfoDialog <" + ex.getMessage() + "> ABORT!");
        return;
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Zeigt eine Warnung an Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui
 * //from   w  w w . j  a v  a  2s .c o m
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 07.01.2012
 * @param msg
 *          Warnmessage
 */
private void showWarnBox(String msg) {
    ImageIcon icon = null;
    try {
        icon = new ImageIcon(MainCommGUI.class.getResource("/de/dmarcini/submatix/pclogger/res/Abort.png"));
        JOptionPane.showMessageDialog(this, msg, LangStrings.getString("MainCommGUI.warnDialog.headline"),
                JOptionPane.WARNING_MESSAGE, icon);
    } catch (NullPointerException ex) {
        statusTextField.setText("ERROR showWarnDialog");
        lg.error("ERROR showWarnDialog <" + ex.getMessage() + "> ABORT!");
        return;
    } catch (MissingResourceException ex) {
        statusTextField.setText("ERROR showWarnDialog");
        lg.error("ERROR showWarnDialog <" + ex.getMessage() + "> ABORT!");
        return;
    } catch (ClassCastException ex) {
        statusTextField.setText("ERROR showWarnDialog");
        lg.error("ERROR showWarnDialog <" + ex.getMessage() + "> ABORT!");
        return;
    }
}

From source file:org.egov.services.budget.BudgetDetailService.java

/**
 * returns department of the employee from assignment for the current date
 *
 * @param emp/*  w  w w  . ja  v a 2 s.  c o m*/
 * @return
 */
public Department depertmentForEmployee(final Employee emp) {
    Department dept = null;
    final Date currDate = new Date();
    try {
        final Assignment empAssignment = eisCommonService.getLatestAssignmentForEmployeeByToDate(emp.getId(),
                currDate);
        dept = empAssignment.getDepartment();
        return dept;
    } catch (final NullPointerException ne) {
        throw new ApplicationRuntimeException(ne.getMessage());
    } catch (final Exception e) {
        throw new ApplicationRuntimeException(
                "Error while getting Department fort the employee" + emp.getName());
    }

}

From source file:org.openbaton.clients.interfaces.client.openstack.OpenstackClient.java

@Override
public List<String> getSubnetsExtIds(VimInstance vimInstance, String extId) throws VimDriverException {
    log.debug("Listing all external SubnetIDs for Network with ExtId: " + extId
            + " from VimInstance with name: " + vimInstance.getName());
    try {/*from   www . j a v a  2  s . com*/
        NeutronApi neutronApi = ContextBuilder.newBuilder("openstack-neutron")
                .endpoint(vimInstance.getAuthUrl())
                .credentials(vimInstance.getTenant() + ":" + vimInstance.getUsername(),
                        vimInstance.getPassword())
                .modules(modules).overrides(overrides).buildApi(NeutronApi.class);
        NetworkApi networkApi = neutronApi.getNetworkApi(getZone(vimInstance));
        List<String> subnets = new ArrayList<String>();
        org.jclouds.openstack.neutron.v2.domain.Network jcloudsNetwork = networkApi.get(extId);
        subnets = jcloudsNetwork.getSubnets().asList();
        log.info("Listed all external SubnetIDs for Network with ExtId: " + extId
                + " from VimInstance with name: " + vimInstance.getName() + " -> external Subnet IDs: "
                + subnets);
        return subnets;
    } catch (NullPointerException e) {
        log.error("Not found Network with ExtId: " + extId + " on VimInstance with name: "
                + vimInstance.getName(), e);
        throw new NullPointerException("Not found Network with ExtId: " + extId + " on VimInstance with name: "
                + vimInstance.getName());
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new VimDriverException(e.getMessage());
    }
}