Strange beaviour in screen of a migrated project in cuba 7

Hi,

I am working on migration of an application from Cuba 6.x to 7.07.
The most things are working but one seems strange:

On Screens based on AbstractEditor<> validation of BigDecimal-Fields seems not to work
correct:

One example: I am using an addon-Table with no coding in the controllers and only three fields.
One of the fields is a BigDecimal - Field.
When I am writing a correct value, everything works. But on a input-string which cannot be
interpreted as a BigDecimal-value, I am getting the following Exception.
This

java.lang.IllegalArgumentException: Datatype not registered: AdaptiveNumberFormat<BigDecimal>
	at com.haulmont.cuba.core.sys.DatatypeRegistryImpl.getId(DatatypeRegistryImpl.java:84)
	at com.haulmont.cuba.web.gui.components.WebV8AbstractField.getDatatypeConversionErrorMsg(WebV8AbstractField.java:244)
	at com.haulmont.cuba.web.gui.components.WebTextField.getConversionErrorMessageInternal(WebTextField.java:206)
	at com.haulmont.cuba.web.gui.components.WebTextField.convertToModel(WebTextField.java:172)
	at com.haulmont.cuba.web.gui.components.WebTextField.convertToModel(WebTextField.java:52)
	at com.haulmont.cuba.web.gui.components.WebV8AbstractField.validate(WebV8AbstractField.java:197)
	at com.haulmont.cuba.gui.screen.ScreenValidation.validate(ScreenValidation.java:100)
	at com.haulmont.cuba.gui.screen.ScreenValidation.lambda$validateUiComponents$0(ScreenValidation.java:93)
	at com.haulmont.cuba.gui.ComponentsHelper.lambda$traverseValidatable$1(ComponentsHelper.java:95)
	at com.haulmont.cuba.gui.ComponentsHelper.lambda$traverseComponents$0(ComponentsHelper.java:78)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
	at com.haulmont.cuba.gui.ComponentsHelper.traverseComponents(ComponentsHelper.java:77)
	at com.haulmont.cuba.gui.ComponentsHelper.lambda$traverseComponents$0(ComponentsHelper.java:81)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at com.haulmont.cuba.gui.ComponentsHelper.traverseComponents(ComponentsHelper.java:77)
	at com.haulmont.cuba.gui.ComponentsHelper.traverseValidatable(ComponentsHelper.java:93)
	at com.haulmont.cuba.gui.screen.ScreenValidation.validateUiComponents(ScreenValidation.java:92)
	at com.haulmont.cuba.gui.components.AbstractWindow.validateAll(AbstractWindow.java:807)
	at com.haulmont.cuba.gui.components.AbstractEditor.closeWithCommit(AbstractEditor.java:415)
	at com.haulmont.cuba.gui.components.AbstractEditor.commitAndClose(AbstractEditor.java:432)
	at com.haulmont.cuba.gui.components.AbstractEditor.lambda$initCommitActions$1(AbstractEditor.java:98)
	at com.haulmont.bali.events.EventHub.publish(EventHub.java:170)
	at com.haulmont.cuba.gui.components.actions.BaseAction.actionPerform(BaseAction.java:221)
	at com.haulmont.cuba.web.gui.components.WebButton.buttonClicked(WebButton.java:62)
	at com.haulmont.cuba.web.widgets.CubaButton.fireClick(CubaButton.java:76)
	at com.vaadin.ui.Button$1.click(Button.java:57)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:153)
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:115)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:431)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:396)
	at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:260)
	at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:82)
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1577)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:425)
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:329)
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:215)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:107)
	at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:73)
	at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:108)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

This behaviour I found on other screens too. I used this example, because it is just without any
code of mine

I append the xml-files of browser and editor.

kunde-artikel-preis-browse.xml (2.0 KB)
kunde-artikel-preis-edit.xml (1.1 KB)
.

Thanks.

Hi,

java.lang.IllegalArgumentException: Datatype not registered: AdaptiveNumberFormat
at com.haulmont.cuba.core.sys.DatatypeRegistryImpl.getId(DatatypeRegistryImpl.java:84)

So, haven’t you registered this custom datatype in metadata.xml of your project?
https://doc.cuba-platform.com/manual-7.0/datatype_custom_example.html

Hi,

I do not use any Custom Datatype in this project. I dit use in older versions a datatype
for currencys, but in newer time, I could realize this things with a simple Number format in
the entity-field-definition.
I removed this older Datatype completely from my project.
But with your hint I tried, to remode the number-Format (#0.00 with Decimal-Separator , and Group-
Separator ).

After that, the validation worked. After putting the number format back to the field, I hat the same
strange behaviour!

Thanks.

This is this small entity-definition:

KundeArtikelPreis.java (3.0 KB)

I could not find a solution, so I tried the following:

  1. Created a new cuba-project with newest platform release 7.1-snapshot
  2. created a entity with one field: a BigDecimal with nubmerformat: #0.00
  3. create standard screens list and mask
  4. started app
  5. started new-mask
  6. put 1.23 in the field, save , all good
  7. put in abc in the field:
    Received an unexpected error:
    IllegalArgumentException: Datatype not registered: AdaptiveNumberFormat

Is this a bug or a mistake of mine ?
Is it needed to create for a formated number-field an own datatype ?

Thanks

Hello @martin4977

AdaptiveNumberDatatype is used when an entity attribute annotated with NumberFormat. Could you clarify whether your entity uses this annotation or not?

Hello Daniil,

yes I am using this annotation (via dialog in CUBA).
The same thing I did in CUBA 6.x-Projects.

Here is the entity of my little test-app:

NumTest.java (2.3 KB)

Thank you for reporting the problem. I’ve created an issue: GitHub.

Regards,
Daniil