Skip to content

Commit

Permalink
Remove debug logging + minor cleanups (#76)
Browse files Browse the repository at this point in the history
* Remove debug logging + minor cleanups

* Test fix and spotless
  • Loading branch information
timja authored Dec 11, 2024
1 parent a2e0f7d commit a4b1998
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ public boolean verify(String email) {
LOG.finer("Resolved gravatar for " + email + ". Found: " + gravatarExistsForEmail);
} catch (URISyntaxException e) {
LOG.warning("Gravatar URL is malformed, " + imageURL);
} catch (IOException e) {
LOG.fine("Could not connect to the Gravatar URL, " + e);
} catch (InterruptedException e) {
} catch (IOException | InterruptedException e) {

Check warning on line 79 in src/main/java/org/jenkinsci/plugins/gravatar/boundary/GravatarImageURLVerifier.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 79 is not covered by tests
LOG.fine("Could not connect to the Gravatar URL, " + e);
}
return gravatarExistsForEmail;
Expand All @@ -90,8 +88,7 @@ protected Gravatar gravatar() {
}

private boolean responseCodeIsOK(int gravatarResponseCode) {
System.err.println("gravatarResponseCode: " + gravatarResponseCode);
return (gravatarResponseCode == HttpURLConnection.HTTP_OK)
|| (gravatarResponseCode == HttpURLConnection.HTTP_NOT_MODIFIED);
return gravatarResponseCode == HttpURLConnection.HTTP_OK

Check warning on line 91 in src/main/java/org/jenkinsci/plugins/gravatar/boundary/GravatarImageURLVerifier.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 91 is only partially covered, one branch is missing
|| gravatarResponseCode == HttpURLConnection.HTTP_NOT_MODIFIED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import de.bripkens.gravatar.DefaultImage;
import de.bripkens.gravatar.Gravatar;
import jenkins.model.Jenkins;

public class GravatarFactory {

Expand All @@ -19,11 +18,6 @@ public Gravatar testGravatar() {
}

private Gravatar gravatar() {
return new Gravatar().setHttps(useHttps());
}

private boolean useHttps() {
final Jenkins jenkins = Jenkins.getInstanceOrNull();
return jenkins != null && jenkins.isRootUrlSecure();
return new Gravatar().setHttps(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void testGravatarIsUsedForUser() throws Exception {
.getElementById("main-panel")
.getElementsByTagName("img")
.get(0);
assertThat(element.getAttribute("src"), startsWith("http://www.gravatar.com"));
assertThat(element.getAttribute("src"), startsWith("https://secure.gravatar.com"));
}

private void prefetchImage(User user) {
Expand Down

0 comments on commit a4b1998

Please sign in to comment.