diff --git a/console-proxy/.classpath b/console-proxy/.classpath
index c87c7cd3995..dead7c796d1 100644
--- a/console-proxy/.classpath
+++ b/console-proxy/.classpath
@@ -3,5 +3,9 @@
+<<<<<<< HEAD
+=======
+
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
diff --git a/console-proxy/src/com/cloud/consoleproxy/util/ITileScanListener.java b/console-proxy/src/com/cloud/consoleproxy/util/ITileScanListener.java
index b9364979887..167938091dc 100644
--- a/console-proxy/src/com/cloud/consoleproxy/util/ITileScanListener.java
+++ b/console-proxy/src/com/cloud/consoleproxy/util/ITileScanListener.java
@@ -10,6 +10,7 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+
package com.cloud.consoleproxy.util;
import java.awt.Rectangle;
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/BufferedImageCanvas.java b/console-proxy/src/com/cloud/consoleproxy/vnc/BufferedImageCanvas.java
index e89d632dd0c..9dc523d4f3d 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/BufferedImageCanvas.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/BufferedImageCanvas.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,12 +11,15 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
+<<<<<<< HEAD
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
@@ -24,12 +28,19 @@ import java.util.List;
import com.cloud.consoleproxy.util.ImageHelper;
import com.cloud.consoleproxy.util.TileInfo;
+=======
+import java.awt.image.BufferedImage;
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
/**
* A BuffereImageCanvas component represents frame buffer image on the
* screen. It also notifies its subscribers when screen is repainted.
*/
+<<<<<<< HEAD
public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
+=======
+public class BufferedImageCanvas extends Canvas {
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
private static final long serialVersionUID = 1L;
// Offline screen buffer
@@ -71,9 +82,14 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
public void paint(Graphics g) {
// Only part of image, requested with repaint(Rectangle), will be
// painted on screen.
+<<<<<<< HEAD
synchronized(offlineImage) {
g.drawImage(offlineImage, 0, 0, this);
}
+=======
+ g.drawImage(offlineImage, 0, 0, this);
+
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
// Notify server that update is painted on screen
listener.imagePaintedOnScreen();
}
@@ -85,6 +101,7 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
public Graphics2D getOfflineGraphics() {
return graphics;
}
+<<<<<<< HEAD
public void copyTile(Graphics2D g, int x, int y, Rectangle rc) {
synchronized(offlineImage) {
@@ -147,4 +164,7 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
}
return imgBits;
}
+=======
+
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
}
\ No newline at end of file
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/FrameBufferUpdateListener.java b/console-proxy/src/com/cloud/consoleproxy/vnc/FrameBufferUpdateListener.java
index 7f6b122c46e..78ec97857c2 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/FrameBufferUpdateListener.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/FrameBufferUpdateListener.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,6 +11,8 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
public interface FrameBufferUpdateListener {
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/PaintNotificationListener.java b/console-proxy/src/com/cloud/consoleproxy/vnc/PaintNotificationListener.java
index cf74e6789b6..00d685247e7 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/PaintNotificationListener.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/PaintNotificationListener.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,6 +11,8 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
public interface PaintNotificationListener {
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/RfbConstants.java b/console-proxy/src/com/cloud/consoleproxy/vnc/RfbConstants.java
index 13dcf46abf2..12af1579323 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/RfbConstants.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/RfbConstants.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,6 +11,8 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
import java.nio.charset.Charset;
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/SimpleLogger.java b/console-proxy/src/com/cloud/consoleproxy/vnc/SimpleLogger.java
new file mode 100644
index 00000000000..2a6ae4d351e
--- /dev/null
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/SimpleLogger.java
@@ -0,0 +1,40 @@
+package com.cloud.consoleproxy.vnc;
+
+public class SimpleLogger {
+
+ public static void log(String message) {
+ System.out.println(getPrefix(1) + " LOG: " + message);
+ }
+
+ public static void log(int skipFrames, String message) {
+ System.out.println(getPrefix(1+skipFrames) + " LOG: " + message);
+ }
+
+ public static void debug(String message) {
+ System.out.println(getPrefix(1) + " DEBUG: " + message);
+ }
+
+ public static void info(String message) {
+ System.out.println(getPrefix(1) + " INFO: " + message);
+ }
+
+ public static void warn(String message) {
+ System.err.println(getPrefix(1) + " WARN: " + message);
+ }
+
+ public static void error(String message) {
+ System.err.println(getPrefix(1) + " ERROR: " + message);
+ }
+
+ private static String getPrefix(int skipFrames) {
+ StackTraceElement frame;
+ try {
+ throw new RuntimeException();
+ } catch (Exception e) {
+ frame = e.getStackTrace()[1+skipFrames];
+ }
+
+ return "(" + frame.getFileName() + ":" + frame.getLineNumber() + ") " + frame.getMethodName() + "()";
+ }
+
+}
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/VncClient.java b/console-proxy/src/com/cloud/consoleproxy/vnc/VncClient.java
index b7ed80c008c..79e51888dfd 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/VncClient.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/VncClient.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,6 +11,8 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
import java.awt.Frame;
@@ -28,6 +31,7 @@ import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
+<<<<<<< HEAD
import com.cloud.consoleproxy.ConsoleProxyClientListener;
import com.cloud.consoleproxy.util.Logger;
import com.cloud.consoleproxy.util.RawHTTP;
@@ -36,6 +40,9 @@ import com.cloud.consoleproxy.vnc.packet.client.MouseEventPacket;
public class VncClient {
private static final Logger s_logger = Logger.getLogger(VncClient.class);
+=======
+public class VncClient {
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
private Socket socket;
private DataInputStream is;
@@ -45,9 +52,12 @@ public class VncClient {
private VncClientPacketSender sender;
private VncServerPacketReceiver receiver;
+<<<<<<< HEAD
private boolean noUI = false;
private ConsoleProxyClientListener clientListener = null;
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
public static void main(String args[]) {
if (args.length < 3) {
@@ -60,6 +70,7 @@ public class VncClient {
String password = args[2];
try {
+<<<<<<< HEAD
new VncClient(host, Integer.parseInt(port), password, false, null);
} catch (NumberFormatException e) {
s_logger.error("Incorrect VNC server port number: " + port + ".");
@@ -73,11 +84,27 @@ public class VncClient {
} catch (Throwable e) {
s_logger.error("An error happened: " + e.getMessage());
System.exit(1);
+=======
+ new VncClient(host, Integer.parseInt(port), password);
+ } catch (NumberFormatException e) {
+ SimpleLogger.error("Incorrect VNC server port number: " + port + ".");
+ System.exit(1);
+ } catch (UnknownHostException e) {
+ SimpleLogger.error("Incorrect VNC server host name: " + host + ".");
+ System.exit(1);
+ } catch (IOException e) {
+ SimpleLogger.error("Cannot communicate with VNC server: " + e.getMessage());
+ System.exit(1);
+ } catch (Throwable e) {
+ SimpleLogger.error("An error happened: " + e.getMessage());
+ System.exit(1);
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
}
System.exit(0);
}
private static void printHelpMessage() {
+<<<<<<< HEAD
/* LOG */s_logger.info("Usage: HOST PORT PASSWORD.");
}
@@ -147,6 +174,44 @@ public class VncClient {
}
private void doConnect(String password) throws IOException {
+=======
+ /* LOG */SimpleLogger.info("Usage: HOST PORT PASSWORD.");
+ }
+
+ public VncClient(String host, int port, String password) throws UnknownHostException, IOException {
+ connectTo(host, port, password);
+ }
+
+ void shutdown() {
+ sender.closeConnection();
+ receiver.closeConnection();
+
+ try {
+ is.close();
+ } catch (Throwable e) {
+ }
+
+ try {
+ os.close();
+ } catch (Throwable e) {
+ }
+
+ try {
+ socket.close();
+ } catch (Throwable e) {
+ }
+
+ }
+
+ public void connectTo(String host, int port, String password) throws UnknownHostException, IOException {
+ // If port number is too small, then interpret it as display number.
+ if (port < 100)
+ port += 5900;
+
+ // Connect to server
+ SimpleLogger.info("Connecting to VNC server " + host + ":" + port + "...");
+ this.socket = new Socket(host, port);
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
is = new DataInputStream(socket.getInputStream());
os = new DataOutputStream(socket.getOutputStream());
@@ -166,13 +231,18 @@ public class VncClient {
canvas.addMouseMotionListener(sender);
canvas.addKeyListener(sender);
+<<<<<<< HEAD
Frame frame = null;
if(!noUI)
frame = createVncClientMainWindow(canvas, screen.getDesktopName());
+=======
+ Frame frame = createVncClientMainWindow(canvas, screen.getDesktopName());
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
new Thread(sender).start();
// Run server-to-client packet receiver
+<<<<<<< HEAD
receiver = new VncServerPacketReceiver(is, canvas, screen, this, sender, clientListener);
try {
receiver.run();
@@ -183,6 +253,17 @@ public class VncClient {
}
this.shutdown();
}
+=======
+ receiver = new VncServerPacketReceiver(is, canvas, screen, this, sender);
+ try {
+ receiver.run();
+ } finally {
+ frame.setVisible(false);
+ frame.dispose();
+ this.shutdown();
+ }
+
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
}
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) {
@@ -371,8 +452,11 @@ public class VncClient {
int framebufferWidth = is.readUnsignedShort();
int framebufferHeight = is.readUnsignedShort();
screen.setFramebufferSize(framebufferWidth, framebufferHeight);
+<<<<<<< HEAD
if(clientListener != null)
clientListener.onFramebufferSizeChange(framebufferWidth, framebufferHeight);
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
}
// Read pixel format
@@ -406,6 +490,7 @@ public class VncClient {
screen.setDesktopName(desktopName);
}
}
+<<<<<<< HEAD
public FrameBufferCanvas getFrameBufferCanvas() {
if(receiver != null)
@@ -432,4 +517,7 @@ public class VncClient {
public boolean isHostConnected() {
return receiver != null && receiver.isConnectionAlive();
}
+=======
+
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
}
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java b/console-proxy/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java
index 671cbd51e70..9f628f54723 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,6 +11,8 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
import java.awt.event.KeyEvent;
@@ -52,10 +55,13 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene
sendSetEncodings();
requestFullScreenUpdate();
}
+<<<<<<< HEAD
public void sendClientPacket(ClientPacket packet) {
queue.add(packet);
}
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
@Override
public void run() {
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/VncScreenDescription.java b/console-proxy/src/com/cloud/consoleproxy/vnc/VncScreenDescription.java
index 9824c637311..c8f9adeb94e 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/VncScreenDescription.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/VncScreenDescription.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,6 +11,8 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
/**
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java b/console-proxy/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java
index 757f5acaf82..072bae53cd3 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
@@ -10,6 +11,8 @@
// limitations under the License.
//
// Automatically generated by addcopyright.py at 04/03/2012
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
package com.cloud.consoleproxy.vnc;
import java.awt.Toolkit;
@@ -17,13 +20,19 @@ import java.awt.datatransfer.StringSelection;
import java.io.DataInputStream;
import java.io.IOException;
+<<<<<<< HEAD
import com.cloud.consoleproxy.ConsoleProxyClientListener;
import com.cloud.consoleproxy.util.Logger;
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
import com.cloud.consoleproxy.vnc.packet.server.FramebufferUpdatePacket;
import com.cloud.consoleproxy.vnc.packet.server.ServerCutText;
public class VncServerPacketReceiver implements Runnable {
+<<<<<<< HEAD
private static final Logger s_logger = Logger.getLogger(VncServerPacketReceiver.class);
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
private final VncScreenDescription screen;
private BufferedImageCanvas canvas;
@@ -32,20 +41,29 @@ public class VncServerPacketReceiver implements Runnable {
private boolean connectionAlive = true;
private VncClient vncConnection;
private final FrameBufferUpdateListener fburListener;
+<<<<<<< HEAD
private final ConsoleProxyClientListener clientListener;
public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection,
FrameBufferUpdateListener fburListener, ConsoleProxyClientListener clientListener) {
+=======
+
+ public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection,
+ FrameBufferUpdateListener fburListener) {
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
this.screen = screen;
this.canvas = canvas;
this.is = is;
this.vncConnection = vncConnection;
this.fburListener = fburListener;
+<<<<<<< HEAD
this.clientListener = clientListener;
}
public BufferedImageCanvas getCanvas() {
return canvas;
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
}
@Override
@@ -64,7 +82,11 @@ public class VncServerPacketReceiver implements Runnable {
// so it can send another frame buffer update request
fburListener.frameBufferPacketReceived();
// Handle frame buffer update
+<<<<<<< HEAD
new FramebufferUpdatePacket(canvas, screen, is, clientListener);
+=======
+ new FramebufferUpdatePacket(canvas, screen, is);
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
break;
}
@@ -81,9 +103,15 @@ public class VncServerPacketReceiver implements Runnable {
default:
throw new RuntimeException("Unknown server packet type: " + messageType + ".");
}
+<<<<<<< HEAD
}
} catch (Throwable e) {
+=======
+
+ }
+ } catch (Throwable e) {
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
if (connectionAlive) {
closeConnection();
vncConnection.shutdown();
@@ -94,10 +122,13 @@ public class VncServerPacketReceiver implements Runnable {
public void closeConnection() {
connectionAlive = false;
}
+<<<<<<< HEAD
public boolean isConnectionAlive() {
return connectionAlive;
}
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
/**
* Handle server bell packet.
@@ -114,6 +145,10 @@ public class VncServerPacketReceiver implements Runnable {
StringSelection contents = new StringSelection(clipboardContent.getContent());
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null);
+<<<<<<< HEAD
s_logger.info("Server clipboard buffer: "+clipboardContent.getContent());
+=======
+ SimpleLogger.info("Server clipboard buffer: "+clipboardContent.getContent());
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
}
}
diff --git a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
index 527c12db57c..b019edb0d1c 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
@@ -15,7 +15,10 @@ package com.cloud.consoleproxy.vnc.packet.server;
import java.io.DataInputStream;
import java.io.IOException;
+<<<<<<< HEAD
import com.cloud.consoleproxy.ConsoleProxyClientListener;
+=======
+>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
import com.cloud.consoleproxy.vnc.BufferedImageCanvas;
import com.cloud.consoleproxy.vnc.RfbConstants;
import com.cloud.consoleproxy.vnc.VncScreenDescription;
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java b/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
index 16a0273ae71..7d5aa6e2f6c 100755
--- a/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade2214to30.java
@@ -653,35 +653,6 @@ public class Upgrade2214to30 implements DbUpgrade {
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
-<<<<<<< HEAD
- int numRows = 0;
- pstmt = conn.prepareStatement("select count(id) from `cloud`.`vm_instance` where removed is null");
- rs = pstmt.executeQuery();
- if(rs.next()){
- numRows = rs.getInt(1);
- }
- rs.close();
- pstmt.close();
- int offset = 0;
- while(offset < numRows){
- pstmt = conn.prepareStatement("select id, vnc_password from `cloud`.`vm_instance` where removed is null limit "+offset+", 500");
- rs = pstmt.executeQuery();
- while (rs.next()) {
- long id = rs.getLong(1);
- String value = rs.getString(2);
- if (value == null) {
- continue;
- }
- String encryptedValue = DBEncryptionUtil.encrypt(value);
- pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vnc_password=? where id=?");
- pstmt.setBytes(1, encryptedValue.getBytes("UTF-8"));
- pstmt.setLong(2, id);
- pstmt.executeUpdate();
- pstmt.close();
- }
- rs.close();
- offset+=500;
-=======
pstmt = conn.prepareStatement("select id, vnc_password from `cloud`.`vm_instance`");
rs = pstmt.executeQuery();
while (rs.next()) {
@@ -695,7 +666,6 @@ public class Upgrade2214to30 implements DbUpgrade {
pstmt.setBytes(1, encryptedValue.getBytes("UTF-8"));
pstmt.setLong(2, id);
pstmt.executeUpdate();
->>>>>>> 2eaefc4... Fixed unittest and some issues with 2.2.14-3.0 upgrade
}
} catch (SQLException e) {
throw new CloudRuntimeException("Unable encrypt vm_instance vnc_password ", e);