JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java 新手區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 詢問一個 Uncompilable source code 的問題
sakata





發文: 311
積分: 0
於 2012-02-13 17:22 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
目前我的程式出現了以下的錯誤訊息

java.lang.RuntimeException: Uncompilable source code
at tw.com.gmpc.hrms.lunch.m0001.Lunch.compareTo(Lunch.java)
at java.util.TreeMap.put(TreeMap.java:545)
at java.util.TreeSet.add(TreeSet.java:238)
at tw.com.gmpc.hrms.lunch.m0001.LUN_M_0001DAO.getExistData(LUN_M_0001DAO.java:238)
at tw.com.gmpc.hrms.lunch.m0001.LUN_M_0001DAO.removeDuplicationDate(LUN_M_0001DAO.java:198)
at tw.com.gmpc.hrms.lunch.m0001.LUN_M_0001DAO.updateLunch(LUN_M_0001DAO.java:133)
at tw.com.gmpc.hrms.lunch.m0001.LUN_M_0001.upDataAction(LUN_M_0001.java:1385)
at tw.com.gmpc.hrms.autorun.LoadLunchData.update(LoadLunchData.java:89)
at tw.com.gmpc.hrms.autorun.LoadLunchData.execute(LoadLunchData.java:67)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

程式碼如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    private TreeSet<Lunch> getExistData(Connection conn, Date startDate, Date stopDate) throws SQLException {
        TreeSet<Lunch> dbLunch = new TreeSet<Lunch>();
 
        String sql = "select * from " + Hrdb.LUNCH + " where ldate between ? and ?";
        PreparedStatement pstmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        pstmt.setDate(1, new java.sql.Date(startDate.getTime()));
        pstmt.setDate(2, new java.sql.Date(stopDate.getTime()));
        ResultSet rs = pstmt.executeQuery();
        sql = "select * from " + Hrdb.LUNCH + " where ldate between '" + ChangeClass.date2String(startDate) + "' and '" + ChangeClass.date2String(stopDate) + "'";
        while (rs.next()) {
            Lunch lunch = new Lunch();
            lunch.setEmployeeId(rs.getString("employee_id"));
            lunch.setLdate(rs.getDate("ldate"));
            lunch.setLtime(rs.getTime("ltime"));
            lunch.setMealType(rs.getString("meal_type"));
            dbLunch.add(lunch);
        }
        rs.close();
        pstmt.close();
        return dbLunch;
    }


錯誤發生在
1
dbLunch.add(lunch);


花了一點時間查詢錯誤,但是我沒有找到
可以請問一下,可能發生問題的原因嗎?

感謝


reply to postreply to post
作者 Re:詢問一個 Uncompilable source code 的問題 [Re:sakata]
ch_huang





發文: 45
積分: 0
於 2012-02-13 17:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Could you post the Lunch class?

reply to postreply to post
This is not a solution only a suggestion....
作者 Re:詢問一個 Uncompilable source code 的問題 [Re:sakata]
uxa





發文: 489
積分: 6
於 2012-02-13 17:40 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
at tw.com.gmpc.hrms.lunch.m0001.Lunch.compareTo(Lunch.java)


應該是這個錯了


reply to postreply to post
☆只要努力就有希望☆
作者 Re:詢問一個 Uncompilable source code 的問題 [Re:uxa]
sakata





發文: 311
積分: 0
於 2012-02-14 08:03 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
4
5
6
7
  public int compareTo(Lunch o) {
    return new CompareToBuilder()
      .append(ldate, o.getLdate())
      .append(employeeId, o.getEmployeeId())
      .append(mealType, o.getMealType())
      .toComparison();      
  }


找到這一段了,但是,還是不了解問題是什麼

感謝


reply to postreply to post
作者 Re:詢問一個 Uncompilable source code 的問題 [Re:sakata]
ch_huang





發文: 45
積分: 0
於 2012-02-14 09:39 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我猜你用的IDE准許您執行還未COMPILE成功的程式,導致上述的錯誤發生。所以你是否可先用其它的方式來COMPILE程式嗎?像是COMMAND LINE(JAVAC)的,應該可幫忙您找到問題。

reply to postreply to post
This is not a solution only a suggestion....
作者 Re:詢問一個 Uncompilable source code 的問題 [Re:ch_huang]
sakata





發文: 311
積分: 0
於 2012-02-14 09:55 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我自動編譯之後,就正常了

其實這隻程式已經使用很久了,為什麼會突然出現這種「鬼打牆」的情況呢?

麻煩幫我解惑一下

感謝


reply to postreply to post
» JWorld@TW »  Java 新手區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8