auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public final Iterable<String> iterate() { return null; }

Target:
public final Iterable<String> iterate() { throw new UnsupportedOperationException(); }
Source:
private Color createColor() { Sequence sequence = getValue().getSequence(); if (sequence == null) { return Color.BLUE; } else { return SequenceColor.getColor(sequence); } }

Target:
private Color createColor() { Sequence sequence = getValue().getSequence(); if (sequence == null) { return DEFAULT_COLOR; } else { return SequenceColor.getColor(sequence); } }
Source:
protected boolean unregisterLibvirtSecrets(StorageDomain storageDomain, Guid vdsId) { Provider provider = getProviderDao().get(Guid.createGuidFromString(storageDomain.getStorage())); VDS vds = getVdsDao().get(vdsId); List<LibvirtSecret> libvirtSecrets = getLibvirtSecretDao().getAllByProviderId(provider.getId()); List<Guid> libvirtSecretsUuids = Entities.getIds(libvirtSecrets); if (!libvirtSecrets.isEmpty()) { VDSReturnValue returnValue; try { returnValue = Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.UnregisterLibvirtSecrets, new UnregisterLibvirtSecretsVDSParameters(vdsId, libvirtSecretsUuids)); } catch (RuntimeException e) { log.error("Failed to unregister libvirt secret for storage domain on vds {}. Error: {}", storageDomain.getName(), vds.getName(), e.getMessage()); log.debug("Exception", e); return false; } if (!returnValue.getSucceeded()) { addMessageToAuditLog(AuditLogType.FAILED_TO_UNREGISTER_LIBVIRT_SECRET, storageDomain.getName(), vds.getName()); log.error("Failed to unregister libvirt secret for storage domain on vds {}.", storageDomain.getName(), vds.getName()); return false; } } return true; }

Target:
protected boolean unregisterLibvirtSecrets(StorageDomain storageDomain, Guid vdsId) { Provider provider = getProviderDao().get(Guid.createGuidFromString(storageDomain.getStorage())); VDS vds = getVdsDao().get(vdsId); List<LibvirtSecret> libvirtSecrets = getLibvirtSecretDao().getAllByProviderId(provider.getId()); List<Guid> libvirtSecretsUuids = Entities.getIds(libvirtSecrets); if (!libvirtSecrets.isEmpty()) { VDSReturnValue returnValue; try { returnValue = Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.UnregisterLibvirtSecrets, new UnregisterLibvirtSecretsVDSParameters(vdsId, libvirtSecretsUuids)); } catch (RuntimeException e) { addMessageToAuditLog(AuditLogType.FAILED_TO_UNREGISTER_LIBVIRT_SECRET, storageDomain.getName(), vds.getName()); log.error("Failed to unregister libvirt secret for storage domain on vds {}. Error: {}", storageDomain.getName(), vds.getName(), e.getMessage()); log.debug("Exception", e); return false; } if (!returnValue.getSucceeded()) { addMessageToAuditLog(AuditLogType.FAILED_TO_UNREGISTER_LIBVIRT_SECRET, storageDomain.getName(), vds.getName()); log.error("Failed to unregister libvirt secret for storage domain on vds {}.", storageDomain.getName(), vds.getName()); return false; } } return true; }
Source:
private String writeGroupMergeInfo( final Metadata md, final Group group, final List<StoreKey> contributingMembers, final String path ) throws IndyWorkflowException { logger.trace( "Start write .info file based on if the cache exists for group of members in path. ", group.getKey(), contributingMembers, path ); final Transfer mergeInfoTarget = fileManager.getTransfer( group, path + GroupMergeHelper.MERGEINFO_SUFFIX ); logger.trace( ".info file not found for of members in path {}", group.getKey(), contributingMembers, path ); logger.trace( "metadata merge info not cached for group of members in path {}, will regenerate.", group.getKey(), contributingMembers, path ); String metaMergeInfo = helper.generateMergeInfoFromKeys( contributingMembers ); logger.trace( "Metadata merge info for of members in path is {}", group.getKey(), contributingMembers, path, metaMergeInfo ); helper.writeMergeInfo( metaMergeInfo, group, path ); logger.trace( ".info file regenerated for group of members in path. Full path: {}", group.getKey(), contributingMembers, path, mergeInfoTarget.getDetachedFile() ); return metaMergeInfo; }

