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:net.larry1123.elec.util.logger.UtilFileHandler.java

@Override
public synchronized void setOutputStream(OutputStream out) throws SecurityException {
    if (out == null) {
        throw new NullPointerException();
    }//from w ww.  j a  va2s.c  om
    try {
        memoryOutputStream.writeTo(out);
    } catch (IOException e) {
        reportError("Unable to move temp buffer!", e, ErrorManager.WRITE_FAILURE);
    }
    super.setOutputStream(out);
}

From source file:StringUtils.java

static public int lastIndexOf(String toSearch, String toFind) {
    if (toSearch == null || toFind == null)
        throw new NullPointerException();
    //the dirty way:
    String toSearchReversed = (new StringBuffer(toSearch)).reverse().toString();
    String toFindReversed = (new StringBuffer(toFind)).reverse().toString();
    return toSearch.length() - (toSearchReversed.indexOf(toFindReversed) + toFind.length() - 1) - 1;
}

From source file:org.cloudfoundry.identity.uaa.codestore.InMemoryExpiringCodeStore.java

@Override
public ExpiringCode generateCode(String data, Timestamp expiresAt) {
    if (data == null || expiresAt == null) {
        throw new NullPointerException();
    }//from w  ww  . j  a  v  a2  s . co m

    if (expiresAt.getTime() < System.currentTimeMillis()) {
        throw new IllegalArgumentException();
    }

    String code = generator.generate();

    ExpiringCode expiringCode = new ExpiringCode(code, expiresAt, data);

    ExpiringCode duplicate = store.putIfAbsent(code, expiringCode);
    if (duplicate != null) {
        throw new DataIntegrityViolationException("Duplicate code: " + code);
    }

    return expiringCode;
}

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

public ProductoDeLineaOfy(ProductoDeLineaOfy base) {
    super(base);//from   ww  w  . j a  v  a2s .  c om
    if (base.refLinea == null) {
        throw new NullPointerException();
    }
    this.refLinea = base.refLinea;
}

From source file:com.rest4j.BinaryResource.java

public BinaryResource(String contentType, String etag, InputStream is) {
    super(contentType);
    this.etag = etag;
    if (is == null)
        throw new NullPointerException();
    this.is = is;
}

From source file:technology.tikal.ventas.model.pedido.ofy.SubPedidoOfy.java

public SubPedidoOfy(PedidoCompuesto owner) {
    this();// w w w. j  av  a 2  s.c  o  m
    if (owner == null) {
        throw new NullPointerException();
    }
    if (owner.getId() == null) {
        throw new IllegalArgumentException();
    }
    this.owner = Ref.create(owner);
}

From source file:org.a3badran.platform.logging.LogMethods.java

@LogRequest("logError")
public void logError() throws Exception {
    throw new NullPointerException();
}

From source file:com.liferay.portlet.StrutsResourceBundle.java

@Override
protected Object handleGetObject(String key) {
    if (key == null) {
        throw new NullPointerException();
    }//from   w w  w . j ava  2s  . com
    if ((key.equals(JavaConstants.JAVAX_PORTLET_DESCRIPTION) || key.equals(JavaConstants.JAVAX_PORTLET_KEYWORDS)
            || key.equals(JavaConstants.JAVAX_PORTLET_LONG_TITLE)
            || key.equals(JavaConstants.JAVAX_PORTLET_SHORT_TITLE)
            || key.equals(JavaConstants.JAVAX_PORTLET_TITLE))) {

        key = key.concat(StringPool.PERIOD).concat(_portletName);
    }
    String value = StringUtils.EMPTY;
    try {
        value = ResourceBundleUtil.getString(_locale, key);
    } catch (Exception e) {
        _logger.error(e.getMessage());
    }
    if (StringUtils.isBlank(value))
        LanguageUtil.get(_locale, key);
    if ((value == null) && ResourceBundleThreadLocal.isReplace()) {
        value = ResourceBundleUtil.NULL_VALUE;
    }
    return value;
}

From source file:pdsanchez.mywebtools.model.service.ToolsSvcImpl.java

@Override
public void updateTool(Tool tool) {
    if (tool == null) {
        throw new NullPointerException();
    }//w w  w  .j  a v  a  2 s.c om

    toolDAO.update(tool);
}

From source file:technology.tikal.accounts.model.InternalAccount.java

public InternalAccount(Account source) {
    this();/* w  w  w .  ja v  a  2 s .  c  o  m*/
    if (source.getUser() == null) {
        throw new NullPointerException();
    }
    this.idUser = StringUtils.lowerCase(source.getUser());
    this.setUser(source.getUser());
    this.setPassword(source.getPassword());
    this.setPersonalInfo(source.getPersonalInfo());
    this.setStatus(source.getStatus());
    this.setRole(source.getRole());
    otpInfo = new OtpInfo();
}