PMD Results

The following document contains the results of PMD 4.2.5.

Files

com/melloware/jukes/db/audit/AuditInterceptor.java

Violation Line
Return an empty array rather than null. 93 - 95

com/melloware/jukes/db/Database.java

Violation Line
Singleton is not thread safe 198 - 210

com/melloware/jukes/db/HibernateUtil.java

Violation Line
The String literal "unchecked" appears 5 times in this file; the first occurrence is on line 63 63

com/melloware/jukes/db/orm/Catalog.java

Violation Line
Avoid reassigning parameters such as 'aFilter' 50

com/melloware/jukes/file/Disclist.java

Violation Line
Avoid if (x != y) ..; else ..; 99 - 106
Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty() 99
Avoid unnecessary if..then..else statements when returning a boolean 100 - 104
Avoid if (x != y) ..; else ..; 116 - 123
Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty() 116
Avoid unnecessary if..then..else statements when returning a boolean 117 - 121

com/melloware/jukes/file/MusicDirectory.java

Violation Line
Avoid if (x != y) ..; else ..; 139 - 154
Avoid if (x != y) ..; else ..; 452 - 456
Position literals first in String comparisons 457
Position literals first in String comparisons 458
Position literals first in String comparisons 459
Avoid if (x != y) ..; else ..; 464 - 473

com/melloware/jukes/file/Playlist.java

Violation Line
The String literal " - " appears 4 times in this file; the first occurrence is on line 615 615

com/melloware/jukes/file/tag/ApeFileTag.java

Violation Line
New exception is thrown in catch block, original stack trace may be lost 55 - 56
New exception is thrown in catch block, original stack trace may be lost 59 - 60
Use equals() to compare strings instead of '==' or '!=' 77
These nested if statements could be combined 78 - 80
Deeply nested if..then statements are hard to read 78 - 80
Use equals() to compare strings instead of '==' or '!=' 82
These nested if statements could be combined 134 - 137
The String literal "FieldDataInvalidException" appears 7 times in this file; the first occurrence is on line 287 287
The String literal "FieldDataInvalidException: " appears 7 times in this file; the first occurrence is on line 289 289
New exception is thrown in catch block, original stack trace may be lost 482

com/melloware/jukes/file/tag/AudioFileTag.java

Violation Line
New exception is thrown in catch block, original stack trace may be lost 56 - 57
New exception is thrown in catch block, original stack trace may be lost 60 - 61
Use equals() to compare strings instead of '==' or '!=' 79
These nested if statements could be combined 80 - 82
Deeply nested if..then statements are hard to read 80 - 82
Use equals() to compare strings instead of '==' or '!=' 84
These nested if statements could be combined 135 - 141
Deeply nested if..then statements are hard to read 137 - 139
The String literal "FieldDataInvalidException" appears 14 times in this file; the first occurrence is on line 291 291
New exception is thrown in catch block, original stack trace may be lost 486

com/melloware/jukes/file/tag/Mp3Tag.java

Violation Line
Perhaps 'CODE_ALBUM_ARTIST' could be replaced by a local variable. 71
Private field 'V2_CODE_DISC_NUMBER' could be made final; it is only initialized in the declaration or constructor. 72
New exception is thrown in catch block, original stack trace may be lost 94 - 95
New exception is thrown in catch block, original stack trace may be lost 98 - 99
New exception is thrown in catch block, original stack trace may be lost 103 - 104
New exception is thrown in catch block, original stack trace may be lost 108 - 109
New exception is thrown in catch block, original stack trace may be lost 112 - 113
Avoid if (x != y) ..; else ..; 136 - 149
String.trim().length()==0 is an inefficient way to validate an empty String. 290
String.indexOf(char) is faster than String.indexOf(String). 304
String.indexOf(char) is faster than String.indexOf(String). 306

com/melloware/jukes/gui/Jukes.java

Violation Line
Use block level rather than method level synchronization 300 - 309
Use block level rather than method level synchronization 315 - 335
Non-static initializers are confusing 419 - 422

com/melloware/jukes/gui/tool/logging/AwtLogHandler.java

Violation Line
Avoid unnecessary comparisons in boolean expressions 61
These nested if statements could be combined 75 - 77

com/melloware/jukes/gui/tool/MainController.java