Target:
private String writeGroupMergeInfo( final Metadata md, final Group group, final List<StoreKey> contributingMembers, final String path ) throws IndyWorkflowException { logger.trace( "Start write .info file based on if the cache exists for group of members in path. ", group.getKey(), contributingMembers, path ); final Transfer mergeInfoTarget = fileManager.getTransfer( group, path + GroupMergeHelper.MERGEINFO_SUFFIX ); logger.trace( "Regenerating metadata merge info for group of members in path {}", group.getKey(), contributingMembers, path ); String metaMergeInfo = helper.generateMergeInfoFromKeys( contributingMembers ); logger.trace( "Metadata merge info for of members in path is {}", group.getKey(), contributingMembers, path, metaMergeInfo ); helper.writeMergeInfo( metaMergeInfo, group, path ); logger.trace( ".info file regenerated for group of members in path. Full path: {}", group.getKey(), contributingMembers, path, mergeInfoTarget.getDetachedFile() ); return metaMergeInfo; }
Source:
private static String getCPUInfo() throws IOException { BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/cpuinfo")); String line; Map<String, String> output = new HashMap<>(); while ((line = bufferedReader.readLine()) != null) { String[] data = line.split(":"); if (data.length > 1) { String key = data[0].trim(); if (key.equals("model name")) { bufferedReader.close(); return data[1].trim(); } } } bufferedReader.close(); return "N/A"; }

Target:
private static HashMap getCPUInfo() throws IOException { BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/cpuinfo")); String line; HashMap output = new HashMap(); while ((line = bufferedReader.readLine()) != null) { String[] data = line.split(":"); if (data.length > 1) { String key = data[0].trim(); if (key.equals("model name")) { output.put(key, data[1].trim()); } } } bufferedReader.close(); int cores = Runtime.getRuntime().availableProcessors(); output.put("cores", cores); return output; }
Source:
public TriggerResult onEventTime(long timestamp, W window, TriggerContext ctx) throws Exception { this.nestedTrigger.onEventTime(timestamp, window, ctx); return TriggerResult.FIRE; }

Target:
public TriggerResult onEventTime(long timestamp, W window, TriggerContext ctx) throws Exception { TriggerResult triggerResult = this.nestedTrigger.onEventTime(timestamp, window, ctx); if (shouldClearOnTimeout) { this.clear(window, ctx); } return triggerResult.isPurge() ? TriggerResult.FIRE_AND_PURGE : TriggerResult.FIRE; }
Source:
private DocumentCollection getCollection(String collectionId) { if (collection == null) { List<DocumentCollection> collectionList = documentClient .queryCollections( getDatabase().getSelfLink(), "SELECT * FROM root r WHERE r.id='" + collectionId + "'", null).getQueryIterable().toList(); if (collectionList.size() > 0) { collection = collectionList.get(0); } else { try { DocumentCollection collectionDefinition = new DocumentCollection(); collectionDefinition.setId(collectionId); collection = documentClient.createCollection( getDatabase().getSelfLink(), collectionDefinition, null).getResource(); } catch (DocumentClientException e) { e.printStackTrace(); } } } return collection; }

Target:
private DocumentCollection getCollection(String collectionId) throws DocumentClientException { if (collection == null) { List<DocumentCollection> collectionList = documentClient .queryCollections(getDatabase().getSelfLink(), "SELECT * FROM root r WHERE r.id='" + collectionId + "'", null) .getQueryIterable() .toList(); if (collectionList.size() > 0) { collection = collectionList.get(0); } else { try { DocumentCollection collectionDefinition = new DocumentCollection(); collectionDefinition.setId(collectionId); collection = documentClient .createCollection(getDatabase().getSelfLink(), collectionDefinition, null) .getResource(); } catch (DocumentClientException e) { e.printStackTrace(System.err); throw e; } } } return collection; }
Source:
private ParserResult mergeImportResults(List<ImportFormatReader.UnknownFormatImport> imports) { BibDatabase resultDatabase = new BibDatabase(); ParserResult result = new ParserResult(resultDatabase); for (ImportFormatReader.UnknownFormatImport importResult : imports) { if (importResult == null) { continue; } ParserResult parserResult = importResult.parserResult; new BibDatabaseMerger().merge(resultDatabase, parserResult.getDatabase()); if (ImportFormatReader.BIBTEX_FORMAT.equals(importResult.format)) { result.getMetaData().merge( parserResult.getMetaData(), importResult.parserResult.getFile().map(File::getName).orElse("unknown"), parserResult.getDatabase().getEntries()); } } UpdateField.setAutomaticFields(resultDatabase.getEntries(), Globals.prefs.getOwnerPreferences(), Globals.prefs.getTimestampPreferences()); return result; }

Target:
private ParserResult mergeImportResults(List<ImportFormatReader.UnknownFormatImport> imports) { BibDatabase resultDatabase = new BibDatabase(); ParserResult result = new ParserResult(resultDatabase); for (ImportFormatReader.UnknownFormatImport importResult : imports) { if (importResult == null) { continue; } ParserResult parserResult = importResult.parserResult; resultDatabase.insertEntries(parserResult.getDatabase().getEntries()); if (ImportFormatReader.BIBTEX_FORMAT.equals(importResult.format)) { new DatabaseMerger().mergeMetaData( result.getMetaData(), parserResult.getMetaData(), importResult.parserResult.getFile().map(File::getName).orElse("unknown"), parserResult.getDatabase().getEntries()); } } UpdateField.setAutomaticFields(resultDatabase.getEntries(), Globals.prefs.getOwnerPreferences(), Globals.prefs.getTimestampPreferences()); return result; }
Source:
public void returnsProperResponseCodeOnNoContentLength() throws Exception { final ByteArrayOutputStream output = new ByteArrayOutputStream(); final String text = "Say hello!"; try (ServerSocket server = new ServerSocket(0)) { new Thread( new Runnable() { @Override public void run() { try { new BkBasic(new TkText("411 Test")).accept( server.accept() ); } catch (final IOException exception) { throw new IllegalStateException(exception); } } } ).start(); try (Socket socket = new Socket( server.getInetAddress(), server.getLocalPort() ) ) { socket.getOutputStream().write( new JoinedText( BkBasicTest.CRLF, BkBasicTest.POST, BkBasicTest.HOST, "", text ).asString().getBytes() ); final InputStream input = socket.getInputStream(); final byte[] buffer = new byte[4096]; for (int count = input.read(buffer); count != -1; count = input.read(buffer)) { output.write(buffer, 0, count); } } } MatcherAssert.assertThat( output.toString(), Matchers.containsString("HTTP/1.1 411 Length Required") ); }

Target:
public void returnsProperResponseCodeOnNoContentLength() throws Exception { final ByteArrayOutputStream output = new ByteArrayOutputStream(); final String text = "Say hello!"; try (ServerSocket server = new ServerSocket(0)) { new Thread( new Runnable() { @Override public void run() { try { new BkBasic(new TkText("411 Test")).accept( server.accept() ); } catch (final IOException exception) { throw new IllegalStateException(exception); } } } ).start(); try (Socket socket = new Socket( server.getInetAddress(), server.getLocalPort() ) ) { socket.getOutputStream().write( new BytesOf( new JoinedText( BkBasicTest.CRLF, BkBasicTest.POST, BkBasicTest.HOST, "", text ) ).asBytes() ); final InputStream input = socket.getInputStream(); final byte[] buffer = new byte[4096]; for (int count = input.read(buffer); count != -1; count = input.read(buffer)) { output.write(buffer, 0, count); } } } MatcherAssert.assertThat( output.toString(), Matchers.containsString("HTTP/1.1 411 Length Required") ); }
Source:
public void bulkOutputCallerTest() throws Exception { String endpointState = "{\"next\":"+1+"}"; String workUnit = "{\"max\":"+6+"}"; OutputCallerImpl caller = new OutputCallerImpl(new JacksonHandle(apiObj)); Stream<InputStream> result = caller.streamCall(IOTestUtil.db, IOTestUtil.asInputStream(endpointState), caller.newSessionState(), IOTestUtil.asInputStream(workUnit)); InputStream[] resultArray = result.toArray(size -> new InputStream[size]); assertNotNull(resultArray); assertTrue(resultArray.length == count); List<String> list = new ArrayList<>(); for(int i=0;i<resultArray.length;i++) { assertNotNull(resultArray[i]); list.add(IOTestUtil.mapper.readValue(resultArray[i], ObjectNode.class).toString()); } OutputEndpointImpl.BulkOutputCaller bulkCaller = OutputEndpoint.on(IOTestUtil.db, new JacksonHandle(apiObj)).bulkCaller(); bulkCaller.setEndpointState(new ByteArrayInputStream(endpointState.getBytes())); bulkCaller.setWorkUnit(new ByteArrayInputStream(workUnit.getBytes())); bulkCaller.forEachOutput(i-> { try { assertTrue(list.contains(IOTestUtil.mapper.readValue(i, ObjectNode.class).toString())); } catch (IOException e) { e.printStackTrace(); } }); bulkCaller.awaitCompletion(); }

Target:
public void bulkOutputCallerTest() throws Exception { String endpointState = "{\"next\":"+1+"}"; String workUnit = "{\"max\":"+6+"}"; OutputCallerImpl caller = new OutputCallerImpl(new JacksonHandle(apiObj)); Stream<InputStream> result = caller.streamCall(IOTestUtil.db, IOTestUtil.asInputStream(endpointState), caller.newSessionState(), IOTestUtil.asInputStream(workUnit)); InputStream[] resultArray = result.toArray(size -> new InputStream[size]); assertNotNull(resultArray); assertTrue(resultArray.length-1 == count); List<String> list = new ArrayList<>(); for(int i=1;i<resultArray.length;i++) { assertNotNull(resultArray[i]); list.add(IOTestUtil.mapper.readValue(resultArray[i], ObjectNode.class).toString()); } String workUnit2 = "{\"max\":"+3+"}"; OutputEndpointImpl.BulkOutputCaller bulkCaller = OutputEndpoint.on(IOTestUtil.db, new JacksonHandle(apiObj)).bulkCaller(); bulkCaller.setEndpointState(new ByteArrayInputStream(endpointState.getBytes())); bulkCaller.setWorkUnit(new ByteArrayInputStream(workUnit2.getBytes())); class Output { int counter =0; } Output output = new Output(); bulkCaller.forEachOutput(i-> { try { assertTrue(list.contains(IOTestUtil.mapper.readValue(i, ObjectNode.class).toString())); output.counter++; } catch (IOException e) { e.printStackTrace(); } }); bulkCaller.awaitCompletion(); assertTrue(output.counter == count); }
Source:
public Serializable getId() { if ( id == null ) { if ( type == null ) { throw log.incompleteEntityInfo( null, null ); } else { throw log.incompleteEntityInfo( type, id ); } } return id; }

Target:
public Serializable getId() { if ( id == null ) { throw log.incompleteEntityInfo( type, id ); } return id; }
Source:
public void flush() { if (!statement.trim().isEmpty()) { statements.add(statement.trim()); } statement = ""; }

Target:
public void flush() { if (!statement.trim().isEmpty()) { statements.add(removeLeadingTrailingNewLines(statement)); } statement = ""; }
Source:
public String getActionProviders(HttpServletRequest request, HttpServletResponse response) throws SecurityServiceException { HttpSession session = httpSessionFactory.getOrCreateSession(request); Object token = ((SecurityTokenHolder) session.getAttribute(SecurityConstants.SECURITY_TOKEN_KEY)) .getPrincipals(); SessionToken sessionToken = new SessionToken(token, session.getId(), "127.0.0.1"); Subject subject = securityManager.getSubject(sessionToken); Map<String, Object> subjectMap = new HashMap<>(); subjectMap.put("http_request", request); subjectMap.put("http_response", response); subjectMap.put(SecurityConstants.SECURITY_SUBJECT, subject); Map<String, String> actionProperties = new HashMap<>(); for (ActionProvider actionProvider : logoutActionProviders) { Action action = actionProvider.getAction(subjectMap); if (action != null) { String displayName = SubjectUtils.getName(subject, "", true); actionProperties.put("title", action.getTitle()); actionProperties.put("auth", displayName); actionProperties.put("description", action.getDescription()); StringBuilder urlBuilder = new StringBuilder(action.getUrl().toString()); String referer = request.getHeader("Referer"); if (!StringUtils.isEmpty(referer)) { String[] parts = referer.split("\\?prevurl="); if (parts.length > 1) { String previousUrl = parts[1]; urlBuilder.append("?prevurl="); urlBuilder.append(previousUrl); } } actionProperties.put("url", urlBuilder.toString()); } } return GSON.toJson(actionProperties); }

Target:
public String getActionProviders(HttpServletRequest request, HttpServletResponse response) throws SecurityServiceException { HttpSession session = httpSessionFactory.getOrCreateSession(request); Object token = ((SecurityTokenHolder) session.getAttribute(SecurityConstants.SECURITY_TOKEN_KEY)) .getPrincipals(); SessionToken sessionToken = new SessionToken(token, session.getId(), "127.0.0.1"); Subject subject = securityManager.getSubject(sessionToken); Map<String, Object> subjectMap = new HashMap<>(); subjectMap.put("http_request", request); subjectMap.put("http_response", response); subjectMap.put(SecurityConstants.SECURITY_SUBJECT, subject); Map<String, String> actionProperties = new HashMap<>(); for (ActionProvider actionProvider : logoutActionProviders) { Action action = actionProvider.getAction(subjectMap); if (action != null) { String displayName = SubjectUtils.getName(subject, "", true); actionProperties.put("title", action.getTitle()); actionProperties.put("auth", displayName); actionProperties.put("description", action.getDescription()); actionProperties.put("url", action.getUrl().toString()); } } return GSON.toJson(actionProperties); }
Source:
public static <K,V extends Item> Map<K,V> loadChildren(ItemGroup parent, File modulesDir, Function1<? extends K,? super V> key) { modulesDir.mkdirs(); File[] subdirs = modulesDir.listFiles(new FileFilter() { public boolean accept(File child) { return child.isDirectory(); } }); CopyOnWriteMap.Tree<K,V> configurations = new CopyOnWriteMap.Tree<K,V>(); for (File subdir : subdirs) { try { V item = (V) parent.getItem(subdir.getName()); if (item == null) { XmlFile xmlFile = Items.getConfigFile( subdir ); if (xmlFile.exists()) { item = (V) Items.load( parent, subdir ); }else{ Logger.getLogger( ItemGroupMixIn.class.getName() ).log( Level.WARNING, "could not find file " + xmlFile.getFile()); continue; } } else { item.onLoad(parent, subdir.getName()); } configurations.put(key.call(item), item); } catch (IOException e) { Logger.getLogger(ItemGroupMixIn.class.getName()).log(Level.WARNING, "could not load " + subdir, e); } catch (Exception e) { Logger.getLogger(ItemGroupMixIn.class.getName()).log(Level.WARNING, "could not load " + subdir, e); } } return configurations; }

Target:
public static <K,V extends Item> Map<K,V> loadChildren(ItemGroup parent, File modulesDir, Function1<? extends K,? super V> key) { modulesDir.mkdirs(); File[] subdirs = modulesDir.listFiles(new FileFilter() { public boolean accept(File child) { return child.isDirectory(); } }); CopyOnWriteMap.Tree<K,V> configurations = new CopyOnWriteMap.Tree<K,V>(); for (File subdir : subdirs) { try { V item = (V) parent.getItem(subdir.getName()); if (item == null) { XmlFile xmlFile = Items.getConfigFile( subdir ); if (xmlFile.exists()) { item = (V) Items.load( parent, subdir ); }else{ Logger.getLogger( ItemGroupMixIn.class.getName() ).log( Level.WARNING, "could not find file " + xmlFile.getFile()); continue; } } else { item.onLoad(parent, subdir.getName()); } configurations.put(key.call(item), item); } catch (Exception e) { Logger.getLogger(ItemGroupMixIn.class.getName()).log(Level.WARNING, "could not load " + subdir, e); } } return configurations; }
Source:
TagsManager(SleuthkitCase caseDb) { this.caseDb = caseDb; TaggingManager taggingMgr = caseDb.getTaggingManager(); try { List<TagSet> setList = taggingMgr.getTagSets(); if (setList.isEmpty()) { TagSet set = taggingMgr.addTagSet("Project VIC (United States)"); for (TagNameDefinition def : TagNameDefinition.getProjectVICDefaultDefinitions()) { TagName tagName = caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus()); taggingMgr.addTagNameToTagSet(set, tagName); } for (TagNameDefinition def : TagNameDefinition.getStandardTagNameDefinitions()) { caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus()); } } } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex); } for (TagNameDefinition tagName : TagNameDefinition.getTagNameDefinitions()) { tagName.saveToCase(caseDb); } }

