Author: adietish
Date: 2010-12-22 13:32:00 -0500 (Wed, 22 Dec 2010)
New Revision: 27688
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java
Log:
[JBIDE-7984] added guard to avoid NPE
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-22 18:31:43
UTC (rev 27687)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-22 18:32:00
UTC (rev 27688)
@@ -1,5 +1,10 @@
2010-12-22 adietisheim <adietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java
+ (setCPU):
+ (setMemody):
+ (setStorage):
+ [JBIDE-7984] added guard to avoid NPE
*
src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePageLabelAndContentProvider.java:
* src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
(.doRun):
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java 2010-12-22
18:31:43 UTC (rev 27687)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java 2010-12-22
18:32:00 UTC (rev 27688)
@@ -102,13 +102,13 @@
memoryLabel.setText(WizardMessages.getString(MEMORY_LABEL));
storageLabel = new Label(container, SWT.NULL);
storageLabel.setText(WizardMessages.getString(STORAGE_LABEL));
-
+
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
cpuLabel.setLayoutData(fd);
DeltaCloudHardwareProperty cpuProperty = profile.getNamedProperty("cpu");
//$NON-NLS-1$
- setCPU(cpuProperty.getValue());
+ setCPU(cpuProperty);
Control cpuControl = createCpuControls(cpuProperty, storageLabel, container);
fd = new FormData();
@@ -116,7 +116,7 @@
fd.top = new FormAttachment(cpuLabel, 8);
memoryLabel.setLayoutData(fd);
DeltaCloudHardwareProperty memoryProperty =
profile.getNamedProperty("memory"); //$NON-NLS-1$
- setMemody(memoryProperty.getValue());
+ setMemody(memoryProperty);
Control memoryControl = createMemoyControl(cpuControl, memoryProperty, storageLabel,
container);
fd = new FormData();
@@ -124,7 +124,7 @@
fd.top = new FormAttachment(memoryControl, 8);
storageLabel.setLayoutData(fd);
DeltaCloudHardwareProperty storageProperty =
profile.getNamedProperty("storage"); //$NON-NLS-1$
- setStorage(storageProperty.getValue());
+ setStorage(storageProperty);
createStorageControls(memoryControl, memoryProperty, storageProperty, storageLabel,
container);
}
@@ -230,7 +230,8 @@
return storageControl;
}
- private Control createMemoyControl(Control cpuControl, DeltaCloudHardwareProperty
memoryProperty, Label storageLabel, Composite container) {
+ private Control createMemoyControl(Control cpuControl, DeltaCloudHardwareProperty
memoryProperty,
+ Label storageLabel, Composite container) {
Control memoryControl = null;
if (memoryProperty != null) {
if (memoryProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
@@ -391,10 +392,12 @@
container.setVisible(visible);
}
- private void setCPU(String value) {
- this.cpu = value;
+ private void setCPU(DeltaCloudHardwareProperty property) {
+ if (property != null) {
+ this.cpu = property.getValue();
+ }
}
-
+
public String getCPU() {
if (cpu != null && !cpu.equals(cpuDefaultValue)) {
return cpu;
@@ -402,8 +405,10 @@
return null;
}
- private void setMemody(String value) {
- this.memory = value;
+ private void setMemody(DeltaCloudHardwareProperty property) {
+ if (property != null) {
+ this.memory = property.getValue();
+ }
}
public String getMemory() {
@@ -413,17 +418,19 @@
return null;
}
- private void setStorage(String value) {
- this.storage = value;
+ private void setStorage(DeltaCloudHardwareProperty property) {
+ if (property != null) {
+ this.storage = property.getValue();
+ }
}
-
+
public String getStorage() {
if (storage != null && !storage.equals(storageDefaultValue)) {
return storage;
}
return null;
}
-
+
public Composite getControl() {
return container;
}
Show replies by date