Buggy code:
public class AttributeGroup extends org . tigris . scarab . om . BaseAttributeGroup implements Persistent { public static final String GET_ATTRIBUTES = "getAttributes" ; private static final String GET_R_ATTRIBUTE_ATTRGROUP = "getRAttributeAttributeGroup" ; public boolean isGlobal ( ) throws TorqueException { } public ScarabModule getScarabModule ( ) { } public void setScarabModule ( ScarabModule module ) { } public void setModule ( Module me ) throws TorqueException { } public Module getModule ( ) throws TorqueException { } private static MethodResultCache getMethodResult ( ) { } public boolean hasAnyOptionAttributes ( ) throws Exception { } public List getAttributes ( ) throws Exception { } public boolean hasAttribute ( Attribute attribute ) throws Exception { } public int getHighestOrderedAttribute ( ) throws Exception { } public RAttributeAttributeGroup getRAttributeAttributeGroup ( Attribute attribute ) throws Exception { } public List getRModuleAttributes ( ) throws Exception { } public List getRIssueTypeAttributes ( ) throws Exception { } public void delete ( ) throws Exception { int dupeSequence = 0 ; Integer issueTypeId = getIssueTypeId ( ) ; IssueType issueType = IssueTypeManager . getInstance ( SimpleKey . keyFor ( issueTypeId ) , false ) ; List attrGroups = null ; if ( isGlobal ( ) ) { attrGroups = issueType . getAttributeGroups ( null , false ) ; dupeSequence = issueType . getDedupeSequence ( ) ; Criteria crit = new Criteria ( ) . addJoin ( ATTRIBUTE_ID , RAttributeAttributeGroupPeer . ATTRIBUTE_ID ) . add ( GROUP_ID , getAttributeGroupId ( ) ) . add ( ISSUE_TYPE_ID , issueTypeId ) ; List results = RIssueTypeAttributePeer . doSelect ( crit ) ; for ( Iterator i = results . iterator ( ) ; i . hasNext ( ) ; ) { ( ( RIssueTypeAttribute ) ( i . next ( ) ) ) . delete ( ) ; } } else { if ( issueType . getLocked ( ) ) { <START_BUG> throw ScarabException . create ( ExceptionGroupDeleteForbidden , this . getName ( ) , issueType . getName ( ) ) ; <END_BUG> } else { Module module = getModule ( ) ; attrGroups = getIssueType ( ) . getAttributeGroups ( module , false ) ; dupeSequence = module . getDedupeSequence ( issueType ) ; Criteria crit = new Criteria ( ) . addJoin ( RModuleAttributePeer . ATTRIBUTE_ID , RAttributeAttributeGroupPeer . ATTRIBUTE_ID ) . add ( GROUP_ID , getAttributeGroupId ( ) ) . add ( MODULE_ID , getModuleId ( ) ) ; Criteria . Criterion critIssueType = crit . getNewCriterion ( RModuleAttributePeer . ISSUE_TYPE_ID , getIssueTypeId ( ) , EQUAL ) ; critIssueType . or ( crit . getNewCriterion ( RModuleAttributePeer . ISSUE_TYPE_ID , issueType . getTemplateId ( ) , EQUAL ) ) ; crit . and ( critIssueType ) ; List results = RModuleAttributePeer . doSelect ( crit ) ; for ( int i = 0 ; i < ( results . size ( ) ) ; i ++ ) { RModuleAttribute rma = ( ( RModuleAttribute ) ( results . get ( i ) ) ) ; rma . delete ( ) ; } } } Criteria crit2 = new Criteria ( ) . add ( GROUP_ID , getAttributeGroupId ( ) ) ; RAttributeAttributeGroupPeer . doDelete ( crit2 ) ; int order = getOrder ( ) ; crit2 = new Criteria ( ) . add ( ATTRIBUTE_GROUP_ID , getAttributeGroupId ( ) ) ; AttributeGroupPeer . doDelete ( crit2 ) ; IssueTypeManager . getManager ( ) . refreshedObject ( this ) ; for ( int i = 0 ; i < ( attrGroups . size ( ) ) ; i ++ ) { AttributeGroup tempGroup = ( ( AttributeGroup ) ( attrGroups . get ( i ) ) ) ; int tempOrder = tempGroup . getOrder ( ) ; if ( ( tempGroup . getOrder ( ) ) > order ) { if ( ( tempOrder == ( dupeSequence + 1 ) ) && ( tempOrder == 3 ) ) { tempGroup . setOrder ( ( tempOrder - 2 ) ) ; } else { tempGroup . setOrder ( ( tempOrder - 1 ) ) ; } tempGroup . save ( ) ; } } } public void addAttribute ( Attribute attribute ) throws Exception { } public void deleteAttribute ( Attribute attribute , ScarabUser user , Module module ) throws Exception { } private RAttributeAttributeGroup addRAttributeAttributeGroup ( Attribute attribute ) throws Exception { } public AttributeGroup copyGroup ( ) throws Exception { } }

Fix:
throw new org . tigris . scarab . util . ScarabException ( L10NKeySet . ExceptionGroupDeleteForbidden , this . getName ( ) , issueType . getName ( ) ) ;