Example usage for org.apache.commons.logging Log warn

List of usage examples for org.apache.commons.logging Log warn

Introduction

In this page you can find the example usage for org.apache.commons.logging Log warn.

Prototype

void warn(Object message);

Source Link

Document

Logs a message with warn log level.

Usage

From source file:com.alfaariss.oa.util.saml2.opensaml.CustomOpenSAMLSecurityConfigurationBootstrap.java

/**
 * Populate signature-related parameters.
 * /*from w w  w. j  a v a 2s  . co m*/
 * @param config the security configuration to populate
 */
protected static void populateSignatureParams(BasicSecurityConfiguration config) {
    Log logger = LogFactory.getLog(CustomOpenSAMLSecurityConfigurationBootstrap.class);
    CryptoManager cryptoManager = Engine.getInstance().getCryptoManager();
    String sSignatureAlgorithmURI = SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1;
    String sMessageDigestAlgorithmURI = SignatureConstants.ALGO_ID_DIGEST_SHA1;

    try {
        sSignatureAlgorithmURI = SAML2CryptoUtils.getXMLSignatureURI(cryptoManager);
    } catch (OAException e) {
        logger.warn("Could not resolve signature algorithm from OA Crypto configuration, using default: "
                + sSignatureAlgorithmURI);
    }

    try {
        sMessageDigestAlgorithmURI = SAML2CryptoUtils.getXMLDigestMethodURI(cryptoManager.getMessageDigest());
    } catch (OAException e) {
        logger.warn("Could not resolve digest algorithm from OA Crypto configuration, using default: "
                + sMessageDigestAlgorithmURI);
    }

    // Asymmetric key algorithms
    config.registerSignatureAlgorithmURI("RSA", sSignatureAlgorithmURI);
    config.registerSignatureAlgorithmURI("DSA", SignatureConstants.ALGO_ID_SIGNATURE_DSA);
    config.registerSignatureAlgorithmURI("ECDSA", SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1);

    // HMAC algorithms
    config.registerSignatureAlgorithmURI("AES", SignatureConstants.ALGO_ID_MAC_HMAC_SHA1);
    config.registerSignatureAlgorithmURI("DESede", SignatureConstants.ALGO_ID_MAC_HMAC_SHA1);

    // Other signature-related params
    config.setSignatureCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
    config.setSignatureHMACOutputLength(null);
    config.setSignatureReferenceDigestMethod(sMessageDigestAlgorithmURI);
}

From source file:it.doqui.index.ecmengine.client.engine.EcmEngineDelegateFactory.java

