• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Dynatrace / openkit-java / #421079377

pending completion
#421079377

push

github-actions

openkitdt
Pull request #255: RUM-9570 Events Spec 1.2

Merge in OP/openkit-java from feature/RUM-9570-openkit-java-update-json-serialization-of-special-numeric-values-for-events to main

* commit 'd864e3bde':
  RUM-9570 Changing special pattern cases
  RUM-9570 Adding special pattern cases
  RUM-9570 Changing isFinite call
  RUM-9570 Removed unused import
  RUM-9570 Events Spec 1.2

GitOrigin-RevId: 65f5a0256

29 of 29 new or added lines in 4 files covered. (100.0%)

4163 of 4377 relevant lines covered (95.11%)

0.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

23.08
/src/main/java/com/dynatrace/openkit/core/util/EventPayloadBuilderUtil.java
1
/**
2
 * Copyright 2018-2021 Dynatrace LLC
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.dynatrace.openkit.core.util;
18

19
import com.dynatrace.openkit.core.objects.EventPayloadBuilder;
20
import com.dynatrace.openkit.util.json.objects.JSONArrayValue;
21
import com.dynatrace.openkit.util.json.objects.JSONNumberValue;
22
import com.dynatrace.openkit.util.json.objects.JSONObjectValue;
23
import com.dynatrace.openkit.util.json.objects.JSONValue;
24

25
import java.util.Iterator;
26

27
public class EventPayloadBuilderUtil {
28

29
    private EventPayloadBuilderUtil() {
30
    }
31

32
    private static boolean isObjectContainingNonFiniteNumericValues(JSONObjectValue jsonObject) {
33
        for(String key: jsonObject.keySet()) {
×
34
            if(isItemContainingNonFiniteNumericValues(jsonObject.get(key))) {
×
35
                return true;
×
36
            }
37
        }
×
38

39
        return false;
×
40
    }
41

42
    private static boolean isArrayContainingNonFiniteNumericValues(JSONArrayValue jsonArrayValue) {
43
        Iterator<JSONValue> it = jsonArrayValue.iterator();
×
44

45
        while(it.hasNext()) {
×
46
            if(isItemContainingNonFiniteNumericValues(it.next())) {
×
47
                return true;
×
48
            }
49
        }
50

51
        return false;
×
52
    }
53

54
    public static boolean isItemContainingNonFiniteNumericValues(JSONValue jsonValue) {
55
        return (jsonValue.isObject() && isObjectContainingNonFiniteNumericValues((JSONObjectValue) jsonValue))
1✔
56
                || (jsonValue.isArray() && isArrayContainingNonFiniteNumericValues((JSONArrayValue) jsonValue))
1✔
57
                || (jsonValue.isNumber() && !((JSONNumberValue) jsonValue).isFinite());
1✔
58
    }
59

60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc