Github user mike-tutkowski commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/654#discussion_r36490932
  
    --- Diff: 
services/console-proxy/server/src/com/cloud/consoleproxy/vnc/packet/server/RawRect.java
 ---
    @@ -50,26 +52,27 @@ public void paint(BufferedImage image, Graphics2D 
graphics) {
     
             switch (dataBuf.getDataType()) {
     
    -            case DataBuffer.TYPE_INT: {
    -                // We chose RGB888 model, so Raster will use DataBufferInt 
type
    -                DataBufferInt dataBuffer = (DataBufferInt)dataBuf;
    +        case DataBuffer.TYPE_INT: {
    +            // We chose RGB888 model, so Raster will use DataBufferInt type
    +            DataBufferInt dataBuffer = (DataBufferInt)dataBuf;
     
    -                int imageWidth = image.getWidth();
    -                int imageHeight = image.getHeight();
    +            int imageWidth = image.getWidth();
    +            int imageHeight = image.getHeight();
     
    -                // Paint rectangle directly on buffer, line by line
    -                int[] imageBuffer = dataBuffer.getData();
    -                for (int srcLine = 0, dstLine = y; srcLine < height && 
dstLine < imageHeight; srcLine++, dstLine++) {
    -                    try {
    -                        System.arraycopy(buf, srcLine * width, 
imageBuffer, x + dstLine * imageWidth, width);
    -                    } catch (IndexOutOfBoundsException e) {
    -                    }
    +            // Paint rectangle directly on buffer, line by line
    +            int[] imageBuffer = dataBuffer.getData();
    +            for (int srcLine = 0, dstLine = y; srcLine < height && dstLine 
< imageHeight; srcLine++, dstLine++) {
    +                try {
    +                    System.arraycopy(buf, srcLine * width, imageBuffer, x 
+ dstLine * imageWidth, width);
    +                } catch (IndexOutOfBoundsException e) {
    +                    s_logger.info("[ignored] buffer overflow!?!", e);
                     }
    -                break;
                 }
    +            break;
    --- End diff --
    
    It looks like this change of location for "break" fixes a bug (versus being 
"cosmetic"). Is that true? Prior to the fix, it appears the loop could only be 
executed at most one time.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to