Bug 48670 - Need to gen try/catch for set methods that throw exceptions
Summary: Need to gen try/catch for set methods that throw exceptions
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: VE (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: VE Bugzilla inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-12 16:52 EST by Peter Walker CLA
Modified: 2011-06-13 11:37 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Walker CLA 2003-12-12 16:52:41 EST
From CMVC defect 231362:
    <Note by myersdj (MYERS, JEFFREY D.), 2002/11/07 16:41:49, seq: 1 rel: 0  
action: open>
The method JInternalFrame.setSelected throws a
java.beans.PropertyVetoException. If the 'selected' property is changed,
the code generated does not catch the exception, causing a compiler
error when attempting to run.

To reproduce the error, load the following code, select the
JInternalFrame, and change the 'selected' property and attempt to run.

import javax.swing.JFrame;

/**
 * @author changeme
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class InternalFrameError extends JFrame {

     private javax.swing.JPanel jContentPane = null;
     private javax.swing.JDesktopPane jDesktopPane = null;
     private javax.swing.JPanel jContentPane1 = null;
     private javax.swing.JInternalFrame jInternalFrame = null;
	/**
	 * This method initializes 
	 * 
	 */
	public InternalFrameError() {
		super();
		initialize();
	}
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
        this.setContentPane(getJContentPane());
        this.setSize(299, 191);
			
	}
	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private javax.swing.JPanel getJContentPane() {
		if(jContentPane == null) {
			jContentPane = new javax.swing.JPanel();
			java.awt.BorderLayout layBorderLayout8 = new 
java.awt.BorderLayout();
			jContentPane.setLayout(layBorderLayout8);
			jContentPane.add(getJDesktopPane(), 
java.awt.BorderLayout.CENTER);
		}
		return jContentPane;
	}
	/**
	 * This method initializes jDesktopPane
	 * 
	 * @return javax.swing.JDesktopPane
	 */
	private javax.swing.JDesktopPane getJDesktopPane() {
		if(jDesktopPane == null) {
			jDesktopPane = new javax.swing.JDesktopPane();
			jDesktopPane.add(getJInternalFrame(), null);
		}
		return jDesktopPane;
	}
	/**
	 * This method initializes jInternalFrame
	 * 
	 * @return javax.swing.JInternalFrame
	 */
	private javax.swing.JInternalFrame getJInternalFrame() {
		if(jInternalFrame == null) {
			jInternalFrame = new javax.swing.JInternalFrame();
			jInternalFrame.setContentPane(getJContentPane1());
			jInternalFrame.setBounds(32, 21, 199, 121);
		}
		return jInternalFrame;
	}
	/**
	 * This method initializes jContentPane1
	 * 
	 * @return javax.swing.JPanel
	 */
	private javax.swing.JPanel getJContentPane1() {
		if(jContentPane1 == null) {
			jContentPane1 = new javax.swing.JPanel();
			java.awt.BorderLayout layBorderLayout9 = new 
java.awt.BorderLayout();
			jContentPane1.setLayout(layBorderLayout9);
		}
		return jContentPane1;
	}
}  //  @jve:visual-info  decl-index=0 visual-constraint="0,0"

    <Note by pwalker (Peter Walker), 2002/11/07 18:44:46, seq: 2 rel: 0  
action: assign>
Old Owner: gmendel
New Owner: pwalker



    <Note by pwalker (Peter Walker), 2002/11/08 10:31:11, seq: 3 rel: 0  
action: modify>
I Think this is one of the reasons VAJava's VCE generated try/catch blocks
around the entire methods.

This isn't something we can do for GA but should look at for 5.1.
An easy work around is to either select the statement and use
  MB2-->Source-->Surround with try/catch block
or... before you drop the JInteralFrame... go the the visual preferences
and select Generate try{}catch() block.

For 5.1 we should look at maybe a second pass through the code and
evaluating the expressions to determine if there are methods that
throw exceptions and either put try/catch around each statement or
generate one try block around the method and multiple catch blocks
for each exception 
Old Abstract: Exception uncaught when using JInternalFrame.setSelected
New Abstract: Need to gen try/catch for set methods that throw exceptions