Bug #28085 Change the NotUpdatable exception
Submitted: 24 Apr 2007 23:13 Modified: 20 May 2007 5:43
Reporter: Ashley Martens Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S4 (Feature request)
Version:5.0.5 OS:Any
Assigned to: CPU Architecture:Any

[24 Apr 2007 23:13] Ashley Martens
Description:
NotUpdatable is not descriptive with it's error message.

How to repeat:
Create a table that is not updatable, then query the table and try to update the ResultSet.

Suggested fix:
I had some problems with NotUpdatable and changed the source. Here are the diffs.

LocalizedErrorMessages.properties
406a407,414
> NotUpdatableReason.0=References more than one table.
> NotUpdatableReason.1=References more than one database.
> NotUpdatableReason.2=References no tables.
> NotUpdatableReason.3=References no fields.
> NotUpdatableReason.4=References no primary keys.
> NotUpdatableReason.5=Table has no primary keys.
> NotUpdatableReason.6=Unknown primary key {0}.
> NotUpdatableReason.7=Does not reference all primary keys.

NotUpdatable.java
60a61,79
>
> /**
> * Append the given reason to the not updatable message if the reason
> * is not null.
> */
> public NotUpdatable(String reason) {
> if (reason == null) {
> this();
> } else {
> super(Messages.getString("NotUpdatable.0")
> + reason
> + Messages.getString("NotUpdatable.1")
> + Messages.getString("NotUpdatable.2")
> + Messages.getString("NotUpdatable.3")
> + Messages.getString("NotUpdatable.4")
> + Messages.getString("NotUpdatable.5"),
> SQLError.SQL_STATE_GENERAL_ERROR);
> }
> }

UpdatableResultSet.java
69a70,72
> /** Reason the result set is not updatable */
> private String notUpdatableReason = null;
>
292a296
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.0");
300a305
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.1");
311a317
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.2");
316a323
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.3");
325a333
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.4");
372a381
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.5");
393a403
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.6", new Object[] {originalName});
402a413,415
> if (!this.isUpdatable) {
> this.notUpdatableReason = Messages.getString("NotUpdatableReason.7");
> }
407a421
> this.notUpdatableReason = null;
426c440
< throw new NotUpdatable();
---
> throw new NotUpdatable(this.notUpdatableReason);
568c582
< throw new NotUpdatable();
---
> throw new NotUpdatable(this.notUpdatableReason);
869c883
< throw new NotUpdatable();
---
> throw new NotUpdatable(this.notUpdatableReason);
899c913
< throw new NotUpdatable();
---
> throw new NotUpdatable(this.notUpdatableReason);
1127c1141
< throw new NotUpdatable();
---
> throw new NotUpdatable(this.notUpdatableReason);
2225c2239
< throw new NotUpdatable();
---
> throw new NotUpdatable(this.notUpdatableReason);
[24 Apr 2007 23:16] Ashley Martens
New NotUpdatable

Attachment: NotUpdatable.java (application/octet-stream, text), 2.45 KiB.

[24 Apr 2007 23:17] Ashley Martens
Messages

Attachment: LocalizedErrorMessages.properties (application/octet-stream, text), 22.04 KiB.

[24 Apr 2007 23:18] Ashley Martens
UpdatableResultSet

Attachment: UpdatableResultSet.java (application/octet-stream, text), 71.91 KiB.

[2 May 2007 18:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/25934
[20 May 2007 5:43] MC Brown
A note has been added to the 5.0.6 changelog.
[29 Aug 2007 17:56] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33375
[6 Sep 2007 15:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33832
[7 Sep 2007 14:03] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33909
[3 Oct 2007 16:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34839
[3 Oct 2007 16:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34840
[3 Oct 2007 18:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34855
[5 Oct 2007 18:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35011
[11 Oct 2007 20:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35407
[11 Oct 2007 20:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35410
[11 Oct 2007 20:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35414
[19 Nov 2007 0:56] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38019
[19 Nov 2007 2:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38024