List of usage examples for java.lang Error Error
public Error(Throwable cause)
From source file:hudson.util.Protector.java
/** * Returns null if fails to decrypt properly. *///from w w w . ja va2s . c o m public static String unprotect(String data) { if (data == null) { return null; } try { Cipher cipher = Secret.getCipher(ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, DES_KEY); String plainText = new String(cipher.doFinal(Base64.decodeBase64(data)), "UTF-8"); if (plainText.endsWith(MAGIC)) { return plainText.substring(0, plainText.length() - 3); } return null; } catch (GeneralSecurityException e) { return null; } catch (UnsupportedEncodingException e) { throw new Error(e); // impossible } catch (IOException e) { return null; } }
From source file:jp.tricreo.ddd.base.model.impl.AbstractEntity.java
@Override public AbstractEntity clone() { try {//w w w . j a va 2 s. c o m return (AbstractEntity) super.clone(); } catch (CloneNotSupportedException e) { throw new Error("clone not supported"); } }
From source file:mx.bigdata.sat.cfdi.TFDv1.java
private static final JAXBContext createContext() { try {/*w ww .j av a2 s. com*/ return JAXBContext.newInstance("mx.bigdata.sat.cfdi.schema"); } catch (Exception e) { throw new Error(e); } }
From source file:gov.nih.nci.protexpress.test.ProtExpressBaseHibernateTest.java
/** * Constructor to initialize the configuration. *///from w w w .java 2 s .co m public ProtExpressBaseHibernateTest() { URL log4jConfig = getClass().getClassLoader().getResource("log4j.xml"); if (log4jConfig == null) { throw new Error("resource log4j.xml not found"); } PropertyConfigurator.configure(log4jConfig); setPopulateProtectedVariables(true); this.csmInitializer = new CsmInitializer(); }
From source file:TestModelBuilder.java
public void setAttributeValue(String name, String value) { throw new Error(getClass() + ": No attributes allowed"); }
From source file:MathUtil.java
/** * Method that calculates the Greatest Common Divisor (GCD) of several * positive integer numbers./*w w w . j av a 2 s. c o m*/ * * @param x Array containing the numbers. * */ public static final int gcd(int[] x) { if (x.length < 2) { throw new Error("Do not use this method if there are less than" + " two numbers."); } int tmp = gcd(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 = gcd(tmp, x[i]); } return tmp; }
From source file:persistence.parent.Dao.java
public Long save(T obj) { if (obj.getId() == null) { return (Long) currentSession().save(obj); } else {/* w w w . j a v a2 s. c om*/ throw new Error("error: object can not be saved with id"); } }
From source file:dk.dma.ais.packet.AisTestPackets.java
private static AisPacket read(String... lines) { try {// www . j a v a2 s . co m return AisPacket.readFromString(StringUtils.join(lines)); } catch (SentenceException e) { throw new Error(e); } }
From source file:UuidGenerator.java
/** * Initializes the factory./* w w w. j av a 2 s. c om*/ * * @param obj */ private synchronized static void initialize(final Object obj) { try { InetAddress inet = InetAddress.getLocalHost(); byte[] bytes = inet.getAddress(); String hexInetAddress = hexFormat(getInt(bytes), 8); String thisHashCode = hexFormat(System.identityHashCode(obj), 8); s_midValue = hexInetAddress + thisHashCode; s_seeder = new SecureRandom(); s_seeder.nextInt(); } catch (java.net.UnknownHostException e) { throw new Error("can not initialize the UuidGenerator generator"); } s_initialized = true; }
From source file:cloudfoundry.norouter.f5.client.NaiveTrustManager.java
public static LayeredConnectionSocketFactory getSocketFactory() { try {/*from ww w . j a v a 2 s. c om*/ final SSLContext context = SSLContext.getInstance("TLS"); context.init(null, TRUST_MANAGERS, null); return new SSLConnectionSocketFactory(context, new X509HostnameVerifier() { @Override public void verify(String host, SSLSocket ssl) throws IOException { } @Override public void verify(String host, X509Certificate cert) throws SSLException { } @Override public void verify(String host, String[] cns, String[] subjectAlts) throws SSLException { } @Override public boolean verify(String s, SSLSession sslSession) { return true; } }); } catch (NoSuchAlgorithmException | KeyManagementException e) { throw new Error(e); } }