/** * Creates the proxy class that implements the interfaces specified in * {@code interfaceNames}. * * @param interfaceNames * the interfaces used to create the proxy class. * @return the proxy class. * @throws ClassNotFoundException * if the proxy class or any of the specified interfaces cannot * be created. * @throws IOException * if an error occurs while reading from the source stream. * @see ObjectOutputStream#annotateProxyClass(Class) */ protected Class<?> resolveProxyClass(String[] interfaceNames) throws IOException, ClassNotFoundException { // TODO: This method is opportunity for performance enhancement // We can cache the classloader and recently used interfaces. ClassLoader loader = ClassLoader.getSystemClassLoader(); Class<?>[] interfaces = new Class<?>[interfaceNames.length]; for (int i = 0; i < interfaceNames.length; i++) { interfaces[i] = Class.forName(interfaceNames[i], false, loader); } try { return Proxy.getProxyClass(loader, interfaces); } catch (IllegalArgumentException e) { throw new ClassNotFoundException(e.toString(), e); } }
@VisibleForTesting static String calculateString( final String packageName, final Locale locale, final String key, final Object[] parameters, final Class<?> resourceClass, final String bundleName, final boolean fallbackOnRoot ) throws MissingResourceException { try { ResourceBundle bundle = getBundle( locale, packageName + "." + bundleName, resourceClass, fallbackOnRoot ); String unformattedString = bundle.getString( key ); String string = MessageFormat.format( unformattedString, parameters ); return string; } catch ( IllegalArgumentException e ) { final StringBuilder msg = new StringBuilder(); msg.append( "Format problem with key=[" ).append( key ).append( "], locale=[" ).append( locale ).append( "], package=" ).append( packageName ).append( " : " ).append( e.toString() ); log.error( msg.toString() ); log.error( Const.getStackTracker( e ) ); throw new MissingResourceException( msg.toString(), packageName, key ); } }
/** * Submit the sla event by calling {@link SlaEventSubmitter#EventSubmitter#submit()}. If * {@link SlaEventSubmitter#eventName}, {@link SlaEventSubmitter#eventSubmitter}, {@link SlaEventSubmitter#datasetUrn} * are not available the method is a no-op. */ public void submit() { try { Preconditions.checkArgument(Predicates.notNull().apply(eventSubmitter), "EventSubmitter needs to be set"); Preconditions.checkArgument(NOT_NULL_OR_EMPTY_PREDICATE.apply(eventName), "Eventname is required"); Preconditions.checkArgument(NOT_NULL_OR_EMPTY_PREDICATE.apply(datasetUrn), "DatasetUrn is required"); eventSubmitter.submit(eventName, buildEventMap()); } catch (IllegalArgumentException e) { log.info("Required arguments to submit an SLA event is not available. No Sla event will be submitted. " + e.toString()); } }
"Exception occurred. Probably the interval is invalid", "message", e.toString()
String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) {
@Test public void testInvalidParameters() { WindowAssigner.WindowAssignerContext mockContext = mock(WindowAssigner.WindowAssignerContext.class); try { SessionWindowTimeGapExtractor extractor = mock(SessionWindowTimeGapExtractor.class); when(extractor.extract(any())).thenReturn(-1L); DynamicProcessingTimeSessionWindows assigner = DynamicProcessingTimeSessionWindows.withDynamicGap(extractor); assigner.assignWindows(Lists.newArrayList(new Object()), 1, mockContext); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < gap")); } try { SessionWindowTimeGapExtractor extractor = mock(SessionWindowTimeGapExtractor.class); when(extractor.extract(any())).thenReturn(-1L); DynamicProcessingTimeSessionWindows assigner = DynamicProcessingTimeSessionWindows.withDynamicGap(extractor); assigner.assignWindows(Lists.newArrayList(new Object()), 1, mockContext); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < gap")); } }
@Test public void testInvalidParameters() { WindowAssigner.WindowAssignerContext mockContext = mock(WindowAssigner.WindowAssignerContext.class); try { SessionWindowTimeGapExtractor extractor = mock(SessionWindowTimeGapExtractor.class); when(extractor.extract(any())).thenReturn(-1L); DynamicEventTimeSessionWindows assigner = DynamicEventTimeSessionWindows.withDynamicGap(extractor); assigner.assignWindows(Lists.newArrayList(new Object()), 1, mockContext); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < gap")); } try { SessionWindowTimeGapExtractor extractor = mock(SessionWindowTimeGapExtractor.class); when(extractor.extract(any())).thenReturn(0L); DynamicEventTimeSessionWindows assigner = DynamicEventTimeSessionWindows.withDynamicGap(extractor); assigner.assignWindows(Lists.newArrayList(new Object()), 1, mockContext); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < gap")); } }
windowManager.removeView(superToast.getView()); } catch (IllegalArgumentException illegalArgumentException) { Log.e(getClass().getName(), illegalArgumentException.toString());
@Test public void testInvalidParameters() { try { EventTimeSessionWindows.withGap(Time.seconds(-1)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < size")); } try { EventTimeSessionWindows.withGap(Time.seconds(0)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < size")); } }
String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) {
@Test public void testInvalidParameters() { try { ProcessingTimeSessionWindows.withGap(Time.seconds(-1)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < size")); } try { ProcessingTimeSessionWindows.withGap(Time.seconds(0)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("0 < size")); } }
@Test public void testInvalidParameters() { try { TumblingProcessingTimeWindows.of(Time.seconds(-1)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < size")); } try { TumblingProcessingTimeWindows.of(Time.seconds(10), Time.seconds(20)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < size")); } try { TumblingProcessingTimeWindows.of(Time.seconds(10), Time.seconds(-11)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < size")); } }
@Test public void testInvalidParameters() { try { TumblingEventTimeWindows.of(Time.seconds(-1)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < size")); } try { TumblingEventTimeWindows.of(Time.seconds(10), Time.seconds(20)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < size")); } try { TumblingEventTimeWindows.of(Time.seconds(10), Time.seconds(-11)); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < size")); } }
/** {@inheritDoc} */ @Override public String toString() { return super.toString() + ":" + revstr; //$NON-NLS-1$ } }
fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0"));
fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0")); fail("should fail"); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("abs(offset) < slide and size > 0"));
public static void main(String[] args) { try { new I2PTunnel(args); } catch (IllegalArgumentException iae) { System.err.println(iae.toString()); System.exit(1); } }
@Override public boolean onTouchEvent(MotionEvent ev) { try { return super.onTouchEvent(ev); } catch (IllegalArgumentException ex) { KLog.e(ex.toString()); } return false; } }
public IndexBean() { _context = I2PAppContext.getGlobalContext(); _log = _context.logManager().getLog(IndexBean.class); TunnelControllerGroup tcg; String error; try { tcg = TunnelControllerGroup.getInstance(); error = tcg == null ? _t("Tunnels are not initialized yet, please reload in two minutes.") : null; } catch (IllegalArgumentException iae) { tcg = null; error = iae.toString(); } _group = tcg; _helper = new GeneralHelper(_context, _group); _fatalError = error; _tunnel = -1; _curNonce = "-1"; addNonce(); _config = new TunnelConfig(); }