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:org.atemsource.atem.impl.json.attribute.DoubleAttribute.java

@Override
public Double getValue(Object entity) {
    ObjectNode node = (ObjectNode) entity;
    if (node.isNull()) {
        throw new NullPointerException("entity is null");
    } else {/*from   w ww . j  a  va 2 s.  c  o  m*/
        JsonNode jsonNode = node.get(getCode());
        if (jsonNode == null || jsonNode.isNull()) {
            return null;
        } else {
            if (!jsonNode.isNumber()) {
                throw new ConversionException(jsonNode.getValueAsText(), getTargetType());
            }
            return jsonNode.getDoubleValue();
        }
    }
}

From source file:org.atemsource.atem.impl.json.attribute.StringAttribute.java

@Override
public String getValue(Object entity) {
    ObjectNode node = (ObjectNode) entity;
    if (node.isNull()) {
        throw new NullPointerException("entity is null");
    } else {//from w w w . ja  v  a2 s  . c  om
        JsonNode jsonNode = node.get(getCode());
        if (jsonNode == null || jsonNode.isNull()) {
            return null;
        } else {
            if (!jsonNode.isTextual()) {
                throw new ConversionException(jsonNode.getValueAsText(), getTargetType());
            }
            return jsonNode.getTextValue();
        }
    }
}

From source file:org.atemsource.atem.impl.json.attribute.BooleanAttribute.java

@Override
public Boolean getValue(Object entity) {
    ObjectNode node = (ObjectNode) entity;
    if (node.isNull()) {
        throw new NullPointerException("entity is null");
    } else {/* w w w.  jav  a2s  .c om*/
        JsonNode jsonNode = node.get(getCode());
        if (jsonNode == null || jsonNode.isNull()) {
            return null;
        } else {
            if (!jsonNode.isBoolean()) {
                throw new ConversionException(jsonNode.getValueAsText(), getTargetType());
            }
            return jsonNode.getBooleanValue();
        }
    }
}

From source file:org.atemsource.atem.impl.json.attribute.IntegerAttribute.java

@Override
public Integer getValue(Object entity) {
    ObjectNode node = (ObjectNode) entity;
    if (node.isNull()) {
        throw new NullPointerException("entity is null");
    } else {// ww  w  .jav  a  2s. c om
        JsonNode jsonNode = node.get(getCode());
        if (jsonNode == null || jsonNode.isNull()) {
            return null;
        } else {
            if (!jsonNode.isNumber()) {
                throw new ConversionException(jsonNode.getValueAsText(), getTargetType());
            }
            return jsonNode.getIntValue();
        }
    }
}

From source file:gallery.web.controller.cms.IndexCmsController.java

public void init() {
    StringBuilder sb = new StringBuilder();
    common.utils.MiscUtils.checkNotNull(content_url, "content_url", sb);
    if (sb.length() > 0) {
        throw new NullPointerException(sb.toString());
    }//from w ww  .  j av  a  2 s  .c  o m
}

From source file:net.jcreate.e3.table.html.SessionStateManager.java

public SessionStateManager(String pId, WebContext pWebContext) {
    if (pId == null) {
        throw new NullPointerException("id?null");
    }//from  ww  w  . j a  v  a2s  .c  o m
    this.id = pId;
    this.webContext = pWebContext;
}

From source file:gallery.web.validator.wallpaper.comment.WallpaperCommentValidator.java

public void init() {
    StringBuilder sb = new StringBuilder();
    common.utils.MiscUtils.checkNotNull(wallpaperService, "wallpaperService", sb);
    if (sb.length() > 0) {
        throw new NullPointerException(sb.toString());
    }/*from   w w  w  . jav a2 s  .c o  m*/
}

From source file:com.navercorp.pinpoint.web.filter.URLPatternFilter.java

public URLPatternFilter(Filter fromToFilter, String urlPattern) {
    if (fromToFilter == null) {
        throw new NullPointerException("fromToFilter must not be null");
    }/*w ww. ja  v a  2 s.  c o  m*/
    this.fromToFilter = fromToFilter;
    this.urlPattern = new String(Base64.decodeBase64(urlPattern), Charset.forName("UTF-8"));
}

From source file:org.apache.tomee.spring.EJB.java

public EJB(BeanContext beanContext, InterfaceType interfaceType, Class<T> intf) {
    if (intf == null)
        throw new NullPointerException("interface is null");
    if (beanContext == null)
        throw new NullPointerException("beanContext is null");
    if (beanContext == null)
        throw new NullPointerException("interfaceType is null");

    this.beanContext = beanContext;
    this.intf = intf;
    this.interfaceType = interfaceType;
}

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

/**
 * Creates a new proxy instance.//from   ww w. j  a va  2  s.co m
 *
 * @param <P> proxy type parameter
 * @param <T> user decoder type parameter
 * @param proxyType proxy type
 * @param decoderType decoder type
 * @param decoder decoder
 *
 * @return a new instance.
 */
protected static <P extends AbstractDecoderProxy<T>, T> Object newInstance(final Class<P> proxyType,
        final Class<T> decoderType, final T decoder) {

    if (proxyType == null) {
        throw new NullPointerException("proxyType");
    }

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

    return newInstance(DECODER.getClassLoader(), new Class<?>[] { DECODER }, proxyType, decoderType, decoder);
}