Projects tigase _server tigase-pubsub Issues #134
NumberFormatException: For input string: "max" (#134)
Closed
wojciech.kapcia@tigase.net opened 2 years ago

When testing moxxy client I got an error that it's not possible to establish OMEMO encryption and it resulted in following exception on our side:

[2023-03-02 12:29:02:275] [SEVERE  ] [           in_3-pubsub ] StanzaProcessor.processPacket()  : java.lang.NumberFormatException: For input string: "max" when processing from=c2s@ip-172-31-38-91.us-west-2.compute.internal/172.24.0.3_5223_172.31.38.18_24644, to=pubsub@ip-172-31-38-91.us-west-2.compute.internal, serverAuthorisedStanzaFrom=Optional.empty, DATA=<iq id="2b322565-717b-42d2-9ab8-648e6a15ee1c" type="set" to="…@tigase.im" xmlns="jabber:client" from="…@tigase.im/677469419-tigase-33747"><pubsub xmlns="http://jabber.org/protocol/pubsub"><publish node="urn:xmpp:omemo:2:bundles"><item id="171955575"><bundle xmlns="urn:xmpp:omemo:2"><spk id="1401410576">pt12i3Lx2WkvvoaE+n1I2IWi0lR41Gktowwig7YQvgQ=</spk><spks>vHHeRlKubquoMSdan342ceckIFJVv+jJqM6tjCaMTsSZ1r+SofeCrDYRXEpR5QIc86vo9nlxIKe7ORo5jgt6DA==</spks><ik>Uw2IeZFm3W92uPdfz0yE9rWD4uvfJYd8UJiNVKzIRnQ=</ik><prekeys><pk id="0">BE9zwfcM9FQhUL2u3rGVY4IE3Os+BNiND2WYSwSt1BU=</pk><pk id="1">OoIsOazzg7iXjPiopKtrkuGkdPYwiG3nlOQOkCQIq3s=</pk><pk id="2">cgq8CfSb4K7uS8dEYGvuhA3qKVlGSE8XDhE+JV6h2io=</pk><pk id="3">KGG9nz/AaEOU8PW04+389X+sXptn0Nzrx30MbThKUmY=</pk><pk id="4">UHnQYJoLeLPc2YrIWY6kix/dggi7SIdnA+Zwpim9oxY=</pk><pk id="5">aSk9IIrDM5IFp3a+Jandl35tx06rJykUZPd3sNqV2nM=</pk><pk id="6">UbMgeZk7H9nkkdIDlOkpPmt78BNVANDuI3RqeBIWCwo=</pk><pk id="7">Q5OgTQeFXlBEHld1iYV3l6g/bg7tvG3WSrwjgHPopGg=</pk><pk id="8">suCYO0 ... , SIZE=6970, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=ADMIN, TYPE=set, STABLE_ID=null
java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "max"
	at tigase.pubsub.modules.PublishItemModule.process(PublishItemModule.java:333)
	at tigase.component.modules.StanzaProcessor.execute(StanzaProcessor.java:219)
	at tigase.component.modules.StanzaProcessor.process(StanzaProcessor.java:206)
	at tigase.component.modules.StanzaProcessor.processPacket(StanzaProcessor.java:103)
	at tigase.component.AbstractKernelBasedComponent.processPacket(AbstractKernelBasedComponent.java:81)
	at tigase.pubsub.PubSubComponent.processPacket(PubSubComponent.java:191)
	at tigase.pubsub.cluster.PubSubComponentClustered.processPacket(SourceFile:183)
	at tigase.server.AbstractMessageReceiver$QueueListener.run(AbstractMessageReceiver.java:1398)
Caused by: java.lang.NumberFormatException: For input string: "max"
	at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.base/java.lang.Integer.parseInt(Unknown Source)
	at java.base/java.lang.Integer.parseInt(Unknown Source)
	at tigase.form.Fields.getAsInteger(Fields.java:91)
	at tigase.form.Form.getAsInteger(Form.java:115)
	at tigase.pubsub.LeafNodeConfig.getMaxItems(LeafNodeConfig.java:33)
	at tigase.pubsub.modules.PublishItemModule.doPublishItems(PublishItemModule.java:153)
	at tigase.pubsub.modules.PublishItemModule.publishItems(PublishItemModule.java:438)
	at tigase.pubsub.modules.PublishItemModule.process(PublishItemModule.java:309)
	... 7 more
wojciech.kapcia@tigase.net commented 2 years ago

Change in xep-0060: https://xmpp.org/extensions/xep-0060.html#revision-history-v1.20.0

Version 1.20.0 (2021-06-08) Add integer-or-max datatype to use with Data Forms Validation.

with following description:

Data Forms Validation Datatypes Registry Submission

<datatype>
  <name>integer-or-max</name>
    <desc>
      Datatype used for text-single fields where the accepted value is
      either an integer or the string "max".
    </desc>
    <doc>XEP-0060</doc>
</datatype>
Andrzej Wójcik (Tigase) commented 2 years ago
Andrzej Wójcik (Tigase) commented 2 years ago

This is not a bug on the server side, but I've added this feature anyway as it is a good to have. According to XEP-0060, clients should not use max as a value for pubsub#max_items field, unless PubSub component (or even node) advertises http://jabber.org/protocol/pubsub#config-node-max feature. I think this issue should also be reported to the client developer.

wojciech.kapcia@tigase.net commented 2 years ago

Revied and merged.

Issue reported: https://codeberg.org/moxxy/moxxy/issues/248

wojciech.kapcia@tigase.net commented 2 years ago

Failed TTS-NG test testSupportAdvertisement:

 java.lang.AssertionError:
org.testng.AssertJUnit.fail(AssertJUnit.java:65)
org.testng.AssertJUnit.assertTrue(AssertJUnit.java:23)
org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33)
tigase.tests.pubsub.TestPubSub.testSupportAdvertisement(TestPubSub.java:99)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:568)
org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:135)
org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:673)
org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:220)
org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:945)
org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:193)
org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
org.testng.TestRunner.privateRun(TestRunner.java:808)
org.testng.TestRunner.run(TestRunner.java:603)
org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
org.testng.SuiteRunner.run(SuiteRunner.java:326)
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
org.testng.TestNG.runSuites(TestNG.java:1092)
org.testng.TestNG.run(TestNG.java:1060)
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Andrzej Wójcik (Tigase) commented 2 years ago

It looks like it works ok now. Maybe something was not rebuilt?

wojciech.kapcia@tigase.net commented 2 years ago

Most likely.

wojciech.kapcia@tigase.net changed fields 4 months ago
Name Previous Value Current Value
Version
Candidate for next minor release
tigase-server-8.4.0
wojciech.kapcia@tigase.net added to iteration "tigase-server-8.4.0" 4 months ago
issue 1 of 1
Type
Task
Priority
Normal
Assignee
Version
tigase-server-8.4.0
Iterations
Issue Votes (0)
Watchers (2)
Reference
tigase/_server/tigase-pubsub#134
Please wait...
Page is in error, reload to recover