Sorry for reposting, but if what I just proposed is to be implemented, maybe 
the findMatchingDataSources(String) method could be inlined, as I used a 
String[] as return to be able to return 2 values.

I actually liked this way better than what I've patched. The code is simpler  
and easier to add new ids in the check.

--
Luis Fernando Planella Gonzalez


Em Segunda-feira 07 Dezembro 2009, às 11:42:13, você escreveu:
> Actually, I was off for 2 weeks. And yes, she's the first baby. Thanks God
>  she's very calm....
> 
> Well, returning to the issue: Sorry, with hundreds of mails after those 2
> weeks, I've actually seen your answer after I've attached the patch to
> https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12426288
> 
> Please, check the comment on the issue.
> 
> The code is there needing a review, but I did implemented it several ifs,
>  but it could be replaced by something like:
> 
> // Collect which data sources will be searched
> List<String> ids = new ArrayList<String>();
> ids.add(unit.getName());
> for (WebModule webModule : app.getWebModules()) {
>     ids.add(webModule.getId());
>     ids.add(webModule.getContextRoot());
> }
> ids.add(app.getModuleId());
> // Search for a matching data source
> for(String id : ids) {
>     dataSources = findMatchingDataSources(id);
>     if (dataSources != null) {
>         jtaDataSourceId = dataSources[0];
>         nonJtaDataSourceId = dataSources[1];
>         break;
> }
> 
> Also, I did added a PersistenceModule.getModuleId() case (with a TODO), so
>  it will probably have to be removed.
> 
> Anyway, the tests are covering all cases (except for
> PersistenceModule.getModuleId()), and I think the issue is resolved...
> 
> Please, let me know if anything changes...
> 
> --
> Luis Fernando Planella Gonzalez

Reply via email to