This commit is contained in:
Mark Nellemann 2020-10-14 08:39:29 +02:00
parent 8d633cc049
commit 500fd79121
5 changed files with 10 additions and 9 deletions

View file

@ -55,7 +55,7 @@ ospackage {
buildRpm {
dependsOn startShadowScripts
os = LINUX
os = "LINUX"
}
buildDeb {

View file

@ -72,7 +72,7 @@ public enum Facility {
return this.facilityNumber;
}
private Integer facilityNumber;
private final Integer facilityNumber;
Facility(int facilityNumber) {
this.facilityNumber = facilityNumber;
}

View file

@ -40,7 +40,7 @@ public enum Severity {
return this.severityNumber;
}
private Integer severityNumber;
private final Integer severityNumber;
Severity(int severityNumber) {
this.severityNumber = severityNumber;
}

View file

@ -26,7 +26,7 @@ import java.util.List;
public class TcpServer {
private int port;
private final int port;
private ServerSocket serverSocket;
TcpServer() {
@ -52,7 +52,7 @@ public class TcpServer {
* Event Listener Configuration
*/
protected List<LogListener> eventListeners = new ArrayList<>();
protected final List<LogListener> eventListeners = new ArrayList<>();
public synchronized void addEventListener( LogListener l ) {
eventListeners.add( l );
@ -66,9 +66,9 @@ public class TcpServer {
private static class ClientHandler extends Thread {
protected List<LogListener> eventListeners;
protected final List<LogListener> eventListeners;
private Socket clientSocket;
private final Socket clientSocket;
private BufferedReader in;
public ClientHandler(Socket socket, List<LogListener> eventListeners) {

View file

@ -18,13 +18,14 @@ package biz.nellemann.syslogd;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class UdpServer extends Thread {
protected DatagramSocket socket = null;
protected DatagramSocket socket;
protected boolean listen = true;
public UdpServer() throws IOException {
@ -44,7 +45,7 @@ public class UdpServer extends Thread {
while (listen) {
try {
socket.receive(packet);
String packetData = new String(packet.getData(), packet.getOffset(), packet.getLength(), "UTF8");
String packetData = new String(packet.getData(), packet.getOffset(), packet.getLength(), StandardCharsets.UTF_8);
sendEvent(packetData);
} catch (Exception e) {
e.printStackTrace();