mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-11-03 20:15:52 +01:00 
			
		
		
		
	Fix sonar issues
This commit is contained in:
		@@ -56,5 +56,6 @@ public class NoneCachingWorkingCopyPool implements WorkingCopyPool {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public void shutdown() {
 | 
					  public void shutdown() {
 | 
				
			||||||
 | 
					    // no caches, nothing to clean up :-)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * MIT License
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-present Cloudogu GmbH and Contributors
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
				
			||||||
 | 
					 * of this software and associated documentation files (the "Software"), to deal
 | 
				
			||||||
 | 
					 * in the Software without restriction, including without limitation the rights
 | 
				
			||||||
 | 
					 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
				
			||||||
 | 
					 * copies of the Software, and to permit persons to whom the Software is
 | 
				
			||||||
 | 
					 * furnished to do so, subject to the following conditions:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The above copyright notice and this permission notice shall be included in all
 | 
				
			||||||
 | 
					 * copies or substantial portions of the Software.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
				
			||||||
 | 
					 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
				
			||||||
 | 
					 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
				
			||||||
 | 
					 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
				
			||||||
 | 
					 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
				
			||||||
 | 
					 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
				
			||||||
 | 
					 * SOFTWARE.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package sonia.scm.repository.work;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import sonia.scm.ContextEntry;
 | 
				
			||||||
 | 
					import sonia.scm.ExceptionWithContext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class WorkdirCreationException extends ExceptionWithContext {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public static final String CODE = "3tS0mjSoo1";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public WorkdirCreationException(String path, Exception cause) {
 | 
				
			||||||
 | 
					    super(ContextEntry.ContextBuilder.entity("Path", path).build(), "Could not create directory " + path, cause);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Override
 | 
				
			||||||
 | 
					  public String getCode() {
 | 
				
			||||||
 | 
					    return CODE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -47,7 +47,7 @@ public class WorkdirProvider {
 | 
				
			|||||||
    try {
 | 
					    try {
 | 
				
			||||||
      return Files.createTempDirectory(rootDirectory.toPath(),"workdir").toFile();
 | 
					      return Files.createTempDirectory(rootDirectory.toPath(),"workdir").toFile();
 | 
				
			||||||
    } catch (IOException e) {
 | 
					    } catch (IOException e) {
 | 
				
			||||||
      throw new RuntimeException("could not create temporary workdir", e);
 | 
					      throw new WorkdirCreationException(rootDirectory.toString(), e);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,8 @@ public class SimpleHgWorkingCopyFactory extends SimpleWorkingCopyFactory<Reposit
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
 | 
					  // The hg api to create a command is meant to be used from the command classes, not from their "flags" base classes.
 | 
				
			||||||
 | 
					  @SuppressWarnings("java:S3252")
 | 
				
			||||||
  protected ParentAndClone<Repository, Repository> reclaim(HgCommandContext context, File target, String initialBranch) throws ReclaimFailedException {
 | 
					  protected ParentAndClone<Repository, Repository> reclaim(HgCommandContext context, File target, String initialBranch) throws ReclaimFailedException {
 | 
				
			||||||
    Repository centralRepository = openCentral(context);
 | 
					    Repository centralRepository = openCentral(context);
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,8 +93,9 @@ public class HgBranchCommandTest extends AbstractHgCommandTestBase {
 | 
				
			|||||||
  public void shouldThrowInternalRepositoryException() {
 | 
					  public void shouldThrowInternalRepositoryException() {
 | 
				
			||||||
    String branchToBeClosed = "default";
 | 
					    String branchToBeClosed = "default";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    new HgBranchCommand(cmdContext, workingCopyFactory).deleteOrClose(branchToBeClosed);
 | 
					    HgBranchCommand hgBranchCommand = new HgBranchCommand(cmdContext, workingCopyFactory);
 | 
				
			||||||
    assertThrows(InternalRepositoryException.class, () -> new HgBranchCommand(cmdContext, workingCopyFactory).deleteOrClose(branchToBeClosed));
 | 
					    hgBranchCommand.deleteOrClose(branchToBeClosed);
 | 
				
			||||||
 | 
					    assertThrows(InternalRepositoryException.class, () -> hgBranchCommand.deleteOrClose(branchToBeClosed));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private List<Branch> readBranches() {
 | 
					  private List<Branch> readBranches() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,9 +50,11 @@ public class SimpleSvnWorkingCopyFactory extends SimpleWorkingCopyFactory<File,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  protected void closeRepository(File workingCopy) {
 | 
					  protected void closeRepository(File workingCopy) {
 | 
				
			||||||
 | 
					    // No resources to be closed for svn
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  protected void closeWorkingCopy(File workingCopy) {
 | 
					  protected void closeWorkingCopy(File workingCopy) {
 | 
				
			||||||
 | 
					    // No resources to be closed for svn
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -219,6 +219,10 @@
 | 
				
			|||||||
    "2qRyyaVcJ1": {
 | 
					    "2qRyyaVcJ1": {
 | 
				
			||||||
      "displayName": "Ungültig formatiertes Element",
 | 
					      "displayName": "Ungültig formatiertes Element",
 | 
				
			||||||
      "description": "Die Eingabe beinhaltete unfültige Formate. Bitte prüfen Sie die Server Logs für genauere Informationen."
 | 
					      "description": "Die Eingabe beinhaltete unfültige Formate. Bitte prüfen Sie die Server Logs für genauere Informationen."
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "3tS0mjSoo1": {
 | 
				
			||||||
 | 
					      "displayName": "Fehler bei der Erstellung eines Arbeitsverzeichnisses",
 | 
				
			||||||
 | 
					      "description": "Der Server konnte kein Arbeitsverzeichnis zur Abarbeitung der Anfrage erstellen. Bitte prüfen Sie die Server Logs für genauere Informationen."
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "namespaceStrategies": {
 | 
					  "namespaceStrategies": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -219,6 +219,10 @@
 | 
				
			|||||||
    "2qRyyaVcJ1": {
 | 
					    "2qRyyaVcJ1": {
 | 
				
			||||||
      "displayName": "Invalid format in element",
 | 
					      "displayName": "Invalid format in element",
 | 
				
			||||||
      "description": "The input had some invalid formats. Please check the server log for further information."
 | 
					      "description": "The input had some invalid formats. Please check the server log for further information."
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "3tS0mjSoo1": {
 | 
				
			||||||
 | 
					      "displayName": "Error creating a new working directory",
 | 
				
			||||||
 | 
					      "description": "The server could not create a new working directory to process the request. Please check the server log for further information."
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "namespaceStrategies": {
 | 
					  "namespaceStrategies": {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user