Fix build warnings (#1562)

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
Eduard Heimbuch
2021-03-01 09:08:01 +01:00
committed by GitHub
parent 0695ca3bac
commit 7852d1034e
46 changed files with 188 additions and 566 deletions

View File

@@ -39,10 +39,10 @@ import static java.util.Collections.unmodifiableCollection;
* .doThrow()
* .violation("name or alias must not be empty if not anonymous", "myParameter", "name")
* .violation("name or alias must not be empty if not anonymous", "myParameter", "alias")
* .when(myParameter.getName() == null && myParameter.getAlias() == null && !myParameter.isAnonymous())
* .when(myParameter.getName() == null &amp;&amp; myParameter.getAlias() == null &amp;&amp; !myParameter.isAnonymous())
* .andThrow()
* .violation("name must be empty if anonymous", "myParameter", "name")
* .when(myParameter.getName() != null && myParameter.isAnonymous());
* .when(myParameter.getName() != null &amp;&amp; myParameter.isAnonymous());
* </pre>
* Mind that using this way you do not have to use if-else constructs.
*/

View File

@@ -32,9 +32,9 @@ package sonia.scm;
public enum ServletContainer
{
SCM_SERVER,
/** Jetty version <= 6 */
/** Jetty version &lt;= 6 */
JETTY,
/** Jetty version >= 7 */
/** Jetty version &gt;= 7 */
ECLIPSE_JETTY,
TOMCAT,
GLASSFISH,

View File

@@ -207,8 +207,7 @@ public class ScmConfiguration implements Configuration {
private String mailDomainName = DEFAULT_MAIL_DOMAIN_NAME;
/**
* Calls the {@link sonia.scm.ConfigChangedListener#configChanged(Object)}
* method of all registered listeners.
* Fires the {@link ScmConfigurationChangedEvent}.
*/
public void fireChangeEvent() {
if (logger.isDebugEnabled()) {
@@ -294,7 +293,7 @@ public class ScmConfiguration implements Configuration {
* <li><b>os</b> = Operation System</li>
* <li><b>arch</b> = Architecture</li>
* </ul>
* For example http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&arch={arch}&snapshot=false
* For example `http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&amp;arch={arch}&amp;snapshot=false`
*
* @return the complete plugin url.
*/
@@ -313,6 +312,7 @@ public class ScmConfiguration implements Configuration {
/**
* Returns the mail domain, that will be used to create e-mail addresses for users without one whenever one is required.
*
* @return default mail domain
* @since 2.8.0
*/

View File

@@ -25,7 +25,7 @@
package sonia.scm.filter;
/**
* Configuration for the {@link GZipFilter}.
* Configuration for the {@link GZipResponseFilter}.
*
* @author Sebastian Sdorra
* @since 1.16

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.io;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,14 +37,13 @@ import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
/**
* {@link ObjectInputStream} implementation which uses the context class loader
* {@link ObjectInputStream} implementation which uses the context class loader
* to resolve classes.
*
* @author Sebastian Sdorra
* @since 1.36
*/
public class ScmObjectInputStream extends ObjectInputStream
{
public class ScmObjectInputStream extends ObjectInputStream {
/**
* the logger for ScmObjectInputStream
@@ -54,11 +53,7 @@ public class ScmObjectInputStream extends ObjectInputStream
//~--- constructors ---------------------------------------------------------
/**
* {@inheritDoc}
*/
public ScmObjectInputStream(InputStream stream) throws IOException
{
public ScmObjectInputStream(InputStream stream) throws IOException {
super(stream);
}
@@ -69,23 +64,18 @@ public class ScmObjectInputStream extends ObjectInputStream
*/
@Override
protected Class<?> resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException
{
throws IOException, ClassNotFoundException {
Class<?> clazz = null;
ClassLoader classLoader = getClassLoader();
try
{
try {
clazz = classLoader.loadClass(desc.getName());
}
catch (ClassNotFoundException ex)
{
} catch (ClassNotFoundException ex) {
// do not log the exception, because the class
// is mostly found by the parent method.
}
if (clazz == null)
{
if (clazz == null) {
clazz = super.resolveClass(desc);
}
@@ -99,15 +89,12 @@ public class ScmObjectInputStream extends ObjectInputStream
* is not available the method will fall back to the class loader which has
* load this class.
*
*
* @return context class loader or default class loader
*/
private ClassLoader getClassLoader()
{
private ClassLoader getClassLoader() {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null)
{
if (classLoader == null) {
logger.debug("could not find context class loader, fall back to default");
classLoader = ScmObjectInputStream.class.getClassLoader();
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.net.ahc;
//~--- JDK imports ------------------------------------------------------------
@@ -29,9 +29,8 @@ package sonia.scm.net.ahc;
import java.io.IOException;
/**
* Advanced client for http operations. The {@link AdvancedHttpClient} replaces
* the much more simpler implementation {@link sonia.scm.net.HttpClient}. The
* {@link AdvancedHttpClient} offers a fluid interface for handling most common
* Advanced client for http operations.The {@link AdvancedHttpClient} offers
* a fluid interface for handling most common
* http operations. The {@link AdvancedHttpClient} can be injected by the
* default injection mechanism of SCM-Manager.
* <p>&nbsp;</p>
@@ -62,36 +61,30 @@ import java.io.IOException;
* </code></pre>
*
* @author Sebastian Sdorra
* @since 1.46
*
* @apiviz.landmark
* @since 1.46
*/
public abstract class AdvancedHttpClient
{
public abstract class AdvancedHttpClient {
/**
* Creates a {@link ContentTransformer} for the given Content-Type.
*
* @param type object type
* @param type object type
* @param contentType content-type
* @throws ContentTransformerNotFoundException if no
* {@link ContentTransformer} could be found for the content-type
*
* @return {@link ContentTransformer}
* @throws ContentTransformerNotFoundException if no
* {@link ContentTransformer} could be found for the content-type
*/
protected abstract ContentTransformer createTransformer(Class<?> type,
String contentType);
String contentType);
/**
* Executes the given request and returns the http response. Implementation
* have to check, if the instance if from type
* {@link AdvancedHttpRequestWithBody} in order to handle request contents.
*
*
* @param request request to execute
*
* @return http response
*
* @throws IOException
*/
protected abstract AdvancedHttpResponse request(BaseHttpRequest<?> request)
@@ -100,26 +93,20 @@ public abstract class AdvancedHttpClient
/**
* Returns a builder for a DELETE request.
*
*
* @param url request url
*
* @return request builder
*/
public AdvancedHttpRequestWithBody delete(String url)
{
public AdvancedHttpRequestWithBody delete(String url) {
return new AdvancedHttpRequestWithBody(this, HttpMethod.DELETE, url);
}
/**
* Returns a builder for a HEAD request.
*
*
* @param url request url
*
* @return request builder
*/
public AdvancedHttpRequest head(String url)
{
public AdvancedHttpRequest head(String url) {
return new AdvancedHttpRequest(this, HttpMethod.HEAD, url);
}
@@ -128,53 +115,41 @@ public abstract class AdvancedHttpClient
* every method is supported by the underlying implementation of the http
* client.
*
*
* @param method http method
* @param url request url
*
* @param url request url
* @return request builder
*/
public AdvancedHttpRequestWithBody method(String method, String url)
{
public AdvancedHttpRequestWithBody method(String method, String url) {
return new AdvancedHttpRequestWithBody(this, method, url);
}
/**
* Returns a builder for a OPTIONS request.
*
*
* @param url request url
*
* @return request builder
*/
public AdvancedHttpRequestWithBody options(String url)
{
public AdvancedHttpRequestWithBody options(String url) {
return new AdvancedHttpRequestWithBody(this, HttpMethod.OPTIONS, url);
}
/**
* Returns a builder for a POST request.
*
*
* @param url request url
*
* @return request builder
*/
public AdvancedHttpRequestWithBody post(String url)
{
public AdvancedHttpRequestWithBody post(String url) {
return new AdvancedHttpRequestWithBody(this, HttpMethod.POST, url);
}
/**
* Returns a builder for a PUT request.
*
*
* @param url request url
*
* @return request builder
*/
public AdvancedHttpRequestWithBody put(String url)
{
public AdvancedHttpRequestWithBody put(String url) {
return new AdvancedHttpRequestWithBody(this, HttpMethod.PUT, url);
}
@@ -183,13 +158,10 @@ public abstract class AdvancedHttpClient
/**
* Returns a builder for a GET request.
*
*
* @param url request url
*
* @return request builder
*/
public AdvancedHttpRequest get(String url)
{
public AdvancedHttpRequest get(String url) {
return new AdvancedHttpRequest(this, HttpMethod.GET, url);
}
}

View File

@@ -31,7 +31,7 @@ import sonia.scm.plugin.ExtensionPoint;
* Transforms {@link ByteSource} content to an object and vice versa. This class
* is an extension point, this means that plugins can define their own
* {@link ContentTransformer} implementations by implementing the interface and
* annotate the implementation with the {@link sonia.scm.plugin.ext.Extension}
* annotate the implementation with the {@link sonia.scm.plugin.Extension}
* annotation.
*
* @author Sebastian Sdorra

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
@@ -37,19 +37,15 @@ import sonia.scm.util.AssertUtil;
*
* @author Sebastian Sdorra
*/
public abstract class AbstractRepositoryManager implements RepositoryManager
{
public abstract class AbstractRepositoryManager implements RepositoryManager {
/**
* Sends a {@link RepositoryHookEvent} to each registered
* {@link RepositoryHook} and sends the {@link RepositoryHookEvent} to
* the {@link ScmEventBus}.
* Sends the {@link RepositoryHookEvent} to the {@link ScmEventBus}.
*
* @param event event to be fired
*/
@Override
public void fireHookEvent(RepositoryHookEvent event)
{
public void fireHookEvent(RepositoryHookEvent event) {
AssertUtil.assertIsNotNull(event);
AssertUtil.assertIsNotNull(event.getRepository());
AssertUtil.assertIsNotNull(event.getType());
@@ -64,13 +60,12 @@ public abstract class AbstractRepositoryManager implements RepositoryManager
/**
* Send a {@link RepositoryEvent} to the {@link ScmEventBus}.
*
* @param event type of change event
* @param repository repository that has changed
* @param event type of change event
* @param repository repository that has changed
* @param oldRepository old repository
*/
protected void fireEvent(HandlerEventType event, Repository repository,
Repository oldRepository)
{
Repository oldRepository) {
ScmEventBus.getInstance().post(new RepositoryModificationEvent(event, repository,
oldRepository));
}
@@ -78,25 +73,21 @@ public abstract class AbstractRepositoryManager implements RepositoryManager
/**
* Send a {@link RepositoryEvent} to the {@link ScmEventBus}.
*
* @param event type of change event
* @param event type of change event
* @param repository repository that has changed
*/
protected void fireEvent(HandlerEventType event, Repository repository)
{
protected void fireEvent(HandlerEventType event, Repository repository) {
ScmEventBus.getInstance().post(new RepositoryEvent(event, repository));
}
/**
* Prepare a hook event before it is fired to the event system of SCM-Manager.
*
*
* @param event hook event
* @since 1.26
*
* @return
* @since 1.26
*/
protected RepositoryHookEvent prepareHookEvent(RepositoryHookEvent event)
{
protected RepositoryHookEvent prepareHookEvent(RepositoryHookEvent event) {
return event;
}
}

View File

@@ -24,6 +24,7 @@
package sonia.scm.repository;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.stream.Stream;
@@ -31,8 +32,9 @@ import java.util.stream.Stream;
import static java.util.stream.Stream.of;
@Value
@EqualsAndHashCode(callSuper=false)
public class Added extends Modification {
private final String path;
String path;
@Override
Stream<String> getEffectedPaths() {

View File

@@ -24,6 +24,7 @@
package sonia.scm.repository;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.stream.Stream;
@@ -31,9 +32,10 @@ import java.util.stream.Stream;
import static java.util.stream.Stream.of;
@Value
@EqualsAndHashCode(callSuper=false)
public class Copied extends Modification {
private final String sourcePath;
private final String targetPath;
String sourcePath;
String targetPath;
@Override
Stream<String> getEffectedPaths() {

View File

@@ -24,6 +24,7 @@
package sonia.scm.repository;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.stream.Stream;
@@ -31,8 +32,9 @@ import java.util.stream.Stream;
import static java.util.stream.Stream.of;
@Value
@EqualsAndHashCode(callSuper=false)
public class Modified extends Modification {
private final String path;
String path;
@Override
Stream<String> getEffectedPaths() {

View File

@@ -24,6 +24,7 @@
package sonia.scm.repository;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.stream.Stream;
@@ -31,8 +32,9 @@ import java.util.stream.Stream;
import static java.util.stream.Stream.of;
@Value
@EqualsAndHashCode(callSuper=false)
public class Removed extends Modification {
private final String path;
String path;
@Override
Stream<String> getEffectedPaths() {

View File

@@ -24,6 +24,7 @@
package sonia.scm.repository;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.stream.Stream;
@@ -31,9 +32,10 @@ import java.util.stream.Stream;
import static java.util.stream.Stream.of;
@Value
@EqualsAndHashCode(callSuper=false)
public class Renamed extends Modification {
private final String oldPath;
private final String newPath;
String oldPath;
String newPath;
@Override
Stream<String> getEffectedPaths() {

View File

@@ -38,7 +38,7 @@ public class RepositoryHookEvent
{
/**
* Constructs a new {@link ExtendedRepositoryHookEvent}.
* Constructs a new {@link RepositoryHookEvent}.
*
* @param context context of current hook
* @param repository

View File

@@ -100,7 +100,7 @@ public interface RepositoryManager
/**
* Creates a new repository and afterwards executes the logic from the {@param afterCreation}.
* Creates a new repository and afterwards executes the logic from the afterCreation.
*
* @param repository the repository to create
* @param afterCreation consumer which is executed after the repository was created

View File

@@ -53,12 +53,12 @@ import java.util.Set;
*
* If the merge is successful, the result will look like this:
* <pre><code>
* O <- Merge result (new head of integration_branch)
* |\
* | \
* old integration_branch -> O O <- feature_branch
* | |
* O O
* O &lt;- Merge result (new head of integration_branch)
* |\
* | \
* old integration_branch -&gt; O O &lt;- feature_branch
* | |
* O O
* </code></pre>
*
* To check whether they can be merged without conflicts beforehand do this:

View File

@@ -41,18 +41,18 @@ import java.io.File;
* implemented:
*
* <dl>
* <dt>{@link #initialize(C, File, String)}</dt>
* <dt>{@link SimpleWorkingCopyFactory#initialize(C, File, String)}</dt>
* <dd>Creates a new clone of the repository for the given context in the given
* directory with the given branch checked out (if branches are supported).</dd>
* <dt>{@link #reclaim(C, File, String)}</dt>
* <dt>{@link SimpleWorkingCopyFactory#reclaim(C, File, String)}</dt>
* <dd>Reclaim the working directory with a already checked out clone of the
* repository given in the context, so that the directory is not modified in
* respect to the repository and the given branch is checked out (if branches
* are supported).</dd>
* <dt>{@link #closeWorkingCopy(W)}</dt>
* <dt>{@link SimpleWorkingCopyFactory#closeWorkingCopy(W)}</dt>
* <dd>Closes resources allocated for the working copy, so that the directory can
* be put to the cache. Will be called at the end of the operation.</dd>
* <dt>{@link #closeRepository(R)}</dt>
* <dt>{@link SimpleWorkingCopyFactory#closeRepository(R)}</dt>
* <dd>Closes resources allocated for the central repository.</dd>
* </dl>
* <br>

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.security;
import java.util.Collection;
@@ -33,33 +33,25 @@ import java.util.function.Predicate;
* @author Sebastian Sdorra
* @since 1.31
*/
public interface SecuritySystem
{
public interface SecuritySystem {
/**
* Store a new permission.
*
*
* @param permission permission to be stored
*
* @return stored permission
*/
void addPermission(AssignedPermission permission);
/**
* Delete stored permission.
*
*
* @param permission permission to be deleted
*/
void deletePermission(AssignedPermission permission);
//~--- get methods ----------------------------------------------------------
/**
* Return all available permissions.
*
*
* @return available permissions
*/
Collection<PermissionDescriptor> getAvailablePermissions();
@@ -68,9 +60,7 @@ public interface SecuritySystem
* Returns all stored permissions which are matched by the given
* {@link Predicate}.
*
*
* @param predicate predicate to filter
*
* @return filtered permissions
*/
Collection<AssignedPermission> getPermissions(Predicate<AssignedPermission> predicate);

View File

@@ -43,7 +43,7 @@ public interface ExportableStore {
StoreEntryMetaData getMetaData();
/**
* Exports the data of this store to the given {@param exporter}.
* Exports the data of this store to the given exporter.
*/
void export(Exporter exporter) throws IOException;
}

View File

@@ -72,7 +72,7 @@ public final class Archives {
* Example:
* <pre>
* Archives.addPathToTar(Paths.get("some/dir"), Files.newOutputStream("my.tar"))
* .filter(path -> !path.toString().endsWith("~"))
* .filter(path -&gt; !path.toString().endsWith("~"))
* .run();
* </pre>
* @param path The path containing the files to be added to the tar.