Commit Graph

269 Commits

Author SHA1 Message Date
Noah Levitt 803f9ca979 HER-1984 save script state - implement by adding a map to the application context for arbitrary use, and make sure the app context is available in all scripting environments
* PathSharingContext.java
    new member variable ConcurrentHashMap data and accessor getData()
* ScriptedProcessor.java, ScriptedDecideRule.java
    make appCtx available to scripts; also remove unused member sharedMap
* ActionDirectory.java
    formatting fix
2012-01-19 13:31:57 -08:00
Noah Levitt 55ec01c4e4 Fix for HER-1983 mangled dns records in w/arcs
* FetchDNS.java
    recordDNS() - use local variable for dummy read buffer, instead of member variable that was shared among threads, since RecordingInputStream.read() used the passed buffer as a work area
2012-01-11 14:38:57 -08:00
gojomo d3ea17baf5 [HER-1976] query-portion ignored when checking against robots.txt rules
(using only path)
(RobotsPolicyTest) added for case that failed pre-fix
(RobotsTxtTest) added case similar to problem (but was already OK at
RobotsTxt level)
(RobotsPolicy, *RobotsPolicy) rename method to reflect new behavior
2012-01-05 23:37:00 -08:00
gojomo 4829160c84 [HER-1981] H3: overlay setting of alternate queue-precedence (via
BaseQueuePrecedencePolicy.basePrecedence) doesn't stick
(CrawlURI) don't null overlayNames in processingCleanup
(WorkQueueFrontier) move queue precedence recalc to only in handleQueue,
not all (post-wake) reenqueues
2012-01-05 23:01:54 -08:00
Gordon Mohr 4ffb6865e1 [HER-1976] H3: query-portion ignored when checking against robots.txt rules (using only path)
* RobotsPolicy.java: use UURI.getPathQuery -- like H1 does
2011-12-22 19:04:19 -08:00
Noah Levitt dff143b301 HER-1964 record whois server ip address in warc
* FetchWhois.java
    fetch() - record server ip address in CrawlURI attributes list
* CoreAttributeConstants.java
    new string constant A_WHOIS_SERVER_IP, key for whois server ip address CrawlURI attribute
* WARCWriterProcessor.java
    writeWhoisRecords() - include warc header WARC-IP-Address
2011-11-01 16:57:22 -07:00
Noah Levitt 450a4c44c4 * CrawlURI.java markPrerequisite() - call setPrerequisite(true) on the prerequisite CrawlURI 2011-10-28 10:03:14 -07:00
nlevitt 5735839252 Post 3.1.0
* **/pom.xml
   switch version to "3.1.1-SNAPSHOT"
2011-10-21 19:00:37 +00:00
nlevitt 8c99fc947c Prep for 3.1.0 release
* **/pom.xml
    bump version-id to "3.1.0"
* README.txt
    refer to exactly 3.1.0 release notes
2011-10-21 17:08:04 +00:00
nlevitt b4e6f43052 Unset script engine variables after scripts complete, allowing memory to be freed up sooner - see also r7252
* ScriptResource.java, ActionDirectory.java, ScriptedDecideRule.java
2011-10-06 18:01:01 +00:00
nlevitt b898d55cea Certain invalid "Crawl-delay" values, e.g. "/", in robots.txt cause split() to return empty string, resulting in ArrayIndexOutOfBoundsException - reported by John Lekashman
* Robotstxt.java
    initializeFromReader() - catch ArrayIndexOutOfBoundsException and ignore -- matches existing handling of other invalid crawl-delay values (catch NumberFormatException and ignore)
