PMD Results

The following document contains the results of PMD 4.2.2.

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 217 - 229

com/melloware/jukes/db/HibernateUtil.java

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

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

Violation Line
Avoid unused imports such as 'java.util.Arrays' 6
Avoid reassigning parameters such as 'aFilter' 50

com/melloware/jukes/file/Disclist.java

Violation Line
Avoid unused imports such as 'java.io.FileOutputStream' 6
Avoid unused imports such as 'java.sql.Timestamp' 8
Avoid unused imports such as 'java.text.MessageFormat' 9
Avoid unused imports such as 'java.util.Random' 14
Avoid unused imports such as 'javax.swing.JComponent' 15
Avoid unused imports such as 'org.apache.commons.io.FilenameUtils' 18
Avoid unused imports such as 'org.apache.commons.lang.StringUtils' 19
Avoid unused imports such as 'org.dom4j.Document' 22
Avoid unused imports such as 'org.dom4j.DocumentHelper' 23
Avoid unused imports such as 'org.dom4j.io.OutputFormat' 24
Avoid unused imports such as 'org.dom4j.io.XMLWriter' 25
Avoid unused imports such as 'com.jgoodies.uif.action.ActionManager' 28
Avoid unused imports such as 'com.jgoodies.uif.util.ResourceUtils' 30
Avoid unused imports such as 'com.melloware.jspiff.jaxp.XspfPlaylist' 31
Avoid unused imports such as 'com.melloware.jspiff.jaxp.XspfPlaylistTrackList' 32
Avoid unused imports such as 'com.melloware.jspiff.jaxp.XspfTrack' 33
Avoid unused imports such as 'com.melloware.jukes.db.HibernateDao' 34
Avoid unused imports such as 'com.melloware.jukes.file.filter.M3uFilter' 39
Avoid unused imports such as 'com.melloware.jukes.file.filter.XspfFilter' 40
Avoid unused imports such as 'com.melloware.jukes.gui.tool.Actions' 41
Avoid unused imports such as 'com.melloware.jukes.util.TimeSpan' 44
Avoid unused private fields such as 'catalog'. 63
Avoid if (x != y) ..; else ..; 126 - 133
Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty() 126
Avoid unnecessary if..then..else statements when returning a boolean 127 - 131
Avoid if (x != y) ..; else ..; 143 - 150
Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty() 143
Avoid unnecessary if..then..else statements when returning a boolean 144 - 148

com/melloware/jukes/file/image/ImageFactory.java

Violation Line
Avoid unused imports such as 'java.awt.image.ImageObserver' 7

com/melloware/jukes/file/MusicDirectory.java

Violation Line
Avoid if (x != y) ..; else ..; 277 - 292
Avoid if (x != y) ..; else ..; 400 - 404
Position literals first in String comparisons 405
Position literals first in String comparisons 406
Position literals first in String comparisons 407
Avoid if (x != y) ..; else ..; 412 - 421

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/AudioFileTag.java

Violation Line
Caught exception is rethrown, original stack trace may be lost 59 - 60
Caught exception is rethrown, original stack trace may be lost 63 - 64
Use equals() to compare strings instead of '==' or '!=' 82
These nested if statements could be combined 83 - 85
Deeply nested if..then statements are hard to read 83 - 85
Use equals() to compare strings instead of '==' or '!=' 87
These nested if statements could be combined 138 - 144
Deeply nested if..then statements are hard to read 140 - 142
The String literal "FieldDataInvalidException" appears 14 times in this file; the first occurrence is on line 294 294
Caught exception is rethrown, original stack trace may be lost 487

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

Violation Line
Perhaps 'CODE_ALBUM_ARTIST' could be replaced by a local variable. 70
Private field 'V2_CODE_DISC_NUMBER' could be made final; it is only initialized in the declaration or constructor. 71
Caught exception is rethrown, original stack trace may be lost 93 - 94
Caught exception is rethrown, original stack trace may be lost 97 - 98
Caught exception is rethrown, original stack trace may be lost 102 - 103
Caught exception is rethrown, original stack trace may be lost 107 - 108
Caught exception is rethrown, original stack trace may be lost 111 - 112
Avoid if (x != y) ..; else ..; 135 - 148
String.trim().length()==0 is an inefficient way to validate an empty String. 289
String.indexOf(char) is faster than String.indexOf(String). 303
String.indexOf(char) is faster than String.indexOf(String). 305

