This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git


The following commit(s) were added to refs/heads/master by this push:
     new 9cdbe79  Fix formatting
9cdbe79 is described below

commit 9cdbe79ab9b24099f4fc5ad3f9fd8b194c24fcc5
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Jul 8 09:22:32 2023 -0400

    Fix formatting
---
 src/samples/AloneService.java      |  2 +-
 src/samples/ProcrunService.java    |  4 ++--
 src/samples/ServiceDaemon.java     |  2 +-
 src/samples/SimpleApplication.java | 27 ++++++++++++---------------
 src/samples/SimpleDaemon.java      | 27 ++++++++++++---------------
 5 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/src/samples/AloneService.java b/src/samples/AloneService.java
index 71dc5af..f018876 100644
--- a/src/samples/AloneService.java
+++ b/src/samples/AloneService.java
@@ -47,7 +47,7 @@ public class AloneService {
      */
     public void init(String[] arguments) throws Exception {
         /* Set the err */
-        System.setErr(new PrintStream(new 
FileOutputStream("/ServiceDaemon.err",true)));
+        System.setErr(new PrintStream(new 
FileOutputStream("/ServiceDaemon.err", true)));
         System.err.println("ServiceDaemon: instance "+this.hashCode()+
                            " init");
 
diff --git a/src/samples/ProcrunService.java b/src/samples/ProcrunService.java
index 8dda938..3497a88 100644
--- a/src/samples/ProcrunService.java
+++ b/src/samples/ProcrunService.java
@@ -191,8 +191,8 @@ public class ProcrunService implements Runnable {
         if (waitParam != null) {
             wait = Integer.valueOf(waitParam).intValue();
         }
-        log("Starting the thread, wait(seconds): "+wait);
-        thrd = new Thread(new ProcrunService(wait*MS_PER_SEC,file));
+        log("Starting the thread, wait(seconds): " + wait);
+        thrd = new Thread(new ProcrunService(wait * MS_PER_SEC, file));
         thrd.start();
     }
 
diff --git a/src/samples/ServiceDaemon.java b/src/samples/ServiceDaemon.java
index d690521..87894f2 100644
--- a/src/samples/ServiceDaemon.java
+++ b/src/samples/ServiceDaemon.java
@@ -52,7 +52,7 @@ public class ServiceDaemon implements Daemon {
     public void init(DaemonContext context)
     throws Exception {
         /* Set the err */
-        System.setErr(new PrintStream(new FileOutputStream(new 
File("ServiceDaemon.err")),true));
+        System.setErr(new PrintStream(new FileOutputStream(new 
File("ServiceDaemon.err")), true));
         System.err.println("ServiceDaemon: instance "+this.hashCode()+
                            " init");
 
diff --git a/src/samples/SimpleApplication.java 
b/src/samples/SimpleApplication.java
index 057dbc6..697c933 100644
--- a/src/samples/SimpleApplication.java
+++ b/src/samples/SimpleApplication.java
@@ -124,9 +124,9 @@ public class SimpleApplication implements Runnable {
 
         System.err.println("SimpleApplication: started acceptor loop");
         try {
-            while(!this.stopping) {
-                Socket socket=this.server.accept();
-                Handler handler=new Handler(socket,this);
+            while (!this.stopping) {
+                Socket socket = this.server.accept();
+                Handler handler = new Handler(socket, this);
                 handler.setConnectionNumber(number++);
                 handler.setDirectoryName(this.directory);
                 new Thread(handler).start();
@@ -198,18 +198,16 @@ public class SimpleApplication implements Runnable {
         @Override
         public void run() {
             this.parent.addHandler(this);
-            System.err.println("SimpleApplication: connection "+this.number+
-                               " opened from "+this.socket.getInetAddress());
+            System.err.println("SimpleApplication: connection " + this.number 
+ " opened from " + this.socket.getInetAddress());
             try {
-                InputStream in=this.socket.getInputStream();
-                OutputStream out=this.socket.getOutputStream();
-                handle(in,out);
+                InputStream in = this.socket.getInputStream();
+                OutputStream out = this.socket.getOutputStream();
+                handle(in, out);
                 this.socket.close();
             } catch (IOException e) {
                 e.printStackTrace(System.err);
             }
-            System.err.println("SimpleApplication: connection "+this.number+
-                               " closed");
+            System.err.println("SimpleApplication: connection " + this.number 
+ " closed");
             this.parent.removeHandler(this);
         }
 
@@ -237,11 +235,10 @@ public class SimpleApplication implements Runnable {
             return(this.directory);
         }
 
-        public void createFile(String name)
-        throws IOException {
-            OutputStream file=new FileOutputStream(name,true);
-            PrintStream out=new PrintStream(file);
-            SimpleDateFormat fmt=new SimpleDateFormat();
+        public void createFile(String name) throws IOException {
+            OutputStream file = new FileOutputStream(name, true);
+            PrintStream out = new PrintStream(file);
+            SimpleDateFormat fmt = new SimpleDateFormat();
 
             out.println(fmt.format(new Date()));
             out.close();
diff --git a/src/samples/SimpleDaemon.java b/src/samples/SimpleDaemon.java
index 2727e4f..63757f4 100644
--- a/src/samples/SimpleDaemon.java
+++ b/src/samples/SimpleDaemon.java
@@ -125,9 +125,9 @@ public class SimpleDaemon implements Daemon, Runnable {
 
         System.err.println("SimpleDaemon: started acceptor loop");
         try {
-            while(!this.stopping) {
-                Socket socket=this.server.accept();
-                Handler handler=new Handler(socket,this,this.controller);
+            while (!this.stopping) {
+                Socket socket = this.server.accept();
+                Handler handler = new Handler(socket, this, this.controller);
                 handler.setConnectionNumber(number++);
                 handler.setDirectoryName(this.directory);
                 new Thread(handler).start();
@@ -180,18 +180,16 @@ public class SimpleDaemon implements Daemon, Runnable {
         @Override
         public void run() {
             this.parent.addHandler(this);
-            System.err.println("SimpleDaemon: connection "+this.number+
-                               " opened from "+this.socket.getInetAddress());
+            System.err.println("SimpleDaemon: connection " + this.number + " 
opened from " + this.socket.getInetAddress());
             try {
-                InputStream in=this.socket.getInputStream();
-                OutputStream out=this.socket.getOutputStream();
-                handle(in,out);
+                InputStream in = this.socket.getInputStream();
+                OutputStream out = this.socket.getOutputStream();
+                handle(in, out);
                 this.socket.close();
             } catch (IOException e) {
                 e.printStackTrace(System.err);
             }
-            System.err.println("SimpleDaemon: connection "+this.number+
-                               " closed");
+            System.err.println("SimpleDaemon: connection " + this.number + " 
closed");
             this.parent.removeHandler(this);
         }
 
@@ -219,11 +217,10 @@ public class SimpleDaemon implements Daemon, Runnable {
             return(this.directory);
         }
 
-        public void createFile(String name)
-        throws IOException {
-            OutputStream file=new FileOutputStream(name,true);
-            PrintStream out=new PrintStream(file);
-            SimpleDateFormat fmt=new SimpleDateFormat();
+        public void createFile(String name) throws IOException {
+            OutputStream file = new FileOutputStream(name, true);
+            PrintStream out = new PrintStream(file);
+            SimpleDateFormat fmt = new SimpleDateFormat();
 
             out.println(fmt.format(new Date()));
             out.close();

Reply via email to