mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 19:15:52 +01:00
use slf4j instead of java.util.logging
This commit is contained in:
@@ -11,6 +11,9 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.ConfigurationException;
|
import sonia.scm.ConfigurationException;
|
||||||
import sonia.scm.io.CommandResult;
|
import sonia.scm.io.CommandResult;
|
||||||
import sonia.scm.io.ExtendedCommand;
|
import sonia.scm.io.ExtendedCommand;
|
||||||
@@ -32,8 +35,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -55,7 +56,7 @@ public class HgRepositoryHandler extends AbstractRepositoryHandler<HgConfig>
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(HgRepositoryHandler.class.getName());
|
LoggerFactory.getLogger(HgRepositoryHandler.class);
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -378,14 +379,14 @@ public class HgRepositoryHandler extends AbstractRepositoryHandler<HgConfig>
|
|||||||
}
|
}
|
||||||
catch (ParseException ex)
|
catch (ParseException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
pom.xml
6
pom.xml
@@ -39,6 +39,12 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<version>1.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|||||||
@@ -7,13 +7,15 @@
|
|||||||
|
|
||||||
package sonia.scm.cli;
|
package sonia.scm.cli;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -23,7 +25,7 @@ public class ConvertUtil
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(ConvertUtil.class.getName());
|
LoggerFactory.getLogger(ConvertUtil.class);
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -77,7 +79,7 @@ public class ConvertUtil
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.FINER, null, ex);
|
logger.debug(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ package sonia.scm.io;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -19,9 +22,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -31,7 +31,7 @@ public class SimpleCommand implements Command
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(SimpleCommand.class.getName());
|
LoggerFactory.getLogger(SimpleCommand.class);
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ public class SimpleCommand implements Command
|
|||||||
}
|
}
|
||||||
catch (InterruptedException ex)
|
catch (InterruptedException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
|
|
||||||
throw new IOException(ex.getMessage());
|
throw new IOException(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryHandler;
|
import sonia.scm.repository.RepositoryHandler;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
@@ -22,8 +25,6 @@ import java.util.Collection;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXB;
|
import javax.xml.bind.JAXB;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ public class SCMPluginManager
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(SCMPluginManager.class.getName());
|
LoggerFactory.getLogger(SCMPluginManager.class);
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ public class SCMPluginManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.ConfigurationException;
|
import sonia.scm.ConfigurationException;
|
||||||
import sonia.scm.SCMContextProvider;
|
import sonia.scm.SCMContextProvider;
|
||||||
import sonia.scm.io.CommandResult;
|
import sonia.scm.io.CommandResult;
|
||||||
@@ -25,8 +28,6 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXB;
|
import javax.xml.bind.JAXB;
|
||||||
|
|
||||||
@@ -34,7 +35,8 @@ import javax.xml.bind.JAXB;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*
|
*
|
||||||
* @param <T>
|
*
|
||||||
|
* @param <C>
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepositoryConfig>
|
public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepositoryConfig>
|
||||||
extends AbstractRepositoryHandler<C>
|
extends AbstractRepositoryHandler<C>
|
||||||
@@ -42,7 +44,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(AbstractSimpleRepositoryHandler.class.getName());
|
LoggerFactory.getLogger(AbstractSimpleRepositoryHandler.class);
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -238,7 +240,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,10 +335,9 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
|||||||
|
|
||||||
if (!directory.exists())
|
if (!directory.exists())
|
||||||
{
|
{
|
||||||
if (logger.isLoggable(Level.WARNING))
|
if (logger.isWarnEnabled())
|
||||||
{
|
{
|
||||||
logger.warning(
|
logger.warn("could not find repository ".concat(repository.getName()));
|
||||||
"could not find repository ".concat(repository.getName()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repository = null;
|
repository = null;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ package sonia.scm.repository;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.ConfigurationException;
|
import sonia.scm.ConfigurationException;
|
||||||
import sonia.scm.SCMContext;
|
import sonia.scm.SCMContext;
|
||||||
import sonia.scm.SCMContextProvider;
|
import sonia.scm.SCMContextProvider;
|
||||||
@@ -38,6 +41,12 @@ import java.util.Set;
|
|||||||
public class BasicRepositoryManager extends AbstractRepositoryManager
|
public class BasicRepositoryManager extends AbstractRepositoryManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private static final Logger logger =
|
||||||
|
LoggerFactory.getLogger(BasicRepositoryManager.class);
|
||||||
|
|
||||||
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs ...
|
||||||
*
|
*
|
||||||
@@ -79,6 +88,12 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
|
|||||||
type.getName().concat("allready registered"));
|
type.getName().concat("allready registered"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (logger.isInfoEnabled())
|
||||||
|
{
|
||||||
|
logger.info("added RepositoryHandler {} for type {}", handler.getClass(),
|
||||||
|
type);
|
||||||
|
}
|
||||||
|
|
||||||
handlerMap.put(type.getName(), handler);
|
handlerMap.put(type.getName(), handler);
|
||||||
handler.init(SCMContext.getContext());
|
handler.init(SCMContext.getContext());
|
||||||
types.add(type);
|
types.add(type);
|
||||||
@@ -112,6 +127,12 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
|
|||||||
public void create(Repository repository)
|
public void create(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException, IOException
|
||||||
{
|
{
|
||||||
|
if (logger.isInfoEnabled())
|
||||||
|
{
|
||||||
|
logger.info("create repository {} of type {}", repository.getName(),
|
||||||
|
repository.getType());
|
||||||
|
}
|
||||||
|
|
||||||
getHandler(repository).create(repository);
|
getHandler(repository).create(repository);
|
||||||
fireEvent(repository, RepositoryEvent.CREATE);
|
fireEvent(repository, RepositoryEvent.CREATE);
|
||||||
}
|
}
|
||||||
@@ -129,6 +150,12 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
|
|||||||
public void delete(Repository repository)
|
public void delete(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException, IOException
|
||||||
{
|
{
|
||||||
|
if (logger.isInfoEnabled())
|
||||||
|
{
|
||||||
|
logger.info("delete repository {} of type {}", repository.getName(),
|
||||||
|
repository.getType());
|
||||||
|
}
|
||||||
|
|
||||||
getHandler(repository).delete(repository);
|
getHandler(repository).delete(repository);
|
||||||
fireEvent(repository, RepositoryEvent.DELETE);
|
fireEvent(repository, RepositoryEvent.DELETE);
|
||||||
}
|
}
|
||||||
@@ -155,6 +182,12 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
|
|||||||
public void modify(Repository repository)
|
public void modify(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException, IOException
|
||||||
{
|
{
|
||||||
|
if (logger.isInfoEnabled())
|
||||||
|
{
|
||||||
|
logger.info("modify repository {} of type {}", repository.getName(),
|
||||||
|
repository.getType());
|
||||||
|
}
|
||||||
|
|
||||||
getHandler(repository).modify(repository);
|
getHandler(repository).modify(repository);
|
||||||
fireEvent(repository, RepositoryEvent.MODIFY);
|
fireEvent(repository, RepositoryEvent.MODIFY);
|
||||||
}
|
}
|
||||||
@@ -216,6 +249,11 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
|
|||||||
@Override
|
@Override
|
||||||
public Collection<Repository> getAll()
|
public Collection<Repository> getAll()
|
||||||
{
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("fetch all repositories");
|
||||||
|
}
|
||||||
|
|
||||||
Set<Repository> repositories = new HashSet<Repository>();
|
Set<Repository> repositories = new HashSet<Repository>();
|
||||||
|
|
||||||
for (RepositoryHandler handler : handlerMap.values())
|
for (RepositoryHandler handler : handlerMap.values())
|
||||||
@@ -231,6 +269,11 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("fetched {} repositories", repositories.size());
|
||||||
|
}
|
||||||
|
|
||||||
return repositories;
|
return repositories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
|
|
||||||
package sonia.scm.util;
|
package sonia.scm.util;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
@@ -17,9 +22,6 @@ import java.io.OutputStream;
|
|||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -28,7 +30,8 @@ public class IOUtil
|
|||||||
{
|
{
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger = Logger.getLogger(IOUtil.class.getName());
|
private static final Logger logger =
|
||||||
|
LoggerFactory.getLogger(IOUtil.class.getName());
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -48,7 +51,7 @@ public class IOUtil
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +175,7 @@ public class IOUtil
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,14 +3,21 @@
|
|||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.util;
|
package sonia.scm.util;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -21,7 +28,7 @@ public class ServiceUtil
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(ServiceUtil.class.getName());
|
LoggerFactory.getLogger(ServiceUtil.class);
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
@@ -71,10 +78,7 @@ public class ServiceUtil
|
|||||||
}
|
}
|
||||||
catch (NoSuchElementException ex)
|
catch (NoSuchElementException ex)
|
||||||
{
|
{
|
||||||
if (logger.isLoggable(Level.FINEST))
|
logger.debug(ex.getMessage(), ex);
|
||||||
{
|
|
||||||
logger.log(Level.FINEST, null, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -107,13 +111,9 @@ public class ServiceUtil
|
|||||||
}
|
}
|
||||||
catch (NoSuchElementException ex)
|
catch (NoSuchElementException ex)
|
||||||
{
|
{
|
||||||
if (logger.isLoggable(Level.FINEST))
|
logger.debug(ex.getMessage(), ex);
|
||||||
{
|
|
||||||
logger.log(Level.FINEST, null, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,22 +9,12 @@ package sonia.scm.util;
|
|||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.Writer;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -36,9 +26,6 @@ public class Util
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String DATE_PATTERN = "yyyy-MM-dd HH-mm-ss";
|
public static final String DATE_PATTERN = "yyyy-MM-dd HH-mm-ss";
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final Logger logger = Logger.getLogger(Util.class.getName());
|
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ package sonia.scm.server;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.cli.CliException;
|
import sonia.scm.cli.CliException;
|
||||||
import sonia.scm.cli.CliParser;
|
import sonia.scm.cli.CliParser;
|
||||||
import sonia.scm.cli.DefaultCliHelpBuilder;
|
import sonia.scm.cli.DefaultCliHelpBuilder;
|
||||||
@@ -20,9 +23,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXB;
|
import javax.xml.bind.JAXB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +46,7 @@ public class ServerApplication
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(ServerApplication.class.getName());
|
LoggerFactory.getLogger(ServerApplication.class.getName());
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -108,11 +108,11 @@ public class ServerApplication
|
|||||||
}
|
}
|
||||||
catch (ServerException ex)
|
catch (ServerException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,15 +124,18 @@ public class ServerApplication
|
|||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param appInfo
|
||||||
* @param parser
|
* @param parser
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
private static void printHelp(ApplicationInformation appInfo, CliParser parser, ServerConfig config)
|
private static void printHelp(ApplicationInformation appInfo,
|
||||||
|
CliParser parser, ServerConfig config)
|
||||||
{
|
{
|
||||||
String s = System.getProperty("line.separator");
|
String s = System.getProperty("line.separator");
|
||||||
StringBuilder prefix = new StringBuilder(appInfo.getName());
|
StringBuilder prefix = new StringBuilder(appInfo.getName());
|
||||||
prefix.append(" ").append( appInfo.getVersion() );
|
|
||||||
|
|
||||||
|
prefix.append(" ").append(appInfo.getVersion());
|
||||||
prefix.append(s).append("usage: ");
|
prefix.append(s).append("usage: ");
|
||||||
prefix.append(s);
|
prefix.append(s);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ package sonia.scm.web.cgi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -21,8 +24,6 @@ import java.io.OutputStream;
|
|||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -41,8 +42,7 @@ public class CGIRunner
|
|||||||
public static final int BUFFERSIZE = 2 * 8192;
|
public static final int BUFFERSIZE = 2 * 8192;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger = LoggerFactory.getLogger(CGIRunner.class);
|
||||||
Logger.getLogger(CGIRunner.class.getName());
|
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
@@ -51,12 +51,11 @@ public class CGIRunner
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
* @param environment
|
|
||||||
* @param cmdPrefix
|
* @param cmdPrefix
|
||||||
* @param ignoreExitState
|
* @param ignoreExitState
|
||||||
*/
|
*/
|
||||||
public CGIRunner(ServletContext context,
|
public CGIRunner(ServletContext context, String cmdPrefix,
|
||||||
String cmdPrefix, boolean ignoreExitState)
|
boolean ignoreExitState)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.cmdPrefix = cmdPrefix;
|
this.cmdPrefix = cmdPrefix;
|
||||||
@@ -69,6 +68,8 @@ public class CGIRunner
|
|||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param environment
|
||||||
* @param command
|
* @param command
|
||||||
* @param pathInfo
|
* @param pathInfo
|
||||||
* @param req
|
* @param req
|
||||||
@@ -76,8 +77,8 @@ public class CGIRunner
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void exec(EnvList environment, File command, String pathInfo, HttpServletRequest req,
|
public void exec(EnvList environment, File command, String pathInfo,
|
||||||
HttpServletResponse res)
|
HttpServletRequest req, HttpServletResponse res)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
String path = command.getAbsolutePath();
|
String path = command.getAbsolutePath();
|
||||||
@@ -142,8 +143,8 @@ public class CGIRunner
|
|||||||
|
|
||||||
// these extra ones were from printenv on www.dev.nomura.co.uk
|
// these extra ones were from printenv on www.dev.nomura.co.uk
|
||||||
environment.set("HTTPS", (req.isSecure()
|
environment.set("HTTPS", (req.isSecure()
|
||||||
? "ON"
|
? "ON"
|
||||||
: "OFF"));
|
: "OFF"));
|
||||||
|
|
||||||
// "DOCUMENT_ROOT" => root + "/docs",
|
// "DOCUMENT_ROOT" => root + "/docs",
|
||||||
// "SERVER_URL" => "NYI - http://us0245",
|
// "SERVER_URL" => "NYI - http://us0245",
|
||||||
@@ -163,14 +164,15 @@ public class CGIRunner
|
|||||||
execCmd = cmdPrefix + " " + execCmd;
|
execCmd = cmdPrefix + " " + execCmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logger.isLoggable(Level.FINE))
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
logger.fine("execute cgi: ".concat(execCmd));
|
logger.info("execute cgi: ".concat(execCmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
Process p = (dir == null)
|
Process p = (dir == null)
|
||||||
? Runtime.getRuntime().exec(execCmd, environment.getEnvArray())
|
? Runtime.getRuntime().exec(execCmd, environment.getEnvArray())
|
||||||
: Runtime.getRuntime().exec(execCmd, environment.getEnvArray(), dir);
|
: Runtime.getRuntime().exec(execCmd, environment.getEnvArray(),
|
||||||
|
dir);
|
||||||
|
|
||||||
// hook processes input to browser's output (async)
|
// hook processes input to browser's output (async)
|
||||||
final InputStream inFromReq = req.getInputStream();
|
final InputStream inFromReq = req.getInputStream();
|
||||||
@@ -194,9 +196,9 @@ public class CGIRunner
|
|||||||
|
|
||||||
outToCgi.close();
|
outToCgi.close();
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.FINEST, null, e);
|
logger.debug(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -266,7 +268,7 @@ public class CGIRunner
|
|||||||
StringBuilder msg = new StringBuilder("Non-zero exit status (");
|
StringBuilder msg = new StringBuilder("Non-zero exit status (");
|
||||||
|
|
||||||
msg.append(exitValue).append(") from CGI program: ").append(path);
|
msg.append(exitValue).append(") from CGI program: ").append(path);
|
||||||
logger.warning(msg.toString());
|
logger.warn(msg.toString());
|
||||||
|
|
||||||
if (!res.isCommitted())
|
if (!res.isCommitted())
|
||||||
{
|
{
|
||||||
@@ -280,11 +282,11 @@ public class CGIRunner
|
|||||||
|
|
||||||
// browser has probably closed its input stream - we
|
// browser has probably closed its input stream - we
|
||||||
// terminate and clean up...
|
// terminate and clean up...
|
||||||
logger.finest("CGI: Client closed connection!");
|
logger.debug("CGI: Client closed connection!");
|
||||||
}
|
}
|
||||||
catch (InterruptedException ie)
|
catch (InterruptedException ie)
|
||||||
{
|
{
|
||||||
logger.finest("CGI: interrupted!");
|
logger.debug("CGI: interrupted!");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ package sonia.scm.web.filter;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -23,8 +27,6 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
@@ -45,7 +47,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(LoggingFilter.class.getName());
|
LoggerFactory.getLogger(LoggingFilter.class);
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
HttpServletResponse response, FilterChain chain)
|
HttpServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
if (logger.isLoggable(Level.FINEST))
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
LoggingHttpServletRequest loggingRequest =
|
LoggingHttpServletRequest loggingRequest =
|
||||||
new LoggingHttpServletRequest(request);
|
new LoggingHttpServletRequest(request);
|
||||||
@@ -90,16 +92,16 @@ public class LoggingFilter extends HttpFilter
|
|||||||
*/
|
*/
|
||||||
private void logRequest(LoggingHttpServletRequest request)
|
private void logRequest(LoggingHttpServletRequest request)
|
||||||
{
|
{
|
||||||
logger.finest("**************** request ****************");
|
logger.debug("**************** request ****************");
|
||||||
logger.finest("Info: Request-Uri = ".concat(request.getRequestURI()));
|
logger.debug("Info: Request-Uri = ".concat(request.getRequestURI()));
|
||||||
logger.finest("Info: Remote-Addr = ".concat(request.getRemoteAddr()));
|
logger.debug("Info: Remote-Addr = ".concat(request.getRemoteAddr()));
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Info: Content-Size = ".concat(
|
"Info: Content-Size = ".concat(
|
||||||
Integer.toString(request.getContentLength())));
|
Integer.toString(request.getContentLength())));
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Info: Content-Type = ".concat(Util.nonNull(request.getContentType())));
|
"Info: Content-Type = ".concat(Util.nonNull(request.getContentType())));
|
||||||
logger.finest("Info: Method = ".concat(request.getMethod()));
|
logger.debug("Info: Method = ".concat(request.getMethod()));
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Info: AuthType = ".concat(Util.nonNull(request.getAuthType())));
|
"Info: AuthType = ".concat(Util.nonNull(request.getAuthType())));
|
||||||
|
|
||||||
Enumeration headers = request.getHeaderNames();
|
Enumeration headers = request.getHeaderNames();
|
||||||
@@ -108,7 +110,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
{
|
{
|
||||||
String header = (String) headers.nextElement();
|
String header = (String) headers.nextElement();
|
||||||
|
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Header: ".concat(header).concat(" = ").concat(
|
"Header: ".concat(header).concat(" = ").concat(
|
||||||
request.getHeader(header)));
|
request.getHeader(header)));
|
||||||
}
|
}
|
||||||
@@ -119,7 +121,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
{
|
{
|
||||||
for (Cookie cookie : cookies)
|
for (Cookie cookie : cookies)
|
||||||
{
|
{
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Cookie: ".concat(cookie.getName()).concat(" = ").concat(
|
"Cookie: ".concat(cookie.getName()).concat(" = ").concat(
|
||||||
cookie.getValue()));
|
cookie.getValue()));
|
||||||
}
|
}
|
||||||
@@ -133,7 +135,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
{
|
{
|
||||||
String parameter = (String) parameters.nextElement();
|
String parameter = (String) parameters.nextElement();
|
||||||
|
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Parameter: ".concat(parameter).concat(" = ").concat(
|
"Parameter: ".concat(parameter).concat(" = ").concat(
|
||||||
request.getParameter(parameter)));
|
request.getParameter(parameter)));
|
||||||
}
|
}
|
||||||
@@ -147,7 +149,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
{
|
{
|
||||||
String attribute = (String) attributes.nextElement();
|
String attribute = (String) attributes.nextElement();
|
||||||
|
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Attribute: ".concat(attribute).concat(" = ").concat(
|
"Attribute: ".concat(attribute).concat(" = ").concat(
|
||||||
request.getAttribute(attribute).toString()));
|
request.getAttribute(attribute).toString()));
|
||||||
}
|
}
|
||||||
@@ -155,7 +157,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
|
|
||||||
HttpSession session = request.getSession(true);
|
HttpSession session = request.getSession(true);
|
||||||
|
|
||||||
logger.finest("Session-New: ".concat(Boolean.toString(session.isNew())));
|
logger.debug("Session-New: ".concat(Boolean.toString(session.isNew())));
|
||||||
|
|
||||||
Enumeration sAttributes = session.getAttributeNames();
|
Enumeration sAttributes = session.getAttributeNames();
|
||||||
|
|
||||||
@@ -165,7 +167,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
{
|
{
|
||||||
String sAttribute = (String) sAttributes.nextElement();
|
String sAttribute = (String) sAttributes.nextElement();
|
||||||
|
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Session-Attribute: ".concat(sAttribute).concat(" = ").concat(
|
"Session-Attribute: ".concat(sAttribute).concat(" = ").concat(
|
||||||
request.getSession().getAttribute(sAttribute).toString()));
|
request.getSession().getAttribute(sAttribute).toString()));
|
||||||
}
|
}
|
||||||
@@ -180,29 +182,29 @@ public class LoggingFilter extends HttpFilter
|
|||||||
*/
|
*/
|
||||||
private void logResponse(LoggingHttpServletResponse response)
|
private void logResponse(LoggingHttpServletResponse response)
|
||||||
{
|
{
|
||||||
logger.finest("**************** response ****************");
|
logger.debug("**************** response ****************");
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"status code = ".concat(Integer.toString(response.getStatusCode())));
|
"status code = ".concat(Integer.toString(response.getStatusCode())));
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"status message = ".concat(Util.nonNull(response.getStatusMessage())));
|
"status message = ".concat(Util.nonNull(response.getStatusMessage())));
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"charset = ".concat(Util.nonNull(response.getCharacterEncoding())));
|
"charset = ".concat(Util.nonNull(response.getCharacterEncoding())));
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"content-type = ".concat(Util.nonNull(response.getContentType())));
|
"content-type = ".concat(Util.nonNull(response.getContentType())));
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"content-length = ".concat(
|
"content-length = ".concat(
|
||||||
Integer.toString(response.getContentLength())));
|
Integer.toString(response.getContentLength())));
|
||||||
|
|
||||||
for (Cookie cookie : response.getCookies())
|
for (Cookie cookie : response.getCookies())
|
||||||
{
|
{
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Cookie: ".concat(cookie.getName()).concat(" = ").concat(
|
"Cookie: ".concat(cookie.getName()).concat(" = ").concat(
|
||||||
cookie.getValue()));
|
cookie.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<String, String> header : response.getHeaders().entrySet())
|
for (Entry<String, String> header : response.getHeaders().entrySet())
|
||||||
{
|
{
|
||||||
logger.finest(
|
logger.debug(
|
||||||
"Header: ".concat(header.getKey()).concat(" = ").concat(
|
"Header: ".concat(header.getKey()).concat(" = ").concat(
|
||||||
header.getValue()));
|
header.getValue()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class ContextListener extends GuiceServletContextListener
|
|||||||
public void contextInitialized(ServletContextEvent servletContextEvent)
|
public void contextInitialized(ServletContextEvent servletContextEvent)
|
||||||
{
|
{
|
||||||
|
|
||||||
// enableDebugLogging();
|
enableDebugLogging();
|
||||||
webPluginContext =
|
webPluginContext =
|
||||||
new ScmWebPluginContext(servletContextEvent.getServletContext());
|
new ScmWebPluginContext(servletContextEvent.getServletContext());
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ package sonia.scm;
|
|||||||
import com.google.inject.multibindings.Multibinder;
|
import com.google.inject.multibindings.Multibinder;
|
||||||
import com.google.inject.servlet.ServletModule;
|
import com.google.inject.servlet.ServletModule;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.api.rest.UriExtensionsConfig;
|
import sonia.scm.api.rest.UriExtensionsConfig;
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
import sonia.scm.cache.CacheRepositoryManagerDecorator;
|
import sonia.scm.cache.CacheRepositoryManagerDecorator;
|
||||||
@@ -40,8 +43,6 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -81,6 +82,10 @@ public class ScmServletModule extends ServletModule
|
|||||||
PATTERN_SCRIPT,
|
PATTERN_SCRIPT,
|
||||||
PATTERN_STYLESHEET, "*.json", "*.xml", "*.txt" };
|
PATTERN_STYLESHEET, "*.json", "*.xml", "*.txt" };
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private static Logger logger =
|
||||||
|
LoggerFactory.getLogger(ScmServletModule.class);
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,8 +124,7 @@ public class ScmServletModule extends ServletModule
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.getLogger(ScmServletModule.class.getName()).log(Level.SEVERE,
|
logger.error(ex.getMessage(), ex);
|
||||||
null, ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Class<? extends RepositoryHandler> handler :
|
for (Class<? extends RepositoryHandler> handler :
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ package sonia.scm.filter;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.web.filter.HttpFilter;
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.util.WebUtil;
|
import sonia.scm.util.WebUtil;
|
||||||
|
import sonia.scm.web.filter.HttpFilter;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
@@ -39,7 +39,7 @@ public class StaticResourceFilter extends HttpFilter
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(StaticResourceFilter.class.getName());
|
LoggerFactory.getLogger(StaticResourceFilter.class);
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -83,13 +83,13 @@ public class StaticResourceFilter extends HttpFilter
|
|||||||
|
|
||||||
if (!WebUtil.isModified(request, resource))
|
if (!WebUtil.isModified(request, resource))
|
||||||
{
|
{
|
||||||
if (logger.isLoggable(Level.FINEST))
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
StringBuilder msg = new StringBuilder("return ");
|
StringBuilder msg = new StringBuilder("return ");
|
||||||
|
|
||||||
msg.append(HttpServletResponse.SC_NOT_MODIFIED);
|
msg.append(HttpServletResponse.SC_NOT_MODIFIED);
|
||||||
msg.append(" for ").append(uri);
|
msg.append(" for ").append(uri);
|
||||||
logger.finest(msg.toString());
|
logger.debug(msg.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
|
|
||||||
package sonia.scm.util;
|
package sonia.scm.util;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -18,8 +23,6 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -80,8 +83,7 @@ public class WebUtil
|
|||||||
"EEE, dd MMM yyyy HH:mm:ss zzz";
|
"EEE, dd MMM yyyy HH:mm:ss zzz";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final Logger logger =
|
private static final Logger logger = LoggerFactory.getLogger(WebUtil.class);
|
||||||
Logger.getLogger(WebUtil.class.getName());
|
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
@@ -212,19 +214,11 @@ public class WebUtil
|
|||||||
}
|
}
|
||||||
catch (ParseException ex)
|
catch (ParseException ex)
|
||||||
{
|
{
|
||||||
if (logger.isLoggable(Level.WARNING))
|
logger.warn(ex.getMessage(), ex);
|
||||||
{
|
|
||||||
logger.log(Level.WARNING, null, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
{
|
{
|
||||||
logger.warning(dateString);
|
logger.warn(ex.getMessage(), ex);
|
||||||
|
|
||||||
if (logger.isLoggable(Level.WARNING))
|
|
||||||
{
|
|
||||||
logger.log(Level.WARNING, dateString, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user