Skip to content

Commit eb52cb1

Browse files
committed
Fix tab/space formating (tab=4*space)
1 parent d18f6de commit eb52cb1

File tree

4 files changed

+1347
-1346
lines changed

4 files changed

+1347
-1346
lines changed

src/main/java/Driver.java

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/**
23
* Copyright 2016-2018 IBM Corporation. All Rights Reserved.
34
*
@@ -25,59 +26,59 @@
2526
import wa.client.Client;
2627
import wa.exceptions.AuthenticationError;
2728

28-
2929
/**
30-
* Main driver of the program. Create client thread and start.
31-
*
32-
* This reads the configure.properties file and creates a Properties object.
33-
* It then creates a Client object with the Properties object.
34-
*
35-
* This does not exit unless:
36-
* <bl>
37-
* <li> It cannot open/read the configure.properties file (Exit=1)
38-
* <li> It cannot create and initialize the Client (Exit=2)
39-
* <li> The client could not authenticate with the server (Exit=3)
40-
* <li> There is a 'catastrophic' error from the client (Exit=4)
41-
* <li> The process is externally terminated
42-
* </bl>
43-
*
30+
* Main driver of the program. Create client thread and start.
31+
*
32+
* This reads the configure.properties file and creates a Properties object. It
33+
* then creates a Client object with the Properties object.
34+
*
35+
* This does not exit unless: <bl>
36+
* <li>It cannot open/read the configure.properties file (Exit=1)
37+
* <li>It cannot create and initialize the Client (Exit=2)
38+
* <li>The client could not authenticate with the server (Exit=3)
39+
* <li>There is a 'catastrophic' error from the client (Exit=4)
40+
* <li>The process is externally terminated </bl>
41+
*
4442
*/
4543
public class Driver {
4644
// Initialize our logger
4745
private static final Logger LOG = LogManager.getLogger(Driver.class);
4846

4947
/**
50-
* Open and read configure.properties. Use the properties to create a Client.
48+
* Open and read configure.properties. Use the properties to create a Client.
5149
* Once created, start the client and let it run.
5250
*
53-
* Only a failure to read the properties, create and start a client, or a fatal client error, will cause this method to exit.
51+
* Only a failure to read the properties, create and start a client, or a fatal
52+
* client error, will cause this method to exit.
5453
*
55-
* @param args - None at this time
54+
* @param args
55+
* - None at this time
5656
*/
5757
public static void main(String args[]) {
5858
Thread.currentThread().setName("Driver (main)");
59-
59+
6060
LOG.info("Watson Assistant Solutions - Audio Client Driver (main) starting...");
6161
Client client = null;
6262
Properties properties = readProps();
6363
if (null == properties) {
64-
LOG.error("The configure.properties was not found, could not be read, or is not in valid properties file format. The configure.properties file should be in the 'config' folder.");
64+
LOG.error(
65+
"The configure.properties was not found, could not be read, or is not in valid properties file format. The configure.properties file should be in the 'config' folder.");
6566
playLocalFlacAudio(LocalAudio.ERROR_NO_CONFIG_FILE);
6667
System.exit(1);
6768
}
6869

6970
// Create the client
7071
try {
7172
client = new Client(properties);
72-
}
73-
catch (Throwable t) {
73+
} catch (Throwable t) {
7474
// Any error from creating the client causes this to exit(2)
7575
LOG.error("Problem trying to create and initialize the client: " + t, t);
7676
playLocalFlacAudio(LocalAudio.ERROR_CLIENT_CREATE);
7777
System.exit(2);
7878
}
7979

80-
// The properties are read, the client is created - start it and wait for a fatal error!
80+
// The properties are read, the client is created - start it and wait for a
81+
// fatal error!
8182
Thread clientThread = new Thread(client, "Client");
8283
LOG.info("Starting client...");
8384
clientThread.start();
@@ -101,28 +102,28 @@ public static void main(String args[]) {
101102
LOG.error("Exiting due to thrown RuntimeException", re);
102103
System.exit(4);
103104
} catch (Error err) {
104-
LOG.error("Exiting due to thrown Error", err);
105+
LOG.error("Exiting due to thrown Error", err);
105106
System.exit(4);
106107
}
107108
}
108109

109110
/**
110-
* Play a local audio file safely (catch any exception that occurs
111-
* while playing and log it).
111+
* Play a local audio file safely (catch any exception that occurs while playing
112+
* and log it).
112113
*
113-
* @param flacFileName - Name of the FLAC audio file to play
114+
* @param flacFileName
115+
* - Name of the FLAC audio file to play
114116
*/
115117
private static void playLocalFlacAudio(String flacFileName) {
116118
try {
117119
LocalAudio.playFlacFile(flacFileName);
118-
}
119-
catch (Throwable t) {
120+
} catch (Throwable t) {
120121
// At this point - just exit
121122
// (log it, just in case it helps improve the responses)
122-
LOG.error("-- could not PLAY response audio due to: " + t, t);
123+
LOG.error("-- could not PLAY response audio due to: " + t, t);
123124
}
124125
}
125-
126+
126127
/**
127128
* Reads the configure.properties file
128129
*
@@ -131,7 +132,7 @@ private static void playLocalFlacAudio(String flacFileName) {
131132
private static Properties readProps() {
132133
return readProps("./config/configure.properties");
133134
}
134-
135+
135136
/* For unit testing */
136137
static Properties readProps(String propFileName) {
137138
FileInputStream file = null;
@@ -149,7 +150,8 @@ static Properties readProps(String propFileName) {
149150
if (null != file) {
150151
file.close();
151152
}
152-
} catch (IOException e) { }
153+
} catch (IOException e) {
154+
}
153155
}
154156
return props;
155157
}

0 commit comments

Comments
 (0)