Target:
TagsManager(SleuthkitCase caseDb) { this.caseDb = caseDb; TaggingManager taggingMgr = caseDb.getTaggingManager(); try { List<TagSet> setList = taggingMgr.getTagSets(); if (setList.isEmpty()) { List<TagName> tagNameList = new ArrayList<>(); for (TagNameDefinition def : TagNameDefinition.getProjectVICDefaultDefinitions()) { tagNameList.add(caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus())); } taggingMgr.addTagSet(DEFAULT_TAG_SET_NAME, tagNameList); for (TagNameDefinition def : TagNameDefinition.getStandardTagNameDefinitions()) { caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus()); } } } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex); } for (TagNameDefinition tagName : TagNameDefinition.getTagNameDefinitions()) { tagName.saveToCase(caseDb); } }
Source:
public int compare(Template firstTemplate, Template secondTemplate) { if (Objects.isNull(firstTemplate) || Objects.isNull(secondTemplate)) { return 1; } if (Objects.isNull(firstTemplate.getWorkflow()) ? Objects.nonNull(secondTemplate.getWorkflow()) : Objects.isNull(secondTemplate.getWorkflow()) || !firstTemplate.getWorkflow().getId().equals(secondTemplate.getWorkflow().getId())) { return 1; } if (Objects.isNull(firstTemplate.getRuleset()) ? Objects.nonNull(secondTemplate.getRuleset()) : Objects.isNull(secondTemplate.getRuleset()) || !firstTemplate.getRuleset().getId().equals(secondTemplate.getRuleset().getId())) { return 1; } if (Objects.isNull(firstTemplate.getDocket()) ? Objects.nonNull(secondTemplate.getDocket()) : Objects.isNull(secondTemplate.getDocket()) || !firstTemplate.getDocket().getId().equals(secondTemplate.getDocket().getId())) { return 1; } return 0; }

