java.lang.NumberFormatException: For input string: "10"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:441)
Relevant segment of code:
public static class NodeWritable implements Writable {
public double msg;
public double rank;
public String others;
public NodeWritable(double msg, double rank, String others) {
this.msg = msg;
this.rank = rank;
this.others = others;
}
public NodeWritable() {
this.msg = 0.0;
this.rank = 0.0;
this.others = "";
}
@Override
public void write(DataOutput out) throws IOException {
out.writeDouble(msg);
out.writeDouble(rank);
out.writeChars(others + "
");
}
@Override
public void readFields(DataInput in) throws IOException {
msg = in.readDouble();
rank = in.readDouble();
others = in.readLine();
}
@Override
public String toString() {
return "" + rank;
}
}
ArrayList<Long> incoming_vids = new ArrayList<Long>();
for (NodeWritable msg : messages) {
String in_vid = msg.others.trim();
incoming_vids.add(Long.parseLong(in_vid));
}
How can this happen? I've done some research with Google. Sometime NumberFormatException
seems to be caused by big numbers. But I just can't find a possible explanation for my case.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…