yeg
2026-08-26 2e3a206767d5042880bb6aab0964cfddd2085e39
ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsTcpTransport.java
@@ -1,6 +1,5 @@
package com.ruoyi.device.bts;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
@@ -83,7 +82,7 @@
            throw new BtsTransportException(BtsTransportException.Reason.DISCONNECTED,
                    "BTS disconnected before completing a response for " + host + ":" + port, ex);
        }
        catch (ResponseTooLargeException ex)
        catch (BtsFrameReader.FrameTooLargeException ex)
        {
            closeSocket();
            throw new BtsTransportException(BtsTransportException.Reason.RESPONSE_TOO_LARGE,
@@ -118,36 +117,7 @@
    private String readFrame(InputStream input) throws IOException
    {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        int matched = 0;
        while (true)
        {
            int value = input.read();
            if (value < 0) throw new EOFException("BTS closed the connection before the response frame ended");
            if ((byte) value == FRAME_END[matched])
            {
                matched++;
                if (matched == FRAME_END.length) return decodeUtf8(buffer.toByteArray());
                continue;
            }
            if (matched > 0)
            {
                for (int i = 0; i < matched; i++) appendPayload(buffer, FRAME_END[i]);
                matched = 0;
                if ((byte) value == FRAME_END[0])
                {
                    matched = 1;
                    continue;
                }
            }
            appendPayload(buffer, value);
        }
    }
    private void appendPayload(ByteArrayOutputStream buffer, int value) throws ResponseTooLargeException
    {
        if (buffer.size() >= maxResponseBytes) throw new ResponseTooLargeException();
        buffer.write(value);
        return decodeUtf8(BtsFrameReader.read(input, maxResponseBytes));
    }
    private static String decodeUtf8(byte[] bytes) throws InvalidUtf8Exception
@@ -194,11 +164,6 @@
        {
            socket = null;
        }
    }
    private static final class ResponseTooLargeException extends IOException
    {
        private static final long serialVersionUID = 1L;
    }
    private static final class InvalidUtf8Exception extends IOException