Skip to content

Commit

Permalink
Updates toString calls affected by change in method signature
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Jan 26, 2023
1 parent 4b51ea7 commit 99d14ce
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentType;

public class WhoAmIResponse extends ActionResponse implements ToXContent {

Expand Down Expand Up @@ -105,6 +106,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws

@Override
public String toString() {
return Strings.toString(this, true, true);
return Strings.toString(XContentType.JSON,this, true, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.util.concurrent.ThreadContext.StoredContext;
import org.opensearch.common.xcontent.MediaType;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.env.Environment;
import org.opensearch.security.auditlog.AuditLog;
import org.opensearch.security.auditlog.config.AuditConfig;
Expand Down Expand Up @@ -379,7 +381,7 @@ public Map<CType, SecurityDynamicConfiguration<?>> getConfigurationsFromIndex(Co
if (logComplianceEvent && auditLog.getComplianceConfig().isEnabled()) {
CType configurationType = configTypes.iterator().next();
Map<String, String> fields = new HashMap<String, String>();
fields.put(configurationType.toLCString(), Strings.toString(retVal.get(configurationType)));
fields.put(configurationType.toLCString(), Strings.toString(XContentType.JSON, retVal.get(configurationType)));
auditLog.logDocumentRead(this.securityIndex, configurationType.toLCString(), null, fields);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.xcontent.NamedXContentRegistry;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.index.query.ParsedQuery;
import org.opensearch.rest.RestStatus;
import org.opensearch.search.DocValueFormat;
Expand Down Expand Up @@ -211,10 +212,10 @@ public boolean invoke(String action, ActionRequest request, final ActionListener
StringBuilder sb = new StringBuilder();

if (searchRequest.source() != null) {
sb.append(Strings.toString(searchRequest.source()) + System.lineSeparator());
sb.append(Strings.toString(XContentType.JSON, searchRequest.source()) + System.lineSeparator());
}

sb.append(Strings.toString(af) + System.lineSeparator());
sb.append(Strings.toString(XContentType.JSON, af) + System.lineSeparator());

LogManager.getLogger("debuglogger").error(sb.toString());

Expand All @@ -224,7 +225,7 @@ public boolean invoke(String action, ActionRequest request, final ActionListener
searchRequest.requestCache(Boolean.FALSE);
} else {
LogManager.getLogger("debuglogger").error("Shard requestcache enabled for "
+ (searchRequest.source() == null ? "<NULL>" : Strings.toString(searchRequest.source())));
+ (searchRequest.source() == null ? "<NULL>" : Strings.toString(XContentType.JSON, searchRequest.source())));
}

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ protected static void generateDiagnoseTrace(final RestHighLevelClient restHighLe
try {
sb.append("ClusterHealthRequest:"+System.lineSeparator());
ClusterHealthResponse nir = restHighLevelClient.cluster().health(new ClusterHealthRequest(), RequestOptions.DEFAULT);
sb.append(Strings.toString(nir, true, true));
sb.append(Strings.toString(XContentType.JSON, nir, true, true));
} catch (Exception e1) {
sb.append(ExceptionsHelper.stackTrace(e1));
}
Expand Down

0 comments on commit 99d14ce

Please sign in to comment.