Buggy code:
@ Controller public class ImportExportController { private static final String OWNER = "UP_SYSTEM" ; private static final String EXPORT_PERMISSION = "EXPORT_ENTITY" ; private static final String DELETE_PERMISSION = "DELETE_ENTITY" ; final Log log = LogFactory . getLog ( getClass ( ) ) ; private IPersonManager personManager ; private IPortalDataHandlerService portalDataHandlerService ; private ICompositeGroupService groupService ; private XmlUtilities xmlUtilities ; @ Autowired public void setXmlUtilities ( XmlUtilities xmlUtilities ) { } @ Autowired public void setPersonManager ( IPersonManager personManager ) { } @ Autowired public void setPortalDataHandlerService ( IPortalDataHandlerService portalDataHandlerService ) { } @ Autowired public void setIGroupService ( ICompositeGroupService groupService ) { } @ RequestMapping ( value = "//import" , method = RequestMethod . POST ) public void importEntity ( @ RequestParam ( "file" ) MultipartFile entityFile , HttpServletRequest request , HttpServletResponse response ) throws IOException , XMLStreamException { } @ RequestMapping ( value = "//create//group" , method = RequestMethod . POST ) public void createGroupAndAddMembers ( @ RequestParam ( "groupid" ) String groupid , @ RequestParam ( "members" ) String memberGroups , HttpServletRequest request , HttpServletResponse response ) throws IOException , XMLStreamException { } @ RequestMapping ( value = "//create//fragment//group//{groupid}" , method = RequestMethod . GET ) public void createFragmentWithLayout ( @ PathVariable ( "groupid" ) String groupId , HttpServletRequest request , HttpServletResponse response ) throws IOException , XMLStreamException { } protected BufferedXMLEventReader createSourceXmlEventReader ( MultipartFile multipartFile ) throws IOException { } protected PortalDataKey getPortalDataKey ( final BufferedXMLEventReader bufferedXmlEventReader ) { } public void updateGroupMembership ( String groupId , List < String > subgroupNames , List < String > userNames , IPerson person ) { } public void createGroup ( String groupId , List < String > subgroupNames , List < String > usernames , IPerson person , boolean shouldJoinGroup ) throws IOException , XMLStreamException { } protected void createFragmentDefinition ( String groupId , HttpServletRequest request ) throws IOException , XMLStreamException { } protected void createFragmentLayout ( String groupId , HttpServletRequest request ) throws IOException , XMLStreamException { final IPerson person = personManager . getPerson ( request ) ; String [ ] splittedGroup = groupId . split ( ":" ) ; final String tabName = splittedGroup [ ( ( splittedGroup . length ) - 1 ) ] ; String layoutXml = ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "<?xml<seq2seq4repair_space>version=\"1.0\"<seq2seq4repair_space>encoding=\"UTF-8\"?>" + ( "<layout<seq2seq4repair_space>xmlns:dlm=\"http:////www.uportal.org//layout//dlm\"<seq2seq4repair_space>script=\"classpath:////org//jasig//portal//io//import-layout_v3-2.crn\"" + "<seq2seq4repair_space>username=\"" ) ) + ( person . getUserName ( ) ) ) + "\"<seq2seq4repair_space>>" ) + "<seq2seq4repair_space><folder<seq2seq4repair_space>ID=\"s1\"<seq2seq4repair_space>hidden=\"false\"<seq2seq4repair_space>immutable=\"false\"<seq2seq4repair_space>name=\"Root<seq2seq4repair_space>folder\"<seq2seq4repair_space>type=\"root\"<seq2seq4repair_space>unremovable=\"true\">" ) + "<seq2seq4repair_space><!--" ) + "<seq2seq4repair_space>|<seq2seq4repair_space>Hidden<seq2seq4repair_space>folders<seq2seq4repair_space>do<seq2seq4repair_space>not<seq2seq4repair_space>propagate<seq2seq4repair_space>to<seq2seq4repair_space>regular<seq2seq4repair_space>users,<seq2seq4repair_space>and<seq2seq4repair_space>fragment<seq2seq4repair_space>owner" ) + "<seq2seq4repair_space>|<seq2seq4repair_space>accounts<seq2seq4repair_space>don't<seq2seq4repair_space>receive<seq2seq4repair_space>(other)<seq2seq4repair_space>fragments<seq2seq4repair_space>at<seq2seq4repair_space>all;<seq2seq4repair_space>Fragment<seq2seq4repair_space>owners<seq2seq4repair_space>must" ) + "<seq2seq4repair_space>|<seq2seq4repair_space>have<seq2seq4repair_space>their<seq2seq4repair_space>own<seq2seq4repair_space>copies<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>minimal<seq2seq4repair_space>portlets<seq2seq4repair_space>required<seq2seq4repair_space>to<seq2seq4repair_space>view<seq2seq4repair_space>and<seq2seq4repair_space>manage" ) + "<seq2seq4repair_space>|<seq2seq4repair_space>their<seq2seq4repair_space>own<seq2seq4repair_space>layouts." ) + "<seq2seq4repair_space>+-->" ) + "<seq2seq4repair_space><folder<seq2seq4repair_space>ID=\"s2\"<seq2seq4repair_space>hidden=\"true\"<seq2seq4repair_space>immutable=\"true\"<seq2seq4repair_space>name=\"Page<seq2seq4repair_space>Top<seq2seq4repair_space>folder\"<seq2seq4repair_space>type=\"page-top\"<seq2seq4repair_space>unremovable=\"true\">" ) + "<seq2seq4repair_space><channel<seq2seq4repair_space>fname=\"dynamic-respondr-skin\"<seq2seq4repair_space>unremovable=\"false\"<seq2seq4repair_space>hidden=\"false\"<seq2seq4repair_space>immutable=\"false\"<seq2seq4repair_space>ID=\"n3\"//>" ) + "<seq2seq4repair_space><channel<seq2seq4repair_space>fname=\"fragment-admin-exit\"<seq2seq4repair_space>unremovable=\"false\"<seq2seq4repair_space>hidden=\"false\"<seq2seq4repair_space>immutable=\"false\"<seq2seq4repair_space>ID=\"n4\"//>" ) + "<seq2seq4repair_space><//folder>" ) + "<seq2seq4repair_space><folder<seq2seq4repair_space>ID=\"s5\"<seq2seq4repair_space>hidden=\"true\"<seq2seq4repair_space>immutable=\"true\"<seq2seq4repair_space>name=\"Customize<seq2seq4repair_space>folder\"<seq2seq4repair_space>type=\"customize\"<seq2seq4repair_space>unremovable=\"true\">" ) + "<seq2seq4repair_space><channel<seq2seq4repair_space>fname=\"personalization-gallery\"<seq2seq4repair_space>unremovable=\"false\"<seq2seq4repair_space>hidden=\"false\"<seq2seq4repair_space>immutable=\"false\"<seq2seq4repair_space>ID=\"n6\"//>" ) + "<seq2seq4repair_space><//folder>" ) + "<seq2seq4repair_space><folder<seq2seq4repair_space>ID=\"s7\"<seq2seq4repair_space>dlm:deleteAllowed=\"false\"<seq2seq4repair_space>dlm:editAllowed=\"false\"<seq2seq4repair_space>dlm:moveAllowed=\"false\"<seq2seq4repair_space>hidden=\"false\"<seq2seq4repair_space>immutable=\"false\"<seq2seq4repair_space>name=\"" ) + tabName ) + "<seq2seq4repair_space>Tab\"<seq2seq4repair_space>type=\"regular\"<seq2seq4repair_space>unremovable=\"false\">" ) + "<seq2seq4repair_space><structure-attribute>" ) + "<seq2seq4repair_space><name>externalId<//name>" ) + "<seq2seq4repair_space><value>welcome<//value>" ) + "<seq2seq4repair_space><//structure-attribute>" ) + "<seq2seq4repair_space><folder<seq2seq4repair_space>ID=\"s8\"<seq2seq4repair_space>hidden=\"false\"<seq2seq4repair_space>immutable=\"false\"<seq2seq4repair_space>name=\"Column\"<seq2seq4repair_space>type=\"regular\"<seq2seq4repair_space>unremovable=\"false\">" ) + "<seq2seq4repair_space><structure-attribute>" ) + "<seq2seq4repair_space><name>width<//name>" ) + "<seq2seq4repair_space><value>60%<//value>" ) + "<seq2seq4repair_space><//structure-attribute>" ) + "<seq2seq4repair_space><//folder>" ) + "<seq2seq4repair_space><folder<seq2seq4repair_space>ID=\"s12\"<seq2seq4repair_space>hidden=\"false\"<seq2seq4repair_space>immutable=\"false\"<seq2seq4repair_space>name=\"Column\"<seq2seq4repair_space>type=\"regular\"<seq2seq4repair_space>unremovable=\"false\">" ) + "<seq2seq4repair_space><structure-attribute>" ) + "<seq2seq4repair_space><name>width<//name>" ) + "<seq2seq4repair_space><value>40%<//value>" ) + "<seq2seq4repair_space><//structure-attribute>" ) + "<seq2seq4repair_space><//folder>" ) + "<seq2seq4repair_space><//folder>" ) + "<seq2seq4repair_space><//folder>" ) + "<//layout>" ; final XMLInputFactory xmlInputFactory = this . xmlUtilities . getXmlInputFactory ( ) ; InputStream inputStream = new ByteArrayInputStream ( layoutXml . getBytes ( "UTF-8" ) ) ; XMLEventReader xmlEventReader = null ; try { <START_BUG> xmlEventReader = xmlInputFactory . createXMLEventReader ( "Fr2.fragment-definition.xml" , inputStream ) ; <END_BUG> } catch ( XMLStreamException e ) { throw new RuntimeException ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>create<seq2seq4repair_space>XML<seq2seq4repair_space>Event<seq2seq4repair_space>Reader<seq2seq4repair_space>for<seq2seq4repair_space>data<seq2seq4repair_space>Source" , e ) ; } BufferedXMLEventReader buffXmlEvnetReader = new BufferedXMLEventReader ( xmlEventReader , ( - 1 ) ) ; final BufferedXMLEventReader bufferedXmlEventReader = buffXmlEvnetReader ; try { StAXSource fragmentSource = new StAXSource ( bufferedXmlEventReader ) ; portalDataHandlerService . importData ( fragmentSource ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new IOException ( e . getMessage ( ) , e ) ; } } @ RequestMapping ( value = "//entity//{entityType}//{entityId}" , method = RequestMethod . DELETE ) public void deleteEntity ( @ PathVariable ( "entityType" ) String entityType , @ PathVariable ( "entityId" ) String entityId , HttpServletRequest request , HttpServletResponse response ) throws IOException { } @ RequestMapping ( value = "//entity//{entityType}//{entityId}" , method = RequestMethod . GET ) public void exportEntity ( @ PathVariable ( "entityId" ) String entityId , @ PathVariable ( "entityType" ) String entityType , @ RequestParam ( value = "download" , required = false ) boolean download , HttpServletRequest request , HttpServletResponse response ) throws IOException { } }

Fix:
xmlEventReader = xmlInputFactory . createXMLEventReader ( "Fr2.fragment-layout.xml" , inputStream ) ;