kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 9483a61dd223b1de0e512fa2c92f3597dd7b91e49b2a0dd13ddbd2dc2208f7e4 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-07-12 11:46 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-07-22 09:47 -07:00 |
| Parents | 37e876ef1735 |
4 files changed
modified driver-mapping/src/main/java/com/datastax/driver/mapping/AnnotationParser.java +1 −1
| @@ -253,7 +253,7 @@ | ||
| 253 | 253 | fetchSize = options.fetchSize(); |
| 254 | 254 | tracing = options.tracing(); |
| 255 | 255 | if (options.idempotent().length > 1) { |
| 256 | - throw new IllegalStateException("idemtpotence() attribute can only accept one value"); | |
| 256 | + throw new IllegalArgumentException("idemtpotence() attribute can only accept one value"); | |
| 257 | 257 | } |
| 258 | 258 | idempotent = options.idempotent().length == 0 ? null : options.idempotent()[0]; |
| 259 | 259 | } |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/PropertyMapper.java +5 −5
| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | import java.util.Collection; |
| 29 | 29 | import java.util.Map; |
| 30 | 30 | |
| 31 | -import static com.google.common.base.Preconditions.checkState; | |
| 31 | +import static com.google.common.base.Preconditions.checkArgument; | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Maps a Java bean property to a table column or a UDT field. |
| @@ -65,9 +65,9 @@ | ||
| 65 | 65 | if (setter != null) |
| 66 | 66 | ReflectionUtils.tryMakeAccessible(setter); |
| 67 | 67 | if (!isTransient()) { |
| 68 | - checkState((field != null && field.isAccessible()) || (getter != null && getter.isAccessible()), | |
| 68 | + checkArgument((field != null && field.isAccessible()) || (getter != null && getter.isAccessible()), | |
| 69 | 69 | "Property '%s' is not readable", propertyName); |
| 70 | - checkState((field != null && field.isAccessible()) || (setter != null && setter.isAccessible()), | |
| 70 | + checkArgument((field != null && field.isAccessible()) || (setter != null && setter.isAccessible()), | |
| 71 | 71 | "Property '%s' is not writable", propertyName); |
| 72 | 72 | } |
| 73 | 73 | columnName = inferColumnName(); |
| @@ -84,7 +84,7 @@ | ||
| 84 | 84 | else |
| 85 | 85 | return field.get(entity); |
| 86 | 86 | } catch (Exception e) { |
| 87 | - throw new IllegalStateException("Unable to read property '" + propertyName + "' in " + entity.getClass().getName(), e); | |
| 87 | + throw new IllegalArgumentException("Unable to read property '" + propertyName + "' in " + entity.getClass(), e); | |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| @@ -96,7 +96,7 @@ | ||
| 96 | 96 | else |
| 97 | 97 | field.set(entity, value); |
| 98 | 98 | } catch (Exception e) { |
| 99 | - throw new IllegalStateException("Unable to write property '" + propertyName + "' in " + entity.getClass().getName(), e); | |
| 99 | + throw new IllegalArgumentException("Unable to write property '" + propertyName + "' in " + entity.getClass(), e); | |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/ReflectionUtils.java +1 −1
| @@ -48,7 +48,7 @@ | ||
| 48 | 48 | try { |
| 49 | 49 | return publicConstructor.newInstance(); |
| 50 | 50 | } catch (Exception e) { |
| 51 | - throw new IllegalStateException("Can't create an instance of " + clazz, e); | |
| 51 | + throw new IllegalArgumentException("Can't create an instance of " + clazz, e); | |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperInvalidAnnotationsTest.java +2 −2
| @@ -261,7 +261,7 @@ | ||
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - @Test(groups = "unit", expectedExceptions = IllegalStateException.class, | |
| 264 | + @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class, | |
| 265 | 265 | expectedExceptionsMessageRegExp = |
| 266 | 266 | "Property 'notReadable' is not readable") |
| 267 | 267 | public void should_not_allow_unreadable_property() throws Exception { |
| @@ -277,7 +277,7 @@ | ||
| 277 | 277 | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - @Test(groups = "unit", expectedExceptions = IllegalStateException.class, | |
| 280 | + @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class, | |
| 281 | 281 | expectedExceptionsMessageRegExp = |
| 282 | 282 | "Property 'notWritable' is not writable") |
| 283 | 283 | public void should_not_allow_unwritable_property() throws Exception { |