|
|
|
|
@ -72,7 +72,7 @@ public class Util {
@@ -72,7 +72,7 @@ public class Util {
|
|
|
|
|
public static String markdown(String source){ |
|
|
|
|
if (source == null) return source; |
|
|
|
|
try { |
|
|
|
|
if (plantumlJar.exists()) { |
|
|
|
|
if (plantumlJar != null && plantumlJar.exists()) { |
|
|
|
|
var matcher = UML_PATTERN.matcher(source); |
|
|
|
|
if (matcher.find()) { |
|
|
|
|
var uml = matcher.group(0).trim(); |
|
|
|
|
@ -98,7 +98,7 @@ public class Util {
@@ -98,7 +98,7 @@ public class Util {
|
|
|
|
|
return MARKDOWN.text(source); |
|
|
|
|
} catch (Exception e){ |
|
|
|
|
if (LOG.isLoggable(TRACE)){ |
|
|
|
|
LOG.log(TRACE,"Failed to render markdown, input was: \n{0}",source); |
|
|
|
|
LOG.log(TRACE,"Failed to render markdown, input was: \n{0}",source,e); |
|
|
|
|
} else LOG.log(WARNING,"Failed to render markdown. Enable TRACE log level for details."); |
|
|
|
|
return source; |
|
|
|
|
} |
|
|
|
|
@ -136,12 +136,12 @@ public class Util {
@@ -136,12 +136,12 @@ public class Util {
|
|
|
|
|
} |
|
|
|
|
var method = query == null ? GET : POST; |
|
|
|
|
try { |
|
|
|
|
LOG.log(DEBUG,"sending {0} request ({1}) to {2}",method,postMime == null ? "empty" : postMime,target); |
|
|
|
|
LOG.log(TRACE,"postData = {0}",query); |
|
|
|
|
LOG.log(DEBUG, "sending {0} request ({1}) to {2}", method, postMime == null ? "empty" : postMime, target); |
|
|
|
|
LOG.log(TRACE, "postData = {0}", query); |
|
|
|
|
var conn = open(target); |
|
|
|
|
conn.setRequestMethod(method); |
|
|
|
|
conn.setRequestProperty(CONTENT_TYPE, postMime); |
|
|
|
|
if (auth != null) conn.setRequestProperty(AUTHORIZATION,auth); |
|
|
|
|
if (auth != null) conn.setRequestProperty(AUTHORIZATION, auth); |
|
|
|
|
if (query != null) { |
|
|
|
|
conn.setDoOutput(true); |
|
|
|
|
var out = conn.getOutputStream(); |
|
|
|
|
@ -161,8 +161,10 @@ public class Util {
@@ -161,8 +161,10 @@ public class Util {
|
|
|
|
|
var is = conn.getErrorStream(); |
|
|
|
|
is.transferTo(bos); |
|
|
|
|
is.close(); |
|
|
|
|
throw new UmbrellaException(500,bos.toString(UTF_8)); |
|
|
|
|
throw new UmbrellaException(500, bos.toString(UTF_8)); |
|
|
|
|
} |
|
|
|
|
} catch (UmbrellaException e){ |
|
|
|
|
throw e; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
LOG.log(WARNING,"Request to {0} failed: {1}",target,e.getMessage()); |
|
|
|
|
throw new UmbrellaException(500,"Request to {0} failed!",target).causedBy(e); |
|
|
|
|
|