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:net.sf.joost.trax.TemplatesImpl.java

/**
 * Configures the <code>Templates</code> - initializing with a completed
 *  <code>Parser</code> object.
 * @param stxParser A <code>Parser</code>
 * @throws TransformerConfigurationException When an error occurs while
 *  initializing the <code>Templates</code>.
 *//*from  w  w  w  . j a  v  a2 s.  c o m*/
private void init(Parser stxParser) throws TransformerConfigurationException {

    if (DEBUG)
        log.debug("init without InputSource ");
    try {
        // check if transformerfactory is in debug mode
        boolean debugmode = ((Boolean) this.factory.getAttribute(DEBUG_FEATURE)).booleanValue();

        if (debugmode) {
            if (log != null)
                log.info("init transformer in debug mode");
            processor = new DebugProcessor(stxParser);
        } else {
            processor = new Processor(stxParser);
        }
        processor.setTransformerHandlerResolver(factory.thResolver);
        processor.setOutputURIResolver(factory.outputUriResolver);
    } catch (org.xml.sax.SAXException sE) {
        if (log != null)
            log.fatal(sE);
        throw new TransformerConfigurationException(sE.getMessage());
    } catch (java.lang.NullPointerException nE) {
        if (log != null)
            log.fatal(nE);
        throw new TransformerConfigurationException(
                "Could not found value for property javax.xml.parsers.SAXParser " + nE.getMessage());
    }
}

From source file:org.jas.metadata.MetadataWriter.java

public boolean writeCdNumber(String cdNumber) throws MetadataException {
    try {/*from   www .j  a v  a 2s.  com*/
        if (StringUtils.isEmpty(cdNumber)) {
            return false;
        }
        tag.setField(FieldKey.DISC_NO, cdNumber);
        audioFile.commit();
        return true;
    } catch (KeyNotFoundException kne) {
        throw new MetadataException(kne.getMessage());
    } catch (FieldDataInvalidException fie) {
        throw new MetadataException(fie.getMessage());
    } catch (CannotWriteException nwe) {
        throw new MetadataException(nwe.getMessage());
    } catch (NullPointerException nue) {
        throw new MetadataException(nue.getMessage());
    }
}

From source file:org.jas.metadata.MetadataWriter.java

public boolean writeTotalCds(String totalCds) throws MetadataException {
    try {/*ww  w. j  ava2  s .co m*/
        if (StringUtils.isEmpty(totalCds)) {
            return false;
        }
        tag.setField(FieldKey.DISC_TOTAL, totalCds);
        audioFile.commit();
        return true;
    } catch (KeyNotFoundException kne) {
        throw new MetadataException(kne.getMessage());
    } catch (FieldDataInvalidException fie) {
        throw new MetadataException(fie.getMessage());
    } catch (CannotWriteException nwe) {
        throw new MetadataException(nwe.getMessage());
    } catch (NullPointerException nue) {
        throw new MetadataException(nue.getMessage());
    }
}

From source file:org.jas.metadata.MetadataWriter.java

public boolean writeYear(String year) throws MetadataException {
    try {/*  ww  w  .  j  av  a 2 s.  c  om*/
        if (StringUtils.isEmpty(year)) {
            return false;
        }
        tag.setField(FieldKey.YEAR, year);
        audioFile.commit();
        return true;
    } catch (KeyNotFoundException kne) {
        throw new MetadataException(kne.getMessage());
    } catch (FieldDataInvalidException fie) {
        throw new MetadataException(fie.getMessage());
    } catch (CannotWriteException nwe) {
        throw new MetadataException(nwe.getMessage());
    } catch (NullPointerException nue) {
        throw new MetadataException(nue.getMessage());
    }
}

From source file:org.jas.metadata.MetadataWriter.java

public boolean writeGenre(String genre) throws MetadataException {
    try {/*from www.j  av  a  2 s .  c  o  m*/
        if (StringUtils.isEmpty(genre)) {
            return false;
        }
        tag.setField(FieldKey.GENRE, genre);
        audioFile.commit();
        return true;
    } catch (KeyNotFoundException kne) {
        throw new MetadataException(kne.getMessage());
    } catch (FieldDataInvalidException fie) {
        throw new MetadataException(fie.getMessage());
    } catch (CannotWriteException nwe) {
        throw new MetadataException(nwe.getMessage());
    } catch (NullPointerException nue) {
        throw new MetadataException(nue.getMessage());
    }
}

From source file:net.easymfne.soundcheck.command.SequenceCommand.java

/**
 * Attempt to parse a user's command arguments.
 * /*from  w ww.  j a v a 2 s  .  c o m*/
 * TODO: Remove deprecation suppression when Bukkit is at Minecraft 1.8.
 * 
 * @param sender
 *            User
 * @param args
 *            Arguments
 * @throws SequenceError
 */
