use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebuggerFactory method create.
@Override
public Debugger create(Map<String, String> properties, Debugger.DebuggerCallback debuggerCallback) throws DebuggerException {
Map<String, String> normalizedProps = properties.entrySet().stream().collect(toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
String host = normalizedProps.get("host");
int port;
try {
port = Integer.parseInt(normalizedProps.getOrDefault("port", "0"));
} catch (NumberFormatException e) {
throw new DebuggerException("Unknown port property format: " + normalizedProps.get("port"));
}
String file = normalizedProps.get("binary");
if (file == null) {
throw new DebuggerException("binary property is null. Debugger can't be started");
}
String sources = normalizedProps.get("sources");
if (sources == null) {
sources = Paths.get(file).getParent().toString();
}
return GdbDebugger.newInstance(host, port, file, sources, debuggerCallback);
}
Aggregations