List of usage examples for java.lang NullPointerException NullPointerException
public NullPointerException(String s)
From source file:com.googlecode.psiprobe.tools.logging.jdk.Jdk14ManagerAccessor.java
public Jdk14ManagerAccessor(ClassLoader cl) throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Class clazz = cl.loadClass("java.util.logging.LogManager"); Method getManager = MethodUtils.getAccessibleMethod(clazz, "getLogManager", new Class[] {}); Object manager = getManager.invoke(null, null); if (manager == null) { throw new NullPointerException(clazz.getName() + ".getLogManager() returned null"); }/*from w w w. j a v a 2 s .co m*/ setTarget(manager); }
From source file:ae.config.field.AbstractMetaField.java
protected AbstractMetaField(final ActiveEntity ae) { if (ae == null) { throw new NullPointerException("ae"); }/*from ww w .j av a 2 s . c o m*/ this.ae = ae; }
From source file:ch.ralscha.extdirectspring_itest.ExceptionFormPostController.java
@ExtDirectMethod(value = ExtDirectMethodType.FORM_POST, group = "itest_upload") @RequestMapping(value = "/throwIt", method = RequestMethod.POST) public void throwAException(@SuppressWarnings("unused") HttpServletRequest request) { throw new NullPointerException("a null pointer"); }
From source file:com.multimedia.service.wallpaper.comment.WallpaperCommentViewService.java
public void init() { StringBuilder sb = new StringBuilder(); common.utils.MiscUtils.checkNotNull(service, "service", sb); if (sb.length() > 0) { throw new NullPointerException(sb.toString()); }/* w ww . j a v a 2s . co m*/ }
From source file:com.github.jinahya.codec.commons.DecoderProxy.java
/** * Creates a new proxy instance for//from w ww. j a va2 s . c om * {@link org.apache.commons.codec.Decoder}. * * @param <P> proxy type parameter. * @param <T> decoder type parameter. * @param proxyType proxy type. * @param decoderType decoder type. * @param decoder decoder instance. * * @return a new proxy 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 (!DecoderProxy.class.isAssignableFrom(proxyType)) { throw new IllegalArgumentException( "proxyType(" + proxyType + ") is not assignable to " + DecoderProxy.class); } return newInstance(DECODER.getClassLoader(), new Class<?>[] { DECODER }, proxyType, decoderType, decoder); }
From source file:com.github.jinahya.codec.commons.EncoderProxy.java
/** * Creates a new proxy instance for/*from w ww . j av a2s.c o m*/ * {@link org.apache.commons.codec.Encoder}. * * @param <P> proxy type parameter * @param <T> encoder (delegate) type parameter * @param proxyType proxy type * @param encoderType encoder type * @param encoder encoder instance * * @return a new proxy instance. */ protected static <P extends AbstractEncoderProxy<T>, T> Object newInstance(final Class<P> proxyType, final Class<T> encoderType, final T encoder) { if (proxyType == null) { throw new NullPointerException("proxyType"); } if (!EncoderProxy.class.isAssignableFrom(proxyType)) { throw new IllegalArgumentException( "proxyType(" + proxyType + ") is not assignable to " + EncoderProxy.class); } return newInstance(ENCODER.getClassLoader(), new Class<?>[] { ENCODER }, proxyType, encoderType, encoder); }
From source file:jef.tools.Assert.java
/** * null/*from www . ja va 2s . c o m*/ * @param obj */ public static void isNull(Object obj, String msg) { if (obj != null) throw new NullPointerException(msg); }
From source file:fr.recolnat.database.RightsManagementDatabase.java
public DataModel.Enums.AccessRights getAccessRights(String user, String node) { if (user == null) { throw new NullPointerException("User is null"); }/*from w ww. jav a 2s . c om*/ if (node == null) { throw new NullPointerException("Node id is null"); } while (database.isClosed()) { try { Thread.sleep(500); } catch (InterruptedException ex) { return null; } } log.debug("getAccessRights " + user + " " + node); Map<String, Integer> userRights = database.treeMap(user, Serializer.STRING, Serializer.INTEGER) .createOrOpen(); Integer rights = userRights.get(node); // This commit is called because createOrOpen is used earlier. database.commit(); if (rights != null) { return DataModel.Enums.AccessRights.fromInt(rights); } else { return DataModel.Enums.AccessRights.NONE; } }
From source file:br.bireme.mlts.utils.Document2JSON.java
public static JSONObject getJSON(final Map<String, List<Fieldable>> map) { if (map == null) { throw new NullPointerException("map"); }//from www. j a va2 s .c om final JSONObject jobj = new JSONObject(); for (Map.Entry<String, List<Fieldable>> entry : map.entrySet()) { final String key = entry.getKey(); final List<Fieldable> value = entry.getValue(); final boolean multivalue = value.size() > 1; if (multivalue) { final JSONArray array = new JSONArray(); jobj.put(key, array); for (Fieldable fld : value) { array.add(getObject(fld)); } } else { jobj.put(key, getObject(value.get(0))); } } return jobj; }
From source file:com.jfinal.ext.plugin.sqlinxml.SqlKit.java
public static SqlClauseItem.SqlSelect sqlSelect(String groupNameAndsqlId) { if (sqlMap == null) { throw new NullPointerException("SqlInXmlPlugin not start"); }/*w ww. ja v a2s .c om*/ return ((SqlClauseItem) sqlMap.get(groupNameAndsqlId)).sqlSelect; }