Target:
public int compare(Template firstTemplate, Template secondTemplate) { if (Objects.isNull(firstTemplate)) { return Objects.isNull(secondTemplate) ? 0 : 1; } if (Objects.isNull(secondTemplate)) { return 1; } if (Objects.isNull(firstTemplate.getWorkflow()) ? Objects.nonNull(secondTemplate.getWorkflow()) : Objects.isNull(secondTemplate.getWorkflow()) || !firstTemplate.getWorkflow().getId().equals(secondTemplate.getWorkflow().getId())) { return 1; } if (Objects.isNull(firstTemplate.getRuleset()) ? Objects.nonNull(secondTemplate.getRuleset()) : Objects.isNull(secondTemplate.getRuleset()) || !firstTemplate.getRuleset().getId().equals(secondTemplate.getRuleset().getId())) { return 1; } if (Objects.isNull(firstTemplate.getDocket()) ? Objects.nonNull(secondTemplate.getDocket()) : Objects.isNull(secondTemplate.getDocket()) || !firstTemplate.getDocket().getId().equals(secondTemplate.getDocket().getId())) { return 1; } return 0; }
Source:
protected void run() throws Failure { if (all && projectNames.size() > 0) { throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT"); } ReplicationState state = new ReplicationState(ReplicationType.COMMAND, this); Future<?> future = null; if (all) { future = pushAllFactory.create(urlMatch, state).schedule(0, TimeUnit.SECONDS); } else { for (String name : projectNames) { Project.NameKey key = new Project.NameKey(name); if (projectCache.get(key) != null) { replication.scheduleFullSync(key, urlMatch, state); } else { writeStdErrSync("error: '" + name + "': not a Gerrit project"); } } state.markAllPushTasksScheduled(); } if (wait) { if (future != null) { try { future.get(); } catch (InterruptedException e) { wrappedLog.error("Thread was interrupted while waiting for PushAll operation to finish", e, state); } catch (ExecutionException e) { wrappedLog.error("An exception was thrown in PushAll operation", e, state); } } if (state.hasPushTask()) { try { state.waitForReplication(); } catch (InterruptedException e) { wrappedLog.error("We are interrupted while waiting replication to complete", state); } } else { writeStdOutSync("Nothing to replicate"); } } }

Target:
protected void run() throws Failure { if (all && projectNames.size() > 0) { throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT"); } ReplicationState state = new ReplicationState(ReplicationType.COMMAND, this); Future<?> future = null; if (all) { future = pushAllFactory.create(urlMatch, state).schedule(0, TimeUnit.SECONDS); } else { for (String name : projectNames) { Project.NameKey key = new Project.NameKey(name); if (projectCache.get(key) != null) { replication.scheduleFullSync(key, urlMatch, state); } else { writeStdErrSync("error: '" + name + "': not a Gerrit project"); } } state.markAllPushTasksScheduled(); } if (wait) { if (future != null) { try { future.get(); } catch (InterruptedException e) { wrappedLog.error("Thread was interrupted while waiting for PushAll operation to finish", e, state); return; } catch (ExecutionException e) { wrappedLog.error("An exception was thrown in PushAll operation", e, state); return; } } if (state.hasPushTask()) { try { state.waitForReplication(); } catch (InterruptedException e) { writeStdErrSync("We are interrupted while waiting replication to complete"); } } else { writeStdOutSync("Nothing to replicate"); } } }
Source:
public synchronized IFile createBookmarksFile() throws CoreException { IFile file = getBookmarksFile(); if (fResource instanceof IFolder) { if (!file.exists()) { final IFile bookmarksFile = getProject().getTracesFolder().getResource().getFile(BOOKMARKS_HIDDEN_FILE); if (!bookmarksFile.exists()) { final InputStream source = new ByteArrayInputStream(new byte[0]); bookmarksFile.create(source, true, null); } bookmarksFile.setHidden(true); file.createLink(bookmarksFile.getLocation(), IResource.REPLACE, null); file.setHidden(true); file.setPersistentProperty(TmfCommonConstants.TRACETYPE, TmfTrace.class.getCanonicalName()); } } return file; }

Target:
public IFile createBookmarksFile() throws CoreException { IFile file = getBookmarksFile(); if (fResource instanceof IFolder) { if (!file.exists()) { final IFile bookmarksFile = getProject().getTracesFolder().getResource().getFile(BOOKMARKS_HIDDEN_FILE); if (!bookmarksFile.exists()) { final InputStream source = new ByteArrayInputStream(new byte[0]); bookmarksFile.create(source, true, null); } bookmarksFile.setHidden(true); file.createLink(bookmarksFile.getLocation(), IResource.REPLACE, null); file.setHidden(true); file.setPersistentProperty(TmfCommonConstants.TRACETYPE, TmfTrace.class.getCanonicalName()); } } return file; }
Source:
public void deleteAll() { try { String query = new String("*:*"); solrServer.deleteByQuery(query); } catch (SolrServerException e) { log.error(e.getLocalizedMessage(), e); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } }

Target:
public void deleteAll() { try { String query = "*:*"; solrServer.deleteByQuery(query); } catch (SolrServerException e) { log.error(e.getLocalizedMessage(), e); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } }
Source:
private SctId getLastSctId(final String namespace, final ComponentCategory category) { return store.get().read(new IndexRead<SctId>() { @Override public SctId execute(final Searcher index) throws IOException { final boolean intNamespace = CompareUtils.isEmpty(namespace); final Expression idsByNamespaceAndType = Expressions.builder() .must(Expressions.exactMatch("namespace", intNamespace ? 0L : Long.parseLong(namespace))) .must(Expressions.exactMatch("partitionId", (intNamespace ? "0" : "1") + Integer.toString(category.ordinal()))) .build(); final Hits<SctId> hits = index.search(Query.select(SctId.class) .where(idsByNamespaceAndType) .sortBy(SortBy.field("sequence", Order.DESC)) .offset(0) .limit(1) .build()); return Iterables.getOnlyElement(hits, null); } }); }

Target:
private SctId getLastSctId(final String namespace, final ComponentCategory category) { return store.get().read(new IndexRead<SctId>() { @Override public SctId execute(final Searcher index) throws IOException { final Expression idsByNamespaceAndType = Expressions.builder() .must(SctId.Expressions.namespace(namespace)) .must(SctId.Expressions.partitionId(namespace, category)) .build(); final Hits<SctId> hits = index.search(Query.select(SctId.class) .where(idsByNamespaceAndType) .sortBy(SortBy.field(SctId.Fields.SEQUENCE, Order.DESC)) .offset(0) .limit(1) .build()); return Iterables.getOnlyElement(hits, null); } }); }
Source:
private void startSending() { if (!isTyping) { isTyping = true; h = new Handler(); h.postDelayed(new Runnable() { @Override public void run() { flushQueue(); if (currentIdleTime > TYPING_TIMEOUT) { isTyping = false; } else { h.postDelayed(this, PACKET_SEND_DUR); } } }, PACKET_SEND_DUR); } }

Target:
private void startSending() { if (isTyping.compareAndSet(false, true)) { h = new Handler(); h.postDelayed(new Runnable() { @Override public void run() { flushQueue(); if (currentIdleTime > TYPING_TIMEOUT) { isTyping.set(false); } else { h.postDelayed(this, PACKET_SEND_DUR); } } }, PACKET_SEND_DUR); } }
Source:
public void initialise() throws InitialisationException { this.flowConstruct = getFromAnnotatedObjectOrFail(muleContext.getConfigurationComponentLocator(), this); this.flowProcessingTemplate = new SchedulerFlowProcessingTemplate(listener, new LinkedList<>(), this); this.flowProcessContext = new SchedulerProcessContext(); createScheduler(); }

Target:
public void initialise() throws InitialisationException { this.flowConstruct = getFromAnnotatedObjectOrFail(muleContext.getConfigurationComponentLocator(), this); this.flowProcessingTemplate = new SchedulerFlowProcessingTemplate(listener, emptyList(), this); this.flowProcessContext = new SchedulerProcessContext(); createScheduler(); }
Source:
public KnoxShellTable string(String csvString) throws IOException { InputStream is = new ByteArrayInputStream(csvString.getBytes(StandardCharsets.UTF_8)); try (Reader stringStreamReader = new InputStreamReader(is, StandardCharsets.UTF_8); BufferedReader csvReader = new BufferedReader(stringStreamReader);) { buildTableFromCSVReader(csvReader); } return this.table; }

Target:
public KnoxShellTable string(String csvString) throws IOException { try (InputStream is = new ByteArrayInputStream(csvString.getBytes(StandardCharsets.UTF_8)); Reader stringStreamReader = new InputStreamReader(is, StandardCharsets.UTF_8); BufferedReader csvReader = new BufferedReader(stringStreamReader);) { buildTableFromCSVReader(csvReader); } return this.table; }
Source:
public Boolean put(final WifiInfo wifiInfo) { final Map<String, AttributeValue> attributes = new HashMap<>(); attributes.put(SENSE_ATTRIBUTE_NAME, new AttributeValue().withS(wifiInfo.senseId)); attributes.put(SSID_ATTRIBUTE_NAME, new AttributeValue().withS(wifiInfo.ssid)); attributes.put(RSSI_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(wifiInfo.rssi))); attributes.put(LAST_UPDATED_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(wifiInfo.lastUpdated))); final PutItemRequest putItemRequest = new PutItemRequest() .withTableName(wifiTableName) .withItem(attributes); try { final PutItemResult putItemResult = dynamoDBClient.putItem(putItemRequest); return putItemResult != null; } catch (AmazonServiceException ase) { LOGGER.error(ase.getMessage()); } return Boolean.FALSE; }

Target:
public Boolean put(final WifiInfo wifiInfo) { final PutItemRequest putItemRequest = new PutItemRequest() .withTableName(wifiTableName) .withItem(createDynamoDBItemFromWifiInfo(wifiInfo)); try { final PutItemResult putItemResult = dynamoDBClient.putItem(putItemRequest); return putItemResult != null; } catch (AmazonServiceException ase) { LOGGER.error(ase.getMessage()); } return Boolean.FALSE; }
Source:
@Override public void run() { init(); while (!Thread.currentThread().isInterrupted() && !stopped) { long currReservedSegment = -1; try { deleteObsoleteRawSegments(); currReservedSegment = tryReserveNextSegmentOrWait(); if (currReservedSegment == -1) continue; File tmpZip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX + ".tmp"); File zip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX); File raw = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment)); if (!Files.exists(raw.toPath())) throw new IgniteCheckedException("WAL archive segment is missing: " + raw); compressSegmentToFile(currReservedSegment, raw, tmpZip); Files.move(tmpZip.toPath(), zip.toPath()); if (mode != WALMode.NONE) { try (FileIO f0 = ioFactory.create(zip, CREATE, READ, WRITE)) { f0.force(); } if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED)) { evt.record(new WalSegmentCompactedEvent( cctx.discovery().localNode(), currReservedSegment, zip.getAbsoluteFile()) ); } } lastCompressedIdx = currReservedSegment; } catch (IgniteCheckedException | IOException e) { U.error(log, "Compression of WAL segment [idx=" + currReservedSegment + "] was skipped due to unexpected error", e); lastCompressedIdx++; } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } finally { if (currReservedSegment != -1) release(new FileWALPointer(currReservedSegment, 0, 0)); } } }

