Return-Path: Delivered-To: apmail-mina-dev-archive@www.apache.org Received: (qmail 43255 invoked from network); 23 Feb 2011 17:49:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Feb 2011 17:49:06 -0000 Received: (qmail 69804 invoked by uid 500); 23 Feb 2011 17:49:05 -0000 Delivered-To: apmail-mina-dev-archive@mina.apache.org Received: (qmail 69482 invoked by uid 500); 23 Feb 2011 17:49:03 -0000 Mailing-List: contact dev-help@mina.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mina.apache.org Delivered-To: mailing list dev@mina.apache.org Received: (qmail 69474 invoked by uid 99); 23 Feb 2011 17:49:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Feb 2011 17:49:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Feb 2011 17:48:59 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 74B681B3852 for ; Wed, 23 Feb 2011 17:48:38 +0000 (UTC) Date: Wed, 23 Feb 2011 17:48:38 +0000 (UTC) From: "Kevin Bulebush (JIRA)" To: dev@mina.apache.org Message-ID: <1401203159.11411.1298483318474.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <15528467.192851295975804190.JavaMail.jira@thor> Subject: [jira] Updated: (SSHD-104) FormatFlagsConversionMismatchException when using IBM JVM. Format String is invalid. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/SSHD-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Bulebush updated SSHD-104: -------------------------------- I believe the right fix is to remove the # flag from the format string. My patch, built against tag sshd-0.5.0 is: ### Eclipse Workspace Patch 1.0 #P sshd-core Index: src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java =================================================================== --- src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java (revision 1073841) +++ src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java (working copy) @@ -840,7 +840,7 @@ } long length = f.getSize(); - String lengthString = String.format("%1$#8s", length); + String lengthString = String.format("%1$8s", length); StringBuilder sb = new StringBuilder(); sb.append((f.isDirectory() ? "d" : "-")); > FormatFlagsConversionMismatchException when using IBM JVM. Format String is invalid. > ------------------------------------------------------------------------------------ > > Key: SSHD-104 > URL: https://issues.apache.org/jira/browse/SSHD-104 > Project: MINA SSHD > Issue Type: Bug > Affects Versions: 0.5.0, 0.6.0 > Environment: IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr8ifx-20100609_59383 (JIT enabled, AOT enabled) > 2.6.35-24-generic #42-Ubuntu SMP (Ubuntu 10.10) > Reporter: Kevin Bulebush > Priority: Critical > Fix For: 0.6.0 > > Original Estimate: 1h > Remaining Estimate: 1h > > The following exception is thrown when using SFTP client FileZilla and Mina is running on the IBM JVM: > java.util.FormatFlagsConversionMismatchException: Mismatched Convertor =s, Flags= # > at java.util.Formatter$Transformer.transformFromString(Formatter.java:1020) > at java.util.Formatter$Transformer.transform(Formatter.java:861) > at java.util.Formatter.format(Formatter.java:565) > at java.util.Formatter.format(Formatter.java:509) > at java.lang.String.format(String.java:1960) > at org.apache.sshd.server.sftp.SftpSubsystem.getLongName(SftpSubsystem.java:843) > at org.apache.sshd.server.sftp.SftpSubsystem.sendPath(SftpSubsystem.java:806) > at org.apache.sshd.server.sftp.SftpSubsystem.process(SftpSubsystem.java:719) > at org.apache.sshd.server.sftp.SftpSubsystem.run(SftpSubsystem.java:331) > at java.lang.Thread.run(Thread.java:736) > Latest source shows the problem line: > 847 long length = f.getSize(); > 848 String lengthString = String.format("%1$#8s", length); > Simple test code also reproduces the problem: > public static void main(String [] args) { > long length = 12312342; > String lengthString = String.format("%1$#8s", length); > System.out.println(lengthString); > } > If I understand the Formatter class documentation, I'm surprised the format call works at all on the Sun JVM. It says the # flag is only applicable for Integral types with o, x, and X conversions only. Further down in the documentation for 's' conversion, it says > "If the '#' flag is given and the argument is not a Formattable , then a FormatFlagsConversionMismatchException will be thrown." > Assuming the long above is autoboxed to Long, Long does not implement Formattable. > I believe a different method should be used for converting this long to string. I'm not sure of the original intent, but maybe the the 'd' conversion was intended rather than the 's' conversion to output the long in base 10, but then I don't understand the use of #. -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira