List of usage examples for java.lang AssertionError AssertionError
public AssertionError(double detailMessage)
double
, which is converted to a string as defined in section 15.18.1.1 of The Java™ Language Specification. From source file:Main.java
/** * XML encodes an attribute value, encoding some characters as * character entities, and dropping invalid control characters. * * @param attrValue the attribute value// w w w . ja v a 2 s . com * @param buf the {@code StringBuffer} to which to append the attribute * * @deprecated - Use {@link #xmlAppendAttrValue(String, Appendable)}. */ @Deprecated public static void XmlEncodeAttrValue(String attrValue, StringBuffer buf) { try { xmlAppendAttrValue(attrValue, buf); } catch (IOException e) { // This can't happen with StringBuffer. throw new AssertionError(e); } }
From source file:Main.java
/** Builds an XPath. This is identical to calling * <tt>XPathFactory.newInstance().newXPath().compile(expression)</tt> except * that rather than throwing an {@link XPathExpressionException} it throws an * {@link AssertionError}. <br>/* w w w. ja v a 2s .co m*/ * <br> * This is intended for use with pre-defined XPaths stored as constants, * where runtime exceptions should not be possible. * @param expression The XPath expression to compile. * @throws AssertionError If the nested call to <tt>XPath.newInstance(path)</tt> * throws an {@link XPathExpressionException}. */ public static synchronized XPathExpression xpath(String expression) { if (xPath == null) xPath = XPathFactory.newInstance().newXPath(); try { return xPath.compile(expression); } catch (XPathExpressionException e) { throw new AssertionError("Error initializing XPath instance for '" + expression + "': " + e); } }
From source file:de.hotware.hibernate.query.intelligent.structure.Util.java
private Util() { throw new AssertionError("can't touch this"); }
From source file:com.callidusrobotics.MythosRL.java
private MythosRL() { throw new AssertionError("Do not instantiate this class."); }
From source file:com.hurence.logisland.utils.HttpUtils.java
/** * Take a url query string and split it into a map of key/values map * * @param urlQuery/* ww w . j ava 2 s . c om*/ * @return */ public static List<String> getQueryKeys(String urlQuery) { try { List<String> keys = new ArrayList<>(); if (urlQuery == null) { return keys; } for (String param : urlQuery.split("&")) { QueryParam queryParam = new QueryParam(); String[] pair = param.split("="); String key = URLDecoder.decode(pair[0], "UTF-8"); if (key != null && !key.equals("null")) { keys.add(key); } } return keys; } catch (UnsupportedEncodingException ex) { throw new AssertionError(ex); } }
From source file:Main.java
public static Map<String, List<String>> getLocationFromUrl(String string) { try {//from w w w .j a v a 2 s.com Map<String, List<String>> params = new HashMap<String, List<String>>(); String[] urlParts = string.split("\\?"); if (urlParts.length > 1) { String query = urlParts[1]; for (String param : query.split("&")) { String[] pair = param.split("="); String key = URLDecoder.decode(pair[0], "UTF-8"); String value = ""; if (pair.length > 1) { value = URLDecoder.decode(pair[1], "UTF-8"); } List<String> values = params.get(key); if (values == null) { values = new ArrayList<String>(); params.put(key, values); } values.add(value); } } return params; } catch (UnsupportedEncodingException ex) { throw new AssertionError(ex); } }
From source file:com.callidusrobotics.object.ItemFactory.java
private ItemFactory() { throw new AssertionError("Do not instantiate this class."); }
From source file:edu.umd.cs.psl.ui.data.graph.BinaryRelation.java
public BinaryRelation(RT type, Entity<ET, RT> _first, Entity<ET, RT> _second) { super(type);//from w ww . j ava2 s.co m if (type.arity() != 2) throw new AssertionError("Expected binary relation type!"); first = _first; second = _second; }
From source file:com.googlecode.vfsjfilechooser2.utils.FileObjectComparatorFactory.java
private FileObjectComparatorFactory() { throw new AssertionError("Trying to instanciate FileObjectComparatorFactory"); }
From source file:com.erinors.hpb.tests.HpbTestUtils.java
public static void assertEqualsByCloneableFields(Object o1, Object o2) { if (o1 == null || o2 == null || o1.getClass() != o2.getClass()) { throw new IllegalArgumentException( "Non-null objects of same class expected but got: " + o1 + ", " + o2); }// w w w. j a v a 2 s . c om List<Field> fields = new LinkedList<Field>(); ClassUtils.collectCloneableFields(o1.getClass(), fields); for (Field field : fields) { try { ReflectionUtils.makeAccessible(field); Object fieldValue1 = field.get(o1); Object fieldValue2 = field.get(o2); if (!equal(fieldValue1, fieldValue2)) { throw new AssertionError("Field value mismatch: " + field + ", value1=" + fieldValue1 + ", value2=" + fieldValue2); } } catch (Exception e) { throw new RuntimeException("Cannot copy field: " + field, e); } } }