-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Do we leave it up to third party developers to take care that only correct values are passed or do we have to take care that otherwise an exception is thrown? To give an example from shared AttributUtils: We never check if the object to clone is a String, we just presume that any other developer using this class respects the convention given by javadoc. Can we do so or should an exception be thrown in such cases?
This question will appear for sure for other methods as well. /** * Clone the value. An attribute value is supposed to be either a String * or a byte array. If it's a String, then we just return it ( as String * is immutable, we don't need to copy it). If it's a bu=yte array, we * create a new byte array and copy the bytes into it. * * @param value The value to clone * @return The cloned value */ public static Object cloneValue( Object value ) { // First copy the value Object newValue = null; if ( value instanceof byte[] ) { newValue = ( ( byte[] ) value ).clone(); } else { newValue = value; } return newValue; } -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwIxz4ACgkQ2lZVCB08qHHdxgCfdoxVZnY6OLr33zaD+p0+Dz6T LU8AnisthtKmNWYd3faao3mBgsrF4IK9 =2x2R -----END PGP SIGNATURE-----