Skip to content

Commit

Permalink
Merge pull request #3362 from nadment/3307
Browse files Browse the repository at this point in the history
Remote Work Configurations Won't Work Because of Turkish Characters #3356
  • Loading branch information
hansva committed Nov 9, 2023
2 parents 34879d4 + 9a948c6 commit f26eb7b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 6 additions & 4 deletions engine/src/main/java/org/apache/hop/server/HopServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ public String constructUrl(IVariables variables, String serviceAndArguments)

HttpPost buildSendXmlMethod(IVariables variables, byte[] content, String service)
throws Exception {
String encoding = Const.getEnvironmentVariable("file.encoding", Const.XML_ENCODING);
return buildSendMethod(variables, content, encoding, service, "text/xml");
String encoding = Const.XML_ENCODING;
return buildSendMethod(variables, content, encoding, service, "text/xml");
}

// Method is defined as package-protected in order to be accessible by unit tests
Expand Down Expand Up @@ -542,7 +542,7 @@ HttpPost buildSendMethod(
public String sendXml(IVariables variables, String xml, String service) throws Exception {
String encoding = getXmlEncoding(xml);
HttpPost method =
buildSendMethod(variables, xml.getBytes(encoding), encoding, service, "text/xml");
buildSendMethod(variables, xml.getBytes(encoding), encoding, service, "text/xml");
try {
return executeAuth(variables, method);
} finally {
Expand Down Expand Up @@ -579,7 +579,8 @@ private String getXmlEncoding(String xml) {
if (matcher.find()) {
return matcher.group();
}
return Const.getEnvironmentVariable("file.encoding", Const.XML_ENCODING);

return Const.XML_ENCODING;
}

/** Throws if not ok */
Expand Down Expand Up @@ -1348,3 +1349,4 @@ public void setPropertiesMasterName(String propertiesMasterName) {
this.propertiesMasterName = propertiesMasterName;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.engine.IPipelineEngine;
import org.json.simple.parser.ParseException;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@HopServerServlet(id = "registerPipeline", name = "Add a pipeline to the server")
public class RegisterPipelineServlet extends BaseWorkflowServlet {
Expand All @@ -48,7 +48,7 @@ WebResult generateBody(
IVariables variables)
throws IOException, HopException, HopException, ParseException {

final String xml = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding());
final String xml = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);

// Parse the XML, create a pipeline configuration
PipelineConfiguration pipelineConfiguration = PipelineConfiguration.fromXml(xml);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import org.apache.hop.workflow.WorkflowMeta;
import org.apache.hop.workflow.engine.IWorkflowEngine;
import org.json.simple.parser.ParseException;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@HopServerServlet(id = "registerWorkflow", name = "Add a workflow to the server")
public class RegisterWorkflowServlet extends BaseWorkflowServlet {
Expand All @@ -48,7 +48,7 @@ WebResult generateBody(
IVariables variables)
throws IOException, HopException, HopException, ParseException {

final String xml = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding());
final String xml = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);

// Parse the XML, create a workflow configuration
WorkflowConfiguration workflowConfiguration = WorkflowConfiguration.fromXml(xml, variables);
Expand Down

0 comments on commit f26eb7b

Please sign in to comment.