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(String s) 

Source Link

Document

Constructs a NullPointerException with the specified detail message.

Usage

From source file:com.bigml.histogram.SimpleTarget.java

@Override
protected void appendTo(final Appendable appendable, final DecimalFormat format) throws IOException {
    if (appendable == null) {
        throw new NullPointerException("appendable must not be null");
    }/*from ww  w. j av  a 2 s .co m*/
    if (format == null) {
        throw new NullPointerException("format must not be null");
    }
    // empty
}

From source file:com.enonic.cms.core.CaseInsensitiveString.java

public CaseInsensitiveString(String s) {
    if (s == null) {
        throw new NullPointerException("CaseInsensitiveString may not take a null value.");
    }//from   www  . j a v  a 2  s .  co m
    caseInsensitiveValue = s;
}

From source file:com.squarespace.gibson.GibsonUtils.java

public static String signature(ILoggingEvent evt) {
    if (evt == null) {
        throw new NullPointerException("event");
    }//from   w  w  w  . j a v  a2s  . c  om

    MessageDigest md = FACTORY.newMessageDigest();

    append(md, evt.getLoggerName());
    append(md, getMarker(evt));
    append(md, getLevel(evt));

    ThrowableProxy proxy = (ThrowableProxy) evt.getThrowableProxy();
    if (proxy != null) {
        append(md, proxy.getThrowable());
    }

    return Base64.encodeBase64URLSafeString(md.digest());
}

From source file:com.github.jinahya.codec.commons.BinaryEncoderProxy.java

protected static <P extends AbstractEncoderProxy<T>, T> Object newInstance(final Class<P> proxyType,
        final Class<T> encoderType, final T encoder) {

    if (proxyType == null) {
        throw new NullPointerException("proxyType");
    }/*  ww w. j  a v a2s .  c o  m*/

    if (!BinaryEncoderProxy.class.isAssignableFrom(proxyType)) {
        throw new IllegalArgumentException(
                "proxyType(" + proxyType + ") is not assignable to " + BinaryEncoderProxy.class);
    }

    return newInstance(ENCODER.getClassLoader(), new Class<?>[] { ENCODER }, proxyType, encoderType, encoder);
}

From source file:com.vehicles.service.GenericServiceImpl.java

@Override
public void save(T entity) throws Exception {
    if (entity == null) {
        throw new NullPointerException("Can't save null entity!");
    } else {// w  w  w.  j a  v  a 2s  .  com
        this.repository.save(entity);
    }
}

From source file:com.robin.uielements.TranslationMap.java

/**
 * Returns the TranslationFile object stored in memory by its file relative
 * filename to the TLXML base dir.//w w  w  . java2s  . co  m
 * @param filePath the name and relative path of the file parsed
 * @return the file representation  with content from the xml
 */
public static TranslationFile getTranslationsByName(final String filePath) {
    TranslationFile page = ELEMENTMAP.get(filePath);
    if (page == null) {
        throw new NullPointerException("Could not find '" + filePath + "' UIPage.");
    }
    return page;
}

From source file:edu.cornell.mannlib.vitro.webapp.auth.policy.RequestPolicyList.java

/**
 * Get the current list of policy additions from the request, or create one
 * if there is none. This method may return an empty list, but it never
 * returns null./*  w  ww  .j a v a  2  s . c  o  m*/
 */
private static PolicyList getPoliciesFromRequest(ServletRequest request) {
    if (request == null) {
        throw new NullPointerException("request may not be null.");
    }

    Object obj = request.getAttribute(ATTRIBUTE_POLICY_ADDITIONS);
    if (obj == null) {
        obj = new PolicyList();
        request.setAttribute(ATTRIBUTE_POLICY_ADDITIONS, obj);
    }

    if (!(obj instanceof PolicyList)) {
        throw new IllegalStateException("Expected to find an instance of " + PolicyList.class.getName()
                + " in the context, but found an instance of " + obj.getClass().getName() + " instead.");
    }

    return (PolicyList) obj;
}

From source file:hd3gtv.embddb.MainClass.java

private static List<InetSocketAddress> importConf(PoolManager poolmanager, Properties conf, int default_port)
        throws Exception {
    if (conf.containsKey("hosts") == false) {
        throw new NullPointerException("No hosts in configuration");
    }/* w  w w . j av a  2s .  c o m*/
    String hosts = conf.getProperty("hosts");

    return Arrays.asList(hosts.split(" ")).stream().map(addr -> {
        if (addr.isEmpty() == false) {
            log.debug("Found host in configuration: " + addr);
            return new InetSocketAddress(addr, default_port);
        } else {
            return null;
        }
    }).filter(addr -> {
        return addr != null;
    }).collect(Collectors.toList());
}

From source file:cz.muni.pa165.carparkapp.DAOImpl.BranchDAOImpl.java

@Override
public Branch createBranch(Branch branch) {
    if (branch == null)
        throw new NullPointerException("Argument cannot be null");

    em.persist(branch);//from  w  w  w . j  av  a2 s  .  c om
    return branch;
}

From source file:com.navercorp.pinpoint.collector.cluster.zookeeper.job.ZookeeperJob.java

public ZookeeperJob(Type type, String key) {
    if (type == null) {
        throw new NullPointerException("type must not be null");
    }/*from   w  w w  . j  av a2  s  . c o  m*/

    this.type = type;
    this.key = key;
}