Target:
@Override public void run() { init(); while (!Thread.currentThread().isInterrupted() && !stopped) { long currReservedSegment = -1; try { deleteObsoleteRawSegments(); currReservedSegment = tryReserveNextSegmentOrWait(); if (currReservedSegment == -1) continue; File tmpZip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX + FilePageStoreManager.TMP_SUFFIX); File zip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX); File raw = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment)); if (!Files.exists(raw.toPath())) throw new IgniteCheckedException("WAL archive segment is missing: " + raw); compressSegmentToFile(currReservedSegment, raw, tmpZip); Files.move(tmpZip.toPath(), zip.toPath()); if (mode != WALMode.NONE) { try (FileIO f0 = ioFactory.create(zip, CREATE, READ, WRITE)) { f0.force(); } if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED)) { evt.record(new WalSegmentCompactedEvent( cctx.discovery().localNode(), currReservedSegment, zip.getAbsoluteFile()) ); } } lastCompressedIdx = currReservedSegment; } catch (IgniteCheckedException | IOException e) { U.error(log, "Compression of WAL segment [idx=" + currReservedSegment + "] was skipped due to unexpected error", e); lastCompressedIdx++; } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } finally { if (currReservedSegment != -1) release(new FileWALPointer(currReservedSegment, 0, 0)); } } }
Source:
private void filterAccessibleProxiedArtifacts(final List<ArtifactEntry> artifactEntries) { if (CollectionUtils.isEmpty(artifactEntries)) { return; } for (final Iterator<ArtifactEntry> it = artifactEntries.iterator(); it.hasNext(); ) { final ArtifactEntry artifactEntry = it.next(); final Storage storage = configurationManager.getConfiguration().getStorage(artifactEntry.getStorageId()); final Repository repository = storage.getRepository(artifactEntry.getRepositoryId()); if (!repository.isProxyRepository()) { logger.debug("Repository is not a proxy repository.", repository.getId()); it.remove(); continue; } final RemoteRepository remoteRepository = repository.getRemoteRepository(); if (remoteRepository == null) { logger.warn("Repository is not associated with remote repository", repository.getId()); it.remove(); continue; } if (!remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository)) { logger.warn("Remote repository is down. Artifacts won't be cleaned up.", remoteRepository.getUrl()); it.remove(); continue; } } }

