Update dependencies and build container.
This commit is contained in:
parent
cf377adecd
commit
3e21ea395e
12
build.gradle
12
build.gradle
|
@ -12,14 +12,14 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
annotationProcessor 'info.picocli:picocli-codegen:4.6.3'
|
annotationProcessor 'info.picocli:picocli-codegen:4.7.0'
|
||||||
implementation 'info.picocli:picocli:4.6.3'
|
implementation 'info.picocli:picocli:4.7.0'
|
||||||
implementation 'org.slf4j:slf4j-api:2.0.3'
|
implementation 'org.slf4j:slf4j-api:2.0.5'
|
||||||
implementation 'org.slf4j:slf4j-simple:2.0.3'
|
implementation 'org.slf4j:slf4j-simple:2.0.5'
|
||||||
|
|
||||||
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
|
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
|
||||||
testImplementation 'org.slf4j:slf4j-api:2.0.3'
|
testImplementation 'org.slf4j:slf4j-api:2.0.5'
|
||||||
testRuntimeOnly 'org.slf4j:slf4j-simple:2.0.3'
|
testRuntimeOnly 'org.slf4j:slf4j-simple:2.0.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
id = syslogd
|
id = syslogd
|
||||||
group = biz.nellemann.syslogd
|
group = biz.nellemann.syslogd
|
||||||
version = 1.2.7
|
version = 1.2.8
|
||||||
|
|
|
@ -168,8 +168,7 @@ public class Application implements Callable<Integer>, LogReceiveListener {
|
||||||
|
|
||||||
|
|
||||||
private InetSocketAddress getInetSocketAddress(URI input) {
|
private InetSocketAddress getInetSocketAddress(URI input) {
|
||||||
InetSocketAddress inetSocketAddress = new InetSocketAddress(input.getHost(), input.getPort());
|
return new InetSocketAddress(input.getHost(), input.getPort());
|
||||||
return inetSocketAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class SyslogPrinter {
|
||||||
sb.append(String.format(" \"level\": \"%s\",", msg.severity));
|
sb.append(String.format(" \"level\": \"%s\",", msg.severity));
|
||||||
sb.append(String.format(" \"application\": \"%s\"", msg.application));
|
sb.append(String.format(" \"application\": \"%s\"", msg.application));
|
||||||
sb.append("}, \"values\": [ ");
|
sb.append("}, \"values\": [ ");
|
||||||
sb.append(String.format("[ \"%d\", \"%s\" ]", msg.timestamp.getEpochSecond() * 1000000000l, getMessageLine(msg)));
|
sb.append(String.format("[ \"%d\", \"%s\" ]", msg.timestamp.getEpochSecond() * 1000000000L, getMessageLine(msg)));
|
||||||
sb.append(" ] } ] }");
|
sb.append(" ] } ] }");
|
||||||
log.debug(sb.toString());
|
log.debug(sb.toString());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
|
@ -29,8 +29,8 @@ public class UdpClient implements LogForwardListener {
|
||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(UdpClient.class);
|
private final static Logger log = LoggerFactory.getLogger(UdpClient.class);
|
||||||
|
|
||||||
private InetSocketAddress inetSocketAddress;
|
private final InetSocketAddress inetSocketAddress;
|
||||||
private DatagramSocket socket;
|
private final DatagramSocket socket;
|
||||||
|
|
||||||
public UdpClient(InetSocketAddress inetSocketAddress) throws SocketException {
|
public UdpClient(InetSocketAddress inetSocketAddress) throws SocketException {
|
||||||
this.inetSocketAddress = inetSocketAddress;
|
this.inetSocketAddress = inetSocketAddress;
|
||||||
|
@ -40,14 +40,12 @@ public class UdpClient implements LogForwardListener {
|
||||||
public void send(String msg) {
|
public void send(String msg) {
|
||||||
byte[] buf = msg.getBytes(StandardCharsets.US_ASCII);
|
byte[] buf = msg.getBytes(StandardCharsets.US_ASCII);
|
||||||
DatagramPacket packet = new DatagramPacket(buf, buf.length, inetSocketAddress.getAddress(), inetSocketAddress.getPort());
|
DatagramPacket packet = new DatagramPacket(buf, buf.length, inetSocketAddress.getAddress(), inetSocketAddress.getPort());
|
||||||
if(this.socket != null) {
|
|
||||||
try {
|
try {
|
||||||
socket.send(packet);
|
socket.send(packet);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("send() - Could not send packet: " + e.getMessage());
|
log.error("send() - Could not send packet: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
socket.close();
|
socket.close();
|
||||||
|
|
|
@ -12,10 +12,9 @@ public class JsonUtil {
|
||||||
|
|
||||||
for (int i = 0; i < input.length(); i++) {
|
for (int i = 0; i < input.length(); i++) {
|
||||||
char ch = input.charAt(i);
|
char ch = input.charAt(i);
|
||||||
int chx = (int) ch;
|
|
||||||
|
|
||||||
// let's not put any nulls in our strings
|
// let's not put any nulls in our strings
|
||||||
if(chx == 0) {
|
if ((int) ch == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +32,8 @@ public class JsonUtil {
|
||||||
output.append("\\b");
|
output.append("\\b");
|
||||||
} else if (ch == '\f') {
|
} else if (ch == '\f') {
|
||||||
output.append("\\f");
|
output.append("\\f");
|
||||||
} else if(chx > 127) {
|
} else if ((int) ch > 127) {
|
||||||
output.append(String.format("\\u%04x", chx));
|
output.append(String.format("\\u%04x", (int) ch));
|
||||||
} else {
|
} else {
|
||||||
output.append(ch);
|
output.append(ch);
|
||||||
}
|
}
|
||||||
|
@ -50,17 +49,18 @@ public class JsonUtil {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < input.length()) {
|
while (i < input.length()) {
|
||||||
char delimiter = input.charAt(i); i++; // consume letter or backslash
|
char delimiter = input.charAt(i);
|
||||||
|
i++; // consume letter or backslash
|
||||||
|
|
||||||
if (delimiter == '\\' && i < input.length()) {
|
if (delimiter == '\\' && i < input.length()) {
|
||||||
|
|
||||||
// consume first after backslash
|
// consume first after backslash
|
||||||
char ch = input.charAt(i); i++;
|
char ch = input.charAt(i);
|
||||||
|
i++;
|
||||||
|
|
||||||
if (ch == '\\' || ch == '/' || ch == '"' || ch == '\'') {
|
if (ch == '\\' || ch == '/' || ch == '"' || ch == '\'') {
|
||||||
builder.append(ch);
|
builder.append(ch);
|
||||||
}
|
} else if (ch == 'n') builder.append('\n');
|
||||||
else if(ch == 'n') builder.append('\n');
|
|
||||||
else if (ch == 'r') builder.append('\r');
|
else if (ch == 'r') builder.append('\r');
|
||||||
else if (ch == 't') builder.append('\t');
|
else if (ch == 't') builder.append('\t');
|
||||||
else if (ch == 'b') builder.append('\b');
|
else if (ch == 'b') builder.append('\b');
|
||||||
|
|
Loading…
Reference in a new issue