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
101 52 0 0

Files

Class Bugs
us.codecraft.webmagic.configurable.ConfigurablePageProcessor 1
us.codecraft.webmagic.configurable.ExtractRule 2
us.codecraft.webmagic.downloader.PhantomJSDownloader 5
us.codecraft.webmagic.example.GithubRepo 1
us.codecraft.webmagic.example.GithubRepoApi 1
us.codecraft.webmagic.example.OschinaBlog 2
us.codecraft.webmagic.handler.PatternRequestMatcher 1
us.codecraft.webmagic.model.FieldExtractor 4
us.codecraft.webmagic.model.OOSpider 1
us.codecraft.webmagic.model.PageMapper 1
us.codecraft.webmagic.model.fields.MultipleField 2
us.codecraft.webmagic.model.formatter.BasicTypeFormatter 2
us.codecraft.webmagic.model.formatter.DateFormatter 2
us.codecraft.webmagic.model.formatter.ObjectFormatterBuilder 1
us.codecraft.webmagic.model.formatter.ObjectFormatters 1
us.codecraft.webmagic.monitor.SpiderMonitor 1
us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener 4
us.codecraft.webmagic.monitor.SpiderStatus 1
us.codecraft.webmagic.pipeline.CollectorPageModelPipeline 1
us.codecraft.webmagic.pipeline.FilePageModelPipeline 1
us.codecraft.webmagic.pipeline.JsonFilePageModelPipeline 1
us.codecraft.webmagic.pipeline.JsonFilePipeline 1
us.codecraft.webmagic.pipeline.MultiPagePipeline 1
us.codecraft.webmagic.scheduler.FileCacheQueueScheduler 7
us.codecraft.webmagic.scheduler.RedisPriorityScheduler 2
us.codecraft.webmagic.scheduler.RedisScheduler 3
us.codecraft.webmagic.utils.DoubleKeyMap 2

us.codecraft.webmagic.configurable.ConfigurablePageProcessor

Bug Category Details Line Priority
new us.codecraft.webmagic.configurable.ConfigurablePageProcessor(Site, List) may expose internal representation by storing an externally mutable object into ConfigurablePageProcessor.extractRules MALICIOUS_CODE EI_EXPOSE_REP2 22 Medium

us.codecraft.webmagic.configurable.ExtractRule

Bug Category Details Line Priority
us.codecraft.webmagic.configurable.ExtractRule.getExpressionParams() may expose internal representation by returning ExtractRule.expressionParams MALICIOUS_CODE EI_EXPOSE_REP 52 Medium
us.codecraft.webmagic.configurable.ExtractRule.setExpressionParams(String[]) may expose internal representation by storing an externally mutable object into ExtractRule.expressionParams MALICIOUS_CODE EI_EXPOSE_REP2 56 Medium

us.codecraft.webmagic.downloader.PhantomJSDownloader

Bug Category Details Line Priority
Found reliance on default encoding in us.codecraft.webmagic.downloader.PhantomJSDownloader.getPage(Request): new java.io.InputStreamReader(InputStream) I18N DM_DEFAULT_ENCODING 119 High
us.codecraft.webmagic.downloader.PhantomJSDownloader.getPage(Request) may fail to close stream BAD_PRACTICE OS_OPEN_STREAM 119 Medium
Write to static field us.codecraft.webmagic.downloader.PhantomJSDownloader.phantomJsCommand from instance method new us.codecraft.webmagic.downloader.PhantomJSDownloader(String) STYLE ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD 39 High
Write to static field us.codecraft.webmagic.downloader.PhantomJSDownloader.crawlJsPath from instance method new us.codecraft.webmagic.downloader.PhantomJSDownloader(String, String) STYLE ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD 77 High
Write to static field us.codecraft.webmagic.downloader.PhantomJSDownloader.phantomJsCommand from instance method new us.codecraft.webmagic.downloader.PhantomJSDownloader(String, String) STYLE ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD 76 High

us.codecraft.webmagic.example.GithubRepo

Bug Category Details Line Priority
us.codecraft.webmagic.example.GithubRepo.getLanguage() may expose internal representation by returning GithubRepo.language MALICIOUS_CODE EI_EXPOSE_REP 67 Medium

us.codecraft.webmagic.example.GithubRepoApi

Bug Category Details Line Priority
us.codecraft.webmagic.example.GithubRepoApi.getLanguage() may expose internal representation by returning GithubRepoApi.language MALICIOUS_CODE EI_EXPOSE_REP 56 Medium

us.codecraft.webmagic.example.OschinaBlog

Bug Category Details Line Priority
us.codecraft.webmagic.example.OschinaBlog.getDate() may expose internal representation by returning OschinaBlog.date MALICIOUS_CODE EI_EXPOSE_REP 51 Medium
us.codecraft.webmagic.example.OschinaBlog.getTags() may expose internal representation by returning OschinaBlog.tags MALICIOUS_CODE EI_EXPOSE_REP 47 Medium

