Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit f38fcdd

Browse files
committed
update deps to prepare for release and fix some bad code
1 parent b525aa4 commit f38fcdd

File tree

3 files changed

+33
-23
lines changed

3 files changed

+33
-23
lines changed

pom.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<dependency>
108108
<groupId>junit</groupId>
109109
<artifactId>junit</artifactId>
110-
<version>4.12</version>
110+
<version>4.13-beta-2</version>
111111
<scope>test</scope>
112112
</dependency>
113113
<dependency>
@@ -116,16 +116,10 @@
116116
<version>2.0.0.0</version>
117117
<scope>test</scope>
118118
</dependency>
119-
<dependency>
120-
<groupId>com.meterware.simplestub</groupId>
121-
<artifactId>simplestub</artifactId>
122-
<version>1.2.8</version>
123-
<scope>test</scope>
124-
</dependency>
125119
<dependency>
126120
<groupId>org.yaml</groupId>
127121
<artifactId>snakeyaml</artifactId>
128-
<version>1.19</version>
122+
<version>1.24</version>
129123
</dependency>
130124
</dependencies>
131125
</project>

src/main/java/weblogic/logging/exporter/LogExportHandler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ private Result executePutOrPostOnUrl(String url, String payload, boolean post) {
179179

180180
private String recordToPayload(WLLogRecord wlLogRecord) {
181181
return "{"
182-
+ dataAsJson("domainUID", domainUID)
183-
+ ","
184182
+ dataAsJson("messageID", wlLogRecord.getId())
185183
+ ","
186184
+ dataAsJson("message", wlLogRecord.getMessage())
@@ -210,6 +208,8 @@ private String recordToPayload(WLLogRecord wlLogRecord) {
210208
+ dataAsJson("diagnosticContextId", wlLogRecord.getDiagnosticContextId())
211209
+ ","
212210
+ dataAsJson("sequenceNumber", wlLogRecord.getSequenceNumber())
211+
+ ","
212+
+ dataAsJson("domainUID", domainUID)
213213
+ "}";
214214
}
215215

@@ -240,9 +240,6 @@ private void createMappings() {
240240
+ DOC_TYPE
241241
+ "\": {"
242242
+ " \"properties\": {"
243-
+ " \"domainUID\": {"
244-
+ "\"type\": \"keyword\" "
245-
+ "},"
246243
+ " \"timestamp\": {"
247244
+ "\"type\": \"date\" "
248245
+ "},"
@@ -278,6 +275,9 @@ private void createMappings() {
278275
+ "},"
279276
+ " \"messageID\": {"
280277
+ "\"type\": \"keyword\" "
278+
+ "},"
279+
+ " \"domainUID\": {"
280+
+ "\"type\": \"keyword\" "
281281
+ "}"
282282
+ " }"
283283
+ " }"

src/main/java/weblogic/logging/exporter/config/MapUtils.java

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,22 @@ static Integer getIntegerValue(Map<String, Object> map, String key) {
5555
@SuppressWarnings("unchecked")
5656
static String[] getStringArray(Map<String, Object> map, String key) {
5757
Object value = map.get(key);
58-
if (value instanceof List) return toStringArray((List<Object>) value);
59-
else if (!value.getClass().isArray()) return new String[] {value.toString()};
60-
else if (value.getClass().getComponentType() == String.class) return (String[]) value;
61-
else throw createBadTypeException(key, value, "an array of strings");
58+
if (value instanceof List) {
59+
return toStringArray((List<Object>) value);
60+
} else if (!value.getClass().isArray()) {
61+
return new String[] {value.toString()};
62+
} else if (value.getClass().getComponentType() == String.class) {
63+
return (String[]) value;
64+
} else {
65+
throw createBadTypeException(key, value, "an array of strings");
66+
}
6267
}
6368

6469
private static String[] toStringArray(List<Object> list) {
6570
String[] result = new String[list.size()];
66-
for (int i = 0; i < result.length; i++) result[i] = list.get(i).toString();
71+
for (int i = 0; i < result.length; i++) {
72+
result[i] = list.get(i).toString();
73+
}
6774
return result;
6875
}
6976

@@ -77,19 +84,28 @@ private static String[] toStringArray(List<Object> list) {
7784
*/
7885
static Boolean getBooleanValue(Map<String, Object> map, String key) {
7986
Object value = map.get(key);
80-
if (value instanceof Boolean) return (Boolean) value;
87+
if (value instanceof Boolean) {
88+
return (Boolean) value;
89+
}
8190

82-
if (inValues(value, TRUE_VALUES)) return true;
83-
if (inValues(value, FALSE_VALUES)) return false;
91+
if (inValues(value, TRUE_VALUES)) {
92+
return true;
93+
}
94+
if (inValues(value, FALSE_VALUES)) {
95+
return false;
96+
}
8497
throw new ConfigurationException("Unable to interpret '" + value + "' as a boolean value");
8598
}
8699

87100
private static final String[] TRUE_VALUES = {"true", "t", "yes", "on", "y"};
88101
private static final String[] FALSE_VALUES = {"false", "f", "no", "off", "n"};
89102

90103
private static boolean inValues(Object candidate, String... matches) {
91-
for (String match : matches) if (candidate.toString().equalsIgnoreCase(match)) return true;
92-
104+
for (String match : matches) {
105+
if (candidate.toString().equalsIgnoreCase(match)) {
106+
return true;
107+
}
108+
}
93109
return false;
94110
}
95111

0 commit comments

Comments
 (0)