SpotBugs Bug Detector Report

The following document contains the results of SpotBugs

SpotBugs Version is 4.8.5

Threshold is medium

Effort is default

Summary

Classes Bugs Errors Missing Classes
79 57 0 0

Files

Class Bugs
us.codecraft.webmagic.Page 10
us.codecraft.webmagic.Request 7
us.codecraft.webmagic.ResultItems 3
us.codecraft.webmagic.Site 5
us.codecraft.webmagic.Spider 6
us.codecraft.webmagic.SpiderScheduler 4
us.codecraft.webmagic.downloader.HttpClientDownloader 2
us.codecraft.webmagic.downloader.HttpClientGenerator 1
us.codecraft.webmagic.downloader.HttpClientRequestContext 2
us.codecraft.webmagic.downloader.HttpUriRequestConverter 1
us.codecraft.webmagic.model.HttpRequestBody 3
us.codecraft.webmagic.pipeline.ResultItemsCollectorPipeline 1
us.codecraft.webmagic.selector.AndSelector 1
us.codecraft.webmagic.selector.Html 2
us.codecraft.webmagic.selector.HtmlNode 1
us.codecraft.webmagic.selector.OrSelector 1
us.codecraft.webmagic.selector.PlainText 1
us.codecraft.webmagic.selector.RegexSelector 2
us.codecraft.webmagic.selector.ReplaceSelector 1
us.codecraft.webmagic.utils.CharsetUtils 1
us.codecraft.webmagic.utils.FilePersistentBase 2

us.codecraft.webmagic.Page

Bug Category Details Line Priority
us.codecraft.webmagic.Page.getBytes() may expose internal representation by returning Page.bytes MALICIOUS_CODE EI_EXPOSE_REP 307 Medium
us.codecraft.webmagic.Page.getHeaders() may expose internal representation by returning Page.headers MALICIOUS_CODE EI_EXPOSE_REP 291 Medium
us.codecraft.webmagic.Page.getHtml() may expose internal representation by returning Page.html MALICIOUS_CODE EI_EXPOSE_REP 146 Medium
us.codecraft.webmagic.Page.getJson() may expose internal representation by returning Page.json MALICIOUS_CODE EI_EXPOSE_REP 159 Medium
us.codecraft.webmagic.Page.getRequest() may expose internal representation by returning Page.request MALICIOUS_CODE EI_EXPOSE_REP 261 Medium
us.codecraft.webmagic.Page.getTargetRequests() may expose internal representation by returning Page.targetRequests MALICIOUS_CODE EI_EXPOSE_REP 173 Medium
us.codecraft.webmagic.Page.setBytes(byte[]) may expose internal representation by storing an externally mutable object into Page.bytes MALICIOUS_CODE EI_EXPOSE_REP2 311 Medium
us.codecraft.webmagic.Page.setHeaders(Map) may expose internal representation by storing an externally mutable object into Page.headers MALICIOUS_CODE EI_EXPOSE_REP2 295 Medium
us.codecraft.webmagic.Page.setHtml(Html) may expose internal representation by storing an externally mutable object into Page.html MALICIOUS_CODE EI_EXPOSE_REP2 169 Medium
us.codecraft.webmagic.Page.setRequest(Request) may expose internal representation by storing an externally mutable object into Page.request MALICIOUS_CODE EI_EXPOSE_REP2 265 Medium

us.codecraft.webmagic.Request

Bug Category Details Line Priority
us.codecraft.webmagic.Request.getCookies() may expose internal representation by returning Request.cookies MALICIOUS_CODE EI_EXPOSE_REP 163 Medium
us.codecraft.webmagic.Request.getDownloader() may expose internal representation by returning Request.downloader MALICIOUS_CODE EI_EXPOSE_REP 183 Medium
us.codecraft.webmagic.Request.getHeaders() may expose internal representation by returning Request.headers MALICIOUS_CODE EI_EXPOSE_REP 167 Medium
us.codecraft.webmagic.Request.getRequestBody() may expose internal representation by returning Request.requestBody MALICIOUS_CODE EI_EXPOSE_REP 171 Medium
us.codecraft.webmagic.Request.setDownloader(Downloader) may expose internal representation by storing an externally mutable object into Request.downloader MALICIOUS_CODE EI_EXPOSE_REP2 187 Medium
us.codecraft.webmagic.Request.setRequestBody(HttpRequestBody) may expose internal representation by storing an externally mutable object into Request.requestBody MALICIOUS_CODE EI_EXPOSE_REP2 175 Medium
Class us.codecraft.webmagic.Request defines non-transient non-serializable instance field downloader BAD_PRACTICE SE_BAD_FIELD Not available Medium

us.codecraft.webmagic.ResultItems

Bug Category Details Line Priority
us.codecraft.webmagic.ResultItems.getAll() may expose internal representation by returning ResultItems.fields MALICIOUS_CODE EI_EXPOSE_REP 33 Medium
us.codecraft.webmagic.ResultItems.getRequest() may expose internal representation by returning ResultItems.request MALICIOUS_CODE EI_EXPOSE_REP 42 Medium
us.codecraft.webmagic.ResultItems.setRequest(Request) may expose internal representation by storing an externally mutable object into ResultItems.request MALICIOUS_CODE EI_EXPOSE_REP2 46 Medium

