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:
Kai Zimmermann
2017-03-14 10:06:56 +01:00
committed by GitHub
parent 809fe4a8b6
commit 67d17fe661
66 changed files with 558 additions and 713 deletions

View File

@@ -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());
}

View File

@@ -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);
}
}
}