java.util.IllegalFormatConversionException: d is incompatible with java.lang.Double

Appcelerator JIRA | Paul Mietz Egli | 5 years ago
  1. 0

    h4. Problem Description Integer format strings that contain positional arguments result in an IllegalFormatConversionException when passed to String.format(). If the positional part of the format is removed, the call works fine. h4. Expected Results Strings with positional should work fine. h4. Actual results The strings with positional information are throwing an exception. h4. Test case {code} var win = Ti.UI.createWindow(); Ti.API.info(String.format('non-positional: %d', 1)); Ti.API.info(String.format('positional: %1$d', 1)); win.open(); {code} h4. Crashlog {code} /TiAPI ( 275): non-positional: 1 E/TitaniumModule( 275): (KrollRuntimeThread) [363,3214] Error in string format E/TitaniumModule( 275): java.util.IllegalFormatConversionException: d is incompatible with java.lang.Double E/TitaniumModule( 275): at java.util.Formatter$Transformer.badArgumentType(Formatter.java:1452) E/TitaniumModule( 275): at java.util.Formatter$Transformer.transformFromInteger(Formatter.java:1683) E/TitaniumModule( 275): at java.util.Formatter$Transformer.transform(Formatter.java:1410) E/TitaniumModule( 275): at java.util.Formatter.doFormat(Formatter.java:1082) E/TitaniumModule( 275): at java.util.Formatter.format(Formatter.java:994) E/TitaniumModule( 275): at java.lang.String.format(String.java:2254) E/TitaniumModule( 275): at java.lang.String.format(String.java:2219) E/TitaniumModule( 275): at ti.modules.titanium.TitaniumModule.stringFormat(TitaniumModule.java:294) E/TitaniumModule( 275): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) E/TitaniumModule( 275): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:116) E/TitaniumModule( 275): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:207) E/TitaniumModule( 275): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:136) E/TitaniumModule( 275): at android.os.Handler.dispatchMessage(Handler.java:95) E/TitaniumModule( 275): at android.os.Looper.loop(Looper.java:123) E/TitaniumModule( 275): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:102) I/TiAPI ( 275): null {code}

    Appcelerator JIRA | 5 years ago | Paul Mietz Egli
    java.util.IllegalFormatConversionException: d is incompatible with java.lang.Double
  2. 0

    h4. Problem Description Integer format strings that contain positional arguments result in an IllegalFormatConversionException when passed to String.format(). If the positional part of the format is removed, the call works fine. h4. Expected Results Strings with positional should work fine. h4. Actual results The strings with positional information are throwing an exception. h4. Test case {code} var win = Ti.UI.createWindow(); Ti.API.info(String.format('non-positional: %d', 1)); Ti.API.info(String.format('positional: %1$d', 1)); win.open(); {code} h4. Crashlog {code} /TiAPI ( 275): non-positional: 1 E/TitaniumModule( 275): (KrollRuntimeThread) [363,3214] Error in string format E/TitaniumModule( 275): java.util.IllegalFormatConversionException: d is incompatible with java.lang.Double E/TitaniumModule( 275): at java.util.Formatter$Transformer.badArgumentType(Formatter.java:1452) E/TitaniumModule( 275): at java.util.Formatter$Transformer.transformFromInteger(Formatter.java:1683) E/TitaniumModule( 275): at java.util.Formatter$Transformer.transform(Formatter.java:1410) E/TitaniumModule( 275): at java.util.Formatter.doFormat(Formatter.java:1082) E/TitaniumModule( 275): at java.util.Formatter.format(Formatter.java:994) E/TitaniumModule( 275): at java.lang.String.format(String.java:2254) E/TitaniumModule( 275): at java.lang.String.format(String.java:2219) E/TitaniumModule( 275): at ti.modules.titanium.TitaniumModule.stringFormat(TitaniumModule.java:294) E/TitaniumModule( 275): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) E/TitaniumModule( 275): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:116) E/TitaniumModule( 275): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:207) E/TitaniumModule( 275): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:136) E/TitaniumModule( 275): at android.os.Handler.dispatchMessage(Handler.java:95) E/TitaniumModule( 275): at android.os.Looper.loop(Looper.java:123) E/TitaniumModule( 275): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:102) I/TiAPI ( 275): null {code}

    Appcelerator JIRA | 5 years ago | Paul Mietz Egli
    java.util.IllegalFormatConversionException: d is incompatible with java.lang.Double
  3. 0

    Getting this error when launching KS (it doesn't crash the app): 03-30 17:38:33.941: E/TitaniumModule(3794): (KrollRuntimeThread) [894,1676] Error in string format 03-30 17:38:33.941: E/TitaniumModule(3794): java.util.IllegalFormatConversionException: %f can't format java.lang.Integer arguments 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.badArgumentType(Formatter.java:1520) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.transformFromFloat(Formatter.java:2080) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.transform(Formatter.java:1496) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.doFormat(Formatter.java:1101) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.format(Formatter.java:1062) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.format(Formatter.java:1031) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.lang.String.format(String.java:2177) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.lang.String.format(String.java:2151) 03-30 17:38:33.941: E/TitaniumModule(3794): at ti.modules.titanium.TitaniumModule.stringFormat(TitaniumModule.java:299) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:134) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:267) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:160) 03-30 17:38:33.941: E/TitaniumModule(3794): at android.os.Handler.dispatchMessage(Handler.java:95) 03-30 17:38:33.941: E/TitaniumModule(3794): at android.os.Looper.loop(Looper.java:123) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:104)

    Appcelerator JIRA | 5 years ago | Hieu Pham
    java.util.IllegalFormatConversionException: %f can't format java.lang.Integer arguments
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Getting this error when launching KS (it doesn't crash the app): 03-30 17:38:33.941: E/TitaniumModule(3794): (KrollRuntimeThread) [894,1676] Error in string format 03-30 17:38:33.941: E/TitaniumModule(3794): java.util.IllegalFormatConversionException: %f can't format java.lang.Integer arguments 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.badArgumentType(Formatter.java:1520) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.transformFromFloat(Formatter.java:2080) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.transform(Formatter.java:1496) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.doFormat(Formatter.java:1101) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.format(Formatter.java:1062) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.util.Formatter.format(Formatter.java:1031) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.lang.String.format(String.java:2177) 03-30 17:38:33.941: E/TitaniumModule(3794): at java.lang.String.format(String.java:2151) 03-30 17:38:33.941: E/TitaniumModule(3794): at ti.modules.titanium.TitaniumModule.stringFormat(TitaniumModule.java:299) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:134) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:267) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:160) 03-30 17:38:33.941: E/TitaniumModule(3794): at android.os.Handler.dispatchMessage(Handler.java:95) 03-30 17:38:33.941: E/TitaniumModule(3794): at android.os.Looper.loop(Looper.java:123) 03-30 17:38:33.941: E/TitaniumModule(3794): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:104)

    Appcelerator JIRA | 5 years ago | Hieu Pham
    java.util.IllegalFormatConversionException: %f can't format java.lang.Integer arguments
  6. 0

    android - ETPush IllegalFormatConversionException when location not available - Salesforce Stack Exchange

    stackexchange.com | 8 months ago
    java.util.IllegalFormatConversionException: %d can't format java.lang.String arguments
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.util.IllegalFormatConversionException

    d is incompatible with java.lang.Double

    at java.util.Formatter$Transformer.badArgumentType()
  2. Java RT
    String.format
    1. java.util.Formatter$Transformer.badArgumentType(Formatter.java:1452)
    2. java.util.Formatter$Transformer.transformFromInteger(Formatter.java:1683)
    3. java.util.Formatter$Transformer.transform(Formatter.java:1410)
    4. java.util.Formatter.doFormat(Formatter.java:1082)
    5. java.util.Formatter.format(Formatter.java:994)
    6. java.lang.String.format(String.java:2254)
    7. java.lang.String.format(String.java:2219)
    7 frames
  3. ti.modules.titanium
    TitaniumModule.stringFormat
    1. ti.modules.titanium.TitaniumModule.stringFormat(TitaniumModule.java:294)
    1 frame
  4. org.appcelerator.kroll
    V8Runtime.handleMessage
    1. org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
    2. org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:116)
    3. org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:207)
    4. org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:136)
    4 frames
  5. Android Platform
    Looper.loop
    1. android.os.Handler.dispatchMessage(Handler.java:95)
    2. android.os.Looper.loop(Looper.java:123)
    2 frames
  6. org.appcelerator.kroll
    KrollRuntime$KrollRuntimeThread.run
    1. org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:102)
    1 frame