[
https://issues.apache.org/jira/browse/GORA-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16039167#comment-16039167
]
Kevin Ratnasekera commented on GORA-512:
----------------------------------------
Hi [~nishadi]
+1 to [~alfonso.nishikawa] ideas here, one small thing add would be, whether we
could test for both exception class as well as exception message inside the
annotation @Test. I have used these inside @Test annotations in Testng, I am
not sure this can be done on JUnit.
I had a look on your code. One thing I have noticed is you have thrown
IllegalStateException for the erroneous case. I was thinking whether this is
appropriate exception to use, or whether we could use some other exception.
Anyway I don't find any issues with this.
One thing to add, I have noticed you have logged the same exception message
before it is thrown to higher layer. Log and throw can sometimes be seen as an
anti pattern. I would let who ever catch the exception up in call stack and
handle and log the exception, logging at one point would be enough.
What do you think [~alfonso.nishikawa] [~lewismc] ?
Regards
Kevin
> Fail at the time of error logging if KeyClass in gora-hbase-mapping is not
> the same as the one in the data bean
> ---------------------------------------------------------------------------------------------------------------
>
> Key: GORA-512
> URL: https://issues.apache.org/jira/browse/GORA-512
> Project: Apache Gora
> Issue Type: Improvement
> Components: gora-hbase
> Reporter: Nishadi Kirielle
> Assignee: Nishadi Kirielle
> Priority: Minor
>
> In the current implementation, when reading the HBase mapping file, if the
> HBase mapping file does not have a matching key class and name to the data
> bean, it only logs that information.[1] It does not fail at the time of
> detecting it. It fails only at the time of building the mapper [2] when it
> detects the table name is null. It will be better if it can fail at the time
> of detecting that mapping file is missing the corresponding class.
> [1].
> https://github.com/apache/gora/blob/master/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L797
> [2].
> https://github.com/apache/gora/blob/master/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L815
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)