日期:2014-05-20  浏览次数:20689 次

求助,没搞明白怎么就是空值了
public class BasicMemorySection {
private FormToolkit toolkit;
private Form form;
private String title;
private int style;
private IndexerDetail detail;
private AssetServer server;

public BasicMemorySection(String title, Form form, int style) {
this.title = title;
this.form = form;
this.style = style;
}

public Section createMemoryContent() {
IndexerDetail detail=new IndexerDetail();
AssetServer server=new AssetServer();
final ServerMonitorService service = (ServerMonitorService) ModelFactory
.getModel().getService(ServerMonitorService.class.getName());
detail = service.getIndexerDetail(server);
GridData gd21 = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);

toolkit = new FormToolkit(form.getDisplay());
Section memorySection = toolkit.createSection(form.getBody(), style);
memorySection.setText(title);
memorySection.setLayoutData(gd21);

Composite client = toolkit.createComposite(memorySection);
client.setLayout(new FormLayout());
memorySection.setClient(client);

Composite client1 = toolkit.createComposite(client);
FormData data = new FormData();
data.top = data.left = new FormAttachment(2);
data.width = 400;
data.height = 250;
client1.setLayoutData(data);
client1.setLayout(new FillLayout());

Map<String, String> map = new HashMap<String, String>();
map.put("未用", detail.getMemoryFree());
map.put("已用", detail.getMemoryUsed());
new SOCChart(client1, SupportSWF.PIE_3D, "感染范围", "100%", "100%",
cn.antvision.soldier.portal.server.moniter.util.ChartUtil
.getPieChartData(map, "MB"), null);
return memorySection;
}

}
谁能告诉我怎么修改detail才不是空的

------解决方案--------------------
service.getIndexerDetail(server);
看看是不是这里返回Null了