Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35402

Re: What happens when format gets a wrong argument

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: What happens when format gets a wrong argument
Date Thu, 18 Aug 2016 19:31:42 -0400
Organization Aioe.org NNTP Server
Lines 18
Message-ID <np5ggu$b69$1@gioia.aioe.org> (permalink)
References <87eg5lkd05.fsf@Equus.decebal.nl>
NNTP-Posting-Host 7SK6yTFfqwlIPNBLl3l7Qg.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.java.programmer:35402

Show key headers only | View raw


On 8/18/2016 5:01 PM, Cecil Westerhof wrote:
> I had a function in ScheduledExecutorService where I changed a
> parameter for format from long to double, but I forgot to change the
> format string. The result was that the function gets an unchecked
> IllegalFormatConversionException and silently terminated on the format
> statement. Is this normal? And where do I find a good description
> about this?

As already explained by others then this is documented behavior.

And many people would consider it an advantage that this is type safe.

But if if you don't want that type safety then look at
MessageFormat.format!

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What happens when format gets a wrong argument Cecil Westerhof <Cecil@decebal.nl> - 2016-08-18 23:01 +0200
  Re: What happens when format gets a wrong argument Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-18 17:31 -0400
    Re: What happens when format gets a wrong argument Arne Vajhøj <arne@vajhoej.dk> - 2016-08-18 19:21 -0400
      Re: What happens when format gets a wrong argument Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-19 08:22 -0400
        Re: What happens when format gets a wrong argument Gene Wirchenko <genew@telus.net> - 2016-08-19 10:40 -0700
        Re: What happens when format gets a wrong argument Arne Vajhøj <arne@vajhoej.dk> - 2016-08-19 20:19 -0400
  Re: What happens when format gets a wrong argument Cecil Westerhof <Cecil@decebal.nl> - 2016-08-19 01:25 +0200
  Re: What happens when format gets a wrong argument Arne Vajhøj <arne@vajhoej.dk> - 2016-08-18 19:31 -0400
  Re: What happens when format gets a wrong argument Arne Vajhøj <arne@vajhoej.dk> - 2016-08-18 19:35 -0400
    Re: What happens when format gets a wrong argument Cecil Westerhof <Cecil@decebal.nl> - 2016-08-19 07:23 +0200

csiph-web