Skip to content
New issue

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

Incorrect handling when an Int argument is a string containing a real number #1923

Closed
jmartisk opened this issue Sep 29, 2023 · 1 comment
Closed

Comments

@jmartisk
Copy link
Member

When there's an argument of type Int, and I input a string that is a valid number, but it has a fractional part, then the client receives an exception including a stack trace>

{
  "details": "Error id 0780f752-0bc9-4592-9ab1-42268a75a798-1, java.lang.ArithmeticException: Rounding necessary",
  "stack": "java.lang.ArithmeticException: Rounding necessary\n\tat java.base/java.math.BigDecimal.commonNeedIncrement(BigDecimal.java:4717)\n\tat java.base/java.math.BigDecimal.needIncrement(BigDecimal.java:4767)\n\tat java.base/java.math.BigDecimal.divideAndRound(BigDecimal.java:4681)\n\tat java.base/java.math.BigDecimal.setScale(BigDecimal.java:2940)\n\tat java.base/java.math.BigDecimal.longValueExact(BigDecimal.java:3637)\n\tat java.base/java.math.BigDecimal.intValueExact(BigDecimal.java:3696)\n\tat io.smallrye.graphql.scalar.number.IntegerScalar$1.fromBigDecimal(IntegerScalar.java:24)\n\tat io.smallrye.graphql.scalar.number.NumberCoercing.parseLiteral(NumberCoercing.java:75)\n\tat graphql.schema.Coercing.parseLiteral(Coercing.java:181)\n\tat graphql.schema.Coercing.parseLiteral(Coercing.java:210)\n\tat graphql.validation.ValidationUtil.parseLiteral(ValidationUtil.java:124)\n\tat graphql.validation.ValidationUtil.isValidLiteralValue(ValidationUtil.java:96)\n\tat graphql.validation.ValidationUtil.isValidLiteralValue(ValidationUtil.java:92)\n\tat graphql.validation.rules.ArgumentsOfCorrectType.checkArgument(ArgumentsOfCorrectType.java:31)\n\tat graphql.validation.RulesVisitor.lambda$checkArgument$2(RulesVisitor.java:92)\n\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1511)\n\tat graphql.validation.RulesVisitor.checkArgument(RulesVisitor.java:92)\n\tat graphql.validation.RulesVisitor.enter(RulesVisitor.java:61)\n\tat graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:33)\n\tat graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)\n\tat graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)\n\tat graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)\n\tat graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)\n\tat graphql.validation.LanguageTraversal.traverse(LanguageTraversal.java:28)\n\tat graphql.validation.Validator.validateDocument(Validator.java:78)\n\tat graphql.ParseAndValidate.validate(ParseAndValidate.java:118)\n\tat graphql.GraphQL.validate(GraphQL.java:542)\n\tat graphql.GraphQL.parseAndValidate(GraphQL.java:504)\n\tat graphql.GraphQL.lambda$parseValidateAndExecute$10(GraphQL.java:468)\n\tat io.smallrye.graphql.execution.QueryCache.getDocument(QueryCache.java:36)\n\tat graphql.execution.preparsed.PreparsedDocumentProvider.getDocumentAsync(PreparsedDocumentProvider.java:47)\n\tat graphql.GraphQL.parseValidateAndExecute(GraphQL.java:470)\n\tat graphql.GraphQL.executeAsync(GraphQL.java:439)\n\tat io.smallrye.graphql.execution.ExecutionService.lambda$writeAsync$0(ExecutionService.java:216)\n\tat io.smallrye.context.impl.wrappers.SlowContextualSupplier.get(SlowContextualSupplier.java:21)\n\tat io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage.subscribe(UniCreateFromCompletionStage.java:24)\n\tat io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)\n\tat io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:51)\n\tat io.smallrye.mutiny.groups.UniSubscribe.with(UniSubscribe.java:110)\n\tat io.smallrye.mutiny.groups.UniSubscribe.with(UniSubscribe.java:88)\n\tat io.smallrye.graphql.execution.ExecutionService.writeAsync(ExecutionService.java:218)\n\tat io.smallrye.graphql.execution.ExecutionService.execute(ExecutionService.java:185)\n\tat io.smallrye.graphql.execution.ExecutionService.executeAsync(ExecutionService.java:121)\n\tat io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doRequest(SmallRyeGraphQLExecutionHandler.java:365)\n\tat io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.handlePost(SmallRyeGraphQLExecutionHandler.java:124)\n\tat io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doHandle(SmallRyeGraphQLExecutionHandler.java:85)\n\tat io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handleWithIdentity(SmallRyeGraphQLAbstractHandler.java:95)\n\tat io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:76)\n\tat io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:30)\n\tat io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1286)\n\tat io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:140)\n\tat io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:144)\n\tat io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.doEnd(BodyHandlerImpl.java:359)\n\tat io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.end(BodyHandlerImpl.java:336)\n\tat io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:277)\n\tat io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:259)\n\tat io.vertx.core.http.impl.HttpEventHandler.handleEnd(HttpEventHandler.java:76)\n\tat io.vertx.core.http.impl.Http1xServerRequest.onEnd(Http1xServerRequest.java:595)\n\tat io.vertx.core.http.impl.Http1xServerRequest.lambda$pendingQueue$1(Http1xServerRequest.java:133)\n\tat io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:255)\n\tat io.vertx.core.streams.impl.InboundBuffer.drain(InboundBuffer.java:242)\n\tat io.vertx.core.streams.impl.InboundBuffer.lambda$fetch$0(InboundBuffer.java:295)\n\tat io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:277)\n\tat io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:259)\n\tat io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:43)\n\tat io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)\n\tat io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Thread.java:833)"
}
@jmartisk
Copy link
Member Author

jmartisk commented Oct 5, 2023

Fixed via #1930

@jmartisk jmartisk closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant