Upgrade sonar to new 6.2 installation (#456)
* Upgrade to new sonar instance. Fix new identified issues. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -163,11 +163,10 @@ public class MongoDBArtifactStore implements ArtifactRepository {
|
||||
storedArtifact = map(result);
|
||||
}
|
||||
} catch (final NoSuchAlgorithmException | IOException e) {
|
||||
throw new ArtifactStoreException(e.getMessage(), e);
|
||||
throw new ArtifactStoreException(e);
|
||||
}
|
||||
|
||||
if (hash != null && hash.getMd5() != null
|
||||
&& !storedArtifact.getHashes().getMd5().equalsIgnoreCase(hash.getMd5())) {
|
||||
if (notNull(hash, storedArtifact) && !storedArtifact.getHashes().getMd5().equalsIgnoreCase(hash.getMd5())) {
|
||||
throw new HashNotMatchException("The given md5 hash " + hash.getMd5()
|
||||
+ " not matching the calculated md5 hash " + storedArtifact.getHashes().getMd5(),
|
||||
HashNotMatchException.MD5);
|
||||
@@ -177,6 +176,10 @@ public class MongoDBArtifactStore implements ArtifactRepository {
|
||||
|
||||
}
|
||||
|
||||
private static boolean notNull(final DbArtifactHash hash, final GridFsArtifact storedArtifact) {
|
||||
return hash != null && hash.getMd5() != null && storedArtifact != null && storedArtifact.getHashes() != null;
|
||||
}
|
||||
|
||||
private static String computeSHA1Hash(final InputStream stream, final OutputStream os, final String providedSHA1Sum)
|
||||
throws NoSuchAlgorithmException, IOException {
|
||||
String sha1Hash;
|
||||
@@ -206,7 +209,7 @@ public class MongoDBArtifactStore implements ArtifactRepository {
|
||||
* the list of mongoDB gridFs files.
|
||||
* @return a paged list of artifacts mapped from the given dbFiles
|
||||
*/
|
||||
private List<DbArtifact> map(final List<GridFSDBFile> dbFiles) {
|
||||
private static List<DbArtifact> map(final List<GridFSDBFile> dbFiles) {
|
||||
return dbFiles.stream().map(MongoDBArtifactStore::map).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,9 @@ public class S3Repository implements ArtifactRepository {
|
||||
} catch (final IOException e) {
|
||||
throw new ArtifactStoreException(e.getMessage(), e);
|
||||
} finally {
|
||||
file.delete();
|
||||
if (!file.delete()) {
|
||||
LOG.error("Could not delete temp file {}", file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user