2011-10-06 17:20:13 +00:00
nlevitt 747fbc0a0f Fix for HER-1954 bdb closed at crawl finish instead of teardown -- refactor crawl finish and teardown
* PathSharingContext.java
    start(), doStart(), stop(), doStop() - remove these overloaded methods, because the spring bug they were working around seems to be fixed, not seeing any problems with cyclical dependencies - might be this one https://jira.springsource.org/browse/SPR-7266
    doClose() - remove because superclass version seems to work fine (this method generally wasn't being called anyway, though it would be now with other changes in this checkin)
* CrawlJob.java
    refactor teardown to call close() on the ApplicationContext, which calls destroy() on any beans that implement DisposableBean - this is now the way to have beans do stuff at teardown
* CrawlController.java
    send FINISHED crawl state event after calling appCtx.stop() so that isFinished() can indicate ready-ness for teardown
* BdbModule.java
    move close() to teardown, i.e. implementation of DisposableBean.destroy(); remove shutdown hook and rely on teardown; related tweaks
* WorkQueueFrontier.java, CrawlerLoggerModule.java, BdbUriUniqFilter.java
    move close() to teardown
* CrawlMapper.java, AbstractFrontier.java, PreloadedUriPrecedencePolicy.java, FetchWhois.java, FetchHTTP.java, PersistLogProcessor.java, WriterPoolProcessor.java
    add comments about cleanup that maybe should wait until teardown
* UriUniqFilter.java
    remove incorrect(?) comment
2011-09-29 00:39:55 +00:00
nlevitt 12411395a8 * ScriptedProcessor.java
innerProcess() - unset engine variable "curi" after script completes, allowing its memory to be freed up sooner
2011-09-14 02:30:02 +00:00
nlevitt 5934e10073 Fix for HER-1939 ScriptedDecideRule: field sharedEngine non-transient and non-serializable.
* ScriptedDecideRule.java
    make field sharedEngine transient
2011-09-12 21:48:27 +00:00
nlevitt f20b3eee30 Fix HER-1935 Many calls to File.mkdirs() and other file/dir methods don't check the return value. Also fix bug where pointless empty directories were created in scratch dir.
* BasicProfileTest.java, SelfTestBase.java, CrawlControllerTest.java, PrecedenceLoader.java, MigrateH1to3Tool.java, CrawlerLoggerModule.java, StatisticsTracker.java, CheckpointUtils.java, BdbUriUniqFilter.java, ARCWriterProcessorTest.java, WARCWriterProcessorTest.java, PersistProcessor.java, WriterPoolProcessor.java, PrefixFinderTest.java, StoredQueueTest.java, FileUtilsTest.java, ObjectIdentityBdbManualCacheTest.java, ObjectIdentityBdbCacheTest.java, ObjectPlusFilesOutputStream.java, TestUtils.java, TmpDirTestCase.java, Engine.java
    Replace calls to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir). In these cases the calls were either already in a spot where the possible IOException would be handled appropriately, or the line was trivially moved into such a block.
* ActionDirectory.java, Engine.java
    replace calls to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir), and throw IllegalStateException on failure
* BdbModule.java
    setup() - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir) and add "throws IOException" - conveniently the place where this method is called was already in a try block that catches IOException
* Checkpoint.java
    generateFrom() - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir) and add "throws IOException"
* CheckpointService.java
    move call to Checkpoint.generateFrom() inside existing try block since it now can throw IOException
* Recorder.java
    ensure(File) - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir), and throw IllegalStateException on failure
    new Recorder(File,String,int,int) - call ensure() on the correct object, the containing directory; and remove redundant call to ensure()
2011-09-12 20:12:10 +00:00
nlevitt 24f4b715ec Various little cleanups including several discovered by Aaron using an automated tool.
* WorkQueueFrontier.java
   (HER-1925) avoid 2 possible null pointer dereferences
* CrawlController.java
    getState() - change declared return type from Object to State
* CrawlerLoggerModule.java
    (HER-1932) remove unused, unset field "reports"
* BdbCookieStorage.java
    elide pointless extra variable
* FetchHTTP.java, DownloadURLConnection.java, ProcessUtils.java
   (HER-1933) use Arrays.toString() for logged arrays
* CrawlServer.java
    - remove unused field robotstxtChecksum
    - updateRobots() - avoid reinventing existing utility class InstanceofPredicate