us.codecraft.webmagic.handler.PatternRequestMatcher

Bug Category Details Line Priority
Unread public/protected field: us.codecraft.webmagic.handler.PatternRequestMatcher.pattern STYLE URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD 29 Medium

us.codecraft.webmagic.model.FieldExtractor

Bug Category Details Line Priority
us.codecraft.webmagic.model.FieldExtractor.getField() may expose internal representation by returning FieldExtractor.field MALICIOUS_CODE EI_EXPOSE_REP 20 Medium
us.codecraft.webmagic.model.FieldExtractor.getSetterMethod() may expose internal representation by returning FieldExtractor.setterMethod MALICIOUS_CODE EI_EXPOSE_REP 23 Medium
new us.codecraft.webmagic.model.FieldExtractor(Field, Selector, Source, boolean, boolean) may expose internal representation by storing an externally mutable object into FieldExtractor.field MALICIOUS_CODE EI_EXPOSE_REP2 31 Medium
us.codecraft.webmagic.model.FieldExtractor.setSetterMethod(Method) may expose internal representation by storing an externally mutable object into FieldExtractor.setterMethod MALICIOUS_CODE EI_EXPOSE_REP2 23 Medium

us.codecraft.webmagic.model.OOSpider

Bug Category Details Line Priority
Unused field: us.codecraft.webmagic.model.OOSpider.pageModelPipeline PERFORMANCE UUF_UNUSED_FIELD Not available Medium

us.codecraft.webmagic.model.PageMapper

Bug Category Details Line Priority
Unread field: us.codecraft.webmagic.model.PageMapper.clazz PERFORMANCE URF_UNREAD_FIELD 18 Medium

us.codecraft.webmagic.model.fields.MultipleField

Bug Category Details Line Priority
us.codecraft.webmagic.model.fields.MultipleField.getFieldNames() may expose internal representation by returning MultipleField.fieldNames MALICIOUS_CODE EI_EXPOSE_REP 14 Medium
new us.codecraft.webmagic.model.fields.MultipleField(List) may expose internal representation by storing an externally mutable object into MultipleField.fieldNames MALICIOUS_CODE EI_EXPOSE_REP2 18 Medium

us.codecraft.webmagic.model.formatter.BasicTypeFormatter

Bug Category Details Line Priority
us.codecraft.webmagic.model.formatter.BasicTypeFormatter.basicClassDetector is a mutable collection which should be package protected MALICIOUS_CODE MS_MUTABLE_COLLECTION_PKGPROTECT 30 Medium
us.codecraft.webmagic.model.formatter.BasicTypeFormatter.basicTypeFormatters is a mutable collection which should be package protected MALICIOUS_CODE MS_MUTABLE_COLLECTION_PKGPROTECT 27 Medium

us.codecraft.webmagic.model.formatter.DateFormatter

Bug Category Details Line Priority
us.codecraft.webmagic.model.formatter.DateFormatter.initParam(String[]) may expose internal representation by storing an externally mutable object into DateFormatter.datePatterns MALICIOUS_CODE EI_EXPOSE_REP2 29 Medium
us.codecraft.webmagic.model.formatter.DateFormatter.DEFAULT_PATTERN should be package protected MALICIOUS_CODE MS_PKGPROTECT 13 Medium

us.codecraft.webmagic.model.formatter.ObjectFormatterBuilder

Bug Category Details Line Priority
us.codecraft.webmagic.model.formatter.ObjectFormatterBuilder.setField(Field) may expose internal representation by storing an externally mutable object into ObjectFormatterBuilder.field MALICIOUS_CODE EI_EXPOSE_REP2 18 Medium

us.codecraft.webmagic.model.formatter.ObjectFormatters

Bug Category Details Line Priority
Public method us.codecraft.webmagic.model.formatter.ObjectFormatters.put(Class) uses reflection to create a class it gets in its parameter which could increase the accessibility of any class MALICIOUS_CODE REFLC_REFLECTION_MAY_INCREASE_ACCESSIBILITY_OF_CLASS 23 Medium

us.codecraft.webmagic.monitor.SpiderMonitor

Bug Category Details Line Priority
Class (us.codecraft.webmagic.monitor.SpiderMonitor) using singleton design pattern has non-private constructor. CORRECTNESS SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR 38-41 Medium

us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener

Bug Category Details Line Priority
us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener.getErrorCount() may expose internal representation by returning SpiderMonitor$MonitorSpiderListener.errorCount MALICIOUS_CODE EI_EXPOSE_REP 103 Medium
us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener.getErrorUrls() may expose internal representation by returning SpiderMonitor$MonitorSpiderListener.errorUrls MALICIOUS_CODE EI_EXPOSE_REP 107 Medium
us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener.getSuccessCount() may expose internal representation by returning SpiderMonitor$MonitorSpiderListener.successCount MALICIOUS_CODE EI_EXPOSE_REP 99 Medium
Should us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener be a _static_ inner class? PERFORMANCE SIC_INNER_SHOULD_BE_STATIC 79-107 Medium

