@@ -669,8 +669,8 @@ public Path resolveLocalFilePath(SftpSubsystemProxy subsystem, Path rootDir, Str
669669 int sshPort = sshd .getPort ();
670670 logger .info ("SSH server started on localhost:{}" , sshPort );
671671
672- // We try with a document that does not exist
673- String json = """
672+ // We try with a document that does not exist (use Locale.ROOT so port is always ASCII digits in JSON)
673+ String json = String . format ( Locale . ROOT , """
674674 {
675675 "type": "ssh",
676676 "ssh": {
@@ -681,13 +681,13 @@ public Path resolveLocalFilePath(SftpSubsystemProxy subsystem, Path rootDir, Str
681681 "path": "/doesnotexist.txt"
682682 }
683683 }
684- """ . formatted ( sshPort , sshUsername , sshPassword );
684+ """ , sshPort , sshUsername , sshPassword );
685685 UploadResponse uploadResponse = post (target , "/_document" , json , UploadResponse .class );
686686 assertThat (uploadResponse .isOk ()).isFalse ();
687687 assertThat (uploadResponse .getMessage ()).contains ("does not exist" );
688688
689- // We try with an existing document
690- json = """
689+ // We try with an existing document (use Locale.ROOT so port is always ASCII digits in JSON)
690+ json = String . format ( Locale . ROOT , """
691691 {
692692 "type": "ssh",
693693 "ssh": {
@@ -698,7 +698,7 @@ public Path resolveLocalFilePath(SftpSubsystemProxy subsystem, Path rootDir, Str
698698 "path": "/testfile.txt"
699699 }
700700 }
701- """ . formatted ( sshPort , sshUsername , sshPassword );
701+ """ , sshPort , sshUsername , sshPassword );
702702 uploadResponse = post (target , "/_document" , json , UploadResponse .class );
703703 assertThat (uploadResponse .isOk ()).isTrue ();
704704
@@ -739,8 +739,8 @@ public void uploadDocumentWithFtpPlugin() throws Exception {
739739 int ftpPort = fakeFtpServer .getServerControlPort ();
740740 logger .info ("FTP server started on localhost:{}" , ftpPort );
741741
742- // We try with a document that does not exist
743- String json = """
742+ // We try with a document that does not exist (use Locale.ROOT so port is always ASCII digits in JSON)
743+ String json = String . format ( Locale . ROOT , """
744744 {
745745 "type": "ftp",
746746 "ftp": {
@@ -751,13 +751,13 @@ public void uploadDocumentWithFtpPlugin() throws Exception {
751751 "path": "/doesnotexist.txt"
752752 }
753753 }
754- """ . formatted ( ftpPort , ftpUser , ftpPass );
754+ """ , ftpPort , ftpUser , ftpPass );
755755 UploadResponse uploadResponse = post (target , "/_document" , json , UploadResponse .class );
756756 assertThat (uploadResponse .isOk ()).isFalse ();
757757 assertThat (uploadResponse .getMessage ()).contains ("does not exist" );
758758
759- // We try with an existing document
760- json = """
759+ // We try with an existing document (use Locale.ROOT so port is always ASCII digits in JSON)
760+ json = String . format ( Locale . ROOT , """
761761 {
762762 "type": "ftp",
763763 "ftp": {
@@ -768,7 +768,7 @@ public void uploadDocumentWithFtpPlugin() throws Exception {
768768 "path": "/testfile.txt"
769769 }
770770 }
771- """ . formatted ( ftpPort , ftpUser , ftpPass );
771+ """ , ftpPort , ftpUser , ftpPass );
772772 uploadResponse = post (target , "/_document" , json , UploadResponse .class );
773773 assertThat (uploadResponse .isOk ()).isTrue ();
774774
0 commit comments