//
// $Id$

package com.samskivert.util;


/**
 * A ResultListener that does nothing on success and logs a warning
 * message on failure, that's all.
 */
public class ComplainingListener
    implements ResultListener
{
    public ComplainingListener (Log log, String errorText)
    {
        _log = log;
        _errorText = errorText;
    }

    // documentation inherited from interface ResultListener
    public void requestCompleted (Object result) { /* nada */ }

    // documentation inherited from interface ResultListener
    public void requestFailed (Exception cause)
    {
        _log.warning(_errorText + " [cause=" + cause + "].");
    }

    /** The log to which we'll log our error. */
    protected Log _log;

    /** The text to output if the error happens. */
    protected String _errorText;
}

@@ -35,16 +35,81 @@
 .util;%0A%0A
+import java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A
 %0A/**%0A * 
@@ -172,19 +172,16 @@
  warning
-%0A *
  message
@@ -237,24 +237,27 @@
 ningListener
+%3CT%3E
 %0A    impleme
@@ -274,16 +274,19 @@
 Listener
+%3CT%3E
 %0A%7B%0A    p
@@ -400,24 +400,160 @@
 ext;%0A    %7D%0A%0A
+    public ComplainingListener (Logger logger, String errorText)%0A    %7B%0A        _logger = logger;%0A        _errorText = errorText;%0A    %7D%0A%0A
     // docum
@@ -639,14 +639,9 @@
 ed (
-Object
+T
  res
@@ -768,32 +768,64 @@
 on cause)%0A    %7B%0A
+        if (_log != null) %7B%0A    
         _log.war
@@ -870,16 +870,212 @@
  %22%5D.%22);%0A
+        %7D else if (_logger != null) %7B%0A            _logger.log(Level.WARNING, _errorText, cause);%0A        %7D else %7B%0A            System.err.println(_errorText + %22 %5Bcause=%22 + cause + %22%5D.%22);%0A        %7D%0A
     %7D%0A%0A 
@@ -1117,16 +1117,29 @@
 ur error
+, may be null
 . */%0A   
@@ -1160,16 +1160,112 @@
  _log;%0A%0A
+    /** The logger to which we'll log our error, may be null. */%0A    protected Logger _logger;%0A%0A
     /** 

Allow ComplainingListener to be properly typed and to use Java's Logger.