本文整理了Java中java.util.NoSuchElementException.printStackTrace()
方法的一些代码示例,展示了NoSuchElementException.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NoSuchElementException.printStackTrace()
方法的具体详情如下:
包路径:java.util.NoSuchElementException
类名称:NoSuchElementException
方法名:printStackTrace
暂无
代码示例来源:origin: qiujuer/Genius-Android
/**
* poll a Runnable form {@link #mPool}
*
* @return Runnable
*/
private Runnable poll() {
synchronized (mPool) {
try {
return mPool.poll();
} catch (NoSuchElementException e) {
e.printStackTrace();
return null;
}
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public boolean add(E e) {
GridArgumentCheck.notNull(e, "e");
if (super.add(e)) {
cnt.incrementAndGet();
int c;
while ((c = cnt.get()) > max) {
// Decrement count.
if (cnt.compareAndSet(c, c - 1)) {
try {
while (!super.remove(first())) {
// No-op.
}
}
catch (NoSuchElementException e1) {
e1.printStackTrace(); // Should never happen.
assert false : "Internal error in grid bounded ordered set.";
}
}
}
return true;
}
return false;
}
代码示例来源:origin: de.sciss/scisslib
protected static Point stringToPoint( String value )
{
Point pt = null;
StringTokenizer tok;
if( value != null ) {
try {
tok = new StringTokenizer( value );
pt = new Point( Integer.parseInt( tok.nextToken() ), Integer.parseInt( tok.nextToken() ));
}
catch( NoSuchElementException e1 ) { e1.printStackTrace(); }
catch( NumberFormatException e2 ) { e2.printStackTrace(); }
}
return pt;
}
代码示例来源:origin: de.sciss/scisslib
protected static Dimension stringToDimension( String value )
{
Dimension dim = null;
StringTokenizer tok;
if( value != null ) {
try {
tok = new StringTokenizer( value );
dim = new Dimension( Integer.parseInt( tok.nextToken() ), Integer.parseInt( tok.nextToken() ));
}
catch( NoSuchElementException e1 ) { e1.printStackTrace(); }
catch( NumberFormatException e2 ) { e2.printStackTrace(); }
}
return dim;
}
代码示例来源:origin: de.sciss/scisslib
private static Rectangle stringToRectangle( String value )
{
Rectangle rect = null;
final StringTokenizer tok;
if( value != null ) {
try {
tok = new StringTokenizer( value );
rect = new Rectangle( Integer.parseInt( tok.nextToken() ), Integer.parseInt( tok.nextToken() ),
Integer.parseInt( tok.nextToken() ), Integer.parseInt( tok.nextToken() ));
}
catch( NoSuchElementException e1 ) { e1.printStackTrace(); }
catch( NumberFormatException e2 ) { e2.printStackTrace(); }
}
return rect;
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
public CustomPopupHelper(URL url) {
super();
xmlFile = null;
try {
itemBean = CustomPopupItemBean.loadXML(url);
item.setText(itemBean.getName());
} catch (NoSuchElementException e) {
JOptionPane.showMessageDialog(item, "custom popup item xml has bad format");
e.printStackTrace();
} catch (IOException e) {
JOptionPane.showMessageDialog(item, "custom popup item file not found in customPopup/ directory");
e.printStackTrace();
}
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
public CustomPopupHelper(File file) {
super();
this.xmlFile = file;
try {
itemBean = CustomPopupItemBean.loadXML(xmlFile);
item.setText(itemBean.getName());
} catch (FileNotFoundException e) {
JOptionPane.showMessageDialog(item, "custom popup item file not found in customPopup/ directory");
e.printStackTrace();
} catch (NoSuchElementException e) {
JOptionPane.showMessageDialog(item, "custom popup item xml has bad format");
e.printStackTrace();
}
}
代码示例来源:origin: Progether/JAdventure
public static String take() {
String message = null;
if (GameModeType.SERVER == mode) {
message = getInput("QUERY");
if (message.equals("error")) {
message = "exit";
}
} else {
Scanner input = null;
try {
input = new Scanner(System.in);
message = input.nextLine();
}
catch (NoSuchElementException nsee) {
nsee.printStackTrace();
}
catch (IllegalStateException ise) {
ise.printStackTrace();
}
}
return message;
}
}
代码示例来源:origin: org.w3c.jigsaw/jigsaw
public static Segment unpickle(String value) {
Segment seg = new Segment() ;
StringTokenizer st = new StringTokenizer(value, SEPARATOR);
try {
int type = Integer.parseInt(st.nextToken());
seg.start = Integer.parseInt(st.nextToken());
seg.end = Integer.parseInt(st.nextToken());
if (type == COMMAND) {
int n = Integer.parseInt(st.nextToken());
String parNames[] = new String[n] ;
String parValues[] = new String[n] ;
for (int i = 0 ; i < n ; i++) {
parNames[i] = st.nextToken();
parValues[i] = st.nextToken();
}
seg.parameters = new ArrayDictionary(parNames,parValues) ;
} else {
seg.commandName = null ;
seg.parameters = null ;
}
} catch (NoSuchElementException ex) {
ex.printStackTrace();
}
return seg;
}
代码示例来源:origin: 01org/graphbuilder
@Override
public void map(LongWritable key, Text val,
OutputCollector<IntWritable, Text> out, Reporter reporter)
throws IOException {
String line = val.toString();
StringTokenizer tokenizer = new StringTokenizer(line);
try {
String vid = tokenizer.nextToken();
if (hashRawVid) { // partition by old vid
Object rawId = vidparser.getValue(tokenizer.nextToken());
int hash = rawId.hashCode() % numChunks;
if (hash < 0)
hash += numChunks; // resolving negative hashcode
out.collect(new IntWritable(hash), val);
} else { // partition by new vid
int hash = Long.valueOf(vid).hashCode() % numChunks;
out.collect(new IntWritable(hash), val);
}
} catch (NoSuchElementException e) {
e.printStackTrace();
LOG.error("Error parsing vertex dictionary: " + val.toString());
}
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
@Override
public void loadItem(String name) throws FileNotFoundException, ParseException {
try {
customPopupItem = CustomPopupItemBean.loadXML(name + ".xml");
} catch (java.util.NoSuchElementException e) {
e.printStackTrace();
throw new ParseException(e.getMessage(), -1);
}
Data2Panel();
}
代码示例来源:origin: 01org/graphbuilder
@Override
public Vertex<VidType, VertexData> parseVertex(String text,
FieldParser<VidType> vidparser, FieldParser<VertexData> vdataparser) {
StringTokenizer tokenizer = new StringTokenizer(text);
try {
VidType id = vidparser.getValue(tokenizer.nextToken());
if (tokenizer.hasMoreTokens()) {
return new Vertex<VidType, VertexData>(id,
vdataparser.getValue(tokenizer.nextToken()));
} else {
return new Vertex<VidType, VertexData>(id, vdataparser.getValue(""));
}
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (NoSuchElementException e) {
e.printStackTrace();
}
LOG.error("Error in parsing line:" + text);
return null;
}
代码示例来源:origin: 01org/graphbuilder
@Override
public Edge<VidType, EdgeData> parseEdge(String text,
FieldParser<VidType> vidparser, FieldParser<EdgeData> edataparser) {
StringTokenizer tokenizer = new StringTokenizer(text);
try {
VidType source = vidparser.getValue(tokenizer.nextToken());
VidType target = vidparser.getValue(tokenizer.nextToken());
if (tokenizer.hasMoreTokens()) {
return new Edge<VidType, EdgeData>(source, target,
edataparser.getValue(tokenizer.nextToken()));
} else {
return new Edge<VidType, EdgeData>(source, target,
edataparser.getValue(""));
}
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (NoSuchElementException e) {
e.printStackTrace();
}
LOG.error("Error in parsing line:" + text);
return null;
}
代码示例来源:origin: org.apache.ignite/ignite-core
/** {@inheritDoc} */
@Override public boolean add(E e) {
GridArgumentCheck.notNull(e, "e");
if (super.add(e)) {
cnt.incrementAndGet();
int c;
while ((c = cnt.get()) > max) {
// Decrement count.
if (cnt.compareAndSet(c, c - 1)) {
try {
while (!super.remove(first())) {
// No-op.
}
}
catch (NoSuchElementException e1) {
e1.printStackTrace(); // Should never happen.
assert false : "Internal error in grid bounded ordered set.";
}
}
}
return true;
}
return false;
}
代码示例来源:origin: org.gridgain/gridgain-core
/** {@inheritDoc} */
@Override public boolean add(E e) {
GridArgumentCheck.notNull(e, "e");
if (super.add(e)) {
cnt.incrementAndGet();
int c;
while ((c = cnt.get()) > max) {
// Decrement count.
if (cnt.compareAndSet(c, c - 1)) {
try {
while (!super.remove(first())) {
// No-op.
}
}
catch (NoSuchElementException e1) {
e1.printStackTrace(); // Should never happen.
assert false : "Internal error in grid bounded ordered set.";
}
}
}
return true;
}
return false;
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public void processPdu(SnmpRequest request, MOServer server) {
initRequestPhase(request);
OctetString context = request.getContext();
try {
Iterator<SnmpRequest.SnmpSubRequest> it = request.iterator();
while (it.hasNext()) {
SubRequest sreq = it.next();
processNextSubRequest(request, server, context, sreq);
}
} catch (NoSuchElementException nsex) {
if (logger.isDebugEnabled()) {
nsex.printStackTrace();
}
logger.error("SubRequest not found");
request.setErrorStatus(PDU.genErr);
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public void processPdu(Request request, MOServer server) {
initRequestPhase(request);
OctetString context = request.getContext();
try {
SubRequestIterator it = (SubRequestIterator) request.iterator();
while (it.hasNext()) {
SubRequest sreq = it.nextSubRequest();
processNextSubRequest(request, server, context, sreq);
}
}
catch (NoSuchElementException nsex) {
if (logger.isDebugEnabled()) {
nsex.printStackTrace();
}
logger.error("SubRequest not found");
request.setErrorStatus(PDU.genErr);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-coref-ace
IndexWord initializeFrom(String line) {
TokenizerParser tokenizer = new TokenizerParser(line, " ");
this.lemma = tokenizer.nextToken().replace('_', ' ');
this.pos = POS.lookup(tokenizer.nextToken());
tokenizer.nextToken(); // poly_cnt
int p_cnt = tokenizer.nextInt();
ptrTypes = new PointerType[p_cnt];
for (int i = 0; i < p_cnt; i++) {
try {
ptrTypes[i] = PointerType.parseKey(tokenizer.nextToken());
} catch (java.util.NoSuchElementException exc) {
exc.printStackTrace();
}
}
int senseCount = tokenizer.nextInt();
this.taggedSenseCount = tokenizer.nextInt();
this.synsetOffsets = new long[senseCount];
for (int i = 0; i < senseCount; i++) {
synsetOffsets[i] = tokenizer.nextLong();
}
return this;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/LBJCoref
IndexWord initializeFrom(String line) {
TokenizerParser tokenizer = new TokenizerParser(line, " ");
this.lemma = tokenizer.nextToken().replace('_', ' ');
this.pos = POS.lookup(tokenizer.nextToken());
tokenizer.nextToken(); // poly_cnt
int p_cnt = tokenizer.nextInt();
ptrTypes = new PointerType[p_cnt];
for (int i = 0; i < p_cnt; i++) {
try {
ptrTypes[i] = PointerType.parseKey(tokenizer.nextToken());
} catch (java.util.NoSuchElementException exc) {
exc.printStackTrace();
}
}
int senseCount = tokenizer.nextInt();
this.taggedSenseCount = tokenizer.nextInt();
this.synsetOffsets = new long[senseCount];
for (int i = 0; i < senseCount; i++) {
synsetOffsets[i] = tokenizer.nextLong();
}
return this;
}
代码示例来源:origin: jclouds/legacy-jclouds
@Test
public void testCreateDestroySecurityGroup() {
try {
zone = Iterables.find(client.getZoneClient().listZones(), new Predicate<Zone>() {
@Override
public boolean apply(Zone arg0) {
return arg0.isSecurityGroupsEnabled();
}
});
securityGroupsSupported = true;
for (SecurityGroup securityGroup : client.getSecurityGroupClient().listSecurityGroups(
ListSecurityGroupsOptions.Builder.named(prefix))) {
for (IngressRule rule : securityGroup.getIngressRules())
assertTrue(jobComplete.apply(client.getSecurityGroupClient().revokeIngressRule(rule.getId())), rule.toString());
client.getSecurityGroupClient().deleteSecurityGroup(securityGroup.getId());
}
group = client.getSecurityGroupClient().createSecurityGroup(prefix);
assertEquals(group.getName(), prefix);
checkGroup(group);
try {
client.getSecurityGroupClient().createSecurityGroup(prefix);
fail("Expected IllegalStateException");
} catch (IllegalStateException e) {
}
} catch (NoSuchElementException e) {
e.printStackTrace();
}
}
内容来源于网络,如有侵权,请联系作者删除!