我们正在使用带有 ASCIChannel 和自定义包的 jpos 服务器,其中包含一个最大长度为 9999 的字段来执行此操作,我们实现了 IFB_LLLLCHAR 如下
public class IFB_LLLLCHAR extends ISOStringFieldPackager {
public IFB_LLLLCHAR() {
super(NullPadder.INSTANCE, AsciiInterpreter.INSTANCE, BcdPrefixer.LLLL);
}
public IFB_LLLLCHAR(int len, String description) {
super(len, description, NullPadder.INSTANCE, AsciiInterpreter.INSTANCE, BcdPrefixer.LLLL);
checkLength(len, 9999);
}
public void setLength(int len)
{
checkLength(len, 9999);
super.setLength(len);
}
}
问题是我不能使用整个 9999,因为如果整个消息的大小超过 9999,它会在发送时抛出以下异常
<exception name="len exceeded">
java.io.IOException: len exceeded
at org.jpos.iso.channel.ASCIIChannel.sendMessageLength(ASCIIChannel.java:80)
at org.jpos.iso.BaseChannel.send(BaseChannel.java:528)
at com.advam.gateway.terminalmanagementserver.gateway.LogUploadFuncTest.testLogUpload(LogUploadFuncTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
</exception>
谁能告诉我为什么我会得到这个异常以及如何解决它。请记住,在回答我对 jpos 内部没有太多了解时。谢谢