Skip to content

Commit 98d6e1b

Browse files
authored
Merge pull request #481 from Microsoft/fix_shadow_build
Fix shadow jar
2 parents 4c0ff8f + 35c79e5 commit 98d6e1b

File tree

4 files changed

+23
-25
lines changed

4 files changed

+23
-25
lines changed

core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.microsoft.applicationinsights.internal.channel.samplingV2;
22

3-
import com.microsoft.applicationinsights.agent.internal.common.StringUtils;
43
import com.microsoft.applicationinsights.extensibility.TelemetryProcessor;
54
import com.microsoft.applicationinsights.internal.annotation.BuiltInProcessor;
65
import com.microsoft.applicationinsights.internal.logger.InternalLogger;
@@ -12,6 +11,8 @@
1211
import java.util.Map;
1312
import java.util.Set;
1413

14+
import org.apache.commons.lang3.StringUtils;
15+
1516
/**
1617
* This processor is used to Perform Sampling on User specified sampling rate
1718
* <p>
@@ -99,9 +100,9 @@ public Set<Class> getIncludedTypes() {
99100

100101
private void setIncludedOrExcludedTypes(String value, Set<Class> typeSet) {
101102

102-
if (!StringUtils.isNullOrEmpty(value)) {
103+
if (!StringUtils.isEmpty(value)) {
103104
value = value.trim();
104-
if (!StringUtils.isNullOrEmpty(value) && allowedTypes.containsKey(value)) {
105+
if (!StringUtils.isEmpty(value) && allowedTypes.containsKey(value)) {
105106
typeSet.add(allowedTypes.get(value));
106107
} else {
107108
InternalLogger.INSTANCE.error("Item is either not allowed to sample or is empty");

core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/SamplingScoreGeneratorV2.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.microsoft.applicationinsights.internal.channel.samplingV2;
22

3-
import com.microsoft.applicationinsights.agent.internal.common.StringUtils;
43
import com.microsoft.applicationinsights.telemetry.Telemetry;
54

65
import java.util.Random;
6+
import org.apache.commons.lang3.StringUtils;
77

88
/**
99
* Created by Dhaval Doshi Oct 2017
@@ -24,7 +24,7 @@ public static double getSamplingScore(Telemetry telemetry) {
2424

2525
double samplingScore = 0.0;
2626

27-
if (!StringUtils.isNullOrEmpty(telemetry.getContext().getOperation().getId())) {
27+
if (!StringUtils.isEmpty(telemetry.getContext().getOperation().getId())) {
2828
samplingScore = ((double) getSamplingHashCode(telemetry.getContext().getOperation().getId()) / Integer.MAX_VALUE);
2929
}
3030

@@ -37,7 +37,7 @@ public static double getSamplingScore(Telemetry telemetry) {
3737
}
3838

3939
static int getSamplingHashCode(String input) {
40-
if (StringUtils.isNullOrEmpty(input)) {
40+
if (StringUtils.isEmpty(input)) {
4141
return 0;
4242
}
4343

core/src/test/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import com.microsoft.applicationinsights.TelemetryClient;
44
import com.microsoft.applicationinsights.TelemetryConfiguration;
55
import com.microsoft.applicationinsights.TestFramework.StubTelemetryChannel;
6-
import com.microsoft.applicationinsights.agent.internal.common.StringUtils;
76
import com.microsoft.applicationinsights.extensibility.TelemetryProcessor;
87
import com.microsoft.applicationinsights.telemetry.PageViewTelemetry;
98
import com.microsoft.applicationinsights.telemetry.RemoteDependencyTelemetry;
109
import com.microsoft.applicationinsights.telemetry.RequestTelemetry;
1110
import com.microsoft.applicationinsights.telemetry.SupportSampling;
1211
import com.microsoft.applicationinsights.telemetry.Telemetry;
12+
import org.apache.commons.lang3.StringUtils;
1313
import org.junit.Assert;
1414
import org.junit.Test;
1515

@@ -513,15 +513,15 @@ private void testSampling(TelemetryClient client , List<List<Telemetry>> depende
513513
processor.setSamplingPercentage(String.valueOf(samplingRate));
514514
if (includeTypes != null) {
515515
for (String includeType : includeTypes) {
516-
if (!StringUtils.isNullOrEmpty(includeType)) {
516+
if (!StringUtils.isEmpty(includeType)) {
517517
processor.addToIncludedType(includeType);
518518
}
519519
}
520520
}
521521

522522
if (excludeTypes != null) {
523523
for (String excludeType : excludeTypes) {
524-
if (!StringUtils.isNullOrEmpty(excludeType)) {
524+
if (!StringUtils.isEmpty(excludeType)) {
525525
processor.addToExcludedType(excludeType);
526526
}
527527
}
@@ -559,15 +559,15 @@ private void testNoSampling(TelemetryClient client , List<List<Telemetry>> depen
559559
processor.setSamplingPercentage(String.valueOf(samplingRate));
560560
if (includeTypes != null) {
561561
for (String includeType : includeTypes) {
562-
if (!StringUtils.isNullOrEmpty(includeType)) {
562+
if (!StringUtils.isEmpty(includeType)) {
563563
processor.addToIncludedType(includeType);
564564
}
565565
}
566566
}
567567

568568
if (excludeTypes != null) {
569569
for (String excludeType : excludeTypes) {
570-
if (!StringUtils.isNullOrEmpty(excludeType)) {
570+
if (!StringUtils.isEmpty(excludeType)) {
571571
processor.addToExcludedType(excludeType);
572572
}
573573
}

gradle/provided-configuration.gradle

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,18 @@
1919
* DEALINGS IN THE SOFTWARE.
2020
*/
2121

22-
// Adding the "provided" configuration
23-
24-
ext {
25-
PROVIDED_CONFIGURATION_NAME = "provided"
22+
// Defines the "provided" configuration for dependencies that the client is responsible for including on the classpath
23+
configurations {
24+
provided
2625
}
2726

28-
configurations {
29-
provided {
30-
// Remove the provided dependencies from the default configuration so
31-
// these dependencies won't be derived by projects that has a dependency on
32-
// the project using the provided scope
33-
dependencies.all { dep ->
34-
configurations.default.exclude group: dep.group, module: dep.name
35-
}
27+
sourceSets {
28+
main {
29+
compileClasspath += configurations.provided
30+
runtimeClasspath += configurations.provided
31+
}
32+
test {
33+
compileClasspath += configurations.provided
34+
runtimeClasspath += configurations.provided
3635
}
37-
compile.extendsFrom provided
3836
}
39-

0 commit comments

Comments
 (0)