Skip to content

Commit

Permalink
Another fix for logging UPNP errors closes #2009
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Dec 5, 2014
1 parent 502fb8f commit 2ea1134
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/org/lantern/UpnpCli.java
Expand Up @@ -165,16 +165,19 @@ protected void processLine(final String line, final int level) {
// The DefaultExecutor throws an IOException on error exit codes.
// In this case, upnpc returns an error code if it can't find any
// IGD on the network. For us that should just be considered
// a port mapping error.
// a port mapping error. If we happen to see some other error, we
// log it.
if (lines.size() > 0) {
final String first = lines.get(0).toLowerCase();
if (!first.contains("no igd")) {
log.warn("Got invalid exit value: {} with unexpected output:{}",
e.getMessage(), lines.toString(), e);
} else {
final String all = lines.toString();
if (all.contains("No IGD") ||
all.contains("No valid UPNP Internet Gateway Device found")) {
log.debug("Got invalid exit value for no IGD", e.getMessage(),
lines.toString(), e);
}
else {
log.warn("Got invalid exit value: {} with unexpected output:{}",
e.getMessage(), lines.toString(), e);
}
throw e;
} else {
log.error("UPNP exception with no output", e);
Expand Down

0 comments on commit 2ea1134

Please sign in to comment.