Example usage for java.lang NullPointerException NullPointerException

List of usage examples for java.lang NullPointerException NullPointerException

Introduction

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

Prototype

public NullPointerException() 

Source Link

Document

Constructs a NullPointerException with no detail message.

Usage

From source file:Main.java

/**
 * Submits a Runnable task for execution on the EDT and returns a
 * Future representing that task./*w  w w  .j  a  v a2  s  . c  o  m*/
 *
 * @param task the task to submit
 * @param result the result to return upon successful completion
 * @return a Future representing pending completion of the task,
 *         and whose <tt>get()</tt> method will return the given
 *         result value upon completion
 * @throws NullPointerException if the task is null
 */
public static <V> Future<V> submit(Runnable task, V result) {
    if (task == null) {
        throw new NullPointerException();
    }
    FutureTask<V> future = new FutureTask<V>(task, result);
    execute(future);
    return future;
}

From source file:com.milaboratory.core.io.CompressionType.java

private static InputStream createInputStream(CompressionType ct, InputStream is, int buffer)
        throws IOException {
    switch (ct) {
    case None:/*from   w w w.j a  v a 2  s  .c  om*/
        return is;
    case GZIP:
        return new GZIPInputStream(is, buffer);
    case BZIP2:
        CompressorStreamFactory factory = new CompressorStreamFactory();
        try {
            return factory.createCompressorInputStream(CompressorStreamFactory.BZIP2,
                    new BufferedInputStream(is));
        } catch (CompressorException e) {
            throw new IOException(e);
        }
    }
    throw new NullPointerException();
}

From source file:org.cloudfoundry.client.lib.io.DynamicInputStream.java

@Override
public int read(byte[] b, int off, int len) throws IOException {
    if (b == null) {
        throw new NullPointerException();
    }/* w w w . ja  v a2s  .co m*/
    if (off < 0 || len < 0 || len > (b.length - off)) {
        throw new IndexOutOfBoundsException();
    }
    if (len == 0) {
        return 0;
    }
    return doRead(b, off, len, true);
}

From source file:com.icesoft.faces.component.ext.renderkit.ImageRenderer.java

protected String processSrcAttribute(FacesContext facesContext, UIGraphic uiGraphic) {
    Object o = uiGraphic.getValue();
    if (o == null) {
        o = uiGraphic.getUrl();/*from  w  w w  .j a v a2 s .c o m*/
    }
    if (o == null) {
        log.error("The value of graphicImage component is missing", new NullPointerException());
        return new String();
    }
    if (o instanceof byte[]) {
        return ((HtmlGraphicImage) uiGraphic).getByteArrayImagePath(facesContext);
    } else if (o instanceof Resource) {
        ResourceRegistry registry = ResourceRegistryLocator.locate(facesContext);
        return registry.registerResource((Resource) o).getPath();
    } else {
        // delegate to the parent class
        return super.processSrcAttribute(facesContext, uiGraphic);
    }
}

From source file:org.pentaho.chart.plugin.jfreechart.outputs.JFreeChartOutput.java

public JFreeChartOutput(final JFreeChart chart) {
    if (chart == null) {
        throw new NullPointerException();
    }//from w ww .  ja  v  a 2s  . com
    this.chart = chart;
}

From source file:net.alegen.datpass.library.Generator.java

public void setCurrentProfile(Profile profile) {
    if (profile == null)
        throw new NullPointerException();
    this.currentProfile = profile;
}

From source file:com.trickl.crawler.protocol.soap.SoapProtocol.java

@Override
public ManagedContentEntity load(URI uri) throws IOException {
    if (uri == null)
        throw new NullPointerException();

    ByteArrayOutputStream xmlOut = new ByteArrayOutputStream();
    StreamResult response = new StreamResult(xmlOut);
    boolean success = getWebServiceTemplate().sendSourceAndReceiveToResult(uri.toString(), getRequest(),
            new WebServiceMessageCallback() {
                // Set the SOAP header
                @Override/*w  w w.  ja v a  2 s . co  m*/
                public void doWithMessage(WebServiceMessage message) {
                    URI action = SoapProtocol.this.getAction();
                    if (action != null) {
                        ((SoapMessage) message).setSoapAction(action.toString());
                    }
                }
            }, response);

    if (!success) {
        throw new IOException("No soap response received from'" + uri.toString() + "'");
    }
    return new TransformResultContentEntity(xmlOut);
}

From source file:eu.europa.esig.dss.FileDocument.java

/**
 * Create a FileDocument/*from ww w.j  av  a2s  . co  m*/
 *
 * @param file {@code File}
 */
public FileDocument(final File file) {
    if (file == null) {
        throw new NullPointerException();
    }
    if (!file.exists()) {
        throw new DSSException("File Not Found: " + file.getAbsolutePath());
    }
    this.file = file;
    this.name = file.getName();
    this.mimeType = MimeType.fromFileName(file.getName());
}

From source file:cz.muni.fi.pa165.deliveryservice.service.CourierServiceImpl.java

@PreAuthorize("hasRole('ROLE_ADMIN')")
@Override// w w  w.j av a  2  s  .  c om
public void deleteCourier(CourierDTO courierDto) {
    if (courierDto == null) {
        throw new NullPointerException();
    }

    Courier courier = courierDao.findCourier(courierDto.getId());
    courier.setActive(Boolean.FALSE);
    courierDao.updateCourier(courier);
}

From source file:technology.tikal.ventas.model.producto.ofy.ProductoDeLineaOfy.java

public ProductoDeLineaOfy(LineaDeProductos linea, Catalogo owner) {
    super(owner);
    if (linea == null) {
        throw new NullPointerException();
    }//from   w  w  w  .  ja  v  a 2 s  . c  o  m
    if (linea.getId() == null) {
        throw new IllegalArgumentException();
    }
    this.refLinea = Ref.create(linea);
}