Violation Line
Use equals() to compare strings instead of '==' or '!=' 953
Avoid if (x != y) ..; else ..; 974 - 989
These nested if statements could be combined 1528 - 1531
Avoid if (x != y) ..; else ..; 1698 - 1712
Use equals() to compare strings instead of '==' or '!=' 1802
An empty statement (semicolon) not part of a loop 1859

com/melloware/jukes/gui/tool/Settings.java

Violation Line
Avoid reassigning parameters such as 'volume' 1041
Avoid reassigning parameters such as 'volume' 1041

com/melloware/jukes/gui/view/component/DisclistCellRenderer.java

Violation Line
StringBuffer.append is called 2 consecutive times with literal Strings. Use a single append with a single String. 62
StringBuffer.append is called 2 consecutive times with literal Strings. Use a single append with a single String. 62

com/melloware/jukes/gui/view/component/PlaylistCellRenderer.java

Violation Line
StringBuffer.append is called 2 consecutive times with literal Strings. Use a single append with a single String. 61
StringBuffer.append is called 2 consecutive times with literal Strings. Use a single append with a single String. 61

com/melloware/jukes/gui/view/dialogs/DifferenceToolDialog.java

Violation Line
Perhaps 'panel' could be replaced by a local variable. 88
Perhaps 'settings' could be replaced by a local variable. 92
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 423
New exception is thrown in catch block, original stack trace may be lost 506
New exception is thrown in catch block, original stack trace may be lost 510
New exception is thrown in catch block, original stack trace may be lost 514
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 569

com/melloware/jukes/gui/view/dialogs/DiscAddDialog.java

Violation Line
Private field 'webImagePreview' could be made final; it is only initialized in the declaration or constructor. 83
Private field 'header' could be made final; it is only initialized in the declaration or constructor. 84
Perhaps 'buttonCancel' could be replaced by a local variable. 86
Perhaps 'buttonSave' could be replaced by a local variable. 87
Private field 'genreField' could be made final; it is only initialized in the declaration or constructor. 88
Perhaps 'buttonBar' could be replaced by a local variable. 89
Private field 'tagTable' could be made final; it is only initialized in the declaration or constructor. 91
Private field 'artistField' could be made final; it is only initialized in the declaration or constructor. 92
Private field 'discField' could be made final; it is only initialized in the declaration or constructor. 93
Private field 'yearField' could be made final; it is only initialized in the declaration or constructor. 94

com/melloware/jukes/gui/view/dialogs/DiscFindDialog.java

Violation Line
Possible unsafe assignment to a non-final static field in a constructor. 91
An empty statement (semicolon) not part of a loop 362

com/melloware/jukes/gui/view/dialogs/DiscRemoveDialog.java

Violation Line
Perhaps 'panel' could be replaced by a local variable. 63

com/melloware/jukes/gui/view/dialogs/FreeDBDialog.java

Violation Line
Logger should be defined private static final and have the correct class 64
Perhaps 'buttonBar' could be replaced by a local variable. 74
Perhaps 'list' could be replaced by a local variable. 76
New exception is thrown in catch block, original stack trace may be lost 458

com/melloware/jukes/gui/view/dialogs/GenresToolDialog.java

Violation Line
Logger should be defined private static final and have the correct class 73
Perhaps 'buttonBar' could be replaced by a local variable. 82
Private field 'addDiscMenu' could be made final; it is only initialized in the declaration or constructor. 90
Perhaps 'addDiscMenu' could be replaced by a local variable. 90
These nested if statements could be combined 404 - 430
An empty statement (semicolon) not part of a loop 410
New exception is thrown in catch block, original stack trace may be lost 441

com/melloware/jukes/gui/view/dialogs/LocationChangeDialog.java

Violation Line
Perhaps 'buttonApply' could be replaced by a local variable. 50
Perhaps 'buttonClose' could be replaced by a local variable. 51
Perhaps 'settings' could be replaced by a local variable. 55
Ensure that resources like this Connection object are closed after use 89

com/melloware/jukes/gui/view/dialogs/MemoryDialog.java

Violation Line
Perhaps 'buttonClose' could be replaced by a local variable. 41
Perhaps 'buttonBar' could be replaced by a local variable. 42

com/melloware/jukes/gui/view/dialogs/SearchDialog.java

Violation Line
Perhaps 'buttonBar' could be replaced by a local variable. 85
New exception is thrown in catch block, original stack trace may be lost 460

com/melloware/jukes/gui/view/dialogs/StatisticsDialog.java

