[Oryx-users] ClassCastException when saving templates in repository
Brought to you by:
jensdietrich
From: Jochen H. <joc...@db...> - 2004-03-11 11:42:54
|
ClassCastException were thrown when i added a template rule to the repo= sitory. The problem occured in CloneService.clone(Rule), line 53. The R= ule's body is cast to Prerequisite, while the type is FactImpl (impleme= ntation of Prerequisite's super class Fact). This patch fixed the problem for me. It does not automatically handle n= ew subclasses of Fact, this could be achieved by moving the clone()s to= the Fact/Prerequisite classes. 53c53,61 < body.add(clone((Prerequisite) it.next())); --- > final Object o =3D it.next(); > // Avoid ClassCast exception when saving templa= tes in repository > if (o instanceof Prerequisite) { > body.add(clone((Prerequisite) o)); > } else if (o instanceof Fact) { > body.add(clone((Fact) o)); > } else { > throw new RuntimeException("Unknown Fac= t subclass " + o.getClass()); > } ________________________________________________ Jochen Hinrichsen External Consultant GTO CIO PBC, Securities Processing Systems (SPS) dbtrader/NetTrader Frankfurter Strasse 84 65760 Eschborn Tel: 069 / 910-61436 Fax: 069 / 910-62028 Mob: 0175/ 56 54 53 9 mailto:joc...@db... mailto:joc...@ka... -- Diese E-Mail enth=E4lt vertrauliche und/oder rechtlich gesch=FCtzte Inf= ormationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail= irrt=FCmlich erhalten haben, informieren Sie bitte sofort den Absender= und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbef= ugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If = you are not the intended recipient (or have received this e-mail in err= or) please notify the sender immediately and destroy this e-mail. Any u= nauthorized copying, disclosure or distribution of the material in this= e-mail is strictly forbidden. = |