* ExternalGeoLookupInterface.java
    (HER-1938) extend Serializable, since ExternalGeoLocationDecideRule is declared Serializable and has a ExternalGeoLookupInterface field
* DecideRuleSequence.java
    (HER-1937) make field fileLogger transient
* PersistLogProcessor.java
    (HER-1924) remove field recoveryCheckpoint shadowing same field in superclass Processor
* ExtractorUniversal.java
    (HER-1920) use return value of potentialTLD.toLowerCase() as it appears was intended
* ARCWriterProcessor.java
    (HER-1928) avoid possible null pointer dereference
* S3URLConnection.java
    (HER-1933) set S3ServiceException as cause of rethrown IOException, and do not put stacktrace array in message
* ObjectIdentityMemCache.java
    (HER-1929) avoid possible null pointer dereference
* .classpath
    more source jar references, other cleanup
2011-09-12 02:12:44 +00:00
nlevitt cdb6fb3a9a * PersistProcessor.java
copyPersistEnv() - improve logging on history entries by marshalling them as json
2011-08-30 22:04:17 +00:00
nlevitt 28aa2ffede * **/pom.xml
improve formatting (no substantive changes at all -- try "svn diff -x -ub -c7232")
2011-08-05 17:46:57 +00:00
nlevitt 706869e586 Fix handling of server error on robots.txt - change to what appears to be the intended behavior
* DispositionProcessor.java
    innerProcess() - call server.updateRobots(curi) after special ignore-robots short-circuiting of retry cycle rather than before, so that updateRobots() deemed-not-found handling applies
* FetchHTTP.java
    call curi.setHttpMethod() right after creating the HttpMethod, instead of when processing the response; this is needed so that updateRobots() check of fetchType works properly (before this change, fetchType was "UNKNOWN" on server error)
* PreconditionEnforcer.java, CrawlServer.java
    fix typos
2011-08-02 23:28:20 +00:00
nlevitt 3cfc315de9 Fix bug reported by Travis where each url in action directory ".include" file is reported as "not canonicalized" in heritrix_out, and some end up crawled in spite of being considered included
* WorkQueueFrontier.java
    considerIncluded(CrawlURI) - call FrontierPreparer.prepare(CrawlURI) so that CrawlURI is canonicalized etc before being considered included (similar to what schedule() does)
* CrawlURI.java
    getCanonicalString(), getPolitenessDelay() - use logger instead of System.err
2011-08-02 01:07:11 +00:00
nlevitt dcbc259776 Fix HER-1917 failure to use good http authentication type if server supports any that heritrix doesn't - problem reported and fix suggested by Adam Wilmer
* HttpAuthenticationCredential.java
    populate() 
        +  http.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,
        +          Arrays.asList(AuthPolicy.DIGEST, AuthPolicy.BASIC));
2011-07-30 01:30:44 +00:00
nlevitt 26584d44d7 * ExtractorHTMLTest.java
testScriptTagWritingScriptType() - As of r7225, ExtractorJS finds a new url - avoid using a strategically placed space. (The fact that UriUtils.isLikelyUri() returns true for the string ");document.write(unescape(" is kind of crazy, but a separate issue)
2011-07-27 20:04:54 +00:00
nlevitt bda2fbebe4 Fix HER-1873 strings with spaces can confuse ExtractorJS
* ExtractorJS.java
    considerStrings() - backtrack to just ahead of previous closing quote to reconsider it as a possible opening quote
* ExtractorJSTest.java
    minimal test case
2011-07-27 18:56:37 +00:00
nlevitt b2307e7cf1 Fix HER-1914 cookie loading and saving does not work properly
* AbstractCookieStorage.java
    make cookiesLoadFile a ConfigFile and use obtainReader() so that the file is snapshotted into launch dir
    saveCookies() - include expiration date, so file format match the format it claims to use, and what loadCookies() expects 
    loadCookies() - handle expiration date field, and actually put each cookie in the cookie map
    refactor loadCookies() for use with Reader from ConfigFile.obtainReader()
    fix up javadocs some
