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:common.web.controller.StatisticController.java

public void init() {
    StringBuilder sb = new StringBuilder();
    common.utils.MiscUtils.checkNotNull(conf, "conf", sb);
    common.utils.MiscUtils.checkNotNull(content_url, "content_url", sb);
    common.utils.MiscUtils.checkNotNull(navigation_url, "navigation_url", sb);
    if (sb.length() > 0) {
        throw new NullPointerException(sb.toString());
    }//ww w.  ja  v  a2  s. co  m
}

From source file:com.googlecode.psiprobe.tools.logging.log4j.Log4JManagerAccessor.java

public Log4JLoggerAccessor getRootLogger() {
    try {/*from  www .  jav  a2  s. co  m*/
        Class clazz = (Class) getTarget();
        Method m = MethodUtils.getAccessibleMethod(clazz, "getRootLogger", new Class[] {});
        Object logger = m.invoke(null, null);
        if (logger == null) {
            throw new NullPointerException(getTarget().getClass().getName() + "#getRootLogger() returned null");
        }
        Log4JLoggerAccessor accessor = new Log4JLoggerAccessor();
        accessor.setTarget(logger);
        accessor.setApplication(getApplication());
        return accessor;
    } catch (Exception e) {
        log.error(getTarget().getClass().getName() + "#getRootLogger() failed", e);
    }
    return null;
}

From source file:com.redhat.rhn.domain.action.ActionFormatter.java

/**
 * Create an ActionFormatter with the associated Action.
 * @param actionIn the Action we associate with this Formatter
 *//*w  w  w.j a  va  2s . com*/
public ActionFormatter(Action actionIn) {
    if (actionIn == null) {
        throw new NullPointerException("ActionIn must not be null");
    }
    this.action = actionIn;
}

From source file:edu.cornell.mannlib.vitro.webapp.searchengine.SearchEngineWrapper.java

public SearchEngineWrapper(SearchEngine innerEngine) {
    if (innerEngine == null) {
        throw new NullPointerException("innerEngine may not be null.");
    }/* ww  w .  ja  v  a2s .  co  m*/
    this.innerEngine = innerEngine;
}

From source file:epgtools.libepgupdate.updator.config.Config.java

/**
 * Updater????/* w w  w  .j  av  a  2s .c  om*/
 *
 * @param connection ?DB??
 * @param xMLDirectory EPG XML???????
 * @param xMLFileCharCode EPG XML?
 * @param paidBroadcastings ?????????(??)
 */
public Config(java.sql.Connection connection, File xMLDirectory, Charset xMLFileCharCode,
        Set<Integer> paidBroadcastings) throws NullPointerException, IllegalArgumentException {
    if (connection != null) {
        this.connection = connection;
    } else {
        throw new NullPointerException("DB??????");
    }
    if (xMLDirectory != null && xMLDirectory.isDirectory()) {
        this.xMLDirectory = new File(xMLDirectory.getAbsolutePath());
    } else {
        throw new IllegalArgumentException(
                "XML??????????");
    }
    if (xMLFileCharCode != null) {
        this.xMLFileCharCode = xMLFileCharCode;
    } else {
        throw new NullPointerException("XML???????");
    }
    if (paidBroadcastings != null && paidBroadcastings.size() >= 0) {
        Set<Integer> tempPaidBroadcastings = new HashSet<>();
        tempPaidBroadcastings.addAll(paidBroadcastings);
        this.paidBroadcastings = Collections.unmodifiableSet(tempPaidBroadcastings);
    } else {
        throw new IllegalArgumentException(
                "?????????????");
    }
}

From source file:hd3gtv.storage.AbstractFileBridgeFtpNexio.java

public AbstractFileBridgeFtpNexio(StorageConfigurator configurator) throws IOException {
    this.configurator = configurator;
    if (configurator == null) {
        throw new NullPointerException("\"configurator\" can't to be null");
    }//from  ww w  .  j  av a  2s  .  co  m
    path = configurator.path.replaceAll("/", "").toUpperCase();
}

From source file:com.cyclopsgroup.waterview.jelly.ScriptView.java

/**
 * Constructor for class ScriptView/*from  w  w w.j a va2s  .c om*/
 *
 * @param script Script object
 * @param module Module to run
 */
public ScriptView(Script script, Module module) {
    if (script == null) {
        throw new NullPointerException("Script can not be null");
    }
    this.script = script;
    setModule(module);
}

From source file:Main.java

public static void show(Context context, int resId, int duration) throws NullPointerException {
    if (null == context)
        throw new NullPointerException("The context is null!");
    duration = duration > 0 ? LENGTH_LONG : LENGTH_SHORT;
    toast(context, context.getResources().getString(resId), duration);
}

From source file:gov.nih.nci.cabig.caaers.web.ae.MandatoryProperties.java

private void add(TreeNode node) {
    if (node == null)
        throw new NullPointerException("Cannot add null nodes");
    mandatoryNodes.add(node);/*from   w w  w. ja va2s  . c o  m*/
}

From source file:org.key2gym.business.services.AdministratorsServiceBean.java

@Override
public AdministratorDTO getById(Integer id) {

    if (id == null) {
        throw new NullPointerException("The id is null."); // NOI18N
    }/*w w w.ja v a2  s  . c  o m*/

    Administrator administrator = getEntityManager().find(Administrator.class, id);

    // TODO: null check here

    return convertToDTO(administrator);
}