Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 16, 2019
2 parents 8b06862 + a509cdb commit 8c91d47
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/auth/PsBasic.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
*
* @since 0.20
* @checkstyle ClassDataAbstractionCouplingCheck (100 lines)
* @todo #863:30min Continue removing nulls from the code base, there are still
* some places that use it and can be replaced with better code constructs.
*/
@EqualsAndHashCode
@SuppressWarnings("PMD.TooManyMethods")
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/org/takes/facets/auth/social/PsGoogle.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,13 @@ private String token(final String code) throws IOException {
*/
private static Identity parse(final JsonObject json) {
final Map<String, String> props = new HashMap<>(json.size());
final JsonObject image = json.getJsonObject("image");
if (image == null) {
props.put(PsGoogle.PICTURE, "#");
final Opt<JsonObject> image = new Opt.Single<>(
json.getJsonObject("image")
);
if (image.has()) {
props.put(PsGoogle.PICTURE, image.get().getString("url", "#"));
} else {
props.put(PsGoogle.PICTURE, image.getString("url", "#"));
props.put(PsGoogle.PICTURE, "#");
}
props.put(
PsGoogle.NAME, json.getString(PsGoogle.DISPLAY_NAME, "unknown")
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/takes/facets/cookies/RqCookies.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ public Base(final Request req) {
public Iterable<String> cookie(final CharSequence key)
throws IOException {
final Map<String, String> map = this.map();
final String value = map.get(
new EnglishLowerCase(key.toString()).string()
final String value = map.getOrDefault(
new EnglishLowerCase(key.toString()).string(),
""
);
final Iterable<String> iter;
if (value == null) {
if (value.isEmpty()) {
iter = new VerboseIterable<>(
Collections.<String>emptyList(),
new Sprintf(
Expand Down
19 changes: 5 additions & 14 deletions src/main/java/org/takes/facets/fork/FkHitRefresh.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
*
* @since 0.9
* @see TkFork
* @todo #863:30min Continue removing nulls from the code base, there are still
* some places that use it and can be replaced with better code constructs.
*/
@EqualsAndHashCode
public final class FkHitRefresh implements Fork {
Expand Down Expand Up @@ -86,14 +84,11 @@ public FkHitRefresh(final File file, final List<String> cmd,
final Take tke) {
this(
file,
new Runnable() {
@Override
public void run() {
try {
new ProcessBuilder().command(cmd).start();
} catch (final IOException ex) {
throw new IllegalStateException(ex);
}
() -> {
try {
new ProcessBuilder().command(cmd).start();
} catch (final IOException ex) {
throw new IllegalStateException(ex);
}
},
tke
Expand Down Expand Up @@ -234,10 +229,6 @@ private boolean expired() throws IOException {
/**
* Directory contents updated?
* @return TRUE if contents were updated
* @todo #802:30min Continue removing nulls from the codebase,
* which still exist in the code. The way it is violates
* the key principles, defined in the README.md file and should be
* deleted.
*/
private boolean directoryUpdated() {
final long recent;
Expand Down

1 comment on commit 8c91d47

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 8c91d47 Jan 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 802-a1804963 disappeared from src/main/java/org/takes/facets/fork/FkHitRefresh.java, that's why I closed #935. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.