Skip to content

Commit

Permalink
fix InputStream to String conversion after common-cli upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas loubrieu committed Aug 22, 2024
1 parent 4e869f4 commit 354c3b4
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gov.nasa.pds.registry.mgr.cmd.reg;

import java.net.URL;
import java.nio.charset.StandardCharsets;
import org.apache.commons.cli.CommandLine;
import org.apache.tika.io.IOUtils;
import gov.nasa.pds.registry.common.connection.KnownRegistryConnections;
Expand All @@ -23,16 +24,18 @@ public void printHelp() {

@Override
public void run(CommandLine cmdLine) throws Exception {
if(cmdLine.hasOption("help") || !cmdLine.hasOption("rc")) {
if (cmdLine.hasOption("help") || !cmdLine.hasOption("rc")) {
printHelp();
return;
}
KnownRegistryConnections.initialzeAppHandler();
URL registry_connection = new URL(cmdLine.getOptionValue("rc"));
if (registry_connection.getProtocol().equalsIgnoreCase("app")) {
registry_connection = RegistryConnectionContent.class.getResource
("/" + registry_connection.getAuthority() + registry_connection.getPath());
registry_connection = RegistryConnectionContent.class
.getResource("/" + registry_connection.getAuthority() + registry_connection.getPath());
}
System.out.println(IOUtils.toString(registry_connection.openStream()));
String stdOut =
new String(registry_connection.openStream().readAllBytes(), StandardCharsets.UTF_8);
System.out.println(stdOut);
}
}

0 comments on commit 354c3b4

Please sign in to comment.