Showing 821 of 821 total issues
Method getTibcoProperties
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static synchronized Properties getTibcoProperties(String location) {
// default location is cloud.client.properties
Properties properties = allProperties.get(location);
if (properties == null) {
properties = new Properties();
Method handleEvent
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
@SuppressWarnings("unchecked")
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
PostOffice po = PostOffice.getInstance();
String myOrigin = Platform.getInstance().getOrigin();
Method handleEvent
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
@SuppressWarnings("unchecked")
public Object handleEvent(Map<String, String> headers, Object body, int instance) {
String type = headers.get(TYPE);
if (INFO.equals(type)) {
Method start
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void start() {
final Platform platform = Platform.getInstance();
final PostOffice po = PostOffice.getInstance();
final Utility util = Utility.getInstance();
final PubSub ps = PubSub.getInstance();
Method read
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public byte[] read() {
if (peeked != null) {
byte[] result = peeked;
peeked = null;
return result;
Method scanLibInfo
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void scanLibInfo() {
if (!loaded) {
synchronized (ORDERLY_SCAN) {
List<String> list = new ArrayList<>();
for (String r : JAR_PATHS) {
Method getClusterProperties
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Properties getClusterProperties(String location) {
// default location is cloud.client.properties
Properties properties = allProperties.get(location);
if (properties == null) {
ConfigReader clusterConfig = null;
Method outgoing
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void outgoing(ServiceQueue dest, EventEnvelope event) throws IOException {
if (dest != null && event != null) {
event.setEndOfRoute();
byte[] payload = event.toBytes();
EventBus system = Platform.getInstance().getEventSystem();
Method getClusterProperties
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Properties getClusterProperties(String location) {
// default location is cloud.client.properties
Properties properties = allProperties.get(location);
if (properties == null) {
ConfigReader clusterConfig = null;
Method getNextAvailable
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private String getNextAvailable(List<String> targetList) {
List<String> available = new ArrayList<>();
for (String target: targetList) {
if (ServiceRegistry.destinationExists(target)) {
available.add(target);
Identical blocks of code found in 2 locations. Consider refactoring. Open
@Override
public void write(Object o, @Nullable MediaType contentType, HttpOutputMessage outputMessage)
throws HttpMessageNotWritableException, IOException {
outputMessage.getHeaders().setContentType(JSON);
// this may be too late to validate because Spring RestController has already got the object
- 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 98.
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
LambdaFunction publisher = (headers, body, instance) -> {
if (body instanceof Map) {
Map<String, Object> data = (Map<String, Object>) body;
Object topic = data.get(TOPIC);
Object partition = data.get(PARTITION);
- 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 98.
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 (contentType.startsWith(TEXT_HTML)) {
byte[] start = util.getUTF(HTML_START);
byte[] payload = SimpleMapper.getInstance().getMapper().writeValueAsBytes(responseBody);
byte[] end = util.getUTF(HTML_END);
response.putHeader(CONTENT_LEN, String.valueOf(start.length+payload.length+end.length));
- 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 98.
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
LambdaFunction publisher = (headers, body, instance) -> {
if (body instanceof Map) {
Map<String, Object> data = (Map<String, Object>) body;
Object topic = data.get(TOPIC);
Object partition = data.get(PARTITION);
- 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 98.
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 (contentType.startsWith(TEXT_HTML)) {
byte[] start = util.getUTF(HTML_START);
byte[] payload = SimpleMapper.getInstance().getMapper().writeValueAsBytes(responseBody);
byte[] end = util.getUTF(HTML_END);
response.putHeader(CONTENT_LEN, String.valueOf(start.length+payload.length+end.length));
- 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 98.
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
@Override
public void write(Object o, @Nullable MediaType contentType, HttpOutputMessage outputMessage) throws HttpMessageNotWritableException, IOException {
outputMessage.getHeaders().setContentType(TEXT_CONTENT);
// this may be too late to validate because Spring RestController has already got the object
SimpleObjectMapper mapper = SimpleMapper.getInstance().getSafeMapper(o.getClass().getTypeName());
- 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 98.
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 loadHeaderEntry
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private void loadHeaderEntry(Map<String, Object> entry, boolean isRequest) {
String id = (String) entry.get(ID);
Object go = isRequest? entry.get(REQUEST) : entry.get(RESPONSE);
if (go instanceof Map) {
Method getEnvVariable
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public String getEnvVariable(String ref) {
long threadId = Thread.currentThread().getId();
List<String> observed = TEMP_CONFIG.getOrDefault(threadId, new ArrayList<>());
if (ref != null && ref.startsWith("${") && ref.endsWith("}")) {
String key = ref.substring(2, ref.length()-1).trim();
Method hello
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@GET
@Path("/concurrent")
@Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_HTML})
public Map<String, Object> hello(@Context HttpServletRequest request) throws IOException, AppException {
Method execute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void execute(JobExecutionContext context) {
JobDataMap parameters = context.getJobDetail().getJobDataMap();
ScheduledJob job = MainScheduler.getJob(parameters.getString(MainScheduler.JOB_ID));
if (job != null) {