java.lang.IllegalArgumentException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(194)

本文整理了Java中java.lang.IllegalArgumentException.toString()方法的一些代码示例,展示了IllegalArgumentException.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalArgumentException.toString()方法的具体详情如下:
包路径:java.lang.IllegalArgumentException
类名称:IllegalArgumentException
方法名:toString

IllegalArgumentException.toString介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * 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);
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

@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 );
 }
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * 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());
 }
}

代码示例来源:origin: apache/incubator-druid

"Exception occurred. Probably the interval is invalid",
"message",
e.toString()

代码示例来源:origin: lealone/Lealone

String message = e.toString();
if (message.indexOf("HOUR_OF_DAY") > 0) {
  if (hour < 0 || hour > 23) {

代码示例来源:origin: apache/flink

@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"));
  }
}

代码示例来源:origin: apache/flink

@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"));
  }
}

代码示例来源:origin: JohnPersano/SuperToasts

windowManager.removeView(superToast.getView());
} catch (IllegalArgumentException illegalArgumentException) {
  Log.e(getClass().getName(), illegalArgumentException.toString());

代码示例来源:origin: apache/flink

@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"));
  }
}

代码示例来源:origin: com.h2database/h2

String message = e.toString();
if (message.indexOf("HOUR_OF_DAY") > 0) {
  if (hour < 0 || hour > 23) {

代码示例来源:origin: apache/flink

@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"));
  }
}

代码示例来源:origin: apache/incubator-gobblin

Assert.assertTrue(e.toString().contains("'from'"));
Assert.assertTrue(e.toString().contains("'order by'"));
Assert.assertTrue(e.toString().contains("'group by'"));
Assert.assertTrue(e.toString().contains("'having'"));
Assert.assertTrue(e.toString().contains("'limit'"));

代码示例来源:origin: apache/flink

@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"));
  }
}

代码示例来源:origin: apache/flink

@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"));
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
  @Override
  public String toString() {
    return super.toString() + ":" + revstr; //$NON-NLS-1$
  }
}

代码示例来源:origin: apache/flink

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"));

代码示例来源:origin: apache/flink

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"));

代码示例来源:origin: i2p/i2p.i2p

public static void main(String[] args) {
  try {
    new I2PTunnel(args);
  } catch (IllegalArgumentException iae) {
    System.err.println(iae.toString());
    System.exit(1);
  }
}

代码示例来源:origin: kaku2015/ColorfulNews

@Override
  public boolean onTouchEvent(MotionEvent ev) {
    try {
      return super.onTouchEvent(ev);
    } catch (IllegalArgumentException ex) {
      KLog.e(ex.toString());
    }
    return false;
  }
}

代码示例来源:origin: i2p/i2p.i2p

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();
}

相关文章