us.codecraft.webmagic.Site

Bug Category Details Line Priority
us.codecraft.webmagic.Site.getAcceptStatCode() may expose internal representation by returning Site.acceptStatCode MALICIOUS_CODE EI_EXPOSE_REP 232 Medium
us.codecraft.webmagic.Site.getAllCookies() may expose internal representation by returning Site.cookies MALICIOUS_CODE EI_EXPOSE_REP 120 Medium
us.codecraft.webmagic.Site.getCookies() may expose internal representation by returning Site.defaultCookies MALICIOUS_CODE EI_EXPOSE_REP 111 Medium
us.codecraft.webmagic.Site.getHeaders() may expose internal representation by returning Site.headers MALICIOUS_CODE EI_EXPOSE_REP 267 Medium
us.codecraft.webmagic.Site.setAcceptStatCode(Set) may expose internal representation by storing an externally mutable object into Site.acceptStatCode MALICIOUS_CODE EI_EXPOSE_REP2 222 Medium

us.codecraft.webmagic.Spider

Bug Category Details Line Priority
us.codecraft.webmagic.Spider.getSpiderListeners() may expose internal representation by returning Spider.spiderListeners MALICIOUS_CODE EI_EXPOSE_REP 757 Medium
us.codecraft.webmagic.Spider.getStartTime() may expose internal representation by returning Spider.startTime MALICIOUS_CODE EI_EXPOSE_REP 766 Medium
us.codecraft.webmagic.Spider.setDownloader(Downloader) may expose internal representation by storing an externally mutable object into Spider.downloader MALICIOUS_CODE EI_EXPOSE_REP2 274 Medium
us.codecraft.webmagic.Spider.setPipelines(List) may expose internal representation by storing an externally mutable object into Spider.pipelines MALICIOUS_CODE EI_EXPOSE_REP2 238 Medium
us.codecraft.webmagic.Spider.setSpiderListeners(List) may expose internal representation by storing an externally mutable object into Spider.spiderListeners MALICIOUS_CODE EI_EXPOSE_REP2 761 Medium
us.codecraft.webmagic.Spider.startRequest(List) may expose internal representation by storing an externally mutable object into Spider.startRequests MALICIOUS_CODE EI_EXPOSE_REP2 152 Medium

us.codecraft.webmagic.SpiderScheduler

Bug Category Details Line Priority
us.codecraft.webmagic.SpiderScheduler.getScheduler() may expose internal representation by returning SpiderScheduler.scheduler MALICIOUS_CODE EI_EXPOSE_REP 20 Medium
new us.codecraft.webmagic.SpiderScheduler(Scheduler) may expose internal representation by storing an externally mutable object into SpiderScheduler.scheduler MALICIOUS_CODE EI_EXPOSE_REP2 16 Medium
us.codecraft.webmagic.SpiderScheduler.setScheduler(Scheduler) may expose internal representation by storing an externally mutable object into SpiderScheduler.scheduler MALICIOUS_CODE EI_EXPOSE_REP2 24 Medium
Exceptional return value of java.util.concurrent.locks.Condition.await(long, TimeUnit) ignored in us.codecraft.webmagic.SpiderScheduler.waitNewUrl(CountableThreadPool, long) BAD_PRACTICE RV_RETURN_VALUE_IGNORED_BAD_PRACTICE 41 Medium

us.codecraft.webmagic.downloader.HttpClientDownloader

Bug Category Details Line Priority
us.codecraft.webmagic.downloader.HttpClientDownloader.setHttpUriRequestConverter(HttpUriRequestConverter) may expose internal representation by storing an externally mutable object into HttpClientDownloader.httpUriRequestConverter MALICIOUS_CODE EI_EXPOSE_REP2 45 Medium
Null passed for non-null parameter of HttpClientGenerator.getClient(Site) in us.codecraft.webmagic.downloader.HttpClientDownloader.getHttpClient(Site) CORRECTNESS NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS 54 Medium

us.codecraft.webmagic.downloader.HttpClientGenerator

Bug Category Details Line Priority
Exception thrown in class us.codecraft.webmagic.downloader.HttpClientGenerator at new us.codecraft.webmagic.downloader.HttpClientGenerator() will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks. BAD_PRACTICE CT_CONSTRUCTOR_THROW 46 Medium

us.codecraft.webmagic.downloader.HttpClientRequestContext

Bug Category Details Line Priority
us.codecraft.webmagic.downloader.HttpClientRequestContext.getHttpClientContext() may expose internal representation by returning HttpClientRequestContext.httpClientContext MALICIOUS_CODE EI_EXPOSE_REP 27 Medium
us.codecraft.webmagic.downloader.HttpClientRequestContext.setHttpClientContext(HttpClientContext) may expose internal representation by storing an externally mutable object into HttpClientRequestContext.httpClientContext MALICIOUS_CODE EI_EXPOSE_REP2 31 Medium

