Bug #22075 Fix to avoid compiler error ("finally does not complete normally") in "MysqlIO"
Submitted: 7 Sep 2006 9:46 Modified: 31 Mar 2014 12:01
Reporter: David Tonhofer Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.0.3 OS:Any (Any)
Assigned to: Alexander Soklakov CPU Architecture:Any

[7 Sep 2006 9:46] David Tonhofer
Description:
Slight fix to avoid compiler error ("finally does not complete normally") in com.mysql.jdbc.MysqlIO:

In method "readPacket()":
=========================

Replace the OutOfMemoryError catch at the end of the method:

-----------------------------------------
        } catch (OutOfMemoryError oom) {
        	try {
    			this.connection.realClose(false, false, true, oom);
    		} finally {
    			throw oom;
    		}
        }
-----------------------------------------

by

-----------------------------------------
        } catch (OutOfMemoryError oom) {
        	try {
    			this.connection.realClose(false, false, true, oom);
        	} catch (Throwable exe) {
        		// NOP
        	}
   		throw oom;
        }
-----------------------------------------

In method "reuseAndReadPacket()":
=================================

Replace the OutOfMemoryError catch at the end of the method:

-----------------------------------------
    	} catch (OutOfMemoryError oom) {
    		try {
    			// _Try_ this
    			clearInputStream();
    		} finally {
    			try {
    				this.connection.realClose(false, false, true, oom);
    			} finally {
    				throw oom;
    			}
    		}
    	}
-----------------------------------------

by:

-----------------------------------------
    	} catch (OutOfMemoryError oom) {
    		try {
    			clearInputStream();
    		} catch (Throwable exe) {
    			// NOP
    		}
    		try {
    			this.connection.realClose(false, false, true, oom);
    		} catch (Throwable exe) {
    			// NOP
    		} 
    		throw oom;
    	}    	
-----------------------------------------

How to repeat:
n/a

Suggested fix:
n/a
[12 Sep 2006 23:27] Mark Matthews
David,

There's definitely interest in such cleanups. You'd have to submit them under
our contributor license agreement, so I'd go read up on
http://forge.mysql.com/wiki/MySQL_Contributor_License_Agreement to make sure
you're able/willing to do it (it's pretty stock, but it is the littlest
bit of legal red tape we're able to get away with).

  -Mark
[15 Sep 2006 7:54] Tonci Grgin
David, you can close this report if you've reached agreement with Mark.
[18 Sep 2006 7:32] Tonci Grgin
David, any news?
[18 Oct 2006 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".
[31 Mar 2014 12:01] Alexander Soklakov
It was fixed but it's hard to say in which version. At least current c/j 5.1.29 contains proposed code.