This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit eceb9d12f21b78b3bd6da1c9f176e135563c61c1 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Nov 13 18:22:37 2019 +0000 Align with 9.0.x/8/5/x. Improve i18n --- .../catalina/ha/deploy/FileMessageFactory.java | 66 ++++++++-------------- .../catalina/ha/deploy/LocalStrings.properties | 6 ++ .../catalina/ha/deploy/LocalStrings_de.properties | 2 + .../catalina/ha/deploy/LocalStrings_es.properties | 2 + .../catalina/ha/deploy/LocalStrings_fr.properties | 6 ++ .../catalina/ha/deploy/LocalStrings_ja.properties | 6 ++ .../catalina/ha/deploy/LocalStrings_ko.properties | 6 ++ .../ha/deploy/LocalStrings_zh_CN.properties | 2 + 8 files changed, 55 insertions(+), 41 deletions(-) diff --git a/java/org/apache/catalina/ha/deploy/FileMessageFactory.java b/java/org/apache/catalina/ha/deploy/FileMessageFactory.java index fec3522..892ea0c 100644 --- a/java/org/apache/catalina/ha/deploy/FileMessageFactory.java +++ b/java/org/apache/catalina/ha/deploy/FileMessageFactory.java @@ -42,14 +42,12 @@ import org.apache.tomcat.util.res.StringManager; * To force a cleanup, call cleanup() from the calling object. <BR> * This class is not thread safe. * - * @author Filip Hanik * @version 1.0 */ public class FileMessageFactory { /*--Static Variables----------------------------------------*/ private static final Log log = LogFactory.getLog(FileMessageFactory.class); - private static final StringManager sm = - StringManager.getManager(Constants.Package); + private static final StringManager sm = StringManager.getManager(FileMessageFactory.class); /** * The number of bytes that we read from file @@ -68,7 +66,7 @@ public class FileMessageFactory { protected boolean openForWrite; /** - * Once the factory is used, it can not be reused. + * Once the factory is used, it cannot be reused. */ protected boolean closed = false; @@ -107,8 +105,7 @@ public class FileMessageFactory { * everything is worked as expected, messages will spend very little time in * the buffer. */ - protected Map<Long, FileMessage> msgBuffer = - new ConcurrentHashMap<Long, FileMessage>(); + protected Map<Long, FileMessage> msgBuffer = new ConcurrentHashMap<Long, FileMessage>(); /** * The bytes that we hold the data in, not thread safe. @@ -239,36 +236,26 @@ public class FileMessageFactory { */ public boolean writeMessage(FileMessage msg) throws IllegalArgumentException, IOException { - if (!openForWrite) - throw new IllegalArgumentException( - "Can't write message, this factory is reading."); + if (!openForWrite) { + throw new IllegalArgumentException(sm.getString("fileMessageFactory.cannotWrite")); + } if (log.isDebugEnabled()) log.debug("Message " + msg + " data " + HexUtils.toHexString(msg.getData()) + " data length " + msg.getDataLength() + " out " + out); if (msg.getMessageNumber() <= lastMessageProcessed.get()) { // Duplicate of message already processed - log.warn("Receive Message again -- Sender ActTimeout too short [ name: " - + msg.getContextName() - + " war: " - + msg.getFileName() - + " data: " - + HexUtils.toHexString(msg.getData()) - + " data length: " + msg.getDataLength() + " ]"); + log.warn(sm.getString("fileMessageFactory.duplicateMessage", msg.getContextName(), msg.getFileName(), + HexUtils.toHexString(msg.getData()), Integer.valueOf(msg.getDataLength()))); return false; } FileMessage previous = msgBuffer.put(Long.valueOf(msg.getMessageNumber()), msg); - if (previous !=null) { + if (previous != null) { // Duplicate of message not yet processed - log.warn("Receive Message again -- Sender ActTimeout too short [ name: " - + msg.getContextName() - + " war: " - + msg.getFileName() - + " data: " - + HexUtils.toHexString(msg.getData()) - + " data length: " + msg.getDataLength() + " ]"); + log.warn(sm.getString("fileMessageFactory.duplicateMessage", msg.getContextName(), msg.getFileName(), + HexUtils.toHexString(msg.getData()), Integer.valueOf(msg.getDataLength()))); return false; } @@ -337,24 +324,22 @@ public class FileMessageFactory { * asked to do. Invoked by readMessage/writeMessage before those methods * proceed. * - * @param openForWrite - * boolean - * @throws IllegalArgumentException + * @param openForWrite The value to check + * @throws IllegalArgumentException if the state is not the expected one */ protected void checkState(boolean openForWrite) throws IllegalArgumentException { if (this.openForWrite != openForWrite) { cleanup(); - if (openForWrite) - throw new IllegalArgumentException( - "Can't write message, this factory is reading."); - else - throw new IllegalArgumentException( - "Can't read message, this factory is writing."); + if (openForWrite) { + throw new IllegalArgumentException(sm.getString("fileMessageFactory.cannotWrite")); + } else { + throw new IllegalArgumentException(sm.getString("fileMessageFactory.cannotRead")); + } } if (this.closed) { cleanup(); - throw new IllegalArgumentException("Factory has been closed."); + throw new IllegalArgumentException(sm.getString("fileMessageFactory.closed")); } } @@ -364,14 +349,11 @@ public class FileMessageFactory { * @param args * String[], args[0] - read from filename, args[1] write to * filename - * @throws Exception + * @throws Exception An error occurred */ public static void main(String[] args) throws Exception { - - System.out - .println("Usage: FileMessageFactory fileToBeRead fileToBeWritten"); - System.out - .println("Usage: This will make a copy of the file on the local file system"); + System.out.println("Usage: FileMessageFactory fileToBeRead fileToBeWritten"); + System.out.println("Usage: This will make a copy of the file on the local file system"); FileMessageFactory read = getInstance(new File(args[0]), false); FileMessageFactory write = getInstance(new File(args[1]), true); FileMessage msg = new FileMessage(null, args[0], args[0]); @@ -401,7 +383,9 @@ public class FileMessageFactory { int timeIdle = (int) ((timeNow - creationTime) / 1000L); if (timeIdle > maxValidTime) { cleanup(); - if (file.exists()) file.delete(); + if (file.exists() && !file.delete()) { + log.warn(sm.getString("fileMessageFactory.deleteFail", file)); + } return false; } } diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings.properties b/java/org/apache/catalina/ha/deploy/LocalStrings.properties index c84a00d..3fcb443 100644 --- a/java/org/apache/catalina/ha/deploy/LocalStrings.properties +++ b/java/org/apache/catalina/ha/deploy/LocalStrings.properties @@ -46,6 +46,12 @@ farmWarDeployer.undeployEnd=Undeployment from [{0}] finished. farmWarDeployer.undeployLocal=Undeploy local context [{0}] farmWarDeployer.watchDir=Cluster deployment is watching [{0}] for changes. +fileMessageFactory.cannotRead=Cannot read message, this factory is writing +fileMessageFactory.cannotWrite=Cannot write message, this factory is reading +fileMessageFactory.closed=Factory has been closed +fileMessageFactory.deleteFail=Failed to delete [{0}] +fileMessageFactory.duplicateMessage=Received duplicate message. Is the Sender timeout too low? context: [{0}] filename: [{1}] data: [{2}] data length: [{3}] + fileNewFail=Unable to create [{0}] warWatcher.cantListWatchDir=Cannot list files in WatchDir [{0}]: check to see if it is a directory and has read permissions. diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings_de.properties b/java/org/apache/catalina/ha/deploy/LocalStrings_de.properties index 362b1a1..d09bce9 100644 --- a/java/org/apache/catalina/ha/deploy/LocalStrings_de.properties +++ b/java/org/apache/catalina/ha/deploy/LocalStrings_de.properties @@ -19,5 +19,7 @@ farmWarDeployer.msgIoe=Die Farm-Deploy-Datei-Nachricht kann nicht gelesen werden farmWarDeployer.servicingUndeploy=Applikation [{0}] ist noch aktiv und kann nicht vom Backup-Cluster-Knoten entfernt werden farmWarDeployer.undeployEnd=Undeployment von [{0}] beendet. +fileMessageFactory.duplicateMessage=Doppelte Nachricht empfangen. Ist der Timeout für den Sender zu niedrig? Context: [{0}] Dateiname: [{1}] Daten: [{2}] Datenlänge [{3}] + warWatcher.cantListWatchDir=Dateien in WatchDir [{0}] können nicht gelistet werdenm: Prüfen Sie dass Lesezugriff auf das Verzeichnis besteht warWatcher.checkingWar=WAR-Datei [{0}] wird geprüft. diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings_es.properties b/java/org/apache/catalina/ha/deploy/LocalStrings_es.properties index d886cce..77e9273 100644 --- a/java/org/apache/catalina/ha/deploy/LocalStrings_es.properties +++ b/java/org/apache/catalina/ha/deploy/LocalStrings_es.properties @@ -24,6 +24,8 @@ farmWarDeployer.sendFragment=Fragmento war enviado al cluster con camino [{0}], farmWarDeployer.servicingUndeploy=La applicación [{0}] esta en servicion y no pude ser removida del nodo de respaldo del cluster farmWarDeployer.undeployEnd=El revertimiendo del despliegue de [{0}] ha terminado.\n +fileMessageFactory.deleteFail=Fallo al borrar [{0}]\n + warWatcher.cantListWatchDir=No se pueden listar archivos en WatchDir [{0}]: verifique si es un directorio y tiene permisos de lectura.\n warWatcher.checkWarResult=WarInfo.check() devolvió [{0}] para [{1}] warWatcher.checkingWar=Verificando archivo WAR [{0}] diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings_fr.properties b/java/org/apache/catalina/ha/deploy/LocalStrings_fr.properties index efdded8..133a41e 100644 --- a/java/org/apache/catalina/ha/deploy/LocalStrings_fr.properties +++ b/java/org/apache/catalina/ha/deploy/LocalStrings_fr.properties @@ -43,6 +43,12 @@ farmWarDeployer.undeployEnd=Retrait de [{0}] terminé farmWarDeployer.undeployLocal=Le contexte local [{0}] est retiré farmWarDeployer.watchDir=Le déploiement du cluster surveille [{0}] pour des modifications +fileMessageFactory.cannotRead=Impossible de lire un message, cette fabrique est en train d'écrire +fileMessageFactory.cannotWrite=Impossible d'écrire un message, cette fabrique est en train de lire +fileMessageFactory.closed=La fabrique a été fermée +fileMessageFactory.deleteFail=Impossible de supprimer [{0}] +fileMessageFactory.duplicateMessage=Réception de message en double, le délai d''attente maximum de l''expéditeur pourrait être trop court; contexte: [{0}] nom de fichier: [{1}] données: [{2}] longueur des données: [{3}] + fileNewFail=Impossible de créer [{0}] warWatcher.cantListWatchDir=Incapacité de lister les fichiers dans le répertoire WatchDir [{0}]: vérifiez qu''il s''agit d''un répertoire et qu''il a la permission de lecture. diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings_ja.properties b/java/org/apache/catalina/ha/deploy/LocalStrings_ja.properties index 3fd5af8..887abe8 100644 --- a/java/org/apache/catalina/ha/deploy/LocalStrings_ja.properties +++ b/java/org/apache/catalina/ha/deploy/LocalStrings_ja.properties @@ -43,6 +43,12 @@ farmWarDeployer.undeployEnd=コンテキスト [{0}] の配置解除が完了し farmWarDeployer.undeployLocal=ローカルコンテキスト [{0}] を配置解除します。 farmWarDeployer.watchDir=クラスタデプロイメントの監視[{0}]が変更されています。 +fileMessageFactory.cannotRead=メッセージを読むことができません。このFactoryは書き込み中です。 +fileMessageFactory.cannotWrite=メッセージを書き込めません、このFactoryは読み込み中です。 +fileMessageFactory.closed=FileMessageFactoryはクローズされています。 +fileMessageFactory.deleteFail=[{0}]を削除できませんでした +fileMessageFactory.duplicateMessage=メッセージをもう一度受信します。SenderのActTimeoutが短すぎます。 名前:[{0}] war:[{1}] データ:[{2}] データ長:[{3}] + fileNewFail=[{0}]を作成できません。 warWatcher.cantListWatchDir=監視ディレクトリ [{0}] のファイル一覧を取得できません : ディレクトリの読み取り権限を確認してください。 diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings_ko.properties b/java/org/apache/catalina/ha/deploy/LocalStrings_ko.properties index 5bc13cd..0f816aa 100644 --- a/java/org/apache/catalina/ha/deploy/LocalStrings_ko.properties +++ b/java/org/apache/catalina/ha/deploy/LocalStrings_ko.properties @@ -43,6 +43,12 @@ farmWarDeployer.undeployEnd=컨텍스트 [{0}]의 배치를 제거했습니다. farmWarDeployer.undeployLocal=로컬 컨텍스트 [{0}]의 배치를 제거합니다. farmWarDeployer.watchDir=클러스터 배치관리자가 변경사항들을 탐지하기 위해 [{0}]을(를) 감시합니다. +fileMessageFactory.cannotRead=팩토리가 쓰고 있는 중이라서, 메시지를 읽을 수 없습니다. +fileMessageFactory.cannotWrite=팩토리가 읽고 있는 중이라서, 메시지를 쓸 수 없습니다. +fileMessageFactory.closed=팩토리가 이미 닫혀 있습니다. +fileMessageFactory.deleteFail=[{0}]을(를) 삭제하지 못했습니다. +fileMessageFactory.duplicateMessage=중복된 메시지를 받았습니다. Sender의 제한 시간 초과 값이 너무 작게 설정되었나요? 컨텍스트: [{0}], 파일명: [{1}], 데이터: [{2}], 데이터 길이: [{3}] + fileNewFail=[{0}]을(를) 생성할 수 없습니다. warWatcher.cantListWatchDir=WatchDir [{0}] 내의 파일 목록을 구할 수 없습니다. 해당 디렉토리가 존재하는지 그리고 읽기 권한이 있는지 점검하십시오. diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings_zh_CN.properties b/java/org/apache/catalina/ha/deploy/LocalStrings_zh_CN.properties index 0fbf775..f65f96a 100644 --- a/java/org/apache/catalina/ha/deploy/LocalStrings_zh_CN.properties +++ b/java/org/apache/catalina/ha/deploy/LocalStrings_zh_CN.properties @@ -30,6 +30,8 @@ farmWarDeployer.servicingUndeploy=正在处理应用程序[{0}],无法从备 farmWarDeployer.undeployEnd=从[{0}]取消部署完成。 farmWarDeployer.undeployLocal=不能部署本地上下文[{0}] +fileMessageFactory.deleteFail=无法删除 [{0}] + warWatcher.cantListWatchDir=无法列出WatchDir文件夹 [{0}] 中的文件:检查该路径是否为目录且应用具有读取权限。 warWatcher.checkWarResult=WarInfo.check() 为[{1}]返回[{0}] warWatcher.checkingWar=检查 WAR 文件 [{0}] --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org