@@ -105,13 +105,16 @@ static void xml(String path, boolean isClasspath, Optilog instance) {
105
105
System .err .println ("Optilog Note: Failed to read xml setting file!" );
106
106
instance .consoleFileMasterCaution = false ;
107
107
e .printStackTrace ();
108
+ } catch (NullPointerException ignored ) {
109
+
108
110
}
109
111
} else {
110
112
try (InputStream input = new FileInputStream (path )) {
111
113
XmlSettingBean object = new XmlMapper (new JacksonXmlModule ()).readValue (input , XmlSettingBean .class );
112
114
// config print
113
- if (object .print .get ("packingFormat" ) != null ) {
114
- instance .allSetting .printPackingFormat = object .print .get ("packingFormat" ).trim ();
115
+ String a = object .print .get ("packingFormat" );
116
+ if (a != null ) {
117
+ instance .allSetting .printPackingFormat = a .trim ();
115
118
}
116
119
instance .allSetting .printInfo = Boolean .parseBoolean (object .print .get ("printInfo" ).trim ());
117
120
instance .allSetting .printError = Boolean .parseBoolean (object .print .get ("printError" ).trim ());
@@ -120,44 +123,57 @@ static void xml(String path, boolean isClasspath, Optilog instance) {
120
123
instance .allSetting .printFatal = Boolean .parseBoolean (object .print .get ("printFatal" ).trim ());
121
124
122
125
// config file
123
- if (object .file .get ("packingFormat" ) != null ) {
124
- instance .allSetting .consolePackingFormat = object .file .get ("packingFormat" ).trim ();
126
+ String b = object .file .get ("packingFormat" );
127
+ if (b != null ) {
128
+ instance .allSetting .consolePackingFormat = b .trim ();
125
129
}
126
- if (object .file .get ("defaultConsolePath" ) != null ) {
127
- instance .allSetting .defaultConsolePath = object .file .get ("defaultConsolePath" ).trim ();
130
+ String c = object .file .get ("defaultConsolePath" );
131
+ if (c != null ) {
132
+ instance .allSetting .defaultConsolePath = c .trim ();
128
133
}
129
- if (object .file .get ("Path1" ) != null ) {
130
- instance .allSetting .Path1 = object .file .get ("Path1" ).trim ();
134
+ String d = object .file .get ("Path1" );
135
+ if (d != null ) {
136
+ instance .allSetting .Path1 = d .trim ();
131
137
}
132
- if (object .file .get ("Path2" ) != null ) {
133
- instance .allSetting .Path2 = object .file .get ("Path2" ).trim ();
138
+ String e = object .file .get ("Path2" );
139
+ if (e != null ) {
140
+ instance .allSetting .Path2 = e .trim ();
134
141
}
135
- if (object .file .get ("Path3" ) != null ) {
136
- instance .allSetting .Path3 = object .file .get ("Path3" ).trim ();
142
+ String f = object .file .get ("Path3" );
143
+ if (f != null ) {
144
+ instance .allSetting .Path3 = f .trim ();
137
145
}
138
- if (object .file .get ("Path4" ) != null ) {
139
- instance .allSetting .Path4 = object .file .get ("Path4" ).trim ();
146
+ String g = object .file .get ("Path4" );
147
+ if (g != null ) {
148
+ instance .allSetting .Path4 = g .trim ();
140
149
}
141
- if (object .file .get ("Path5" ) != null ) {
142
- instance .allSetting .Path5 = object .file .get ("Path5" ).trim ();
150
+ String h = object .file .get ("Path5" );
151
+ if (h != null ) {
152
+ instance .allSetting .Path5 = h .trim ();
143
153
}
144
- if (object .file .get ("infoPath" ) != null ) {
145
- instance .allSetting .infoPath = object .file .get ("infoPath" ).trim ();
154
+ String i = object .file .get ("infoPath" );
155
+ if (i != null ) {
156
+ instance .allSetting .infoPath = i .trim ();
146
157
}
147
- if (object .file .get ("errorPath" ) != null ) {
148
- instance .allSetting .errorPath = object .file .get ("errorPath" ).trim ();
158
+ String j = object .file .get ("errorPath" );
159
+ if (j != null ) {
160
+ instance .allSetting .errorPath = j .trim ();
149
161
}
150
- if (object .file .get ("warnPath" ) != null ) {
151
- instance .allSetting .warnPath = object .file .get ("warnPath" ).trim ();
162
+ String k = object .file .get ("warnPath" );
163
+ if (k != null ) {
164
+ instance .allSetting .warnPath = k .trim ();
152
165
}
153
- if (object .file .get ("debugPath" ) != null ) {
154
- instance .allSetting .debugPath = object .file .get ("debugPath" ).trim ();
166
+ String l = object .file .get ("debugPath" );
167
+ if (l != null ) {
168
+ instance .allSetting .debugPath = l .trim ();
155
169
}
156
- if (object .file .get ("fatalPath" ) != null ) {
157
- instance .allSetting .fatalPath = object .file .get ("fatalPath" ).trim ();
170
+ String m = object .file .get ("fatalPath" );
171
+ if (m != null ) {
172
+ instance .allSetting .fatalPath = m .trim ();
158
173
}
159
- if (object .file .get ("fileName" ) != null ) {
160
- instance .allSetting .fileName = object .file .get ("fileName" ).trim ();
174
+ String n = (object .file .get ("fileName" ));
175
+ if (n != null ) {
176
+ instance .allSetting .fileName = n .trim ();
161
177
}
162
178
instance .allSetting .consoleInfo = Boolean .parseBoolean (object .file .get ("consoleInfo" ).trim ());
163
179
instance .allSetting .consoleError = Boolean .parseBoolean (object .file .get ("consoleError" ).trim ());
@@ -166,25 +182,30 @@ static void xml(String path, boolean isClasspath, Optilog instance) {
166
182
instance .allSetting .consoleFatal = Boolean .parseBoolean (object .file .get ("consoleFatal" ).trim ());
167
183
168
184
// config server
169
- if (object .server .get ("packingFormat" ) != null ) {
170
- instance .allSetting .serverPackingFormat = object .server .get ("packingFormat" ).trim ();
185
+ String o = object .server .get ("packingFormat" );
186
+ if (o != null ) {
187
+ instance .allSetting .serverPackingFormat = o .trim ();
171
188
}
172
189
instance .allSetting .serverInfo = Boolean .parseBoolean (object .server .get ("serverInfo" ).trim ());
173
190
instance .allSetting .serverError = Boolean .parseBoolean (object .server .get ("serverError" ).trim ());
174
191
instance .allSetting .serverWarn = Boolean .parseBoolean (object .server .get ("serverWarn" ).trim ());
175
192
instance .allSetting .serverDebug = Boolean .parseBoolean (object .server .get ("serverDebug" ).trim ());
176
193
instance .allSetting .serverFatal = Boolean .parseBoolean (object .server .get ("serverFatal" ).trim ());
177
194
instance .allSetting .startClient = Boolean .parseBoolean (object .server .get ("startClient" ).trim ());
178
- if (object .server .get ("host" ) != null ) {
179
- instance .allSetting .host = object .server .get ("host" );
195
+ String p = object .server .get ("host" );
196
+ if (p != null ) {
197
+ instance .allSetting .host = p .trim ();
180
198
}
181
- if (object .server .get ("socketNumber" ) != null ) {
182
- instance .allSetting .socketNumber = Integer .parseInt (object .server .get ("socketNumber" ));
199
+ String q = object .server .get ("socketNumber" );
200
+ if (q != null ) {
201
+ instance .allSetting .socketNumber = Integer .parseInt (q .trim ());
183
202
}
184
203
185
204
} catch (IOException e ) {
186
205
System .err .println ("Optilog Note: Failed to read xml setting file!" );
187
206
e .printStackTrace ();
207
+ } catch (NullPointerException ignored ) {
208
+
188
209
}
189
210
}
190
211
}
0 commit comments