mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-21 15:59:48 +01:00
fix some deprecated warnings
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -177,6 +177,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.0</version>
|
<version>3.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<showWarnings>true</showWarnings>
|
||||||
|
<showDeprecation>true</showDeprecation>
|
||||||
<source>${project.build.javaLevel}</source>
|
<source>${project.build.javaLevel}</source>
|
||||||
<target>${project.build.javaLevel}</target>
|
<target>${project.build.javaLevel}</target>
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ package sonia.scm.io;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ public abstract class AbstractWriter<T>
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(output);
|
IOUtil.close(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -46,6 +45,7 @@ import sonia.scm.repository.Repository;
|
|||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RepositoryException;
|
||||||
import sonia.scm.repository.spi.CatCommand;
|
import sonia.scm.repository.spi.CatCommand;
|
||||||
import sonia.scm.repository.spi.CatCommandRequest;
|
import sonia.scm.repository.spi.CatCommandRequest;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -117,8 +117,8 @@ public final class CatCommandBuilder
|
|||||||
* @throws RepositoryException
|
* @throws RepositoryException
|
||||||
*/
|
*/
|
||||||
public CatCommandBuilder retriveContent(OutputStream outputStream,
|
public CatCommandBuilder retriveContent(OutputStream outputStream,
|
||||||
String path)
|
String path)
|
||||||
throws IOException, RepositoryException
|
throws IOException, RepositoryException
|
||||||
{
|
{
|
||||||
getCatResult(outputStream, path);
|
getCatResult(outputStream, path);
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ public final class CatCommandBuilder
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(baos);
|
IOUtil.close(baos);
|
||||||
}
|
}
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
@@ -185,11 +185,11 @@ public final class CatCommandBuilder
|
|||||||
* @throws RepositoryException
|
* @throws RepositoryException
|
||||||
*/
|
*/
|
||||||
private void getCatResult(OutputStream outputStream, String path)
|
private void getCatResult(OutputStream outputStream, String path)
|
||||||
throws IOException, RepositoryException
|
throws IOException, RepositoryException
|
||||||
{
|
{
|
||||||
Preconditions.checkNotNull(outputStream, "OutputStream is required");
|
Preconditions.checkNotNull(outputStream, "OutputStream is required");
|
||||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
||||||
"path is required");
|
"path is required");
|
||||||
|
|
||||||
CatCommandRequest requestClone = request.clone();
|
CatCommandRequest requestClone = request.clone();
|
||||||
|
|
||||||
@@ -206,8 +206,8 @@ public final class CatCommandBuilder
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** implementation of the cat command */
|
/** implementation of the cat command */
|
||||||
private CatCommand catCommand;
|
private final CatCommand catCommand;
|
||||||
|
|
||||||
/** request for the cat command */
|
/** request for the cat command */
|
||||||
private CatCommandRequest request = new CatCommandRequest();
|
private final CatCommandRequest request = new CatCommandRequest();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ package sonia.scm.repository.api;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -44,6 +43,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RepositoryException;
|
||||||
import sonia.scm.repository.spi.DiffCommand;
|
import sonia.scm.repository.spi.DiffCommand;
|
||||||
import sonia.scm.repository.spi.DiffCommandRequest;
|
import sonia.scm.repository.spi.DiffCommandRequest;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ public final class DiffCommandBuilder
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(baos);
|
IOUtil.close(baos);
|
||||||
}
|
}
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
@@ -149,15 +149,15 @@ public final class DiffCommandBuilder
|
|||||||
//~--- set methods ----------------------------------------------------------
|
//~--- set methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the diff format which should be used for the output.
|
* Sets the diff format which should be used for the output.
|
||||||
* <strong>Note: </strong> If the repository provider does not support the
|
* <strong>Note: </strong> If the repository provider does not support the
|
||||||
* diff format, it will fallback to its default format.
|
* diff format, it will fallback to its default format.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param format format of the diff output
|
* @param format format of the diff output
|
||||||
*
|
*
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
*
|
*
|
||||||
* @since 1.34
|
* @since 1.34
|
||||||
*/
|
*/
|
||||||
public DiffCommandBuilder setFormat(DiffFormat format)
|
public DiffCommandBuilder setFormat(DiffFormat format)
|
||||||
@@ -228,8 +228,8 @@ public final class DiffCommandBuilder
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** implementation of the diff command */
|
/** implementation of the diff command */
|
||||||
private DiffCommand diffCommand;
|
private final DiffCommand diffCommand;
|
||||||
|
|
||||||
/** request for the diff command implementation */
|
/** request for the diff command implementation */
|
||||||
private DiffCommandRequest request = new DiffCommandRequest();
|
private final DiffCommandRequest request = new DiffCommandRequest();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ package sonia.scm.template;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -124,7 +124,7 @@ public final class Templates
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(reader);
|
IOUtil.close(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public final class IOUtil
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.error(ex.getMessage(), ex);
|
logger.warn("IOException thrown while closing Closeable.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ package sonia.scm.web.filter;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -87,8 +87,8 @@ public class LoggingFilter extends HttpFilter
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void doFilter(HttpServletRequest request,
|
protected void doFilter(HttpServletRequest request,
|
||||||
HttpServletResponse response, FilterChain chain)
|
HttpServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
@@ -120,11 +120,11 @@ public class LoggingFilter extends HttpFilter
|
|||||||
logger.debug("Info: Request-Uri = {}", request.getRequestURI());
|
logger.debug("Info: Request-Uri = {}", request.getRequestURI());
|
||||||
logger.debug("Info: Remote-Addr = {}", request.getRemoteAddr());
|
logger.debug("Info: Remote-Addr = {}", request.getRemoteAddr());
|
||||||
logger.debug("Info: Remote-User = {}",
|
logger.debug("Info: Remote-User = {}",
|
||||||
Util.nonNull(request.getRemoteUser()));
|
Util.nonNull(request.getRemoteUser()));
|
||||||
logger.debug("Info: Content-Size = {}",
|
logger.debug("Info: Content-Size = {}",
|
||||||
Integer.toString(request.getContentLength()));
|
Integer.toString(request.getContentLength()));
|
||||||
logger.debug("Info: Content-Type = {}",
|
logger.debug("Info: Content-Type = {}",
|
||||||
Util.nonNull(request.getContentType()));
|
Util.nonNull(request.getContentType()));
|
||||||
logger.debug("Info: Method = {}", request.getMethod());
|
logger.debug("Info: Method = {}", request.getMethod());
|
||||||
logger.debug("Info: AuthType = {}", Util.nonNull(request.getAuthType()));
|
logger.debug("Info: AuthType = {}", Util.nonNull(request.getAuthType()));
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
String parameter = (String) parameters.nextElement();
|
String parameter = (String) parameters.nextElement();
|
||||||
|
|
||||||
logger.debug("Parameter: {} = {}", parameter,
|
logger.debug("Parameter: {} = {}", parameter,
|
||||||
request.getParameter(parameter));
|
request.getParameter(parameter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
String attribute = (String) attributes.nextElement();
|
String attribute = (String) attributes.nextElement();
|
||||||
|
|
||||||
logger.debug("Attribute: {} = {}", attribute,
|
logger.debug("Attribute: {} = {}", attribute,
|
||||||
request.getAttribute(attribute).toString());
|
request.getAttribute(attribute).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
String sAttribute = (String) sAttributes.nextElement();
|
String sAttribute = (String) sAttributes.nextElement();
|
||||||
|
|
||||||
logger.debug("Session-Attribute: {} = {}", sAttribute,
|
logger.debug("Session-Attribute: {} = {}", sAttribute,
|
||||||
request.getSession().getAttribute(sAttribute).toString());
|
request.getSession().getAttribute(sAttribute).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,18 +212,18 @@ public class LoggingFilter extends HttpFilter
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void logResponse(HttpServletResponse orgResponse,
|
private void logResponse(HttpServletResponse orgResponse,
|
||||||
BufferedHttpServletResponse response)
|
BufferedHttpServletResponse response)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
logger.debug("**************** response ****************");
|
logger.debug("**************** response ****************");
|
||||||
logger.debug("status code = {}",
|
logger.debug("status code = {}",
|
||||||
Integer.toString(response.getStatusCode()));
|
Integer.toString(response.getStatusCode()));
|
||||||
logger.debug("status message = {}",
|
logger.debug("status message = {}",
|
||||||
Util.nonNull(response.getStatusMessage()));
|
Util.nonNull(response.getStatusMessage()));
|
||||||
logger.debug("charset = {}", Util.nonNull(response.getCharacterEncoding()));
|
logger.debug("charset = {}", Util.nonNull(response.getCharacterEncoding()));
|
||||||
logger.debug("content-type = {}", Util.nonNull(response.getContentType()));
|
logger.debug("content-type = {}", Util.nonNull(response.getContentType()));
|
||||||
logger.debug("content-length = {}",
|
logger.debug("content-length = {}",
|
||||||
Integer.toString(response.getContentLength()));
|
Integer.toString(response.getContentLength()));
|
||||||
|
|
||||||
for (Cookie cookie : response.getCookies())
|
for (Cookie cookie : response.getCookies())
|
||||||
{
|
{
|
||||||
@@ -250,7 +250,7 @@ public class LoggingFilter extends HttpFilter
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(out);
|
IOUtil.close(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Content: ".concat(new String(content)));
|
logger.trace("Content: ".concat(new String(content)));
|
||||||
@@ -297,6 +297,6 @@ public class LoggingFilter extends HttpFilter
|
|||||||
private boolean isTextRequest(String contentType)
|
private boolean isTextRequest(String contentType)
|
||||||
{
|
{
|
||||||
return !Strings.isNullOrEmpty(contentType)
|
return !Strings.isNullOrEmpty(contentType)
|
||||||
&& contentType.toLowerCase(Locale.ENGLISH).startsWith("text");
|
&& contentType.toLowerCase(Locale.ENGLISH).startsWith("text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,13 +30,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.web.proxy;
|
package sonia.scm.web.proxy;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.google.common.io.Closeables;
|
import com.google.common.io.Closer;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
@@ -48,6 +49,8 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
|
||||||
@@ -152,7 +155,7 @@ public class ProxyServlet extends HttpServlet
|
|||||||
|
|
||||||
con.disconnect();
|
con.disconnect();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.error("could not proxy request", ex);
|
logger.error("could not proxy request", ex);
|
||||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||||
@@ -172,13 +175,14 @@ public class ProxyServlet extends HttpServlet
|
|||||||
private void copyContent(HttpURLConnection con, HttpServletResponse response)
|
private void copyContent(HttpURLConnection con, HttpServletResponse response)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
BufferedInputStream webToProxyBuf = null;
|
Closer closer = Closer.create();
|
||||||
BufferedOutputStream proxyToClientBuf = null;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
webToProxyBuf = new BufferedInputStream(con.getInputStream());
|
InputStream webToProxyBuf =
|
||||||
proxyToClientBuf = new BufferedOutputStream(response.getOutputStream());
|
closer.register(new BufferedInputStream(con.getInputStream()));
|
||||||
|
OutputStream proxyToClientBuf =
|
||||||
|
closer.register(new BufferedOutputStream(response.getOutputStream()));
|
||||||
|
|
||||||
long bytes = ByteStreams.copy(webToProxyBuf, proxyToClientBuf);
|
long bytes = ByteStreams.copy(webToProxyBuf, proxyToClientBuf);
|
||||||
|
|
||||||
@@ -186,8 +190,7 @@ public class ProxyServlet extends HttpServlet
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(webToProxyBuf);
|
closer.close();
|
||||||
Closeables.closeQuietly(proxyToClientBuf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,5 +310,5 @@ public class ProxyServlet extends HttpServlet
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private ProxyConfigurationProvider configurationProvider;
|
private final ProxyConfigurationProvider configurationProvider;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.web;
|
package sonia.scm.web;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import com.google.common.io.Closeables;
|
import com.google.common.io.Closer;
|
||||||
|
|
||||||
import org.eclipse.jgit.transport.ReceiveCommand;
|
import org.eclipse.jgit.transport.ReceiveCommand;
|
||||||
import org.eclipse.jgit.transport.ReceivePack;
|
import org.eclipse.jgit.transport.ReceivePack;
|
||||||
@@ -55,7 +56,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -91,8 +91,8 @@ public class GitFileHook
|
|||||||
* @param rpack
|
* @param rpack
|
||||||
* @param commands
|
* @param commands
|
||||||
*/
|
*/
|
||||||
private GitFileHook(RepositoryHookType type,
|
private GitFileHook(RepositoryHookType type, ReceivePack rpack,
|
||||||
ReceivePack rpack, Iterable<ReceiveCommand> commands)
|
Iterable<ReceiveCommand> commands)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.rpack = rpack;
|
this.rpack = rpack;
|
||||||
@@ -106,13 +106,12 @@ public class GitFileHook
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param executor
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param rpack
|
* @param rpack
|
||||||
* @param commands
|
* @param commands
|
||||||
*/
|
*/
|
||||||
public static void execute(RepositoryHookType type,
|
public static void execute(RepositoryHookType type, ReceivePack rpack,
|
||||||
ReceivePack rpack, Iterable<ReceiveCommand> commands)
|
Iterable<ReceiveCommand> commands)
|
||||||
{
|
{
|
||||||
new GitFileHook(type, rpack, commands).execute();
|
new GitFileHook(type, rpack, commands).execute();
|
||||||
}
|
}
|
||||||
@@ -208,14 +207,18 @@ public class GitFileHook
|
|||||||
private void execute(File hook)
|
private void execute(File hook)
|
||||||
{
|
{
|
||||||
Process p;
|
Process p;
|
||||||
PrintWriter writer = null;
|
Closer closer = Closer.create();
|
||||||
BufferedReader stdReader = null;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
p = createProcess(hook);
|
p = createProcess(hook);
|
||||||
writer = new PrintWriter(p.getOutputStream());
|
|
||||||
stdReader = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
PrintWriter writer =
|
||||||
|
closer.register(new PrintWriter(p.getOutputStream()));
|
||||||
|
BufferedReader stdReader = closer.register(
|
||||||
|
new BufferedReader(
|
||||||
|
new InputStreamReader(
|
||||||
|
p.getInputStream())));
|
||||||
|
|
||||||
for (ReceiveCommand rc : commands)
|
for (ReceiveCommand rc : commands)
|
||||||
{
|
{
|
||||||
@@ -224,9 +227,9 @@ public class GitFileHook
|
|||||||
logger.trace("write rc output \"{}\" to hook {}", output, hook);
|
logger.trace("write rc output \"{}\" to hook {}", output, hook);
|
||||||
writer.println(output);
|
writer.println(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
String line = stdReader.readLine();
|
String line = stdReader.readLine();
|
||||||
|
|
||||||
while (line != null)
|
while (line != null)
|
||||||
@@ -256,8 +259,7 @@ public class GitFileHook
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(writer);
|
IOUtil.close(closer);
|
||||||
Closeables.closeQuietly(stdReader);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,11 +320,11 @@ public class GitFileHook
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Iterable<ReceiveCommand> commands;
|
private final Iterable<ReceiveCommand> commands;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private ReceivePack rpack;
|
private final ReceivePack rpack;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryHookType type;
|
private final RepositoryHookType type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ import sonia.scm.template.TemplateEngineFactory;
|
|||||||
import sonia.scm.url.RepositoryUrlProvider;
|
import sonia.scm.url.RepositoryUrlProvider;
|
||||||
import sonia.scm.url.UrlProvider;
|
import sonia.scm.url.UrlProvider;
|
||||||
import sonia.scm.url.UrlProviderFactory;
|
import sonia.scm.url.UrlProviderFactory;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -196,7 +197,7 @@ public class GitRepositoryViewer
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(service);
|
IOUtil.close(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import sonia.scm.repository.client.api.RepositoryClientException;
|
|||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -103,7 +104,7 @@ public class GitCommitCommand implements CommitCommand
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(converter);
|
IOUtil.close(converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return changeset;
|
return changeset;
|
||||||
@@ -112,5 +113,5 @@ public class GitCommitCommand implements CommitCommand
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Git git;
|
private final Git git;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,14 +226,14 @@ public class SvnBlameHandler implements ISVNAnnotateHandler
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private List<BlameLine> blameLines;
|
private final List<BlameLine> blameLines;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Map<Long, String> descriptionCache = new HashMap<Long, String>();
|
private final Map<Long, String> descriptionCache = new HashMap<Long, String>();
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private String path;
|
private final String path;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private SVNRepository svnRepository;
|
private final SVNRepository svnRepository;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,16 +30,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.repository.client.api;
|
package sonia.scm.repository.client.api;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.repository.client.spi.RepositoryClientProvider;
|
import sonia.scm.repository.client.spi.RepositoryClientProvider;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public final class RepositoryClient implements Closeable
|
|||||||
logger.trace("close client provider");
|
logger.trace("close client provider");
|
||||||
}
|
}
|
||||||
|
|
||||||
Closeables.closeQuietly(clientProvider);
|
IOUtil.close(clientProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -204,5 +204,5 @@ public final class RepositoryClient implements Closeable
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryClientProvider clientProvider;
|
private final RepositoryClientProvider clientProvider;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -125,8 +124,6 @@ public abstract class ZippedRepositoryTestBase extends AbstractTestBase
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
protected File createRepositoryDirectory()
|
protected File createRepositoryDirectory()
|
||||||
{
|
{
|
||||||
@@ -190,7 +187,7 @@ public abstract class ZippedRepositoryTestBase extends AbstractTestBase
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(output);
|
IOUtil.close(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +197,7 @@ public abstract class ZippedRepositoryTestBase extends AbstractTestBase
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(zip);
|
IOUtil.close(zip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import java.io.OutputStream;
|
|||||||
import javax.ws.rs.WebApplicationException;
|
import javax.ws.rs.WebApplicationException;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.StreamingOutput;
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -134,18 +135,18 @@ public class BrowserStreamingOutput implements StreamingOutput
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(repositoryService);
|
IOUtil.close(repositoryService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private CatCommandBuilder builder;
|
private final CatCommandBuilder builder;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private String path;
|
private final String path;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import java.io.OutputStream;
|
|||||||
import javax.ws.rs.WebApplicationException;
|
import javax.ws.rs.WebApplicationException;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.StreamingOutput;
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -129,15 +130,15 @@ public class DiffStreamingOutput implements StreamingOutput
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(repositoryService);
|
IOUtil.close(repositoryService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private DiffCommandBuilder builder;
|
private final DiffCommandBuilder builder;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ package sonia.scm.api.rest.resources;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
@@ -75,6 +74,7 @@ import sonia.scm.security.RepositoryPermission;
|
|||||||
import sonia.scm.security.ScmSecurityException;
|
import sonia.scm.security.ScmSecurityException;
|
||||||
import sonia.scm.util.AssertUtil;
|
import sonia.scm.util.AssertUtil;
|
||||||
import sonia.scm.util.HttpUtil;
|
import sonia.scm.util.HttpUtil;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -383,7 +383,7 @@ public class RepositoryResource
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(service);
|
IOUtil.close(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -443,7 +443,7 @@ public class RepositoryResource
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(service);
|
IOUtil.close(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -534,7 +534,7 @@ public class RepositoryResource
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(service);
|
IOUtil.close(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -638,7 +638,7 @@ public class RepositoryResource
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(service);
|
IOUtil.close(service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -741,7 +741,7 @@ public class RepositoryResource
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(service);
|
IOUtil.close(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -960,7 +960,7 @@ public class RepositoryResource
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(service);
|
IOUtil.close(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
import com.google.inject.Binder;
|
import com.google.inject.Binder;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
@@ -55,6 +54,7 @@ import sonia.scm.plugin.ext.Extension;
|
|||||||
import sonia.scm.plugin.ext.ExtensionBinder;
|
import sonia.scm.plugin.ext.ExtensionBinder;
|
||||||
import sonia.scm.plugin.ext.ExtensionProcessor;
|
import sonia.scm.plugin.ext.ExtensionProcessor;
|
||||||
import sonia.scm.plugin.ext.Extensions;
|
import sonia.scm.plugin.ext.Extensions;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.web.security.DefaultAuthenticationHandler;
|
import sonia.scm.web.security.DefaultAuthenticationHandler;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -146,8 +146,6 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
*
|
*
|
||||||
* @param classLoader
|
* @param classLoader
|
||||||
* @param packages
|
* @param packages
|
||||||
* @param annotation
|
|
||||||
* @param processor
|
|
||||||
* @param extensionPointProcessor
|
* @param extensionPointProcessor
|
||||||
* @param extensionProcessor
|
* @param extensionProcessor
|
||||||
* @param <T>
|
* @param <T>
|
||||||
@@ -488,7 +486,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(input);
|
IOUtil.close(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -607,7 +605,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(content);
|
IOUtil.close(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,10 +637,19 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private AnnotationScannerFactory annotationScannerFactory;
|
private final AnnotationScannerFactory annotationScannerFactory;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Set<AnnotatedClass<Extension>> bounds = Sets.newHashSet();
|
private final Set<AnnotatedClass<Extension>> bounds = Sets.newHashSet();
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private final Set<Module> moduleSet = Sets.newHashSet();
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private final Set<Plugin> installedPlugins = new HashSet<Plugin>();
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private final ServletContext servletContext;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private URL coreFile;
|
private URL coreFile;
|
||||||
@@ -652,13 +659,4 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Set<AnnotatedClass<Extension>> extensions;
|
private Set<AnnotatedClass<Extension>> extensions;
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private Set<Module> moduleSet = Sets.newHashSet();
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private Set<Plugin> installedPlugins = new HashSet<Plugin>();
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private ServletContext servletContext;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ package sonia.scm.util;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -235,7 +234,7 @@ public class DebugServlet extends HttpServlet
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(writer);
|
IOUtil.close(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ import java.net.URL;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -228,7 +229,7 @@ public abstract class TemplateEngineTestBase
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Closeables.closeQuietly(input);
|
IOUtil.close(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user