Skip to content

Commit

Permalink
errorprone :: ConstantField - EmissaryClient.context (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdahlke authored Aug 1, 2024
1 parent 5f6db5e commit fc5278e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/main/java/emissary/client/EmissaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class EmissaryClient {
private static ConnectionConfig staticConnectionConfig = null;

// static config variables
public static String CONTEXT = DEFAULT_CONTEXT;
public static String context = DEFAULT_CONTEXT;
protected static int retries = DEFAULT_RETRIES;
protected static String username = DEFAULT_USERNAME;
// How long to wait while establishing a connection (ms)
Expand Down Expand Up @@ -102,15 +102,15 @@ protected static void configure() {
connectionTimeout = c.findIntEntry("connectionTimeout", DEFAULT_CONNECTION_TIMEOUT);
connectionManagerTimeout = c.findIntEntry("connectionManagerTimeout", DEFAULT_CONNECTION_MANAGER_TIMEOUT);
socketTimeout = c.findIntEntry("socketTimeout", DEFAULT_SOCKET_TIMEOUT);
CONTEXT = c.findStringEntry("context", DEFAULT_CONTEXT);
context = c.findStringEntry("context", DEFAULT_CONTEXT);
} catch (IOException iox) {
LOGGER.warn("Cannot read EmissaryClient properties, configuring defaults: {}", iox.getMessage());
retries = DEFAULT_RETRIES;
username = DEFAULT_USERNAME;
connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
connectionManagerTimeout = DEFAULT_CONNECTION_MANAGER_TIMEOUT;
socketTimeout = DEFAULT_SOCKET_TIMEOUT;
CONTEXT = DEFAULT_CONTEXT;
context = DEFAULT_CONTEXT;
}

// Read the jetty user realm formatted property file for the password
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/directory/HeartbeatManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public static EmissaryResponse getHeartbeat(String fromPlace, String toPlace) {

public static EmissaryResponse getHeartbeat(String fromPlace, String toPlace, EmissaryClient client) {
final String directoryUrl = KeyManipulator.getServiceHostUrl(toPlace);
final HttpPost method = client.createHttpPost(directoryUrl, EmissaryClient.CONTEXT, "/Heartbeat.action");
final HttpPost method = client.createHttpPost(directoryUrl, EmissaryClient.context, "/Heartbeat.action");
final String loc = KeyManipulator.getServiceLocation(toPlace);

final List<NameValuePair> nvps = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public EmissaryResponse outboundAddPlaces(final String parentDirectory, final Li
return new EmissaryResponse(response);
} else {
final String parentDirectoryUrl = KeyManipulator.getServiceHostUrl(parentDirectory);
final HttpPost method = createHttpPost(parentDirectoryUrl, CONTEXT, "/RegisterPlace.action");
final HttpPost method = createHttpPost(parentDirectoryUrl, context, "/RegisterPlace.action");

final String parentLoc = KeyManipulator.getServiceLocation(parentDirectory);
// Separate it out into lists
Expand Down Expand Up @@ -140,7 +140,7 @@ public EmissaryResponse outboundAddPlaces(final String parentDirectory, final Li
*/
public EmissaryResponse outboundRemovePlaces(final String directory, final List<String> key, final boolean propagating) {
final String directoryUrl = KeyManipulator.getServiceHostUrl(directory);
final HttpPost method = createHttpPost(directoryUrl, CONTEXT, "/DeregisterPlace.action");
final HttpPost method = createHttpPost(directoryUrl, context, "/DeregisterPlace.action");

final String parentLoc = KeyManipulator.getServiceLocation(directory);

Expand All @@ -166,7 +166,7 @@ public EmissaryResponse outboundRemovePlaces(final String directory, final List<
*/
public EmissaryResponse outboundFailDirectory(final String directory, final String failKey, final boolean permanent) {
final String directoryUrl = KeyManipulator.getServiceHostUrl(directory);
final HttpPost method = createHttpPost(directoryUrl, CONTEXT, "/FailDirectory.action");
final HttpPost method = createHttpPost(directoryUrl, context, "/FailDirectory.action");

final String parentLoc = KeyManipulator.getServiceLocation(directory);
final List<NameValuePair> nvps = new ArrayList<>();
Expand Down Expand Up @@ -243,7 +243,7 @@ public DirectoryEntryMap outboundRegisterPeer(final String key, final String pee
* @throws EmissaryException if remote returns an error
*/
private DirectoryEntryMap zoneTransfer(final String key, @Nullable final String myKey, final String action) throws EmissaryException {
final HttpPost method = createHttpPost(KeyManipulator.getServiceHostUrl(key), CONTEXT, action);
final HttpPost method = createHttpPost(KeyManipulator.getServiceHostUrl(key), context, action);

final String parentLoc = KeyManipulator.getServiceLocation(key);
final List<NameValuePair> nvps = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class WorkSpaceAdapter extends EmissaryClient {
public EmissaryResponse outboundOpenWorkSpace(final String place, final String space) {

final String placeUrl = KeyManipulator.getServiceHostUrl(place);
final HttpPost method = createHttpPost(placeUrl, CONTEXT, "/WorkSpaceClientOpenWorkSpace.action");
final HttpPost method = createHttpPost(placeUrl, context, "/WorkSpaceClientOpenWorkSpace.action");

final List<NameValuePair> nvps = new ArrayList<>();
nvps.add(new BasicNameValuePair(CLIENT_NAME, place));
Expand All @@ -59,7 +59,7 @@ public EmissaryResponse outboundOpenWorkSpace(final String place, final String s
public WorkBundle outboundWorkSpaceTake(final String space, final String place) {

final String placeUrl = KeyManipulator.getServiceHostUrl(space);
final HttpPost method = createHttpPost(placeUrl, CONTEXT, "/WorkSpaceClientSpaceTake.action");
final HttpPost method = createHttpPost(placeUrl, context, "/WorkSpaceClientSpaceTake.action");

final List<NameValuePair> nvps = new ArrayList<>();
nvps.add(new BasicNameValuePair(CLIENT_NAME, place));
Expand Down Expand Up @@ -89,7 +89,7 @@ public WorkBundle outboundWorkSpaceTake(final String space, final String place)
*/
public boolean outboundBundleCompletion(final String space, final String place, final String bundleId, final boolean itWorked) {
final String placeUrl = KeyManipulator.getServiceHostUrl(space);
final HttpPost method = createHttpPost(placeUrl, CONTEXT, "/WorkBundleCompleted.action");
final HttpPost method = createHttpPost(placeUrl, context, "/WorkBundleCompleted.action");

final List<NameValuePair> nvps = new ArrayList<>();
nvps.add(new BasicNameValuePair(CLIENT_NAME, place));
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/emissary/core/FTestMovingAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void runTest(@Nullable final String agentClass) {
private void runHttpTest() {
final Version version = new Version();
final EmissaryClient h = new EmissaryClient();
final String urlBase = KeyManipulator.getServiceHostUrl(this.dir1.getKey()) + EmissaryClient.CONTEXT + "/";
final String urlBase = KeyManipulator.getServiceHostUrl(this.dir1.getKey()) + EmissaryClient.context + "/";
HttpGet get = new HttpGet(urlBase + "welcome.jsp");
EmissaryResponse ws = h.send(get);
String msg = ws.getContentString();
Expand Down

0 comments on commit fc5278e

Please sign in to comment.