com/melloware/jukes/gui/Jukes.java

Violation Line
Use block level rather than method level synchronization 284 - 293
Use block level rather than method level synchronization 299 - 319
Non-static initializers are confusing 398 - 401

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
Avoid unused imports such as 'org.apache.commons.io.FilenameUtils' 41
Avoid unused imports such as 'com.melloware.jukes.gui.view.component.DisclistListModel' 71
Avoid unused imports such as 'com.melloware.jukes.gui.view.component.ExportableTable' 91
Use equals() to compare strings instead of '==' or '!=' 927
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 1482
Use equals() to compare strings instead of '==' or '!=' 1725
An empty statement (semicolon) not part of a loop 1781
Avoid unused local variables such as 'discList'. 1818

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

Violation Line
Avoid duplicate imports such as 'com.melloware.jukes.db.orm.Catalog' 44

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

Violation Line
Avoid unused imports such as 'java.io.FileInputStream' 5

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. 73
StringBuffer.append is called 2 consecutive times with literal Strings. Use a single append with a single String. 73

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

Violation Line
Avoid unused imports such as 'javax.swing.JComponent' 11

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. 74
StringBuffer.append is called 2 consecutive times with literal Strings. Use a single append with a single String. 74

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

Violation Line
Perhaps 'panel' could be replaced by a local variable. 87
Perhaps 'settings' could be replaced by a local variable. 91
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 417
Caught exception is rethrown, original stack trace may be lost 501
Caught exception is rethrown, original stack trace may be lost 505
Caught exception is rethrown, original stack trace may be lost 509
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 564

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

Violation Line
Perhaps 'buttonCancel' could be replaced by a local variable. 85
Perhaps 'buttonSave' could be replaced by a local variable. 86
Perhaps 'buttonBar' could be replaced by a local variable. 88
Avoid printStackTrace(); use a logger call instead. 187

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

Violation Line
Perhaps 'panel' could be replaced by a local variable. 85
Possible unsafe assignment to a non-final static field in a constructor. 90
An empty statement (semicolon) not part of a loop 361

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/DiscTableModel.java

Violation Line
Avoid unused imports such as 'org.apache.commons.lang.StringUtils' 5

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

Violation Line
Avoid unused imports such as 'java.text.MessageFormat' 9
Avoid unused imports such as 'java.util.Enumeration' 11
Avoid unused imports such as 'com.jgoodies.validation.Severity' 48
Avoid unused imports such as 'com.melloware.jukes.util.JukesValidationMessage' 63
Logger should be defined private static final and have the correct class 77
Perhaps 'buttonBar' could be replaced by a local variable. 86
Private field 'addDiscMenu' could be made final; it is only initialized in the declaration or constructor. 94
Perhaps 'addDiscMenu' could be replaced by a local variable. 94
Caught exception is rethrown, original stack trace may be lost 413

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
Avoid unused private fields such as 'buttonSave'. 42
Perhaps 'buttonClose' could be replaced by a local variable. 43
Perhaps 'buttonBar' could be replaced by a local variable. 44

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

Violation Line
Perhaps 'buttonBar' could be replaced by a local variable. 85
Caught exception is rethrown, original stack trace may be lost 460

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

Violation Line
Avoid unused imports such as 'com.melloware.jukes.gui.tool.MainModule' 13

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

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

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

Violation Line
Avoid unused imports such as 'java.util.Iterator' 12
Avoid unused imports such as 'com.melloware.jukes.gui.view.MainFrame' 66
Perhaps 'buttonCancel' could be replaced by a local variable. 94
Perhaps 'buttonSave' could be replaced by a local variable. 95
Perhaps 'buttonBar' could be replaced by a local variable. 97
Avoid unused local variables such as 'files'. 146
Avoid printStackTrace(); use a logger call instead. 188
Avoid if (x != y) ..; else ..; 229 - 279

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

Violation Line
Perhaps 'buttonBar' could be replaced by a local variable. 83
Perhaps 'list' could be replaced by a local variable. 85
Caught exception is rethrown, original stack trace may be lost 492

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