2011-07-26 19:30:16 +00:00
nlevitt cb7a454d0c Post 3.1.0-RC1
* **/pom.xml
   switch version back to "3.1.0-SNAPSHOT"
2011-07-26 03:42:02 +00:00
nlevitt 347a25e417 Prep for 3.1.0-RC1 release
* pom.xml, */pom.xml
    bump version number to 3.1.0-RC1
2011-07-26 02:57:48 +00:00
nlevitt a103c5f05c * SurtPrefixedDecideRule.java
fix timing reading surts source to make sure launch dir is in place for snapshot
2011-07-25 22:52:15 +00:00
gojomo 269a763860 [HER-1912] Kryo-deserialization of Robotstxt can consume excess memory by creating multiple copies of RobotsDirective
* CrawlServer, Robotstxt
    move autoregister details to Robotstxt, RobotsDirectives
* RobotsDirectives
    use ReferenceFieldSerializer so that repeated instances of RobotsDirectives in same context are replaced with backrefs
* RobotstxtTest
    (from Kenji) unit test for instance multiplication
2011-07-22 06:46:39 +00:00
nlevitt e9d53ec487 HER-1791 - a different implementation
* IdenticalDigestDecideRule.java
    fix javadoc typo
* CoreAttributeConstants.java
    "history-good-to-store" is history
* RecrawlAttributeConstants.java
    new "write-tag" constant
* PersistProcessor.java
    remove defunct "history-good-to-store" logic; nadd new option onlyStoreIfWriteTagPresent, and update shouldStore() to respect that option
* WriterPoolProcessor.java
    remove defunct "history-good-to-store" logic; new method copyForwardWriteTagIfDupe(); override innerRejectProcess() to call copyForwardWriteTagIfDupe()
* ARCWriterProcessor.java, WARCWriterProcessor.java
    remove defunct "history-good-to-store" logic; add writeTag to history on write; call copyForwardWriteTagIfDupe() on skipIdenticalDigest
2011-07-18 20:22:48 +00:00
nlevitt f13b393dab * PersistLogProcessor.java
put default persist log path in launch directory
2011-07-16 00:44:13 +00:00
gojomo e819d197fe [HER-915] (contrib) add http proxy authentication
contributed by Adam Wilmer
* FetchHTTP.java
    properties, setup for http proxy user/password
* profile-crawler-beans.cxml
    commented-out example settings for proxy auth properties
2011-07-15 21:57:20 +00:00
nlevitt b90aa89e4b More on HER-1901 - fix build by refactoring launch dir initialization into PathSharingContext; refactor config path interpolation mostly into ConfigPathConfigurer; various tweaks
* ActionDirectory.java, CrawlerLoggerModule.java, StatisticsTracker.java, SurtPrefixedDecideRule.java, WriterPoolProcessor.java, profile-crawler-beans.cxml
    use camelcase ${launchId} 
* CheckpointService.java, JobResource.java
    rename getAvailableCheckpointDirectories() to findAvailableCheckpointDirectories() so that it's not treated as a bean property
* WriterPoolProcessor.java, WriterPoolSettingsData.java, WriterPoolMember.java
    rename getOutputDirs() to calcOutputDirs() so that it's not treated as a bean property
* ConfigPath.java
    let ConfigPathConfigurer to do interpolation of ${launchId}
* ConfigFile.java
    let ConfigPathConfigurer do the snapshotting of config file
* CrawlJob.java, PathSharingContext.java
    remove launchDir initialization out of CrawlJob into PathSharingContext
* ConfigPathConfigurer.java
    - remove special handling of WriterPoolProcessor store paths; instead, look in beans for ConfigPaths within Iterables
    - have each ConfigPath hold reference to this ConfigPathConfigurer to use for interpolating ${launchId} and snapshotting config files
2011-07-15 19:39:32 +00:00
gojomo 2e10d07da2 [HER-741] Make extractors interrogate for charset
* ExtractorHTML
    fix reflexive probe to look as many characters in (1000) as initially
