From 270966d535649a20111b5cfa967fa94244bb6456 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Wed, 02 Apr 2008 11:47:50 +0000
Subject: [PATCH] Fix for issue #3041 (ldapsearch: trailing arguments are not interpreted as attributes when --filename option is specify)
---
opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearch.java | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearch.java b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearch.java
index 7e63d00..b85d3f2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearch.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearch.java
@@ -1079,18 +1079,27 @@
argParser.getTrailingArguments();
if(filterAndAttributeStrings.size() > 0)
{
- String filterString = filterAndAttributeStrings.remove(0);
- try
+ // the list of trailing arguments should be structured as follow:
+ // - If a filter file is present, trailing arguments are considered
+ // as attributes
+ // - If filter file is not present, the first trailing argument is
+ // considered the filter, the other as attributes.
+ if (! filename.isPresent())
{
- filters.add(LDAPFilter.decode(filterString));
- } catch(LDAPException le)
- {
- if (debugEnabled())
+ String filterString = filterAndAttributeStrings.remove(0);
+
+ try
{
- TRACER.debugCaught(DebugLogLevel.ERROR, le);
+ filters.add(LDAPFilter.decode(filterString));
+ } catch (LDAPException le)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, le);
+ }
+ err.println(wrapText(le.getMessage(), MAX_LINE_WIDTH));
+ return 1;
}
- err.println(wrapText(le.getMessage(), MAX_LINE_WIDTH));
- return 1;
}
// The rest are attributes
for(String s : filterAndAttributeStrings)
--
Gitblit v1.10.0