Apache Solr open-source search software
SOLR-15942: Upgrade Hadoop to 3.3.1
Kevin Risden534cad870b8c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 665df994887..66489752d3b 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -598,6 +598,8 @@ and each individual module's jar will be included in its directory's lib/ folder* SOLR-15943: Simplify HDFS cache to account for LUCENE-10366 / LUCENE-10376 (Kevin Risden)+* SOLR-15942: Upgrade Hadoop to 3.3.1 (Kevin Risden)+Bug Fixes---------------------* SOLR-15849: Fix the connection reset problem caused by the incorrect use of 4LW with \n when monitoring zooKeeper status (Fa Ming).diff --git a/solr/licenses/commons-configuration2-2.1.1.jar.sha1 b/solr/licenses/commons-configuration2-2.1.1.jar.sha1deleted file mode 100644index 7cdc3d23702..00000000000--- a/solr/licenses/commons-configuration2-2.1.1.jar.sha1+++ /dev/null@@ -1 +0,0 @@-d97d5b3f8b58c52730d47e1a63c8d3258f41ca6cdiff --git a/solr/licenses/commons-configuration2-2.7.jar.sha1 b/solr/licenses/commons-configuration2-2.7.jar.sha1new file mode 100644index 00000000000..aad467115c7--- /dev/null+++ b/solr/licenses/commons-configuration2-2.7.jar.sha1@@ -0,0 +1 @@+593326399e5fb5e1f986607f06f63c1250ab36b4diff --git a/solr/licenses/commons-lang3-3.12.0.jar.sha1 b/solr/licenses/commons-lang3-3.12.0.jar.sha1new file mode 100644index 00000000000..8846a21387e--- /dev/null+++ b/solr/licenses/commons-lang3-3.12.0.jar.sha1@@ -0,0 +1 @@+c6842c86792ff03b9f1d1fe2aab8dc23aa6c6f0ediff --git a/solr/licenses/commons-lang3-3.9.jar.sha1 b/solr/licenses/commons-lang3-3.9.jar.sha1deleted file mode 100644index 7875e4380d2..00000000000--- a/solr/licenses/commons-lang3-3.9.jar.sha1+++ /dev/null@@ -1 +0,0 @@-0122c7cee69b53ed4a7681c03d4ee4c0e2765da5diff --git a/solr/licenses/commons-text-1.6.jar.sha1 b/solr/licenses/commons-text-1.6.jar.sha1deleted file mode 100644index 84b2ef1f14f..00000000000--- a/solr/licenses/commons-text-1.6.jar.sha1+++ /dev/null@@ -1 +0,0 @@-ba72cf0c40cf701e972fe7720ae844629f4ecca2diff --git a/solr/licenses/commons-text-1.8.jar.sha1 b/solr/licenses/commons-text-1.8.jar.sha1new file mode 100644index 00000000000..8fea1467925--- /dev/null+++ b/solr/licenses/commons-text-1.8.jar.sha1@@ -0,0 +1 @@+879a6bde4c0537a25504c72ec7a94ba4099f469cdiff --git a/solr/licenses/curator-client-2.13.0.jar.sha1 b/solr/licenses/curator-client-2.13.0.jar.sha1deleted file mode 100644index f44216a57d4..00000000000--- a/solr/licenses/curator-client-2.13.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-a1974d9b3251c055408059b2f408d19d7db07224diff --git a/solr/licenses/curator-client-4.3.0.jar.sha1 b/solr/licenses/curator-client-4.3.0.jar.sha1new file mode 100644index 00000000000..c8c057968ae--- /dev/null+++ b/solr/licenses/curator-client-4.3.0.jar.sha1@@ -0,0 +1 @@+3eacfe1f700d66e73b5eb9313af0945042327186diff --git a/solr/licenses/curator-framework-2.13.0.jar.sha1 b/solr/licenses/curator-framework-2.13.0.jar.sha1deleted file mode 100644index 930e5462dc0..00000000000--- a/solr/licenses/curator-framework-2.13.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-d45229aee7d3f1f628a34fcac9b66ed5ba52c31fdiff --git a/solr/licenses/curator-framework-4.3.0.jar.sha1 b/solr/licenses/curator-framework-4.3.0.jar.sha1new file mode 100644index 00000000000..9a6a844271d--- /dev/null+++ b/solr/licenses/curator-framework-4.3.0.jar.sha1@@ -0,0 +1 @@+7a05a339688b5e2f0db4416cb19bc340b68abdc9diff --git a/solr/licenses/curator-recipes-2.13.0.jar.sha1 b/solr/licenses/curator-recipes-2.13.0.jar.sha1deleted file mode 100644index 19c936df271..00000000000--- a/solr/licenses/curator-recipes-2.13.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-1e6d5cf7b18a402f5d52785877010711538d68a0diff --git a/solr/licenses/curator-recipes-4.3.0.jar.sha1 b/solr/licenses/curator-recipes-4.3.0.jar.sha1new file mode 100644index 00000000000..dc098a6dd00--- /dev/null+++ b/solr/licenses/curator-recipes-4.3.0.jar.sha1@@ -0,0 +1 @@+df60350024ccf98bdd9299b3e3c079aab5845d1fdiff --git a/solr/licenses/guava-25.1-jre.jar.sha1 b/solr/licenses/guava-25.1-jre.jar.sha1deleted file mode 100644index 8ee9ae964a8..00000000000--- a/solr/licenses/guava-25.1-jre.jar.sha1+++ /dev/null@@ -1 +0,0 @@-6c57e4b22b44e89e548b5c9f70f0c45fe10fb0b4diff --git a/solr/licenses/guava-27.0.1-jre.jar.sha1 b/solr/licenses/guava-27.0.1-jre.jar.sha1new file mode 100644index 00000000000..d3d307d4423--- /dev/null+++ b/solr/licenses/guava-27.0.1-jre.jar.sha1@@ -0,0 +1 @@+bd41a290787b5301e63929676d792c507bbc00aediff --git a/solr/licenses/hadoop-annotations-3.2.0.jar.sha1 b/solr/licenses/hadoop-annotations-3.2.0.jar.sha1deleted file mode 100644index c1ae3ba9629..00000000000--- a/solr/licenses/hadoop-annotations-3.2.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-275df2b5942c554ae3f3adf8483e81f5aec5ebc7diff --git a/solr/licenses/hadoop-annotations-3.3.1.jar.sha1 b/solr/licenses/hadoop-annotations-3.3.1.jar.sha1new file mode 100644index 00000000000..2fc67fe2910--- /dev/null+++ b/solr/licenses/hadoop-annotations-3.3.1.jar.sha1@@ -0,0 +1 @@+6d70d2a8682f650f0dd6e66945448a2e2222a44adiff --git a/solr/licenses/hadoop-auth-3.2.0.jar.sha1 b/solr/licenses/hadoop-auth-3.2.0.jar.sha1deleted file mode 100644index b737a8d2e89..00000000000--- a/solr/licenses/hadoop-auth-3.2.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-b1b95aed9aa956ffb7d21e30a0415ca14d91c4addiff --git a/solr/licenses/hadoop-auth-3.3.1.jar.sha1 b/solr/licenses/hadoop-auth-3.3.1.jar.sha1new file mode 100644index 00000000000..c3bcba36e05--- /dev/null+++ b/solr/licenses/hadoop-auth-3.3.1.jar.sha1@@ -0,0 +1 @@+862a3da7b7c75cca2e0ffe48f1f449d0897245dediff --git a/solr/licenses/hadoop-client-api-3.3.1.jar.sha1 b/solr/licenses/hadoop-client-api-3.3.1.jar.sha1new file mode 100644index 00000000000..26531add82d--- /dev/null+++ b/solr/licenses/hadoop-client-api-3.3.1.jar.sha1@@ -0,0 +1 @@+4b9c9cdd9967495838fb521001699c4c9dddf183diff --git a/solr/licenses/hadoop-hdfs-client-LICENSE-ASL.txt b/solr/licenses/hadoop-client-api-LICENSE-ASL.txtsimilarity index 100%rename from solr/licenses/hadoop-hdfs-client-LICENSE-ASL.txtrename to solr/licenses/hadoop-client-api-LICENSE-ASL.txtdiff --git a/solr/licenses/hadoop-hdfs-client-NOTICE.txt b/solr/licenses/hadoop-client-api-NOTICE.txtsimilarity index 100%rename from solr/licenses/hadoop-hdfs-client-NOTICE.txtrename to solr/licenses/hadoop-client-api-NOTICE.txtdiff --git a/solr/licenses/hadoop-client-minicluster-3.3.1.jar.sha1 b/solr/licenses/hadoop-client-minicluster-3.3.1.jar.sha1new file mode 100644index 00000000000..e487160785d--- /dev/null+++ b/solr/licenses/hadoop-client-minicluster-3.3.1.jar.sha1@@ -0,0 +1 @@+545968c946585792b3d5bb4ed379a7c114fc7051diff --git a/solr/licenses/hadoop-client-minicluster-LICENSE-ASL.txt b/solr/licenses/hadoop-client-minicluster-LICENSE-ASL.txtnew file mode 100644index 00000000000..9a8e847ee84--- /dev/null+++ b/solr/licenses/hadoop-client-minicluster-LICENSE-ASL.txt@@ -0,0 +1,244 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+++APACHE HADOOP SUBCOMPONENTS:++The Apache Hadoop project contains subcomponents with separate copyright+notices and license terms. Your use of the source code for the these+subcomponents is subject to the terms and conditions of the following+licenses.++For the org.apache.hadoop.util.bloom.* classes:++/**+ *+ * Copyright (c) 2005, European Commission project OneLab under contract+ * 034819 (http://www.one-lab.org)+ * All rights reserved.+ * Redistribution and use in source and binary forms, with or+ * without modification, are permitted provided that the following+ * conditions are met:+ * - Redistributions of source code must retain the above copyright+ * notice, this list of conditions and the following disclaimer.+ * - Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the following disclaimer in+ * the documentation and/or other materials provided with the distribution.+ * - Neither the name of the University Catholique de Louvain - UCL+ * nor the names of its contributors may be used to endorse or+ * promote products derived from this software without specific prior+ * written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ * POSSIBILITY OF SUCH DAMAGE.+ */\ No newline at end of filediff --git a/solr/licenses/hadoop-client-minicluster-NOTICE.txt b/solr/licenses/hadoop-client-minicluster-NOTICE.txtnew file mode 100644index 00000000000..c56a5e4eac1--- /dev/null+++ b/solr/licenses/hadoop-client-minicluster-NOTICE.txt@@ -0,0 +1,2 @@+This product includes software developed by The Apache Software+Foundation (http://www.apache.org/).\ No newline at end of filediff --git a/solr/licenses/hadoop-client-runtime-3.3.1.jar.sha1 b/solr/licenses/hadoop-client-runtime-3.3.1.jar.sha1new file mode 100644index 00000000000..58dbafa0fa0--- /dev/null+++ b/solr/licenses/hadoop-client-runtime-3.3.1.jar.sha1@@ -0,0 +1 @@+f3a55d882328ee87a1054f99d62ba987fa9029a4diff --git a/solr/licenses/hadoop-client-runtime-LICENSE-ASL.txt b/solr/licenses/hadoop-client-runtime-LICENSE-ASL.txtnew file mode 100644index 00000000000..9a8e847ee84--- /dev/null+++ b/solr/licenses/hadoop-client-runtime-LICENSE-ASL.txt@@ -0,0 +1,244 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+++APACHE HADOOP SUBCOMPONENTS:++The Apache Hadoop project contains subcomponents with separate copyright+notices and license terms. Your use of the source code for the these+subcomponents is subject to the terms and conditions of the following+licenses.++For the org.apache.hadoop.util.bloom.* classes:++/**+ *+ * Copyright (c) 2005, European Commission project OneLab under contract+ * 034819 (http://www.one-lab.org)+ * All rights reserved.+ * Redistribution and use in source and binary forms, with or+ * without modification, are permitted provided that the following+ * conditions are met:+ * - Redistributions of source code must retain the above copyright+ * notice, this list of conditions and the following disclaimer.+ * - Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the following disclaimer in+ * the documentation and/or other materials provided with the distribution.+ * - Neither the name of the University Catholique de Louvain - UCL+ * nor the names of its contributors may be used to endorse or+ * promote products derived from this software without specific prior+ * written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ * POSSIBILITY OF SUCH DAMAGE.+ */\ No newline at end of filediff --git a/solr/licenses/hadoop-client-runtime-NOTICE.txt b/solr/licenses/hadoop-client-runtime-NOTICE.txtnew file mode 100644index 00000000000..c56a5e4eac1--- /dev/null+++ b/solr/licenses/hadoop-client-runtime-NOTICE.txt@@ -0,0 +1,2 @@+This product includes software developed by The Apache Software+Foundation (http://www.apache.org/).\ No newline at end of filediff --git a/solr/licenses/hadoop-common-3.2.0-tests.jar.sha1 b/solr/licenses/hadoop-common-3.2.0-tests.jar.sha1deleted file mode 100644index ec7e6b608d9..00000000000--- a/solr/licenses/hadoop-common-3.2.0-tests.jar.sha1+++ /dev/null@@ -1 +0,0 @@-f75a9b8c7868056325c1eba7be17e42628bc4a6fdiff --git a/solr/licenses/hadoop-common-3.2.0.jar.sha1 b/solr/licenses/hadoop-common-3.2.0.jar.sha1deleted file mode 100644index fdc40c0ac93..00000000000--- a/solr/licenses/hadoop-common-3.2.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-e47a88c42c450e6e4b23bf951356c203cae2db24diff --git a/solr/licenses/hadoop-common-3.3.1.jar.sha1 b/solr/licenses/hadoop-common-3.3.1.jar.sha1new file mode 100644index 00000000000..541d526e57c--- /dev/null+++ b/solr/licenses/hadoop-common-3.3.1.jar.sha1@@ -0,0 +1 @@+227027e98079d3f0f24c56f323fe27a129658073diff --git a/solr/licenses/hadoop-hdfs-3.2.0-tests.jar.sha1 b/solr/licenses/hadoop-hdfs-3.2.0-tests.jar.sha1deleted file mode 100644index c64eba7eaaa..00000000000--- a/solr/licenses/hadoop-hdfs-3.2.0-tests.jar.sha1+++ /dev/null@@ -1 +0,0 @@-2243629339302f74412f4bcb3777d0b248e86387diff --git a/solr/licenses/hadoop-hdfs-3.2.0.jar.sha1 b/solr/licenses/hadoop-hdfs-3.2.0.jar.sha1deleted file mode 100644index 13359830541..00000000000--- a/solr/licenses/hadoop-hdfs-3.2.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-a79e17c4d454cfb51b8d3307570ed84b1f7cc8f1diff --git a/solr/licenses/hadoop-hdfs-3.3.1-tests.jar.sha1 b/solr/licenses/hadoop-hdfs-3.3.1-tests.jar.sha1new file mode 100644index 00000000000..95b29469b11--- /dev/null+++ b/solr/licenses/hadoop-hdfs-3.3.1-tests.jar.sha1@@ -0,0 +1 @@+5e37d582c2cf6320b0422a7ea3b5442a4fa0b3b3diff --git a/solr/licenses/hadoop-hdfs-3.3.1.jar.sha1 b/solr/licenses/hadoop-hdfs-3.3.1.jar.sha1new file mode 100644index 00000000000..3eb461a2603--- /dev/null+++ b/solr/licenses/hadoop-hdfs-3.3.1.jar.sha1@@ -0,0 +1 @@+5da7f270cb6564e099e0d2d424285a24fca62bd2diff --git a/solr/licenses/hadoop-hdfs-client-3.2.0.jar.sha1 b/solr/licenses/hadoop-hdfs-client-3.2.0.jar.sha1deleted file mode 100644index 0f7ad25b588..00000000000--- a/solr/licenses/hadoop-hdfs-client-3.2.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-c56a99b3043755b5506cfd85f11d53bd61652f3ddiff --git a/solr/licenses/hadoop-minikdc-3.2.0.jar.sha1 b/solr/licenses/hadoop-minikdc-3.2.0.jar.sha1deleted file mode 100644index d6b740578a9..00000000000--- a/solr/licenses/hadoop-minikdc-3.2.0.jar.sha1+++ /dev/null@@ -1 +0,0 @@-f23cc3049750388d6f800f5aff276cc1aaed77b3diff --git a/solr/licenses/hadoop-minikdc-3.3.1.jar.sha1 b/solr/licenses/hadoop-minikdc-3.3.1.jar.sha1new file mode 100644index 00000000000..1aed63c2ab0--- /dev/null+++ b/solr/licenses/hadoop-minikdc-3.3.1.jar.sha1@@ -0,0 +1 @@+353cb158ac0fc045e6f92045170f20288f0ca5dcdiff --git a/solr/licenses/hadoop-shaded-guava-1.1.1.jar.sha1 b/solr/licenses/hadoop-shaded-guava-1.1.1.jar.sha1new file mode 100644index 00000000000..36924b7d2fd--- /dev/null+++ b/solr/licenses/hadoop-shaded-guava-1.1.1.jar.sha1@@ -0,0 +1 @@+02419d851c01139edf9e19b81056382163d9bfabdiff --git a/solr/licenses/hadoop-shaded-guava-LICENSE-ASL.txt b/solr/licenses/hadoop-shaded-guava-LICENSE-ASL.txtnew file mode 100644index 00000000000..9a8e847ee84--- /dev/null+++ b/solr/licenses/hadoop-shaded-guava-LICENSE-ASL.txt@@ -0,0 +1,244 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+++APACHE HADOOP SUBCOMPONENTS:++The Apache Hadoop project contains subcomponents with separate copyright+notices and license terms. Your use of the source code for the these+subcomponents is subject to the terms and conditions of the following+licenses.++For the org.apache.hadoop.util.bloom.* classes:++/**+ *+ * Copyright (c) 2005, European Commission project OneLab under contract+ * 034819 (http://www.one-lab.org)+ * All rights reserved.+ * Redistribution and use in source and binary forms, with or+ * without modification, are permitted provided that the following+ * conditions are met:+ * - Redistributions of source code must retain the above copyright+ * notice, this list of conditions and the following disclaimer.+ * - Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the following disclaimer in+ * the documentation and/or other materials provided with the distribution.+ * - Neither the name of the University Catholique de Louvain - UCL+ * nor the names of its contributors may be used to endorse or+ * promote products derived from this software without specific prior+ * written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ * POSSIBILITY OF SUCH DAMAGE.+ */\ No newline at end of filediff --git a/solr/licenses/hadoop-shaded-guava-NOTICE.txt b/solr/licenses/hadoop-shaded-guava-NOTICE.txtnew file mode 100644index 00000000000..c56a5e4eac1--- /dev/null+++ b/solr/licenses/hadoop-shaded-guava-NOTICE.txt@@ -0,0 +1,2 @@+This product includes software developed by The Apache Software+Foundation (http://www.apache.org/).\ No newline at end of filediff --git a/solr/licenses/httpcore-4.4.14.jar.sha1 b/solr/licenses/httpcore-4.4.14.jar.sha1deleted file mode 100644index 85629d517a5..00000000000--- a/solr/licenses/httpcore-4.4.14.jar.sha1+++ /dev/null@@ -1 +0,0 @@-9dd1a631c082d92ecd4bd8fd4cf55026c720a8c1diff --git a/solr/licenses/httpcore-4.4.15.jar.sha1 b/solr/licenses/httpcore-4.4.15.jar.sha1new file mode 100644index 00000000000..28e6ffca1a7--- /dev/null+++ b/solr/licenses/httpcore-4.4.15.jar.sha1@@ -0,0 +1 @@+7f2e0c573eaa7a74bac2e89b359e1f73d92a0a1ddiff --git a/solr/licenses/httpmime-4.5.10.jar.sha1 b/solr/licenses/httpmime-4.5.10.jar.sha1deleted file mode 100644index 473e6604f21..00000000000--- a/solr/licenses/httpmime-4.5.10.jar.sha1+++ /dev/null@@ -1 +0,0 @@-3513ca10d24d7aa962741c90e914fec650f0848cdiff --git a/solr/licenses/httpmime-4.5.13.jar.sha1 b/solr/licenses/httpmime-4.5.13.jar.sha1new file mode 100644index 00000000000..877dded1c56--- /dev/null+++ b/solr/licenses/httpmime-4.5.13.jar.sha1@@ -0,0 +1 @@+efc110bad4a0d45cda7858e6beee1d8a8313da5adiff --git a/solr/licenses/jersey-servlet-1.19.jar.sha1 b/solr/licenses/jersey-servlet-1.19.jar.sha1deleted file mode 100644index b38f1fb42ab..00000000000--- a/solr/licenses/jersey-servlet-1.19.jar.sha1+++ /dev/null@@ -1 +0,0 @@-2f19f1f7096d0fe3e09ae5698e4427114c23ad03diff --git a/solr/licenses/jersey-servlet-LICENSE-CDDL.txt b/solr/licenses/jersey-servlet-LICENSE-CDDL.txtdeleted file mode 100644index 64df8d56300..00000000000--- a/solr/licenses/jersey-servlet-LICENSE-CDDL.txt+++ /dev/null@@ -1,85 +0,0 @@-COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)Version 1.1--1. Definitions.--1.1. “Contributor” means each individual or entity that creates or contributes to the creation of Modifications.-1.2. “Contributor Version” means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.-1.3. “Covered Software” means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.-1.4. “Executable” means the Covered Software in any form other than Source Code.-1.5. “Initial Developer” means the individual or entity that first makes Original Software available under this License.-1.6. “Larger Work” means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.-1.7. “License” means this document.-1.8. “Licensable” means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.-1.9. “Modifications” means the Source Code and Executable form of any of the following:-A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;-B. Any new file that contains any part of the Original Software or previous Modification; or-C. Any new file that is contributed or otherwise made available under the terms of this License.-1.10. “Original Software” means the Source Code and Executable form of computer software code that is originally released under this License.-1.11. “Patent Claims” means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.-1.12. “Source Code” means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.-1.13. “You” (or “Your”) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, “You” includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.-2. License Grants.--2.1. The Initial Developer Grant.-Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:-(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and-(b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).-(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.-(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices.-2.2. Contributor Grant.-Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:-(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and-(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).-(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.-(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.-3. Distribution Obligations.--3.1. Availability of Source Code.-Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.-3.2. Modifications.-The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.-3.3. Required Notices.-You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.-3.4. Application of Additional Terms.-You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients' rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.-3.5. Distribution of Executable Versions.-You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient's rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.-3.6. Larger Works.-You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.-4. Versions of the License.--4.1. New Versions.-Oracle is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.-4.2. Effect of New Versions.-You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.-4.3. Modified Versions.-When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License.-5. DISCLAIMER OF WARRANTY.--COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN “AS IS” BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.--6. TERMINATION.--6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.-6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as “Participant”) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant.-6.3. If You assert a patent infringement claim against Participant alleging that the Participant Software directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.-6.4. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.-7. LIMITATION OF LIABILITY.--UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.--8. U.S. GOVERNMENT END USERS.--The Covered Software is a “commercial item,” as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of “commercial computer software” (as that term is defined at 48 C.F.R. § 252.227-7014(a)(1)) and “commercial computer software documentation” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.--9. MISCELLANEOUS.--This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction's conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.--10. RESPONSIBILITY FOR CLAIMS.--As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.--NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)--The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California.\ No newline at end of filediff --git a/solr/modules/hadoop-auth/build.gradle b/solr/modules/hadoop-auth/build.gradleindex 7f051f65a10..069172c030d 100644--- a/solr/modules/hadoop-auth/build.gradle+++ b/solr/modules/hadoop-auth/build.gradle@@ -66,6 +66,7 @@ dependencies {implementation ('org.apache.hadoop:hadoop-auth') { transitive = false }implementation ('org.apache.hadoop:hadoop-common') { transitive = false }// transitive of hadoop-common; used by Kerberos auth+ runtimeOnly 'org.apache.hadoop.thirdparty:hadoop-shaded-guava'runtimeOnly 'commons-collections:commons-collections'runtimeOnly 'com.google.re2j:re2j'runtimeOnly 'org.apache.commons:commons-configuration2'diff --git a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/DelegationTokenKerberosFilter.java b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/DelegationTokenKerberosFilter.javaindex 2ee87ec3107..2ca03f26544 100644--- a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/DelegationTokenKerberosFilter.java+++ b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/DelegationTokenKerberosFilter.java@@ -20,7 +20,6 @@ import java.io.IOException;import java.util.Enumeration;import java.util.LinkedList;import java.util.List;-import java.util.Locale;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;@@ -56,7 +55,6 @@ import org.apache.zookeeper.data.ACL;*/public class DelegationTokenKerberosFilter extends DelegationTokenAuthenticationFilter {private CuratorFramework curatorFramework;- private final Locale defaultLocale = Locale.getDefault();@Overridepublic void init(FilterConfig conf) throws ServletException {@@ -101,7 +99,6 @@ public class DelegationTokenKerberosFilter extends DelegationTokenAuthentication@Overridepublic void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)throws IOException, ServletException {- Locale.setDefault(defaultLocale);HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;UserGroupInformation ugi = HttpUserGroupInformation.get();@@ -115,8 +112,6 @@ public class DelegationTokenKerberosFilter extends DelegationTokenAuthentication}};- // A hack until HADOOP-15681 get committed- Locale.setDefault(Locale.US);super.doFilter(request, response, filterChainWrapper);}diff --git a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthFilter.java b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthFilter.javaindex 10812cadc6a..779bbafa71c 100644--- a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthFilter.java+++ b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthFilter.java@@ -19,7 +19,6 @@ package org.apache.solr.security.hadoop;import java.io.IOException;import java.util.LinkedList;import java.util.List;-import java.util.Locale;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;@@ -58,7 +57,6 @@ public class HadoopAuthFilter extends DelegationTokenAuthenticationFilter {static final String DELEGATION_TOKEN_ZK_CLIENT = "solr.kerberos.delegation.token.zk.client";private CuratorFramework curatorFramework;- private final Locale defaultLocale = Locale.getDefault();@Overridepublic void init(FilterConfig conf) throws ServletException {@@ -83,7 +81,6 @@ public class HadoopAuthFilter extends DelegationTokenAuthenticationFilter {@Overridepublic void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)throws IOException, ServletException {- Locale.setDefault(defaultLocale);HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;UserGroupInformation ugi = HttpUserGroupInformation.get();@@ -97,8 +94,6 @@ public class HadoopAuthFilter extends DelegationTokenAuthenticationFilter {}};- // A hack until HADOOP-15681 get committed- Locale.setDefault(Locale.US);super.doFilter(request, response, filterChainWrapper);}diff --git a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthPlugin.java b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthPlugin.javaindex 039be889722..bb50424f447 100644--- a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthPlugin.java+++ b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/HadoopAuthPlugin.java@@ -25,15 +25,12 @@ import java.util.Collection;import java.util.Collections;import java.util.Enumeration;import java.util.HashMap;-import java.util.Locale;import java.util.Map;import java.util.Objects;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;import javax.servlet.ServletContext;import javax.servlet.ServletException;-import javax.servlet.ServletRequest;-import javax.servlet.ServletResponse;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;@@ -120,7 +117,6 @@ public class HadoopAuthPlugin extends AuthenticationPlugin {private static final boolean TRACE_HTTP = Boolean.getBoolean("hadoopauth.tracehttp");private AuthenticationFilter authFilter;- private final Locale defaultLocale = Locale.getDefault();protected final CoreContainer coreContainer;private boolean delegationTokenEnabled;@@ -132,20 +128,7 @@ public class HadoopAuthPlugin extends AuthenticationPlugin {public void init(Map<String,Object> pluginConfig) {try {delegationTokenEnabled = Boolean.parseBoolean((String) pluginConfig.get(DELEGATION_TOKEN_ENABLED_PROPERTY));- authFilter = delegationTokenEnabled ? new HadoopAuthFilter() : new AuthenticationFilter() {- @Override- public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {- // A hack until HADOOP-15681 get committed- Locale.setDefault(Locale.US);- super.doFilter(request, response, filterChain);- }-- @Override- protected void doFilter(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {- Locale.setDefault(defaultLocale);- super.doFilter(filterChain, request, response);- }- };+ authFilter = delegationTokenEnabled ? new HadoopAuthFilter() : new AuthenticationFilter();// Initialize kerberos before initializing curator instance.boolean initKerberosZk = Boolean.parseBoolean((String)pluginConfig.getOrDefault(INIT_KERBEROS_ZK, "false"));diff --git a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/KerberosFilter.java b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/KerberosFilter.javaindex 7c44403b168..94b8fa1bb93 100644--- a/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/KerberosFilter.java+++ b/solr/modules/hadoop-auth/src/java/org/apache/solr/security/hadoop/KerberosFilter.java@@ -19,13 +19,10 @@ package org.apache.solr.security.hadoop;import java.io.IOException;import java.lang.invoke.MethodHandles;import java.security.Principal;-import java.util.Locale;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;import javax.servlet.ServletException;-import javax.servlet.ServletRequest;-import javax.servlet.ServletResponse;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletRequestWrapper;import javax.servlet.http.HttpServletResponse;@@ -40,9 +37,6 @@ import org.slf4j.Logger;import org.slf4j.LoggerFactory;public class KerberosFilter extends AuthenticationFilter {-- private final Locale defaultLocale = Locale.getDefault();-private final CoreContainer coreContainer;public KerberosFilter(CoreContainer coreContainer) {@@ -72,8 +66,6 @@ public class KerberosFilter extends AuthenticationFilter {@Overrideprotected void doFilter(FilterChain filterChain, HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {- Locale.setDefault(defaultLocale);-request = substituteOriginalUserRequest(request);super.doFilter(filterChain, request, response);@@ -118,12 +110,4 @@ public class KerberosFilter extends AuthenticationFilter {}return request;}-- @Override- public void doFilter(ServletRequest request, ServletResponse response,- FilterChain filterChain) throws IOException, ServletException {- // A hack until HADOOP-15681 get committed- Locale.setDefault(Locale.US);- super.doFilter(request, response, filterChain);- }}diff --git a/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithSecureImpersonation.java b/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithSecureImpersonation.javaindex 7d885f9cfc3..22a9f68e267 100644--- a/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithSecureImpersonation.java+++ b/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithSecureImpersonation.java@@ -221,7 +221,7 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}@Test- public void testProxyNoConfigGroups() throws Exception {+ public void testProxyNoConfigGroups() {BaseHttpSolrClient.RemoteSolrException e = expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> solrClient.request(getProxyRequest("noGroups","bar")));@@ -229,7 +229,7 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}@Test- public void testProxyWrongHost() throws Exception {+ public void testProxyWrongHost() {BaseHttpSolrClient.RemoteSolrException e = expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> solrClient.request(getProxyRequest("wrongHost","bar")));@@ -237,13 +237,11 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}@Test- public void testProxyNoConfigHosts() throws Exception {+ public void testProxyNoConfigHosts() {BaseHttpSolrClient.RemoteSolrException e = expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> solrClient.request(getProxyRequest("noHosts","bar")));- // FixMe: this should return an exception about the host being invalid,- // but a bug (HADOOP-11077) causes an NPE instead.- // assertTrue(ex.getMessage().contains(getExpectedHostExMsg("noHosts")));+ assertTrue(e.getMessage().contains(getExpectedHostExMsg("noHosts")));}@Test@@ -253,7 +251,7 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}@Test- public void testProxyInvalidProxyUser() throws Exception {+ public void testProxyInvalidProxyUser() {// wrong direction, should failBaseHttpSolrClient.RemoteSolrException e = expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> solrClient.request(getProxyRequest("bar","anyHostAnyUser"))@@ -276,7 +274,7 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}@Test- public void testProxyUnknownRemote() throws Exception {+ public void testProxyUnknownRemote() {BaseHttpSolrClient.RemoteSolrException e = expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> {// Use a reserved ip address@@ -287,16 +285,16 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}@Test- public void testProxyInvalidRemote() throws Exception {+ public void testProxyInvalidRemote() {BaseHttpSolrClient.RemoteSolrException e = expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> {- solrClient.request(getProxyRequest("localHostAnyGroup","bar", "[ff01::114]", DEAD_HOST_2));+ solrClient.request(getProxyRequest("localHostAnyGroup","bar", "[ff01::114]", "[::1]"));});assertTrue(e.getMessage().contains(getExpectedHostExMsg("localHostAnyGroup")));}@Test- public void testProxyInvalidGroup() throws Exception {+ public void testProxyInvalidGroup() {BaseHttpSolrClient.RemoteSolrException e = expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> solrClient.request(getProxyRequest("bogusGroup","bar", null)));@@ -304,7 +302,7 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}@Test- public void testProxyNullProxyUser() throws Exception {+ public void testProxyNullProxyUser() {expectThrows(BaseHttpSolrClient.RemoteSolrException.class,() -> solrClient.request(getProxyRequest("","bar")));diff --git a/solr/modules/hdfs/build.gradle b/solr/modules/hdfs/build.gradleindex f88e7b37888..f2f45444430 100644--- a/solr/modules/hdfs/build.gradle+++ b/solr/modules/hdfs/build.gradle@@ -17,7 +17,7 @@apply plugin: 'java-library'-description = 'HDFS Contrib Module'+description = 'HDFS Module'dependencies {implementation project(':solr:core')@@ -27,22 +27,10 @@ dependencies {implementation 'org.slf4j:slf4j-api'- // Hadoop dependencies- permitUnusedDeclared 'org.apache.hadoop:hadoop-annotations'- implementation ('org.apache.hadoop:hadoop-annotations') { transitive = false }- permitUnusedDeclared 'org.apache.hadoop:hadoop-auth'- implementation ('org.apache.hadoop:hadoop-auth') { transitive = false }- implementation ('org.apache.hadoop:hadoop-common') { transitive = false }- // transitive of hadoop-common; used by HDFS- runtimeOnly 'commons-collections:commons-collections'- runtimeOnly 'com.google.re2j:re2j'- runtimeOnly 'org.apache.commons:commons-configuration2'- runtimeOnly 'org.apache.htrace:htrace-core4' // note: removed in Hadoop 3.3.2- runtimeOnly 'org.apache.kerby:kerb-core'- runtimeOnly 'org.apache.kerby:kerb-util'- implementation ('org.apache.hadoop:hadoop-hdfs-client') { transitive = false }-- // Guava implements the VisibleForTesting annotations+ api 'org.apache.hadoop:hadoop-client-api'+ runtimeOnly 'org.apache.hadoop:hadoop-client-runtime'++ // Guava implements Preconditions, caches, and VisibleForTesting annotationsimplementation 'com.google.guava:guava'// Caffeine cache to implement HDFS block caching@@ -57,35 +45,27 @@ dependencies {// hadoop dependencies for teststestImplementation ('org.apache.hadoop:hadoop-hdfs') { transitive = false }- testImplementation ('org.apache.hadoop:hadoop-common::tests') { transitive = false }testImplementation ('org.apache.hadoop:hadoop-hdfs::tests') { transitive = false }- testImplementation ('org.apache.hadoop:hadoop-minikdc') { transitive = false }+ testRuntimeOnly 'org.apache.hadoop:hadoop-client-minicluster'testImplementation 'org.slf4j:jcl-over-slf4j'- testImplementation 'org.apache.logging.log4j:log4j-1.2-api'+ testRuntimeOnly 'org.apache.logging.log4j:log4j-1.2-api'// classes like solr.ICUCollationField, used by NNFailoverTest for example.testRuntimeOnly project(':solr:modules:analysis-extras')- // required for instantiating a Zookeeper server in tests or embedded- runtimeOnly ('org.xerial.snappy:snappy-java')-// used by the hadoop-specific test framework classes- testImplementation('commons-io:commons-io') { transitive = false }- testImplementation ('org.apache.commons:commons-compress') { transitive = false }- testImplementation ('org.apache.commons:commons-collections4') { transitive = false }- testImplementation ('org.apache.commons:commons-lang3') { transitive = false }- testImplementation ('com.sun.jersey:jersey-servlet') { transitive = false }+ testImplementation 'commons-io:commons-io'+ testImplementation 'org.apache.commons:commons-compress'+ testImplementation 'org.apache.commons:commons-collections4'+ testImplementation 'org.apache.commons:commons-lang3'testImplementation 'io.dropwizard.metrics:metrics-core'- testImplementation 'javax.servlet:javax.servlet-api'- testImplementation 'org.eclipse.jetty:jetty-http'- testImplementation 'org.eclipse.jetty:jetty-server'- testImplementation 'org.eclipse.jetty:jetty-servlet'- testImplementation 'org.eclipse.jetty:jetty-util'- testImplementation 'org.eclipse.jetty:jetty-webapp'// Zookeeper dependency - some tests like HdfsCloudBackupRestore need this+ permitTestUnusedDeclared 'org.apache.zookeeper:zookeeper'testImplementation 'org.apache.zookeeper:zookeeper'+ // required for instantiating a Zookeeper server in tests or embedded+ testRuntimeOnly 'org.xerial.snappy:snappy-java'}diff --git a/solr/modules/hdfs/src/test-files/core-site.xml b/solr/modules/hdfs/src/test-files/core-site.xmlindex c949ff35224..fcfdfa9d39a 100644--- a/solr/modules/hdfs/src/test-files/core-site.xml+++ b/solr/modules/hdfs/src/test-files/core-site.xml@@ -20,4 +20,10 @@<name>hadoop.security.group.mapping</name><value>org.apache.solr.cloud.hdfs.HdfsFakeGroupMapping</value></property>++ <!-- SSL KeyStore reloading causes thread leaks - HADOOP-16524 introduced in Hadoop 3.3.1 -->+ <property>+ <name>hadoop.ssl.keystores.factory.class</name>+ <value>org.apache.solr.cloud.hdfs.DisableKeyStoresFactory</value>+ </property></configuration>diff --git a/solr/modules/hdfs/src/test/org/apache/hadoop/fs/FileUtil.java b/solr/modules/hdfs/src/test/org/apache/hadoop/fs/FileUtil.javaindex e21a5b92c2e..01df4d45256 100644--- a/solr/modules/hdfs/src/test/org/apache/hadoop/fs/FileUtil.java+++ b/solr/modules/hdfs/src/test/org/apache/hadoop/fs/FileUtil.java@@ -21,18 +21,20 @@ package org.apache.hadoop.fs;import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.BufferedReader;+import java.io.BufferedWriter;import java.io.File;-import java.io.FileInputStream;import java.io.FileNotFoundException;-import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.OutputStream;+import java.io.OutputStreamWriter;import java.net.InetAddress;import java.net.URI;import java.net.UnknownHostException;import java.nio.charset.Charset;+import java.nio.charset.CharsetEncoder;+import java.nio.charset.StandardCharsets;import java.nio.file.AccessDeniedException;import java.nio.file.FileSystems;import java.nio.file.Files;@@ -40,6 +42,7 @@ import java.util.ArrayList;import java.util.Enumeration;import java.util.List;import java.util.Map;+import java.util.Objects;import java.util.concurrent.ExecutionException;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;@@ -448,7 +451,7 @@ public class FileUtil {InputStream in = null;OutputStream out =null;try {- in = new FileInputStream(src);+ in = Files.newInputStream(src.toPath());out = dstFS.create(dst);IOUtils.copyBytes(in, out, conf);} catch (IOException e) {@@ -496,7 +499,7 @@ public class FileUtil {}} else {InputStream in = srcFS.open(src);- IOUtils.copyBytes(in, new FileOutputStream(dst), conf);+ IOUtils.copyBytes(in, Files.newOutputStream(dst.toPath()), conf);}if (deleteSource) {return srcFS.delete(src, true);@@ -596,11 +599,10 @@ public class FileUtil {return dir.length();} else {File[] allFiles = dir.listFiles();- if(allFiles != null) {- for (int i = 0; i < allFiles.length; i++) {- boolean isSymLink = org.apache.commons.io.FileUtils.isSymlink(allFiles[i]);- if(!isSymLink) {- size += getDU(allFiles[i]);+ if (allFiles != null) {+ for (File f : allFiles) {+ if (!org.apache.commons.io.FileUtils.isSymlink(f)) {+ size += getDU(f);}}}@@ -635,7 +637,7 @@ public class FileUtil {throw new IOException("Mkdirs failed to create " +parent.getAbsolutePath());}- try (OutputStream out = new FileOutputStream(file)) {+ try (OutputStream out = Files.newOutputStream(file.toPath())) {IOUtils.copyBytes(zip, out, BUFFER_SIZE);}if (!file.setLastModified(entry.getTime())) {@@ -680,7 +682,7 @@ public class FileUtil {file.getParentFile().toString());}}- OutputStream out = new FileOutputStream(file);+ OutputStream out = Files.newOutputStream(file.toPath());try {byte[] buffer = new byte[8192];int i;@@ -742,9 +744,7 @@ public class FileUtil {new IOUtils.NullOutputStream());}} catch (IOException e) {- if (LOG.isDebugEnabled()) {- LOG.debug(e.getMessage());- }+ LOG.debug(e.getMessage());}});Future<?> error = executor.submit(() -> {@@ -767,9 +767,7 @@ public class FileUtil {new IOUtils.NullOutputStream());}} catch (IOException e) {- if (LOG.isDebugEnabled()) {- LOG.debug(e.getMessage());- }+ LOG.debug(e.getMessage());}});@@ -873,10 +871,10 @@ public class FileUtil {if (gzipped) {untarCommand.append("gzip -dc | (");}- untarCommand.append("cd '");- untarCommand.append(FileUtil.makeSecureShellPath(untarDir));- untarCommand.append("' && ");- untarCommand.append("tar -x ");+ untarCommand.append("cd '")+ .append(FileUtil.makeSecureShellPath(untarDir))+ .append("' && ")+ .append("tar -x ");if (gzipped) {untarCommand.append(")");@@ -888,14 +886,14 @@ public class FileUtil {boolean gzipped) throws IOException {StringBuffer untarCommand = new StringBuffer();if (gzipped) {- untarCommand.append(" gzip -dc '");- untarCommand.append(FileUtil.makeSecureShellPath(inFile));- untarCommand.append("' | (");+ untarCommand.append(" gzip -dc '")+ .append(FileUtil.makeSecureShellPath(inFile))+ .append("' | (");}- untarCommand.append("cd '");- untarCommand.append(FileUtil.makeSecureShellPath(untarDir));- untarCommand.append("' && ");- untarCommand.append("tar -xf ");+ untarCommand.append("cd '")+ .append(FileUtil.makeSecureShellPath(untarDir))+ .append("' && ")+ .append("tar -xf ");if (gzipped) {untarCommand.append(" -)");@@ -918,12 +916,14 @@ public class FileUtil {TarArchiveInputStream tis = null;try {if (gzipped) {- inputStream = new BufferedInputStream(new GZIPInputStream(- new FileInputStream(inFile)));+ inputStream =+ new GZIPInputStream(Files.newInputStream(inFile.toPath()));} else {- inputStream = new BufferedInputStream(new FileInputStream(inFile));+ inputStream = Files.newInputStream(inFile.toPath());}+ inputStream = new BufferedInputStream(inputStream);+tis = new TarArchiveInputStream(inputStream);for (TarArchiveEntry entry = tis.getNextTarEntry(); entry != null;) {@@ -940,13 +940,9 @@ public class FileUtil {TarArchiveInputStream tis = null;try {if (gzipped) {- inputStream = new BufferedInputStream(new GZIPInputStream(- inputStream));- } else {- inputStream =- new BufferedInputStream(inputStream);+ inputStream = new GZIPInputStream(inputStream);}-+ inputStream = new BufferedInputStream(inputStream);tis = new TarArchiveInputStream(inputStream);for (TarArchiveEntry entry = tis.getNextTarEntry(); entry != null;) {@@ -1002,17 +998,7 @@ public class FileUtil {return;}- int count;- byte data[] = new byte[2048];- try (BufferedOutputStream outputStream = new BufferedOutputStream(- new FileOutputStream(outputFile));) {-- while ((count = tis.read(data)) != -1) {- outputStream.write(data, 0, count);- }-- outputStream.flush();- }+ org.apache.commons.io.FileUtils.copyToFile(tis, outputFile);}/**@@ -1347,7 +1333,8 @@ public class FileUtil {String[] args = new String[cmd.length + 1];System.arraycopy(cmd, 0, args, 0, cmd.length);args[cmd.length] = f.getCanonicalPath();- return Shell.execCommand(args);+ String output = Shell.execCommand(args);+ return output;}/**@@ -1360,9 +1347,9 @@ public class FileUtil {* @see java.io.File#createTempFile(String, String, File)* @see java.io.File#deleteOnExit()*/- public static File createLocalTempFile(final File basefile,- final String prefix,- final boolean isDeleteOnExit)+ public static final File createLocalTempFile(final File basefile,+ final String prefix,+ final boolean isDeleteOnExit)throws IOException {File tmp = File.createTempFile(prefix + basefile.getName(),"", basefile.getParentFile());@@ -1473,8 +1460,8 @@ public class FileUtil {* @param inputClassPath String input classpath to bundle into the jar manifest* @param pwd Path to working directory to save jar* @param targetDir path to where the jar execution will have its working dir- * @param callerEnv Map<String, String> caller's environment variables to use- * for expansion+ * @param callerEnv Map {@literal <}String, String{@literal >} caller's+ * environment variables to use for expansion* @return String[] with absolute path to new jar in position 0 and* unexpanded wild card entry path in position 1* @throws IOException if there is an I/O error while writing the jar file@@ -1483,6 +1470,7 @@ public class FileUtil {Path targetDir,Map<String, String> callerEnv) throws IOException {// Replace environment variables, case-insensitive on Windows+ @SuppressWarnings("unchecked")Map<String, String> env = Shell.WINDOWS ? new CaseInsensitiveMap<>(callerEnv) :callerEnv;String[] classPathEntries = inputClassPath.split(File.pathSeparator);@@ -1515,8 +1503,8 @@ public class FileUtil {classPathEntryList.add(jar.toUri().toURL().toExternalForm());}} else {- unexpandedWildcardClasspath.append(File.pathSeparator);- unexpandedWildcardClasspath.append(classPathEntry);+ unexpandedWildcardClasspath.append(File.pathSeparator)+ .append(classPathEntry);}} else {// Append just this entry@@ -1555,7 +1543,7 @@ public class FileUtil {// Write the manifest to output JAR fileFile classPathJar = File.createTempFile("classpath-", ".jar", workingDir);- try (FileOutputStream fos = new FileOutputStream(classPathJar);+ try (OutputStream fos = Files.newOutputStream(classPathJar.toPath());BufferedOutputStream bos = new BufferedOutputStream(fos)) {JarOutputStream jos = new JarOutputStream(bos, jarManifest);jos.close();@@ -1645,4 +1633,235 @@ public class FileUtil {// check for portsreturn srcUri.getPort()==dstUri.getPort();}++ /**+ * Writes bytes to a file. This utility method opens the file for writing,+ * creating the file if it does not exist, or overwrites an existing file. All+ * bytes in the byte array are written to the file.+ *+ * @param fs the file system with which to create the file+ * @param path the path to the file+ * @param bytes the byte array with the bytes to write+ *+ * @return the file system+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileSystem write(final FileSystem fs, final Path path,+ final byte[] bytes) throws IOException {++ Objects.requireNonNull(path);+ Objects.requireNonNull(bytes);++ try (FSDataOutputStream out = fs.createFile(path).overwrite(true).build()) {+ out.write(bytes);+ }++ return fs;+ }++ /**+ * Writes bytes to a file. This utility method opens the file for writing,+ * creating the file if it does not exist, or overwrites an existing file. All+ * bytes in the byte array are written to the file.+ *+ * @param fileContext the file context with which to create the file+ * @param path the path to the file+ * @param bytes the byte array with the bytes to write+ *+ * @return the file context+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileContext write(final FileContext fileContext,+ final Path path, final byte[] bytes) throws IOException {++ Objects.requireNonNull(path);+ Objects.requireNonNull(bytes);++ try (FSDataOutputStream out =+ fileContext.create(path).overwrite(true).build()) {+ out.write(bytes);+ }++ return fileContext;+ }++ /**+ * Write lines of text to a file. Each line is a char sequence and is written+ * to the file in sequence with each line terminated by the platform's line+ * separator, as defined by the system property {@code+ * line.separator}. Characters are encoded into bytes using the specified+ * charset. This utility method opens the file for writing, creating the file+ * if it does not exist, or overwrites an existing file.+ *+ * @param fs the file system with which to create the file+ * @param path the path to the file+ * @param lines a Collection to iterate over the char sequences+ * @param cs the charset to use for encoding+ *+ * @return the file system+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileSystem write(final FileSystem fs, final Path path,+ final Iterable<? extends CharSequence> lines, final Charset cs)+ throws IOException {++ Objects.requireNonNull(path);+ Objects.requireNonNull(lines);+ Objects.requireNonNull(cs);++ CharsetEncoder encoder = cs.newEncoder();+ try (FSDataOutputStream out = fs.createFile(path).overwrite(true).build();+ BufferedWriter writer =+ new BufferedWriter(new OutputStreamWriter(out, encoder))) {+ for (CharSequence line : lines) {+ writer.append(line);+ writer.newLine();+ }+ }+ return fs;+ }++ /**+ * Write lines of text to a file. Each line is a char sequence and is written+ * to the file in sequence with each line terminated by the platform's line+ * separator, as defined by the system property {@code+ * line.separator}. Characters are encoded into bytes using the specified+ * charset. This utility method opens the file for writing, creating the file+ * if it does not exist, or overwrites an existing file.+ *+ * @param fileContext the file context with which to create the file+ * @param path the path to the file+ * @param lines a Collection to iterate over the char sequences+ * @param cs the charset to use for encoding+ *+ * @return the file context+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileContext write(final FileContext fileContext,+ final Path path, final Iterable<? extends CharSequence> lines,+ final Charset cs) throws IOException {++ Objects.requireNonNull(path);+ Objects.requireNonNull(lines);+ Objects.requireNonNull(cs);++ CharsetEncoder encoder = cs.newEncoder();+ try (FSDataOutputStream out = fileContext.create(path).overwrite(true).build();+ BufferedWriter writer =+ new BufferedWriter(new OutputStreamWriter(out, encoder))) {+ for (CharSequence line : lines) {+ writer.append(line);+ writer.newLine();+ }+ }+ return fileContext;+ }++ /**+ * Write a line of text to a file. Characters are encoded into bytes using the+ * specified charset. This utility method opens the file for writing, creating+ * the file if it does not exist, or overwrites an existing file.+ *+ * @param fs the file system with which to create the file+ * @param path the path to the file+ * @param charseq the char sequence to write to the file+ * @param cs the charset to use for encoding+ *+ * @return the file system+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileSystem write(final FileSystem fs, final Path path,+ final CharSequence charseq, final Charset cs) throws IOException {++ Objects.requireNonNull(path);+ Objects.requireNonNull(charseq);+ Objects.requireNonNull(cs);++ CharsetEncoder encoder = cs.newEncoder();+ try (FSDataOutputStream out = fs.createFile(path).overwrite(true).build();+ BufferedWriter writer =+ new BufferedWriter(new OutputStreamWriter(out, encoder))) {+ writer.append(charseq);+ }+ return fs;+ }++ /**+ * Write a line of text to a file. Characters are encoded into bytes using the+ * specified charset. This utility method opens the file for writing, creating+ * the file if it does not exist, or overwrites an existing file.+ *+ * @param fs the file context with which to create the file+ * @param path the path to the file+ * @param charseq the char sequence to write to the file+ * @param cs the charset to use for encoding+ *+ * @return the file context+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileContext write(final FileContext fs, final Path path,+ final CharSequence charseq, final Charset cs) throws IOException {++ Objects.requireNonNull(path);+ Objects.requireNonNull(charseq);+ Objects.requireNonNull(cs);++ CharsetEncoder encoder = cs.newEncoder();+ try (FSDataOutputStream out = fs.create(path).overwrite(true).build();+ BufferedWriter writer =+ new BufferedWriter(new OutputStreamWriter(out, encoder))) {+ writer.append(charseq);+ }+ return fs;+ }++ /**+ * Write a line of text to a file. Characters are encoded into bytes using+ * UTF-8. This utility method opens the file for writing, creating the file if+ * it does not exist, or overwrites an existing file.+ *+ * @param fs the files system with which to create the file+ * @param path the path to the file+ * @param charseq the char sequence to write to the file+ *+ * @return the file system+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileSystem write(final FileSystem fs, final Path path,+ final CharSequence charseq) throws IOException {+ return write(fs, path, charseq, StandardCharsets.UTF_8);+ }++ /**+ * Write a line of text to a file. Characters are encoded into bytes using+ * UTF-8. This utility method opens the file for writing, creating the file if+ * it does not exist, or overwrites an existing file.+ *+ * @param fileContext the files system with which to create the file+ * @param path the path to the file+ * @param charseq the char sequence to write to the file+ *+ * @return the file context+ *+ * @throws NullPointerException if any of the arguments are {@code null}+ * @throws IOException if an I/O error occurs creating or writing to the file+ */+ public static FileContext write(final FileContext fileContext,+ final Path path, final CharSequence charseq) throws IOException {+ return write(fileContext, path, charseq, StandardCharsets.UTF_8);+ }}diff --git a/solr/modules/hdfs/src/test/org/apache/hadoop/fs/RawLocalFileSystem.java b/solr/modules/hdfs/src/test/org/apache/hadoop/fs/RawLocalFileSystem.javaindex 5373c03bcc0..c059ef8c2b1 100644--- a/solr/modules/hdfs/src/test/org/apache/hadoop/fs/RawLocalFileSystem.java+++ b/solr/modules/hdfs/src/test/org/apache/hadoop/fs/RawLocalFileSystem.java@@ -43,18 +43,35 @@ import java.nio.file.attribute.PosixFileAttributes;import java.nio.file.attribute.PosixFilePermissions;import java.util.Arrays;import java.util.EnumSet;+import java.util.Locale;import java.util.Optional;+import java.util.concurrent.atomic.AtomicLong;import org.apache.hadoop.classification.InterfaceAudience;import org.apache.hadoop.classification.InterfaceStability;import org.apache.hadoop.conf.Configuration;+import org.apache.hadoop.fs.impl.StoreImplementationUtils;import org.apache.hadoop.fs.permission.FsPermission;+import org.apache.hadoop.fs.statistics.IOStatistics;+import org.apache.hadoop.fs.statistics.IOStatisticsSource;+import org.apache.hadoop.fs.statistics.BufferedIOStatisticsOutputStream;+import org.apache.hadoop.fs.statistics.impl.IOStatisticsStore;import org.apache.hadoop.io.IOUtils;import org.apache.hadoop.io.nativeio.NativeIO;import org.apache.hadoop.util.Progressable;import org.apache.hadoop.util.Shell;import org.apache.hadoop.util.StringUtils;+import static org.apache.hadoop.fs.impl.PathCapabilitiesSupport.validatePathCapabilityArgs;+import static org.apache.hadoop.fs.statistics.StreamStatisticNames.STREAM_READ_BYTES;+import static org.apache.hadoop.fs.statistics.StreamStatisticNames.STREAM_READ_EXCEPTIONS;+import static org.apache.hadoop.fs.statistics.StreamStatisticNames.STREAM_READ_SEEK_OPERATIONS;+import static org.apache.hadoop.fs.statistics.StreamStatisticNames.STREAM_READ_SKIP_BYTES;+import static org.apache.hadoop.fs.statistics.StreamStatisticNames.STREAM_READ_SKIP_OPERATIONS;+import static org.apache.hadoop.fs.statistics.StreamStatisticNames.STREAM_WRITE_BYTES;+import static org.apache.hadoop.fs.statistics.StreamStatisticNames.STREAM_WRITE_EXCEPTIONS;+import static org.apache.hadoop.fs.statistics.impl.IOStatisticsBinding.iostatisticsStore;+/***************************************************************** Implement the FileSystem API for the raw local filesystem.*@@ -66,6 +83,7 @@ public class RawLocalFileSystem extends FileSystem {static final URI NAME = URI.create("file:///");private Path workingDir;+ private long defaultBlockSize;// Temporary workaround for HADOOP-9652.private static boolean useDeprecatedFileStatus = true;@@ -102,17 +120,36 @@ public class RawLocalFileSystem extends FileSystem {public void initialize(URI uri, Configuration conf) throws IOException {super.initialize(uri, conf);setConf(conf);+ defaultBlockSize = getDefaultBlockSize(new Path(uri));}/******************************************************** For open()'s FSInputStream.*******************************************************/- class LocalFSFileInputStream extends FSInputStream implements HasFileDescriptor {+ class LocalFSFileInputStream extends FSInputStream implements+ HasFileDescriptor, IOStatisticsSource, StreamCapabilities {private FileInputStream fis;private long position;+ /**+ * Minimal set of counters.+ */+ private final IOStatisticsStore ioStatistics = iostatisticsStore()+ .withCounters(+ STREAM_READ_BYTES,+ STREAM_READ_EXCEPTIONS,+ STREAM_READ_SEEK_OPERATIONS,+ STREAM_READ_SKIP_OPERATIONS,+ STREAM_READ_SKIP_BYTES)+ .build();++ /** Reference to the bytes read counter for slightly faster counting. */+ private final AtomicLong bytesRead;+public LocalFSFileInputStream(Path f) throws IOException {fis = new FileInputStream(pathToFile(f));+ bytesRead = ioStatistics.getCounterReference(+ STREAM_READ_BYTES);}@Override@@ -152,9 +189,11 @@ public class RawLocalFileSystem extends FileSystem {if (value >= 0) {this.position++;statistics.incrementBytesRead(1);+ bytesRead.addAndGet(1);}return value;} catch (IOException e) { // unexpected exception+ ioStatistics.incrementCounter(STREAM_READ_EXCEPTIONS);throw new FSError(e); // assume native fs error}}@@ -168,9 +207,11 @@ public class RawLocalFileSystem extends FileSystem {if (value > 0) {this.position += value;statistics.incrementBytesRead(value);+ bytesRead.addAndGet(value);}return value;} catch (IOException e) { // unexpected exception+ ioStatistics.incrementCounter(STREAM_READ_EXCEPTIONS);throw new FSError(e); // assume native fs error}}@@ -189,18 +230,22 @@ public class RawLocalFileSystem extends FileSystem {int value = fis.getChannel().read(bb, position);if (value > 0) {statistics.incrementBytesRead(value);+ ioStatistics.incrementCounter(STREAM_READ_BYTES, value);}return value;} catch (IOException e) {+ ioStatistics.incrementCounter(STREAM_READ_EXCEPTIONS);throw new FSError(e);}}@Overridepublic long skip(long n) throws IOException {+ ioStatistics.incrementCounter(STREAM_READ_SKIP_OPERATIONS);long value = fis.skip(n);if (value > 0) {this.position += value;+ ioStatistics.incrementCounter(STREAM_READ_SKIP_BYTES, value);}return value;}@@ -209,6 +254,23 @@ public class RawLocalFileSystem extends FileSystem {public FileDescriptor getFileDescriptor() throws IOException {return fis.getFD();}++ @Override+ public boolean hasCapability(String capability) {+ // a bit inefficient, but intended to make it easier to add+ // new capabilities.+ switch (capability.toLowerCase(Locale.ENGLISH)) {+ case StreamCapabilities.IOSTATISTICS:+ return true;+ default:+ return false;+ }+ }++ @Override+ public IOStatistics getIOStatistics() {+ return ioStatistics;+ }}@Override@@ -233,9 +295,19 @@ public class RawLocalFileSystem extends FileSystem {/********************************************************** For create()'s FSOutputStream.*********************************************************/- class LocalFSFileOutputStream extends OutputStream {+ final class LocalFSFileOutputStream extends OutputStream implements+ IOStatisticsSource, StreamCapabilities, Syncable {private FileOutputStream fos;+ /**+ * Minimal set of counters.+ */+ private final IOStatisticsStore ioStatistics = iostatisticsStore()+ .withCounters(+ STREAM_WRITE_BYTES,+ STREAM_WRITE_EXCEPTIONS)+ .build();+private LocalFSFileOutputStream(Path f, boolean append,FsPermission permission) throws IOException {File file = pathToFile(f);@@ -275,7 +347,9 @@ public class RawLocalFileSystem extends FileSystem {public void write(byte[] b, int off, int len) throws IOException {try {fos.write(b, off, len);+ ioStatistics.incrementCounter(STREAM_WRITE_BYTES, len);} catch (IOException e) { // unexpected exception+ ioStatistics.incrementCounter(STREAM_WRITE_EXCEPTIONS);throw new FSError(e); // assume native fs error}}@@ -284,10 +358,44 @@ public class RawLocalFileSystem extends FileSystem {public void write(int b) throws IOException {try {fos.write(b);+ ioStatistics.incrementCounter(STREAM_WRITE_BYTES);} catch (IOException e) { // unexpected exception+ ioStatistics.incrementCounter(STREAM_WRITE_EXCEPTIONS);throw new FSError(e); // assume native fs error}}++ @Override+ public void hflush() throws IOException {+ flush();+ }++ /**+ * HSync calls sync on fhe file descriptor after a local flush() call.+ * @throws IOException failure+ */+ @Override+ public void hsync() throws IOException {+ flush();+ fos.getFD().sync();+ }++ @Override+ public boolean hasCapability(String capability) {+ // a bit inefficient, but intended to make it easier to add+ // new capabilities.+ switch (capability.toLowerCase(Locale.ENGLISH)) {+ case StreamCapabilities.IOSTATISTICS:+ return true;+ default:+ return StoreImplementationUtils.isProbeForSyncable(capability);+ }+ }++ @Override+ public IOStatistics getIOStatistics() {+ return ioStatistics;+ }}@Override@@ -320,8 +428,8 @@ public class RawLocalFileSystem extends FileSystem {if (parent != null && !mkdirs(parent)) {throw new IOException("Mkdirs failed to create " + parent.toString());}- return new FSDataOutputStream(new BufferedOutputStream(- createOutputStreamWithMode(f, false, permission), bufferSize),+ return new FSDataOutputStream(new BufferedIOStatisticsOutputStream(+ createOutputStreamWithMode(f, false, permission), bufferSize, true),statistics);}@@ -342,8 +450,8 @@ public class RawLocalFileSystem extends FileSystem {if (exists(f) && !flags.contains(CreateFlag.OVERWRITE)) {throw new FileAlreadyExistsException("File already exists: " + f);}- return new FSDataOutputStream(new BufferedOutputStream(- createOutputStreamWithMode(f, false, permission), bufferSize),+ return new FSDataOutputStream(new BufferedIOStatisticsOutputStream(+ createOutputStreamWithMode(f, false, permission), bufferSize, true),statistics);}@@ -520,7 +628,12 @@ public class RawLocalFileSystem extends FileSystem {}return new FileStatus[] {new DeprecatedRawLocalFileStatus(localf,- getDefaultBlockSize(f), this) };+ defaultBlockSize, this) };+ }++ @Override+ public boolean exists(Path f) throws IOException {+ return pathToFile(f).exists();}protected boolean mkOneDir(File p2f) throws IOException {@@ -665,7 +778,7 @@ public class RawLocalFileSystem extends FileSystem {File path = pathToFile(f);if (path.exists()) {return new DeprecatedRawLocalFileStatus(pathToFile(f),- getDefaultBlockSize(f), this);+ defaultBlockSize, this);} else {throw new FileNotFoundException("File " + f + " does not exist");}@@ -1033,8 +1146,9 @@ public class RawLocalFileSystem extends FileSystem {private FileStatus getNativeFileLinkStatus(final Path f,boolean dereference) throws IOException {checkPath(f);- Stat stat = new Stat(f, getDefaultBlockSize(f), dereference, this);- return stat.getFileStatus();+ Stat stat = new Stat(f, defaultBlockSize, dereference, this);+ FileStatus status = stat.getFileStatus();+ return status;}@Override@@ -1043,4 +1157,21 @@ public class RawLocalFileSystem extends FileSystem {// return an unqualified symlink targetreturn fi.getSymlink();}++ @Override+ public boolean hasPathCapability(final Path path, final String capability)+ throws IOException {+ switch (validatePathCapabilityArgs(makeQualified(path), capability)) {+ case CommonPathCapabilities.FS_APPEND:+ case CommonPathCapabilities.FS_CONCAT:+ case CommonPathCapabilities.FS_PATHHANDLES:+ case CommonPathCapabilities.FS_PERMISSIONS:+ case CommonPathCapabilities.FS_TRUNCATE:+ return true;+ case CommonPathCapabilities.FS_SYMLINKS:+ return FileSystem.areSymlinksEnabled();+ default:+ return super.hasPathCapability(path, capability);+ }+ }}diff --git a/solr/modules/hdfs/src/test/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java b/solr/modules/hdfs/src/test/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.javaindex 26c3d3c6f76..d502203e0d9 100644--- a/solr/modules/hdfs/src/test/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java+++ b/solr/modules/hdfs/src/test/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java@@ -40,6 +40,8 @@ import java.util.concurrent.ForkJoinPool;import java.util.concurrent.ForkJoinTask;import java.util.concurrent.RecursiveAction;import java.util.concurrent.atomic.AtomicLong;+import java.util.concurrent.locks.ReentrantReadWriteLock;+import java.util.concurrent.TimeUnit;import org.slf4j.Logger;import org.slf4j.LoggerFactory;@@ -61,8 +63,8 @@ import org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.RamDiskReplicaTrackimport org.apache.hadoop.hdfs.server.datanode.fsdataset.ReplicaInputStreams;import org.apache.hadoop.io.IOUtils;import org.apache.hadoop.io.MultipleIOException;-import org.apache.hadoop.util.AutoCloseableLock;import org.apache.hadoop.util.DataChecksum;+import org.apache.hadoop.util.DataChecksum.Type;import org.apache.hadoop.util.DiskChecker;import org.apache.hadoop.util.DiskChecker.DiskErrorException;import org.apache.hadoop.util.ShutdownHookManager;@@ -100,7 +102,8 @@ public class BlockPoolSlice {private static final int SHUTDOWN_HOOK_PRIORITY = 30;private final boolean deleteDuplicateReplicas;private static final String REPLICA_CACHE_FILE = "replicas";- private final long replicaCacheExpiry = 5*60*1000;+ private final long replicaCacheExpiry;+ private final File replicaCacheDir;private AtomicLong numOfBlocks = new AtomicLong();private final long cachedDfsUsedCheckTime;private final Timer timer;@@ -174,9 +177,27 @@ public class BlockPoolSlice {fileIoProvider.mkdirs(volume, rbwDir);fileIoProvider.mkdirs(volume, tmpDir);+ String cacheDirRoot = conf.get(+ DFSConfigKeys.DFS_DATANODE_REPLICA_CACHE_ROOT_DIR_KEY);+ if (cacheDirRoot != null && !cacheDirRoot.isEmpty()) {+ this.replicaCacheDir = new File(cacheDirRoot,+ currentDir.getCanonicalPath());+ if (!this.replicaCacheDir.exists()) {+ if (!this.replicaCacheDir.mkdirs()) {+ throw new IOException("Failed to mkdirs " + this.replicaCacheDir);+ }+ }+ } else {+ this.replicaCacheDir = currentDir;+ }+ this.replicaCacheExpiry = conf.getTimeDuration(+ DFSConfigKeys.DFS_DATANODE_REPLICA_CACHE_EXPIRY_TIME_KEY,+ DFSConfigKeys.DFS_DATANODE_REPLICA_CACHE_EXPIRY_TIME_DEFAULT,+ TimeUnit.MILLISECONDS);+if (addReplicaThreadPool == null) {// initialize add replica fork join pool- initializeAddReplicaPool(conf);+ initializeAddReplicaPool(conf, (FsDatasetImpl) volume.getDataset());}// Make the dfs usage to be saved during shutdown.shutdownHook = new Runnable() {@@ -189,9 +210,9 @@ public class BlockPoolSlice {SHUTDOWN_HOOK_PRIORITY);}- private synchronized void initializeAddReplicaPool(Configuration conf) {+ private synchronized static void initializeAddReplicaPool(Configuration conf,+ FsDatasetImpl dataset) {if (addReplicaThreadPool == null) {- FsDatasetImpl dataset = (FsDatasetImpl) volume.getDataset();int numberOfBlockPoolSlice = dataset.getVolumeCount()* dataset.getBPServiceCount();int poolsize = Math.max(numberOfBlockPoolSlice,@@ -697,6 +718,10 @@ public class BlockPoolSlice {// read and handle the common header here. For now just a versionfinal DataChecksum checksum = BlockMetadataHeader.readDataChecksum(checksumIn, metaFile);+ if (Type.NULL.equals(checksum.getChecksumType())) {+ // in case of NULL checksum type consider full file as valid+ return blockFileLen;+ }int bytesPerChecksum = checksum.getBytesPerChecksum();int checksumSize = checksum.getChecksumSize();long numChunks = Math.min(@@ -759,8 +784,8 @@ public class BlockPoolSlice {private boolean readReplicasFromCache(ReplicaMap volumeMap,final RamDiskReplicaTracker lazyWriteReplicaMap) {- ReplicaMap tmpReplicaMap = new ReplicaMap(new AutoCloseableLock());- File replicaFile = new File(currentDir, REPLICA_CACHE_FILE);+ ReplicaMap tmpReplicaMap = new ReplicaMap(new ReentrantReadWriteLock());+ File replicaFile = new File(replicaCacheDir, REPLICA_CACHE_FILE);// Check whether the file exists or not.if (!replicaFile.exists()) {if (LOG.isInfoEnabled()) {@@ -844,8 +869,8 @@ public class BlockPoolSlice {blocksListToPersist.getNumberOfBlocks()== 0) {return;}- final File tmpFile = new File(currentDir, REPLICA_CACHE_FILE + ".tmp");- final File replicaCacheFile = new File(currentDir, REPLICA_CACHE_FILE);+ final File tmpFile = new File(replicaCacheDir, REPLICA_CACHE_FILE + ".tmp");+ final File replicaCacheFile = new File(replicaCacheDir, REPLICA_CACHE_FILE);if (!fileIoProvider.deleteWithExistsCheck(volume, tmpFile) ||!fileIoProvider.deleteWithExistsCheck(volume, replicaCacheFile)) {return;@@ -939,4 +964,15 @@ public class BlockPoolSlice {public static int getAddReplicaForkPoolSize() {return addReplicaThreadPool.getPoolSize();}++ @VisibleForTesting+ public ForkJoinPool getAddReplicaThreadPool() {+ return addReplicaThreadPool;+ }++ @VisibleForTesting+ public static void reInitializeAddReplicaThreadPool() {+ addReplicaThreadPool.shutdown();+ addReplicaThreadPool = null;+ }}diff --git a/solr/modules/hdfs/src/test/org/apache/hadoop/http/HttpServer2.java b/solr/modules/hdfs/src/test/org/apache/hadoop/http/HttpServer2.javadeleted file mode 100644index d9da3f5491d..00000000000--- a/solr/modules/hdfs/src/test/org/apache/hadoop/http/HttpServer2.java+++ /dev/null@@ -1,1687 +0,0 @@-/*- * Licensed to the Apache Software Foundation (ASF) under one- * or more contributor license agreements. See the NOTICE file- * distributed with this work for additional information- * regarding copyright ownership. The ASF licenses this file- * to you under the Apache License, Version 2.0 (the- * "License"); you may not use this file except in compliance- * with the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package org.apache.hadoop.http;--import java.io.File;-import java.io.FileNotFoundException;-import java.io.IOException;-import java.io.InterruptedIOException;-import java.io.PrintStream;-import java.net.BindException;-import java.net.InetSocketAddress;-import java.net.MalformedURLException;-import java.net.URI;-import java.net.URL;-import java.util.ArrayList;-import java.util.Collections;-import java.util.Enumeration;-import java.util.HashMap;-import java.util.List;-import java.util.Map;-import java.util.Locale;-import java.util.Properties;-import java.util.regex.Matcher;-import java.util.regex.Pattern;--import javax.servlet.Filter;-import javax.servlet.FilterChain;-import javax.servlet.FilterConfig;-import javax.servlet.ServletContext;-import javax.servlet.ServletException;-import javax.servlet.ServletRequest;-import javax.servlet.ServletResponse;-import javax.servlet.http.HttpServlet;-import javax.servlet.http.HttpServletRequest;-import javax.servlet.http.HttpServletRequestWrapper;-import javax.servlet.http.HttpServletResponse;--import com.google.common.base.Preconditions;-import com.google.common.collect.ImmutableMap;-import com.google.common.collect.Lists;-import com.sun.jersey.spi.container.servlet.ServletContainer;-import org.apache.hadoop.HadoopIllegalArgumentException;-import org.apache.hadoop.classification.InterfaceAudience;-import org.apache.hadoop.classification.InterfaceStability;-import org.apache.hadoop.conf.ConfServlet;-import org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.conf.Configuration.IntegerRanges;-import org.apache.hadoop.fs.CommonConfigurationKeys;-import org.apache.hadoop.jmx.JMXJsonServlet;-import org.apache.hadoop.log.LogLevel;-import org.apache.hadoop.security.AuthenticationFilterInitializer;-import org.apache.hadoop.security.SecurityUtil;-import org.apache.hadoop.security.UserGroupInformation;-import org.apache.hadoop.security.authentication.server.AuthenticationFilter;-import org.apache.hadoop.security.authentication.util.SignerSecretProvider;-import org.apache.hadoop.security.authorize.AccessControlList;-import org.apache.hadoop.security.ssl.SSLFactory;-import org.apache.hadoop.util.ReflectionUtils;-import org.apache.hadoop.util.Shell;-import org.apache.hadoop.util.StringUtils;-import org.eclipse.jetty.http.HttpVersion;-import org.eclipse.jetty.server.ConnectionFactory;-import org.eclipse.jetty.server.Connector;-import org.eclipse.jetty.server.Handler;-import org.eclipse.jetty.server.HttpConfiguration;-import org.eclipse.jetty.server.HttpConnectionFactory;-import org.eclipse.jetty.server.RequestLog;-import org.eclipse.jetty.server.SecureRequestCustomizer;-import org.eclipse.jetty.server.Server;-import org.eclipse.jetty.server.ServerConnector;-import org.eclipse.jetty.server.SslConnectionFactory;-import org.eclipse.jetty.server.handler.ContextHandlerCollection;-import org.eclipse.jetty.server.handler.HandlerCollection;-import org.eclipse.jetty.server.handler.RequestLogHandler;-import org.eclipse.jetty.server.session.SessionHandler;-import org.eclipse.jetty.servlet.DefaultServlet;-import org.eclipse.jetty.servlet.FilterHolder;-import org.eclipse.jetty.servlet.FilterMapping;-import org.eclipse.jetty.servlet.ServletContextHandler;-import org.eclipse.jetty.servlet.ServletHandler;-import org.eclipse.jetty.servlet.ServletHolder;-import org.eclipse.jetty.servlet.ServletMapping;-import org.eclipse.jetty.util.ArrayUtil;-import org.eclipse.jetty.util.MultiException;-import org.eclipse.jetty.util.ssl.SslContextFactory;-import org.eclipse.jetty.util.thread.QueuedThreadPool;-import org.eclipse.jetty.webapp.WebAppContext;-import org.slf4j.Logger;-import org.slf4j.LoggerFactory;--/**- * Create a Jetty embedded server to answer http requests. The primary goal is- * to serve up status information for the server. There are three contexts:- * "/logs/" points to the log directory "/static/" points to common static- * files (src/webapps/static) "/" the jsp server code from- * (src/webapps/NAME)- *- * This class is a fork of the old HttpServer. HttpServer exists for- * compatibility reasons. See HBASE-10336 for more details.- */-public final class HttpServer2 implements FilterContainer {- public static final Object SOLR_HACK_FOR_CLASS_VERIFICATION = new Object();-- // Apparently the Hadoop code expectes upper-case LOG, so...- public static final Logger LOG = LoggerFactory.getLogger(HttpServer2.class); // nowarn_valid_logger-- public static final String HTTP_SCHEME = "http";- public static final String HTTPS_SCHEME = "https";-- public static final String HTTP_MAX_REQUEST_HEADER_SIZE_KEY =- "hadoop.http.max.request.header.size";- public static final int HTTP_MAX_REQUEST_HEADER_SIZE_DEFAULT = 65536;- public static final String HTTP_MAX_RESPONSE_HEADER_SIZE_KEY =- "hadoop.http.max.response.header.size";- public static final int HTTP_MAX_RESPONSE_HEADER_SIZE_DEFAULT = 65536;-- public static final String HTTP_SOCKET_BACKLOG_SIZE_KEY =- "hadoop.http.socket.backlog.size";- public static final int HTTP_SOCKET_BACKLOG_SIZE_DEFAULT = 128;- public static final String HTTP_MAX_THREADS_KEY = "hadoop.http.max.threads";- public static final String HTTP_ACCEPTOR_COUNT_KEY =- "hadoop.http.acceptor.count";- // -1 to use default behavior of setting count based on CPU core count- public static final int HTTP_ACCEPTOR_COUNT_DEFAULT = -1;- public static final String HTTP_SELECTOR_COUNT_KEY =- "hadoop.http.selector.count";- // -1 to use default behavior of setting count based on CPU core count- public static final int HTTP_SELECTOR_COUNT_DEFAULT = -1;- // idle timeout in milliseconds- public static final String HTTP_IDLE_TIMEOUT_MS_KEY =- "hadoop.http.idle_timeout.ms";- public static final int HTTP_IDLE_TIMEOUT_MS_DEFAULT = 10000;- public static final String HTTP_TEMP_DIR_KEY = "hadoop.http.temp.dir";-- public static final String FILTER_INITIALIZER_PROPERTY- = "hadoop.http.filter.initializers";-- // The ServletContext attribute where the daemon Configuration- // gets stored.- public static final String CONF_CONTEXT_ATTRIBUTE = "hadoop.conf";- public static final String ADMINS_ACL = "admins.acl";- public static final String SPNEGO_FILTER = "SpnegoFilter";- public static final String NO_CACHE_FILTER = "NoCacheFilter";-- public static final String BIND_ADDRESS = "bind.address";-- private final AccessControlList adminsAcl;-- protected final Server webServer;-- private final HandlerCollection handlers;-- private final List<ServerConnector> listeners = Lists.newArrayList();-- protected final WebAppContext webAppContext;- protected final boolean findPort;- protected final IntegerRanges portRanges;- private final Map<ServletContextHandler, Boolean> defaultContexts =- new HashMap<>();- protected final List<String> filterNames = new ArrayList<>();- static final String STATE_DESCRIPTION_ALIVE = " - alive";- static final String STATE_DESCRIPTION_NOT_LIVE = " - not live";- private final SignerSecretProvider secretProvider;- private XFrameOption xFrameOption;- private boolean xFrameOptionIsEnabled;- public static final String HTTP_HEADER_PREFIX = "hadoop.http.header.";- private static final String HTTP_HEADER_REGEX =- "hadoop\\.http\\.header\\.([a-zA-Z\\-_]+)";- static final String X_XSS_PROTECTION =- "X-XSS-Protection:1; mode=block";- static final String X_CONTENT_TYPE_OPTIONS =- "X-Content-Type-Options:nosniff";- private static final String X_FRAME_OPTIONS = "X-FRAME-OPTIONS";- private static final Pattern PATTERN_HTTP_HEADER_REGEX =- Pattern.compile(HTTP_HEADER_REGEX);- /**- * Class to construct instances of HTTP server with specific options.- */- public static class Builder {- private ArrayList<URI> endpoints = Lists.newArrayList();- private String name;- private Configuration conf;- private Configuration sslConf;- private String[] pathSpecs;- private AccessControlList adminsAcl;- private boolean securityEnabled = false;- private String usernameConfKey;- private String keytabConfKey;- private boolean needsClientAuth;- private String trustStore;- private String trustStorePassword;- private String trustStoreType;-- private String keyStore;- private String keyStorePassword;- private String keyStoreType;-- // The -keypass option in keytool- private String keyPassword;-- private boolean findPort;- private IntegerRanges portRanges = null;-- private String hostName;- private boolean disallowFallbackToRandomSignerSecretProvider;- private String authFilterConfigurationPrefix = "hadoop.http.authentication.";- private String excludeCiphers;-- private boolean xFrameEnabled;- private XFrameOption xFrameOption = XFrameOption.SAMEORIGIN;-- public Builder setName(String name){- this.name = name;- return this;- }-- /**- * Add an endpoint that the HTTP server should listen to.- *- * @param endpoint- * the endpoint of that the HTTP server should listen to. The- * scheme specifies the protocol (i.e. HTTP / HTTPS), the host- * specifies the binding address, and the port specifies the- * listening port. Unspecified or zero port means that the server- * can listen to any port.- */- public Builder addEndpoint(URI endpoint) {- endpoints.add(endpoint);- return this;- }-- /**- * Set the hostname of the http server. The host name is used to resolve the- * _HOST field in Kerberos principals. The hostname of the first listener- * will be used if the name is unspecified.- */- public Builder hostName(String hostName) {- this.hostName = hostName;- return this;- }-- public Builder trustStore(String location, String password, String type) {- this.trustStore = location;- this.trustStorePassword = password;- this.trustStoreType = type;- return this;- }-- public Builder keyStore(String location, String password, String type) {- this.keyStore = location;- this.keyStorePassword = password;- this.keyStoreType = type;- return this;- }-- public Builder keyPassword(String password) {- this.keyPassword = password;- return this;- }-- /**- * Specify whether the server should authorize the client in SSL- * connections.- */- public Builder needsClientAuth(boolean value) {- this.needsClientAuth = value;- return this;- }-- public Builder setFindPort(boolean findPort) {- this.findPort = findPort;- return this;- }-- public Builder setPortRanges(IntegerRanges ranges) {- this.portRanges = ranges;- return this;- }-- public Builder setConf(Configuration conf) {- this.conf = conf;- return this;- }-- /**- * Specify the SSL configuration to load. This API provides an alternative- * to keyStore/keyPassword/trustStore.- */- public Builder setSSLConf(Configuration sslCnf) {- this.sslConf = sslCnf;- return this;- }-- public Builder setPathSpec(String[] pathSpec) {- this.pathSpecs = pathSpec;- return this;- }-- public Builder setACL(AccessControlList acl) {- this.adminsAcl = acl;- return this;- }-- public Builder setSecurityEnabled(boolean securityEnabled) {- this.securityEnabled = securityEnabled;- return this;- }-- public Builder setUsernameConfKey(String usernameConfKey) {- this.usernameConfKey = usernameConfKey;- return this;- }-- public Builder setKeytabConfKey(String keytabConfKey) {- this.keytabConfKey = keytabConfKey;- return this;- }-- public Builder disallowFallbackToRandomSingerSecretProvider(boolean value) {- this.disallowFallbackToRandomSignerSecretProvider = value;- return this;- }-- public Builder authFilterConfigurationPrefix(String value) {- this.authFilterConfigurationPrefix = value;- return this;- }-- public Builder excludeCiphers(String pExcludeCiphers) {- this.excludeCiphers = pExcludeCiphers;- return this;- }-- /**- * Adds the ability to control X_FRAME_OPTIONS on HttpServer2.- * @param xFrameEnabled - True enables X_FRAME_OPTIONS false disables it.- * @return Builder.- */- public Builder configureXFrame(boolean xFrameEnabled) {- this.xFrameEnabled = xFrameEnabled;- return this;- }-- /**- * Sets a valid X-Frame-option that can be used by HttpServer2.- * @param option - String DENY, SAMEORIGIN or ALLOW-FROM are the only valid- * options. Any other value will throw IllegalArgument- * Exception.- * @return Builder.- */- public Builder setXFrameOption(String option) {- this.xFrameOption = XFrameOption.getEnum(option);- return this;- }-- /**- * A wrapper of {@link Configuration#getPassword(String)}. It returns- * <code>String</code> instead of <code>char[]</code>.- *- * @param conf the configuration- * @param name the property name- * @return the password string or null- */- private static String getPasswordString(Configuration conf, String name)- throws IOException {- char[] passchars = conf.getPassword(name);- if (passchars == null) {- return null;- }- return new String(passchars);- }-- /**- * Load SSL properties from the SSL configuration.- */- private void loadSSLConfiguration() throws IOException {- if (sslConf == null) {- return;- }- needsClientAuth = sslConf.getBoolean(- SSLFactory.SSL_SERVER_NEED_CLIENT_AUTH,- SSLFactory.SSL_SERVER_NEED_CLIENT_AUTH_DEFAULT);- keyStore = sslConf.getTrimmed(SSLFactory.SSL_SERVER_KEYSTORE_LOCATION);- if (keyStore == null || keyStore.isEmpty()) {- throw new IOException(String.format(Locale.ROOT, "Property %s not specified",- SSLFactory.SSL_SERVER_KEYSTORE_LOCATION));- }- keyStorePassword = getPasswordString(sslConf,- SSLFactory.SSL_SERVER_KEYSTORE_PASSWORD);- if (keyStorePassword == null) {- throw new IOException(String.format(Locale.ROOT, "Property %s not specified",- SSLFactory.SSL_SERVER_KEYSTORE_PASSWORD));- }- keyStoreType = sslConf.get(SSLFactory.SSL_SERVER_KEYSTORE_TYPE,- SSLFactory.SSL_SERVER_KEYSTORE_TYPE_DEFAULT);- keyPassword = getPasswordString(sslConf,- SSLFactory.SSL_SERVER_KEYSTORE_KEYPASSWORD);- trustStore = sslConf.get(SSLFactory.SSL_SERVER_TRUSTSTORE_LOCATION);- trustStorePassword = getPasswordString(sslConf,- SSLFactory.SSL_SERVER_TRUSTSTORE_PASSWORD);- trustStoreType = sslConf.get(SSLFactory.SSL_SERVER_TRUSTSTORE_TYPE,- SSLFactory.SSL_SERVER_TRUSTSTORE_TYPE_DEFAULT);- excludeCiphers = sslConf.get(SSLFactory.SSL_SERVER_EXCLUDE_CIPHER_LIST);- }-- public HttpServer2 build() throws IOException {- Preconditions.checkNotNull(name, "name is not set");- Preconditions.checkState(!endpoints.isEmpty(), "No endpoints specified");-- if (hostName == null) {- hostName = endpoints.get(0).getHost();- }-- if (this.conf == null) {- conf = new Configuration();- }-- HttpServer2 server = new HttpServer2(this);-- if (this.securityEnabled) {- server.initSpnego(conf, hostName, usernameConfKey, keytabConfKey);- }-- for (URI ep : endpoints) {- if (HTTPS_SCHEME.equals(ep.getScheme())) {- loadSSLConfiguration();- break;- }- }-- int requestHeaderSize = conf.getInt(- HTTP_MAX_REQUEST_HEADER_SIZE_KEY,- HTTP_MAX_REQUEST_HEADER_SIZE_DEFAULT);- int responseHeaderSize = conf.getInt(- HTTP_MAX_RESPONSE_HEADER_SIZE_KEY,- HTTP_MAX_RESPONSE_HEADER_SIZE_DEFAULT);- int idleTimeout = conf.getInt(HTTP_IDLE_TIMEOUT_MS_KEY,- HTTP_IDLE_TIMEOUT_MS_DEFAULT);-- HttpConfiguration httpConfig = new HttpConfiguration();- httpConfig.setRequestHeaderSize(requestHeaderSize);- httpConfig.setResponseHeaderSize(responseHeaderSize);- httpConfig.setSendServerVersion(false);-- int backlogSize = conf.getInt(HTTP_SOCKET_BACKLOG_SIZE_KEY,- HTTP_SOCKET_BACKLOG_SIZE_DEFAULT);-- for (URI ep : endpoints) {- final ServerConnector connector;- String scheme = ep.getScheme();- if (HTTP_SCHEME.equals(scheme)) {- connector = createHttpChannelConnector(server.webServer,- httpConfig);- } else if (HTTPS_SCHEME.equals(scheme)) {- connector = createHttpsChannelConnector(server.webServer,- httpConfig);- } else {- throw new HadoopIllegalArgumentException(- "unknown scheme for endpoint:" + ep);- }- connector.setHost(ep.getHost());- connector.setPort(ep.getPort() == -1 ? 0 : ep.getPort());- connector.setAcceptQueueSize(backlogSize);- connector.setIdleTimeout(idleTimeout);- server.addListener(connector);- }- server.loadListeners();- return server;- }-- private ServerConnector createHttpChannelConnector(- Server server, HttpConfiguration httpConfig) {- ServerConnector conn = new ServerConnector(server,- conf.getInt(HTTP_ACCEPTOR_COUNT_KEY, HTTP_ACCEPTOR_COUNT_DEFAULT),- conf.getInt(HTTP_SELECTOR_COUNT_KEY, HTTP_SELECTOR_COUNT_DEFAULT));- ConnectionFactory connFactory = new HttpConnectionFactory(httpConfig);- conn.addConnectionFactory(connFactory);- if(Shell.WINDOWS) {- // result of setting the SO_REUSEADDR flag is different on Windows- // http://msdn.microsoft.com/en-us/library/ms740621(v=vs.85).aspx- // without this 2 NN's can start on the same machine and listen on- // the same port with indeterminate routing of incoming requests to them- conn.setReuseAddress(false);- }- return conn;- }-- private ServerConnector createHttpsChannelConnector(- Server server, HttpConfiguration httpConfig) {- httpConfig.setSecureScheme(HTTPS_SCHEME);- httpConfig.addCustomizer(new SecureRequestCustomizer());- ServerConnector conn = createHttpChannelConnector(server, httpConfig);-- SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();- sslContextFactory.setNeedClientAuth(needsClientAuth);- sslContextFactory.setKeyManagerPassword(keyPassword);- if (keyStore != null) {- sslContextFactory.setKeyStorePath(keyStore);- sslContextFactory.setKeyStoreType(keyStoreType);- sslContextFactory.setKeyStorePassword(keyStorePassword);- }- if (trustStore != null) {- sslContextFactory.setTrustStorePath(trustStore);- sslContextFactory.setTrustStoreType(trustStoreType);- sslContextFactory.setTrustStorePassword(trustStorePassword);- }- if(null != excludeCiphers && !excludeCiphers.isEmpty()) {- sslContextFactory.setExcludeCipherSuites(- StringUtils.getTrimmedStrings(excludeCiphers));- LOG.info("Excluded Cipher List:{}", excludeCiphers);- }-- conn.addFirstConnectionFactory(new SslConnectionFactory(sslContextFactory,- HttpVersion.HTTP_1_1.asString()));-- return conn;- }- }-- private HttpServer2(final Builder b) throws IOException {- final String appDir = getWebAppsPath(b.name);- this.webServer = new Server();- this.adminsAcl = b.adminsAcl;- this.handlers = new HandlerCollection();- this.webAppContext = createWebAppContext(b, adminsAcl, appDir);- this.xFrameOptionIsEnabled = b.xFrameEnabled;- this.xFrameOption = b.xFrameOption;-- try {- this.secretProvider =- constructSecretProvider(b, webAppContext.getServletContext());- this.webAppContext.getServletContext().setAttribute- (AuthenticationFilter.SIGNER_SECRET_PROVIDER_ATTRIBUTE,- secretProvider);- } catch(IOException e) {- throw e;- } catch (Exception e) {- throw new IOException(e);- }-- this.findPort = b.findPort;- this.portRanges = b.portRanges;- initializeWebServer(b.name, b.hostName, b.conf, b.pathSpecs);- }-- private void initializeWebServer(String name, String hostName,- Configuration conf, String[] pathSpecs)- throws IOException {-- Preconditions.checkNotNull(webAppContext);-- int maxThreads = conf.getInt(HTTP_MAX_THREADS_KEY, -1);- // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the- // default value (currently 250).-- QueuedThreadPool threadPool = (QueuedThreadPool) webServer.getThreadPool();- threadPool.setDaemon(true);- if (maxThreads != -1) {- // Minimum number of threads must be > 3.- // DatanodeHttpServer sets the HTTP_MAX_THREADS_KEY to 3- threadPool.setMaxThreads(Math.max(maxThreads, 4));- }-- SessionHandler sessionHandler = webAppContext.getSessionHandler();- sessionHandler.setHttpOnly(true);- sessionHandler.getSessionCookieConfig().setSecure(true);-- ContextHandlerCollection contexts = new ContextHandlerCollection();- RequestLog requestLog = HttpRequestLog.getRequestLog(name);-- handlers.addHandler(contexts);- if (requestLog != null) {- RequestLogHandler requestLogHandler = new RequestLogHandler();- requestLogHandler.setRequestLog(requestLog);- handlers.addHandler(requestLogHandler);- }- handlers.addHandler(webAppContext);- final String appDir = getWebAppsPath(name);- addDefaultApps(contexts, appDir, conf);- webServer.setHandler(handlers);-- Map<String, String> xFrameParams = setHeaders(conf);- addGlobalFilter("safety", QuotingInputFilter.class.getName(), xFrameParams);- final FilterInitializer[] initializers = getFilterInitializers(conf);- if (initializers != null) {- conf = new Configuration(conf);- conf.set(BIND_ADDRESS, hostName);- for (FilterInitializer c : initializers) {- c.initFilter(this, conf);- }- }-- addDefaultServlets();-- if (pathSpecs != null) {- for (String path : pathSpecs) {- LOG.info("adding path spec: {}", path);- addFilterPathMapping(path, webAppContext);- }- }- }-- private void addListener(ServerConnector connector) {- listeners.add(connector);- }-- private static WebAppContext createWebAppContext(Builder b,- AccessControlList adminsAcl, final String appDir) {- WebAppContext ctx = new WebAppContext();- ctx.setDefaultsDescriptor(null);- ServletHolder holder = new ServletHolder(new DefaultServlet());- Map<String, String> params = ImmutableMap. <String, String> builder()- .put("acceptRanges", "true")- .put("dirAllowed", "false")- .put("gzip", "true")- .put("useFileMappedBuffer", "true")- .build();- holder.setInitParameters(params);- ctx.setWelcomeFiles(new String[] {"index.html"});- ctx.addServlet(holder, "/");- ctx.setDisplayName(b.name);- ctx.setContextPath("/");- ctx.setWar(appDir + "/" + b.name);- String tempDirectory = b.conf.get(HTTP_TEMP_DIR_KEY);- if (tempDirectory != null && !tempDirectory.isEmpty()) {- ctx.setTempDirectory(new File(tempDirectory));- ctx.setAttribute("javax.servlet.context.tempdir", tempDirectory);- }- ctx.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, b.conf);- ctx.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);- addNoCacheFilter(ctx);- return ctx;- }-- private static SignerSecretProvider constructSecretProvider(final Builder b,- ServletContext ctx)- throws Exception {- final Configuration conf = b.conf;- Properties config = getFilterProperties(conf,- b.authFilterConfigurationPrefix);- return AuthenticationFilter.constructSecretProvider(- ctx, config, b.disallowFallbackToRandomSignerSecretProvider);- }-- private static Properties getFilterProperties(Configuration conf, String- prefix) {- Properties prop = new Properties();- Map<String, String> filterConfig = AuthenticationFilterInitializer- .getFilterConfigMap(conf, prefix);- prop.putAll(filterConfig);- return prop;- }-- private static void addNoCacheFilter(ServletContextHandler ctxt) {- defineFilter(ctxt, NO_CACHE_FILTER, NoCacheFilter.class.getName(),- Collections.<String, String> emptyMap(), new String[] { "/*" });- }-- /** Get an array of FilterConfiguration specified in the conf */- private static FilterInitializer[] getFilterInitializers(Configuration conf) {- if (conf == null) {- return null;- }-- Class<?>[] classes = conf.getClasses(FILTER_INITIALIZER_PROPERTY);- if (classes == null) {- return null;- }-- FilterInitializer[] initializers = new FilterInitializer[classes.length];- for(int i = 0; i < classes.length; i++) {- initializers[i] = (FilterInitializer)ReflectionUtils.newInstance(- classes[i], conf);- }- return initializers;- }-- /**- * Add default apps.- * @param appDir The application directory- */- protected void addDefaultApps(ContextHandlerCollection parent,- final String appDir, Configuration conf) {- // set up the context for "/logs/" if "hadoop.log.dir" property is defined- // and it's enabled.- String logDir = System.getProperty("hadoop.log.dir");- boolean logsEnabled = conf.getBoolean(- CommonConfigurationKeys.HADOOP_HTTP_LOGS_ENABLED,- CommonConfigurationKeys.HADOOP_HTTP_LOGS_ENABLED_DEFAULT);- if (logDir != null && logsEnabled) {- ServletContextHandler logContext =- new ServletContextHandler(parent, "/logs");- logContext.setResourceBase(logDir);- logContext.addServlet(AdminAuthorizedServlet.class, "/*");- if (conf.getBoolean(- CommonConfigurationKeys.HADOOP_JETTY_LOGS_SERVE_ALIASES,- CommonConfigurationKeys.DEFAULT_HADOOP_JETTY_LOGS_SERVE_ALIASES)) {- Map<String, String> params = logContext.getInitParams();- params.put("org.eclipse.jetty.servlet.Default.aliases", "true");- }- logContext.setDisplayName("logs");- SessionHandler handler = new SessionHandler();- handler.setHttpOnly(true);- handler.getSessionCookieConfig().setSecure(true);- logContext.setSessionHandler(handler);- setContextAttributes(logContext, conf);- addNoCacheFilter(logContext);- defaultContexts.put(logContext, true);- }- // set up the context for "/static/*"- ServletContextHandler staticContext =- new ServletContextHandler(parent, "/static");- staticContext.setResourceBase(appDir + "/static");- staticContext.addServlet(DefaultServlet.class, "/*");- staticContext.setDisplayName("static");- Map<String, String> params = staticContext.getInitParams();- params.put("org.eclipse.jetty.servlet.Default.dirAllowed", "false");- params.put("org.eclipse.jetty.servlet.Default.gzip", "true");- SessionHandler handler = new SessionHandler();- handler.setHttpOnly(true);- handler.getSessionCookieConfig().setSecure(true);- staticContext.setSessionHandler(handler);- setContextAttributes(staticContext, conf);- defaultContexts.put(staticContext, true);- }-- private void setContextAttributes(ServletContextHandler context,- Configuration conf) {- context.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);- context.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);- }-- /**- * Add default servlets.- */- protected void addDefaultServlets() {- // set up default servlets- addServlet("stacks", "/stacks", StackServlet.class);- addServlet("logLevel", "/logLevel", LogLevel.Servlet.class);- addServlet("jmx", "/jmx", JMXJsonServlet.class);- addServlet("conf", "/conf", ConfServlet.class);- }-- public void addContext(ServletContextHandler ctxt, boolean isFiltered) {- handlers.addHandler(ctxt);- addNoCacheFilter(ctxt);- defaultContexts.put(ctxt, isFiltered);- }-- /**- * Set a value in the webapp context. These values are available to the jsp- * pages as "application.getAttribute(name)".- * @param name The name of the attribute- * @param value The value of the attribute- */- public void setAttribute(String name, Object value) {- webAppContext.setAttribute(name, value);- }-- /**- * Add a Jersey resource package.- * @param packageName The Java package name containing the Jersey resource.- * @param pathSpec The path spec for the servlet- */- public void addJerseyResourcePackage(final String packageName,- final String pathSpec) {- LOG.info("addJerseyResourcePackage: packageName={}, pathcpec={}"- , packageName, pathSpec);- final ServletHolder sh = new ServletHolder(ServletContainer.class);- sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",- "com.sun.jersey.api.core.PackagesResourceConfig");- sh.setInitParameter("com.sun.jersey.config.property.packages", packageName);- webAppContext.addServlet(sh, pathSpec);- }-- /**- * Add a servlet in the server.- * @param name The name of the servlet (can be passed as null)- * @param pathSpec The path spec for the servlet- * @param clazz The servlet class- */- public void addServlet(String name, String pathSpec,- Class<? extends HttpServlet> clazz) {- addInternalServlet(name, pathSpec, clazz, false);- addFilterPathMapping(pathSpec, webAppContext);- }-- /**- * Add an internal servlet in the server.- * Note: This method is to be used for adding servlets that facilitate- * internal communication and not for user facing functionality. For- * servlets added using this method, filters are not enabled.- *- * @param name The name of the servlet (can be passed as null)- * @param pathSpec The path spec for the servlet- * @param clazz The servlet class- */- public void addInternalServlet(String name, String pathSpec,- Class<? extends HttpServlet> clazz) {- addInternalServlet(name, pathSpec, clazz, false);- }-- /**- * Add an internal servlet in the server, specifying whether or not to- * protect with Kerberos authentication.- * Note: This method is to be used for adding servlets that facilitate- * internal communication and not for user facing functionality. For- * servlets added using this method, filters (except internal Kerberos- * filters) are not enabled.- *- * @param name The name of the servlet (can be passed as null)- * @param pathSpec The path spec for the servlet- * @param clazz The servlet class- * @param requireAuth Require Kerberos authenticate to access servlet- */- public void addInternalServlet(String name, String pathSpec,- Class<? extends HttpServlet> clazz, boolean requireAuth) {- ServletHolder holder = new ServletHolder(clazz);- if (name != null) {- holder.setName(name);- }- // Jetty doesn't like the same path spec mapping to different servlets, so- // if there's already a mapping for this pathSpec, remove it and assume that- // the newest one is the one we want- final ServletMapping[] servletMappings =- webAppContext.getServletHandler().getServletMappings();- for (int i = 0; i < servletMappings.length; i++) {- if (servletMappings[i].containsPathSpec(pathSpec)) {- if (LOG.isDebugEnabled()) {- LOG.debug("Found existing {} servlet at path {}; will replace mapping with {} servlet"- , servletMappings[i].getServletName()- , pathSpec- , holder.getName());- }- ServletMapping[] newServletMappings =- ArrayUtil.removeFromArray(servletMappings, servletMappings[i]);- webAppContext.getServletHandler()- .setServletMappings(newServletMappings);- break;- }- }- webAppContext.addServlet(holder, pathSpec);-- if(requireAuth && UserGroupInformation.isSecurityEnabled()) {- LOG.info("Adding Kerberos (SPNEGO) filter to {}", name);- ServletHandler handler = webAppContext.getServletHandler();- FilterMapping fmap = new FilterMapping();- fmap.setPathSpec(pathSpec);- fmap.setFilterName(SPNEGO_FILTER);- fmap.setDispatches(FilterMapping.ALL);- handler.addFilterMapping(fmap);- }- }-- /**- * Add an internal servlet in the server, with initialization parameters.- * Note: This method is to be used for adding servlets that facilitate- * internal communication and not for user facing functionality. For- * servlets added using this method, filters (except internal Kerberos- * filters) are not enabled.- *- * @param name The name of the servlet (can be passed as null)- * @param pathSpec The path spec for the servlet- * @param clazz The servlet class- * @param params init parameters- */- public void addInternalServlet(String name, String pathSpec,- Class<? extends HttpServlet> clazz, Map<String, String> params) {- // Jetty doesn't like the same path spec mapping to different servlets, so- // if there's already a mapping for this pathSpec, remove it and assume that- // the newest one is the one we want- final ServletHolder sh = new ServletHolder(clazz);- sh.setName(name);- sh.setInitParameters(params);- final ServletMapping[] servletMappings =- webAppContext.getServletHandler().getServletMappings();- for (int i = 0; i < servletMappings.length; i++) {- if (servletMappings[i].containsPathSpec(pathSpec)) {- if (LOG.isDebugEnabled()) {- LOG.debug("Found existing {} servlet at path {}; will replace mapping with {} servlet"- , servletMappings[i].getServletName(), pathSpec, sh.getName());- }- ServletMapping[] newServletMappings =- ArrayUtil.removeFromArray(servletMappings, servletMappings[i]);- webAppContext.getServletHandler()- .setServletMappings(newServletMappings);- break;- }- }- webAppContext.addServlet(sh, pathSpec);- }-- /**- * Add the given handler to the front of the list of handlers.- *- * @param handler The handler to add- */- public void addHandlerAtFront(Handler handler) {- Handler[] h = ArrayUtil.prependToArray(- handler, this.handlers.getHandlers(), Handler.class);- handlers.setHandlers(h);- }-- /**- * Add the given handler to the end of the list of handlers.- *- * @param handler The handler to add- */- public void addHandlerAtEnd(Handler handler) {- handlers.addHandler(handler);- }-- @Override- public void addFilter(String name, String classname,- Map<String, String> parameters) {-- FilterHolder filterHolder = getFilterHolder(name, classname, parameters);- final String[] USER_FACING_URLS = { "*.html", "*.jsp" };- FilterMapping fmap = getFilterMapping(name, USER_FACING_URLS);- defineFilter(webAppContext, filterHolder, fmap);- if (LOG.isInfoEnabled()) {- LOG.info("Added filter {} (class={}) to context {}", name, classname- , webAppContext.getDisplayName());- }- final String[] ALL_URLS = { "/*" };- fmap = getFilterMapping(name, ALL_URLS);- for (Map.Entry<ServletContextHandler, Boolean> e- : defaultContexts.entrySet()) {- if (e.getValue()) {- ServletContextHandler ctx = e.getKey();- defineFilter(ctx, filterHolder, fmap);- if (LOG.isInfoEnabled()) {- LOG.info("Added filter {} (class={}) to context {}"- , name, classname, ctx.getDisplayName());- }- }- }- filterNames.add(name);- }-- @Override- public void addGlobalFilter(String name, String classname,- Map<String, String> parameters) {- final String[] ALL_URLS = { "/*" };- FilterHolder filterHolder = getFilterHolder(name, classname, parameters);- FilterMapping fmap = getFilterMapping(name, ALL_URLS);- defineFilter(webAppContext, filterHolder, fmap);- for (ServletContextHandler ctx : defaultContexts.keySet()) {- defineFilter(ctx, filterHolder, fmap);- }- LOG.info("Added global filter {}' (class={})'", name, classname);- }-- /**- * Define a filter for a context and set up default url mappings.- */- public static void defineFilter(ServletContextHandler ctx, String name,- String classname, Map<String,String> parameters, String[] urls) {- FilterHolder filterHolder = getFilterHolder(name, classname, parameters);- FilterMapping fmap = getFilterMapping(name, urls);- defineFilter(ctx, filterHolder, fmap);- }-- /**- * Define a filter for a context and set up default url mappings.- */- private static void defineFilter(ServletContextHandler ctx,- FilterHolder holder, FilterMapping fmap) {- ServletHandler handler = ctx.getServletHandler();- handler.addFilter(holder, fmap);- }-- private static FilterMapping getFilterMapping(String name, String[] urls) {- FilterMapping fmap = new FilterMapping();- fmap.setPathSpecs(urls);- fmap.setDispatches(FilterMapping.ALL);- fmap.setFilterName(name);- return fmap;- }-- private static FilterHolder getFilterHolder(String name, String classname,- Map<String, String> parameters) {- FilterHolder holder = new FilterHolder();- holder.setName(name);- holder.setClassName(classname);- if (parameters != null) {- holder.setInitParameters(parameters);- }- return holder;- }-- /**- * Add the path spec to the filter path mapping.- * @param pathSpec The path spec- * @param webAppCtx The WebApplicationContext to add to- */- protected void addFilterPathMapping(String pathSpec,- ServletContextHandler webAppCtx) {- ServletHandler handler = webAppCtx.getServletHandler();- for(String name : filterNames) {- FilterMapping fmap = new FilterMapping();- fmap.setPathSpec(pathSpec);- fmap.setFilterName(name);- fmap.setDispatches(FilterMapping.ALL);- handler.addFilterMapping(fmap);- }- }-- /**- * Get the value in the webapp context.- * @param name The name of the attribute- * @return The value of the attribute- */- public Object getAttribute(String name) {- return webAppContext.getAttribute(name);- }-- public WebAppContext getWebAppContext(){- return this.webAppContext;- }-- /**- * Get the pathname to the webapps files.- * @param appName eg "secondary" or "datanode"- * @return the pathname as a URL- * @throws FileNotFoundException if 'webapps' directory cannot be found- * on CLASSPATH or in the development location.- */- protected String getWebAppsPath(String appName) throws FileNotFoundException {- URL resourceUrl = null;- File webResourceDevLocation = new File("src/main/webapps", appName);- if (webResourceDevLocation.exists()) {- LOG.info("Web server is in development mode. Resources "- + "will be read from the source tree.");- try {- resourceUrl = webResourceDevLocation.getParentFile().toURI().toURL();- } catch (MalformedURLException e) {- throw new FileNotFoundException("Mailformed URL while finding the "- + "web resource dir:" + e.getMessage());- }- } else {- resourceUrl =- getClass().getClassLoader().getResource("webapps/" + appName);-- if (resourceUrl == null) {- throw new FileNotFoundException("webapps/" + appName +- " not found in CLASSPATH");- }- }- String urlString = resourceUrl.toString();- return urlString.substring(0, urlString.lastIndexOf('/'));- }-- /**- * Get the port that the server is on- * @return the port- */- @Deprecated- public int getPort() {- return ((ServerConnector)webServer.getConnectors()[0]).getLocalPort();- }-- /**- * Get the address that corresponds to a particular connector.- *- * @return the corresponding address for the connector, or null if there's no- * such connector or the connector is not bounded or was closed.- */- public InetSocketAddress getConnectorAddress(int index) {- Preconditions.checkArgument(index >= 0);- if (index > webServer.getConnectors().length)- return null;-- ServerConnector c = (ServerConnector)webServer.getConnectors()[index];- if (c.getLocalPort() == -1 || c.getLocalPort() == -2) {- // The connector is not bounded or was closed- return null;- }-- return new InetSocketAddress(c.getHost(), c.getLocalPort());- }-- /**- * Set the min, max number of worker threads (simultaneous connections).- */- public void setThreads(int min, int max) {- QueuedThreadPool pool = (QueuedThreadPool) webServer.getThreadPool();- pool.setMinThreads(min);- pool.setMaxThreads(max);- }-- private void initSpnego(Configuration conf, String hostName,- String usernameConfKey, String keytabConfKey) throws IOException {- Map<String, String> params = new HashMap<>();- String principalInConf = conf.get(usernameConfKey);- if (principalInConf != null && !principalInConf.isEmpty()) {- params.put("kerberos.principal", SecurityUtil.getServerPrincipal(- principalInConf, hostName));- }- String httpKeytab = conf.get(keytabConfKey);- if (httpKeytab != null && !httpKeytab.isEmpty()) {- params.put("kerberos.keytab", httpKeytab);- }- params.put(AuthenticationFilter.AUTH_TYPE, "kerberos");- defineFilter(webAppContext, SPNEGO_FILTER,- AuthenticationFilter.class.getName(), params, null);- }-- /**- * Start the server. Does not wait for the server to start.- */- public void start() throws IOException {- try {- try {- openListeners();- webServer.start();- } catch (IOException ex) {- LOG.info("HttpServer.start() threw a non Bind IOException", ex);- throw ex;- } catch (MultiException ex) {- LOG.info("HttpServer.start() threw a MultiException", ex);- throw ex;- }- // Make sure there is no handler failures.- Handler[] hs = webServer.getHandlers();- for (Handler handler : hs) {- if (handler.isFailed()) {- throw new IOException(- "Problem in starting http server. Server handlers failed");- }- }- // Make sure there are no errors initializing the context.- Throwable unavailableException = webAppContext.getUnavailableException();- if (unavailableException != null) {- // Have to stop the webserver, or else its non-daemon threads- // will hang forever.- webServer.stop();- throw new IOException("Unable to initialize WebAppContext",- unavailableException);- }- } catch (IOException e) {- throw e;- } catch (InterruptedException e) {- throw (IOException) new InterruptedIOException(- "Interrupted while starting HTTP server").initCause(e);- } catch (Exception e) {- throw new IOException("Problem starting http server", e);- }- }-- private void loadListeners() {- for (Connector c : listeners) {- webServer.addConnector(c);- }- }-- /**- * Bind listener by closing and opening the listener.- * @param listener listener to bind- * @throws Exception Exception on opening listener- */- private static void bindListener(ServerConnector listener) throws Exception {- // jetty has a bug where you can't reopen a listener that previously- // failed to open w/o issuing a close first, even if the port is changed- listener.close();- listener.open();- if (LOG.isInfoEnabled()) {- LOG.info("Jetty bound to port {}", listener.getLocalPort());- }- }-- /**- * Create bind exception by wrapping the bind exception thrown.- * @param listener listener to check- * @param ex exception to check- * @return returns the exception- */- private static BindException constructBindException(ServerConnector listener,- BindException ex) {- BindException be = new BindException("Port in use: "- + listener.getHost() + ":" + listener.getPort());- if (ex != null) {- be.initCause(ex);- }- return be;- }-- /**- * Bind using single configured port. If findPort is true, we will try to bind- * after incrementing port till a free port is found.- * @param listener jetty listener.- * @param port port which is set in the listener.- * @throws Exception exception on binding- */- private void bindForSinglePort(ServerConnector listener, int port)- throws Exception {- while (true) {- try {- bindListener(listener);- break;- } catch (BindException ex) {- if (port == 0 || !findPort) {- throw constructBindException(listener, ex);- }- }- // try the next port number- listener.setPort(++port);- Thread.sleep(100);- }- }-- /**- * Bind using port ranges. Keep on looking for a free port in the port range- * and throw a bind exception if no port in the configured range binds.- * @param listener jetty listener.- * @param startPort initial port which is set in the listener.- * @throws Exception exception on binding- */- private void bindForPortRange(ServerConnector listener, int startPort)- throws Exception {- BindException bindException = null;- try {- bindListener(listener);- return;- } catch (BindException ex) {- // Ignore exception.- bindException = ex;- }- for(Integer port : portRanges) {- if (port == startPort) {- continue;- }- Thread.sleep(100);- listener.setPort(port);- try {- bindListener(listener);- return;- } catch (BindException ex) {- // Ignore exception. Move to next port.- bindException = ex;- }- }- throw constructBindException(listener, bindException);- }-- /**- * Open the main listener for the server- * @throws Exception exception opening listener- */- void openListeners() throws Exception {- LOG.debug("opening listeners: {}", listeners);- for (ServerConnector listener : listeners) {- if (listener.getLocalPort() != -1 && listener.getLocalPort() != -2) {- // This listener is either started externally or has been bound or was- // closed- continue;- }- int port = listener.getPort();- if (portRanges != null && port != 0) {- bindForPortRange(listener, port);- } else {- bindForSinglePort(listener, port);- }- }- }-- /**- * stop the server- */- public void stop() throws Exception {- MultiException exception = null;- for (ServerConnector c : listeners) {- try {- c.close();- } catch (Exception e) {- LOG.error("Error while stopping listener for webapp{}", webAppContext.getDisplayName(), e);- exception = addMultiException(exception, e);- }- }-- try {- // explicitly destroy the secret provider- secretProvider.destroy();- // clear & stop webAppContext attributes to avoid memory leaks.- webAppContext.clearAttributes();- webAppContext.stop();- } catch (Exception e) {- LOG.error("Error while stopping web app context for webapp {}", webAppContext.getDisplayName(), e);- exception = addMultiException(exception, e);- }-- try {- webServer.stop();- } catch (Exception e) {- LOG.error("Error while stopping web server for webapp {}"- , webAppContext.getDisplayName(), e);- exception = addMultiException(exception, e);- }-- if (exception != null) {- exception.ifExceptionThrow();- }-- }-- private MultiException addMultiException(MultiException exception, Exception e) {- if(exception == null){- exception = new MultiException();- }- exception.add(e);- return exception;- }-- public void join() throws InterruptedException {- webServer.join();- }-- /**- * Test for the availability of the web server- * @return true if the web server is started, false otherwise- */- public boolean isAlive() {- return webServer != null && webServer.isStarted();- }-- @Override- public String toString() {- Preconditions.checkState(!listeners.isEmpty());- StringBuilder sb = new StringBuilder("HttpServer (")- .append(isAlive() ? STATE_DESCRIPTION_ALIVE- : STATE_DESCRIPTION_NOT_LIVE)- .append("), listening at:");- for (ServerConnector l : listeners) {- sb.append(l.getHost()).append(":").append(l.getPort()).append("/,");- }- return sb.toString();- }-- /**- * Checks the user has privileges to access to instrumentation servlets.- *- * If <code>hadoop.security.instrumentation.requires.admin</code> is set to FALSE- * (default value) it always returns TRUE.- *- * If <code>hadoop.security.instrumentation.requires.admin</code> is set to TRUE- * it will check that if the current user is in the admin ACLS. If the user is- * in the admin ACLs it returns TRUE, otherwise it returns FALSE.- *- * @param servletContext the servlet context.- * @param request the servlet request.- * @param response the servlet response.- * @return TRUE/FALSE based on the logic decribed above.- */- public static boolean isInstrumentationAccessAllowed(- ServletContext servletContext, HttpServletRequest request,- HttpServletResponse response) throws IOException {- Configuration conf =- (Configuration) servletContext.getAttribute(CONF_CONTEXT_ATTRIBUTE);-- boolean access = true;- boolean adminAccess = conf.getBoolean(- CommonConfigurationKeys.HADOOP_SECURITY_INSTRUMENTATION_REQUIRES_ADMIN,- false);- if (adminAccess) {- access = hasAdministratorAccess(servletContext, request, response);- }- return access;- }-- /**- * Does the user sending the HttpServletRequest has the administrator ACLs? If- * it isn't the case, response will be modified to send an error to the user.- *- * @param response used to send the error response if user does not have admin access.- * @return true if admin-authorized, false otherwise- * @throws IOException exception on error- */- public static boolean hasAdministratorAccess(- ServletContext servletContext, HttpServletRequest request,- HttpServletResponse response) throws IOException {- Configuration conf =- (Configuration) servletContext.getAttribute(CONF_CONTEXT_ATTRIBUTE);- // If there is no authorization, anybody has administrator access.- if (!conf.getBoolean(- CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false)) {- return true;- }-- String remoteUser = request.getRemoteUser();- if (remoteUser == null) {- response.sendError(HttpServletResponse.SC_FORBIDDEN,- "Unauthenticated users are not " +- "authorized to access this page.");- return false;- }-- if (servletContext.getAttribute(ADMINS_ACL) != null &&- !userHasAdministratorAccess(servletContext, remoteUser)) {- response.sendError(HttpServletResponse.SC_FORBIDDEN,- "Unauthenticated users are not " +- "authorized to access this page.");- LOG.warn("User {} is unauthorized to access the page {}.", remoteUser, request.getRequestURI());- return false;- }-- return true;- }-- /**- * Get the admin ACLs from the given ServletContext and check if the given- * user is in the ACL.- *- * @param servletContext the context containing the admin ACL.- * @param remoteUser the remote user to check for.- * @return true if the user is present in the ACL, false if no ACL is set or- * the user is not present- */- public static boolean userHasAdministratorAccess(ServletContext servletContext,- String remoteUser) {- AccessControlList adminsAcl = (AccessControlList) servletContext- .getAttribute(ADMINS_ACL);- UserGroupInformation remoteUserUGI =- UserGroupInformation.createRemoteUser(remoteUser);- return adminsAcl != null && adminsAcl.isUserAllowed(remoteUserUGI);- }-- /**- * A very simple servlet to serve up a text representation of the current- * stack traces. It both returns the stacks to the caller and logs them.- * Currently the stack traces are done sequentially rather than exactly the- * same data.- */- public static class StackServlet extends HttpServlet {- private static final long serialVersionUID = -6284183679759467039L;-- @Override- public void doGet(HttpServletRequest request, HttpServletResponse response)- throws ServletException, IOException {- if (!HttpServer2.isInstrumentationAccessAllowed(getServletContext(),- request, response)) {- return;- }- response.setContentType("text/plain; charset=UTF-8");- try (PrintStream out = new PrintStream(- response.getOutputStream(), false, "UTF-8")) {- ReflectionUtils.printThreadInfo(out, "");- }- ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);- }- }-- /**- * A Servlet input filter that quotes all HTML active characters in the- * parameter names and values. The goal is to quote the characters to make- * all of the servlets resistant to cross-site scripting attacks. It also- * sets X-FRAME-OPTIONS in the header to mitigate clickjacking attacks.- */- public static class QuotingInputFilter implements Filter {-- private FilterConfig config;- private Map<String, String> headerMap;-- public static class RequestQuoter extends HttpServletRequestWrapper {- private final HttpServletRequest rawRequest;-- public RequestQuoter(HttpServletRequest rawRequest) {- super(rawRequest);- this.rawRequest = rawRequest;- }-- /**- * Return the set of parameter names, quoting each name.- */- @Override- public Enumeration<String> getParameterNames() {- return new Enumeration<String>() {- private Enumeration<String> rawIterator = rawRequest.getParameterNames();- @Override- public boolean hasMoreElements() {- return rawIterator.hasMoreElements();- }-- @Override- public String nextElement() {- return HtmlQuoting.quoteHtmlChars(rawIterator.nextElement());- }- };- }-- /**- * Unquote the name and quote the value.- */- @Override- public String getParameter(String name) {- return HtmlQuoting.quoteHtmlChars(rawRequest.getParameter- (HtmlQuoting.unquoteHtmlChars(name)));- }-- @Override- public String[] getParameterValues(String name) {- String unquoteName = HtmlQuoting.unquoteHtmlChars(name);- String[] unquoteValue = rawRequest.getParameterValues(unquoteName);- if (unquoteValue == null) {- return null;- }- String[] result = new String[unquoteValue.length];- for(int i=0; i < result.length; ++i) {- result[i] = HtmlQuoting.quoteHtmlChars(unquoteValue[i]);- }- return result;- }-- @Override- public Map<String, String[]> getParameterMap() {- Map<String, String[]> result = new HashMap<>();- Map<String, String[]> raw = rawRequest.getParameterMap();- for (Map.Entry<String,String[]> item: raw.entrySet()) {- String[] rawValue = item.getValue();- String[] cookedValue = new String[rawValue.length];- for(int i=0; i< rawValue.length; ++i) {- cookedValue[i] = HtmlQuoting.quoteHtmlChars(rawValue[i]);- }- result.put(HtmlQuoting.quoteHtmlChars(item.getKey()), cookedValue);- }- return result;- }-- /**- * Quote the url so that users specifying the HOST HTTP header- * can't inject attacks.- */- @Override- public StringBuffer getRequestURL(){- String url = rawRequest.getRequestURL().toString();- return new StringBuffer(HtmlQuoting.quoteHtmlChars(url));- }-- /**- * Quote the server name so that users specifying the HOST HTTP header- * can't inject attacks.- */- @Override- public String getServerName() {- return HtmlQuoting.quoteHtmlChars(rawRequest.getServerName());- }- }-- @Override- public void init(FilterConfig config) throws ServletException {- this.config = config;- initHttpHeaderMap();- }-- @Override- public void destroy() {- }-- @Override- public void doFilter(ServletRequest request,- ServletResponse response,- FilterChain chain- ) throws IOException, ServletException {- HttpServletRequestWrapper quoted =- new RequestQuoter((HttpServletRequest) request);- HttpServletResponse httpResponse = (HttpServletResponse) response;-- String mime = inferMimeType(request);- if (mime == null) {- httpResponse.setContentType("text/plain; charset=utf-8");- } else if (mime.startsWith("text/html")) {- // HTML with unspecified encoding, we want to- // force HTML with utf-8 encoding- // This is to avoid the following security issue:- // http://openmya.hacker.jp/hasegawa/security/utf7cs.html- httpResponse.setContentType("text/html; charset=utf-8");- } else if (mime.startsWith("application/xml")) {- httpResponse.setContentType("text/xml; charset=utf-8");- }- headerMap.forEach((k, v) -> httpResponse.addHeader(k, v));- chain.doFilter(quoted, httpResponse);- }-- /**- * Infer the mime type for the response based on the extension of the request- * URI. Returns null if unknown.- */- private String inferMimeType(ServletRequest request) {- String path = ((HttpServletRequest)request).getRequestURI();- ServletContextHandler.Context sContext =- (ServletContextHandler.Context)config.getServletContext();- String mime = sContext.getMimeType(path);- return (mime == null) ? null : mime;- }-- private void initHttpHeaderMap() {- Enumeration<String> params = this.config.getInitParameterNames();- headerMap = new HashMap<>();- while (params.hasMoreElements()) {- String key = params.nextElement();- Matcher m = PATTERN_HTTP_HEADER_REGEX.matcher(key);- if (m.matches()) {- String headerKey = m.group(1);- headerMap.put(headerKey, config.getInitParameter(key));- }- }- }- }- /**- * The X-FRAME-OPTIONS header in HTTP response to mitigate clickjacking- * attack.- */- public enum XFrameOption {- DENY("DENY"), SAMEORIGIN("SAMEORIGIN"), ALLOWFROM("ALLOW-FROM");-- XFrameOption(String name) {- this.name = name;- }-- private final String name;-- @Override- public String toString() {- return this.name;- }-- /**- * We cannot use valueOf since the AllowFrom enum differs from its value- * Allow-From. This is a helper method that does exactly what valueof does,- * but allows us to handle the AllowFrom issue gracefully.- *- * @param value - String must be DENY, SAMEORIGIN or ALLOW-FROM.- * @return XFrameOption or throws IllegalException.- */- private static XFrameOption getEnum(String value) {- Preconditions.checkState(value != null && !value.isEmpty());- for (XFrameOption xoption : values()) {- if (value.equals(xoption.toString())) {- return xoption;- }- }- throw new IllegalArgumentException("Unexpected value in xFrameOption.");- }- }--- private Map<String, String> setHeaders(Configuration conf) {- Map<String, String> xFrameParams = new HashMap<>();- Map<String, String> headerConfigMap =- conf.getValByRegex(HTTP_HEADER_REGEX);-- xFrameParams.putAll(getDefaultHeaders());- if(this.xFrameOptionIsEnabled) {- xFrameParams.put(HTTP_HEADER_PREFIX+X_FRAME_OPTIONS,- this.xFrameOption.toString());- }- xFrameParams.putAll(headerConfigMap);- return xFrameParams;- }-- private Map<String, String> getDefaultHeaders() {- Map<String, String> headers = new HashMap<>();- String[] splitVal = X_CONTENT_TYPE_OPTIONS.split(":");- headers.put(HTTP_HEADER_PREFIX + splitVal[0],- splitVal[1]);- splitVal = X_XSS_PROTECTION.split(":");- headers.put(HTTP_HEADER_PREFIX + splitVal[0],- splitVal[1]);- return headers;- }-}diff --git a/solr/modules/hdfs/src/test/org/apache/hadoop/package-info.java b/solr/modules/hdfs/src/test/org/apache/hadoop/package-info.javaindex f10ed779f79..28203e51c33 100644--- a/solr/modules/hdfs/src/test/org/apache/hadoop/package-info.java+++ b/solr/modules/hdfs/src/test/org/apache/hadoop/package-info.java@@ -20,11 +20,6 @@* to avoid certain issues during tests. The copied classes override the* Apache Hadoop dependency versions during tests.*- * HttpServer2 class was copied to avoid Jetty 9.4 dependency issues. Since- * Solr uses Jetty 9.4, Hadoop integration tests needs to use Jetty 9.4 as- * well. The HttpServer2 class should be removed when Hadoop is upgraded to- * 3.3.0 due to HADOOP-16152 upgrading Hadoop to Jetty 9.4.- ** The classes BlockPoolSlice (HDFS-14251), DiskChecker, FileUtil, HardLink,* NameNodeResourceChecker, and RawLocalFileSystem were copied to avoid* issues with running Hadoop integration tests under the Java securitydiff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSFailoverTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSFailoverTest.javaindex 5f6bb0ed547..ee0ecc830e6 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSFailoverTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSFailoverTest.java@@ -35,7 +35,7 @@ import org.apache.solr.common.cloud.ClusterStateUtil;import org.apache.solr.common.cloud.DocCollection;import org.apache.solr.common.cloud.Replica;import org.apache.solr.common.cloud.ZkStateReader;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSTest.javaindex aee051e425d..99c52329420 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/MoveReplicaHDFSTest.java@@ -27,7 +27,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.TimeUnits;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.hdfs.HdfsTestUtil;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.javaindex f0a107a8337..7db2ed9ecf9 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.java@@ -61,7 +61,7 @@ import org.apache.solr.common.util.ExecutorUtil;import org.apache.solr.common.util.TimeSource;import org.apache.solr.core.CoreDescriptor;import org.apache.solr.common.util.SolrNamedThreadFactory;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.apache.solr.util.LogLevel;import org.apache.solr.util.TestInjection;import org.apache.solr.util.TimeOut;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCloudIncrementalBackupTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCloudIncrementalBackupTest.javaindex 8bf410e3698..62fea83cea4 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCloudIncrementalBackupTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCloudIncrementalBackupTest.java@@ -33,7 +33,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.hdfs.HdfsTestUtil;import org.apache.solr.common.util.IOUtils;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -43,7 +43,7 @@ import org.junit.BeforeClass;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsCloudIncrementalBackupTest extends AbstractIncrementalBackupTest{public static final String SOLR_XML = "<solr>\n" +"\n" +diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCollectionsAPIDistributedZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCollectionsAPIDistributedZkTest.javaindex e7992c248a8..2cd9799b381 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCollectionsAPIDistributedZkTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/HdfsCollectionsAPIDistributedZkTest.java@@ -25,7 +25,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.TimeUnits;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.hdfs.HdfsTestUtil;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/TestHdfsCloudBackupRestore.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/TestHdfsCloudBackupRestore.javaindex 28c6b7bda9f..346b543654c 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/TestHdfsCloudBackupRestore.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/api/collections/TestHdfsCloudBackupRestore.java@@ -48,7 +48,7 @@ import org.apache.solr.common.util.NamedList;import org.apache.solr.core.backup.BackupManager;import org.apache.solr.core.backup.BackupProperties;import org.apache.solr.core.backup.repository.HdfsBackupRepository;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -68,7 +68,7 @@ import static org.apache.solr.core.backup.BackupManager.ZK_STATE_DIR;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 30)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class TestHdfsCloudBackupRestore extends AbstractCloudBackupRestoreTestCase {public static final String SOLR_XML = "<solr>\n" +"\n" +diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/DisableKeyStoresFactory.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/DisableKeyStoresFactory.javanew file mode 100644index 00000000000..088eb5f71b0--- /dev/null+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/DisableKeyStoresFactory.java@@ -0,0 +1,58 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.solr.cloud.hdfs;++import org.apache.hadoop.conf.Configuration;+import org.apache.hadoop.security.ssl.KeyStoresFactory;+import org.apache.hadoop.security.ssl.SSLFactory;++import javax.net.ssl.KeyManager;+import javax.net.ssl.TrustManager;+import java.io.IOException;+import java.security.GeneralSecurityException;++public class DisableKeyStoresFactory implements KeyStoresFactory {+ @Override+ public void init(SSLFactory.Mode mode) throws IOException, GeneralSecurityException {++ }++ @Override+ public void destroy() {++ }++ @Override+ public KeyManager[] getKeyManagers() {+ return new KeyManager[0];+ }++ @Override+ public TrustManager[] getTrustManagers() {+ return new TrustManager[0];+ }++ @Override+ public void setConf(Configuration conf) {++ }++ @Override+ public Configuration getConf() {+ return null;+ }+}diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HDFSCollectionsAPITest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HDFSCollectionsAPITest.javaindex 83bd930999e..5bad1c7c20a 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HDFSCollectionsAPITest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HDFSCollectionsAPITest.java@@ -29,7 +29,7 @@ import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.cloud.SolrCloudTestCase;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.cloud.Replica;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -38,7 +38,7 @@ import org.junit.BeforeClass;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HDFSCollectionsAPITest extends SolrCloudTestCase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZk2Test.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZk2Test.javaindex 59fd45c6f73..8596e567463 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZk2Test.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZk2Test.java@@ -24,7 +24,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractBasicDistributedZk2TestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -39,7 +39,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsBasicDistributedZk2Test extends AbstractBasicDistributedZk2TestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.javaindex 74571da0422..9a3183fec62 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.java@@ -24,7 +24,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractBasicDistributedZkTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -39,7 +39,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsBasicDistributedZkTest extends AbstractBasicDistributedZkTestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeyNothingIsSafeTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeyNothingIsSafeTest.javaindex 0850d6a2c0e..5642b85e517 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeyNothingIsSafeTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeyNothingIsSafeTest.java@@ -24,7 +24,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractChaosMonkeyNothingIsSafeTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -38,7 +38,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsChaosMonkeyNothingIsSafeTest extends AbstractChaosMonkeyNothingIsSafeTestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.javaindex 40e4c012bbb..88fc163ad06 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.java@@ -24,7 +24,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractChaosMonkeySafeLeaderTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -39,7 +39,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsChaosMonkeySafeLeaderTest extends AbstractChaosMonkeySafeLeaderTestBase {private static final String DIRECTORY_FACTORY = "org.apache.solr.core.HdfsDirectoryFactory";private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsNNFailoverTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsNNFailoverTest.javaindex 35a8472ed73..4b17cc39c6c 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsNNFailoverTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsNNFailoverTest.java@@ -24,7 +24,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractBasicDistributedZkTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -37,7 +37,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 40)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsNNFailoverTest extends AbstractBasicDistributedZkTestBase {private static final String COLLECTION = "collection";private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoverLeaseTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoverLeaseTest.javaindex ad0b4af713a..f3742b4c40b 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoverLeaseTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoverLeaseTest.java@@ -30,7 +30,7 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.SolrTestCaseJ4;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.apache.solr.util.FSHDFSUtils;import org.apache.solr.util.FSHDFSUtils.CallerInfo;import org.junit.After;@@ -46,7 +46,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 40)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsRecoverLeaseTest extends SolrTestCaseJ4 {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.javaindex 252f392ec9f..d74f1bfe065 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.java@@ -25,7 +25,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractRecoveryZkTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -37,7 +37,7 @@ import org.junit.BeforeClass;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsRecoveryZkTest extends AbstractRecoveryZkTestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRestartWhileUpdatingTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRestartWhileUpdatingTest.javaindex d90db0bd4d7..b606090b282 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRestartWhileUpdatingTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsRestartWhileUpdatingTest.java@@ -22,7 +22,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractRestartWhileUpdatingTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -36,7 +36,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsRestartWhileUpdatingTest extends AbstractRestartWhileUpdatingTestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.javaindex 68f4ee0137b..a06c07d7ca1 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.java@@ -24,7 +24,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractSyncSliceTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -38,7 +38,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsSyncSliceTest extends AbstractSyncSliceTestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.javaindex 1f640e6538d..0840ae94db9 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java@@ -45,7 +45,6 @@ import org.apache.hadoop.hdfs.MiniDFSNNTopology;import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;import org.apache.hadoop.hdfs.server.namenode.NameNodeResourceChecker;import org.apache.hadoop.hdfs.server.namenode.ha.HATestUtil;-import org.apache.hadoop.http.HttpServer2;import org.apache.hadoop.io.nativeio.NativeIO;import org.apache.hadoop.metrics2.MetricsSystem;import org.apache.hadoop.metrics2.impl.MetricsSystemImpl;@@ -123,7 +122,6 @@ public class HdfsTestUtil {DiskChecker.class,FileUtil.class,HardLink.class,- HttpServer2.class,NameNodeResourceChecker.class,RawLocalFileSystem.class));// Dodge weird scope errors from the compiler (SOLR-14417)@@ -180,6 +178,8 @@ public class HdfsTestUtil {// Disable metrics logging for HDFSconf.setInt("dfs.namenode.metrics.logger.period.seconds", 0);conf.setInt("dfs.datanode.metrics.logger.period.seconds", 0);+ // Disable GcTimeMonitor - HDFS-15176 introduced in Hadoop 3.3.0 - causes thead leaks+ conf.setBoolean("dfs.namenode.gc.time.monitor.enable", false);System.setProperty("test.build.data", dir + File.separator + "hdfs" + File.separator + "build");System.setProperty("test.cache.data", dir + File.separator + "hdfs" + File.separator + "cache");diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsThreadLeakTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsThreadLeakTest.javaindex f79c618f222..9fa195baca2 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsThreadLeakTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsThreadLeakTest.java@@ -27,7 +27,7 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.SolrTestCaseJ4;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -39,7 +39,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 30)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsThreadLeakTest extends SolrTestCaseJ4 {private static MiniDFSCluster dfsCluster;@@ -56,7 +56,7 @@ public class HdfsThreadLeakTest extends SolrTestCaseJ4 {dfsCluster = null;}}-+@Testpublic void testBasic() throws IOException {String uri = HdfsTestUtil.getURI(dfsCluster);diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTlogReplayBufferedWhileIndexingTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTlogReplayBufferedWhileIndexingTest.javaindex 4a25cf1e4cf..d81786645ce 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTlogReplayBufferedWhileIndexingTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsTlogReplayBufferedWhileIndexingTest.java@@ -22,7 +22,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractTlogReplayBufferedWhileIndexingTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -36,7 +36,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsTlogReplayBufferedWhileIndexingTest extends AbstractTlogReplayBufferedWhileIndexingTestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.javaindex 1711ed17c65..93fb63af8f4 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.java@@ -22,7 +22,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.cloud.AbstractUnloadDistributedZkTestBase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -36,7 +36,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsUnloadDistributedZkTest extends AbstractUnloadDistributedZkTestBase {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.javaindex 22b31d96697..f92fdf45e48 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java@@ -49,7 +49,7 @@ import org.apache.solr.store.blockcache.BlockCache;import org.apache.solr.store.blockcache.BlockDirectory;import org.apache.solr.store.blockcache.BlockDirectoryCache;import org.apache.solr.store.blockcache.Cache;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.apache.solr.util.RefCounted;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -62,7 +62,7 @@ import org.junit.Test;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsWriteToMultipleCollectionsTest extends AbstractBasicDistributedZkTestBase {private static final String ACOLLECTION = "acollection";private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.javaindex d3cb41b994d..2c4c09dd553 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java@@ -41,7 +41,7 @@ import org.apache.solr.common.params.CollectionParams.CollectionAction;import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.common.util.NamedList;import org.apache.solr.common.util.TimeSource;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.apache.solr.util.TimeOut;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -63,7 +63,7 @@ import java.util.concurrent.TimeUnit;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class StressHdfsTest extends AbstractBasicDistributedZkTestBase {private static final String DELETE_DATA_DIR_COLLECTION = "delete_data_dir";private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.java b/solr/modules/hdfs/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.javaindex 653a8f8138c..9b49b463e98 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/core/HdfsDirectoryFactoryTest.java@@ -46,7 +46,7 @@ import org.apache.solr.metrics.MetricsMap;import org.apache.solr.metrics.SolrMetricManager;import org.apache.solr.metrics.SolrMetricsContext;import org.apache.solr.store.hdfs.HdfsLocalityReporter;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.apache.solr.util.MockCoreContainer.MockCoreDescriptor;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -59,7 +59,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsDirectoryFactoryTest extends SolrTestCaseJ4 {private static MiniDFSCluster dfsCluster;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/core/backup/repository/HdfsBackupRepositoryIntegrationTest.java b/solr/modules/hdfs/src/test/org/apache/solr/core/backup/repository/HdfsBackupRepositoryIntegrationTest.javaindex a395435f0d8..cd8190201be 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/core/backup/repository/HdfsBackupRepositoryIntegrationTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/core/backup/repository/HdfsBackupRepositoryIntegrationTest.java@@ -34,7 +34,7 @@ import org.apache.solr.cloud.hdfs.HdfsTestUtil;import org.apache.solr.common.util.IOUtils;import org.apache.solr.common.util.NamedList;import org.apache.solr.core.HdfsDirectoryFactory;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -42,7 +42,7 @@ import org.junit.BeforeClass;@ThreadLeakFilters(defaultFilters = true, filters = {BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 10)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsBackupRepositoryIntegrationTest extends AbstractBackupRepositoryTest {private static MiniDFSCluster dfsCluster;private static String hdfsUri;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/handler/TestHdfsBackupRestoreCore.java b/solr/modules/hdfs/src/test/org/apache/solr/handler/TestHdfsBackupRestoreCore.javaindex 5add5c7db88..760415166de 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/handler/TestHdfsBackupRestoreCore.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/handler/TestHdfsBackupRestoreCore.java@@ -45,7 +45,7 @@ import org.apache.solr.common.params.CoreAdminParams;import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction;import org.apache.solr.core.backup.BackupId;import org.apache.solr.core.backup.ShardBackupId;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -66,7 +66,7 @@ import java.util.Map;})@SolrTestCaseJ4.SuppressSSL // Currently unknown why SSL does not work with this test@LuceneTestCase.SuppressCodecs({"SimpleText"}) // Backups do checksum validation against a footer value not present in 'SimpleText'-@ThreadLeakLingering(linger = 40)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class TestHdfsBackupRestoreCore extends SolrCloudTestCase {public static final String HDFS_REPO_SOLR_XML = "<solr>\n" +"\n" +diff --git a/solr/test-framework/src/java/org/apache/solr/util/BadHdfsThreadsFilter.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/util/BadHdfsThreadsFilter.javasimilarity index 98%rename from solr/test-framework/src/java/org/apache/solr/util/BadHdfsThreadsFilter.javarename to solr/modules/hdfs/src/test/org/apache/solr/hdfs/util/BadHdfsThreadsFilter.javaindex 22b3587d41d..495f2264cfa 100644--- a/solr/test-framework/src/java/org/apache/solr/util/BadHdfsThreadsFilter.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/util/BadHdfsThreadsFilter.java@@ -14,7 +14,7 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package org.apache.solr.util;+package org.apache.solr.hdfs.util;import com.carrotsearch.randomizedtesting.ThreadFilter;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.java b/solr/modules/hdfs/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.javaindex 28e82ca6edf..140f864b652 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.java@@ -33,7 +33,7 @@ import org.apache.solr.cloud.AbstractFullDistribZkTestBase;import org.apache.solr.cloud.hdfs.HdfsTestUtil;import org.apache.solr.common.util.NamedList;import org.apache.solr.store.hdfs.HdfsDirectory;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.After;import org.junit.AfterClass;import org.junit.Before;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/search/TestRecoveryHdfs.java b/solr/modules/hdfs/src/test/org/apache/solr/search/TestRecoveryHdfs.javaindex 9e57717d493..9c50efffa36 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/search/TestRecoveryHdfs.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/search/TestRecoveryHdfs.java@@ -51,7 +51,7 @@ import org.apache.solr.update.HdfsUpdateLog;import org.apache.solr.update.UpdateHandler;import org.apache.solr.update.UpdateLog;import org.apache.solr.update.processor.DistributedUpdateProcessor.DistribPhase;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.apache.solr.util.TestInjection;import org.apache.solr.util.TimeOut;import org.junit.After;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java b/solr/modules/hdfs/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.javaindex 7bcb445940f..5dd82243b3d 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java@@ -35,7 +35,6 @@ import org.junit.After;import org.junit.Before;import org.junit.Test;-// commented out on: 24-Dec-2018 @LuceneTestCase.BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 12-Jun-2018public class BlockDirectoryTest extends SolrTestCaseJ4 {private static class MapperCache implements Cache {diff --git a/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java b/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.javaindex b1eb7c119e1..267c098189f 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java@@ -35,7 +35,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.cloud.hdfs.HdfsTestUtil;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.After;import org.junit.AfterClass;import org.junit.Before;@@ -49,7 +49,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;QuickPatchThreadsFilter.class,BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)})-@ThreadLeakLingering(linger = 20)+@ThreadLeakLingering(linger = 1000) // Wait at least 1 second for Netty GlobalEventExecutor to shutdownpublic class HdfsDirectoryTest extends SolrTestCaseJ4 {private static final int MAX_NUMBER_OF_WRITES = 10000;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java b/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.javaindex 18ff266189b..48eb2565eb2 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java@@ -27,7 +27,7 @@ import org.apache.lucene.util.QuickPatchThreadsFilter;import org.apache.solr.SolrIgnoredThreadsFilter;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.cloud.hdfs.HdfsTestUtil;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;diff --git a/solr/modules/hdfs/src/test/org/apache/solr/update/TestHdfsUpdateLog.java b/solr/modules/hdfs/src/test/org/apache/solr/update/TestHdfsUpdateLog.javaindex 59f8fa93db8..64320a6ed50 100644--- a/solr/modules/hdfs/src/test/org/apache/solr/update/TestHdfsUpdateLog.java+++ b/solr/modules/hdfs/src/test/org/apache/solr/update/TestHdfsUpdateLog.java@@ -29,7 +29,7 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.cloud.hdfs.HdfsTestUtil;import org.apache.solr.common.util.IOUtils;import org.apache.solr.request.SolrQueryRequest;-import org.apache.solr.util.BadHdfsThreadsFilter;+import org.apache.solr.hdfs.util.BadHdfsThreadsFilter;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;diff --git a/versions.lock b/versions.lockindex 60f3273fd16..e8ae3c1d736 100644--- a/versions.lock+++ b/versions.lock@@ -7,10 +7,10 @@ com.drewnoakes:metadata-extractor:2.11.0 (1 constraints: 3605323b)com.epam:parso:2.0.11 (1 constraints: 36052c3b)com.esri.geometry:esri-geometry-api:2.2.0 (2 constraints: 6112842b)com.fasterxml.jackson:jackson-bom:2.13.1 (10 constraints: 93d98ca5)-com.fasterxml.jackson.core:jackson-annotations:2.13.1 (8 constraints: dd8797a5)-com.fasterxml.jackson.core:jackson-core:2.13.1 (13 constraints: a5f07d58)-com.fasterxml.jackson.core:jackson-databind:2.13.1 (16 constraints: f62b03fa)-com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.13.1 (2 constraints: f0137e82)+com.fasterxml.jackson.core:jackson-annotations:2.13.1 (8 constraints: dc8721a4)+com.fasterxml.jackson.core:jackson-core:2.13.1 (13 constraints: a4f0e055)+com.fasterxml.jackson.core:jackson-databind:2.13.1 (16 constraints: f52bc0f6)+com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.13.1 (2 constraints: ef135482)com.fasterxml.woodstox:woodstox-core:6.2.7 (2 constraints: 501caf9f)com.github.ben-manes.caffeine:caffeine:3.0.5 (1 constraints: 0a05ff35)com.github.spotbugs:spotbugs-annotations:4.5.3 (1 constraints: 0e051136)@@ -30,10 +30,10 @@ com.google.cloud:google-cloud-core:1.94.3 (3 constraints: da2307c0)com.google.cloud:google-cloud-core-http:1.94.3 (2 constraints: 651543d8)com.google.cloud:google-cloud-storage:1.113.14 (2 constraints: 10143aa3)com.google.code.gson:gson:2.8.6 (5 constraints: 1545748b)-com.google.errorprone:error_prone_annotations:2.10.0 (5 constraints: 18489d8d)-com.google.guava:failureaccess:1.0.1 (1 constraints: e60fd595)-com.google.guava:guava:25.1-jre (2 constraints: 0515c2b9)-com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (1 constraints: 8f1d45cb)+com.google.errorprone:error_prone_annotations:2.10.0 (5 constraints: 1648ef8c)+com.google.guava:failureaccess:1.0.1 (2 constraints: f9199e37)+com.google.guava:guava:27.0.1-jre (2 constraints: 75163311)+com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (2 constraints: 4b35b0a0)com.google.http-client:google-http-client:1.39.2 (9 constraints: 0792de64)com.google.http-client:google-http-client-apache-v2:1.39.2 (2 constraints: bf20ed76)com.google.http-client:google-http-client-appengine:1.39.0 (2 constraints: 5915a1d6)@@ -58,7 +58,7 @@ com.tdunning:t-digest:3.1 (1 constraints: a804212c)commons-cli:commons-cli:1.4 (1 constraints: a9041e2c)commons-codec:commons-codec:1.13 (4 constraints: b633162d)commons-collections:commons-collections:3.2.2 (1 constraints: 09050236)-commons-io:commons-io:2.8.0 (4 constraints: 842b7e24)+commons-io:commons-io:2.8.0 (4 constraints: e52b7071)de.l3s.boilerpipe:boilerpipe:1.1.0 (1 constraints: 0405f335)io.dropwizard.metrics:metrics-core:4.1.5 (5 constraints: 2543e4c0)io.dropwizard.metrics:metrics-graphite:4.1.5 (1 constraints: 0c050736)@@ -86,7 +86,7 @@ io.prometheus:simpleclient_common:0.2.0 (1 constraints: e51014af)io.prometheus:simpleclient_httpserver:0.2.0 (1 constraints: 0405f135)io.sgr:s2-geometry-library-java:1.0.0 (2 constraints: b215dedf)javax.servlet:javax.servlet-api:3.1.0 (3 constraints: 75209943)-junit:junit:4.13.1 (6 constraints: c059a781)+junit:junit:4.13.1 (7 constraints: af6cf716)net.arnx:jsonic:1.2.7 (2 constraints: db10d4d1)net.sf.jopt-simple:jopt-simple:4.6 (1 constraints: 610a91b7)net.sourceforge.argparse4j:argparse4j:0.8.1 (1 constraints: 0b050436)@@ -97,23 +97,25 @@ org.apache.calcite:calcite-linq4j:1.27.0 (2 constraints: cd12134c)org.apache.calcite.avatica:avatica-core:1.18.0 (3 constraints: 0721eacd)org.apache.commons:commons-collections4:4.4 (1 constraints: ac04272c)org.apache.commons:commons-compress:1.21 (1 constraints: d804f430)-org.apache.commons:commons-configuration2:2.1.1 (1 constraints: 0605f935)+org.apache.commons:commons-configuration2:2.7 (1 constraints: ad04242c)org.apache.commons:commons-csv:1.7 (1 constraints: ac04212c)org.apache.commons:commons-exec:1.3 (1 constraints: a8041d2c)-org.apache.commons:commons-lang3:3.9 (4 constraints: 2f31aa08)+org.apache.commons:commons-lang3:3.12.0 (4 constraints: ff3079a3)org.apache.commons:commons-math3:3.6.1 (2 constraints: 670ffb89)-org.apache.commons:commons-text:1.6 (1 constraints: ab04202c)-org.apache.curator:curator-client:2.13.0 (2 constraints: 401576c5)-org.apache.curator:curator-framework:2.13.0 (2 constraints: 5d141e96)-org.apache.curator:curator-recipes:2.13.0 (1 constraints: 3805383b)-org.apache.hadoop:hadoop-annotations:3.2.0 (1 constraints: 07050036)-org.apache.hadoop:hadoop-auth:3.2.0 (1 constraints: 07050036)-org.apache.hadoop:hadoop-common:3.2.0 (1 constraints: 07050036)-org.apache.hadoop:hadoop-hdfs-client:3.2.0 (1 constraints: 07050036)-org.apache.htrace:htrace-core4:4.1.0-incubating (1 constraints: 58090086)-org.apache.httpcomponents:httpclient:4.5.13 (8 constraints: 237a2994)-org.apache.httpcomponents:httpcore:4.4.14 (7 constraints: 756d28c6)-org.apache.httpcomponents:httpmime:4.5.10 (1 constraints: 3c054b3b)+org.apache.commons:commons-text:1.8 (2 constraints: fe1528d0)+org.apache.curator:curator-client:4.3.0 (2 constraints: e214cba2)+org.apache.curator:curator-framework:4.3.0 (2 constraints: ff13b474)+org.apache.curator:curator-recipes:4.3.0 (1 constraints: 09050836)+org.apache.hadoop:hadoop-annotations:3.3.1 (1 constraints: 09050436)+org.apache.hadoop:hadoop-auth:3.3.1 (1 constraints: 09050436)+org.apache.hadoop:hadoop-client-api:3.3.1 (3 constraints: 1628155e)+org.apache.hadoop:hadoop-client-runtime:3.3.1 (2 constraints: 6517ce42)+org.apache.hadoop:hadoop-common:3.3.1 (1 constraints: 09050436)+org.apache.hadoop.thirdparty:hadoop-shaded-guava:1.1.1 (1 constraints: 0505f435)+org.apache.htrace:htrace-core4:4.1.0-incubating (2 constraints: 581ec435)+org.apache.httpcomponents:httpclient:4.5.13 (8 constraints: 267ab694)+org.apache.httpcomponents:httpcore:4.4.15 (7 constraints: 776d86c8)+org.apache.httpcomponents:httpmime:4.5.13 (1 constraints: 3f054e3b)org.apache.james:apache-mime4j-core:0.8.3 (1 constraints: 0d050636)org.apache.james:apache-mime4j-dom:0.8.3 (1 constraints: 0d050636)org.apache.kerby:kerb-core:1.0.1 (5 constraints: 683677dd)@@ -167,7 +169,7 @@ org.apache.tika:tika-java7:1.27 (1 constraints: de04fa30)org.apache.tika:tika-parsers:1.27 (1 constraints: de04fa30)org.apache.tika:tika-xmp:1.27 (1 constraints: de04fa30)org.apache.xmlbeans:xmlbeans:3.1.0 (1 constraints: 0605fd35)-org.apache.zookeeper:zookeeper:3.7.0 (2 constraints: 9e13f25e)+org.apache.zookeeper:zookeeper:3.7.0 (2 constraints: 9e13f45e)org.apache.zookeeper:zookeeper-jute:3.7.0 (2 constraints: 95120523)org.apiguardian:apiguardian-api:1.1.0 (3 constraints: 5f208479)org.aspectj:aspectjrt:1.8.0 (1 constraints: 0b050836)@@ -183,7 +185,7 @@ org.carrot2:morfologik-polish:2.1.5 (1 constraints: cf12501e)org.carrot2:morfologik-stemming:2.1.5 (2 constraints: d01f1300)org.ccil.cowan.tagsoup:tagsoup:1.2.1 (1 constraints: 0605f735)org.checkerframework:checker-compat-qual:2.5.5 (1 constraints: f00fed95)-org.checkerframework:checker-qual:3.19.0 (5 constraints: 3a3b3860)+org.checkerframework:checker-qual:3.19.0 (5 constraints: 413b9562)org.codehaus.janino:commons-compiler:3.0.11 (2 constraints: 81192719)org.codehaus.janino:janino:3.0.11 (1 constraints: 8d0d3f3a)org.codehaus.woodstox:stax2-api:4.2.1 (2 constraints: 36152eaf)@@ -225,7 +227,7 @@ org.ow2.asm:asm-commons:9.1 (1 constraints: 6b0f7267)org.quicktheories:quicktheories:0.26 (1 constraints: dc04f530)org.reactivestreams:reactive-streams:1.0.3 (3 constraints: 3c2b02fd)org.slf4j:jcl-over-slf4j:1.7.35 (1 constraints: 42054a3b)-org.slf4j:slf4j-api:1.7.35 (24 constraints: 6d45f2a6)+org.slf4j:slf4j-api:1.7.35 (25 constraints: 835620d6)org.tallison:jmatio:1.5 (1 constraints: aa041f2c)org.threeten:threetenbp:1.5.0 (4 constraints: f82b9e86)org.tukaani:xz:1.8 (1 constraints: ad04222c)@@ -275,7 +277,6 @@ com.nimbusds:oauth2-oidc-sdk:9.22.2 (1 constraints: f50ebb71)com.squareup.okhttp3:mockwebserver:4.9.3 (1 constraints: c60ebf62)com.squareup.okhttp3:okhttp:4.9.3 (1 constraints: 3f0f516d)com.squareup.okio:okio:2.8.0 (1 constraints: 540c39fd)-com.sun.jersey:jersey-servlet:1.19 (1 constraints: df04fa30)io.github.microutils:kotlin-logging:2.1.21 (1 constraints: ec0e8871)io.github.microutils:kotlin-logging-jvm:2.1.21 (1 constraints: af0f358c)io.micrometer:micrometer-core:1.5.14 (1 constraints: fc161b19)@@ -290,8 +291,9 @@ net.bytebuddy:byte-buddy:1.10.20 (2 constraints: 7c10a9d0)net.minidev:accessors-smart:2.4.7 (1 constraints: 4e0a90b8)net.minidev:json-smart:2.4.7 (1 constraints: 160e936e)no.nav.security:mock-oauth2-server:0.4.3 (1 constraints: 0905fa35)-org.apache.hadoop:hadoop-hdfs:3.2.0 (1 constraints: 07050036)-org.apache.hadoop:hadoop-minikdc:3.2.0 (1 constraints: 07050036)+org.apache.hadoop:hadoop-client-minicluster:3.3.1 (1 constraints: 09050436)+org.apache.hadoop:hadoop-hdfs:3.3.1 (1 constraints: 09050436)+org.apache.hadoop:hadoop-minikdc:3.3.1 (1 constraints: 09050436)org.apache.kerby:kerb-admin:1.0.1 (1 constraints: 840d892f)org.apache.kerby:kerb-client:1.0.1 (1 constraints: 840d892f)org.apache.kerby:kerb-common:1.0.1 (2 constraints: a51841ca)diff --git a/versions.props b/versions.propsindex 3915dbd0ea5..e266a4c3487 100644--- a/versions.props+++ b/versions.props@@ -6,7 +6,7 @@ com.cybozu.labs:langdetect=1.1-20120112com.drewnoakes:metadata-extractor=2.11.0com.epam:parso=2.0.11com.esri.geometry:esri-geometry-api=2.2.0-com.fasterxml.jackson*:*=2.12.3+com.fasterxml.jackson*:*=2.13.1com.fasterxml.woodstox:woodstox-core=6.2.4com.github.ben-manes.caffeine:caffeine=3.0.5com.github.spotbugs:*=4.5.3@@ -33,8 +33,7 @@ com.google.http-client:google-http-client-jackson2=1.32.1com.google.http-client:google-http-client=1.32.1com.google.j2objc:j2objc-annotations=1.1com.google.oauth-client:google-oauth-client=1.32.1-com.google.protobuf:protobuf-java-util=3.11.0-com.google.protobuf:protobuf-java=3.11.0+com.google.protobuf:protobuf-java*=3.11.0com.google.re2j:re2j=1.2com.googlecode.juniversalchardet:juniversalchardet=1.0.3com.googlecode.mp4parser:isoparser=1.1.22@@ -45,7 +44,6 @@ com.jayway.jsonpath:json-path=2.4.0com.lmax:disruptor=3.4.2com.pff:java-libpst=0.8.1com.rometools:*=1.12.2-com.sun.jersey:*=1.19com.tdunning:t-digest=3.1commons-cli:commons-cli=1.4commons-codec:commons-codec=1.13@@ -74,18 +72,19 @@ org.apache.calcite.avatica:avatica-core=1.18.0org.apache.calcite:*=1.27.0org.apache.commons:commons-collections4=4.4org.apache.commons:commons-compress=1.21-org.apache.commons:commons-configuration2=2.1.1+org.apache.commons:commons-configuration2=2.7org.apache.commons:commons-csv=1.7org.apache.commons:commons-exec=1.3-org.apache.commons:commons-lang3=3.9+org.apache.commons:commons-lang3=3.12.0org.apache.commons:commons-math3=3.6.1-org.apache.commons:commons-text=1.6-org.apache.curator:*=2.13.0-org.apache.hadoop:*=3.2.0+org.apache.commons:commons-text=1.8+org.apache.curator:*=4.3.0+org.apache.hadoop.thirdparty:*=1.1.1+org.apache.hadoop:*=3.3.1org.apache.htrace:htrace-core4=4.1.0-incubatingorg.apache.httpcomponents:httpclient=4.5.13-org.apache.httpcomponents:httpcore=4.4.13-org.apache.httpcomponents:httpmime=4.5.10+org.apache.httpcomponents:httpcore=4.4.15+org.apache.httpcomponents:httpmime=4.5.13org.apache.james:apache-mime4j*=0.8.3org.apache.kerby:*=1.0.1org.apache.logging.log4j:*=2.17.1