[ 
https://issues.apache.org/jira/browse/GORA-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042183#comment-16042183
 ] 

Nishadi Kirielle edited comment on GORA-512 at 6/8/17 4:35 AM:
---------------------------------------------------------------

Hi all,
Thank you for looking into the issue.

[~alfonso.nishikawa] +1 for the suggestion of loading a 
not-matching-keyclass-mapping.xml to the configuration. That would be the best 
approach to capture the scenario.
[~djkevincr] [~kamaci] Illegal State Exception being a run-time exception 
terminates the execution without going further down in the call stack. That is 
the reason I have logged before throwing the exception. 
As all of you have suggested, the Illegal State Exception is not much 
descriptive for the scenario. So +1 for moving on with  ConfigurationException 
which is meaningful and provides insight to what has happened. This exception 
is provided through a javax.naming library as well [1]. IMHO, it would be 
better to use that exception without going for a custom exception. In that 
case, as it is not a runtime exception, I will avoid logging as suggested so 
that it would be caught at [2] and thrown as IOException, and again caught at 
[3] and thrown as RuntimeException as explained by [~alfonso.nishikawa]. 
Another approach would be to throw after the try/catch as suggested by 
[~kamaci]. 

Your opinions would be great on selecting which approach to choose.

[1]. 
https://docs.oracle.com/javase/7/docs/api/javax/naming/ConfigurationException.html
 
[2]. 
https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L808
[3]. 
https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L135


was (Author: nishadi):
Hi all,
Thank you for looking into the issue.

[~alfonso.nishikawa] +1 for the suggestion of loading a 
not-matching-keyclass-mapping.xml to the configuration. That would be the best 
approach to capture the scenario.
[~djkevincr] [~kamaci] Illegal State Exception being a run-time exception 
terminates the execution without going further down in the call stack. That is 
the reason I have logged before throwing the exception. 
As all of you have suggested, the Illegal State Exception is not much 
descriptive for the scenario. So +1 for moving on with  ConfigurationException 
which is meaningful and provides insight to what has happened. This exception 
is provided through a javax.naming library as well [1]. IMHO, it would be 
better to use that exception without going for a custom exception. In that 
case, as it is not a runtime exception, I will avoid logging as suggested so 
that it would be caught at caught at [2] and thrown as IOException, and again 
at [3] and thrown as RuntimeException as explained by [~alfonso.nishikawa]. 
Another approach would be to throw after the try/catch as suggested by 
[~kamaci]. 

Your opinions would be great on selecting which approach to choose.

[1]. 
https://docs.oracle.com/javase/7/docs/api/javax/naming/ConfigurationException.html
 
[2]. 
https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L808
[3]. 
https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L135

> 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)

Reply via email to