Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2376

A NumberFormatException occurs when starting the groovy console in the command line

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5
    • 1.5.1
    • None
    • None
    • Microsoft Windows XP Professional Version 2002 Service Pack 2

    Description

      When I started the groovy console in the command line, a NumberFormatException was thrown. This is due to try to parse system property named "os.version" as a float value, but failed. Because the value on my machine is "5.1 build 2600 Service Pack 2".
      The groovy file the exception thrown is called WindowsDefaults.groovy under package "groovy.ui.view".

      Below is the exception stack trace:

      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:64)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:615)
      at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java
      :101)
      at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
      Caused by: java.lang.NumberFormatException: For input string: "5.1 build 2600 Se
      rvice Pack 2"
      at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:12
      39)
      at java.lang.Float.valueOf(Float.java:375)
      at org.codehaus.groovy.runtime.DefaultGroovyMethods.toFloat(DefaultGroov
      yMethods.java:6293)
      at org.codehaus.groovy.runtime.DefaultGroovyMethods.asType(DefaultGroovy
      Methods.java:8479)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:64)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:615)
      at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(Ref
      lectionMetaMethod.java:56)
      at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(Ne
      wInstanceMetaMethod.java:54)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassH
      elper.java:599)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:742)
      at org.codehaus.groovy.runtime.Invoker.invokePojoMethod(Invoker.java:87)

      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:75)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.
      java:66)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(Scrip
      tBytecodeAdapter.java:165)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.asType(ScriptByteco
      deAdapter.java:613)
      at groovy.ui.view.WindowsDefaults.run(WindowsDefaults.groovy:11)
      at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:67
      0)
      at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:65
      8)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:64)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:615)
      at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(Ref
      lectionMetaMethod.java:56)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassH
      elper.java:599)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:742)
      at org.codehaus.groovy.runtime.Invoker.invokePogoMethod(Invoker.java:99)

      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:79)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.
      java:66)
      at groovy.util.FactoryInterceptorMetaClass.invokeMethod(FactoryBuilderSu
      pport.java:807)
      at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java
      :44)
      at groovy.lang.Script.invokeMethod(Script.java:78)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurre
      ntN(ScriptBytecodeAdapter.java:80)
      at groovy.ui.ConsoleView.run(ConsoleView.groovy:27)
      at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:67
      0)
      at groovy.util.FactoryBuilderSupport.build(FactoryBuilderSupport.java:65
      8)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:64)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:615)
      at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(Ref
      lectionMetaMethod.java:56)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassH
      elper.java:599)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:742)
      at org.codehaus.groovy.runtime.Invoker.invokePogoMethod(Invoker.java:99)

      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:79)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.
      java:66)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(Scrip
      tBytecodeAdapter.java:165)
      at groovy.ui.Console.run(Console.groovy:165)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:64)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:615)
      at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(Ref
      lectionMetaMethod.java:56)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassH
      elper.java:599)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:742)
      at org.codehaus.groovy.runtime.Invoker.invokePogoMethod(Invoker.java:99)

      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:79)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.
      java:66)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(Scrip
      tBytecodeAdapter.java:165)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(Scrip
      tBytecodeAdapter.java:193)
      at groovy.ui.Console.main(Console.groovy:123)
      ... 6 more

      Attachments

        Activity

          People

            shemnon Daniel Ferrin
            alexcheng1982 Fu Cheng
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: