Bug #53792 | Application breaks with latest version of MySQL driver | ||
---|---|---|---|
Submitted: | 19 May 2010 9:25 | Modified: | 29 Apr 2013 8:35 |
Reporter: | ashish kumar | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | Connector / J | Severity: | S1 (Critical) |
Version: | 5.1.12 | OS: | Linux |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[19 May 2010 9:25]
ashish kumar
[19 May 2010 11:58]
ashish kumar
need feedback
[19 May 2010 14:40]
Todd Farmer
Thank you for your bug report! Do you have a reduced test case to demonstrate this issue? I was unsuccessful using the current source tree, executing a stored procedure which returns resultsets from a JDBC2 data source. Please provide stored procedure and table definition, sample data, and Java application code which can repeatedly demonstrate this behavior.
[20 May 2010 6:20]
ashish kumar
Thanka for your reply ... I will provide the information what you need to reproduce
[20 May 2010 6:32]
Tonci Grgin
Ashish, please do.
[24 May 2010 12:30]
ashish kumar
in this file line 237 throw an exception but older version does not
Attachment: DatabaseEntryManager.java (text/plain), 9.93 KiB.
[24 May 2010 12:30]
ashish kumar
here is the procedure which is called
Attachment: gdc_GetAllEntries.sql (text/plain), 487 bytes.
[24 May 2010 12:32]
ashish kumar
Here is the entry class file public class Entry implements java.io.Serializable { private int m_entryID = 0; private DataCollection m_collection = null; private long m_entryDate = 0; private int m_userID = 0; private int m_credits = 0; private int m_stateID = 0; private Answer[] m_answers; private transient int m_referringEntryID = 0; public Entry() {} public Entry(int id, DataCollection col, long date, int userID, int credits) { m_entryID = id; m_collection = col; m_entryDate = date; m_userID = userID; m_credits = credits; } public Entry(int userID, DataCollection col, int referringEntryID) { m_entryID = -1; m_collection = col; m_entryDate = System.currentTimeMillis(); m_userID = userID; m_credits = 0; m_referringEntryID = referringEntryID; } public void setAnswers(Collection answers) { m_answers = (Answer[]) answers.toArray(new Answer[answers.size()]); } /** Returns this entry as a Map. The keys in the Map are the question tags; * the values are the corresponding answer. Three extra keys are added to * the Map: _date is the Date the entry was received; _userID is the userID * who submitted the entry (if available); _credits is the number of credits * attached to the entry. */ public Map asMap() { Map m = new HashMap(); m.put("_date", new Date(m_entryDate)); m.put("_userID", new Integer(m_userID)); m.put("_credits", new Integer(m_credits)); for (int i=0; i<m_answers.length; i++) { Question q = m_collection.getQuestion(m_answers[i].getQuestionID()); if (q!=null) { m.put(q.getNameTag(), m_answers[i].getData()); } } return m; } public final int getEntryID() { return m_entryID; } public void setEntryID(int arg) { m_entryID = arg; } public final int getCredits() { return m_credits; } public void addCredit() { m_credits++; } public void addCredits(int num) { m_credits += num; } public int getReferringEntryID() { return m_referringEntryID; } public final DataCollection getCollection() { return m_collection; } public final long getEntryDate() { return m_entryDate; } public final int getUserID() { return m_userID; } public final Answer[] getAnswers() { return m_answers; } public final int getStateID(){ return m_stateID; } public void setStateID(int arg){ m_stateID = arg; } /** Gets the answer to a question by question ID. */ public Object getAnswerTo(int questionID) { for (int i=0; i<m_answers.length; i++) { if (m_answers[i].getQuestionID()==questionID) return m_answers[i].getData(); } return null; } /** Sets the answer to a question by question ID. */ public void setAnswerTo(int questionID, Object val) { for (int i=0; i<m_answers.length; i++) { if (m_answers[i].getQuestionID()==questionID) { m_answers[i] = new Answer(questionID, val); return; } } Answer[] newAnswers = new Answer[m_answers.length + 1]; System.arraycopy(m_answers, 0, newAnswers, 0, m_answers.length); newAnswers[newAnswers.length - 1] = new Answer(questionID, val); m_answers = newAnswers; } /** Sets the answer to a question by question ID. */ public void setAnswerTo(String tag, Object val) { if (m_collection!=null) { Question q = m_collection.getQuestion(tag); if (q!=null) { setAnswerTo(q.getQuestionID(), val); } } } /** Gets the answer to a question by the question's name tag. */ public Object getAnswerTo(String tag) { if (m_collection==null) return null; Question q = m_collection.getQuestion(tag); if (q==null) return null; return getAnswerTo(q.getQuestionID()); } public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Entry #").append(m_entryID).append("\ncreated ") .append(new Date(m_entryDate)).append(" by user #").append(m_userID) .append(" (").append(m_credits).append(" credits)\n\nData:\n"); for (int i=0; i<m_answers.length; i++) { sb.append(' ').append(m_answers[i].getQuestionID()).append(": "); sb.append(m_answers[i].getData()).append('\n'); } return sb.toString(); } }
[24 May 2010 12:36]
ashish kumar
I think when the row set is empty and return it wont cast as boolean. but in older version it take this one . line 237 call below method and throw exception. public Entry next() throws WrappedException { try { return m_builder.buildEntry(); // fail to cast in new version } catch (SQLException se) { throw new WrappedException("Error building entry", se); } }
[24 May 2010 12:44]
ashish kumar
here bottom line is if (!m_rs.next()) doest not give false in newer deriver version but in older version it gives.
[27 May 2010 5:17]
ashish kumar
please give the feedback... do you people reproduce the bug or need any assistance from my side
[27 May 2010 5:23]
Tonci Grgin
Ashish, I am sorry but we do have other reports and things to take care of too. The only way you can be sure your problem will be dealt with promptly is to purchase a support contract. Now, I gather your problem is rs.Next() on empty resultset, right? If so, please boil down your test case to just a few lines needed to reproduce the faulty situation.
[27 Jun 2010 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[23 Aug 2010 8:50]
Tonci Grgin
Ashish?
[23 Aug 2010 8:54]
ashish kumar
Please ignore this bug ...as of now we are using old version to stabalise the build. Thanks,
[23 Aug 2010 8:56]
Tonci Grgin
Ashish, can you please answer my last question: > Now, I gather your problem is rs.Next() on empty resultset, right?
[23 Aug 2010 8:59]
ashish kumar
I am not sure on this ..but it might be the case.
[29 Mar 2013 8:35]
Alexander Soklakov
Hi Ashish, Is this problem still actual? 5.1.12 too old for now.
[30 Apr 2013 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".