diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-09-05 12:10:26 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-09-07 06:50:30 +0000 |
commit | 1326e9fa5cffe326b82aeee9d82d008526aff947 (patch) | |
tree | f8ca808f3aa3a9338573d8892b83305210a664a1 /infra/translate-impl/src/main | |
parent | 6e77db8e850be8ad8a3d91bf43fb8986125ae60f (diff) |
Cleanup TODOs and FIXMEs
- Fix minor ones
- Report bigger and include issue number in comment
- Pull common dependencies into dependency management of common/parents
Change-Id: I06a6ac37c52b603fd73ed42023d6b2e7fa18010f
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'infra/translate-impl/src/main')
4 files changed, 40 insertions, 10 deletions
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java index c6e7f3cb5..d8accec91 100644 --- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java +++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java @@ -106,7 +106,11 @@ public final class GenericListReader<C extends DataObject & Identifiable<K>, K e public void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - customizer.readCurrentAttributes(id, builder, ctx); + try { + customizer.readCurrentAttributes(id, builder, ctx); + } catch (RuntimeException e) { + throw new ReadFailedException(id, e); + } } @Override diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java index 1c638317a..f60c8f137 100644 --- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java +++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java @@ -54,7 +54,11 @@ public final class GenericReader<C extends DataObject, B extends Builder<C>> ext public void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - customizer.readCurrentAttributes(id, builder, ctx); + try { + customizer.readCurrentAttributes(id, builder, ctx); + } catch (RuntimeException e) { + throw new ReadFailedException(id, e); + } } @Override diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java index f61812931..4e05ce018 100644 --- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java +++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java @@ -46,20 +46,32 @@ public final class GenericListWriter<D extends DataObject & Identifiable<K>, K e @Override protected void writeCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D data, @Nonnull final WriteContext ctx) throws WriteFailedException { - customizer.writeCurrentAttributes(id, data, ctx); + try { + customizer.writeCurrentAttributes(id, data, ctx); + } catch (RuntimeException e) { + throw new WriteFailedException.CreateFailedException(id, data, e); + } } @Override protected void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final WriteContext ctx) throws WriteFailedException { - customizer.deleteCurrentAttributes(id, dataBefore, ctx); + try { + customizer.deleteCurrentAttributes(id, dataBefore, ctx); + } catch (RuntimeException e) { + throw new WriteFailedException.DeleteFailedException(id, e); + } } @Override protected void updateCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final D dataAfter, @Nonnull final WriteContext ctx) throws WriteFailedException { - customizer.updateCurrentAttributes(id, dataBefore, dataAfter, ctx); + try { + customizer.updateCurrentAttributes(id, dataBefore, dataAfter, ctx); + } catch (RuntimeException e) { + throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e); + } } @Override diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericWriter.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericWriter.java index 486da9b4a..30d15e370 100644 --- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericWriter.java +++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericWriter.java @@ -40,15 +40,21 @@ public final class GenericWriter<D extends DataObject> extends AbstractGenericWr @Override protected void writeCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D data, @Nonnull final WriteContext ctx) throws WriteFailedException { - // TODO wrap all customizer invocations in try catch, and wrap runtime exceptions in ReadFailed - // TODO same for readers - customizer.writeCurrentAttributes(id, data, ctx); + try { + customizer.writeCurrentAttributes(id, data, ctx); + } catch (RuntimeException e) { + throw new WriteFailedException.CreateFailedException(id, data, e); + } } @Override protected void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final WriteContext ctx) throws WriteFailedException { - customizer.deleteCurrentAttributes(id, dataBefore, ctx); + try { + customizer.deleteCurrentAttributes(id, dataBefore, ctx); + } catch (RuntimeException e) { + throw new WriteFailedException.DeleteFailedException(id, e); + } } @Override @@ -56,6 +62,10 @@ public final class GenericWriter<D extends DataObject> extends AbstractGenericWr @Nonnull final D dataBefore, @Nonnull final D dataAfter, @Nonnull final WriteContext ctx) throws WriteFailedException { - customizer.updateCurrentAttributes(id, dataBefore, dataAfter, ctx); + try { + customizer.updateCurrentAttributes(id, dataBefore, dataAfter, ctx); + } catch (RuntimeException e) { + throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e); + } } } |