Skip to content

Commit 89b6e5f

Browse files
committed
Fix indentent
1 parent b971afb commit 89b6e5f

1 file changed

Lines changed: 38 additions & 39 deletions

File tree

  • samples/features/sql-big-data-cluster/connectivity/webhdfs-java-client/src/main/java/com/microsoft/mssql

samples/features/sql-big-data-cluster/connectivity/webhdfs-java-client/src/main/java/com/microsoft/mssql/App.java

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -62,46 +62,45 @@ public void clear() {
6262
// No op. Nothing to clean up.
6363
}
6464
};
65-
private static void uploadResource(String inputFilePath, String outputFilePath){
66-
System.out.println("Entering create resource");
67-
// Construct Knox endpoint
68-
String createOperationEndpoint = GW_ENDPOINT + outputFilePath + "?op=CREATE&overwrite=true";
69-
try (CloseableHttpClient client2 = HttpClients.custom().setDefaultCredentialsProvider(provider).build()) {
70-
HttpUriRequest request = new HttpPut(createOperationEndpoint);
71-
// First request to get the location in data nodes
72-
try (CloseableHttpResponse response = client2.execute(request)) {
73-
System.out.println("===============");
74-
String newlocation = response.getFirstHeader("Location").getValue();
75-
HttpEntity entity = response.getEntity();
76-
System.out.println("----------------------------------------");
77-
System.out.println(response.getStatusLine());
78-
System.out.println("----------------------------------------");
79-
if (entity != null) {
80-
System.out.println(EntityUtils.toString(entity));
81-
}
82-
System.out.println("----------------------------------------");
83-
EntityUtils.consume(entity);
84-
// Second request to put the content to that location
85-
File testUploadFile = new File(inputFilePath);
86-
HttpEntity putData = MultipartEntityBuilder.create().addBinaryBody("upfile", testUploadFile).build();
87-
HttpUriRequest putRequest = RequestBuilder.put(newlocation).setEntity(putData).build();
88-
System.out.println("Executing request " + putRequest.getRequestLine());
89-
CloseableHttpResponse response2 = client2.execute(putRequest);
90-
HttpEntity entity2 = response2.getEntity();
91-
System.out.println("----------------------------------------");
92-
System.out.println(response2.getStatusLine());
93-
System.out.println("----------------------------------------");
94-
if (entity2 != null) {
95-
System.out.println(EntityUtils.toString(entity2));
96-
}
97-
System.out.println("----------------------------------------");
98-
99-
}
100-
} catch (Exception e) {
101-
System.out.println(e);
102-
}
10365

104-
}
66+
private static void uploadResource(String inputFilePath, String outputFilePath){
67+
System.out.println("Entering create resource");
68+
// Construct Knox endpoint
69+
String createOperationEndpoint = GW_ENDPOINT + outputFilePath + "?op=CREATE&overwrite=true";
70+
try (CloseableHttpClient client2 = HttpClients.custom().setDefaultCredentialsProvider(provider).build()) {
71+
HttpUriRequest request = new HttpPut(createOperationEndpoint);
72+
// First request to get the location in data nodes
73+
try (CloseableHttpResponse response = client2.execute(request)) {
74+
System.out.println("===============");
75+
String newlocation = response.getFirstHeader("Location").getValue();
76+
HttpEntity entity = response.getEntity();
77+
System.out.println("----------------------------------------");
78+
System.out.println(response.getStatusLine());
79+
System.out.println("----------------------------------------");
80+
if (entity != null) {
81+
System.out.println(EntityUtils.toString(entity));
82+
}
83+
System.out.println("----------------------------------------");
84+
EntityUtils.consume(entity);
85+
// Second request to put the content to that location
86+
File testUploadFile = new File(inputFilePath);
87+
HttpEntity putData = MultipartEntityBuilder.create().addBinaryBody("upfile", testUploadFile).build();
88+
HttpUriRequest putRequest = RequestBuilder.put(newlocation).setEntity(putData).build();
89+
System.out.println("Executing request " + putRequest.getRequestLine());
90+
CloseableHttpResponse response2 = client2.execute(putRequest);
91+
HttpEntity entity2 = response2.getEntity();
92+
System.out.println("----------------------------------------");
93+
System.out.println(response2.getStatusLine());
94+
System.out.println("----------------------------------------");
95+
if (entity2 != null) {
96+
System.out.println(EntityUtils.toString(entity2));
97+
}
98+
System.out.println("----------------------------------------");
99+
}
100+
} catch (Exception e) {
101+
System.out.println(e);
102+
}
103+
}
105104

106105
public static void main(String[] args) throws Exception {
107106
// These properties can be specified using command line as well by using

0 commit comments

Comments
 (0)