Violation Line
Perhaps 'buttonClose' could be replaced by a local variable. 27
Perhaps 'buttonBar' could be replaced by a local variable. 28

com/melloware/jukes/gui/view/dialogs/TrackAddDialog.java

Violation Line
Private field 'webImagePreview' could be made final; it is only initialized in the declaration or constructor. 87
Perhaps 'buttonCancel' could be replaced by a local variable. 90
Perhaps 'buttonSave' could be replaced by a local variable. 91
Private field 'genreField' could be made final; it is only initialized in the declaration or constructor. 92
Perhaps 'buttonBar' could be replaced by a local variable. 93
Private field 'artistField' could be made final; it is only initialized in the declaration or constructor. 96
Private field 'discField' could be made final; it is only initialized in the declaration or constructor. 97
Private field 'yearField' could be made final; it is only initialized in the declaration or constructor. 98
Avoid if (x != y) ..; else ..; 234 - 284

com/melloware/jukes/gui/view/dialogs/WebSearchDialog.java

Violation Line
Perhaps 'buttonBar' could be replaced by a local variable. 87
Perhaps 'list' could be replaced by a local variable. 89
Private field 'endpointsCombo' could be made final; it is only initialized in the declaration or constructor. 99
Avoid unused local variables such as 'row'. 332
New exception is thrown in catch block, original stack trace may be lost 506

com/melloware/jukes/gui/view/dialogs/XMLExportDialog.java

Violation Line
Logger should be defined private static final and have the correct class 62
Perhaps 'buttonBar' could be replaced by a local variable. 66
Perhaps 'settings' could be replaced by a local variable. 69
Private field 'file' could be made final; it is only initialized in the declaration or constructor. 71
New exception is thrown in catch block, original stack trace may be lost 303
Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty() 357
Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty() 384
Avoid if (x != y) ..; else ..; 465 - 474
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484
Avoid reassigning parameters such as 'aString' 484

com/melloware/jukes/gui/view/dialogs/XMLImportDialog.java

Violation Line
Logger should be defined private static final and have the correct class 69
Perhaps 'buttonBar' could be replaced by a local variable. 73
Perhaps 'settings' could be replaced by a local variable. 75
StringBuffers can grow quite a lot, and so may become a source of memory leak (if the owning class has a long life time). 324
New exception is thrown in catch block, original stack trace may be lost 349
When instantiating a SimpleDateFormat object, specify a Locale 357
New exception is thrown in catch block, original stack trace may be lost 372
The String literal "XML Import: Truncate String - " appears 7 times in this file; the first occurrence is on line 381 381
New exception is thrown in catch block, original stack trace may be lost 409
The String literal "Import XML: " appears 12 times in this file; the first occurrence is on line 430 430
New exception is thrown in catch block, original stack trace may be lost 473
These nested if statements could be combined 549 - 551

com/melloware/jukes/gui/view/DisclistPanel.java

Violation Line
Perhaps 'disclistScrollPane' could be replaced by a local variable. 75
Perhaps 'disclistModel' could be replaced by a local variable. 77

com/melloware/jukes/gui/view/editor/ArtistEditor.java

Violation Line
Perhaps 'artistPanel' could be replaced by a local variable. 72
These nested if statements could be combined 164 - 166
Deeply nested if..then statements are hard to read 164 - 166

com/melloware/jukes/gui/view/editor/DiscEditor.java

Violation Line
Perhaps 'discPanel' could be replaced by a local variable. 102
Perhaps 'trackList' could be replaced by a local variable. 106
Perhaps 'tracks' could be replaced by a local variable. 112
An empty statement (semicolon) not part of a loop 192
These nested if statements could be combined 202 - 204
Deeply nested if..then statements are hard to read 202 - 204
The String literal "messages.discnotexists" appears 4 times in this file; the first occurrence is on line 234 234
Avoid printStackTrace(); use a logger call instead. 276
These nested if statements could be combined 420 - 424
These nested if statements could be combined 434 - 437
These nested if statements could be combined 441 - 444
These nested if statements could be combined 580 - 584
These nested if statements could be combined 615 - 618

com/melloware/jukes/gui/view/editor/TrackEditor.java

Violation Line
Perhaps 'trackPanel' could be replaced by a local variable. 67
The String literal "messages.editorerrors" appears 4 times in this file; the first occurrence is on line 154 154
These nested if statements could be combined 267 - 269
Deeply nested if..then statements are hard to read 267 - 269