/**
 * Metodo factory che crea una nuova istanza del client delegate.
 * /*from ww w .j a v  a 2s  .  c  o m*/
 * <p>La factory cerca di istanziare la classe di implementazione
 * specificata dall'utente nel file di propriet&agrave;
 * {@code ecmengine-engine-delegate.properties}. Se tale operazione fallisce
 * la factory cerca di istanziare la classe di default definita
 * in {@link it.doqui.index.ecmengine.client.engine.util.EcmEngineDelegateConstants#ECMENGINE_DELEGATE_CLASS_NAME_DEFAULT}.
 * </p>
 * 
 * @return Una nuova istanza del client delegate.
 * 
 * @throws EcmEngineDelegateInstantiationException Se si verifica un
 * errore nell'istanziazione del client delegate.
 */
public static EcmEngineDelegate getEcmEngineDelegate() throws EcmEngineDelegateInstantiationException {
    final ResourceBundle resources = ResourceBundle.getBundle(ECMENGINE_PROPERTIES_FILE);
    final String caller = resources.getString(ECMENGINE_DELEGATE_CALLER);
    final Log logger = LogFactory.getLog(caller + ECMENGINE_DELEGATE_LOG_CATEGORY);
    final String implClass = resources.getString(ECMENGINE_DELEGATE_CLASS);

    EcmEngineDelegate ecmEngineDelegateImpl = null;
    logger.debug("[EcmEngineDelegateFactory::getEcmEngineDelegate] BEGIN");

    logger.debug("[EcmEngineDelegateFactory::getEcmEngineDelegate] " + "Classe delegate: " + implClass);
    try {
        ecmEngineDelegateImpl = getClassInstance(implClass, logger);
    } catch (EcmEngineDelegateInstantiationException e) {
        logger.warn("[EcmEngineDelegateFactory::getEcmEngineDelegate] " + "Impossibile caricare la classe \""
                + implClass + "\": " + e.getMessage());

        logger.debug("[EcmEngineDelegateFactory::getEcmEngineDelegate] " + "Classe delegate di default: "
                + ECMENGINE_DELEGATE_CLASS_NAME_DEFAULT);
        try {
            ecmEngineDelegateImpl = getClassInstance(ECMENGINE_DELEGATE_CLASS_NAME_DEFAULT, logger);
        } catch (EcmEngineDelegateInstantiationException ex) {
            logger.error("[EcmEngineDelegateFactory::getEcmEngineDelegate] "
                    + "Impossibile caricare la classe di default \"" + ECMENGINE_DELEGATE_CLASS_NAME_DEFAULT
                    + "\": " + ex.getMessage());

            throw ex; // Rilancia l'eccezione al chiamante
        }

    } finally {
        logger.debug("[EcmEngineDelegateFactory::getEcmEngineDelegate] END");
    }

    return ecmEngineDelegateImpl;
}

From source file:com.octo.captcha.module.web.image.ImageToJpegHelper.java

/**
 * retrieve a new ImageCaptcha using ImageCaptchaService and flush it to the response.<br/> Captcha are localized
 * using request locale.<br/>// w ww .j ava2  s .  c  o m
 * <p/>
 * This method returns a 404 to the client instead of the image if the request isn't correct (missing parameters,
 * etc...)..<br/> The log may be null.<br/>
 *
 * @param theRequest  the request
 * @param theResponse the response
 * @param log         a commons logger
 * @param service     an ImageCaptchaService instance
 *
 * @throws java.io.IOException if a problem occurs during the jpeg generation process
 */
public static void flushNewCaptchaToResponse(HttpServletRequest theRequest, HttpServletResponse theResponse,
        Log log, ImageCaptchaService service, String id, Locale locale) throws IOException {

    // call the ImageCaptchaService method to retrieve a captcha
    byte[] captchaChallengeAsJpeg = null;
    ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
    try {
        BufferedImage challenge = service.getImageChallengeForID(id, locale);
        // the output stream to render the captcha image as jpeg into

        ImageIO.write(challenge, "jpg", jpegOutputStream);

    } catch (IllegalArgumentException e) {
        //    log a security warning and return a 404...
        if (log != null && log.isWarnEnabled()) {
            log.warn("There was a try from " + theRequest.getRemoteAddr()
                    + " to render an captcha with invalid ID :'" + id + "' or with a too long one");
            theResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }
    }

    captchaChallengeAsJpeg = jpegOutputStream.toByteArray();

    // render the captcha challenge as a JPEG image in the response
    theResponse.setHeader("Cache-Control", "no-store");
    theResponse.setHeader("Pragma", "no-cache");
    theResponse.setDateHeader("Expires", 0);

    theResponse.setContentType("image/jpeg");
    ServletOutputStream responseOutputStream = theResponse.getOutputStream();
    responseOutputStream.write(captchaChallengeAsJpeg);
    responseOutputStream.flush();
    responseOutputStream.close();
}

From source file:it.doqui.index.ecmengine.client.backoffice.EcmEngineBackofficeDelegateFactory.java

/**
 * Metodo factory che crea una nuova istanza del client delegate.
 * /*from   w  w  w  .  jav  a  2s  .  co  m*/
 * <p>La factory cerca di istanziare la classe di implementazione
 * specificata dall'utente nel file di propriet&agrave;
 * {@code ecmengine-backoffice-delegate.properties}. Se tale operazione fallisce
 * la factory cerca di istanziare la classe di default definita
 * in {@link EcmEngineBackofficeDelegateConstants#ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT}.
 * </p>
 * 
 * @return Una nuova istanza del client delegate.
 * 
 * @throws EcmEngineBackofficeDelegateInstantiationException Se si verifica un
 * errore nell'istanziazione del client delegate.
 */
public static EcmEngineBackofficeDelegate getEcmEngineBackofficeDelegate()
        throws EcmEngineBackofficeDelegateInstantiationException {
    final ResourceBundle resources = ResourceBundle.getBundle(ECMENGINE_BKO_PROPERTIES_FILE);
    final String caller = resources.getString(ECMENGINE_BKO_DELEGATE_CALLER);
    final Log logger = LogFactory.getLog(caller + ECMENGINE_BKO_DELEGATE_LOG_CATEGORY);
    final String implClass = resources.getString(ECMENGINE_BKO_DELEGATE_CLASS);

    logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] BEGIN");

    EcmEngineBackofficeDelegate backofficeInstance = null;

    logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] " + "Classe delegate: "
            + implClass);
    try {
        backofficeInstance = getClassInstance(implClass, logger);
    } catch (EcmEngineBackofficeDelegateInstantiationException e) {
        logger.warn("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] "
                + "Impossibile caricare la classe \"" + implClass + "\": " + e.getMessage());

        logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] "
                + "Classe delegate di default: " + ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT);
        try {
            backofficeInstance = getClassInstance(ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT, logger);
        } catch (EcmEngineBackofficeDelegateInstantiationException ex) {
            logger.error("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] "
                    + "Impossibile caricare la classe di default \"" + ECMENGINE_BKO_DELEGATE_CLASS_NAME_DEFAULT
                    + "\": " + ex.getMessage());

            throw ex; // Rilancia l'eccezione al chiamante
        }

    } finally {
        logger.debug("[EcmEngineBackofficeDelegateFactory::getEcmEngineBackofficeDelegate] END");
    }

    return backofficeInstance;
}

