rdonkin 2004/08/22 09:46:40 Modified: betwixt/src/java/org/apache/commons/betwixt/io AbstractBeanWriter.java Log: Improved diagnosis for id mismaps. Patch contributed by Christoph Gaffga. Revision Changes Path 1.29 +9 -3 jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/AbstractBeanWriter.java Index: AbstractBeanWriter.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/AbstractBeanWriter.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- AbstractBeanWriter.java 4 Jul 2004 16:58:17 -0000 1.28 +++ AbstractBeanWriter.java 22 Aug 2004 16:46:40 -0000 1.29 @@ -272,6 +272,7 @@ beanInfo.getIDAttributeName(), id); + } else { // write element without ID writeElement( @@ -285,8 +286,13 @@ } else { // use id from bean property // it's up to the user to ensure uniqueness - // XXX should we trap nulls? - Object exp = idAttribute.getTextExpression().evaluate( context ); + Expression idExpression = idAttribute.getTextExpression(); + if(idExpression == null) { + throw new IntrospectionException( + "The specified id property wasn't found in the bean (" + + idAttribute + ")."); + } + Object exp = idExpression.evaluate( context ); if (exp == null) { // we'll use a random id log.debug("Using random id");
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]