Skip to content

Commit 613b520

Browse files
committed
Fix Apache Rat errors
1 parent 3297ddb commit 613b520

File tree

6 files changed

+79
-14
lines changed

6 files changed

+79
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
117
org.apache.logging.log4j.smtp.SmtpManager$SMTPManagerFactory

log4j-osgi-test/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@
198198
<!-- PAX logging has a copy of Log4j2 API-->
199199
<pax.exam.logging>false</pax.exam.logging>
200200
<java.protocol.handler.pkgs>org.ops4j.pax.url</java.protocol.handler.pkgs>
201+
<!-- Used in `osgi.properties -->
202+
<felix.cache.rootdir>${project.build.directory}</felix.cache.rootdir>
201203
</systemPropertyVariables>
202204
</configuration>
203205
</plugin>

log4j-osgi-test/src/test/java/org/apache/logging/log4j/osgi/tests/junit/OsgiRule.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
*/
1717
package org.apache.logging.log4j.osgi.tests.junit;
1818

19+
import java.io.InputStream;
1920
import java.util.HashMap;
2021
import java.util.Map;
22+
import java.util.Properties;
23+
import java.util.stream.Collectors;
2124
import org.junit.rules.ExternalResource;
2225
import org.osgi.framework.BundleException;
2326
import org.osgi.framework.launch.Framework;
@@ -50,18 +53,25 @@ protected void after() {
5053

5154
@Override
5255
protected void before() throws Throwable {
53-
final Map<String, String> configMap = new HashMap<>(2);
54-
// Cleans framework before first init. Subsequent init invocations do not clean framework.
55-
configMap.put("org.osgi.framework.storage.clean", "onFirstInit");
56-
configMap.put("felix.log.level", "4");
57-
configMap.put("eclipse.log.level", "ALL");
58-
// Hack to get the build working on Windows. Could try newer versions of Felix.
59-
configMap.put("felix.cache.locking", "false");
60-
// Delegates loading of endorsed libraries to JVM classloader
61-
// config.put("org.osgi.framework.bootdelegation", "javax.*,org.w3c.*,org.xml.*");
62-
framework = factory.newFramework(configMap);
63-
framework.init();
64-
framework.start();
56+
try (final InputStream is = OsgiRule.class.getResourceAsStream("/osgi.properties")) {
57+
final Properties props = new Properties();
58+
props.load(is);
59+
final Map<String, String> configMap = props.entrySet().stream()
60+
.collect(Collectors.toMap(
61+
e -> String.valueOf(e.getKey()),
62+
e -> String.valueOf(e.getValue()),
63+
(prev, next) -> next,
64+
HashMap::new));
65+
System.getProperties().forEach((k, v) -> {
66+
final String key = String.valueOf(k);
67+
if (key.startsWith("felix") || key.startsWith("org.osgi")) {
68+
configMap.put(key, String.valueOf(v));
69+
}
70+
});
71+
framework = factory.newFramework(configMap);
72+
framework.init();
73+
framework.start();
74+
}
6575
}
6676

6777
public Framework getFramework() {
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
# This file enables the CustomConfigurationFactory
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
This file enables the CustomConfigurationFactory
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
org.osgi.framework.storage.clean = onFirstInit
18+
felix.log.level = 4
19+
eclipse.log.level = ALL
20+
# Hack to get the build working on Windows. Could try newer versions of Felix.
21+
felix.cache.locking = false

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@
572572
<exclude>**/.toDelete</exclude>
573573
<exclude>velocity.log</exclude>
574574
<!-- Other -->
575-
<exclude>felix-cache/**</exclude>
576575
<exclude>**/README.md</exclude>
577576
<exclude>SECURITY.md</exclude>
578577
<exclude>**/*.yml</exclude>
@@ -910,6 +909,7 @@
910909
</plugins>
911910
</build>
912911
</profile>
912+
913913
</profiles>
914914

915915
</project>

0 commit comments

Comments
 (0)