List of usage examples for java.lang NullPointerException NullPointerException
public NullPointerException(String s)
From source file:edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties.java
public static ConfigurationProperties getBean(ServletContextEvent sce) { if (sce == null) { throw new NullPointerException("sce may not be null."); }//w w w .java 2 s .c o m return getBean(sce.getServletContext()); }
From source file:name.osipov.alexey.server.ServerHandler.java
public ServerHandler(Users users) { if (users == null) throw new NullPointerException("users must not be null"); this.users = users; }
From source file:Main.java
/** * This method returns the first non-null owner document of the Nodes in this Set. * This method is necessary because it <I>always</I> returns a * {@link Document}. {@link Node#getOwnerDocument} returns <CODE>null</CODE> * if the {@link Node} is a {@link Document}. * * @param xpathNodeSet//from www . j a v a 2s .c om * @return the owner document */ public static Document getOwnerDocument(Set<Node> xpathNodeSet) { NullPointerException npe = null; for (Node node : xpathNodeSet) { int nodeType = node.getNodeType(); if (nodeType == Node.DOCUMENT_NODE) { return (Document) node; } try { if (nodeType == Node.ATTRIBUTE_NODE) { return ((Attr) node).getOwnerElement().getOwnerDocument(); } return node.getOwnerDocument(); } catch (NullPointerException e) { npe = e; } } throw new NullPointerException(npe.getMessage()); }
From source file:edu.cornell.mannlib.vitro.webapp.controller.freemarker.FlatteningTemplateLoader.java
public FlatteningTemplateLoader(File baseDir) { if (baseDir == null) { throw new NullPointerException("baseDir may not be null."); }/* w ww. j a va2 s .c o m*/ if (!baseDir.exists()) { throw new IllegalArgumentException( "Template directory '" + baseDir.getAbsolutePath() + "' does not exist"); } if (!baseDir.isDirectory()) { throw new IllegalArgumentException( "Template directory '" + baseDir.getAbsolutePath() + "' is not a directory"); } if (!baseDir.canRead()) { throw new IllegalArgumentException( "Can't read template " + "directory '" + baseDir.getAbsolutePath() + "'"); } log.debug("Created template loader - baseDir is '" + baseDir.getAbsolutePath() + "'"); this.baseDir = baseDir; }
From source file:com.cyclopsgroup.waterview.jelly.JellyLayout.java
/** * Constructor for class JellyScriptLayout * * @param script Jelly script object/*from w ww . ja v a 2 s. c o m*/ * @param modulePath Path of module */ public JellyLayout(Script script, String modulePath) { super(modulePath); this.script = script; if (script == null) { throw new NullPointerException("Script can not be null"); } }
From source file:com.pkstudio.hive.exceptions.rest.RestError.java
public RestError(HttpStatus status, int code, String message, String developerMessage, String moreInfoUrl, Throwable throwable, List<FieldError> fieldErrors) { if (status == null) { throw new NullPointerException("HttpStatus argument cannot be null."); }/*from w w w .java2s. c o m*/ this.status = status; this.code = code; this.message = message; this.developerMessage = developerMessage; this.moreInfoUrl = moreInfoUrl; this.throwable = throwable; this.fieldErrors = fieldErrors; }
From source file:net.happyonroad.component.container.support.DefaultComponentResolver.java
public DefaultComponentResolver(MutableComponentRepository repository) { if (repository == null) { throw new NullPointerException("The repository can't be null"); }/*from w w w .j a v a 2 s. co m*/ this.repository = repository; customizeXstream(); }
From source file:com.cisco.gerrit.plugins.slack.message.ChangeMergedMessageGenerator.java
/** * Creates a new ChangeMergedMessageGenerator instance using the provided ChangeMergedEvent * instance.//from w w w . ja va 2s .c o m * * @param event The ChangeMergedEvent instance to generate a message for. */ ChangeMergedMessageGenerator(ChangeMergedEvent event, ProjectConfig config) { if (event == null) { throw new NullPointerException("event cannot be null"); } this.event = event; this.config = config; }
From source file:com.lanhun.framework.service.DemoService.java
public int save(Country country) { if (country == null) { throw new NullPointerException("??!"); }// w ww . j av a 2s . c o m if (country.getCountrycode() == null || country.getCountrycode().equals("")) { throw new RuntimeException("??!"); } if (country.getCountryname() == null || country.getCountryname().equals("")) { throw new RuntimeException("???!"); } return super.save(country); }
From source file:net.ontopia.persistence.query.jdo.JDONativeValue.java
public JDONativeValue(JDOVariable root, String[] args, Class value_type) { if (root == null) throw new NullPointerException("Value root cannot be null."); if (args == null || args.length < 1) throw new NullPointerException("Field args cannot be null."); if (value_type == null) throw new NullPointerException("Value value_type cannot be null."); this.root = root; this.args = args; this.value_type = value_type; }