mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

lutoff
02.47.2008 270966d535649a20111b5cfa967fa94244bb6456
Fix for issue #3041 (ldapsearch: trailing arguments are not interpreted as attributes when --filename option is specify)

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.
1 files modified
27 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearch.java 27 ●●●●● patch | view | raw | blame | history
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)