CQL Exception handle
--------------------

                 Key: GEOT-1235
                 URL: http://jira.codehaus.org/browse/GEOT-1235
             Project: GeoTools
          Issue Type: Improvement
          Components: core cql
    Affects Versions: 2.4.M1
            Reporter: Mauricio Pazos
            Assignee: Mauricio Pazos
             Fix For: 2.4.M2


Nowadays, to get a syntax error message is required a new call  
getFormattedErrorMessage(e, cqlInput) method. The next sample present the idiom 
required:
try {
            ....
            CQL.toFilter(source);
            ...
} catch (ParseException e) {
            String message = CQL.getFormattedErrorMessage(e, source);
            System.out.println(message);
}
This idiom has the following problems:

- Error-prone: the method require the cql string parsed that. Then, 
accidentally, the programmer could provide other string that not was analysed.

- Complex protocol: the client needs other call to format the message. Then is 
need more methods (getFormattedErrorMessage) 

Those problems could be resolved adding an specific exception which maintaining 
the last string analysed. Additionally, it could have a getSyntaxError method 
to avoid a new call to CQL.

The follow sample present the solution idea:

try {
            CQL.toFilter(source);
            ....

} catch (CQLException e) {
            String message = e.getSyntaxError();
            System.out.println(message);
}








-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to