List of usage examples for java.lang Error Error
public Error(Throwable cause)
From source file:com.googlecode.arit.mbeans.MBeanScanner.java
public void scanForResources(ResourceListener resourceEventListener) { ArrayList<MBeanServer> mbeanServers = MBeanServerFactory.findMBeanServer(null); for (MBeanServer mbs : mbeanServers) { MBeanAccessor mbeanAccessor = mbsInspector.inspect(mbs); if (mbeanAccessor == null) { String errorMsg = "Unable to inspect MBeanServer of type " + mbs.getClass().getName(); LOG.error(errorMsg);/*w w w. j a v a 2 s. com*/ if (messages != null) { messages.addMessage(errorMsg); } } else { Set<ObjectName> mbeans; try { mbeans = mbs.queryNames(new ObjectName("*:*"), null); } catch (MalformedObjectNameException ex) { // We should never get here throw new Error(ex); } for (ObjectName name : mbeans) { Object mbean = mbeanAccessor.retrieve(name); SimpleResource<Object> mbeanResource = new SimpleResource<Object>(resourceType, mbean, "MBean: " + name); mbeanResource.addClassloaderReference(mbean.getClass().getClassLoader(), "Implementation class: " + mbean.getClass().getName()); resourceEventListener.onResourceFound(mbeanResource); } } } }
From source file:com.genentech.chemistry.tool.mm.SDFMMMinimize.java
private static MMMinMethod initializeMinimizeMethod(String requestedProgram, String requestedFF, String requestedSolvent) { MMMinMethod minMethod = null;/*from ww w.jav a2s . c o m*/ for (String knownProgram : minMethodNameObjectMap.keySet()) { if (knownProgram.equalsIgnoreCase(requestedProgram)) { minMethod = getMinMethodFromName(requestedProgram); if (requestedFF != null) { minMethod.setForceField(requestedFF); } if (requestedSolvent != null) { minMethod.setSolvent(requestedSolvent); } break; } } if (minMethod == null) { throw new Error("Minimization method not available." + requestedProgram); } return minMethod; }
From source file:edu.unc.lib.dl.util.JRDFGraphUtil.java
public static void removeAllRelatedByPredicate(Graph graph, PID pid, URI predicate) { ClosableIterator<Triple> tripleIter = null; try {//from w w w. j a v a 2 s . c o m URIReference subject = graph.getElementFactory().createResource(new URI("info:fedora/" + pid.getPid())); URIReference pred = graph.getElementFactory().createResource(predicate); Triple findTop = graph.getTripleFactory().createTriple(subject, pred, ANY_OBJECT_NODE); tripleIter = graph.find(findTop); graph.remove(tripleIter); } catch (GraphException e) { log.error("programmer error: ", e); throw new Error(e); } catch (TripleFactoryException e) { log.error("programmer error: ", e); throw new Error(e); } catch (GraphElementFactoryException e) { log.error("programmer error: ", e); throw new Error(e); } catch (URISyntaxException e) { log.error("programmer error: ", e); throw new Error(e); } finally { if (tripleIter != null) tripleIter.close(); } }
From source file:io.servicecomb.core.definition.loader.SchemaLoader.java
public SchemaMeta registerSchema(String microserviceName, String schemaId, String swaggerContent) { Swagger swagger = SchemaUtils.parseSwagger(swaggerContent); if (swagger == null) { throw new Error(String.format("Parse the swagger for %s:%s failed", microserviceName, schemaId)); }//from w w w.j av a 2s. com return registerSchema(microserviceName, schemaId, swagger); }
From source file:espresso.CsCompiler.java
public CsCompiler() { InputStream inputStream = CsCompiler.class.getResourceAsStream("coffee-script.js"); try {/* w w w. j a va 2s . co m*/ try { Reader reader = new InputStreamReader(inputStream, "UTF-8"); try { Context context = Context.enter(); context.setOptimizationLevel(-1); // Without this, Rhino hits a 64K bytecode limit and fails try { globalScope = context.initStandardObjects(); context.evaluateReader(globalScope, reader, "coffee-script.js", 0, null); // Load base import. libraries.put(ESPRESSO_BASE, compileRaw(readEspressoBase(), globalScope)); } finally { Context.exit(); } } finally { reader.close(); } } catch (UnsupportedEncodingException e) { throw new Error(e); // This should never happen } finally { inputStream.close(); } } catch (IOException e) { throw new Error(e); // This should never happen } }
From source file:io.servicecomb.swagger.TestSwaggerUtils.java
@Test public void parseSwaggerUrlException(@Mocked URL url) throws IOException { new Expectations(IOUtils.class) { {/* w w w .ja va 2 s .c om*/ IOUtils.toString(url); result = new Error("failed"); } }; expectedException.expect(ServiceCombException.class); expectedException.expectMessage("Parse swagger from url failed, "); SwaggerUtils.parseSwagger(url); }
From source file:it.cnr.isti.smartfed.federation.generation.ApplicationGenerator.java
/** * Return an application whose cloudlets are assigned to vertex with * a custom distribution.//from www .j a v a 2s.com * @param userId * @param numVertex * @param numCloudlet * @return */ public Application getApplication(int userId, int numVertex, int numCloudlet, AbstractRealDistribution distribution) { if (numCloudlet < numVertex) throw new Error("Cannot create an application with more vertexes (" + numVertex + ") than cloudlets (" + numCloudlet + ")"); int[] assignment = DistributionAssignment.getAssignmentArray(numVertex, numCloudlet, distribution); return getApplication(userId, assignment); }
From source file:com.github.rnewson.couchdb.lucene.couchdb.View.java
public String getDigest() { try {/*from w w w . ja va2s. co m*/ final MessageDigest md = MessageDigest.getInstance("MD5"); md.update(toBytes(json.optString("analyzer"))); md.update(toBytes(json.optString("defaults"))); md.update(toBytes(json.optString("index"))); return new BigInteger(1, md.digest()).toString(Character.MAX_RADIX); } catch (final NoSuchAlgorithmException e) { throw new Error("MD5 support missing."); } }
From source file:de.weingardt.mylyn.gitlab.core.GitlabTaskDataHandler.java
@Override public TaskAttributeMapper getAttributeMapper(TaskRepository repository) { try {// w ww . j a v a 2s . c om return ConnectionManager.get(repository).mapper; } catch (CoreException e) { throw new Error(e); } }
From source file:marytts.tools.voiceimport.AllophonesExtractor.java
@Override protected void initialiseComp() { locale = db.getProp(db.LOCALE);//from www. j a v a 2 s . c o m mary = null; // initialised only if needed promptAllophonesDir = new File(db.getProp(db.PROMPTALLOPHONESDIR)); if (!promptAllophonesDir.exists()) { System.out.println("Allophones directory does not exist; "); if (!promptAllophonesDir.mkdir()) { throw new Error("Could not create ALLOPHONES"); } System.out.println("Created successfully.\n"); } maryInputType = "RAWMARYXML"; maryOutputType = "ALLOPHONES"; // if styleDefinitionFileName is provided, try to initialize StyleDefinitionFileReader: String styleDefinitionFileName = getProp(STYLEDEFINITIONFILE); if (!styleDefinitionFileName.equals("")) { try { styleDefinition = new BasenameClassificationDefinitionFileReader(styleDefinitionFileName); if (!styleDefinition.fileOK) { System.err.println("There were problems parsing " + styleDefinitionFileName); } } catch (IOException e) { System.err.println("Warning: style definition file " + styleDefinitionFileName + " could not be opened, styles will not be used!"); } } }