@SuppressWarnings("deprecation")
private void parseCommand(CommandSender sender, String... args) throws SequenceError {
    Location senderLocation = (sender instanceof Player ? ((Player) sender).getLocation()
            : (sender instanceof BlockCommandSender ? ((BlockCommandSender) sender).getBlock().getLocation()
                    : null));
    Sequence sequence = null;
    try {
        sequence = Sequence.parse(plugin.getConfigHelper().getSequences().getMapList(args[0]));
    } catch (NullPointerException e) {
        throw new SequenceError("Unknown sequence: " + args[0]);
    } catch (IllegalArgumentException e) {
        throw new SequenceError("Error in sequence: " + e.getMessage());
    }

    Player player = null;
    Coordinates coordinates = null;
    RelativeCoordinates relativeCoordinates = null;

    /* Iterate through arguments, matching all that we can */
    /* order of operations: player, coords, relativeCoords */
    for (int i = 1; i < args.length; i++) {
        if (plugin.getServer().getPlayerExact(args[i]) != null) {
            player = plugin.getServer().getPlayerExact(args[i]);
        } else if (Coordinates.matches(args[i])) {
            try {
                coordinates = Coordinates.parse(args[i]);
            } catch (NumberFormatException e) {
                throw new SequenceError("Failed to parse coordinates: " + args[i]);
            }
        } else if (RelativeCoordinates.matches(args[i])) {
            try {
                relativeCoordinates = RelativeCoordinates.parse(args[i]);
            } catch (NumberFormatException e) {
                throw new SequenceError("Failed to parse relative coordinates: " + args[i]);
            }
        } else {
            throw new SequenceError("Unrecognized player: " + args[i]);
        }
    }

    playSequence(sequence, senderLocation, player, coordinates, relativeCoordinates);
}

From source file:org.pentaho.hadoop.shim.common.DistributedCacheUtilImplTest.java

@Test
public void installKettleEnvironment_missing_arguments() throws Exception {
    DistributedCacheUtilImpl ch = new DistributedCacheUtilImpl(TEST_CONFIG);

    try {/*  w  w w .  jav  a  2s .  co  m*/
        ch.installKettleEnvironment(null, (org.pentaho.hadoop.shim.api.fs.FileSystem) null, null, null, null);
        fail("Expected exception on missing archive");
    } catch (NullPointerException ex) {
        assertEquals("pmrArchive is required", ex.getMessage());
    }

    try {
        ch.installKettleEnvironment(KettleVFS.getFileObject("."),
                (org.pentaho.hadoop.shim.api.fs.FileSystem) null, null, null, null);
        fail("Expected exception on missing archive");
    } catch (NullPointerException ex) {
        assertEquals("destination is required", ex.getMessage());
    }

    try {
        ch.installKettleEnvironment(KettleVFS.getFileObject("."),
                (org.pentaho.hadoop.shim.api.fs.FileSystem) null, new PathProxy("."), null, null);
        fail("Expected exception on missing archive");
    } catch (NullPointerException ex) {
        assertEquals("big data plugin required", ex.getMessage());
    }
}

From source file:org.jas.metadata.MetadataWriter.java

public boolean writeCoverArt(Image lastfmCoverArt) throws MetadataException {
    try {/*w  ww  . j  a v  a2s  . co m*/
        File coverArtFile = imageUtils.saveCoverArtToFile(lastfmCoverArt, StringUtils.EMPTY);
        Artwork artwork = artworkHelper.createArtwork();
        artwork.setFromFile(coverArtFile);
        tag.setField(artwork);
        audioFile.commit();
        return true;
    } catch (KeyNotFoundException kne) {
        throw new MetadataException(kne.getMessage());
    } catch (FieldDataInvalidException fie) {
        throw new MetadataException(fie.getMessage());
    } catch (CannotWriteException nwe) {
        throw new MetadataException(nwe.getMessage());
    } catch (IOException ioe) {
        throw new MetadataException(ioe.getMessage());
    } catch (NullPointerException nue) {
        throw new MetadataException(nue.getMessage());
    }
}

From source file:org.energy_home.jemma.javagal.rest.resources.LocalServicesResource.java

@Delete
public void precessDelete() {

    try {//from  www . j a  va  2s .  com

        String epString = "";
        epString = (String) getRequest().getAttributes().get(Resources.PARAMETER_EP);

        proxyGalInterface = getRestManager().getClientObjectKey(-1, getClientInfo().getAddress())
                .getGatewayInterface();
        Short endpoint = Short.parseShort(epString, 16);

        // ClearEndpoint
        proxyGalInterface.clearEndpoint(endpoint);
        Info i = new Info();

        Status st = new Status();
        st.setCode((short) GatewayConstants.SUCCESS);
        i.setStatus(st);
        getResponse().setEntity(Util.marshal(i), MediaType.APPLICATION_XML);

        return;
    } catch (NullPointerException npe) {
        Info info = new Info();
        Status _st = new Status();
        _st.setCode((short) GatewayConstants.GENERAL_ERROR);
        _st.setMessage(npe.getMessage());
        info.setStatus(_st);
        Info.Detail detail = new Info.Detail();
        info.setDetail(detail);
        getResponse().setEntity(Util.marshal(info), MediaType.APPLICATION_XML);
        return;
    } catch (Exception e) {
        Info info = new Info();
        Status _st = new Status();
        _st.setCode((short) GatewayConstants.GENERAL_ERROR);
        _st.setMessage(e.getMessage());
        info.setStatus(_st);
        Info.Detail detail = new Info.Detail();
        info.setDetail(detail);
        getResponse().setEntity(Util.marshal(info), MediaType.APPLICATION_XML);
        return;
    }
}

From source file:se.vgregion.portal.rss.client.beans.FeedEntryBean.java

private Date toTimeDate(String text) {
    try {//from w  ww.j  a v  a  2s.  c o m
        return (timeFormat.parse(text));
    } catch (NullPointerException e) {
        LOGGER.warn("Null date text.");
        return null;
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        return null;
    }
}