Buggy code:
private static final String ACTIVE_STYLE = "active" ; private static final String LIBRARY_PAGE = "page" ; private String unitListId = "" ; private String parentId = "" ; private static final String COURSE_DEFAULT_IMG = "..//images//library//course-1000x300.png" ; private static DistrictView . DistrictViewUiBinder uiBinder = GWT . create ( DistrictView . DistrictViewUiBinder . class ) ; private MessageProperties i18n = GWT . create ( MessageProperties . class ) ; private int collectionCount = 0 ; private int totalCollectionCount = 0 ; interface DistrictViewUiBinder extends UiBinder < Widget , DistrictView > { } public DistrictView ( ) { } @ Override public void onLoad ( ) { } @ Override public void loadFeaturedContributors ( String callBack , String placeToken , ProfileLibraryListDo profileLibraryListDo ) { } private void setFeaturedCourseWidgets ( ArrayList < ProfileLibraryDo > profileLibDoList , boolean isFeaturedCourseSelected ) { } public void setUnitList ( final ArrayList < ProfileLibraryDo > profileLibraryDoList , String libraryGooruOid ) { Window . addWindowScrollHandler ( new DistrictView . LeftPanelScroll ( libraryGooruOid ) ) ; if ( ( profileLibraryDoList . get ( 0 ) . getItemCount ( ) ) > 20 ) { totalCollectionCount = profileLibraryDoList . get ( 0 ) . getItemCount ( ) ; } int firstWidgetCount = leftNav . getWidgetCount ( ) ; for ( int i = 0 ; i < ( profileLibraryDoList . size ( ) ) ; i ++ ) { LibraryUnitMenuView libraryUnitMenuView = new LibraryUnitMenuView ( profileLibraryDoList . get ( i ) , libraryGooruOid ) ; leftNav . add ( libraryUnitMenuView ) ; libraryUnitMenuView . setWidgetCount ( ( ( leftNav . getWidgetCount ( ) ) + 1 ) ) ; libraryUnitMenuView . setType ( profileLibraryDoList . get ( i ) . getType ( ) ) ; if ( firstWidgetCount == 0 ) { firstWidgetCount ++ ; loadingPanel ( true ) ; libraryUnitMenuView . addStyleName ( districtStyleUc . unitLiActive ( ) ) ; unitListId = profileLibraryDoList . get ( i ) . getGooruOid ( ) ; if ( profileLibraryDoList . get ( i ) . getType ( ) . equals ( "scollection" ) ) { setTopicListData ( profileLibraryDoList . get ( i ) , unitListId , libraryGooruOid ) ; } else { folderTopicTitleLbl . setText ( profileLibraryDoList . get ( i ) . getTitle ( ) ) ; parentId = profileLibraryDoList . get ( i ) . getParentGooruOid ( ) ; if ( ( handlerRegistration ) != null ) { handlerRegistration . removeHandler ( ) ; } handlerRegistration = listViewBtn . addClickHandler ( new DistrictView . ListAllBtnClickHandler ( profileLibraryDoList . get ( i ) . getGooruOid ( ) , parentId ) ) ; setTopicListData ( profileLibraryDoList . get ( i ) . getCollectionItems ( ) , unitListId , profileLibraryDoList . get ( i ) , libraryGooruOid , parentId ) ; } } } final Iterator < Widget > widgets = leftNav . iterator ( ) ; int widgetCount = 0 ; while ( widgets . hasNext ( ) ) { final Widget widget = widgets . next ( ) ; final LibraryUnitMenuView libraryUnitMenuView = ( ( LibraryUnitMenuView ) ( widget ) ) ; final int widgetCountTemp = widgetCount ; libraryUnitMenuView . getUnitMenuItemPanel ( ) . addClickHandler ( new ClickHandler ( ) { @ Override public void onClick ( ClickEvent event ) { if ( ( libraryUnitMenuView . getWidgetCount ( ) ) > 10 ) { Window . scrollTo ( 0 , 0 ) ; } DistrictView . scrollFlag = false ; loadingPanel ( true ) ; final Iterator < Widget > widgetsPanel = leftNav . iterator ( ) ; while ( widgetsPanel . hasNext ( ) ) { final Widget widgetTxt = widgetsPanel . next ( ) ; widgetTxt . removeStyleName ( districtStyleUc . unitLiActive ( ) ) ; } widget . addStyleName ( districtStyleUc . unitLiActive ( ) ) ; unitListId = libraryUnitMenuView . getUnitId ( ) ; if ( libraryUnitMenuView . getType ( ) . equals ( "scollection" ) ) { setTopicListData ( profileLibraryDoList . get ( widgetCountTemp ) , unitListId , libraryUnitMenuView . getLibraryGooruOid ( ) ) ; } else { folderTopicTitleLbl . setText ( libraryUnitMenuView . getTitle ( ) ) ; if ( ( handlerRegistration ) != null ) { handlerRegistration . removeHandler ( ) ; } <START_BUG> handlerRegistration = listViewBtn . addClickHandler ( new DistrictView . ListAllBtnClickHandler ( libraryUnitMenuView . getLibraryGooruOid ( ) , parentId ) ) ; <END_BUG> if ( widgetCountTemp == 0 ) { totalCollectionCount = profileLibraryDoList . get ( widgetCountTemp ) . getItemCount ( ) ; setTopicListData ( profileLibraryDoList . get ( widgetCountTemp ) . getCollectionItems ( ) , unitListId , profileLibraryDoList . get ( widgetCountTemp ) , libraryUnitMenuView . getLibraryGooruOid ( ) , parentId ) ; } else { getUnitTopics ( unitListId , profileLibraryDoList . get ( widgetCountTemp ) , libraryUnitMenuView . getLibraryGooruOid ( ) ) ; ProfileLibraryDoObj = profileLibraryDoList . get ( widgetCountTemp ) ; } } } } ) ; widgetCount ++ ; } } private void getUnitTopics ( final String unitListId , final ProfileLibraryDo profileLibraryDo , final String libraryGooruOid ) { } public void setTopicListData ( ProfileLibraryDo profileLibraryDo , String folderId , String libraryGooruOid ) { } public void setTopicListData ( ArrayList < ProfileLibraryDo > folderListDo , String folderId , ProfileLibraryDo profileLibraryDo , String libraryGooruOid , String parentId ) { } public void loadingPanel ( boolean isVisible ) { } public String getPlaceToken ( ) { } private void setPlaceToken ( String placeToken ) { } private void setMetaDataContent ( ProfileLibraryDo profileLibraryDo ) { } public void setAssets ( String placeToken ) { } private void setLandingBannerMetaData ( String bannerId , String height , String featuredCourseLbl , String partnerLogoStyle , boolean isPartnerLogoVisible ) { } private void setSubjectUnits ( ArrayList < ProfileLibraryDo > unitList , String libraryGooruOid ) { } public class ListAllBtnClickHandler implements ClickHandler { String folderId = "" ; String parentId = "" ; public ListAllBtnClickHandler ( String folderId , String parentId ) { } @ Override public void onClick ( ClickEvent event ) { } } private void showCourseBanner ( ProfileLibraryDo profileLibraryDo , boolean isCoursePageVisible ) { }

Fix:
handlerRegistration = listViewBtn . addClickHandler ( new DistrictView . ListAllBtnClickHandler ( libraryUnitMenuView . getUnitId ( ) , parentId ) ) ;