java.lang.NumberFormatException: For input string:

java.lang.NumberFormatException: For input string: "1.0"
 at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
 at java.lang.Integer.parseInt(Integer.java:477)
 at java.lang.Integer.(Integer.java:609)
 at com.gpcsoft.eprocurement.mydesktop.seller.business.SellerDeskTopBusiness$OrderNoComparator.compare(SellerDeskTopBusiness.java:219)
 at java.util.Arrays.mergeSort(Arrays.java:1278)
 at java.util.Arrays.sort(Arrays.java:1219)
 at java.util.Collections.sort(Collections.java:155)








	public class OrderNoComparator implements Comparator {
		public int compare(Object element1, Object element2) {
			try {
				Object tmpStr2=BeanUtilsEx.getProperty(element1, "orderNo");
				Object tmpStr1=BeanUtilsEx.getProperty(element1, "orderNo");

      //取出来的是 Double类型.结果toString();变成 x.0.就报错了
				return (new Integer(tmpStr2.toString())).compareTo(new Integer(tmpStr1.toString()));
				
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (NoSuchMethodException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return 0;
		}
	} 


 

你可能感兴趣的:(异常)