Buggy code:
String sqlGetForms = "select<seq2seq4repair_space>f.f_id,<seq2seq4repair_space>" + ( ( ( ( ( "f.name,<seq2seq4repair_space>" + "f.parentform,<seq2seq4repair_space>" ) + "f.parentquestion,<seq2seq4repair_space>" ) + "f.table_name,<seq2seq4repair_space>" ) + "f.repeats<seq2seq4repair_space>" ) + "from<seq2seq4repair_space>form<seq2seq4repair_space>f<seq2seq4repair_space>where<seq2seq4repair_space>f.s_id<seq2seq4repair_space>=<seq2seq4repair_space>?;" ) ; PreparedStatement pstmtGetForms = sd . prepareStatement ( sqlGetForms ) ; ResultSet rsGetQuestions = null ; String sqlGetQuestions = "select<seq2seq4repair_space>q.q_id,<seq2seq4repair_space>q.qname,<seq2seq4repair_space>q.qtype,<seq2seq4repair_space>q.qtext_id,<seq2seq4repair_space>l.name,<seq2seq4repair_space>q.infotext_id,<seq2seq4repair_space>" + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "q.source,<seq2seq4repair_space>" + "q.calculate,<seq2seq4repair_space>" ) + "q.seq,<seq2seq4repair_space>" ) + "q.defaultanswer,<seq2seq4repair_space>" ) + "q.appearance,<seq2seq4repair_space>" ) + "q.qconstraint,<seq2seq4repair_space>" ) + "q.constraint_msg,<seq2seq4repair_space>" ) + "q.nodeset,<seq2seq4repair_space>" ) + "q.relevant,<seq2seq4repair_space>" ) + "q.visible,<seq2seq4repair_space>" ) + "q.readonly,<seq2seq4repair_space>" ) + "q.mandatory,<seq2seq4repair_space>" ) + "q.repeatcount,<seq2seq4repair_space>" ) + "q.published,<seq2seq4repair_space>" ) + "q.column_name,<seq2seq4repair_space>" ) + "q.source_param,<seq2seq4repair_space>" ) + "q.path,<seq2seq4repair_space>" ) + "q.soft_deleted<seq2seq4repair_space>" ) + "from<seq2seq4repair_space>question<seq2seq4repair_space>q<seq2seq4repair_space>" ) + "left<seq2seq4repair_space>outer<seq2seq4repair_space>join<seq2seq4repair_space>listname<seq2seq4repair_space>l<seq2seq4repair_space>on<seq2seq4repair_space>q.l_id<seq2seq4repair_space>=<seq2seq4repair_space>l.l_id<seq2seq4repair_space>" ) + "where<seq2seq4repair_space>q.f_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" ) + "order<seq2seq4repair_space>by<seq2seq4repair_space>q.seq<seq2seq4repair_space>asc;" ) ; PreparedStatement pstmtGetQuestions = sd . prepareStatement ( sqlGetQuestions ) ; ResultSet rsGetLists = null ; String sqlGetLists = "select<seq2seq4repair_space>l_id,<seq2seq4repair_space>" + ( ( "name<seq2seq4repair_space>" + "from<seq2seq4repair_space>listname<seq2seq4repair_space>" ) + "where<seq2seq4repair_space>s_id<seq2seq4repair_space>=<seq2seq4repair_space>?;" ) ; PreparedStatement pstmtGetLists = sd . prepareStatement ( sqlGetLists ) ; ResultSet rsGetOptions = null ; String sqlGetOptions = "select<seq2seq4repair_space>o.o_id,<seq2seq4repair_space>" + ( ( ( ( ( ( ( "o.ovalue<seq2seq4repair_space>as<seq2seq4repair_space>value,<seq2seq4repair_space>" + "o.label_id,<seq2seq4repair_space>" ) + "o.externalfile,<seq2seq4repair_space>" ) + "o.cascade_filters,<seq2seq4repair_space>" ) + "o.column_name<seq2seq4repair_space>" ) + "from<seq2seq4repair_space>option<seq2seq4repair_space>o<seq2seq4repair_space>" ) + "where<seq2seq4repair_space>o.l_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" ) + "order<seq2seq4repair_space>by<seq2seq4repair_space>o.seq" ) ; PreparedStatement pstmtGetOptions = sd . prepareStatement ( sqlGetOptions ) ; ResultSet rsGetSSC = null ; String sqlGetSSC = "SELECT<seq2seq4repair_space>ssc.id,<seq2seq4repair_space>ssc.name,<seq2seq4repair_space>ssc.function,<seq2seq4repair_space>ssc.parameters,<seq2seq4repair_space>ssc.units,<seq2seq4repair_space>f.name,<seq2seq4repair_space>f.f_id<seq2seq4repair_space>" + "FROM<seq2seq4repair_space>ssc<seq2seq4repair_space>ssc,<seq2seq4repair_space>form<seq2seq4repair_space>f<seq2seq4repair_space>WHERE<seq2seq4repair_space>ssc.s_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>AND<seq2seq4repair_space>ssc.f_id<seq2seq4repair_space>=<seq2seq4repair_space>f.f_id<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>id" ; PreparedStatement pstmtGetSSC = sd . prepareStatement ( sqlGetSSC ) ; ResultSet rsGetChanges = null ; String sqlGetChanges = "SELECT<seq2seq4repair_space>c.changes,<seq2seq4repair_space>" + ( ( ( ( ( ( ( ( ( ( "c.c_id,<seq2seq4repair_space>" + "c.version,<seq2seq4repair_space>" ) + "u.name,<seq2seq4repair_space>" ) + "c.updated_time,<seq2seq4repair_space>" ) + "c.apply_results,<seq2seq4repair_space>" ) + "c.success,<seq2seq4repair_space>" ) + "c.msg<seq2seq4repair_space>" ) + "from<seq2seq4repair_space>survey_change<seq2seq4repair_space>c,<seq2seq4repair_space>users<seq2seq4repair_space>u<seq2seq4repair_space>" ) + "where<seq2seq4repair_space>c.s_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" ) + "and<seq2seq4repair_space>c.user_id<seq2seq4repair_space>=<seq2seq4repair_space>u.id<seq2seq4repair_space>" ) + "order<seq2seq4repair_space>by<seq2seq4repair_space>c_id<seq2seq4repair_space>desc;<seq2seq4repair_space>" ) ; PreparedStatement pstmtGetChanges = sd . prepareStatement ( sqlGetChanges ) ; s . languages = GeneralUtilityMethods . getLanguages ( sd , s . id ) ; int oId = GeneralUtilityMethods . getOrganisationId ( sd , user ) ; if ( ( s . def_lang ) == null ) { if ( ( ( s . languages ) != null ) && ( ( s . languages . size ( ) ) > 0 ) ) { s . def_lang = s . languages . get ( 0 ) ; } else { s . def_lang = "language" ; } } pstmtGetForms . setInt ( 1 , s . id ) ; rsGetForms = pstmtGetForms . executeQuery ( ) ; while ( rsGetForms . next ( ) ) { Form f = new Form ( ) ; f . id = rsGetForms . getInt ( 1 ) ; f . name = rsGetForms . getString ( 2 ) ; f . parentform = rsGetForms . getInt ( 3 ) ; f . parentQuestion = rsGetForms . getInt ( 4 ) ; f . tableName = rsGetForms . getString ( 5 ) ; f . repeat_path = rsGetForms . getString ( 6 ) ; pstmtGetQuestions . setInt ( 1 , f . id ) ; SurveyManager . log . info ( ( "Get<seq2seq4repair_space>questions<seq2seq4repair_space>for<seq2seq4repair_space>form:<seq2seq4repair_space>" + ( pstmtGetQuestions . toString ( ) ) ) ) ; rsGetQuestions = pstmtGetQuestions . executeQuery ( ) ; boolean inMeta = false ; String savedCalculation = null ; while ( rsGetQuestions . next ( ) ) { Question q = new Question ( ) ; q . id = rsGetQuestions . getInt ( 1 ) ; q . name = rsGetQuestions . getString ( 2 ) ; q . type = rsGetQuestions . getString ( 3 ) ; q . text_id = rsGetQuestions . getString ( 4 ) ; q . list_name = rsGetQuestions . getString ( 5 ) ; q . hint_id = rsGetQuestions . getString ( 6 ) ; q . source = rsGetQuestions . getString ( 7 ) ; q . calculation = GeneralUtilityMethods . convertAllXpathNames ( rsGetQuestions . getString ( 8 ) , true ) ; q . seq = rsGetQuestions . getInt ( 9 ) ; q . defaultanswer = rsGetQuestions . getString ( 10 ) ; q . appearance = rsGetQuestions . getString ( 11 ) ; q . constraint = GeneralUtilityMethods . convertAllXpathNames ( rsGetQuestions . getString ( 12 ) , true ) ; q . constraint_msg = rsGetQuestions . getString ( 13 ) ; q . choice_filter = GeneralUtilityMethods . getChoiceFilterFromNodeset ( rsGetQuestions . getString ( 14 ) , true ) ; q . relevant = GeneralUtilityMethods . convertAllXpathNames ( rsGetQuestions . getString ( 15 ) , true ) ; q . visible = rsGetQuestions . getBoolean ( 16 ) ; q . readonly = rsGetQuestions . getBoolean ( 17 ) ; q . required = rsGetQuestions . getBoolean ( 18 ) ; q . repeatCount = rsGetQuestions . getBoolean ( 19 ) ; q . published = rsGetQuestions . getBoolean ( 20 ) ; q . columnName = rsGetQuestions . getString ( 21 ) ; q . source_param = rsGetQuestions . getString ( 22 ) ; q . path = rsGetQuestions . getString ( 23 ) ; q . soft_deleted = rsGetQuestions . getBoolean ( 24 ) ; if ( ( ( q . source_param ) != null ) && ( ( ( q . source_param . equals ( "deviceid" ) ) || ( q . source_param . equals ( "start" ) ) ) || ( q . source_param . equals ( "end" ) ) ) ) { q . propertyType = true ; } if ( ( ( q . name ) != null ) & ( ( q . name . equals ( "_instanceid" ) ) || ( q . name . equals ( "_task_key" ) ) ) ) { q . propertyType = true ; } if ( ( ( q . path ) != null ) && ( q . path . startsWith ( "//main//meta" ) ) ) { q . propertyType = true ; } if ( ( q . propertyType ) && ( ! getPropertyTypeQuestions ) ) { continue ; } if ( q . repeatCount ) { savedCalculation = q . calculation ; continue ; } if ( q . type . equals ( "begin<seq2seq4repair_space>repeat" ) ) { q . calculation = savedCalculation ; savedCalculation = null ; } <START_BUG> q . type = GeneralUtilityMethods . translateTypeFromDB ( q . type , q . readonly ) ; <END_BUG>

Fix:
q . type = GeneralUtilityMethods . translateTypeFromDB ( q . type , q . readonly , q . visible ) ;