Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
Signed-off-by: Jackie Han <[email protected]>
  • Loading branch information
jackiehanyang committed Oct 2, 2023
1 parent 2ee84c8 commit d1a2c14
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
public class FlowFrameworkException extends RuntimeException {

private final Response.Status restStatus;

/**
* Constructor with error message.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
*/
public enum FlowFrameworkIndex {
GLOBAL_CONTEXT(
GLOBAL_CONTEXT_INDEX,
ThrowingSupplierWrapper.throwingSupplierWrapper(GlobalContextHandler::getGlobalContextMappings),
GLOBAL_CONTEXT_INDEX_VERSION
GLOBAL_CONTEXT_INDEX,
ThrowingSupplierWrapper.throwingSupplierWrapper(GlobalContextHandler::getGlobalContextMappings),
GLOBAL_CONTEXT_INDEX_VERSION
);

private final String indexName;
Expand All @@ -46,4 +46,4 @@ public String getMapping() {
public Integer getVersion() {
return version;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.opensearch.flowframework.workflow.CreateIndexStep;

import javax.ws.rs.core.Response;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -73,7 +74,9 @@ private void initGlobalContextIndexIfAbsent(ActionListener<Boolean> listener) {
public void putTemplateToGlobalContext(Template template, ActionListener<IndexResponse> listener) {
initGlobalContextIndexIfAbsent(ActionListener.wrap(indexCreated -> {
if (!indexCreated) {
listener.onFailure(new FlowFrameworkException("No response to create global_context index", Response.Status.INTERNAL_SERVER_ERROR));
listener.onFailure(
new FlowFrameworkException("No response to create global_context index", Response.Status.INTERNAL_SERVER_ERROR)
);
return;
}
IndexRequest request = new IndexRequest(GLOBAL_CONTEXT_INDEX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.opensearch.flowframework.indices.FlowFrameworkIndex;

import javax.ws.rs.core.Response;

import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
Expand Down Expand Up @@ -165,15 +166,23 @@ public void initIndexIfAbsent(FlowFrameworkIndex index, ActionListener<Boolean>
internalListener.onResponse(true);
} else {
internalListener.onFailure(
new FlowFrameworkException("Failed to update index setting for: " + indexName, Response.Status.INTERNAL_SERVER_ERROR)
new FlowFrameworkException(
"Failed to update index setting for: " + indexName,
Response.Status.INTERNAL_SERVER_ERROR
)
);
}
}, exception -> {
logger.error("Failed to update index setting for: " + indexName, exception);
internalListener.onFailure(exception);
}));
} else {
internalListener.onFailure(new FlowFrameworkException("Failed to update index: " + indexName, Response.Status.INTERNAL_SERVER_ERROR));
internalListener.onFailure(
new FlowFrameworkException(
"Failed to update index: " + indexName,
Response.Status.INTERNAL_SERVER_ERROR
)
);
}
}, exception -> {
logger.error("Failed to update index " + indexName, exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.opensearch.flowframework.workflow.CreateIndexStep;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.threadpool.ThreadPool;
import org.junit.Test;

import java.io.IOException;
import java.util.HashMap;
Expand Down

0 comments on commit d1a2c14

Please sign in to comment.