List of usage examples for java.lang NullPointerException NullPointerException
public NullPointerException(String s)
From source file:com.github.luuuis.myzone.preference.TimeZoneInfo.java
/** * Returns a new TimeZoneInfo instance that wraps the given DateTimeZone. * * @param timezone a DateTimeZone/*from w w w . j ava 2s. c o m*/ * @return a TimeZoneInfo */ public static TimeZoneInfo from(DateTimeZone timezone) { if (timezone == null) { throw new NullPointerException("timezone"); } return new TimeZoneInfo(timezone); }
From source file:com.gistlabs.mechanize.document.json.node.impl.ArrayNodeImpl.java
public ArrayNodeImpl(final JsonNode parent, final String key, final JSONArray array) { super(parent, key); if (array == null) throw new NullPointerException("JSONArray can't be null"); this.array = array; }
From source file:libepg.util.bytearray.ByteDataBlock.java
public ByteDataBlock(byte[] data) throws NullPointerException { if (data == null) { throw new NullPointerException("???????????"); }//from w ww . ja v a 2 s. co m //? this.data = Arrays.copyOf(data, data.length); }
From source file:com.amazonaws.retry.internal.AuthRetryParameters.java
public AuthRetryParameters(Signer signer, URI endpoint) { if (signer == null) throw new NullPointerException("signer"); if (endpoint == null) throw new NullPointerException("endpoint"); this.signerForRetry = signer; this.endpointForRetry = endpoint; }
From source file:org.liberty.android.fantastischmemo.downloader.DownloaderUtils.java
public static String downloadJSONString(String url) throws Exception { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpResponse response;/*from w w w .ja v a 2s . com*/ response = httpclient.execute(httpget); Log.i(TAG, "Response: " + response.getStatusLine().toString()); HttpEntity entity = response.getEntity(); if (entity == null) { throw new NullPointerException("Null entity error"); } InputStream instream = entity.getContent(); // Now convert stream to string BufferedReader reader = new BufferedReader(new InputStreamReader(instream)); StringBuilder sb = new StringBuilder(); String line = null; String result = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } result = sb.toString(); return result; }
From source file:com.jfinal.ext.plugin.sqlinxml.SqlKit.java
public static SqlClauseItem.SqlExceptSelect sqlExceptSelect(String groupNameAndsqlId) { if (sqlMap == null) { throw new NullPointerException("SqlInXmlPlugin not start"); }/* www .ja va 2 s. co m*/ return ((SqlClauseItem) sqlMap.get(groupNameAndsqlId)).sqlExceptSelect; }
From source file:com.sf.ddao.shards.TestShardingService.java
public DataSource getShard(Long id, Context ctx) { if (id == null) { throw new NullPointerException("Shard key is not defined"); }/* ww w .j av a 2s .com*/ if (1 <= id && id <= 10) { return ds1; } if (11 <= id && id <= 20) { return ds2; } return null; }
From source file:edu.cornell.mannlib.vitro.webapp.auth.identifier.common.IsBlacklisted.java
/** * If this individual is blacklisted, return an appropriate Identifier. * Otherwise, return null./* ww w. j av a2 s . com*/ */ public static IsBlacklisted getInstance(Individual individual, ServletContext context) { if (individual == null) { throw new NullPointerException("individual may not be null."); } if (context == null) { throw new NullPointerException("context may not be null."); } String reasonForBlacklisting = checkForBlacklisted(individual, context); IsBlacklisted id = new IsBlacklisted(individual.getURI(), reasonForBlacklisting); if (id.isBlacklisted()) { return id; } else { return null; } }
From source file:fr.univlorraine.mondossierweb.utils.PropertyUtils.java
/** Retourne le nom du cluster elasticSearch */ public static String getElasticSearchCluster() { String value = System.getProperty("context.param.elasticsearch.cluster"); if (!StringUtils.hasText(value)) throw new NullPointerException("param.elasticsearch.cluster cannot be null !"); return value; }
From source file:edu.dfci.cccb.mev.dataset.domain.tsv.UrlTsvInput.java
public UrlTsvInput(URL url) { if (url == null) throw new NullPointerException("URL cannot be null"); this.url = url; }