In class edu.odu.cs.cs350.Corpus
In method edu.odu.cs.cs350.Corpus.getDocuments()
Field edu.odu.cs.cs350.Corpus.documents
At Corpus.java:[line 40]
edu.odu.cs.cs350.Corpus.getDocuments() may expose internal representation by returning Corpus.documents
In class edu.odu.cs.cs350.Document
In method edu.odu.cs.cs350.Document.getWords()
Field edu.odu.cs.cs350.Document.words
At Document.java:[line 67]
edu.odu.cs.cs350.Document.getWords() may expose internal representation by returning Document.words
In class edu.odu.cs.cs350.LoggerUtil
In method edu.odu.cs.cs350.LoggerUtil.getLogger()
On field edu.odu.cs.cs350.LoggerUtil.logger
At LoggerUtil.java:[lines 16-18]
Incorrect lazy initialization and update of static field edu.odu.cs.cs350.LoggerUtil.logger in edu.odu.cs.cs350.LoggerUtil.getLogger()
In class edu.odu.cs.cs350.LoggerUtil
In method edu.odu.cs.cs350.LoggerUtil.getLogger()
Field edu.odu.cs.cs350.LoggerUtil.logger
At LoggerUtil.java:[line 16]
Another occurrence at LoggerUtil.java:[line 43]
Public static edu.odu.cs.cs350.LoggerUtil.getLogger() may expose internal representation by returning LoggerUtil.logger
In class edu.odu.cs.cs350.pdfFileProcessor
At pdfFileProcessor.java:[lines 14-41]
The class name edu.odu.cs.cs350.pdfFileProcessor doesn't start with an upper case letter
In class edu.odu.cs.cs350.txtFileProcessor
At txtFileProcessor.java:[lines 24-87]
The class name edu.odu.cs.cs350.txtFileProcessor doesn't start with an upper case letter
Returning a reference to a mutable object value stored in one of the object's fields
exposes the internal representation of the object.
If instances
are accessed by untrusted code, and unchecked changes to
the mutable object would compromise security or other
important properties, you will need to do something different.
Returning a new copy of the object is better approach in many situations.
See CWE-374: Passing Mutable Objects to an Untrusted Method.
This method contains an unsynchronized lazy initialization of a static field.
After the field is set, the object stored into that location is further updated or accessed.
The setting of the field is visible to other threads as soon as it is set. If the
further accesses in the method that set the field serve to initialize the object, then
you have a very serious multithreading bug, unless something else prevents
any other thread from accessing the stored object until it is fully initialized.
Even if you feel confident that the method is never called by multiple
threads, it might be better to not set the static field until the value
you are setting it to is fully populated/initialized.
See CWE-543: Use of Singleton Pattern Without Synchronization in a Multithreaded Context.
A public static method returns a reference to a mutable object or
an array that is part of the static state of the class.
Any code that calls this method can freely modify
the underlying array.
One fix is to return a copy of the array.
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).