Target:
private void filterAccessibleProxiedArtifacts(final List<ArtifactEntry> artifactEntries) { if (CollectionUtils.isEmpty(artifactEntries)) { return; } for (final Iterator<ArtifactEntry> it = artifactEntries.iterator(); it.hasNext(); ) { final ArtifactEntry artifactEntry = it.next(); final Storage storage = configurationManager.getConfiguration().getStorage(artifactEntry.getStorageId()); final Repository repository = storage.getRepository(artifactEntry.getRepositoryId()); if (!repository.isProxyRepository()) { it.remove(); continue; } final RemoteRepository remoteRepository = repository.getRemoteRepository(); if (remoteRepository == null) { logger.warn("Repository is not associated with remote repository", repository.getId()); it.remove(); continue; } if (!remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository)) { logger.warn("Remote repository is down. Artifacts won't be cleaned up.", remoteRepository.getUrl()); it.remove(); continue; } } }
Source:
public SegmentLayer(IrisStarTable table) { if (table == null) { throw new InvalidParameterException("star table cannot be null"); } this.setInSource(table); this.suffix = '_' + table.getName(); this.setxCol(Column.SPECTRAL_COL.name()) .setyCol(Column.FLUX_COL.name()) .setErrorBarType(ErrorBarType.capped_lines) .setMarkType(ShapeType.open_circle) .setSize(4); this.showErrorBars = true; this.showMarks = true; }

