Code example for ObjectStreamClass

Methods: getNamegetSerialVersionUID

0
		super(in);
	} 
 
	protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
		ObjectStreamClass osc = super.readClassDescriptor();		
		ObjectStreamClass target_osc = ObjectStreamClass.lookup(Class.forName(osc.getName()));
		if(target_osc.getSerialVersionUID() != osc.getSerialVersionUID())
		{ 
			String[] options = {"Yes", "No"}; 
			int sel = JOptionPane.showOptionDialog(null, "SerializedVersionUID mismatch for class " + osc.getName() + "!\n"+
					osc.getSerialVersionUID() + " != " + target_osc.getSerialVersionUID() + "\n" +
					"Do you want to ignore this error?", "Read Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,null, options, options[0]);
			if(sel == 0) return target_osc; // ObjectStreamClass.lookup(Class.forName("com.frinika.sequencer.model.MidiPlayOptions"));
		}		 
		return osc;
	} 
 
	 
 
} 
Experience pair programming with AI  Get Codota for Java