New reporting functionality

Started by edward.borst, August 14, 2014, 12:51:40 PM

Previous topic - Next topic

multix

#15
Quote from: edward.borst on August 26, 2014, 01:13:08 PM
Hi Alex,

There seems a problem in the table script with the column reportId.
As I can see from the source that is is an hybernate uuid binary column I think it should be binary(16) instead of binary(255).
I have tried it (recreated the table) and now it is showing up in the console.

Only thing is that I can't render the results. I'm getting the following error in the nxreporting log:
Exception in thread "Thread-9" java.lang.IllegalArgumentException: 32768 > 16384
        at java.util.Arrays.copyOfRange(Arrays.java:2549)
        at com.radensolutions.reporting.infrastructure.impl.TcpConnector$SessionWorker.sendFileData(TcpConnector.java:232)
        at com.radensolutions.reporting.infrastructure.impl.TcpConnector$SessionWorker.run(TcpConnector.java:174)
        at java.lang.Thread.run(Thread.java:722)

I am getting same error after changing binary(255) to binary(16). I did not change anything else.

I had a look to output directory, and saw that report has been created. I tried to open it with jaspersoft studio, it succeeded and I could export it as pdf with in jaspersoft studio. But I can't do this in netxms console.

I hope, it will be corrected in ashort time.

red

develop version v2.0 dont have this bug, so i mix some code from v2.0 to 1.2.17 for fastfix
replace method
private void sendFileData(final long requestId, final byte[] data)
in
src\java\nxreporting\src\main\java\com\radensolutions\reporting\infrastructure\impl\TcpConnector.java
with
/**
         * @param requestId
         * @param data
         * @throws IOException
         */
        private void sendFileData(final long requestId, final byte[] data) throws IOException {
            NXCPMessage msg = new NXCPMessage(NXCPCodes.CMD_FILE_DATA, requestId);
            msg.setBinaryMessage(true);
            boolean success = false;
            for (int pos = 0; pos < data.length; pos += 16384) {
                int len = Math.min(16384, data.length - pos);
                msg.setBinaryData(Arrays.copyOfRange(data, pos, pos + len));
                sendMessage(msg);
                if (pos + len == data.length )
                {
                    success = true;
                    break;
                }
            }
            if (success)
            {
                msg.setEndOfFile(true);
                msg.setBinaryData(new byte[0]);
                sendMessage(msg);
            }
            else
           {
              NXCPMessage abortMessage = new NXCPMessage(NXCPCodes.CMD_ABORT_FILE_TRANSFER, requestId);
              abortMessage.setBinaryMessage(true);
              sendMessage(abortMessage);
           }
        }