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:com.discovery.darchrow.util.CollectionsUtil.java
/** Don't let anyone instantiate this class. */ private CollectionsUtil() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }
From source file:com.feilong.commons.core.lang.reflect.ConstructorUtil.java
/** Don't let anyone instantiate this class. */ private ConstructorUtil() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }
From source file:net.openwatch.acluaz.http.AZHttpClient.java
private SSLSocketFactory newSslSocketFactory() { try {/* ww w . j av a 2 s .c o m*/ // Get an instance of the Bouncy Castle KeyStore format KeyStore trusted = KeyStore.getInstance("BKS"); // Get the raw resource, which contains the keystore with // your trusted certificates (root and any intermediate certs) InputStream in = context.getResources().openRawResource(R.raw.azkeystore); try { // Initialize the keystore with the provided trusted certificates // Also provide the password of the keystore trusted.load(in, SECRETS.SSL_KEYSTORE_PASS.toCharArray()); } finally { in.close(); } // Pass the keystore to the SSLSocketFactory. The factory is responsible // for the verification of the server certificate. SSLSocketFactory sf = new SSLSocketFactory(trusted); // Hostname verification from certificate // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e506 sf.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER); return sf; } catch (Exception e) { throw new AssertionError(e); } }
From source file:com.discovery.darchrow.lang.CharsetType.java
/** Don't let anyone instantiate this class. */ private CharsetType() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }
From source file:com.digitalpebble.storm.crawler.metrics.DebugMetricsConsumer.java
@Override public void prepare(Map stormConf, Object registrationArgument, TopologyContext context, IErrorReporter errorReporter) {//from w ww .j a va2 s . co m this.errorReporter = errorReporter; this.metrics = new ConcurrentHashMap<String, Number>(); this.metrics_metadata = new ConcurrentHashMap<String, Map<String, Object>>(); try { // TODO Config file not tested final String PORT_CONFIG_STRING = "topology.metrics.consumers.debug.servlet.port"; Integer port = (Integer) stormConf.get(PORT_CONFIG_STRING); if (port == null) { log.warn("Metrics debug servlet's port not specified, defaulting to 7070. You can specify it via " + PORT_CONFIG_STRING + " in storm.yaml"); port = 7070; } server = startServlet(port); } catch (Exception e) { log.error("Failed to start metrics server", e); throw new AssertionError(e); } }
From source file:com.newtranx.util.cassandra.spring.AccessorScannerConfigurer.java
@Override public void postProcessBeanFactory(ConfigurableListableBeanFactory context) throws BeansException { ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( false) {/*from w w w .j a va 2 s .co m*/ @Override protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) { return beanDefinition.getMetadata().isInterface(); } }; scanner.addIncludeFilter(new AnnotationTypeFilter(Accessor.class)); for (BeanDefinition bd : scanner.findCandidateComponents(basePackage)) { Class<?> accessorCls; try { accessorCls = Class.forName(bd.getBeanClassName()); } catch (ClassNotFoundException e) { throw new AssertionError(e); } log.info("Creating proxy accessor: " + accessorCls.getName()); MethodInterceptor interceptor = new MethodInterceptor() { private final Lazy<?> target = new Lazy<>(() -> { log.info("Creating actual accessor: " + accessorCls.getName()); Session session; if (AccessorScannerConfigurer.this.session == null) session = mainContext.getBean(Session.class); else session = AccessorScannerConfigurer.this.session; MappingManager mappingManager = new MappingManager(session); return mappingManager.createAccessor(accessorCls); }); @Override public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { if ("toString".equals(method.getName())) { return accessorCls.getName(); } return method.invoke(target.get(), args); } }; Enhancer enhancer = new Enhancer(); enhancer.setInterfaces(new Class<?>[] { accessorCls }); enhancer.setCallback(interceptor); Object bean = enhancer.create(); String beanName = StringUtils.uncapitalize(accessorCls.getSimpleName()); context.registerSingleton(beanName, bean); log.info("Bean registed, name=" + beanName + ", bean=" + bean.toString()); } }
From source file:org.callimachusproject.client.ProxyClientExecDecorator.java
private HttpHost key(HttpHost host) { if (host != null && host.getPort() < 0) { try {/*from w ww . ja va2 s . c om*/ int port = DefaultSchemePortResolver.INSTANCE.resolve(host); host = new HttpHost(host.getHostName(), port, host.getSchemeName()); } catch (UnsupportedSchemeException e) { throw new AssertionError(e); } } return host; }
From source file:com.stratio.decision.unit.engine.action.CassandraServer.java
/** * Set embedded cassandra up and spawn it in a new thread. * //from w w w . ja v a 2s . co m * @throws TTransportException * @throws IOException * @throws InterruptedException */ public void start() throws TTransportException, IOException, InterruptedException, ConfigurationException { File dir = Files.createTempDir(); String dirPath = dir.getAbsolutePath(); System.out.println("Storing Cassandra files in " + dirPath); URL url = Resources.getResource("cassandra.yaml"); String yaml = Resources.toString(url, Charsets.UTF_8); yaml = yaml.replaceAll("REPLACEDIR", dirPath); String yamlPath = dirPath + File.separatorChar + "cassandra.yaml"; org.apache.commons.io.FileUtils.writeStringToFile(new File(yamlPath), yaml); // make a tmp dir and copy cassandra.yaml and log4j.properties to it copy("/log4j.properties", dir.getAbsolutePath()); System.setProperty("cassandra.config", "file:" + dirPath + yamlFilePath); System.setProperty("log4j.configuration", "file:" + dirPath + "/log4j.properties"); System.setProperty("cassandra-foreground", "true"); cleanupAndLeaveDirs(); try { executor.execute(new CassandraRunner()); } catch (RejectedExecutionException e) { log.error("RejectError", e); return; } try { TimeUnit.SECONDS.sleep(WAIT_SECONDS); } catch (InterruptedException e) { log.error("InterrputedError", e); throw new AssertionError(e); } }
From source file:com.newtranx.util.cassandra.spring.MapperScannerConfigurer.java
@SuppressWarnings("unused") // compiler bug? @Override//w ww. j a v a2 s . co m public void postProcessBeanFactory(ConfigurableListableBeanFactory context) throws BeansException { synchronized (lock) { ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( false); scanner.addIncludeFilter(new AnnotationTypeFilter(Table.class)); for (BeanDefinition bd : scanner.findCandidateComponents(basePackage)) { Class<?> entityCls; try { entityCls = Class.forName(bd.getBeanClassName()); } catch (ClassNotFoundException e) { throw new AssertionError(e); } log.info("Creating proxy mapper for entity: " + entityCls.getName()); CassandraMapper annotation = entityCls.getAnnotation(CassandraMapper.class); Mapper<?> bean = createProxy(Mapper.class, new MyInterceptor(entityCls, annotation.singleton())); String beanName; if (annotation == null) beanName = StringUtils.uncapitalize(entityCls.getSimpleName()) + "Mapper"; else beanName = annotation.value(); context.registerSingleton(beanName, bean); log.info("Bean registed, name=" + beanName + ", bean=" + bean.toString()); } } }
From source file:org.apache.falcon.regression.core.util.Util.java
private Util() { throw new AssertionError("Instantiating utility class..."); }