| Summary: | Ingres's implementation of SQLDevToolsConfiguration.recognize() method uses indexOf() instead of string compare. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] Data Tools | Reporter: | Barry LaFond <blafond> | ||||
| Component: | Enablement | Assignee: | Brian Fitzpatrick <bfitzpat> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 1.7.2 | ||||||
| Target Milestone: | 1.9 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Barry LaFond
I'll take a look at this... Barry, I'm looking at the code here:
private static final String[] PRODUCTS = { "Ingres", "II" };
...
public boolean recognize(String product, String version) {
// TODO extract version from supplied string
// example product="INGRES" and version="0.1.0.w32/115)"
if (product != null) {
String formattedProduct = format(product);
for (int i = 0; i < PRODUCTS.length; i++) {
if (formattedProduct.indexOf(format(PRODUCTS[i])) > -1) {
return true;
}
}
}
return false;
}
Obviously indexOf isn't the right approach since it's lowercasing the string and then looking for "ii". I don't have Ingres installed. Can you tell me what the actual product strings are that get returned and processed by this method? Specifically one with "Ingres" in it and another with "II" in it vs. what you get back from Teiid...
Teiid's recognize() method values: product = "Teiid Server" version = "x" IngresDBConfiguration.recognize() is returning TRUE for that product/version also. ** additional concern ** Seems like SQLToolsFacade.getDeclaredDatabaseVendorDefinitionId() is finding 2 ids and the if( ids.size() > 0 ) then it ends up returning the first one if other compares fail. (line 364 in my code) That logic seems a little strange too. Created attachment 196673 [details]
Patch of Ingres DB config
This patch changes the Ingres IngresDBConfiguration class a bit to resolve the issue. It should work to support both Ingres and Teiid.
Committed change minus the last comparison in the patch. If this causes issues for Ingres with the "II" version, we can resolve in the dot release in November, but it seemed to work on our end. I was unable to get in touch with any of my previous contacts at Ingres to confirm, so please let us know if there are issues. Tagged in HEAD in org.eclipse.datatools.enablement.ingres.ui as v201105270214 |