Buggy code:
private Label lblPicDispenseDrugs ; private Button btnAddDoctor ; private Text txtAreaNotes ; private Button btnPatientHistoryReport ; private Text txtWeight ; private CCombo cmbLinha ; private CCombo cmbSector ; private CCombo cmbRegime ; private Button btnRemoveDrug ; private Button btnMoveUp ; private Button btnMoveDown ; boolean fromShortcut ; private DateButton btnCaptureDate ; public AddPrescription ( Patient patient , Shell theParent , boolean fromShortcut ) { } @ Override protected void createShell ( ) { } @ Override protected void createContents ( ) { } public void addDisposeListener ( DisposeListener dl ) { } @ Override protected void createCompHeader ( ) { } @ Override protected void createCompButtons ( ) { } private void createCompInstructions ( ) { } private void createGrpPatientID ( ) { } @ SuppressWarnings ( "unchecked" ) private void setCaptureDateRestrictions ( ) throws DateException { } private void createParticularsGroup ( ) { } private void createCompButtonsMiddle ( ) { } private void createGrpDrugs ( ) { } private void createDrugsTable ( ) { } @ Override protected boolean fieldsOk ( ) { } private void setFormToInitialPrescription ( ) { } private void setFormToReactivationPrescription ( ) { } private void loadPrescriptionDetails ( ) { } private void cmdRemoveDrugWidgetSelected ( ) { } private void cmdMoveDrug ( int moveAmount ) { } public void loadPatientDetails ( ) { } private void cmdAddDrugWidgetSelected ( ) { } private void loadPrescription ( ) { } private void populateGUI ( ) { } private void cmdSearchWidgetSelected ( ) { } private void cmdEkapaSearchWidgetSelected ( ) { } private void cmdDispenseARVDrugsSelected ( ) { } private void checkFirstPrescription ( ) { } private boolean drugsAddedToPrescription ( ) { } @ Override protected boolean submitForm ( ) { } private boolean validateCompound ( ) { } private void cmdSavePrescriptionWidgetSelected ( ) { } private void cmdAddDoctorWidgetSelected ( ) { } private void setLocalPrescription ( ) { localPrescription = new Prescription ( ) ; localPrescription . setPrescriptionId ( lblNewPrescriptionId . getText ( ) ) ; localPrescription . setPatient ( thePatient ) ; localPrescription . setReasonForUpdate ( cmbUpdateReason . getText ( ) ) ; localPrescription . setDatainicionoutroservico ( btnDataInicioNoutroServico . getDate ( ) ) ; if ( ! ( txtWeight . getText ( ) . equals ( "" ) ) ) { localPrescription . setWeight ( Double . parseDouble ( txtWeight . getText ( ) ) ) ; } else { localPrescription . setWeight ( 0.0 ) ; } if ( cmbDuration . getText ( ) . endsWith ( "weeks" ) ) { String [ ] s = cmbDuration . getText ( ) . split ( "<seq2seq4repair_space>" ) ; localPrescription . setDuration ( Integer . parseInt ( s [ 0 ] ) ) ; } else { String [ ] s = cmbDuration . getText ( ) . split ( "<seq2seq4repair_space>" ) ; localPrescription . setDuration ( ( ( Integer . parseInt ( s [ 0 ] ) ) * 4 ) ) ; } Date scriptDate = btnCaptureDate . getDate ( ) ; Calendar compareCal = Calendar . getInstance ( ) ; Calendar scriptDateCal = Calendar . getInstance ( ) ; scriptDateCal . setTime ( scriptDate ) ; if ( ( ( ( compareCal . get ( Calendar . DAY_OF_MONTH ) ) == ( scriptDateCal . get ( Calendar . DAY_OF_MONTH ) ) ) && ( ( compareCal . get ( Calendar . MONTH ) ) == ( scriptDateCal . get ( Calendar . MONTH ) ) ) ) && ( ( compareCal . get ( Calendar . YEAR ) ) == ( scriptDateCal . get ( Calendar . YEAR ) ) ) ) { scriptDate = new Date ( ) ; } localPrescription . setDate ( scriptDate ) ; localPrescription . setDoctor ( AdministrationManager . getDoctor ( getHSession ( ) , cmbDoctor . getText ( ) ) ) ; localPrescription . setRegimeTerapeutico ( AdministrationManager . getRegimeTerapeutico ( getHSession ( ) , cmbRegime . getText ( ) ) ) ; <START_BUG> localPrescription . setLinha ( AdministrationManager . getLinha ( getHSession ( ) , cmbLinha . getText ( ) ) ) ; <END_BUG> localPrescription . setSector ( AdministrationManager . getSector ( getHSession ( ) , cmbSector . getText ( ) ) ) ; localPrescription . setMotivoMudanca ( cmbMotivoMudanca . getText ( ) ) ; localPrescription . setModified ( 'T' ) ; localPrescription . setCurrent ( 'T' ) ; localPrescription . setNotes ( txtAreaNotes . getText ( ) ) ; List < PrescribedDrugs > prescribedDrugsList = new ArrayList < PrescribedDrugs > ( ) ; for ( int i = 0 ; i < ( tblDrugs . getItemCount ( ) ) ; i ++ ) { TableItem tmpItem = tblDrugs . getItem ( i ) ; PrescribedDrugs oldPD = ( ( PrescribedDrugs ) ( tmpItem . getData ( ) ) ) ; if ( oldPD != null ) { PrescribedDrugs newPD = new PrescribedDrugs ( ) ; newPD . setAmtPerTime ( oldPD . getAmtPerTime ( ) ) ; newPD . setDrug ( oldPD . getDrug ( ) ) ; newPD . setModified ( oldPD . getModified ( ) ) ; newPD . setPrescription ( localPrescription ) ; newPD . setTimesPerDay ( oldPD . getTimesPerDay ( ) ) ; prescribedDrugsList . add ( newPD ) ; } } localPrescription . setPrescribedDrugs ( prescribedDrugsList ) ; } @ Override protected void cmdCancelWidgetSelected ( ) { } @ Override protected void cmdClearWidgetSelected ( ) { } private void populateDrugsFromDrugGroup ( String DrugGroupName ) { } @ Override public void clearForm ( ) { } @ Override protected void enableFields ( boolean enable ) { } private void createCompDispense ( ) { } private void cmdUpdatePrescriptionId ( ) { } private void cmdUpdateClinic ( ) { } private void cmdPatientHistoryWidgetSelected ( ) { } @ Override protected void cmdSaveWidgetSelected ( ) { } @ Override protected void setLogger ( ) { } private void deleteScript ( Prescription prescriptionToRemove , Transaction tx ) { } public Patient getPatient ( ) { } @ Override public void changed ( Object o ) { }

Fix:
localPrescription . setLinha ( AdministrationManager . getLinhaTNome ( getHSession ( ) , cmbLinha . getText ( ) ) ) ;