[
https://issues.apache.org/jira/browse/GORA-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040624#comment-16040624
]
Alfonso Nishikawa commented on GORA-512:
----------------------------------------
[~djkevincr]: In JUnit there are two ways to check for the message. One with
@Rule in the test class and other "by hand" in the test method. The bad news
is that the exception ends being a RuntimeException and I assume will be a bit
hard to extract and check the details.
About the exception, maybe something like ConfigurationException would be more
descriptive, but this class belongs to commons-configuration and we are not
using that package... so maybe would be better to define the exception class
alone inside Gora (our own ConfigurationException).
Don't put much effort on it, since the exception thrown there will be caught at
[1] and thrown as IOException, and again at [2] and thrown as RuntimeException.
Fortunately, the stacktrace will be preserved :) All the process of creation
and initialization could be improved, but I believe there is no need to go for
the big.
As [~kamaci] comments, the option of throwing after the try/catch is something
to consider. Will end being catch by [2] because the method `initialize()` [3]
does not declares thrown exceptions, but would be good to throw outside the
try/catch.
[~djkevincr]: About logging and throwing, you are right: if both messages are
the same, I guess we can get rid of the log message.
[~nishadi]: What do you think about?
Thank you!
[1] -
https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L808
[2] -
https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L135
[3] -
https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L113
> 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)