Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] Minor code cleanup #620

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Map<String, String> adjustProperties(AbstractLicenseMojo mojo,
result.put(COPYRIGHT_YEARS_KEY, copyrightYears);

return Collections.unmodifiableMap(result);
} catch (Throwable e) {
} catch (Exception e) {
throw new RuntimeException(
"CopyrightRangeProvider error on file: " + document.getFile().getAbsolutePath() + ": "
+ e.getMessage(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.FileTime;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

class CopyrightRangeProviderTest {
private static Path fsRepoRoot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ void copyrightAuthor() {
}
}

private void assertAuthor(CopyrightAuthorProvider provider, String path,
String copyrightAuthorName, String copyrightAuthorEmail) {

}

private static Document newDocument(String relativePath) {
Path path = Paths.get(gitRepoRoot + File.separator
+ relativePath.replace('/', File.separatorChar));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ private GitLookup newCommitterLookup() {
}

@Test
public void ignoreCommitsInLastChange() throws GitAPIException, IOException {
void ignoreCommitsInLastChange() throws GitAPIException, IOException {
assertLastChange(newAuthorLookup("95d52919cbe340dc271cf1f5ec68cf36705bd3a3"), "dir1/file1.txt", 2004);
assertLastChange(newCommitterLookup("95d52919cbe340dc271cf1f5ec68cf36705bd3a3"), "dir1/file1.txt", 2004);
}

@Test
public void doNotIgnoreCommitsInCreation() throws GitAPIException, IOException {
void doNotIgnoreCommitsInCreation() throws GitAPIException, IOException {
assertCreation(newAuthorLookup("53b44baedc5a378f9b665da12f298e1003793219"), "dir1/file1.txt", 2000);
assertCreation(newCommitterLookup("53b44baedc5a378f9b665da12f298e1003793219"), "dir1/file1.txt", 2000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,17 @@ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
// One-time warning for shallow repo
if (mojo.warnIfShallow && !warnedIfShallow.get()) {
SVNInfo info = svnClientManager.getWCClient().doInfo(documentFile, SVNRevision.HEAD);
if (info.getDepth() != SVNDepth.INFINITY) {
if (warnedIfShallow.compareAndSet(false, true)) {
mojo.warn(
"Sparse svn repository detected. Year property values may not be accurate.");
}
if (info.getDepth() != SVNDepth.INFINITY && warnedIfShallow.compareAndSet(false, true)) {
mojo.warn(
"Sparse svn repository detected. Year property values may not be accurate.");
}
}

svnClientManager.getLogClient()
.doLog(new File[]{documentFile}, SVNRevision.HEAD, SVNRevision.create(0), true, true, 1,
lastChangeDateLogEntryHandler);
} catch (SVNException ex) {
IllegalStateException ise = new IllegalStateException("cannot query SVN latest date information for file: " + documentFile, ex);
throw ise;
} catch (SVNException e) {
throw new IllegalStateException("cannot query SVN latest date information for file: " + documentFile, e);
}

return newProperties;
Expand Down