Issue Details (XML | Word | Printable)

Key: DIRSERVER-649
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Ralf Hauser
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

transport explanations in NamingExceptions why searches fail back to the client

Created: 17/Jun/06 03:11 AM   Updated: 14/May/09 05:25 PM
Return to search
Component/s: ldap
Affects Version/s: None
Fix Version/s: 1.5.5

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works SearchHandler.java.patch 2006-06-18 02:11 AM Ralf Hauser 0.8 kB
Environment: all

Resolution Date: 14/May/09 05:25 PM


 Description  « Hide
Our ldap application has a custom partition and we only allow restricted searches on it.

If the queries do not comply with our rules, we throw a NamingException.
I guess good candidates for this are
- CannotProceedException
- NoPermissionException
The good news is that I even can provide the exception constructor with some extra information
that might help the searching user to adapt the query in order to succeed subsequently.

Unfortunately, such exception explanation are ignored in SearchHandler.java and only
  "failed on search operation"
is returned to the client

Please find a diff below how this might be solved.

Secondly, it would be great to be able to localize also the main error texts. Since our
searches are only executed after a "bind" we do have the possibility to know the locale
preferences from our own user-data-base.

What do you think.



--- SearchHandler.java.orig 2006-06-16 09:56:02.000000000 +0200
+++ SearchHandler.java 2006-06-16 09:57:28.000000000 +0200
@@ -345,7 +345,13 @@
 
             LdapResult result = req.getResultResponse().getLdapResult();
             result.setResultCode( code );
- result.setErrorMessage( msg );
+ String extraInfo="";
+ if (e.getMessage() != null) {
+ if (e.getMessage().trim().length()>0) {
+ extraInfo=": " + e.getMessage();
+ }
+ }
+ result.setErrorMessage( msg + extraInfo );
 
             if ( ( e.getResolvedName() != null )
                 && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alex Karasulu added a comment - 17/Jun/06 08:29 AM
Sure I will apply this for you. However could you attach an svn diff generated patch to this issue: unfortunatly things get mutilated by JIRA text formating. Thanks!

Ralf Hauser added a comment - 18/Jun/06 02:11 AM
see also DIRSERVER-649

Ralf Hauser added a comment - 18/Jun/06 02:13 AM
oops, should have been the reference to DIRSERVER-640 where the same issue exists with bind exceptions

Norval Hope added a comment - 19/Jun/06 08:01 AM
This issue and http://issues.apache.org/jira/browse/DIRSERVER-640 appear to me to be special cases of an issue I raised against LDAP earlier: http://issues.apache.org/jira/browse/DIRSERVER-619.

I second Ralf's suggestion about localisation of server messages eventually. I currently use a message class that stores message format + args, and can be rendered to/from XML as well resolved to a localised string either at the server or the client as required (client being the most useful option where geographically diverse clients access a centrail server).


Emmanuel Lecharny added a comment - 09/Jul/08 01:24 PM
I think we need this feature.

Alex Karasulu added a comment - 27/Aug/08 07:27 PM
Postponed.

Emmanuel Lecharny added a comment - 14/May/09 05:25 PM
This long witing issue has been fixed. We now transmit the initial cause to the client, and if the server is in debug mode, we also transmit the stack trace.