![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Nov 2005
Posts: 35
Rep Power: 0
![]() |
Is there anything wrong with this code?
I have the following code
private String okWidgetSelected(SelectionEvent evt) {
System.out.println("ok.widgetSelected, event=" + evt);
if (testRegGame() == false) {
String a[] = new String[1];
InsEvtEnsTypeError.main(a);
} else if (testSpecialEvent() == false) {
String a[] = new String[1];
InsEvtPtError.main(a);
} else {
/*
* Pass everyting back to the EventMaker class as a String
* Event Type, Late CutoffTime, Ensemble Type, Ontime points,
* Late points
*/
String info = eventType.getText()
+ "," + formatTimeAsMilitary(hour.getText(), min.getText(), pm.getSelection())
+ "," + ensembleType.getText() + "," + ontimePoints.getText() + ","
+ latePts.getText();
dialogShell.close();
return info;
}This involves getting data from an SWT form in case you're wondering about all the getText() and close() methods. I'm merely trying to return all the data from the form as a comma seperated String. Eclipse is telling me that "the method must return a result of type String" and hits a compile error. I don't see what's wrong. I earlier tried to return an array of Strings, but it didn't like that either. I told Eclipse to clean the project too, to no avail. In case you're wondering, I can remove the line with close() in it without fixing the bug. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Nov 2005
Posts: 35
Rep Power: 0
![]() |
Wait I see what's wrong, it needed a return value on each branch of the if-else ladder; DUH!
|
|
|
|
|
|
#3 |
|
Programmer
|
Its written in java, thats whats wrong!!!
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|