SpotBugs Bug Detector Report

The following document contains the results of SpotBugs

SpotBugs Version is 4.2.3

Threshold is medium

Effort is default

Summary

Classes Bugs Errors Missing Classes
85 32 0 0

Files

Class Bugs
us.codecraft.webmagic.configurable.ExtractRule 2
us.codecraft.webmagic.downloader.PhantomJSDownloader 5
us.codecraft.webmagic.example.OschinaBlog 1
us.codecraft.webmagic.handler.PatternRequestMatcher 1
us.codecraft.webmagic.model.OOSpider 1
us.codecraft.webmagic.model.PageMapper 1
us.codecraft.webmagic.model.formatter.BasicTypeFormatter 1
us.codecraft.webmagic.model.formatter.DateFormatter 2
us.codecraft.webmagic.monitor.SpiderMonitor 2
us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener 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 6
us.codecraft.webmagic.scheduler.RedisPriorityScheduler 2
us.codecraft.webmagic.scheduler.RedisScheduler 2
us.codecraft.webmagic.utils.DoubleKeyMap 1

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 128 High
us.codecraft.webmagic.downloader.PhantomJSDownloader.getPage(Request) may fail to close stream BAD_PRACTICE OS_OPEN_STREAM 128 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 43 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 81 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 80 High

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.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.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.formatter.BasicTypeFormatter

Bug Category Details Line Priority
us.codecraft.webmagic.model.formatter.BasicTypeFormatter.basicTypeFormatters is a mutable collection which should be package protected MALICIOUS_CODE MS_MUTABLE_COLLECTION_PKGPROTECT 28 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.monitor.SpiderMonitor

Bug Category Details Line Priority
Unread field: us.codecraft.webmagic.monitor.SpiderMonitor.logger PERFORMANCE URF_UNREAD_FIELD 30 Medium
Unread field: us.codecraft.webmagic.monitor.SpiderMonitor.started PERFORMANCE URF_UNREAD_FIELD 28 Medium

us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener

Bug Category Details Line Priority
Should us.codecraft.webmagic.monitor.SpiderMonitor$MonitorSpiderListener be a _static_ inner class? PERFORMANCE SIC_INNER_SHOULD_BE_STATIC 79-107 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 120 High
Found reliance on default encoding in us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.readCursorFile(): new java.io.FileReader(String) I18N DM_DEFAULT_ENCODING 165 High
Found reliance on default encoding in us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.readUrlFile(): new java.io.FileReader(String) I18N DM_DEFAULT_ENCODING 146 High
Inconsistent synchronization of us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.fileCursorWriter; locked 66% of time MT_CORRECTNESS IS2_INCONSISTENT_SYNC 69 Medium
Inconsistent synchronization of us.codecraft.webmagic.scheduler.FileCacheQueueScheduler.queue; locked 60% of time MT_CORRECTNESS IS2_INCONSISTENT_SYNC 193 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 76 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

us.codecraft.webmagic.utils.DoubleKeyMap

Bug Category Details Line Priority
There is an apparent infinite recursive loop in us.codecraft.webmagic.utils.DoubleKeyMap.put(Object, Map) CORRECTNESS IL_INFINITE_RECURSIVE_LOOP 70 High