2011-07-14 06:53:56 +00:00
gojomo be12d1e8f3 calmer logging (fewer alerts in job.log/alerts.log/heritrix_out.log)
* Recorder
    object to unsupported content-encodings when first set
* FetchHTTP
    note as annotation unsupported content-encodings
* Link
    not as annotation when base URI is used for absent via
* ExtractorHTML
    downgrade char-sequence reading problem (often a chunking problem) to WARNING from SEVERE
2011-07-14 06:35:07 +00:00
gojomo 6a3072ef46 more rapidly release refs for finished CrawlURIs
* UriProcessingFormatter, Preformatter, GenerationFileHandler
    improve preformat-outside-synchronized optimization so that the LogRecord/CrawlURI doesn't linger until next displaces it
* CrawlURI
    (processingCleanup) null more of last-processing-run collected values
2011-07-14 01:14:04 +00:00
nlevitt 4d966ae70b More on HER-1901 - support ${launch-id} interpolation on W/ARCWriterProcessor storePaths
* WriterPoolProcessor.java, ARCWriterProcessor.java, WARCWriterProcessor.java
    change type of storePaths to List<ConfigPath> and handle appropriately
* ConfigPathConfigurer.java
    fixupPaths() - old code did not touch WriterPoolProcessor storePaths, since they're deeply nested inside the bean, but they need to be remembered for later interpolation of ${launch-id}, so add special handling
2011-07-13 20:18:51 +00:00
nlevitt 4250e07de9 HER-1901 timestamped subdirectory for each launch
* HardLinker.java
    renamed FilesystemLinkMaker.java
* FilesystemLinkMaker.java
    add support for symbolic links
* CLibrary.java
    new method symlink()
* BdbModule.java
    use new class name FilesystemLinkMaker
* CrawlJob.java
    at crawl launch, create launch directory launch-{timestamp17}, copy cxml there, symlink "current" to launch dir, inform ConfigPaths
* ConfigPath.java
    interpolate ${launch-id} in configured paths
* ConfigFile.java
    obtainReader() - snapshot config files to launch dir when they are read
* ActionDirectory.java
    default doneDir now ${launch-id}/actions-done
    actOn() - symlink from old style done dir action/done to done files
* SurtPrefixedDecideRule.java
    default surtsDumpFile now ${launch-id}/surts.dump
    pathsFixedUp() - this gets called at build time, but we don't want anything written to disk until launch time, so remove call to dumpSurtPrefixSet() here
* CrawlerLoggerModule.java
    default logs dir now ${launch-id}/logs
* StatisticsTracker.java 
    default reports dir now ${launch-id}/reports
* WriterPoolProcessor.java
    default writer base path now ${launch-id} 
* profile-crawler-beans.cxml
    update to reflect new default paths under launch dirs
* PropertyUtils.java
    fix javadoc typo
2011-07-13 19:18:55 +00:00
gojomo a8682ff1ff * TextSeedModule
(actOn) use ArchiveUtils.getBufferedReader so that seeds-files via action directory may optionally be gzipped (indicated by .gz suffix)
2011-07-09 02:13:52 +00:00
gojomo a41809b8a7 [HER-1908] H3: upgrade to Spring 3
* pom.xml, .classpath
    update references to necessary spring-3.0.5 packages
* SeedModule
    merge rather than replace event listeners, so that (now later) autowiring doesn't clobber the self-insertion done by anonymous (non-top-level) SurtPrefixedDecideRule bean
* HeritrixLifecycleProcessor, PathScharingContext
    use this new non-default LifecycleProcessor to avoid new Spring3 behavior of auto-start()ing context on refresh(build)
* CrawlController
    example of using @Value annotation to set default value: will offer benefits for auto-discovery of defaults for configuration interface, or enforcing maximally-explicit configurations (see [HER-1897])
* profile-crawler-beans.cxml, selftest-crawler-beans.cxml
    update templates with spring3 preamble/boilerplate
2011-07-08 04:31:54 +00:00
gojomo 39091dc82c Fix tests
* TextSeedModule
    remove unintended @Required annotation
2011-06-22 23:09:43 +00:00
gojomo 842f495ee9 [HER-1905] H3: allow crawling to begin while large seed list still loading
* TextSeedModule
    refactor announceSeeds to occur in background thread if non-default blockAwaitingSeedLines value is set
    signal CountDownLatch on each line, allowing calling thread to proceed at right count
* profile-crawler-beans.cxml
    commented-out blockAwaitingSeedLines default settings (-1, meaning wait for all seed lines)
2011-06-22 21:21:26 +00:00
gojomo c4636f38ec [HER-741] Make extractors interrogate for charset
* FetchHTTP
    use Charset-instances rather than String names
2011-06-04 00:25:23 +00:00
gojomo 2043d1801a [HER-741] Make extractors interrogate for charset
* ReplayCharSequence, GenericReplayCharSequence
    use Charset instance rather than String-name
* Recorder
    use Charset instance ratehr than String-name
    (getContentReplayCharSequence) avoid reusing cached ReplayCharSequence when encoding-in-use has changed since it was created
    (getContentReplayPrefixString) allow requested specific charset-interpretation
* ExtractorHTML, ExtractorXML
    work with Charset instances
    double-check that in-content-declarations are self-consistent before using
    recycle matcher instances
    change minor charset problems/decisions to a crawl.log annotation
2011-06-03 21:28:03 +00:00
gojomo 572aa83d39 * CrawlURI
make extraInfo declarations adjacent
    utility test for charset-declared-in-contentType
2011-06-03 21:17:32 +00:00
gojomo 292b30af1b remove unnecessary Serializable interface 2011-05-28 00:02:38 +00:00
gojomo 083e75e30a * CrawlServer.java
autoregister ConcurrentSkipListSet
2011-05-28 00:02:10 +00:00
nlevitt 728951d1ff Fix for HER-1791 - heritrix writes revisit record whether or not previous fetch
was archived
* CoreAttributeConstants.java
    new flag A_HISTORY_GOOD_TO_STORE w/ javadoc
* WriterPoolProcessor.java
    shouldWrite() - set A_HISTORY_GOOD_TO_STORE on CrawlURI if we decide to skip writing because of previous fetch with identical digest
* WARCWriterProcessor.java
    write() - set A_HISTORY_GOOD_TO_STORE on CrawlURI on successful write to warc
* PersistProcessor.java
    shouldStore() - change to return true if A_HISTORY_GOOD_TO_STORE is set on the CrawlURI
2011-05-26 16:44:53 +00:00
nlevitt 2d267cf173 HER-843 - crawl.log record of which ARC a capture landed in
* WARCWriterProcessor.java
    write() - on success, add arcFilename to CrawlURI extraInfo
2011-05-25 22:23:53 +00:00
nlevitt 5e1571f8dd HER-1790 - record warc where url was saved in crawl.log
* CrawlURI.java
    new field JSONObject extraInfo, methods getExtraInfo() and addExtraInfo()
* WARCWriterProcessor.java
    write() - on success, add warcFilename to CrawlURI extraInfo
* CrawlerLoggerModule.java
    new config option logExtraInfo, default false 
* UriProcessingFormatter.java
    new field logExtraInfo
    format() - include CrawlURI extraInfo if logExtraInfo is enabled
               also include "-" if CrawlURI has no annotations, since this is no longer the last field on the line
* profile-crawler-beans.cxml
    <!-- <property name="logExtraInfo" value="false" /> -->
* NonFatalErrorFormatter.java, RuntimeErrorFormatter.java
    new constructor to handle logExtraInfo since these subclass UriProcessingFormatter
2011-05-25 22:11:18 +00:00
nlevitt e70f0f8a50 Fix HER-1889 should recover from problems unescaping javascript in ExtractorJS
* ExtractorJS.java
    considerStrings() - catch exceptions from
    StringEscapeUtils.unescapeJavaScript(), log warning, and proceed
2011-05-20 00:05:09 +00:00