Buggy code:
private static final long startTime = System . currentTimeMillis ( ) ; public long getStartTime ( ) { } public static SolrIndexConfig mainIndexConfig = new SolrIndexConfig ( "mainIndex" ) ; public static List < SolrEventListener > parseListener ( String path ) { } List < SolrEventListener > firstSearcherListeners ; List < SolrEventListener > newSearcherListeners ; private void parseListeners ( ) { } public IndexSchema getSchema ( ) { } public String getDataDir ( ) { } public String getIndexDir ( ) { } private final RequestHandlers reqHandlers = new RequestHandlers ( SolrConfig . config ) ; public SolrRequestHandler getRequestHandler ( String handlerName ) { } public SolrIndexSearcher newSearcher ( String name ) throws IOException { } void initIndex ( ) { } private UpdateHandler createUpdateHandler ( String className ) { } private static SolrCore core ; public static SolrCore getSolrCore ( ) { } public SolrCore ( String dataDir , IndexSchema schema ) { } public void close ( ) { } void finalizer ( ) { } private RefCounted < SolrIndexSearcher > _searcher ; final ExecutorService searcherExecutor = Executors . newSingleThreadExecutor ( ) ; private int onDeckSearchers ; private Object searcherLock = new Object ( ) ; public RefCounted < SolrIndexSearcher > getSearcher ( ) { } public RefCounted < SolrIndexSearcher > getSearcher ( boolean forceNew , boolean returnSearcher , final Future [ ] waitSearcher ) throws IOException { } private RefCounted < SolrIndexSearcher > newHolder ( SolrIndexSearcher newSearcher ) { } private void registerSearcher ( RefCounted < SolrIndexSearcher > newSearcherHolder ) throws IOException { } public void closeSearcher ( ) { } public void execute ( SolrQueryRequest req , SolrQueryResponse rsp ) { } XmlPullParserFactory factory ; private int findNextTag ( XmlPullParser xpp , String tag ) throws IOException , XmlPullParserException { } public void update ( Reader reader , Writer writer ) { XmlPullParser xpp = null ; try { xpp = factory . newPullParser ( ) ; } catch ( XmlPullParserException e ) { throw new RuntimeException ( e ) ; } long startTime = System . currentTimeMillis ( ) ; try { xpp . setInput ( reader ) ; xpp . nextTag ( ) ; String currTag = xpp . getName ( ) ; if ( "add" . equals ( currTag ) ) { SolrCore . log . finest ( "SolrCore.update(add)" ) ; AddUpdateCommand cmd = new AddUpdateCommand ( ) ; cmd . allowDups = false ; int status = 0 ; boolean pendingAttr = false ; boolean committedAttr = false ; int attrcount = xpp . getAttributeCount ( ) ; for ( int i = 0 ; i < attrcount ; i ++ ) { String attrName = xpp . getAttributeName ( i ) ; String attrVal = xpp . getAttributeValue ( i ) ; if ( "allowDups" . equals ( attrName ) ) { cmd . allowDups = StrUtils . parseBoolean ( attrVal ) ; } else if ( "overwritePending" . equals ( attrName ) ) { cmd . overwritePending = StrUtils . parseBoolean ( attrVal ) ; pendingAttr = true ; } else if ( "overwriteCommitted" . equals ( attrName ) ) { cmd . overwriteCommitted = StrUtils . parseBoolean ( attrVal ) ; committedAttr = true ; } else { SolrCore . log . warning ( ( "Unknown<seq2seq4repair_space>attribute<seq2seq4repair_space>id<seq2seq4repair_space>in<seq2seq4repair_space>add:" + attrName ) ) ; } } if ( ! pendingAttr ) cmd . overwritePending = ! ( cmd . allowDups ) ; if ( ! committedAttr ) cmd . overwriteCommitted = ! ( cmd . allowDups ) ; DocumentBuilder builder = new DocumentBuilder ( schema ) ; int eventType = 0 ; while ( true ) { <START_BUG> cmd . id = null ; <END_BUG> if ( eventType != 0 ) { eventType = xpp . getEventType ( ) ; if ( eventType == ( XmlPullParser . END_DOCUMENT ) ) break ; } eventType = xpp . nextTag ( ) ; if ( ( eventType == ( XmlPullParser . END_TAG ) ) || ( eventType == ( XmlPullParser . END_DOCUMENT ) ) ) break ; try { readDoc ( builder , xpp ) ; builder . endDoc ( ) ; cmd . doc = builder . getDoc ( ) ; SolrCore . log . finest ( "adding<seq2seq4repair_space>doc..." ) ; updateHandler . addDoc ( cmd ) ; SolrCore . log . info ( ( ( ( "add<seq2seq4repair_space>" + status ) + "<seq2seq4repair_space>" ) + ( ( System . currentTimeMillis ( ) ) - startTime ) ) ) ; writer . write ( ( ( "<result<seq2seq4repair_space>status=\"" + status ) + "\"><//result>" ) ) ; } catch ( SolrException e ) { SolrCore . log ( e ) ; SolrCore . log . info ( ( ( ( "add<seq2seq4repair_space>" + ( e . code ) ) + "<seq2seq4repair_space>" ) + ( ( System . currentTimeMillis ( ) ) - startTime ) ) ) ; SolrCore . writeResult ( writer , e ) ; eventType = xpp . getEventType ( ) ; while ( true ) { if ( ( eventType == ( XmlPullParser . END_DOCUMENT ) ) || ( ( eventType == ( XmlPullParser . END_TAG ) ) && ( "add" . equals ( xpp . getName ( ) ) ) ) ) { break ; } eventType = xpp . next ( ) ; } } } } else if ( ( "commit" . equals ( currTag ) ) || ( "optimize" . equals ( currTag ) ) ) { SolrCore . log . finest ( ( "parsing<seq2seq4repair_space>" + currTag ) ) ; try { CommitUpdateCommand cmd = new CommitUpdateCommand ( "optimize" . equals ( currTag ) ) ; boolean sawWaitSearcher = false ; boolean sawWaitFlush = false ; int attrcount = xpp . getAttributeCount ( ) ; for ( int i = 0 ; i < attrcount ; i ++ ) { String attrName = xpp . getAttributeName ( i ) ; String attrVal = xpp . getAttributeValue ( i ) ;

Fix:
cmd . indexedId = null ;