From source file:com.octo.captcha.module.web.sound.SoundToWavHelper.java

/**
 * retrieve a new SoundCaptcha using SoundCaptchaService and flush it to the response. <br/> Captcha are localized
 * using request locale. <br/>This method returns a 404 to the client instead of the image if the request isn't
 * correct (missing parameters, etc...).. <br/>The log may be null. <br/>
 *
 * @param theRequest  the request/* w  w w  .j  av  a2 s  . com*/
 * @param theResponse the response
 * @param log         a commons logger
 * @param service     an SoundCaptchaService instance
 *
 * @throws java.io.IOException if a problem occurs during the jpeg generation process
 */
public static void flushNewCaptchaToResponse(HttpServletRequest theRequest, HttpServletResponse theResponse,
        Log log, SoundCaptchaService service, String id, Locale locale) throws IOException {

    // call the ImageCaptchaService method to retrieve a captcha
    byte[] captchaChallengeAsWav = null;
    ByteArrayOutputStream wavOutputStream = new ByteArrayOutputStream();
    try {
        AudioInputStream stream = service.getSoundChallengeForID(id, locale);

        // call the ImageCaptchaService method to retrieve a captcha

        AudioSystem.write(stream, AudioFileFormat.Type.WAVE, wavOutputStream);
        //AudioSystem.(pAudioInputStream, AudioFileFormat.Type.WAVE, pFile);

    } catch (IllegalArgumentException e) {
        //    log a security warning and return a 404...
        if (log != null && log.isWarnEnabled()) {
            log.warn("There was a try from " + theRequest.getRemoteAddr()
                    + " to render an captcha with invalid ID :'" + id + "' or with a too long one");
            theResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }
    } catch (CaptchaServiceException e) {
        // log and return a 404 instead of an image...
        if (log != null && log.isWarnEnabled()) {
            log.warn(

                    "Error trying to generate a captcha and " + "render its challenge as JPEG", e);
        }
        theResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
    }
    captchaChallengeAsWav = wavOutputStream.toByteArray();

    // render the captcha challenge as a JPEG image in the response
    theResponse.setHeader("Cache-Control", "no-store");
    theResponse.setHeader("Pragma", "no-cache");
    theResponse.setDateHeader("Expires", 0);

    theResponse.setContentType("audio/x-wav");
    ServletOutputStream responseOutputStream = theResponse.getOutputStream();
    responseOutputStream.write(captchaChallengeAsWav);
    responseOutputStream.flush();
    responseOutputStream.close();
}

