We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
文字列型の負の数(-12.34)をJavaのdouble型にマッピングする場合、エラーが発生する。
com.gh.mygreen.xlsmapper.cellconvert.TypeBindException: Fail conversion field value '-12.34' => type 'double'. Cell 'F20' map to 'com.gh.mygreen.xlsmapper.cellconvert.CellConvertNumberTest$PrimitiveRecord#d'. at com.gh.mygreen.xlsmapper.cellconvert.AbstractCellConverter.newTypeBindException(AbstractCellConverter.java:39) at com.gh.mygreen.xlsmapper.cellconvert.converter.AbstractNumberCellConverter.toObject(AbstractNumberCellConverter.java:72) at com.gh.mygreen.xlsmapper.cellconvert.converter.AbstractNumberCellConverter.toObject(AbstractNumberCellConverter.java:1) at com.gh.mygreen.xlsmapper.fieldprocessor.processor.HorizontalRecordsProcessor.loadRecords(HorizontalRecordsProcessor.java:260) at com.gh.mygreen.xlsmapper.fieldprocessor.processor.HorizontalRecordsProcessor.loadProcess(HorizontalRecordsProcessor.java:91) at com.gh.mygreen.xlsmapper.fieldprocessor.processor.HorizontalRecordsProcessor.loadProcess(HorizontalRecordsProcessor.java:1) at com.gh.mygreen.xlsmapper.FieldAdaptorProxy.loadProcess(FieldAdaptorProxy.java:61) at com.gh.mygreen.xlsmapper.XlsLoader.loadSheet(XlsLoader.java:440) at com.gh.mygreen.xlsmapper.XlsLoader.load(XlsLoader.java:157) at com.gh.mygreen.xlsmapper.XlsLoader.load(XlsLoader.java:67) at com.gh.mygreen.xlsmapper.XlsMapper.load(XlsMapper.java:60) at com.gh.mygreen.xlsmapper.cellconvert.CellConvertNumberTest.test_load_number(CellConvertNumberTest.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.text.ParseException: '-12.34' cannot less than 0.000000 at com.gh.mygreen.xlsmapper.cellconvert.converter.AbstractNumberCellConverter.parseNumber(AbstractNumberCellConverter.java:171) at com.gh.mygreen.xlsmapper.cellconvert.converter.AbstractNumberCellConverter.toObject(AbstractNumberCellConverter.java:70) ... 36 more
The text was updated successfully, but these errors were encountered:
文字列型の場合、パースして数値に変換し、その際に、最大値、最小値の範囲に収まっているかどうか比較するが、double型のDouble.MIN_VALUEは、負の最小値ではなく、「正の最小非ゼロ値 2-1074 を保持する定数」なので、使い方が間違っている。
負の場合を取得したければ、Double.MAX_VALUEに負をとればよい。 floatの場合も同様。
Sorry, something went wrong.
fix v0.5
refs #23 文字列型のセルに負の数値をマッピングする際に、エラーが発生する事象を修正。
fe38747
No branches or pull requests
文字列型の負の数(-12.34)をJavaのdouble型にマッピングする場合、エラーが発生する。
The text was updated successfully, but these errors were encountered: