Commit Graph

448 Commits

Author SHA1 Message Date
Gary Russell
86c7e36667 Sonar issues - complexity
* Fix checkstyle issue.
2019-05-03 20:05:16 -04:00
Gary Russell
6d7bc1fc39 Sonar: repeated literals
* Polishing - PR Comments

* GatewayParser: Restore suppress warnings; remove size from `toArray()`.

* Merge conflict resolution
2019-05-03 12:39:02 -04:00
Gary Russell
0d6faa2e34 Sonar - protected fields 2019-05-01 17:28:42 -04:00
Gary Russell
36c33bb5ab Sonar fixes
- a few complexities
- final method calls from ctor
- raw exception throwing
- useless overrides
- loss of stack trace
2019-04-29 18:20:40 -04:00
Artem Bilan
d21e8f0349 URL Cleanup
This commit updates URLs to prefer the https protocol.
Redirects are not followed to avoid accidentally expanding intentionally
shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status.
While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 2638 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-21 19:22:26 -04:00
Artem Bilan
20e8f0af2f Fix HTTP urls to HTTPS
* Do not fix urls for the `http://apache.org/xml/features` when we
configure XML components
* Do not fix urls for localhost and fake links in tests
* Fix all the dead links in docs
2019-03-21 17:16:30 -04:00
Spring Operator
fd30d1b48b URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://foo.com (301) with 1 occurrences could not be migrated:
   ([https](https://foo.com) result SSLHandshakeException).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* http://diveintomark.org/ (302) with 1 occurrences migrated to:
  /ZKSXZ/ ([https](https://diveintomark.org/) result IllegalArgumentException).
* http://foo.bar.com (UnknownHostException) with 1 occurrences migrated to:
  https://foo.bar.com ([https](https://foo.bar.com) result UnknownHostException).
* http://site1.com,http://site2.com (UnknownHostException) with 1 occurrences migrated to:
  https://site1.com,http://site2.com ([https](https://site1.com,https://site2.com) result UnknownHostException).
* http://example.org/2005/04/02/atom (404) with 1 occurrences migrated to:
  https://example.org/2005/04/02/atom ([https](https://example.org/2005/04/02/atom) result 404).
* http://example.org/audio/ph34r_my_podcast.mp3 (404) with 1 occurrences migrated to:
  https://example.org/audio/ph34r_my_podcast.mp3 ([https](https://example.org/audio/ph34r_my_podcast.mp3) result 404).
* http://example.org/feed.atom (404) with 1 occurrences migrated to:
  https://example.org/feed.atom ([https](https://example.org/feed.atom) result 404).
* http://www.puppycrawl.com/dtds/configuration_1_2.dtd (404) with 1 occurrences migrated to:
  https://www.puppycrawl.com/dtds/configuration_1_2.dtd ([https](https://www.puppycrawl.com/dtds/configuration_1_2.dtd) result 404).
* http://www.puppycrawl.com/dtds/suppressions_1_1.dtd (404) with 1 occurrences migrated to:
  https://www.puppycrawl.com/dtds/suppressions_1_1.dtd ([https](https://www.puppycrawl.com/dtds/suppressions_1_1.dtd) result 404).
* http://www.springframework.org/schema/integration/jsr223/spring-integration-jsr223.xsd (404) with 1 occurrences migrated to:
  https://www.springframework.org/schema/integration/jsr223/spring-integration-jsr223.xsd ([https](https://www.springframework.org/schema/integration/jsr223/spring-integration-jsr223.xsd) result 404).
* http://www.springframework.org/schema/integration/spring-integration-ws.xsd (404) with 1 occurrences migrated to:
  https://www.springframework.org/schema/integration/spring-integration-ws.xsd ([https](https://www.springframework.org/schema/integration/spring-integration-ws.xsd) result 404).
* http://www.springframework.org/schema/integration/webflux/spring-integration-webflux.xsd (404) with 4 occurrences migrated to:
  https://www.springframework.org/schema/integration/webflux/spring-integration-webflux.xsd ([https](https://www.springframework.org/schema/integration/webflux/spring-integration-webflux.xsd) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://example.org with 22 occurrences migrated to:
  https://example.org ([https](https://example.org) result 200).
* http://example.org/ with 2 occurrences migrated to:
  https://example.org/ ([https](https://example.org/) result 200).
* http://feeds.bbci.co.uk/news/rss.xml with 1 occurrences migrated to:
  https://feeds.bbci.co.uk/news/rss.xml ([https](https://feeds.bbci.co.uk/news/rss.xml) result 200).
* http://www.example.com/ with 1 occurrences migrated to:
  https://www.example.com/ ([https](https://www.example.com/) result 200).
* http://www.springframework.org/schema/aop/spring-aop.xsd with 12 occurrences migrated to:
  https://www.springframework.org/schema/aop/spring-aop.xsd ([https](https://www.springframework.org/schema/aop/spring-aop.xsd) result 200).
* http://www.springframework.org/schema/beans/spring-beans.xsd with 813 occurrences migrated to:
  https://www.springframework.org/schema/beans/spring-beans.xsd ([https](https://www.springframework.org/schema/beans/spring-beans.xsd) result 200).
* http://www.springframework.org/schema/context/spring-context.xsd with 122 occurrences migrated to:
  https://www.springframework.org/schema/context/spring-context.xsd ([https](https://www.springframework.org/schema/context/spring-context.xsd) result 200).
* http://www.springframework.org/schema/data/jpa/spring-jpa.xsd with 2 occurrences migrated to:
  https://www.springframework.org/schema/data/jpa/spring-jpa.xsd ([https](https://www.springframework.org/schema/data/jpa/spring-jpa.xsd) result 200).
* http://www.springframework.org/schema/data/mongo/spring-mongo.xsd with 18 occurrences migrated to:
  https://www.springframework.org/schema/data/mongo/spring-mongo.xsd ([https](https://www.springframework.org/schema/data/mongo/spring-mongo.xsd) result 200).
* http://www.springframework.org/schema/geode/spring-geode.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/geode/spring-geode.xsd ([https](https://www.springframework.org/schema/geode/spring-geode.xsd) result 200).
* http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd with 14 occurrences migrated to:
  https://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd ([https](https://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd) result 200).
* http://www.springframework.org/schema/integration/event/spring-integration-event.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/integration/event/spring-integration-event.xsd ([https](https://www.springframework.org/schema/integration/event/spring-integration-event.xsd) result 200).
* http://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd ([https](https://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd) result 200).
* http://www.springframework.org/schema/integration/file/spring-integration-file.xsd with 27 occurrences migrated to:
  https://www.springframework.org/schema/integration/file/spring-integration-file.xsd ([https](https://www.springframework.org/schema/integration/file/spring-integration-file.xsd) result 200).
* http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd with 15 occurrences migrated to:
  https://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd ([https](https://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd) result 200).
* http://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd with 6 occurrences migrated to:
  https://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd ([https](https://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd) result 200).
* http://www.springframework.org/schema/integration/groovy/spring-integration-groovy.xsd with 11 occurrences migrated to:
  https://www.springframework.org/schema/integration/groovy/spring-integration-groovy.xsd ([https](https://www.springframework.org/schema/integration/groovy/spring-integration-groovy.xsd) result 200).
* http://www.springframework.org/schema/integration/http/spring-integration-http.xsd with 18 occurrences migrated to:
  https://www.springframework.org/schema/integration/http/spring-integration-http.xsd ([https](https://www.springframework.org/schema/integration/http/spring-integration-http.xsd) result 200).
* http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd with 27 occurrences migrated to:
  https://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd ([https](https://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd) result 200).
* http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd with 47 occurrences migrated to:
  https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd ([https](https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd) result 200).
* http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd with 93 occurrences migrated to:
  https://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd ([https](https://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd) result 200).
* http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd with 32 occurrences migrated to:
  https://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd ([https](https://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd) result 200).
* http://www.springframework.org/schema/integration/jpa/spring-integration-jpa.xsd with 11 occurrences migrated to:
  https://www.springframework.org/schema/integration/jpa/spring-integration-jpa.xsd ([https](https://www.springframework.org/schema/integration/jpa/spring-integration-jpa.xsd) result 200).
* http://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd with 18 occurrences migrated to:
  https://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd ([https](https://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd) result 200).
* http://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb.xsd with 17 occurrences migrated to:
  https://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb.xsd ([https](https://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb.xsd) result 200).
* http://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt.xsd ([https](https://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt.xsd) result 200).
* http://www.springframework.org/schema/integration/redis/spring-integration-redis.xsd with 17 occurrences migrated to:
  https://www.springframework.org/schema/integration/redis/spring-integration-redis.xsd ([https](https://www.springframework.org/schema/integration/redis/spring-integration-redis.xsd) result 200).
* http://www.springframework.org/schema/integration/rmi/spring-integration-rmi.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/integration/rmi/spring-integration-rmi.xsd ([https](https://www.springframework.org/schema/integration/rmi/spring-integration-rmi.xsd) result 200).
* http://www.springframework.org/schema/integration/scripting/spring-integration-scripting.xsd with 14 occurrences migrated to:
  https://www.springframework.org/schema/integration/scripting/spring-integration-scripting.xsd ([https](https://www.springframework.org/schema/integration/scripting/spring-integration-scripting.xsd) result 200).
* http://www.springframework.org/schema/integration/security/spring-integration-security.xsd with 3 occurrences migrated to:
  https://www.springframework.org/schema/integration/security/spring-integration-security.xsd ([https](https://www.springframework.org/schema/integration/security/spring-integration-security.xsd) result 200).
* http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd with 18 occurrences migrated to:
  https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd ([https](https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd) result 200).
* http://www.springframework.org/schema/integration/spring-integration.xsd with 731 occurrences migrated to:
  https://www.springframework.org/schema/integration/spring-integration.xsd ([https](https://www.springframework.org/schema/integration/spring-integration.xsd) result 200).
* http://www.springframework.org/schema/integration/stomp/spring-integration-stomp.xsd with 1 occurrences migrated to:
  https://www.springframework.org/schema/integration/stomp/spring-integration-stomp.xsd ([https](https://www.springframework.org/schema/integration/stomp/spring-integration-stomp.xsd) result 200).
* http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd with 17 occurrences migrated to:
  https://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd ([https](https://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd) result 200).
* http://www.springframework.org/schema/integration/syslog/spring-integration-syslog.xsd with 5 occurrences migrated to:
  https://www.springframework.org/schema/integration/syslog/spring-integration-syslog.xsd ([https](https://www.springframework.org/schema/integration/syslog/spring-integration-syslog.xsd) result 200).
* http://www.springframework.org/schema/integration/websocket/spring-integration-websocket.xsd with 1 occurrences migrated to:
  https://www.springframework.org/schema/integration/websocket/spring-integration-websocket.xsd ([https](https://www.springframework.org/schema/integration/websocket/spring-integration-websocket.xsd) result 200).
* http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd with 10 occurrences migrated to:
  https://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd ([https](https://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd) result 200).
* http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd with 12 occurrences migrated to:
  https://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd ([https](https://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd) result 200).
* http://www.springframework.org/schema/integration/xmpp/spring-integration-xmpp.xsd with 14 occurrences migrated to:
  https://www.springframework.org/schema/integration/xmpp/spring-integration-xmpp.xsd ([https](https://www.springframework.org/schema/integration/xmpp/spring-integration-xmpp.xsd) result 200).
* http://www.springframework.org/schema/integration/zookeeper/spring-integration-zookeeper.xsd with 1 occurrences migrated to:
  https://www.springframework.org/schema/integration/zookeeper/spring-integration-zookeeper.xsd ([https](https://www.springframework.org/schema/integration/zookeeper/spring-integration-zookeeper.xsd) result 200).
* http://www.springframework.org/schema/jdbc/spring-jdbc.xsd with 52 occurrences migrated to:
  https://www.springframework.org/schema/jdbc/spring-jdbc.xsd ([https](https://www.springframework.org/schema/jdbc/spring-jdbc.xsd) result 200).
* http://www.springframework.org/schema/jms/spring-jms.xsd with 7 occurrences migrated to:
  https://www.springframework.org/schema/jms/spring-jms.xsd ([https](https://www.springframework.org/schema/jms/spring-jms.xsd) result 200).
* http://www.springframework.org/schema/lang/spring-lang.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/lang/spring-lang.xsd ([https](https://www.springframework.org/schema/lang/spring-lang.xsd) result 200).
* http://www.springframework.org/schema/mvc/spring-mvc.xsd with 1 occurrences migrated to:
  https://www.springframework.org/schema/mvc/spring-mvc.xsd ([https](https://www.springframework.org/schema/mvc/spring-mvc.xsd) result 200).
* http://www.springframework.org/schema/rabbit/spring-rabbit.xsd with 9 occurrences migrated to:
  https://www.springframework.org/schema/rabbit/spring-rabbit.xsd ([https](https://www.springframework.org/schema/rabbit/spring-rabbit.xsd) result 200).
* http://www.springframework.org/schema/security/spring-security.xsd with 2 occurrences migrated to:
  https://www.springframework.org/schema/security/spring-security.xsd ([https](https://www.springframework.org/schema/security/spring-security.xsd) result 200).
* http://www.springframework.org/schema/task/spring-task.xsd with 44 occurrences migrated to:
  https://www.springframework.org/schema/task/spring-task.xsd ([https](https://www.springframework.org/schema/task/spring-task.xsd) result 200).
* http://www.springframework.org/schema/tool/spring-tool.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/tool/spring-tool.xsd ([https](https://www.springframework.org/schema/tool/spring-tool.xsd) result 200).
* http://www.springframework.org/schema/tx/spring-tx.xsd with 14 occurrences migrated to:
  https://www.springframework.org/schema/tx/spring-tx.xsd ([https](https://www.springframework.org/schema/tx/spring-tx.xsd) result 200).
* http://www.springframework.org/schema/util/spring-util.xsd with 92 occurrences migrated to:
  https://www.springframework.org/schema/util/spring-util.xsd ([https](https://www.springframework.org/schema/util/spring-util.xsd) result 200).
* http://www.springframework.org/schema/websocket/spring-websocket.xsd with 1 occurrences migrated to:
  https://www.springframework.org/schema/websocket/spring-websocket.xsd ([https](https://www.springframework.org/schema/websocket/spring-websocket.xsd) result 200).
* http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd with 1 occurrences migrated to:
  https://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ([https](https://java.sun.com/xml/ns/persistence/persistence_2_0.xsd) result 302).

# Ignored
These URLs were intentionally ignored.

* http://java.sun.com/xml/ns/persistence with 2 occurrences
* http://localhost with 1 occurrences
* http://localhost/ with 1 occurrences
* http://localhost/test1 with 25 occurrences
* http://localhost/test1/%2f with 1 occurrences
* http://localhost/test2 with 2 occurrences
* http://localhost/test2/ with 1 occurrences
* http://localhost:18080/it/ with 3 occurrences
* http://localhost:51235/%2f/testApps?param= with 1 occurrences
* http://test with 1 occurrences
* http://test.example.org with 1 occurrences
* http://test.org with 1 occurrences
* http://testServer/test with 1 occurrences
* http://testServer/testmp with 1 occurrences
* http://www.springframework.org/schema/aop with 25 occurrences
* http://www.springframework.org/schema/beans with 1633 occurrences
* http://www.springframework.org/schema/c with 1 occurrences
* http://www.springframework.org/schema/context with 244 occurrences
* http://www.springframework.org/schema/data/jpa with 3 occurrences
* http://www.springframework.org/schema/data/mongo with 36 occurrences
* http://www.springframework.org/schema/geode with 8 occurrences
* http://www.springframework.org/schema/integration with 1465 occurrences
* http://www.springframework.org/schema/integration/amqp with 28 occurrences
* http://www.springframework.org/schema/integration/event with 8 occurrences
* http://www.springframework.org/schema/integration/feed with 8 occurrences
* http://www.springframework.org/schema/integration/file with 54 occurrences
* http://www.springframework.org/schema/integration/ftp with 30 occurrences
* http://www.springframework.org/schema/integration/gemfire with 12 occurrences
* http://www.springframework.org/schema/integration/groovy with 27 occurrences
* http://www.springframework.org/schema/integration/http with 36 occurrences
* http://www.springframework.org/schema/integration/ip with 54 occurrences
* http://www.springframework.org/schema/integration/jdbc with 94 occurrences
* http://www.springframework.org/schema/integration/jms with 186 occurrences
* http://www.springframework.org/schema/integration/jmx with 64 occurrences
* http://www.springframework.org/schema/integration/jpa with 22 occurrences
* http://www.springframework.org/schema/integration/jsr223 with 2 occurrences
* http://www.springframework.org/schema/integration/mail with 36 occurrences
* http://www.springframework.org/schema/integration/mongodb with 34 occurrences
* http://www.springframework.org/schema/integration/mqtt with 8 occurrences
* http://www.springframework.org/schema/integration/redis with 34 occurrences
* http://www.springframework.org/schema/integration/rmi with 8 occurrences
* http://www.springframework.org/schema/integration/scripting with 28 occurrences
* http://www.springframework.org/schema/integration/security with 6 occurrences
* http://www.springframework.org/schema/integration/sftp with 36 occurrences
* http://www.springframework.org/schema/integration/stomp with 2 occurrences
* http://www.springframework.org/schema/integration/stream with 34 occurrences
* http://www.springframework.org/schema/integration/syslog with 10 occurrences
* http://www.springframework.org/schema/integration/webflux with 8 occurrences
* http://www.springframework.org/schema/integration/websocket with 2 occurrences
* http://www.springframework.org/schema/integration/ws with 22 occurrences
* http://www.springframework.org/schema/integration/xml with 24 occurrences
* http://www.springframework.org/schema/integration/xmpp with 28 occurrences
* http://www.springframework.org/schema/integration/zookeeper with 2 occurrences
* http://www.springframework.org/schema/jdbc with 104 occurrences
* http://www.springframework.org/schema/jms with 13 occurrences
* http://www.springframework.org/schema/lang with 8 occurrences
* http://www.springframework.org/schema/mvc with 2 occurrences
* http://www.springframework.org/schema/p with 19 occurrences
* http://www.springframework.org/schema/rabbit with 18 occurrences
* http://www.springframework.org/schema/security with 4 occurrences
* http://www.springframework.org/schema/task with 88 occurrences
* http://www.springframework.org/schema/tool with 8 occurrences
* http://www.springframework.org/schema/tx with 28 occurrences
* http://www.springframework.org/schema/util with 184 occurrences
* http://www.springframework.org/schema/websocket with 2 occurrences
* http://www.w3.org/1999/xhtml with 1 occurrences
* http://www.w3.org/2001/XMLSchema with 1 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 814 occurrences
* http://www.w3.org/2005/Atom with 1 occurrences

* Use the latest Checkstyle DTDs with their HTTPS variants
2019-03-20 10:39:37 -04:00
Artem Bilan
8380346821 GH-2820: Close session in FtpRemFileTempl.exists
Fixes: https://github.com/spring-projects/spring-integration/issues/2820

The current `FtpRemoteFileTemplate.exists()` implementation obtains a
`Session` for the `NLST_AND_DIRS` mode, but doesn't close it.

* Fix the `FtpRemoteFileTemplate.exists()` method to delegate to `super`
for the proper interaction with a `Session`

**Cherry-pick to 5.1.x, 5.0.x & 4.3.x**
2019-03-19 11:16:04 -04:00
Gary Russell
b187bca36e Avoid throws Exception where possible - Phase I
* Polishing - PR Comments
2019-03-07 12:53:52 -05:00
Gary Russell
931df86274 GH-2777: Remote File Filter Improvements
Resolves https://github.com/spring-projects/spring-integration/issues/2777

If the filter supports it, defer filtering until the last possible moment.
Then, the worst case scenario after a catastrophic failure (e.g. power loss),
would be that at most one file will be incorrectly filtered on restart.

Polishing and add more tests.

Polishing Javadocs

More Polishing

Final polishing

More polishing.

Polishing and docPolishing and docs.

* Fix typos in Docs
2019-03-05 17:49:56 -05:00
Gary Russell
a167290f9b GH-2776: Fix Streaming Remote File MessageSource
Fixes https://github.com/spring-projects/spring-integration/issues/2776
Also see https://github.com/spring-projects/spring-integration/issues/2777

- reset the filter for the current file if the fetch fails
- implement `Lifecycle` and clear the `toBeReceived` queue and corresponding
  filter entries

* Polishing - PR Comments **cherry-pick to all supported**

* Polishing
2019-03-01 14:35:31 -05:00
Gary Russell
23843c789b Avoid Race in FtpStreamingMessageSourceTests
See https://github.com/spring-projects/spring-integration/issues/2776
2019-03-01 11:14:12 -05:00
Artem Bilan
3657d05596 Defer Messaging annotations process (#2769)
* Defer Messaging annotations process

The `AbstractMethodAnnotationPostProcessor` and its implementations
have a `beanFactory.getBean()` call for the `@Bean` methods with
Messaging annotations.
This is done, actually, from the
`MessagingAnnotationPostProcessor.postProcessAfterInitialization()`
which might be still too early in some scenarios, like Spring Cloud Feign
with its child application contexts being initialized from the
`FeignClientFactoryBean`, causing a `BeanCurrentlyInCreationException`

See https://stackoverflow.com/questions/54887963/beancurrentlyincreationexception-when-using-spring-integration-with-spring-cloud

* Implement a `SmartInitializingSingleton` for the `MessagingAnnotationPostProcessor`
and gather `Runnable` wrappers for newly introduced `postProcessMethodAndRegisterEndpointIfAny()`
to be called later in the `afterSingletonsInstantiated()` when context is
still in the initialization phase.
All runtime-registered beans are going to be processed normally from the
regular `postProcessAfterInitialization()`

**Cherry-pick to 5.1.x**

* * Fix unused imports in the `MessagingAnnotationsWithBeanAnnotationTests`

* * Fix `IntegrationEndpointsInitializer` in the testing framework to handle
all the possible `AbstractEndpoint` beans registration.
See its JavaDocs for more info
* Fix `AbstractCorrelatingMessageHandlerParser` and
`AbstractConsumerEndpointParser` to use bean names for `outputChannel`
and `discardChannel` instead of bean references.
Since `MessagingAnnotationPostProcessor` now registers endpoints and
beans for channels much later, than parsers, we can't rely on bean
references any more there.
* Fixes for failing tests which expected `outputChannel/discardChannel`
bean references, when it is already just their names for late binding.
* Apply some code style polishing for the affected classes.
* Add `@Nullable` for `MessageSelector` parameter in the `QueueChannel.purge()`
2019-03-01 10:26:05 -05:00
Artem Bilan
d2e974a6de Fix new Sonar smells (#2768)
* Fix new Sonar smells

* Fix some old Sonar smells as well
* Fix Micrometer leaks in the `PollableChannel` when we register
meters, but don't remove them.

* * Fix NPE around `MetricsCaptor` in channels

* * Fix new smells according test report

* * Further Sonar smell fixes

* * More smell fixes for `MessagingMethodInvokerHelper`
* Remove `throws Exception` from `AbstractMessageHandler.destroy()`

* * Fix complexity in the `MessagingMethodInvokerHelper.processInvokeExceptionAndFallbackToExpressionIfAny()`
2019-02-27 15:17:51 -05:00
Artem Bilan
7e3b56939e Fix XSDs for actual core schema version 2019-02-21 12:43:21 -05:00
Artem Bilan
622d42c71a Migrate tests to AssertJ
Mostly thanks to IDEA's plugin: https://plugins.jetbrains.com/plugin/10345-assertions2assertj
There is still a lot of work to do when complex and composite matchers are used.

* Add `awaitility` dependency and deprecate `EventuallyMatcher` in favor
of `awaitility`
* Remove Hamcrest from dependencies and disable JUnit & Hamcrest
static imports to encourage to use only AssertJ
* Migrate JUnit assumptions in rules to AssertJ's assumptions
* Deprecate some custom matchers in favor of existing in Hamcrest
after upgrading the last to version `2.1`
* Replace `ExpectedException` rules with `assertThatThrownBy()`
* Mention `MessagePredicate` in the `testing.adoc`
2019-02-21 10:20:45 -05:00
Gary Russell
520ebbbd2c Move master to 5.2 2019-02-15 12:01:24 -05:00
Artem Bilan
a609bd9398 Some file module Sonar fixes (#2718)
* Some file module Sonar fixes

* * Fixes after testing

* * Some further Sonar fixes for file module

* * Further Sonar fixes for file module

* * More Sonar fixes for file module

* * Fix `RemoteFileTemplate` issues

* * Fix new sonar smells after previous one

* * Review feedback
2019-01-25 14:37:57 -05:00
Gary Russell
4ea3b1c23c GH-2705: public CTORs on AMFPFileListFilter Impls
Fixes https://github.com/spring-projects/spring-integration/issues/2705
2019-01-18 11:12:38 -05:00
Gary Russell
e40cfe101e Sonar fixes
Hidden fields, `o.s.i.a*` through `o.s.i.j*`.
2019-01-09 10:02:19 -05:00
Gary Russell
e8df546b04 Sonar Fixes - Javadoc-only imports 2019-01-02 12:26:22 -05:00
Gary Russell
62fc7df693 Sonar Fixes
Critical smells, packages `o.s.i.a*` to `f*`.

Plus new smells caused by these changes.
2018-12-03 10:44:26 -05:00
Artem Bilan
76c670075b Fix RotatingServersTests concurrency
https://build.spring.io/browse/INT-FATS5IC-685/

Even if we stop `SourcePollingChannelAdapter`, the task on the fly is
still going to be executed.
This way we may have extra calls to our logic.

* Use `CopyOnWriteArrayList` for the `sessionSources` to avoid
`ConcurrentModificationException` during this collection read in the
tests

**Cherry-pick to 5.0.x**
2018-11-07 10:42:00 -05:00
Gary Russell
12bc24dd02 File, FTP, IP Sonar Fixes 2018-10-26 13:53:54 -04:00
Gary Russell
bd7a3bc4ed GH-2605: (S)FTP test cached sessions
Resolves https://github.com/spring-projects/spring-integration/issues/2605

* Suppress unused field warning.

* Fix typos.

* Use lstat() - don't follow symbolic lincs
2018-10-23 13:59:00 -04:00
Artem Bilan
27353ed393 Add Reactive mode for AbstractPollingEndpoint (#2429)
* Add Reactive mode for AbstractPollingEndpoint

* When `SourcePollingChannelAdapter.outputChannel` is a
`ReactiveStreamsSubscribableChannel`, use `Flux.generate()` for polling
* Refactor `AbstractPollingEndpoint` to remove redundant `Poller` class
in favor of lambda
* Extract `pollForMessage()` method to handle TX states instead of
`Poller` class previously

* * Rebase and fix conflicts

* Polishing for GatewayProxyFactoryBeanTests
2018-09-14 10:05:00 -04:00
Artem Bilan
21338d1934 Fix RotatingServersTests race condition
https://build.spring.io/browse/INT-MASTERSPRING40-458/

We need to stop Inbound Channel Adapter first and only then wait for
the latch.
Otherwise there is a chance that new item is added to the collection
in between `latch.await()` and `stop()`

**Cherry-pick to 5.0.x**
2018-09-08 17:44:17 -04:00
Artem Bilan
adbbca13fb INT-4513: Clean IntManageConf from removed beans
JIRA: https://jira.spring.io/browse/INT-4513

The `IntegrationManagementConfigurer` keeps metrics beans in its local
stores.
When we add beans at runtime, they are not removed from those caches
after their removal

* Implement `DestructionAwareBeanPostProcessor` in the `IntegrationManagementConfigurer`
and clean up caches according provided bean type and its name
* Improve `ManualFlowTests` and `FtpTests` to be sure that
`IntegrationManagementConfigurer` caches are cleared after destroying
 `IntegrationFlowRegistration`

**Cherry-pick to 5.0.x**
2018-07-27 13:32:08 -04:00
Gary Russell
d61cd790fe Upgrade to Gradle 4.9; fix RotatingServersTests
Stop the flow before examining the stream to avoid `ConcurrentModificationException`.

**cherry-pick to 5.0.x**
2018-07-25 14:01:38 -04:00
Artem Bilan
0d0605be78 INT-4381: MessageSources refactoring (#2517)
* INT-4381: MessageSources refactoring

JIRA: https://jira.spring.io/browse/INT-4381

* Make all the out-of-the-box `MessageSource` implementations based
on the `AbstractMessageSource`
* Fix `JdbcPollingChannelAdapterIntegrationTests` for sporadic failure
because of `fixed-rate` for the poller

* Fix HeaderEnricherTests race condition

The `errorChannel()` expect an error in the `testErrorChannel` after
`1000` ms, but at the same time the `poller` in configured for the
`3000` ms.

* Increase all the timeouts for replies
* Decrease a `fixed-delay` on the `poller`
* Some other code style polishing for the `HeaderEnricherTests`
2018-07-25 13:01:22 -04:00
Gary Russell
d6c8baf50f INT-4505: Fix package tangle
JIRA: https://jira.spring.io/browse/INT-4505
2018-07-24 16:30:10 -04:00
Gary Russell
11d39b7da1 INT-4496: (S)FTP: Sort file list earlier
JIRA: https://jira.spring.io/browse/INT-4496

Sort the file list before applying `maxFetchSize` and filters.

* Polishing - PR Comments
2018-07-02 16:49:23 -04:00
Artem Bilan
6ecd948a32 Close file resource after (S)FTP streaming tests
Windows is too scrupulous for non closed file resources.
Our `RemoteFileTestSupport` recreates a test directory with files
for each test.
When we don't close some file handler, we are not able to delete the
directory and we fail with subsequent tests.

* Close `InputStream` for each polled file in new tests in the
`SftpStreamingMessageSourceTests`

* Close `CLOSEABLE_RESOURCE` in new tests in the
`FtpStreamingMessageSourceTests`
* Rework `FtpStreamingMessageSourceTests.testAllContents()` do not
poll all the files on each polling cycle - this causes a race condition
when we don't close `CLOSEABLE_RESOURCE` yet in the `StreamTransformer`,
but try to proceed with recreation a test directory structure

**Cherry-pick to 5.0.x**
2018-06-29 21:28:28 -04:00
Gary Russell
3f218a97a0 INT-4495: (S)FTP: fix max-fetch with directories
JIRA: https://jira.spring.io/browse/INT-4495

Previously, `maxFetch` was applied before directories were removed from
the fetch list.

Remove the directories before filtering and applying `maxFetch`.

* Polishing - PR Comments

* More polishing

* More polishing.

* Check for empty array.

* Remove test main method.
2018-06-29 14:21:06 -04:00
Artem Bilan
e83b472a37 RotatingSTests: Don't delete files between polls
On Windows `File.delete()` causes to file to be modified first of all.
with the high polling interval (`fixedDelay(1)`) there is a chance
to pick the same file from the local directory again, since the
`AbstractPersistentAcceptOnceFileListFilter` is based on the `lastModified`

* Do not delete files manually at all - just rely on the `clean()`
with the `@Before`

**Cherry-pick to 5.0.x**
2018-06-27 16:32:55 -04:00
Gary Russell
26cfab579c INT-4491: (S)FTP inbound rotate dirs/servers
JIRA: https://jira.spring.io/browse/INT-4491

Add Rotating Server/Directory Polling Advice.

**cherry-pick to 5.0.x**

* Polishing - PR Comments.

* Polishing

* Polishing; revert `KeyDirectory`; WARN about `TaskExecutor` and `MessageSoureMutator`(s).

* More polishing - PR comments

* Apply stashed changes.

* Fix WARN log - the `SyncTaskExecutor` is wrapped.
2018-06-27 13:43:41 -04:00
Gary Russell
52c5b822df INT-4422: Fix FTP Pool tests 2018-05-10 15:43:34 -04:00
Artem Bilan
027021d6e4 Move XSDs to version 5.1
* Upgrade to Spring AMQP-2.1 and fix compatibility
2018-03-17 09:58:40 -04:00
Gary Russell
82f252dd00 INT-4390: Fix tangles
JIRA: https://jira.spring.io/browse/INT-4390

Phase I: flow context/registration cycle

- extract interfaces
- rename implementations to `Standard...`

Phase II - dsl<->dsl.channel tangles

Move the channel specs to dsl.

Fix missing refactorings

(Not related to DSL) - rename core `event` package to `events`

- avoid collision with event module package
- fix tangle caused by `MessageGroupExpiredEvent`.

Phase III - dsl<->config.dsl

- move classes from config.dsl to dsl

(Not related to DSL) - fix many tangles caused by graph being a sub-package of support.management
 - make `graph` a top-level package

(Not related to DSL) - move `IntegrationManagementConfigurer` from
`management` to `config` - tangle between core and management
* Polishing Copyrights, diamonds, some JavaDocs and What's New
2018-03-16 14:59:47 -04:00
Artem Bilan
e46fc9b738 INT-4407: Add merge option to Log4j2LevelAdjuster
JIRA: https://jira.spring.io/browse/INT-4407

To make a `Log4j2LevelAdjuster` more builder friendly, add a `merge`
option to the overloaded `classes()` and `categories()` methods.
This way the existing (or previously configured) `categories` and
`classes` are merged with the provided values and default
`org.springframework.integration` category can be reuse.

Note: this behavior can be reconsidered as default one in the `5.1`
2018-02-20 15:05:46 -05:00
Gary Russell
8aa91d1db0 Shutdown test executors in -core
- don't use `ExecutorService` as `@Bean` - spring can't stop them
- also add log adjuster for ftp test that sometimes fails
2018-01-19 10:21:55 -05:00
Gary Russell
1bb4f86151 Minor Fixes
- use passive mode for FTP tests
(active fails on one of my machines for some reason)

* Fix generic args instead of `@SuppressWarnings("rawtypes")`
2018-01-16 16:37:50 -05:00
Artem Bilan
30450c48be INT-4376: Upgage to Log4J 2 (#2321)
* INT-4376: Upgage to Log4J 2

JIRA: https://jira.spring.io/browse/INT-4376

* Deprecate Log4J 1.x components in favor of newly added
a `Log4j2LevelAdjuster` JUnit `@Rule`
* Update all the logging configuration to Log4J 2

* Polishing after testing
2018-01-11 10:59:55 -05:00
Artem Bilan
077b5ffffc INT-4344: AbstRemoteFileOutGw: Add assert for NPE
JIRA: https://jira.spring.io/browse/INT-4344

The `FtpOutboundGateway` provides ctors without expression for remote path.
In this case it is treated as a `working directory` but only for the
`LS`, `NLST`, `PUT` and `MPUT` commands.

* Add assertion in the `AbstractRemoteFileOutboundGateway` to discard
configuration for all other commands when `expression` is `null`

**Cherry-pick to 4.3.x**
2017-10-16 17:04:22 -04:00
Artem Bilan
bf63ef5491 GH-2253: Revert (S)FTP Source to DefaultDirScann
Fixes spring-projects/spring-integration#2253

For backward compatibility and use-cases when processed files are stored
in sub-directories in the `localDirectory` revert the
`AbstractInboundFileSynchronizingMessageSource` logic back to the
`DefaultDirectoryScanner`.
The `RecursiveDirectoryScanner` can be injected via `scanner` option
2017-10-16 16:05:44 -04:00
Venil Noronha
797e5045bf INT-4334: Adds a DirectoryScanner to RemoteFileMS
JIRA: https://jira.springsource.org/browse/INT-4334

* Add a `DirectoryScanner` setter named `setScanner` in
`AbstractInboundFileSynchronizingMessageSource` to set the
`FileReadingMessageSource`'s scanner.
* Add tests to `AbstractRemoteFileSynchronizerTests`.

Polish.

Updates xsd, tests and documentation.

Fix xsd formatting.

Addresses review comments.

* Some code style polishing
2017-09-25 21:08:51 -04:00
Artem Bilan
72bd4e5bcf INT-4305: (S)FTP: Remove Local File Before Rename
JIRA: https://jira.spring.io/browse/INT-4305

The `File.renameTo()` operation may fail, therefore the content of the
local file isn't changed, but since we change `setLastModified()` anyway,
this file might be eligible for local polling.
So, we end up with the same content from local file in a new message,
meanwhile we expect a new content from the remote file

* Check the `File.renameTo()` result and attempt to `delete()`
for existing local file
* When file isn't renames remove the remote file from the `filter` to let
it be transferred one more time on the next poll.
The local file might be opened for processing, so this way we postpone a fresh
remote file for the future poll rounds
* Modify `copyFileToLocalDirectory()` to return `boolean` to reflect the fact of copy.
This way we check the real number of transferred files

**Cherry-pick to 4.3.x**

Do not transfer remote file if we can't remove local one

Polishing Log Messages
2017-06-27 16:45:15 -04:00
Gary Russell
36ac9f2203 (S)FTP MaxFetchSize Doc Polishing and DSL
Also polish programming tips and tricks docs.

* Fix typos in docs
2017-06-27 15:45:40 -04:00
Gary Russell
5216dc2b02 INT-4304 (S)FTP Outbound Gateway Delete After GET
JIRA: https://jira.spring.io/browse/INT-4304

Add an option to delete remote file(s) after GET/MGET.

Polishing - log error on delete failure.
2017-06-26 14:30:08 -04:00
Gary Russell
0903df9676 INT-4303: (S)FTP MGET with FileExistsMode.IGNORE
JIRA: https://jira.spring.io/browse/INT-4303

Don't emit ignored files in the output message payload.

Also, always preserve the timestamp when using `FileExistsMode.REPLACE_IF_MODIFIED`.

Some code style polishing
2017-06-23 14:02:03 -04:00