|
20 | 20 | import java.io.File; |
21 | 21 | import java.io.FileOutputStream; |
22 | 22 | import java.io.OutputStreamWriter; |
| 23 | +import java.io.UnsupportedEncodingException; |
23 | 24 | import java.net.URI; |
| 25 | +import java.nio.charset.Charset; |
24 | 26 | import java.rmi.RemoteException; |
25 | 27 | import java.util.ArrayList; |
26 | 28 | import java.util.HashMap; |
|
30 | 32 | import java.util.concurrent.ExecutorService; |
31 | 33 | import java.util.concurrent.Executors; |
32 | 34 | import java.util.concurrent.TimeUnit; |
33 | | -import java.io.UnsupportedEncodingException; |
34 | 35 |
|
35 | 36 | import org.apache.commons.lang.StringUtils; |
36 | 37 | import org.apache.log4j.Logger; |
@@ -108,11 +109,11 @@ public class VmwareStorageProcessor implements StorageProcessor { |
108 | 109 | private static final Logger s_logger = Logger.getLogger(VmwareStorageProcessor.class); |
109 | 110 | private static final int DEFAULT_NFS_PORT = 2049; |
110 | 111 |
|
111 | | - private VmwareHostService hostService; |
112 | | - private boolean _fullCloneFlag; |
113 | | - private VmwareStorageMount mountService; |
114 | | - private VmwareResource resource; |
115 | | - private Integer _timeout; |
| 112 | + private final VmwareHostService hostService; |
| 113 | + private final boolean _fullCloneFlag; |
| 114 | + private final VmwareStorageMount mountService; |
| 115 | + private final VmwareResource resource; |
| 116 | + private final Integer _timeout; |
116 | 117 | protected Integer _shutdownWaitMs; |
117 | 118 | private final Gson _gson; |
118 | 119 | private final StorageLayer _storage = new JavaStorageLayer(); |
@@ -2265,10 +2266,13 @@ public Answer forgetObject(ForgetObjectCmd cmd) { |
2265 | 2266 | } |
2266 | 2267 |
|
2267 | 2268 | private static String deriveTemplateUuidOnHost(VmwareHypervisorHost hyperHost, String storeIdentifier, String templateName) { |
| 2269 | + String templateUuid; |
2268 | 2270 | try{ |
2269 | | - String templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier + "-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString(); |
| 2271 | + templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier + "-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString(); |
2270 | 2272 | }catch(UnsupportedEncodingException e){ |
2271 | | - s_logger.warn("Unable to generate UUID due to unexpected encoding error."+e); |
| 2273 | + s_logger.warn("unexpected encoding error, using default Charset: " + e.getLocalizedMessage()); |
| 2274 | + templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier + "-" + hyperHost.getMor().getValue()).getBytes(Charset.defaultCharset())) |
| 2275 | + .toString(); |
2272 | 2276 | } |
2273 | 2277 | templateUuid = templateUuid.replaceAll("-", ""); |
2274 | 2278 | return templateUuid; |
|
0 commit comments