Target:
public SegmentLayer(IrisStarTable table) { if (table == null) { throw new InvalidParameterException("star table cannot be null"); } this.setInSource(table); this.suffix = '_' + table.getName(); this.setErrorBarType(ErrorBarType.capped_lines) .setMarkType(ShapeType.open_circle) .setSize(4); this.showErrorBars = true; this.showMarks = true; }
Source:
public void putByteBuffer(int index, ByteBuffer src, int len) { assert (len <= src.remaining()); if(src.hasArray()) { byte[] srcArray = src.array(); putBytes(index, srcArray, src.position(), len); } else { for(int i = 0; i < len; ++i) { putByte(index + i, src.get()); } } src.position(src.position() + len); }

Target:
public void putByteBuffer(int index, ByteBuffer src, int len) { assert (len <= src.remaining()); if(src.hasArray()) { putBytes(index, src.array(), src.position(), len); src.position(src.position() + len); } else { int prevSrcLimit = src.limit(); try { src.limit(src.position() + len); reference.put(src); } finally { src.limit(prevSrcLimit); } } }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File file = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); file = checkForIndex(request, response, file, request.getPathInfo()); if (null == file) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else { ServletUtils.sendFile(request, response, file, type); } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File file = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); file = checkForIndex(request, response, file, request.getPathInfo()); if (file == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else { ServletUtils.sendFile(request, response, file, type); } }
Source:
private Set<ConstrainedElement> getFieldMetaData(Class<?> beanClass) { Set<ConstrainedElement> propertyMetaData = newHashSet(); for ( Field field : run( GetDeclaredFields.action( beanClass ) ) ) { if ( Modifier.isStatic( field.getModifiers() ) || field.isSynthetic() ) { continue; } String name = new ExecutablePropertyNodeNameProvider( propertyNodeNameProvider, beanClass ).getName( field.getName() ); JavaBeanField javaBeanField = new JavaBeanField( field, name ); if ( annotationProcessingOptions.areMemberConstraintsIgnoredFor( javaBeanField ) ) { continue; } propertyMetaData.add( findPropertyMetaData( javaBeanField ) ); } return propertyMetaData; }

Target:
private Set<ConstrainedElement> getFieldMetaData(Class<?> beanClass) { Set<ConstrainedElement> propertyMetaData = newHashSet(); for ( Field field : run( GetDeclaredFields.action( beanClass ) ) ) { if ( Modifier.isStatic( field.getModifiers() ) || field.isSynthetic() ) { continue; } JavaBeanField javaBeanField = javaBeanHelper.field( field ); if ( annotationProcessingOptions.areMemberConstraintsIgnoredFor( javaBeanField ) ) { continue; } propertyMetaData.add( findPropertyMetaData( javaBeanField ) ); } return propertyMetaData; }
Source:
private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); if (!isDomainExistAndActive()) { addAuditLog(storageDomain, diskImage); return; } try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); addAuditLog(storageDomain, diskImage); } }

Target:
private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); if (!isDomainExistAndActive()) { addAuditLog(storageDomain, diskImage); return; } try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); auditLogForNoMetadataDescriptionUpdate(storageDomain, diskImage); } }
Source:
private boolean initTranscripts(){ loadTranscriptsData(unit); try { initTranscriptListView(); updateTranscript(subtitlesObj); return true; } catch (NullPointerException e) { return false; } }

