Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 109e02e

Browse files
committed
changed publishing to OSTI to send raw JSON metadata rather than
translated version Signed-off-by: Neal Ensor <[email protected]>
1 parent b5305c1 commit 109e02e

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/main/java/gov/osti/services/Metadata.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,16 +1495,12 @@ public Response approve(@PathParam("codeId") Long codeId) {
14951495

14961496
// if approving announced, send this to OSTI
14971497
if (DOECodeMetadata.Status.Announced.equals(md.getWorkflowStatus())) {
1498-
1499-
OstiMetadata omd = new OstiMetadata();
1500-
omd.set(md);
1501-
15021498
// if configured, post this to OSTI
15031499
String publishing_host = context.getInitParameter("publishing.host");
15041500
if (null!=publishing_host) {
15051501
// set some reasonable default timeouts
15061502
// create an HTTP client to request through
1507-
CloseableHttpClient hc =
1503+
try (CloseableHttpClient hc =
15081504
HttpClientBuilder
15091505
.create()
15101506
.setDefaultRequestConfig(RequestConfig
@@ -1513,22 +1509,19 @@ public Response approve(@PathParam("codeId") Long codeId) {
15131509
.setConnectTimeout(5000)
15141510
.setConnectionRequestTimeout(5000)
15151511
.build())
1516-
.build();
1512+
.build()) {
15171513
HttpPost post = new HttpPost(publishing_host + "/services/softwarecenter?action=api");
15181514
post.setHeader("Content-Type", "application/json");
15191515
post.setHeader("Accept", "application/json");
1520-
post.setEntity(new StringEntity(omd.toJsonString(), "UTF-8"));
1516+
post.setEntity(new StringEntity(mapper.writeValueAsString(md), "UTF-8"));
15211517

1522-
try {
15231518
HttpResponse response = hc.execute(post);
15241519
String text = EntityUtils.toString(response.getEntity());
15251520

15261521
if ( HttpStatus.SC_OK!=response.getStatusLine().getStatusCode()) {
15271522
log.warn("OSTI Error: " + text);
15281523
throw new IOException ("OSTI software publication error");
15291524
}
1530-
} finally {
1531-
hc.close();
15321525
}
15331526
}
15341527
}

0 commit comments

Comments
 (0)