us.codecraft.webmagic.downloader.HttpUriRequestConverter

Bug Category Details Line Priority
Nullcheck of site at line 71 of value previously dereferenced in us.codecraft.webmagic.downloader.HttpUriRequestConverter.convertHttpUriRequest(Request, Site, Proxy) CORRECTNESS RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE 64 Medium

us.codecraft.webmagic.model.HttpRequestBody

Bug Category Details Line Priority
us.codecraft.webmagic.model.HttpRequestBody.getBody() may expose internal representation by returning HttpRequestBody.body MALICIOUS_CODE EI_EXPOSE_REP 100 Medium
new us.codecraft.webmagic.model.HttpRequestBody(byte[], String, String) may expose internal representation by storing an externally mutable object into HttpRequestBody.body MALICIOUS_CODE EI_EXPOSE_REP2 42 Medium
us.codecraft.webmagic.model.HttpRequestBody.setBody(byte[]) may expose internal representation by storing an externally mutable object into HttpRequestBody.body MALICIOUS_CODE EI_EXPOSE_REP2 56 Medium

us.codecraft.webmagic.pipeline.ResultItemsCollectorPipeline

Bug Category Details Line Priority
us.codecraft.webmagic.pipeline.ResultItemsCollectorPipeline.getCollected() may expose internal representation by returning ResultItemsCollectorPipeline.collector MALICIOUS_CODE EI_EXPOSE_REP 24 Medium

us.codecraft.webmagic.selector.AndSelector

Bug Category Details Line Priority
new us.codecraft.webmagic.selector.AndSelector(List) may expose internal representation by storing an externally mutable object into AndSelector.selectors MALICIOUS_CODE EI_EXPOSE_REP2 23 Medium

us.codecraft.webmagic.selector.Html

Bug Category Details Line Priority
us.codecraft.webmagic.selector.Html.getDocument() may expose internal representation by returning Html.document MALICIOUS_CODE EI_EXPOSE_REP 56 Medium
new us.codecraft.webmagic.selector.Html(Document) may expose internal representation by storing an externally mutable object into Html.document MALICIOUS_CODE EI_EXPOSE_REP2 52 Medium

us.codecraft.webmagic.selector.HtmlNode

Bug Category Details Line Priority
new us.codecraft.webmagic.selector.HtmlNode(List) may expose internal representation by storing an externally mutable object into HtmlNode.elements MALICIOUS_CODE EI_EXPOSE_REP2 18 Medium

us.codecraft.webmagic.selector.OrSelector

Bug Category Details Line Priority
new us.codecraft.webmagic.selector.OrSelector(List) may expose internal representation by storing an externally mutable object into OrSelector.selectors MALICIOUS_CODE EI_EXPOSE_REP2 23 Medium

us.codecraft.webmagic.selector.PlainText

Bug Category Details Line Priority
new us.codecraft.webmagic.selector.PlainText(List) may expose internal representation by storing an externally mutable object into PlainText.sourceTexts MALICIOUS_CODE EI_EXPOSE_REP2 18 Medium

us.codecraft.webmagic.selector.RegexSelector

Bug Category Details Line Priority
Exception thrown in class us.codecraft.webmagic.selector.RegexSelector at new us.codecraft.webmagic.selector.RegexSelector(String) will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks. BAD_PRACTICE CT_CONSTRUCTOR_THROW 47 Medium
Exception thrown in class us.codecraft.webmagic.selector.RegexSelector at new us.codecraft.webmagic.selector.RegexSelector(String, int) will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks. BAD_PRACTICE CT_CONSTRUCTOR_THROW 26 Medium

us.codecraft.webmagic.selector.ReplaceSelector

Bug Category Details Line Priority
Exception thrown in class us.codecraft.webmagic.selector.ReplaceSelector at new us.codecraft.webmagic.selector.ReplaceSelector(String, String) will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks. BAD_PRACTICE CT_CONSTRUCTOR_THROW 28 Medium

us.codecraft.webmagic.utils.CharsetUtils

Bug Category Details Line Priority
Exception thrown in class us.codecraft.webmagic.utils.CharsetUtils at new us.codecraft.webmagic.utils.CharsetUtils() will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks. BAD_PRACTICE CT_CONSTRUCTOR_THROW 25 Medium

us.codecraft.webmagic.utils.FilePersistentBase

Bug Category Details Line Priority
us.codecraft.webmagic.utils.FilePersistentBase.PATH_SEPERATOR isn't final but should be refactored to be so MALICIOUS_CODE MS_SHOULD_BE_REFACTORED_TO_BE_FINAL 15 High
Exceptional return value of java.io.File.mkdirs() ignored in us.codecraft.webmagic.utils.FilePersistentBase.checkAndMakeParentDirecotry(String) BAD_PRACTICE RV_RETURN_VALUE_IGNORED_BAD_PRACTICE 42 Medium