Buggy code:
public class UpgradeCompany extends UpgradeProcess { protected AssetCategory addAssetCategory ( long userId , long parentCategoryId , String title , long vocabularyId , ServiceContext serviceContext ) throws Exception { } protected AssetVocabulary addAssetVocabulary ( long userId , String title , ServiceContext serviceContext ) throws Exception { } protected BlogsEntry addBlogsEntry ( long userId , String title , String fileName , ServiceContext serviceContext ) throws Exception { } protected FileEntry addDLFileEntry ( long userId , long groupId , long folderId , String fileName , String name , String mimeType , String title , String description , ServiceContext serviceContext ) throws Exception { } protected FileEntry addDLFileEntry ( long userId , long folderId , String filePath , ServiceContext serviceContext ) throws Exception { } protected Folder addDLFolder ( long userId , long groupId , String name , String description ) throws Exception { } protected JournalArticle addJournalArticle ( long userId , long groupId , String title , String fileName , ServiceContext serviceContext ) throws Exception { } protected JournalArticle addJournalArticle ( long userId , long groupId , String title , String fileName , String structureId , String templateId , ServiceContext serviceContext ) throws Exception { } protected JournalStructure addJournalStructure ( long userId , long groupId , String fileName ) throws Exception { } protected JournalTemplate addJournalTemplate ( long userId , long groupId , String fileName ) throws Exception { } protected Layout addLayout ( Group group , String name , boolean privateLayout , String friendlyURL , String layouteTemplateId ) throws Exception { ServiceContext serviceContext = new ServiceContext ( ) ; <START_BUG> Layout layout = LayoutLocalServiceUtil . addLayout ( group . getCreatorUserId ( ) , group . getGroupId ( ) , privateLayout , DEFAULT_PARENT_LAYOUT_ID , name , BLANK , BLANK , TYPE_PORTLET , false , friendlyURL , false , serviceContext ) ; <END_BUG> LayoutTypePortlet layoutTypePortlet = ( ( LayoutTypePortlet ) ( layout . getLayoutType ( ) ) ) ; layoutTypePortlet . setLayoutTemplateId ( 0 , layouteTemplateId , false ) ; addResources ( layout , DOCKBAR ) ; return layout ; } protected MBCategory addMBCategory ( long userId , String name , String description , ServiceContext serviceContext ) throws Exception { } protected MBMessage addMBMessage ( long userId , String userName , long groupId , long categoryId , long threadId , long parentMessageId , String subject , String filePath , ServiceContext serviceContext ) throws Exception { } protected String addPortletId ( Layout layout , String portletId , String columnId ) throws Exception { } protected void addResources ( Layout layout , String portletId ) throws Exception { } protected void addSocialRequest ( User user , User receiverUser , boolean confirm ) throws Exception { } protected User addUser ( long companyId , String screenName , String firstName , String lastName , boolean male , String jobTitle , long [ ] roleIds ) throws Exception { } protected WikiPage addWikiPage ( long userId , long nodeId , String title , String fileName , ServiceContext serviceContext ) throws Exception { } protected void clearData ( long companyId ) throws Exception { } protected void configureJournalContent ( Layout layout , String portletId , String articleId ) throws Exception { } protected void configurePortletTitle ( Layout layout , String portletId , String title ) throws Exception { } protected void deleteOrganizations ( long companyId , long parentOrganizationId ) throws Exception { } @ Override protected void doUpgrade ( ) throws Exception { } protected byte [ ] getBytes ( String path ) throws Exception { } protected InputStream getInputStream ( String path ) throws Exception { } protected String getString ( String path ) throws Exception { } protected void highlightPortlet ( Layout layout , String portletId ) throws Exception { } protected void removePortletBorder ( Layout layout , String portletId ) throws Exception { } protected void setRolePermissions ( Role role , String name , String [ ] actionIds ) throws Exception { } protected void setupCommunities ( long companyId , long defaultUserId ) throws Exception { } protected void setupOrganizations ( long companyId , long defaultUserId ) throws Exception { } protected void setupRoles ( long companyId , long defaultUserId ) throws Exception { } protected void setupUsers ( long companyId ) throws Exception { } protected void setupWorkflow ( long companyId , long defaultUserId ) throws Exception { } protected void updateLayout ( Layout layout ) throws Exception { } protected PortletPreferences updatePortletSetup ( Layout layout , String portletId , Map < String , String > preferences ) throws Exception { } private static int _PERMISSIONS_USER_CHECK_ALGORITHM = GetterUtil . getInteger ( PropsUtil . get ( PERMISSIONS_USER_CHECK_ALGORITHM ) ) ; private static final int _SN_FRIENDS_REQUEST_KEYS_ADD_FRIEND = 1 ; private Map < String , AssetCategory > _assetCategories ; No newline ; at end ; of file ; }

Fix:
Layout layout = LayoutLocalServiceUtil . addLayout ( group . getCreatorUserId ( ) , group . getGroupId ( ) , privateLayout , DEFAULT_PARENT_LAYOUT_ID , name , BLANK , BLANK , TYPE_PORTLET , false , friendlyURL , serviceContext ) ;