Buggy code:
public class CmsXmlSitemapGenerator { protected class ResultEntry { private int m_priority ; private CmsXmlSitemapUrlBean m_urlBean ; public ResultEntry ( CmsXmlSitemapUrlBean urlBean , int priority ) { } public int getPriority ( ) { } public CmsXmlSitemapUrlBean getUrlBean ( ) { } } public static final String DEFAULT_CHANGE_FREQUENCY = "daily" ; public static final double DEFAULT_PRIORITY = 0.5 ; private static final Log LOG = CmsLog . getLog ( CmsXmlSitemapGenerator . class ) ; protected String m_baseFolderRootPath ; protected String m_baseFolderSitePath ; protected boolean m_computeContainerPageDates ; protected List < CmsDetailPageInfo > m_detailPageInfos = new ArrayList < CmsDetailPageInfo > ( ) ; protected Map < String , List < CmsResource > > m_detailResources = new HashMap < String , List < CmsResource > > ( ) ; protected Multimap < String , String > m_detailTypesByPage = ArrayListMultimap . create ( ) ; protected CmsObject m_guestCms ; protected CmsPathIncludeExcludeSet m_includeExcludeSet = new CmsPathIncludeExcludeSet ( ) ; protected Multimap < CmsUUID , CmsAlias > m_pageAliasesBelowBaseFolderByStructureId = ArrayListMultimap . create ( ) ; protected Map < String , CmsXmlSitemapGenerator . ResultEntry > m_resultMap = new LinkedHashMap < String , CmsXmlSitemapGenerator . ResultEntry > ( ) ; protected CmsObject m_siteGuestCms ; protected String m_siteRoot ; protected String m_siteRootLink ; public CmsXmlSitemapGenerator ( String folderRootPath ) throws CmsException { } protected static String getChangeFrequency ( List < CmsProperty > properties ) { } protected static void removeInternalFiles ( List < CmsResource > resources ) { } private static double getPriority ( List < CmsProperty > properties ) { } public List < CmsXmlSitemapUrlBean > generateSitemapBeans ( ) throws CmsException { } public CmsPathIncludeExcludeSet getIncludeExcludeSet ( ) { } public String renderSitemap ( ) throws CmsException { } public void setComputeContainerPageDates ( boolean computeContainerPageDates ) { } protected void addResult ( CmsXmlSitemapUrlBean result , int resultPriority ) { } protected long computeContainerPageModificationDate ( CmsResource containerPage ) throws CmsException { } protected String getDetailLink ( CmsResource pageRes , CmsResource detailRes , Locale locale ) { String pageSitePath = m_siteGuestCms . getSitePath ( pageRes ) ; String detailSitePath = m_siteGuestCms . getSitePath ( detailRes ) ; CmsRequestContext requestContext = m_siteGuestCms . getRequestContext ( ) ; String originalUri = requestContext . getUri ( ) ; Locale originalLocale = requestContext . getLocale ( ) ; try { requestContext . setUri ( pageSitePath ) ; requestContext . setLocale ( locale ) ; <START_BUG> return OpenCms . getLinkManager ( ) . getOnlineLink ( m_siteGuestCms , detailSitePath ) ; <END_BUG> } finally { requestContext . setUri ( originalUri ) ; requestContext . setLocale ( originalLocale ) ; } } protected List < I_CmsResourceType > getDetailTypesForPage ( CmsResource resource ) { } protected List < CmsResource > getDirectPages ( ) throws CmsException { } protected String getInnerXmlForEntry ( CmsXmlSitemapUrlBean entry ) { } protected List < CmsResource > getNavigationPages ( ) { } protected String getUrlSetOpenTag ( ) { } protected String getXmlForEntry ( CmsXmlSitemapUrlBean entry ) { } protected boolean isAliasBelowBaseFolder ( CmsAlias alias ) { } private void addAliasLinks ( CmsUUID aliasStructureId ) { } private void addDetailLinks ( CmsResource containerPage , Locale locale ) throws CmsException { } private List < CmsResource > getDetailResources ( I_CmsResourceType type ) throws CmsException { } private Locale getLocale ( CmsResource resource , List < CmsProperty > propertyList ) { } private void initializeFileData ( String baseSitePath ) throws CmsException { } private boolean isValidDetailPageCombination ( CmsResource page , Locale locale , CmsResource detailRes ) { } }

Fix:
return OpenCms . getLinkManager ( ) . getOnlineLink ( m_siteGuestCms , detailSitePath , true ) ;