Target:
private void initTranscripts() { loadTranscriptsData(); if (subtitlesObj != null) { initTranscriptListView(); updateTranscript(subtitlesObj); } }
Source:
private static List<CaseLabelTree> allLabels(SwitchStatementTree switchStatementTree) { return switchStatementTree.cases().stream() .flatMap(caseGroup -> caseGroup.labels().stream()) .collect(Collectors.toList()); }

Target:
private static Stream<CaseLabelTree> allLabels(SwitchStatementTree switchStatementTree) { return switchStatementTree.cases().stream().flatMap(caseGroup -> caseGroup.labels().stream()); }
Source:
public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) { List<VDS> acceptableHostsList = vmToHostAffinityFilterPolicyUnit.get().getAcceptableHosts(false, hosts, vm, new PerHostMessages(), getPendingResourceManager()); Map<Guid, VDS> acceptableHostsMap = new HashMap<>(); if (acceptableHostsList != null) { acceptableHostsMap = acceptableHostsList.stream().collect(Collectors.toMap(VDS::getId, h -> h)); } List<Pair<Guid, Integer>> retList = new ArrayList<>(); int score; for (VDS host : hosts) { score = DEFAULT_SCORE; if (!acceptableHostsMap.containsKey(host.getId())) { score = MaxSchedulerWeight; } retList.add(new Pair<>(host.getId(), score)); } return retList; }

Target:
public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) { List<VDS> acceptableHostsList = vmToHostAffinityFilterPolicyUnit.get().getAcceptableHosts(false, hosts, vm, new PerHostMessages(), getPendingResourceManager()); Map<Guid, VDS> acceptableHostsMap = acceptableHostsList.stream().collect(Collectors.toMap(VDS::getId, h -> h)); List<Pair<Guid, Integer>> retList = new ArrayList<>(); int score; for (VDS host : hosts) { score = DEFAULT_SCORE; if (!acceptableHostsMap.containsKey(host.getId())) { score = MaxSchedulerWeight; } retList.add(new Pair<>(host.getId(), score)); } return retList; }
Source:
private boolean upgradeProviderDb(SQLiteDatabase db, ProviderUtils.ProviderType type) { File oldDbFile = CommCareApplication._().getDatabasePath(type.getOldDbName()); if (oldDbFile.exists()) { File newDbFile = CommCareApplication._().getDatabasePath( ProviderUtils.getProviderDbName(type, getInstalledAppRecord(c, db).getApplicationId())); if (!oldDbFile.renameTo(newDbFile)) { return false; } else { return true; } } return true; }

Target:
private boolean upgradeProviderDb(SQLiteDatabase db, ProviderUtils.ProviderType type) { File oldDbFile = CommCareApplication._().getDatabasePath(type.getOldDbName()); if (oldDbFile.exists()) { File newDbFile = CommCareApplication._().getDatabasePath( ProviderUtils.getProviderDbName(type, getInstalledAppRecord(c, db).getApplicationId())); if (!oldDbFile.renameTo(newDbFile)) { throw new MigrationException(false); } else { return true; } } return true; }
Source:
public VmNextRunConfigurationModel() { setApplyCpuLater(new EntityModel<Boolean>(false)); setVmUnpinnedLatch(new EntityModel<Boolean>(false)); getVmUnpinnedLatch().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { if (isVmUnpinned()) { UICommand okCommand = getCommands().get(0); if (okCommand != null) { okCommand.setIsExecutionAllowed(getVmUnpinnedLatch().getEntity()); } } } }); }

Target:
public VmNextRunConfigurationModel() { setApplyCpuLater(new EntityModel<Boolean>(false)); setVmUnpinnedLatch(new EntityModel<Boolean>(false)); setLatch(getVmUnpinnedLatch()); }
Source:
public void start(Properties props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); assignment = context.assignment(); hdfsWriter = new HdfsWriter(connectorConfig, assignment); recover(assignment); resetOffsets(); } catch (ConfigException e) { throw new CopycatException( "Couldn't start HdfsSinkConnector due to configuration error.", e); } }

Target:
public void start(Properties props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); int schemaCacheSize = connectorConfig.getInt(HdfsSinkConnectorConfig.SCHEMA_CACHE_SIZE_CONFIG); avroData = new AvroData(schemaCacheSize); hdfsWriter = new HdfsWriter(connectorConfig, context, avroData); Set<TopicPartition> assignment = context.assignment(); recover(assignment); } catch (ConfigException e) { throw new CopycatException( "Couldn't start HdfsSinkConnector due to configuration error.", e); } catch (CopycatException e) { hdfsWriter.close(); } }
Source:
private void karmaDec( ReceivePrivmsg event ) { Matcher decMatcher = decrementPattern.matcher( event.getText() ); if ( decMatcher.matches() ) { String wordBlob = decMatcher.group( 0 ); List<String> nicks = new LinkedList<String>(); Matcher nickMatcher = decBlobPattern.matcher( wordBlob ); while ( nickMatcher.find() ) { nicks.add( BaseNick.toBaseNick( nickMatcher.group( 1 ) ) ); } for ( String nick : nicks ) { if ( !nick.equals( bot.getNick() ) ) KarmaDB.modNounKarma( nick, -1 ); else event.reply( "I think I'm supposed to insult you now." ); } } }

Target:
private void karmaDec( ReceivePrivmsg event ) { Matcher decMatcher = decrementPattern.matcher( event.getText() ); if ( decMatcher.matches() ) { String wordBlob = decMatcher.group( 0 ); List<String> nicks = new LinkedList<String>(); Matcher nickMatcher = decBlobPattern.matcher( wordBlob ); while ( nickMatcher.find() ) { nicks.add( BaseNick.toBaseNick( nickMatcher.group( 1 ) ) ); } boolean insult = false; for ( String nick : nicks ) { if ( !nick.equals( bot.getNick() ) ) KarmaDB.modNounKarma( nick, -1 ); else insult = true; } if ( insult ) event.reply( "I think I'm supposed to insult you now." ); } }