Skip to content
Open
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
10 changes: 4 additions & 6 deletions src/main/java/com/microsoft/bingads/ApiEnvironment.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.microsoft.bingads;

import java.util.Arrays;

/**
* Represents Bing Ads API environment (Production or Sandbox).
*/
Expand All @@ -26,11 +28,7 @@ public String value() {
}

public static ApiEnvironment fromValue(String v) {
for (ApiEnvironment c : ApiEnvironment.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
return Arrays.stream(values()).filter((env) -> env.value.equals(v)).findFirst()
.orElseThrow(() -> new IllegalArgumentException(v));
}
}
1 change: 1 addition & 0 deletions src/main/java/com/microsoft/bingads/AsyncCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @param <T> the type of result
*/
@FunctionalInterface
public interface AsyncCallback<T> {

/**
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/microsoft/bingads/ServiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ public List<Handler> getHandlerChain(PortInfo portInfo) {
}
});

T port = serviceFactory.createProxyFromService(service, environment, serviceInterface);

return port;
return serviceFactory.createProxyFromService(service, environment, serviceInterface);
}

private void refreshOAuthTokensIfNeeded() {
Expand Down