Cleanup.
This commit is contained in:
parent
8d633cc049
commit
500fd79121
|
@ -55,7 +55,7 @@ ospackage {
|
||||||
|
|
||||||
buildRpm {
|
buildRpm {
|
||||||
dependsOn startShadowScripts
|
dependsOn startShadowScripts
|
||||||
os = LINUX
|
os = "LINUX"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildDeb {
|
buildDeb {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public enum Facility {
|
||||||
return this.facilityNumber;
|
return this.facilityNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer facilityNumber;
|
private final Integer facilityNumber;
|
||||||
Facility(int facilityNumber) {
|
Facility(int facilityNumber) {
|
||||||
this.facilityNumber = facilityNumber;
|
this.facilityNumber = facilityNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public enum Severity {
|
||||||
return this.severityNumber;
|
return this.severityNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer severityNumber;
|
private final Integer severityNumber;
|
||||||
Severity(int severityNumber) {
|
Severity(int severityNumber) {
|
||||||
this.severityNumber = severityNumber;
|
this.severityNumber = severityNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class TcpServer {
|
public class TcpServer {
|
||||||
|
|
||||||
private int port;
|
private final int port;
|
||||||
private ServerSocket serverSocket;
|
private ServerSocket serverSocket;
|
||||||
|
|
||||||
TcpServer() {
|
TcpServer() {
|
||||||
|
@ -52,7 +52,7 @@ public class TcpServer {
|
||||||
* Event Listener Configuration
|
* Event Listener Configuration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected List<LogListener> eventListeners = new ArrayList<>();
|
protected final List<LogListener> eventListeners = new ArrayList<>();
|
||||||
|
|
||||||
public synchronized void addEventListener( LogListener l ) {
|
public synchronized void addEventListener( LogListener l ) {
|
||||||
eventListeners.add( l );
|
eventListeners.add( l );
|
||||||
|
@ -66,9 +66,9 @@ public class TcpServer {
|
||||||
|
|
||||||
private static class ClientHandler extends Thread {
|
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;
|
private BufferedReader in;
|
||||||
|
|
||||||
public ClientHandler(Socket socket, List<LogListener> eventListeners) {
|
public ClientHandler(Socket socket, List<LogListener> eventListeners) {
|
||||||
|
|
|
@ -18,13 +18,14 @@ package biz.nellemann.syslogd;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.DatagramPacket;
|
import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UdpServer extends Thread {
|
public class UdpServer extends Thread {
|
||||||
|
|
||||||
protected DatagramSocket socket = null;
|
protected DatagramSocket socket;
|
||||||
protected boolean listen = true;
|
protected boolean listen = true;
|
||||||
|
|
||||||
public UdpServer() throws IOException {
|
public UdpServer() throws IOException {
|
||||||
|
@ -44,7 +45,7 @@ public class UdpServer extends Thread {
|
||||||
while (listen) {
|
while (listen) {
|
||||||
try {
|
try {
|
||||||
socket.receive(packet);
|
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);
|
sendEvent(packetData);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in a new issue