From b04929437cf6cbfd9c2a4a64cb453ce072084a4e Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 27 Mar 2009 00:20:53 +0000 Subject: Make sure FetchException propagates from generated index Storable correctly. --- .../synthetic/SyntheticStorableReferenceAccess.java | 13 +++++++------ .../synthetic/SyntheticStorableReferenceBuilder.java | 7 ++++--- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/synthetic') diff --git a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceAccess.java b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceAccess.java index 778b4ac..f83be02 100644 --- a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceAccess.java +++ b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceAccess.java @@ -24,6 +24,7 @@ import java.lang.reflect.UndeclaredThrowableException; import java.util.Comparator; import java.util.Iterator; +import com.amazon.carbonado.FetchException; import com.amazon.carbonado.Storable; import com.amazon.carbonado.cursor.SortedCursor; @@ -109,11 +110,11 @@ public class SyntheticStorableReferenceAccess { * @param reference source of property values * @param master master whose primary key properties will be set */ - public void copyToMasterPrimaryKey(Storable reference, S master) { + public void copyToMasterPrimaryKey(Storable reference, S master) throws FetchException { try { mCopyToMasterPkMethod.invoke(reference, master); } catch (Exception e) { - ThrowUnchecked.fireFirstDeclaredCause(e); + ThrowUnchecked.fireFirstDeclaredCause(e, FetchException.class); } } @@ -124,11 +125,11 @@ public class SyntheticStorableReferenceAccess { * @param reference reference whose properties will be set * @param master source of property values */ - public void copyFromMaster(Storable reference, S master) { + public void copyFromMaster(Storable reference, S master) throws FetchException { try { mCopyFromMasterMethod.invoke(reference, master); } catch (Exception e) { - ThrowUnchecked.fireFirstDeclaredCause(e); + ThrowUnchecked.fireFirstDeclaredCause(e, FetchException.class); } } @@ -140,11 +141,11 @@ public class SyntheticStorableReferenceAccess { * @param reference reference whose properties will be tested * @param master source of property values */ - public boolean isConsistent(Storable reference, S master) { + public boolean isConsistent(Storable reference, S master) throws FetchException { try { return (Boolean) mIsConsistentMethod.invoke(reference, master); } catch (Exception e) { - ThrowUnchecked.fireFirstDeclaredCause(e); + ThrowUnchecked.fireFirstDeclaredCause(e, FetchException.class); // Not reached. return false; } diff --git a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java index a06c557..75f1701 100644 --- a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java +++ b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java @@ -26,6 +26,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; +import com.amazon.carbonado.FetchException; import com.amazon.carbonado.Storable; import com.amazon.carbonado.SupportException; import com.amazon.carbonado.info.Direction; @@ -350,7 +351,7 @@ public class SyntheticStorableReferenceBuilder * @deprecated call getReferenceAccess */ @Deprecated - public void copyToMasterPrimaryKey(Storable indexEntry, S master) { + public void copyToMasterPrimaryKey(Storable indexEntry, S master) throws FetchException { getReferenceAccess().copyToMasterPrimaryKey(indexEntry, master); } @@ -363,7 +364,7 @@ public class SyntheticStorableReferenceBuilder * @deprecated call getReferenceAccess */ @Deprecated - public void copyFromMaster(Storable indexEntry, S master) { + public void copyFromMaster(Storable indexEntry, S master) throws FetchException { getReferenceAccess().copyFromMaster(indexEntry, master); } @@ -379,7 +380,7 @@ public class SyntheticStorableReferenceBuilder * @deprecated call getReferenceAccess */ @Deprecated - public boolean isConsistent(Storable indexEntry, S master) { + public boolean isConsistent(Storable indexEntry, S master) throws FetchException { return getReferenceAccess().isConsistent(indexEntry, master); } -- cgit v1.2.3