us.codecraft.webmagic.monitor.SpiderStatus

Bug Category Details Line Priority
new us.codecraft.webmagic.monitor.SpiderStatus(Spider, SpiderMonitor$MonitorSpiderListener) may expose internal representation by storing an externally mutable object into SpiderStatus.spider MALICIOUS_CODE EI_EXPOSE_REP2 24 Medium

us.codecraft.webmagic.pipeline.CollectorPageModelPipeline

Bug Category Details Line Priority
us.codecraft.webmagic.pipeline.CollectorPageModelPipeline.getCollected() may expose internal representation by returning CollectorPageModelPipeline.collected MALICIOUS_CODE EI_EXPOSE_REP 21 Medium

us.codecraft.webmagic.pipeline.FilePageModelPipeline

Bug Category Details Line Priority
Found reliance on default encoding in us.codecraft.webmagic.pipeline.FilePageModelPipeline.process(Object, Task): new java.io.FileWriter(File) I18N DM_DEFAULT_ENCODING 48 High

us.codecraft.webmagic.pipeline.JsonFilePageModelPipeline

Bug Category Details Line Priority
Found reliance on default encoding in us.codecraft.webmagic.pipeline.JsonFilePageModelPipeline.process(Object, Task): new java.io.FileWriter(File) I18N DM_DEFAULT_ENCODING 49 High

us.codecraft.webmagic.pipeline.JsonFilePipeline

Bug Category Details Line Priority
Found reliance on default encoding in us.codecraft.webmagic.pipeline.JsonFilePipeline.process(ResultItems, Task): new java.io.FileWriter(File) I18N DM_DEFAULT_ENCODING 40 High

us.codecraft.webmagic.pipeline.MultiPagePipeline

Bug Category Details Line Priority
Adding elements of an entry set may fail due to reuse of Map.Entry object in us.codecraft.webmagic.pipeline.MultiPagePipeline.handleObject(Iterator) BAD_PRACTICE DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS 70 Medium

us.codecraft.webmagic.scheduler.FileCacheQueueScheduler

Bug Category Details Line Priority
Found reliance on default encoding in us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.initWriter(): new java.io.FileWriter(String, boolean) I18N DM_DEFAULT_ENCODING 79 High
Found reliance on default encoding in us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.readCursorFile(): new java.io.FileReader(String) I18N DM_DEFAULT_ENCODING 117 High
Found reliance on default encoding in us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.readUrlFile(): new java.io.FileReader(String) I18N DM_DEFAULT_ENCODING 101 High
Inconsistent synchronization of us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.fileCursorWriter; locked 66% of time MT_CORRECTNESS IS2_INCONSISTENT_SYNC 51 Medium
Inconsistent synchronization of us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.queue; locked 60% of time MT_CORRECTNESS IS2_INCONSISTENT_SYNC 148 Medium
Load of known null value in us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.readCursorFile() STYLE NP_LOAD_OF_KNOWN_NULL_VALUE 128 Medium
Exceptional return value of java.io.File.mkdirs() ignored in us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.init(Task) BAD_PRACTICE RV_RETURN_VALUE_IGNORED_BAD_PRACTICE 58 Medium

us.codecraft.webmagic.scheduler.RedisPriorityScheduler

Bug Category Details Line Priority
Found reliance on default encoding in us.codecraft.webmagic.scheduler.RedisPriorityScheduler.getExtrasInItem(Jedis, String, Task): new String(byte[]) I18N DM_DEFAULT_ENCODING 117 High
Found reliance on default encoding in us.codecraft.webmagic.scheduler.RedisPriorityScheduler.getExtrasInItem(Jedis, String, Task): String.getBytes() I18N DM_DEFAULT_ENCODING 115 High

us.codecraft.webmagic.scheduler.RedisScheduler

Bug Category Details Line Priority
Found reliance on default encoding in us.codecraft.webmagic.scheduler.RedisScheduler.poll(Task): new String(byte[]) I18N DM_DEFAULT_ENCODING 108 High
Found reliance on default encoding in us.codecraft.webmagic.scheduler.RedisScheduler.poll(Task): String.getBytes() I18N DM_DEFAULT_ENCODING 106 High
new us.codecraft.webmagic.scheduler.RedisScheduler(JedisPool) may expose internal representation by storing an externally mutable object into RedisScheduler.pool MALICIOUS_CODE EI_EXPOSE_REP2 36 Medium

us.codecraft.webmagic.utils.DoubleKeyMap

Bug Category Details Line Priority
new us.codecraft.webmagic.utils.DoubleKeyMap(Map, Class) may expose internal representation by storing an externally mutable object into DoubleKeyMap.map MALICIOUS_CODE EI_EXPOSE_REP2 39 Medium
There is an apparent infinite recursive loop in us.codecraft.webmagic.utils.DoubleKeyMap.put(Object, Map) CORRECTNESS IL_INFINITE_RECURSIVE_LOOP 70 High