List of usage examples for java.lang Error Error
public Error(String message, Throwable cause)
From source file:com.igormaznitsa.mindmap.swing.panel.utils.Icons.java
private Icons(final String name) { final InputStream in = ScalableIcon.class.getClassLoader() .getResourceAsStream("com/igormaznitsa/mindmap/swing/panel/icons/" + name); //NOI18N try {/*w ww . j a v a 2s . c om*/ this.icon = new ImageIcon(ImageIO.read(in)); } catch (IOException ex) { throw new Error("Can't load icon " + name, ex); //NOI18N } finally { IOUtils.closeQuietly(in); } }
From source file:io.fabric8.che.starter.error.ErrorController.java
@RequestMapping(PATH) public Error error(HttpServletRequest request, HttpServletResponse response) { // Appropriate HTTP response code (e.g. 404) is set automatically return new Error(response.getStatus(), getErrorAttributes(request, includeStackTrace)); }
From source file:com.github.veithen.visualwas.connector.security.BasicAuthCredentials.java
@Override public void configure(HttpURLConnection connection) { try {//from w w w. jav a 2 s. c o m connection.setRequestProperty("Authorization", "Basic " + new String(Base64.encodeBase64((username + ":" + password).getBytes("utf-8")), "ascii")); } catch (UnsupportedEncodingException ex) { throw new Error("Unexpected exception", ex); } }
From source file:com.vgorcinschi.concordiafootballmanager.rest.PlayerRestController.java
@ExceptionHandler(PlayerNotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND)// www . j a va 2 s.c o m public @ResponseBody Error playerNotFound(PlayerNotFoundException e) { String playerName = e.getLastName(); return new Error(404, "Player [" + playerName + "] is not stored in our databse"); }
From source file:com.aionemu.gameserver.dataholders.ReloadableData.java
protected Schema getSchema(String xml_schema) { Schema schema = null;/* w w w.j av a 2 s .c om*/ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); try { schema = sf.newSchema(new File(xml_schema)); } catch (SAXException saxe) { throw new Error("Error while getting schema", saxe); } return schema; }
From source file:com.l2jfree.L2Registry.java
/** * Load registry from spring/* w w w . j a v a 2 s . c om*/ * The registry is a facade behind ApplicationContext from spring. */ public static void loadRegistry(String[] paths) { try { // Load the context if it is not already loaded if (__ctx == null) { // init properties for spring __ctx = new ClassPathXmlApplicationContext(paths); } } catch (RuntimeException e) { throw new Error("Unable to load registry, check that you update xml file in config folder !", e); } }
From source file:com.jameswolfeoliver.pigeon.Server.Endpoints.Endpoint.java
protected static Response buildJsonError(int errorCode, String error, Status status) { return Response.newFixedLengthResponse(status, MIME_JSON, PigeonApplication.getGson().toJson(new Error(errorCode, error), Error.class)); }
From source file:org.nuxeo.ecm.automation.client.jaxrs.spi.auth.PortalSSOAuthInterceptor.java
@Override public void processRequest(Request request, Connector connector) { // compute token long ts = new Date().getTime(); long random = new Random(ts).nextInt(); String clearToken = String.format("%d:%d:%s:%s", ts, random, secret, username); byte[] hashedToken; try {//from ww w . ja v a 2s . c o m hashedToken = MessageDigest.getInstance("MD5").digest(clearToken.getBytes()); } catch (NoSuchAlgorithmException e) { throw new Error("Cannot compute token", e); } String base64HashedToken = Base64.encode(hashedToken); // set request headers request.put("NX_TS", String.valueOf(ts)); request.put("NX_RD", String.valueOf(random)); request.put("NX_TOKEN", base64HashedToken); request.put("NX_USER", username); }
From source file:org.ambraproject.journal.JournalCreatorImpl.java
/** * Create all configured journals./*from ww w . ja v a 2 s . co m*/ * * @throws Error to abort */ public void createJournals() { try { createJournals(hibernateTemplate); } catch (Exception e) { throw new Error("A journal creation operation failed. Aborting ...", e); } }
From source file:com.igormaznitsa.nbmindmap.utils.Icons.java
private Icons(final String name) { final InputStream in = Icons.class.getClassLoader() .getResourceAsStream("com/igormaznitsa/nbmindmap/icons/" + name); //NOI18N try {/*from w ww.j a v a 2 s .c o m*/ this.icon = new ImageIcon(ImageIO.read(in)); } catch (IOException ex) { throw new Error("Can't load icon " + name, ex); //NOI18N } finally { IOUtils.closeQuietly(in); } }