From source file:com.blm.orc.ReaderImpl.java

/**
 * Check to see if this ORC file is from a future version and if so,
 * warn the user that we may not be able to read all of the column encodings.
 * @param log the logger to write any error message to
 * @param path the filename for error messages
 * @param version the version of hive that wrote the file.
 *//* ww w. j av a  2s  . c o m*/
static void checkOrcVersion(Log log, Path path, List<Integer> version) {
    if (version.size() >= 1) {
        int major = version.get(0);
        int minor = 0;
        if (version.size() >= 2) {
            minor = version.get(1);
        }
        if (major > OrcFile.Version.CURRENT.getMajor() || (major == OrcFile.Version.CURRENT.getMajor()
                && minor > OrcFile.Version.CURRENT.getMinor())) {
            log.warn("ORC file " + path + " was written by a future Hive version " + versionString(version)
                    + ". This file may not be readable by this version of Hive.");
        }
    }
}

From source file:com.brienwheeler.svc.monitor.intervene.impl.LoggingInterventionListener.java

@Override
public void recordInterventionRequest(Object source, Log log, String message) {
    if (enabled)//from  w  w  w  . j  av  a2s.  c  o m
        log.warn(ObjectUtils.getUniqueId(source) + ": " + message);
}

From source file:com.lucidtechnics.blackboard.util.error.ErrorManager.java

public void warn(String _message, Log _logger) {
    _logger.warn(_message);
}

From source file:javadz.beanutils.BeanUtilsBean.java

/**
 * Returns a <code>Method<code> allowing access to
 * {@link Throwable#initCause(Throwable)} method of {@link Throwable},
 * or <code>null</code> if the method
 * does not exist./*from   w  w w.j  av  a 2s .  c o m*/
 * 
 * @return A <code>Method<code> for <code>Throwable.initCause</code>, or
 * <code>null</code> if unavailable.
 */
private static Method getInitCauseMethod() {
    try {
        Class[] paramsClasses = new Class[] { Throwable.class };
        return Throwable.class.getMethod("initCause", paramsClasses);
    } catch (NoSuchMethodException e) {
        Log log = LogFactory.getLog(BeanUtils.class);
        if (log.isWarnEnabled()) {
            log.warn("Throwable does not have initCause() method in JDK 1.3");
        }
        return null;
    } catch (Throwable e) {
        Log log = LogFactory.getLog(BeanUtils.class);
        if (log.isWarnEnabled()) {
            log.warn("Error getting the Throwable initCause() method", e);
        }
        return null;
    }
}

From source file:edu.vt.middleware.ldap.ssl.SingletonTLSSocketFactory.java

/** {@inheritDoc} */
public void setSSLContextInitializer(final SSLContextInitializer initializer) {
    if (staticContextInitializer != null) {
        final Log logger = LogFactory.getLog(SingletonTLSSocketFactory.class);
        if (logger.isWarnEnabled()) {
            logger.warn("SSLContextInitializer is being overridden");
        }/*w  w  w.  j av  a 2  s.c om*/
    }
    staticContextInitializer = initializer;
}