Showing 821 of 821 total issues
Method handleEvent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
Platform platform = Platform.getInstance();
PostOffice po = PostOffice.getInstance();
EventEnvelope event = (EventEnvelope) body;
Method executeOrderly
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void executeOrderly(Map<String, Class<?>> steps, String[] args, boolean main) {
List<String> list = new ArrayList<>(steps.keySet());
if (list.size() > 1) {
Collections.sort(list);
}
Method asyncRequest
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Future<EventEnvelope> asyncRequest(final EventEnvelope event, long timeout) throws IOException {
if (event == null) {
throw new IllegalArgumentException(MISSING_EVENT);
}
String dest = event.getTo();
Method sendLater
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public String sendLater(final EventEnvelope event, Date future) {
String dest = event.getTo();
if (dest == null) {
throw new IllegalArgumentException(MISSING_ROUTING_PATH);
}
Method escapeXml
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private String escapeXml(String value, TagType type) {
switch (type) {
case START:
if (value.startsWith("/") || value.startsWith("{")) {
return "node value=\""+value+"\"";
Method sendEvent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void sendEvent(String topic, int partition, Map<String, String> headers, Object body) {
String realTopic = partition < 0 ? topic : topic + "." + partition;
if (ConnectorConfig.topicSubstitutionEnabled()) {
realTopic = preAllocatedTopics.getOrDefault(realTopic, realTopic);
}
Method transform
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Map<String, Object> transform(Map<String, String> headers) {
// restore the original types for selected key-values
Utility util = Utility.getInstance();
Map<String, Object> result = new HashMap<>();
for (String key: headers.keySet()) {
Method publish
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
ConnectorConfig.validateTopicName(topic);
Map<String, String> eventHeaders = headers == null? new HashMap<>() : headers;
if (eventHeaders.containsKey(EventProducer.EMBED_EVENT) && body instanceof byte[]) {
Method handleEvent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
if (headers.containsKey(TYPE)) {
if (LIST.equals(headers.get(TYPE))) {
return listTopics();
Method sendEvent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void sendEvent(String topic, int partition, Map<String, String> headers, Object body) {
String realTopic = partition < 0 ? topic : topic + "." + partition;
if (ConnectorConfig.topicSubstitutionEnabled()) {
realTopic = preAllocatedTopics.getOrDefault(realTopic, realTopic);
}
Method publish
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
ConnectorConfig.validateTopicName(topic);
Map<String, String> eventHeaders = headers == null? new HashMap<>() : headers;
if (eventHeaders.containsKey(EventProducer.EMBED_EVENT) && body instanceof byte[]) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (EventEnvelope event : events) {
TargetRoute target = destinations.get(n++);
event.setBroadcastLevel(0);
event.setReplyTo(replyTo);
if (target.isCloud()) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (EventProducer.TEXT_DATA.equals(dataType)) {
message.setHeaders(originalHeaders).setBody(util.getUTF(data));
} else if (EventProducer.MAP_DATA.equals(dataType) ||
EventProducer.LIST_DATA.equals(dataType)) {
message.setHeaders(originalHeaders).setBody(msgPack.unpack(data));
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (EventEnvelope event : events) {
TargetRoute target = destinations.get(n++);
event.setBroadcastLevel(0);
event.setReplyTo(replyTo);
if (target.isCloud()) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (EventProducer.TEXT_DATA.equals(dataType)) {
message.setHeaders(originalHeaders).setBody(util.getUTF(data));
} else if (EventProducer.MAP_DATA.equals(dataType) || EventProducer.LIST_DATA.equals(dataType)) {
message.setHeaders(originalHeaders).setBody(msgPack.unpack(data));
} else {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public long str2long(String str) {
if (str == null || str.length() == 0) {
return -1;
}
try {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public int str2int(String str) {
if (str == null || str.length() == 0) {
return -1;
}
try {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method startCloudServices
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public synchronized void startCloudServices() {
if (!Platform.cloudServicesStarted) {
// guarantee to execute once
Platform.cloudServicesStarted = true;
AppConfigReader reader = AppConfigReader.getInstance();
Method validateServiceList
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private List<String> validateServiceList(Object svcList) {
Utility util = Utility.getInstance();
List<String> list = svcList instanceof String?
Collections.singletonList((String) svcList) : (List<String>) svcList;
Identical blocks of code found in 4 locations. Consider refactoring. Open
if (trace != null) {
if (trace.route != null && event.getFrom() == null) {
event.setFrom(trace.route);
}
if (trace.id != null && trace.path != null) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 78.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76