CPD Results
The following document contains the results of PMD's CPD 6.55.0.
Duplications
File |
Project |
Line |
com/intergral/deep/examples/SimpleTest.java |
Agent Load |
25 |
com/intergral/deep/examples/SimpleTest.java |
Agent Load |
25 |
com/intergral/deep/examples/SimpleTest.java |
Dynamic Load |
25 |
public class SimpleTest extends BaseTest {
public static Date NICE_START_DATE = new Date();
private final long startedAt = System.currentTimeMillis();
private final String testName;
private final int maxExecutions;
private int cnt = 0;
private Map<Character, Integer> charCounter = new TreeMap<Character, Integer>();
public SimpleTest(final String testName, final int maxExecutions) {
this.testName = testName;
this.maxExecutions = maxExecutions;
}
void message(final String uuid) throws Exception {
System.out.println(cnt + ":" + uuid);
cnt += 1;
checkEnd(cnt, maxExecutions);
final Map<Character, Integer> info = makeCharCountMap(uuid);
merge(charCounter, info);
if ((cnt % 30) == 0) {
dump();
}
}
void merge(final Map<Character, Integer> charCounter, final Map<Character, Integer> newInfo) {
for (final Character c : newInfo.keySet()) {
final Integer i = newInfo.get(c);
Integer curr = charCounter.get(c);
if (curr == null) {
charCounter.put(c, i);
} else {
charCounter.put(c, curr + i);
}
}
}
void dump() {
System.out.println(charCounter);
charCounter = new HashMap<Character, Integer>();
}
static void checkEnd(final int val, final int max) throws Exception {
if (val > max) {
throw new Exception("Hit max executions " + val + " " + max);
}
}
@Override
public String toString() {
return getClass().getName() + ":" + testName + ":" + startedAt + "#" + System.identityHashCode(
this);
}
} |
File |
Project |
Line |
com/intergral/deep/examples/SimpleTest.java |
otel-example |
25 |
com/intergral/deep/examples/SimpleTest.java |
prometheus-metrics-example |
25 |
public class SimpleTest extends BaseTest {
public static Date NICE_START_DATE = new Date();
private final long startedAt = System.currentTimeMillis();
private final String testName;
private final int maxExecutions;
public int cnt = 0;
private Map<Character, Integer> charCounter = new TreeMap<Character, Integer>();
public SimpleTest(final String testName, final int maxExecutions) {
this.testName = testName;
this.maxExecutions = maxExecutions;
}
void message(final String uuid) throws Exception {
System.out.println(cnt + ":" + uuid);
cnt += 1;
checkEnd(cnt, maxExecutions);
final Map<Character, Integer> info = makeCharCountMap(uuid);
merge(charCounter, info);
if ((cnt % 30) == 0) {
dump();
}
}
void merge(final Map<Character, Integer> charCounter, final Map<Character, Integer> newInfo) {
for (final Character c : newInfo.keySet()) {
final Integer i = newInfo.get(c);
Integer curr = charCounter.get(c);
if (curr == null) {
charCounter.put(c, i);
} else {
charCounter.put(c, curr + i);
}
}
}
void dump() {
System.out.println(charCounter);
charCounter = new HashMap<Character, Integer>();
}
static void checkEnd(final int val, final int max) throws Exception {
if (val > max) {
throw new Exception("Hit max executions " + val + " " + max);
}
}
@Override
public String toString() {
return getClass().getName() + ":" + testName + ":" + startedAt + "#" + System.identityHashCode(
this);
}
} |
File |
Project |
Line |
com/intergral/deep/examples/SimpleTest.java |
Agent Load |
32 |
com/intergral/deep/examples/SimpleTest.java |
Agent Load |
32 |
com/intergral/deep/examples/SimpleTest.java |
Dynamic Load |
32 |
com/intergral/deep/examples/SimpleTest.java |
otel-example |
32 |
com/intergral/deep/examples/SimpleTest.java |
prometheus-metrics-example |
32 |
private int cnt = 0;
private Map<Character, Integer> charCounter = new TreeMap<Character, Integer>();
public SimpleTest(final String testName, final int maxExecutions) {
this.testName = testName;
this.maxExecutions = maxExecutions;
}
void message(final String uuid) throws Exception {
System.out.println(cnt + ":" + uuid);
cnt += 1;
checkEnd(cnt, maxExecutions);
final Map<Character, Integer> info = makeCharCountMap(uuid);
merge(charCounter, info);
if ((cnt % 30) == 0) {
dump();
}
}
void merge(final Map<Character, Integer> charCounter, final Map<Character, Integer> newInfo) {
for (final Character c : newInfo.keySet()) {
final Integer i = newInfo.get(c);
Integer curr = charCounter.get(c);
if (curr == null) {
charCounter.put(c, i);
} else {
charCounter.put(c, curr + i);
}
}
}
void dump() {
System.out.println(charCounter);
charCounter = new HashMap<Character, Integer>();
}
static void checkEnd(final int val, final int max) throws Exception {
if (val > max) {
throw new Exception("Hit max executions " + val + " " + max);
}
}
@Override
public String toString() {
return getClass().getName() + ":" + testName + ":" + startedAt + "#" + System.identityHashCode(
this);
}
} |
File |
Project |
Line |
com/intergral/deep/examples/Main.java |
Dynamic Load |
39 |
com/intergral/deep/examples/Main.java |
otel-example |
64 |
com/intergral/deep/examples/Main.java |
prometheus-metrics-example |
49 |
public class Main {
/**
* Main entry for example.
*
* @param args the startup arguments
* @throws Throwable if we error
*/
public static void main(String[] args) throws Throwable {
// this is only needed in this example as we are using a local built module
// if using the dependency from maven you do not need to set the path
//noinspection DataFlowIssue
Path jarPath = Paths.get(Main.class.getResource("/").toURI())
.getParent()
.getParent()
.getParent()
.getParent()
.resolve("agent/target/agent-1.0-SNAPSHOT.jar");
// Dynamically configure and attach the deep agent
Deep.config()
.setJarPath(jarPath.toAbsolutePath().toString())
.setValue(ISettings.KEY_SERVICE_URL, "localhost:43315")
.setValue(ISettings.KEY_SERVICE_SECURE, false)
.start();
// different ways to get the API instance
final Deep instance = Deep.getInstance();
System.out.println(instance.<IDeep>api().getVersion());
System.out.println(instance.<IReflection>reflection());
System.out.println(DeepAPI.api().getVersion());
System.out.println(DeepAPI.reflection()); |
File |
Project |
Line |
com/intergral/deep/examples/BaseTest.java |
Agent Load |
25 |
com/intergral/deep/examples/BaseTest.java |
Agent Load |
25 |
com/intergral/deep/examples/BaseTest.java |
Dynamic Load |
25 |
com/intergral/deep/examples/BaseTest.java |
otel-example |
25 |
com/intergral/deep/examples/BaseTest.java |
prometheus-metrics-example |
25 |
public class BaseTest {
protected final Properties systemProps = System.getProperties();
public String newId() {
return UUID.randomUUID().toString();
}
public Map<Character, Integer> makeCharCountMap(final String str) {
final HashMap<Character, Integer> res = new HashMap<Character, Integer>();
for (int i = 0; i < str.length(); i++) {
final char c = str.charAt(i);
final Integer cnt = res.get(c);
if (cnt == null) {
res.put(c, 0);
} else {
res.put(c, cnt + 1);
}
}
return res;
}
} |
File |
Project |
Line |
com/intergral/deep/agent/api/utils/string/TextStringBuilder.java |
Agent API |
595 |
com/intergral/deep/agent/api/utils/string/TextStringBuilder.java |
Agent API |
706 |
com/intergral/deep/agent/api/utils/string/TextStringBuilder.java |
Agent API |
753 |
com/intergral/deep/agent/api/utils/string/TextStringBuilder.java |
Agent API |
800 |
public TextStringBuilder append(final String str, final int startIndex, final int length) {
if (str == null) {
return appendNull();
}
if (startIndex < 0 || startIndex > str.length()) {
throw new StringIndexOutOfBoundsException("startIndex must be valid");
}
if (length < 0 || (startIndex + length) > str.length()) {
throw new StringIndexOutOfBoundsException("length must be valid");
}
if (length > 0) {
final int len = length();
ensureCapacity(len + length);
str.getChars(startIndex, startIndex + length, buffer, len);
size += length;
}
return this;
}
/**
* Calls {@link String#format(String, Object...)} and appends the result.
*
* @param format the format string
* @param objs the objects to use in the format string
* @return {@code this} to enable chaining
* @see String#format(String, Object...)
*/
public TextStringBuilder append(final String format, final Object... objs) { |