Violation Line
Avoid unused imports such as 'java.util.List' 13
Avoid unused imports such as 'javax.swing.Icon' 16
Avoid unused imports such as 'javax.swing.JToggleButton' 23
Avoid unused imports such as 'org.apache.commons.io.FilenameUtils' 31
Avoid unused imports such as 'org.apache.commons.lang.SystemUtils' 33
Avoid unused imports such as 'com.melloware.jukes.file.Playlist' 48
Avoid unused imports such as 'com.melloware.jukes.file.filter.M3uFilter' 51
Avoid unused imports such as 'com.melloware.jukes.file.filter.XspfFilter' 52
Avoid unused imports such as 'com.melloware.jukes.util.JukesValidationMessage' 64
Avoid unused private fields such as 'track'. 83
Perhaps 'disclistScrollPane' could be replaced by a local variable. 85
Perhaps 'disclistModel' could be replaced by a local variable. 87

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

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

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

Violation Line
Avoid unused imports such as 'com.jgoodies.binding.list.SelectionInList' 36
Avoid unused imports such as 'com.melloware.jukes.db.orm.Catalog' 54
Avoid unused imports such as 'com.melloware.jukes.file.FileUtil' 58
Perhaps 'discPanel' could be replaced by a local variable. 101
Perhaps 'trackList' could be replaced by a local variable. 105
Perhaps 'tracks' could be replaced by a local variable. 111
These nested if statements could be combined 198 - 200
Deeply nested if..then statements are hard to read 198 - 200
Avoid printStackTrace(); use a logger call instead. 272

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

Violation Line
Avoid unused imports such as 'com.melloware.jukes.gui.view.editor.DiscEditor' 50
No need to import a type that lives in the same package 50
Perhaps 'trackPanel' could be replaced by a local variable. 69
The String literal "messages.editorerrors" appears 4 times in this file; the first occurrence is on line 150 150
These nested if statements could be combined 253 - 255
Deeply nested if..then statements are hard to read 253 - 255

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

Violation Line
Perhaps 'filterPanel' could be replaced by a local variable. 65
Perhaps 'scrollPane' could be replaced by a local variable. 66
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 146
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 148
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 155
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 157
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 164
When doing a String.toLowerCase()/toUpperCase() call, use a Locale 166

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 ..; 188 - 200
Use block level rather than method level synchronization 549 - 551
Use block level rather than method level synchronization 558 - 560
Avoid if (x != y) ..; else ..; 662 - 674
Avoid if (x != y) ..; else ..; 693 - 697

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

Violation Line
Avoid unused local variables such as 'node'. 387

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

Violation Line
Perhaps 'listScrollPane' could be replaced by a local variable. 79
Perhaps 'listModel' could be replaced by a local variable. 83

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
Avoid unused imports such as 'javazoom.jlgui.basicplayer.BasicPlayer' 9
Avoid unused imports such as 'org.apache.commons.io.FilenameUtils' 12
Avoid unused imports such as 'com.jgoodies.uif.action.ActionManager' 17
Avoid unused imports such as 'com.jgoodies.uif.application.Application' 18
Avoid unused imports such as 'com.melloware.jukes.db.orm.Track' 24
Avoid unused imports such as 'com.melloware.jukes.file.filter.M3uFilter' 26
Avoid unused imports such as 'com.melloware.jukes.file.filter.XspfFilter' 27
Avoid unused imports such as 'com.melloware.jukes.gui.tool.Actions' 28
Avoid unused imports such as 'com.melloware.jukes.gui.tool.Player' 29
Avoid unused imports such as 'com.melloware.jukes.gui.view.MainFrame' 30
Perhaps 'file' could be replaced by a local variable. 47

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/validation/DiscValidator.java

Violation Line
Avoid unused imports such as 'com.jgoodies.validation.view.ValidationComponentUtils' 10
String.indexOf(char) is faster than String.indexOf(String). 76
String.indexOf(char) is faster than String.indexOf(String). 77
String.indexOf(char) is faster than String.indexOf(String). 78
String.indexOf(char) is faster than String.indexOf(String). 79
String.indexOf(char) is faster than String.indexOf(String). 80
String.indexOf(char) is faster than String.indexOf(String). 81
String.indexOf(char) is faster than String.indexOf(String). 82
String.indexOf(char) is faster than String.indexOf(String). 83
String.indexOf(char) is faster than String.indexOf(String). 84
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

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
These nested if statements could be combined 301 - 303