com/melloware/jukes/gui/view/FilterPanel.java

Violation Line
Perhaps 'filterPanel' could be replaced by a local variable. 61
Perhaps 'scrollPane' could be replaced by a local variable. 62
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 145
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 147
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 157
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 159
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 166
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 168

com/melloware/jukes/gui/view/MainFrame.java

Violation Line
A switch with less than 3 branches is inefficient, use a if statement instead. 279 - 295

com/melloware/jukes/gui/view/MainPageBuilder.java

Violation Line
Perhaps 'navigationPanel' could be replaced by a local variable. 96
Avoid if (x != y) ..; else ..; 186 - 198
Use block level rather than method level synchronization 579 - 581
Use block level rather than method level synchronization 588 - 590
Avoid if (x != y) ..; else ..; 687 - 699
Avoid if (x != y) ..; else ..; 717 - 721

com/melloware/jukes/gui/view/PlaylistPanel.java

Violation Line
Perhaps 'listScrollPane' could be replaced by a local variable. 80
Perhaps 'listModel' could be replaced by a local variable. 84

com/melloware/jukes/gui/view/preferences/LookAndFeelPanel.java

Violation Line
Avoid empty catch blocks 269 - 271
Use block level rather than method level synchronization 322 - 328

com/melloware/jukes/gui/view/preferences/PreferencesDialog.java

Violation Line
Perhaps 'lafPanel' could be replaced by a local variable. 51

com/melloware/jukes/gui/view/preferences/PropertySheetSettings.java

Violation Line
Perhaps 'settings' could be replaced by a local variable. 27

com/melloware/jukes/gui/view/tasks/LoadDisclistTask.java

Violation Line
Perhaps 'file' could be replaced by a local variable. 34

com/melloware/jukes/gui/view/tasks/LoadPlaylistTask.java

Violation Line
Perhaps 'file' could be replaced by a local variable. 47

com/melloware/jukes/gui/view/tasks/UpdateTagsTask.java

Violation Line
These nested if statements could be combined 121 - 123
An operation on an Immutable object (String, BigDecimal or BigInteger) won't change the object itself 122
The String literal "Exception caught updating tags: " appears 5 times in this file; the first occurrence is on line 162 162

com/melloware/jukes/gui/view/validation/DiscValidator.java

Violation Line
String.indexOf(char) is faster than String.indexOf(String). 85
String.indexOf(char) is faster than String.indexOf(String). 86
String.indexOf(char) is faster than String.indexOf(String). 87
String.indexOf(char) is faster than String.indexOf(String). 88
String.indexOf(char) is faster than String.indexOf(String). 89
String.indexOf(char) is faster than String.indexOf(String). 90
String.indexOf(char) is faster than String.indexOf(String). 91
String.indexOf(char) is faster than String.indexOf(String). 92
String.indexOf(char) is faster than String.indexOf(String). 93
String.indexOf(char) is faster than String.indexOf(String). 94
String.indexOf(char) is faster than String.indexOf(String). 95
String.indexOf(char) is faster than String.indexOf(String). 96

com/melloware/jukes/util/GuiUtil.java

Violation Line
Unnecessary final modifier in final class 42 - 53

com/melloware/jukes/util/TimeSpanUnit.java

Violation Line
An Interface should be used only to model a behaviour; consider converting this to a class. 123 - 139

com/melloware/jukes/ws/AmazonItem.java

Violation Line
Avoid if (x != y) ..; else ..; 277 - 340
These nested if statements could be combined 462 - 464
These nested if statements could be combined 473 - 475

com/melloware/jukes/ws/AmazonSearch.java

Violation Line
Avoid if (x != y) ..; else ..; 146 - 166

com/melloware/jukes/ws/FreeDBItem.java

Violation Line
Private field 'releaseDate' could be made final; it is only initialized in the declaration or constructor. 28

com/melloware/jukes/ws/SignedRequestsHelper.java

Violation Line
A class which only has private constructors should be final 53 - 295
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 104
When instantiating a SimpleDateFormat object, specify a Locale 199
Avoid appending characters as strings in StringBuffer.append. 223
Avoid appending characters as strings in StringBuffer.append. 226
Consider simply returning the value vs storing it in local variable 'cannoical' 230
Avoid empty catch blocks 275 - 276
Switch statements should have a default label 278 - 291
A switch with less than 3 branches is inefficient, use a if statement instead. 278 - 291