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

HotelsDotCom / waggle-dance / #318

pending completion
#318

push

web-flow
Feature/upgrade springboot (#268)

* update springboot to 2.1.18

* update springboot to 2.2.13

* Upgrade to srping boot 2.7.11

* Update changelog

* Update changelog

* fix version

3 of 3 new or added lines in 2 files covered. (100.0%)

132 of 3058 relevant lines covered (4.32%)

0.04 hits per line

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

0.0
/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/util/AllowList.java
1
/**
2
 * Copyright (C) 2016-2020 Expedia, Inc.
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
package com.hotels.bdp.waggledance.util;
17

18
import java.util.HashSet;
19
import java.util.List;
20
import java.util.Locale;
21
import java.util.Set;
22
import java.util.regex.Matcher;
23
import java.util.regex.Pattern;
24

25
public class AllowList {
26

27
  private final static String MATCH_ALL = ".*";
28
  private final Set<Pattern> allowList = new HashSet<>();
×
29

30
  public AllowList() {}
×
31

32
  public AllowList(List<String> allowList) {
×
33
    if (allowList == null) {
×
34
      add(MATCH_ALL);
×
35
    } else {
×
36
      for (String element : allowList) {
×
37
        add(element);
×
38
      }
39
    }
40
  }
×
41

42
  public void add(String element) {
43
    allowList.add(Pattern.compile(trimToLowerCase(element)));
×
44
  }
×
45

46
  int size() {
47
    return allowList.size();
×
48
  }
49

50
  private String trimToLowerCase(String string) {
51
    return string.trim().toLowerCase(Locale.ROOT);
×
52
  }
53

54
  public boolean contains(String element) {
55
    if (element == null) {
×
56
      return true;
×
57
    }
58
    element = trimToLowerCase(element);
×
59
    for (Pattern allowListEntry : allowList) {
×
60
      Matcher matcher = allowListEntry.matcher(element);
×
61
      if (matcher.matches()) {
×
62
        return true;
×
63
      }
64
    }
65
    return false;
×
66
  }
67

68
}
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

© 2026 Coveralls, Inc