List of usage examples for java.lang Error Error
public Error(Throwable cause)
From source file:jp.tricreo.ddd.base.lifecycle.impl.OnMemoryRepository.java
@Override @SuppressWarnings("unchecked") public OnMemoryRepository<T> clone() { try {/* w w w . j a v a 2 s .com*/ return (OnMemoryRepository<T>) super.clone(); } catch (CloneNotSupportedException e) { throw new Error("clone not supported"); } }
From source file:com.google.walkaround.wave.server.rpc.HistoryHandler.java
@Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { try {//from w w w .jav a 2 s . c o m inner(req, resp); } catch (JSONException e) { throw new Error(e); } catch (SlobNotFoundException e) { throw new BadRequestException("Object not found or access denied", e); } catch (AccessDeniedException e) { throw new BadRequestException("Object not found or access denied", e); } }
From source file:com.t3.guid.GUID.java
/** Creates a new GUID based on the specified hexadecimal-code string. */ public GUID(String strGUID) { if (strGUID == null) throw new InvalidGUIDException("GUID is null"); try {//from w w w .j a v a 2 s . co m this.baGUID = Hex.decodeHex(strGUID.toCharArray()); } catch (DecoderException e) { throw new Error(e); } validateGUID(); }
From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDataPropertyFormGenerator.java
@Override public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) { String subjectUri = vreq.getParameter("subjectUri"); Individual subject = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(subjectUri); if (subject == null) throw new Error("In DefaultDataPropertyFormGenerator, could not find individual for URI " + subjectUri); String predicateUri = vreq.getParameter("predicateUri"); WebappDaoFactory unfilteredWdf = vreq.getUnfilteredWebappDaoFactory(); DataProperty dataproperty = unfilteredWdf.getDataPropertyDao().getDataPropertyByURI(predicateUri); dataproperty = vreq.getWebappDaoFactory().getDataPropertyDao().getDataPropertyByURI(predicateUri); if (dataproperty == null) { // No dataproperty will be returned for rdfs:label, but we shouldn't throw an error. // This is controlled by the Jena layer, so we can't change the behavior. if (!predicateUri.equals(VitroVocabulary.LABEL)) { log.error("Could not find data property '" + predicateUri + "' in model"); throw new Error("Could not find DataProperty in model: " + predicateUri); }/*from w w w .j ava2s .c om*/ } String rangeDatatypeUri = dataproperty.getRangeDatatypeURI(); if (rangeDatatypeUri == null || rangeDatatypeUri.trim().isEmpty()) { rangeDatatypeUri = vreq.getWebappDaoFactory().getDataPropertyDao().getRequiredDatatypeURI(subject, dataproperty); } Integer dataHash = EditConfigurationUtils.getDataHash(vreq); boolean update = (dataHash != null); EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo(); initBasics(editConfiguration, vreq); initPropertyParameters(vreq, session, editConfiguration); editConfiguration.setTemplate("defaultDataPropertyForm.ftl"); editConfiguration.setDatapropKey(dataHash); editConfiguration.setVarNameForSubject("subject"); editConfiguration.setVarNameForPredicate("predicate"); editConfiguration.setVarNameForObject(literalVar); editConfiguration.setLiteralsOnForm(Arrays.asList(literalVar)); FieldVTwo literalField = new FieldVTwo().setName(literalVar).setRangeDatatypeUri(rangeDatatypeUri); editConfiguration.addField(literalField); editConfiguration.addValidator(new AntiXssValidation()); // An empty field on an update gets special treatment if (update) { // on update, allow an empty field and deal with it in DefaultDataPropEmptyField // see comments in DefaultDataPropEmptyField and VITRO-432 editConfiguration.addModelChangePreprocessor(new DefaultDataPropEmptyField()); editConfiguration.setN3Optional(Arrays.asList(dataPropN3)); } else { //on new, don't allow an empty field literalField.setValidators(list("nonempty")); editConfiguration.setN3Required(Arrays.asList(dataPropN3)); } // if the property has a rangeDatatypeUri, validate it if (rangeDatatypeUri != null) { editConfiguration.addValidator(new DefaultDataPropertyFormValidator(rangeDatatypeUri, vreq)); } //prepare prepare(vreq, editConfiguration); return editConfiguration; }
From source file:com.genentech.chemistry.openEye.apps.SdfRMSDSphereExclusion.java
private SdfRMSDSphereExclusion(String refFile, String outFile, double radius, boolean printAll, boolean doMirror, boolean doOptimize, String groupBy) { this.radius = radius; this.printAll = printAll; this.doMirror = doMirror; this.groupByTag = groupBy; this.doOptimize = doOptimize; if (refFile != null && groupBy != null) throw new Error("groupBy and refFile may not be used together!"); if (refFile != null) { OEMolBase mol = new OEGraphMol(); oemolithread ifs = new oemolithread(refFile); while (oechem.OEReadMolecule(ifs, mol)) { selected.add(new OEGraphMol(mol)); }// w ww.j a v a 2 s . co m ifs.close(); ifs.delete(); mol.delete(); } outputOEThread = new oemolothread(outFile); }
From source file:com.googlecode.sisme.filesystem.websphere.ConfigRepository.java
public DocumentContentSource extract(String docURI) throws JMException, IOException { DocumentContentSource result = new DocumentContentSource(); try {/*from w w w .jav a2 s.co m*/ beanUtils.copyProperties(result, connection.invoke(target, "extract", new Object[] { docURI }, new String[] { "java.lang.String" })); } catch (IllegalAccessException ex) { throw new Error(ex); } catch (InvocationTargetException ex) { throw new Error(ex); } return result; }
From source file:MathUtil.java
/** * Method that calculates the Least Common Multiple (LCM) of several * positive integer numbers./*from w ww . j av a 2 s.com*/ * * @param x Array containing the numbers. * */ public static final int lcm(int[] x) { if (x.length < 2) { throw new Error("Do not use this method if there are less than" + " two numbers."); } int tmp = lcm(x[x.length - 1], x[x.length - 2]); for (int i = x.length - 3; i >= 0; i--) { if (x[i] <= 0) { throw new IllegalArgumentException("Cannot compute the least " + "common multiple of " + "several numbers where " + "one, at least," + "is negative."); } tmp = lcm(tmp, x[i]); } return tmp; }
From source file:hudson.plugins.ec2.AmazonEC2Cloud.java
public static URL getEc2EndpointUrl(String region) { try {/*from ww w .ja v a2 s .c o m*/ return new URL("https://" + region + "." + EC2_URL_HOST + "/"); } catch (MalformedURLException e) { throw new Error(e); // Impossible } }
From source file:com.google.code.ddom.commons.cl.ClassLoaderLocal.java
private static Map<ClassLoaderLocal<?>, Object> getClassLoaderLocalMap(ClassLoader cl) { if (cl == ClassLoaderLocal.class.getClassLoader()) { return ClassLoaderLocalMapHolder.locals; } else {/*from w ww .j a va 2s . c o m*/ Class<?> holderClass; try { holderClass = cl.loadClass(holderClassName); if (holderClass.getClassLoader() != cl) { holderClass = null; } } catch (ClassNotFoundException ex) { holderClass = null; } if (holderClass == null) { try { holderClass = (Class<?>) defineClassMethod.invoke(cl, holderClassName, holderClassDef, 0, holderClassDef.length); } catch (Exception ex) { // TODO: can we get here? maybe if two threads call getClassLoaderLocalMap concurrently? throw new Error(ex); } } Field field; try { field = holderClass.getDeclaredField("locals"); } catch (NoSuchFieldException ex) { throw new NoSuchFieldError(ex.getMessage()); } try { return (Map<ClassLoaderLocal<?>, Object>) field.get(0); } catch (IllegalAccessException ex) { throw new Error(ex); } } }
From source file:hudson.scm.credential.SslClientCertificateCredential.java
@Override public SVNAuthentication createSVNAuthentication(String kind) { if (kind.equals(ISVNAuthenticationManager.SSL)) { try {/*from w ww. j a va 2s. c o m*/ return new SVNSSLAuthentication(Base64.decode(certificate.getPlainText().toCharArray()), Scrambler.descramble(password), false); } catch (IOException e) { throw new Error(e); // can't happen } } return null; // unexpected authentication type }