auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void run() { depositStatus = getDepositStatus(); processDepositStructure(); try { listener.registerListener(this); String groups = depositStatus.get(DepositField.permissionGroups.name()); AccessGroupSet ags = new AccessGroupSet(); ags.addAccessGroups(groups.split(",")); GroupsThreadStore.storeGroups(ags); GroupsThreadStore.storeUsername(depositStatus.get(DepositField.depositorName.name())); String ingestPid = null; try { while ((ingestPid = ingestPids.poll()) != null) { addTopLevelToContainer(ingestPid); ingestsAwaitingConfirmation.add(ingestPid); ingestObject(ingestPid); } } catch (DepositException e) { failJob(e, Type.INGESTION, "Ingest of object {0} failed", ingestPid); return; } try { while (ingestsAwaitingConfirmation.size() > 0) { Thread.sleep(COMPLETE_CHECK_DELAY); } } catch (InterruptedException e) { log.info("Interrupted ingest of job {}", this.getJobUUID()); return; } updateDestinationEvents(); } finally { GroupsThreadStore.clearGroups(); GroupsThreadStore.clearUsername(); listener.unregisterListener(this); } }

Target:
public void run() { depositStatus = getDepositStatus(); processDepositStructure(); try { listener.registerListener(this); String groups = depositStatus.get(DepositField.permissionGroups.name()); AccessGroupSet ags = new AccessGroupSet(groups); GroupsThreadStore.storeGroups(ags); GroupsThreadStore.storeUsername(depositStatus.get(DepositField.depositorName.name())); String ingestPid = null; try { while ((ingestPid = ingestPids.poll()) != null) { addTopLevelToContainer(ingestPid); ingestsAwaitingConfirmation.add(ingestPid); ingestObject(ingestPid); } } catch (DepositException e) { failJob(e, Type.INGESTION, "Ingest of object {0} failed", ingestPid); return; } try { while (ingestsAwaitingConfirmation.size() > 0) { Thread.sleep(COMPLETE_CHECK_DELAY); } } catch (InterruptedException e) { log.info("Interrupted ingest of job {}", this.getJobUUID()); return; } updateDestinationEvents(); } finally { GroupsThreadStore.clearGroups(); GroupsThreadStore.clearUsername(); listener.unregisterListener(this); } }
Source:
@JsonIgnore public ContractMetadata getContract(String contractName) { if (contractName == null && contracts.size() == 1) { return contracts.values().iterator().next(); } else if (contractName == null || contractName.isEmpty()) { throw new UnsupportedOperationException("Source contains more than 1 contact. Please specify the contract name. Available keys (" + getContractKeys() + ")."); } for (Map.Entry<String, ContractMetadata> entry : contracts.entrySet()) { String key = entry.getKey(); String name = key.substring(key.lastIndexOf(':') + 1); if (contractName.equals(name)) { return entry.getValue(); } } throw new UnsupportedOperationException("Source contains more than 1 contact. Please specify a valid contract name. Available keys (" + getContractKeys() + ")."); }

Target:
@JsonIgnore public ContractMetadata getContract(String contractName) { if (contractName == null && contracts.size() == 1) { return contracts.values().iterator().next(); } else if (contractName == null || contractName.isEmpty()) { throw new UnsupportedOperationException("Source contains more than 1 contact. Please specify the contract name. Available keys (" + getContractKeys() + ")."); } for (Map.Entry<String, ContractMetadata> entry : contracts.entrySet()) { String key = entry.getKey(); String name = key.substring(key.lastIndexOf(':') + 1); if (contractName.equals(name)) { return entry.getValue(); } } throw new UnsupportedOperationException("No contract found with name '" + contractName + "'. Please specify a valid contract name. Available keys (" + getContractKeys() + ")."); }
Source:
private ICPPClassType getFirstCandidateForNamingClass(IASTName name) throws DOMException { LookupData data = new LookupData(name); isUnqualifiedLookup= !data.qualified; ICPPScope scope = CPPSemantics.getLookupScope(name); while (scope != null && !(scope instanceof ICPPClassScope)) { if (scope instanceof ICPPInternalUnknownScope) { IType scopeType = ((ICPPInternalUnknownScope) scope).getScopeType(); if (scopeType instanceof ICPPDeferredClassInstance) { scope = (ICPPScope) ((ICPPDeferredClassInstance) scopeType).getClassTemplate() .getCompositeScope(); } } else { scope = CPPSemantics.getParentScope(scope, data.getTranslationUnit()); } } if (scope instanceof ICPPClassScope) { return ((ICPPClassScope) scope).getClassType(); } return null; }

Target:
private ICPPClassType getFirstCandidateForNamingClass(IASTName name) throws DOMException { LookupData data = new LookupData(name); isUnqualifiedLookup= !data.qualified; ICPPScope scope = CPPSemantics.getLookupScope(name); while (scope != null && !(scope instanceof ICPPClassScope)) { if (scope instanceof ICPPInternalUnknownScope) { IType scopeType = ((ICPPInternalUnknownScope) scope).getScopeType(); if (scopeType instanceof ICPPDeferredClassInstance) { return ((ICPPDeferredClassInstance) scopeType).getClassTemplate(); } } else { scope = CPPSemantics.getParentScope(scope, data.getTranslationUnit()); } } if (scope instanceof ICPPClassScope) { return ((ICPPClassScope) scope).getClassType(); } return null; }
Source:
public String getActionClass( ) { return environmentVariables.get( actionClass ); }

Target:
public String getActionClass( ) { return actionClass; }
Source:
public SameIntervalMergeTaskTest() { EmittingLogger.registerEmitter(new NoopServiceEmitter()); indexSpec = new IndexSpec(); TestUtils testUtils = new TestUtils(); jsonMapper = testUtils.getTestObjectMapper(); }

Target:
public SameIntervalMergeTaskTest() { indexSpec = new IndexSpec(); TestUtils testUtils = new TestUtils(); jsonMapper = testUtils.getTestObjectMapper(); indexIO = testUtils.getTestIndexIO(); }
Source:
public void shouldSolveProblem20() { assertThat(sumOfDigits100Factorial()).isEqualTo(648); }

Target:
public void shouldSolveProblem20() { assertThat(sumOfFactorialDigits(10)).isEqualTo(3 + 6 + 2 + 8 + 8 + 0 + 0); assertThat(sumOfFactorialDigits(100)).isEqualTo(9 + 3 + 3 + 2 + 6 + 2 + 1 + 5 + 4 + 4 + 3 + 9 + 4 + 4 + 1 + 5 + 2 + 6 + 8 + 1 + 6 + 9 + 9 + 2 + 3 + 8 + 8 + 5 + 6 + 2 + 6 + 6 + 7 + 0 + 0 + 4 + 9 + 0 + 7 + 1 + 5 + 9 + 6 + 8 + 2 + 6 + 4 + 3 + 8 + 1 + 6 + 2 + 1 + 4 + 6 + 8 + 5 + 9 + 2 + 9 + 6 + 3 + 8 + 9 + 5 + 2 + 1 + 7 + 5 + 9 + 9 + 9 + 9 + 3 + 2 + 2 + 9 + 9 + 1 + 5 + 6 + 0 + 8 + 9 + 4 + 1 + 4 + 6 + 3 + 9 + 7 + 6 + 1 + 5 + 6 + 5 + 1 + 8 + 2 + 8 + 6 + 2 + 5 + 3 + 6 + 9 + 7 + 9 + 2 + 0 + 8 + 2 + 7 + 2 + 2 + 3 + 7 + 5 + 8 + 2 + 5 + 1 + 1 + 8 + 5 + 2 + 1 + 0 + 9 + 1 + 6 + 8 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); }
Source:
public void onLocationRequestFailure(@NotNull CommCareLocationListener.Failure failure) { Context context = CommCareApplication.instance(); if (failure instanceof CommCareLocationListener.Failure.ApiException) { Exception exception = ((CommCareLocationListener.Failure.ApiException) failure).getException(); if (exception instanceof ResolvableApiException) { apiException = (ResolvableApiException) exception; sendBroadcast(context); } else { } } else { noProviders = true; context.registerReceiver( new ProvidersChangedHandler(), new IntentFilter(LocationManager.PROVIDERS_CHANGED_ACTION) ); sendBroadcast(context); } }

Target:
public void onLocationRequestFailure(@NotNull CommCareLocationListener.Failure failure) { Context context = CommCareApplication.instance(); if (failure instanceof CommCareLocationListener.Failure.ApiException) { Exception exception = ((CommCareLocationListener.Failure.ApiException) failure).getException(); if (exception instanceof ResolvableApiException) { apiException = (ResolvableApiException) exception; broadcastLocationError(context); } else { } } else { noProviders = true; broadcastLocationError(context); } }
Source:
private void registerOpenWorkspaceVersion(MenuManager menu, final ISelectionProvider selectionProvider) { FileRevisionTypedElement leftRevision = getLeftRevision(); if (leftRevision != null) { IFileRevision fileRevision = leftRevision.getFileRevision(); if (fileRevision instanceof CommitFileRevision) { CommitFileRevision revision = (CommitFileRevision) fileRevision; final File workspaceFile = new File(revision.getRepository() .getWorkTree(), revision.getGitPath()); if (workspaceFile.exists()) menu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { Action action = new OpenWorkspaceVersionAction( UIText.CommitFileDiffViewer_OpenWorkingTreeVersionInEditorMenuLabel, selectionProvider, workspaceFile); manager.insertAfter("save", new Separator()); manager.insertAfter("save", action); } }); } } }

Target:
private void registerOpenWorkspaceVersion(MenuManager menu, final ISelectionProvider selectionProvider) { FileRevisionTypedElement leftRevision = getLeftRevision(); if (leftRevision != null) { IFileRevision fileRevision = leftRevision.getFileRevision(); if (fileRevision instanceof OpenWorkspaceVersionEnabled) { OpenWorkspaceVersionEnabled workspaceVersion = (OpenWorkspaceVersionEnabled) fileRevision; final File workspaceFile = new File(workspaceVersion .getRepository().getWorkTree(), workspaceVersion.getGitPath()); if (workspaceFile.exists()) menu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { Action action = new OpenWorkspaceVersionAction( UIText.CommitFileDiffViewer_OpenWorkingTreeVersionInEditorMenuLabel, selectionProvider, workspaceFile); manager.insertAfter("file", action); } }); } } }
Source:
protected boolean clientNeedAuthentication(final HttpServletRequest request, final HttpServletResponse response) { val clientId = OAuth20Utils.getClientIdAndClientSecret(new JEEContext(request, response)).getLeft(); val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(servicesManager, clientId); if (clientId.isEmpty() || registeredService == null) { return true; } return !StringUtils.isBlank(registeredService.getClientSecret()); }

Target:
protected boolean clientNeedAuthentication(final HttpServletRequest request, final HttpServletResponse response) { val clientId = OAuth20Utils.getClientIdAndClientSecret(new JEEContext(request, response, sessionStore)).getLeft(); if (clientId.isEmpty()) { return true; } val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(servicesManager, clientId); if (registeredService == null) { return true; } return OAuth20Utils.doesServiceNeedAuthentication(registeredService); }
Source:
protected void logInCaseOfTemplateCopyFailure(Answer copyCommandAnswer, TemplateObjectTO sourceTemplate, DataStore destDataStore) { if (copyCommandAnswer != null && !copyCommandAnswer.getResult()) { String failureDetails = StringUtils.EMPTY; if (copyCommandAnswer.getDetails() != null) { failureDetails = "; details: " + copyCommandAnswer.getDetails(); } LOGGER.debug(String.format("Failed to copy template [id=%s, name=%s] to the primary storage pool [id=%s]%s", sourceTemplate.getId(), sourceTemplate.getName(), destDataStore.getId(), failureDetails)); } }

Target:
protected void logInCaseOfTemplateCopyFailure(Answer copyCommandAnswer, TemplateObjectTO sourceTemplate, DataStore destDataStore) { if (copyCommandAnswer != null && !copyCommandAnswer.getResult()) { String failureDetails = StringUtils.EMPTY; if (copyCommandAnswer.getDetails() != null) { failureDetails = " Details: " + copyCommandAnswer.getDetails(); } LOGGER.error(generateFailToCopyTemplateMessage(sourceTemplate, destDataStore) + failureDetails); } }
Source:
void removeTemporaryWs() throws ServerException { ; for (WorkspaceImpl workspace : Pages.iterate( (maxItems, skipCount) -> workspaceDao.getWorkspaces(true, maxItems, skipCount))) { try { workspaceDao.remove(workspace.getId()); } catch (ServerException e) { LOG.error( "Unable to cleanup temporary workspace {}. Reason is {}", workspace.getId(), e.getLocalizedMessage()); } } }

Target:
void removeTemporaryWs() throws ServerException { for (WorkspaceImpl workspace : Pages.iterate( (maxItems, skipCount) -> workspaceDao.getWorkspaces(true, maxItems, skipCount))) { try { workspaceDao.remove(workspace.getId()); } catch (ServerException e) { LOG.error( "Unable to cleanup temporary workspace {}. Reason is {}", workspace.getId(), e.getLocalizedMessage()); } } }
Source:
public ContentEquivalenceUpdateTask(ContentLister contentLister, ContentResolver contentResolver, ScheduleTaskProgressStore progressStore, EquivalenceUpdater<Content> updater, Set<String> ignored) { super(contentLister); this.progressStore = progressStore; this.updater = RootEquivalenceUpdater.create(contentResolver, updater); this.ignored = ignored; this.telescopeProxy = OwlTelescopeReporter.create( OwlTelescopeReporters.EQUIVALENCE, Event.Type.EQUIVALENCE ); }

Target:
public ContentEquivalenceUpdateTask(ContentLister contentLister, ContentResolver contentResolver, ScheduleTaskProgressStore progressStore, EquivalenceUpdater<Content> updater, Set<String> ignored) { super(contentLister); this.progressStore = progressStore; this.updater = RootEquivalenceUpdater.create(contentResolver, updater); this.ignored = ignored; this.telescope = OwlTelescopeReporter.create( OwlTelescopeReporters.EQUIVALENCE, Event.Type.EQUIVALENCE ); }
Source:
public int hashCode() { int hashCode = 31; if (key != null) { hashCode += key.hashCode(); } if (value != null) { hashCode += value.hashCode(); } return hashCode; }

Target:
public int hashCode() { return (key == null ? 0 : key.hashCode()) ^ (value == null ? 0 : value.hashCode()); }
Source:
public int getInt(int length, boolean signed) { if (length == 0) { return 0; } if (!canRead(length)) { throw new BufferOverflowException(); } if (length > BIT_INT) { throw new IllegalArgumentException("Maximum size of value is 32 requested size" + length); } if (length < 0) { throw new IllegalArgumentException("Cannot handle negative reads"); } int val = 0; if (!canRead(length)) { throw new BufferOverflowException(); } boolean gotIt = false; if (this.pos % BitBuffer.BIT_CHAR == 0) { switch (length) { case BitBuffer.BIT_CHAR: val = this.buf.get((int) (this.pos / 8)); if (!signed) { val = val & 0xff; } gotIt = true; break; case BitBuffer.BIT_SHORT: val = this.buf.getShort((int) (this.pos / 8)); if (!signed) { val = val & 0xffff; } gotIt = true; break; case BitBuffer.BIT_INT: val = this.buf.getInt((int) (this.pos / 8)); gotIt = true; break; default: break; } } if (!gotIt) { if (this.byteOrder == ByteOrder.LITTLE_ENDIAN) { val = getIntLE(this.pos, length, signed); } else { val = getIntBE(this.pos, length, signed); } } this.pos += length; return val; }

Target:
public int getInt(int length, boolean signed) { if (length == 0) { return 0; } if (!canRead(length)) { throw new BufferOverflowException(); } if (!canRead(length)) { throw new BufferOverflowException(); } int val = 0; boolean gotIt = false; if (this.pos % BitBuffer.BIT_CHAR == 0) { switch (length) { case BitBuffer.BIT_CHAR: val = this.buf.get((int) (this.pos / 8)); if (!signed) { val = val & 0xff; } gotIt = true; break; case BitBuffer.BIT_SHORT: val = this.buf.getShort((int) (this.pos / 8)); if (!signed) { val = val & 0xffff; } gotIt = true; break; case BitBuffer.BIT_INT: val = this.buf.getInt((int) (this.pos / 8)); gotIt = true; break; default: break; } } if (!gotIt) { if (this.byteOrder == ByteOrder.LITTLE_ENDIAN) { val = getIntLE(this.pos, length, signed); } else { val = getIntBE(this.pos, length, signed); } } this.pos += length; return val; }
Source:
public CacheConfigHolder cacheConfigMap() { CacheConfigHolder cm = new CacheConfigHolder(); cm.addDistCache(CACHE_SAMPLING, 15, 15 , DIST , 0 , 0); cm.addDistCache(CACHE_MONITORING, 15, 15, DIST , 0 , 0); cm.addDistCache(CACHE_USERS, 30, 100 , DIST_AND_LOCAL , 30 , 100); cm.addDistCache(CACHE_USER_ENTITY, 30, 100 , DIST_AND_LOCAL , 30 , 100); cm.addDistCache(CACHE_FILE_ENTRIES, 1 * HOUR + 40 * MIN, 100 , DIST_AND_LOCAL, 1 * HOUR + 40 * MIN, 100); cm.addLocalCache(CACHE_RIGHT_PANEL_ENTRIES, 1 * DAY, 2); cm.addLocalCache(CACHE_LEFT_PANEL_ENTRIES, 1 * DAY, 2); cm.addLocalCache(CACHE_CURRENT_PERFTEST_STATISTICS, 5, 1); cm.addLocalCache(CACHE_LOCAL_AGENTS, 1 * HOUR, 1); return cm; }

Target:
public CacheConfigHolder cacheConfigMap() { CacheConfigHolder cm = new CacheConfigHolder(); cm.addDistMap(DIST_MAP_NAME_SAMPLING, 15, 20); cm.addDistMap(DIST_MAP_NAME_MONITORING, 15, 20); cm.addDistCache(CACHE_USERS, 30, 100, 30, 100); cm.addDistCache(CACHE_FILE_ENTRIES, 1 * HOUR + 40 * MIN, 100, 1 * HOUR + 40 * MIN, 100); cm.addLocalCache(CACHE_RIGHT_PANEL_ENTRIES, 1 * DAY, 2); cm.addLocalCache(CACHE_LEFT_PANEL_ENTRIES, 1 * DAY, 2); cm.addLocalCache(CACHE_CURRENT_PERFTEST_STATISTICS, 5, 1); cm.addLocalCache(CACHE_LOCAL_AGENTS, 1 * HOUR, 1); return cm; }
Source:
public void finishPendingCleanup() { final long start = System.currentTimeMillis(); try { try { barrier.lock(); while (!projectsUnderDeletion.isEmpty()) { emptyQCond.await(1, TimeUnit.SECONDS); } } finally { barrier.unlock(); } log.info("Took ms to complete ongoing cache cleanup.", (System.currentTimeMillis() - start)); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
void finishPendingCleanup() { final long start = System.currentTimeMillis(); try { this.barrier.lock(); while (!projectsUnderDeletion.isEmpty()) { log.info("{} entries left in the cache directory deletion Q. Waiting for the cleanup to finish", this.projectsUnderDeletion.size()); this.emptyQCond.await(10, TimeUnit.SECONDS); } log.info("Took ms to complete ongoing cache cleanup.", (System.currentTimeMillis() - start)); } catch (InterruptedException e) { e.printStackTrace(); } finally { this.barrier.unlock(); } }
Source:
public boolean execute(CommandSender sender, String label, String[] args) { final World world = CommandUtils.getWorld(sender); if (world == null) { sender.sendMessage(ChatColor.RED + "Can not get the world"); return false; } else { sender.sendMessage("Seed: " + world.getSeed()); } return true; }

Target:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; final World world = CommandUtils.getWorld(sender); if (world == null) { return false; } else { sender.sendMessage("Seed: " + world.getSeed()); } return true; }
Source:
private static String readAppUrl() { ApiProxy.Environment serverEnvironment = ApiProxy.getCurrentEnvironment(); if (serverEnvironment == null) { return null; } String hostname = (String) serverEnvironment.getAttributes() .get("com.google.appengine.runtime.default_version_hostname"); if (hostname == null) { return null; } if (isDevServer()) { return "http://" + hostname; } return "https://" + hostname; }

Target:
private static String readAppUrl() { ApiProxy.Environment serverEnvironment = ApiProxy.getCurrentEnvironment(); if (serverEnvironment == null) { return null; } String hostname = (String) serverEnvironment.getAttributes() .get("com.google.appengine.runtime.default_version_hostname"); if (hostname == null) { return null; } return (isDevServer() ? "http://" : "https://") + hostname; }
Source:
protected SmbSession createSession() throws IOException { Properties props = new Properties(); props.setProperty("jcifs.smb.client.minVersion", this.getSmbMinVer().name()); props.setProperty("jcifs.smb.client.maxVersion", this.getSmbMaxVer().name()); SmbShare smbShare = new SmbShare(this, props); smbShare.setReplaceFile(isReplaceFile()); smbShare.setUseTempFile(isUseTempFile()); if (logger.isInfoEnabled()) { logger.info(String.format("SMB share init: %s/%s", getHostPort(), getShareAndDir())); } smbShare.init(); logger.debug("SMB share initialized."); return new SmbSession(smbShare); }

Target:
protected SmbSession createSession() throws IOException { Properties props = new Properties(); props.setProperty("jcifs.smb.client.minVersion", this.getSmbMinVersion().name()); props.setProperty("jcifs.smb.client.maxVersion", this.getSmbMaxVersion().name()); SmbShare smbShare = new SmbShare(this, props); smbShare.setReplaceFile(isReplaceFile()); smbShare.setUseTempFile(isUseTempFile()); if (logger.isInfoEnabled()) { logger.info(String.format("SMB share init: %s/%s", getHostPort(), getShareAndDir())); } smbShare.init(); logger.debug("SMB share initialized."); return new SmbSession(smbShare); }
Source:
public ExtendedSymbolKindType(int _v) { try { SymbolKind s = SymbolKind.forValue(_v); value = _v; isProtocolSymbol = true; } catch (IllegalArgumentException e) { try { CquerySymbolKind c = CquerySymbolKind.forValue(_v); value = _v; isProtocolSymbol = false; } catch (IllegalArgumentException y) { throw new IllegalArgumentException("Illegal value for SymbolKind"); } } }

Target:
public ExtendedSymbolKindType(int _v) { try { SymbolKind.forValue(_v); value = _v; isProtocolSymbol = true; } catch (IllegalArgumentException e) { try { CquerySymbolKind.forValue(_v); value = _v; isProtocolSymbol = false; } catch (IllegalArgumentException y) { throw new IllegalArgumentException("Illegal value for SymbolKind"); } } }
Source:
private String getUniqueNameFor(String seriesName) { Integer quark = fQuarkToString.inverse().get(seriesName); int index = 0; String newName = seriesName; while (quark != null) { newName = seriesName + '(' + index + ')'; quark = fQuarkToString.inverse().get(newName); } return newName; }

Target:
private String getUniqueNameFor(String seriesName) { Integer quark = fQuarkToString.inverse().get(seriesName); int index = 1; String newName = seriesName; while (quark != null) { newName = seriesName + '(' + index + ')'; quark = fQuarkToString.inverse().get(newName); index++; } return newName; }
Source:
public static int levenDistance(String a, String b) { a = a.toLowerCase(); b = b.toLowerCase(); int[] costs = new int [b.length() + 1]; for (int j = 0; j < costs.length; j++) costs[j] = j; for (int i = 1; i <= a.length(); i++) { costs[0] = i; int nw = i - 1; for (int j = 1; j <= b.length(); j++) { int cj = Math.min(1 + Math.min(costs[j], costs[j - 1]), a.charAt(i - 1) == b.charAt(j - 1) ? nw : nw + 1); nw = costs[j]; costs[j] = cj; } } return costs[b.length()]; }

Target:
public static int levenDistance(String a, String b) { a = a.toLowerCase(Locale.ENGLISH); b = b.toLowerCase(Locale.ENGLISH); int[] costs = new int[b.length() + 1]; for (int j = 0; j < costs.length; j++) costs[j] = j; for (int i = 1; i <= a.length(); i++) { costs[0] = i; int nw = i - 1; for (int j = 1; j <= b.length(); j++) { int cj = Math.min(1 + Math.min(costs[j], costs[j - 1]), a.charAt(i - 1) == b.charAt(j - 1) ? nw : nw + 1); nw = costs[j]; costs[j] = cj; } } return costs[b.length()]; }
Source:
public String conceptSearchHandler(@PathVariable("collection_id") String collection_id, HttpServletRequest req, ModelMap model) throws QuadrigaStorageException, QuadrigaAccessException { try { ConceptpowerReply conReply = conceptControllerManager.search(req.getParameter("name"), req.getParameter("pos")); if (conReply != null) { List<ConceptEntry> lists = conReply.getConceptEntry(); lists.sort(new Comparator<ConceptEntry>() { @Override public int compare(ConceptEntry o1, ConceptEntry o2) { return o1.getLemma().toLowerCase().compareTo(o2.getLemma().toLowerCase()); } }); model.addAttribute("result", conReply.getConceptEntry()); } } catch (HttpMessageNotReadableException hex) { logger.error("error:", hex); return "auth/storageissue"; } model.addAttribute("collectionid", collection_id); return "auth/searchitems"; }

Target:
public String conceptSearchHandler(@PathVariable("collection_id") String collection_id, HttpServletRequest req, ModelMap model) throws QuadrigaStorageException, QuadrigaAccessException, QuadrigaException { try { ConceptpowerReply conReply = conceptControllerManager.search(req.getParameter("name"), req.getParameter("pos")); if (conReply != null) { List<ConceptEntry> lists = conReply.getConceptEntry(); lists.sort(new Comparator<ConceptEntry>() { @Override public int compare(ConceptEntry o1, ConceptEntry o2) { return o1.getLemma().toLowerCase().compareTo(o2.getLemma().toLowerCase()); } }); model.addAttribute("result", conReply.getConceptEntry()); } } catch (HttpMessageNotReadableException hex) { throw new QuadrigaException(hex); } model.addAttribute("collectionid", collection_id); return "auth/searchitems"; }
Source:
public <T extends BusinessObject> T findByPrimaryKey(Class<T> clazz, Map<String, ?> primaryKeys) { return (T)FavoriteAccountFixture.FAVORITE_ACCOUNT_1.createFavoriteAccount(); }

Target:
public <T extends BusinessObject> T findByPrimaryKey(Class<T> clazz, Map<String, ?> primaryKeys) { Integer accountLineIdentifier = (Integer) primaryKeys.get("accountLineIdentifier"); if (accountLineIdentifier.equals(13)) { return (T) FavoriteAccountFixture.FAVORITE_ACCOUNT_1.createFavoriteAccount(); } else { return null; } }
Source:
public String asShortTime(Instant instant) { Locale set=locale; switch(preferencesService.getPreferences().getChat().getUkTime()) { case("yes"): set= new Locale("en", "UK"); break; case ("no"): set= new Locale("de", "DE"); break; } return DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(set).format( ZonedDateTime.ofInstant(instant, TimeZone.getDefault().toZoneId()) ); }

Target:
public String asShortTime(Instant instant) { return DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(getCurrentTimeLocale()).format( ZonedDateTime.ofInstant(instant, TimeZone.getDefault().toZoneId()) ); }
Source:
public void should_not_remove_tag_iframe_from_sound_cloud() { String html = "<ol><li><iframe width=\"100%\" height=\"166\" scrolling=\"no\" frameborder=\"no\" src=\"<LINK_1>\"></iframe></li><li>ctrl</li></ol>"; String htmlSanitized = "<ol><li><iframe width=\"100%\" height=\"166\" scrolling=\"no\" frameborder=\"no\" src=\"<LINK_0>;https%3A String sanitized = htmlSanitizer.sanitize(html); assertEquals(htmlSanitized, sanitized); }

Target:
public void should_not_remove_tag_iframe_from_sound_cloud() { String html = "<ol><li><iframe width=\"100%\" height=\"166\" scrolling=\"no\" frameborder=\"no\" src=\"<LINK_1>\"></iframe></li><li>ctrl</li></ol>"; String htmlSanitized = "<ol><li><iframe width=\"100%\" height=\"166\" scrolling=\"no\" frameborder=\"no\" src=\"<LINK_0>;https%3A String sanitized = htmlSanitizer.sanitize(html).getText(); assertEquals(htmlSanitized, sanitized); }
Source:
public void testNoRetry() { Random random = mock(Random.class); ExponentialBackoff backoff = new ExponentialBackoff(0, ONE_SECOND, random::nextDouble); assertThat(backoff.nextBackoff()).isEmpty(); }

Target:
public void testNoRetry() { AtomicDouble random = new AtomicDouble(); ExponentialBackoff backoff = new ExponentialBackoff(0, ONE_SECOND, random::get); assertThat(backoff.nextBackoff()).isEmpty(); }
Source:
public DimFilter optimize() { return new InDimFilter(dimension, Arrays.asList(value), extractionFn).optimize(); }

Target:
public DimFilter optimize() { return new InDimFilter(dimension, Collections.singletonList(value), extractionFn).optimize(); }
Source:
private void setWatchAction(UserFeed feed) { actionIcon.setImageResource(Action.WATCH.getDrawableId()); int pluralsId = feed.getGender() == Gender.FEMALE ? R.plurals.f_watch_series : R.plurals.m_watch_series; int seriesNumber = feed.getEpisodes(); String showName = feed.getShow(); String episodeName = "[" + feed.getEpisode() + "]"; String actionText = itemView.getContext().getResources().getQuantityString(pluralsId, seriesNumber, seriesNumber, showName, episodeName); setShowActionText(actionText, feed); }

Target:
private void setWatchAction(UserFeed feed) { actionIcon.setImageResource(Action.WATCH.getDrawableId()); int pluralsId = feed.getGender() == Gender.FEMALE ? R.plurals.f_watch_series : R.plurals.m_watch_series; int seriesNumber = feed.getEpisodes(); String showName = feed.getShow(); String episodeName = "[" + feed.getEpisode() + "]"; String actionText = itemView.getResources().getQuantityString(pluralsId, seriesNumber, seriesNumber, showName, episodeName); setShowActionText(actionText, feed); }
Source:
protected void createTableViewer() { ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); tableViewer = viewerFactory.createTableViewer(scrolledComposite, SWT.BORDER | SWT.FULL_SELECTION, getEClass()); Table table = tableViewer.getTable(); scrolledComposite.setContent(table); scrolledComposite.setMinSize(table .computeSize(SWT.DEFAULT, SWT.DEFAULT)); }

Target:
protected void createTableViewer() { ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); tableViewer = tableViewerFactory.createTableViewer(scrolledComposite, SWT.BORDER | SWT.FULL_SELECTION, getEClass()); Table table = tableViewer.getTable(); scrolledComposite.setContent(table); scrolledComposite.setMinSize(table .computeSize(SWT.DEFAULT, SWT.DEFAULT)); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { M_log.debug("doFilter: Called"); HttpServletRequest useRequest = (HttpServletRequest) request; HttpServletResponse useResponse=(HttpServletResponse)response; if ( BASIC_LTI_LAUNCH_REQUEST.equals(request.getParameter(LTI_MESSAGE_TYPE))) { M_log.debug("new launch so invalidate any existing session"); if (useRequest.getSession() != null) { M_log.info("session id to invalidate: " + useRequest.getSession().getId()); useRequest.getSession().invalidate(); } } HttpSession session= useRequest.getSession(true); M_log.debug("session id: " + session.getId()); setLaunchType(request, session); M_log.debug("Launch Type: " + session.getAttribute(LAUNCH_TYPE)); M_log.debug("Path Info: " + useRequest.getPathInfo() ); if (session.getAttribute(LAUNCH_TYPE).equals("lti")){ if( useRequest.getPathInfo() != null && useRequest.getPathInfo().equals(SC_PAGE)){ useRequest.getSession().invalidate(); useResponse.sendError(403); return; } chain.doFilter(useRequest, response); } else if(session.getAttribute(LAUNCH_TYPE).equals("sc")){ if(!useRequest.getPathInfo().equals(STATUS_PAGE) && !useRequest.getPathInfo().equals(PING_PAGE)){ if(!checkForAuthorization(useRequest)) { useResponse.sendError(403); return; } } chain.doFilter(useRequest, response); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { M_log.debug("doFilter: Called"); HttpServletRequest useRequest = (HttpServletRequest) request; HttpServletResponse useResponse=(HttpServletResponse)response; if ( BASIC_LTI_LAUNCH_REQUEST.equals(request.getParameter(LTI_MESSAGE_TYPE))) { M_log.debug("new launch so invalidate any existing session"); if (useRequest.getSession() != null) { M_log.info("session id to invalidate: " + useRequest.getSession().getId()); useRequest.getSession().invalidate(); } } HttpSession session= useRequest.getSession(true); M_log.debug("session id: " + session.getId()); setLaunchType(request, session); M_log.debug("Launch Type: " + session.getAttribute(LAUNCH_TYPE)); M_log.debug("Path Info: " + useRequest.getPathInfo() ); if (session.getAttribute(LAUNCH_TYPE).equals("lti")){ if( useRequest.getPathInfo() != null && useRequest.getPathInfo().equals(SC_PAGE)){ useRequest.getSession().invalidate(); useResponse.sendError(403); return; } chain.doFilter(useRequest, response); } else if(session.getAttribute(LAUNCH_TYPE).equals("sc")){ if(useRequest.getPathInfo() != null && !useRequest.getPathInfo().startsWith(STATUS_PAGE) && !useRequest.getPathInfo().equals(BOOTSTRAP) && !checkForAuthorization(useRequest)){ useResponse.sendError(403); return; } chain.doFilter(useRequest, response); } }
Source:
private boolean shouldRemoveCommand(AsyncTask asyncTask) { if (asyncTask == null || Guid.isNullOrEmpty(asyncTask.getCommandId())) { return false; } CommandEntity cmdEntity = coco.getCommandEntity(asyncTask.getCommandId()); CommandEntity rootEntity = coco.getCommandEntity(asyncTask.getRootCommandId()); CommandEntity parentEntity = null; if (cmdEntity != null) { parentEntity = coco.getCommandEntity(cmdEntity.getParentCommandId()); } return (cmdEntity != null && !cmdEntity.isCallbackEnabled() && (rootEntity == null || !rootEntity.isCallbackEnabled()) && (parentEntity == null || !parentEntity.isCallbackEnabled())); }

Target:
private boolean shouldRemoveCommand(AsyncTask asyncTask) { if (asyncTask == null || Guid.isNullOrEmpty(asyncTask.getCommandId())) { return false; } CommandEntity cmdEntity = coco.getCommandEntity(asyncTask.getCommandId()); CommandEntity parentEntity = null; if (cmdEntity != null) { parentEntity = coco.getCommandEntity(cmdEntity.getParentCommandId()); } return (cmdEntity != null && !cmdEntity.isCallbackEnabled() && (parentEntity == null || !parentEntity.isCallbackEnabled())); }
Source:
public void visitField(Field field) { final CtField<Object> ctField = factory.Core().createField(); ctField.setSimpleName(field.getName()); setModifier(ctField, field.getModifiers(), field.getDeclaringClass()); try { Set<ModifierKind> modifiers = RtHelper.getModifiers(field.getModifiers()); if (modifiers.contains(ModifierKind.STATIC) && modifiers.contains(ModifierKind.PUBLIC) && (field.getType().isPrimitive() || String.class.isAssignableFrom(field.getType())) ) { CtLiteral<Object> defaultExpression = factory.createLiteral(field.get(null)); ctField.setDefaultExpression(defaultExpression); } } catch (Throwable e) { } enter(new VariableRuntimeBuilderContext(ctField)); super.visitField(field); exit(); contexts.peek().addField(ctField); }

Target:
public void visitField(Field field) { final CtField<Object> ctField = factory.Core().createField(); ctField.setSimpleName(field.getName()); setModifier(ctField, field.getModifiers(), field.getDeclaringClass()); try { Set<ModifierKind> modifiers = RtHelper.getModifiers(field.getModifiers()); if (modifiers.contains(ModifierKind.STATIC) && modifiers.contains(ModifierKind.PUBLIC) && (field.getType().isPrimitive() || String.class.isAssignableFrom(field.getType())) ) { CtLiteral<Object> defaultExpression = factory.createLiteral(field.get(null)); ctField.setDefaultExpression(defaultExpression); } } catch (IllegalAccessException | ExceptionInInitializerError | UnsatisfiedLinkError e) { } enter(new VariableRuntimeBuilderContext(ctField)); super.visitField(field); exit(); contexts.peek().addField(ctField); }
Source:
public void close() throws StorageContainerException { writeLock(); try { updateContainerData(containerData::closeContainer); } finally { writeUnlock(); } compactDB(); flushAndSyncDB(); }

Target:
public void close() throws StorageContainerException { flushAndSyncDB(); writeLock(); try { flushAndSyncDB(); updateContainerData(containerData::closeContainer); } finally { writeUnlock(); } }
Source:
protected void onCreateSessionSafe(Bundle savedInstanceState) { super.onCreateSessionSafe(savedInstanceState); for(Suite s: CommCareApplication._().getCurrentApp().getCommCarePlatform().getInstalledSuites()){ allAlerts.addAll(s.getAlerts()); } launchService(allAlerts); loadInstanceState(savedInstanceState); ACRAUtil.registerAppData(); uiController.setupUI(); sessionNavigator = new SessionNavigator(this); formAndDataSyncer = new FormAndDataSyncer(); processFromExternalLaunch(savedInstanceState); processFromShortcutLaunch(); processFromLoginLaunch(); }

Target:
protected void onCreateSessionSafe(Bundle savedInstanceState) { super.onCreateSessionSafe(savedInstanceState); loadInstanceState(savedInstanceState); ACRAUtil.registerAppData(); uiController.setupUI(); sessionNavigator = new SessionNavigator(this); formAndDataSyncer = new FormAndDataSyncer(); processFromExternalLaunch(savedInstanceState); processFromShortcutLaunch(); processFromLoginLaunch(); }
Source:
private void initDataSource() throws HumanTaskServerException { database = new Database(serverConfig); database.setTransactionManager(tnxManager); try { database.start(); } catch (Exception e) { String errMsg = "Humantask Database Initialization failed."; log.error(errMsg); throw new HumanTaskServerException(errMsg, e); } }

Target:
private void initDataSource() throws HumanTaskServerException { database = new Database(serverConfig); database.setTransactionManager(tnxManager); try { database.start(); } catch (Exception e) { String errMsg = "Humantask Database Initialization failed."; log.error(errMsg, e); throw new HumanTaskServerException(errMsg, e); } }
Source:
private void validateProperties(ProcessingEnvironment env, Map<String, ExecutableElement> properties) { Types typeUtils = env.getTypeUtils(); Elements elementUtils = env.getElementUtils(); TypeMirror collection = typeUtils.getDeclaredType( elementUtils.getTypeElement(Collection.class.getName()), typeUtils.getWildcardType(null, null) ); TypeMirror parcelable = env.getElementUtils().getTypeElement("android.os.Parcelable").asType(); TypeMirror serializable = TypeSimplifier.typeFromClass(env.getTypeUtils(), env.getElementUtils(), Serializable.class); for (ExecutableElement name : properties.values()) { TypeMirror type = name.getReturnType(); if (type.getKind() == TypeKind.DECLARED && typeUtils.isSubtype(type, collection)) { DeclaredType dType = (DeclaredType) type; List<? extends TypeMirror> types = dType.getTypeArguments(); if (!types.isEmpty()) { type = types.get(0); } } if (!TypeName.get(type).isPrimitive() && !TypeSimplifier.isClassOfType(env.getTypeUtils(), parcelable, type) && !TypeSimplifier.isClassOfType(env.getTypeUtils(), serializable, type)) { env.getMessager().printMessage(Diagnostic.Kind.ERROR, "AutoValue property " + name.getSimpleName() + " is not primitive, Parcelable, or Serializable.", name); throw new AutoValueParcelException(); } } }

Target:
private void validateProperties(ProcessingEnvironment env, Map<String, ExecutableElement> properties) { Types typeUtils = env.getTypeUtils(); Elements elementUtils = env.getElementUtils(); TypeMirror list = typeUtils.getDeclaredType( elementUtils.getTypeElement(List.class.getName()), typeUtils.getWildcardType(null, null) ); TypeMirror parcelable = env.getElementUtils().getTypeElement("android.os.Parcelable").asType(); TypeMirror serializable = TypeSimplifier.typeFromClass(env.getTypeUtils(), env.getElementUtils(), Serializable.class); for (ExecutableElement name : properties.values()) { TypeMirror type = name.getReturnType(); if (type.getKind() == TypeKind.DECLARED && typeUtils.isSubtype(type, list)) { DeclaredType dType = (DeclaredType) type; List<? extends TypeMirror> types = dType.getTypeArguments(); if (!types.isEmpty()) { type = types.get(0); } } else if (type.getKind() == TypeKind.ARRAY) { ArrayType aType = (ArrayType) type; type = aType.getComponentType(); } if (!TypeName.get(type).isPrimitive() && !TypeSimplifier.isClassOfType(env.getTypeUtils(), parcelable, type) && !TypeSimplifier.isClassOfType(env.getTypeUtils(), serializable, type)) { env.getMessager().printMessage(Diagnostic.Kind.ERROR, "AutoValue property " + name.getSimpleName() + " is not primitive, Parcelable, or Serializable.", name); throw new AutoValueParcelException(); } } }
Source:
private void refreshAssetList() { final Images images = Ode.getImageBundle(); OdeLog.log("AssetList: refreshing for project " + projectId); assetList.clear(); if (assetsFolder != null) { for (ProjectNode node : assetsFolder.getChildren()) { String nodeName = node.getName(); if (nodeName.length() > 20) nodeName = nodeName.substring(0, 8) + "..." + nodeName.substring(nodeName.length() - 9, nodeName.length()); String fileSuffix = node.getProjectId() + "/" + node.getFileId(); String treeItemText = "<span style='cursor: pointer'>"; Image mediaIcon = null; if (StorageUtil.isImageFile(fileSuffix)) { mediaIcon = new Image(images.mediaIconImg()); } else if (StorageUtil.isAudioFile(fileSuffix )) { mediaIcon = new Image(images.mediaIconAudio()); } else if (StorageUtil.isVideoFile(fileSuffix )) { mediaIcon = new Image(images.mediaIconVideo()); } if (mediaIcon != null){ treeItemText += mediaIcon; } treeItemText += nodeName + "</span>"; TreeItem treeItem = new TreeItem(new HTML(treeItemText)); treeItem.setUserObject(node); assetList.addItem(treeItem); } } }

Target:
private void refreshAssetList() { final Images images = Ode.getImageBundle(); OdeLog.log("AssetList: refreshing for project " + projectId); assetList.clear(); if (assetsFolder != null) { for (ProjectNode node : assetsFolder.getChildren()) { String nodeName = node.getName(); if (nodeName.length() > 20) nodeName = nodeName.substring(0, 8) + "..." + nodeName.substring(nodeName.length() - 9, nodeName.length()); String fileSuffix = node.getProjectId() + "/" + node.getFileId(); String treeItemText = "<span style='cursor: pointer'>"; if (StorageUtil.isImageFile(fileSuffix)) { treeItemText += new Image(images.mediaIconImg()); } else if (StorageUtil.isAudioFile(fileSuffix )) { treeItemText += new Image(images.mediaIconAudio()); } else if (StorageUtil.isVideoFile(fileSuffix )) { treeItemText += new Image(images.mediaIconVideo()); } treeItemText += nodeName + "</span>"; TreeItem treeItem = new TreeItem(new HTML(treeItemText)); treeItem.setUserObject(node); assetList.addItem(treeItem); } } }
Source:
private TimeoutDuration getTimeoutDuration(EhcacheOperationMessage message) { TimeoutDuration timeLimit = timeouts.getMutativeOperationTimeout(); if (GET_STORE_OPS.contains(message.getMessageType())) { timeLimit = timeouts.getReadOperationTimeout(); } return timeLimit; }

Target:
private TimeoutDuration getTimeoutDuration(EhcacheOperationMessage message) { if (GET_STORE_OPS.contains(message.getMessageType())) { return timeouts.getReadOperationTimeout(); } else { return timeouts.getMutativeOperationTimeout(); } }
Source:
protected boolean isDriverVersion( int majorVersion, int minorVersion ) { int driverMajorVersion; int driverMinorVersion; if ( getAccessType() == DatabaseMeta.TYPE_ACCESS_JNDI ) { PooledDatasourceHelper pooledDatasourceHelper = new PooledDatasourceHelper(); DataSource dataSource = null; try { dataSource = pooledDatasourceHelper.getJndiDataSource( this.getDatabaseName() ); } catch ( DBDatasourceServiceException e ) { e.printStackTrace(); } DatabaseMetaData meta = null; try { Connection connection = dataSource.getConnection(); meta = connection.getMetaData(); } catch ( SQLException e ) { e.printStackTrace(); } driverMajorVersion = meta.getDriverMajorVersion(); driverMinorVersion = meta.getDriverMinorVersion(); } else { String url = getURL( "localhost", "10000", "default" ); Driver driver = driverLocator.getDriver( url ); driverMajorVersion = driver.getMajorVersion(); driverMinorVersion = driver.getMinorVersion(); } return driverMajorVersion > majorVersion || ( driverMajorVersion == majorVersion && driverMinorVersion >= minorVersion ); }

Target:
protected boolean isDriverVersion( int majorVersion, int minorVersion ) { int driverMajorVersion; int driverMinorVersion; if ( getAccessType() == DatabaseMeta.TYPE_ACCESS_JNDI ) { PooledDatasourceHelper pooledDatasourceHelper = new PooledDatasourceHelper(); DataSource dataSource = null; try { dataSource = pooledDatasourceHelper.getJndiDataSource( this.getDatabaseName() ); } catch ( DBDatasourceServiceException e ) { logger.error( e.getMessage(), e ); } DatabaseMetaData meta = null; try ( Connection connection = dataSource.getConnection() ) { meta = connection.getMetaData(); } catch ( SQLException e ) { logger.error( e.getMessage(), e ); } driverMajorVersion = meta.getDriverMajorVersion(); driverMinorVersion = meta.getDriverMinorVersion(); } else { String url = getURL( "localhost", "10000", "default" ); Driver driver = driverLocator.getDriver( url ); driverMajorVersion = driver.getMajorVersion(); driverMinorVersion = driver.getMinorVersion(); } return driverMajorVersion > majorVersion || ( driverMajorVersion == majorVersion && driverMinorVersion >= minorVersion ); }
Source:
public SourceResponse query(QueryRequest request) throws UnsupportedQueryException { long startTime = System.currentTimeMillis(); SourceResponse result = source.query(request); long endTime = System.currentTimeMillis(); int elapsedTime = Math.toIntExact(endTime - startTime); result.getProperties().put("metrics.source.elapsed." + source.getId(), elapsedTime); LOGGER.trace("Source took {}ms to query.", source.getId(), elapsedTime); return result; }

Target:
public SourceResponse query(QueryRequest request) throws UnsupportedQueryException { long startTime = System.currentTimeMillis(); SourceResponse result = source.query(request); long endTime = System.currentTimeMillis(); int elapsedTime = Math.toIntExact(endTime - startTime); String sourceLatencyMetricKey = METRICS_SOURCE_ELAPSED_PREFIX_API + source.getId(); result.getProperties().put(sourceLatencyMetricKey, elapsedTime); LOGGER.trace("Query latency for source was {}ms.", source.getId(), elapsedTime); return result; }
Source:
public void onApplicationEvent(AbstractAuthenticationEvent appEvent) { String currentUserName = extractUserName(appEvent); if (currentUserName == null || isLockMechanismDisabled()) { return; } if (appEvent instanceof AuthenticationSuccessEvent) { if (accessCounter.containsKey(currentUserName)) { if (accessCounter.get(currentUserName) < maxLoginFailures) { accessCounter.remove(currentUserName); lastFailedLogin.remove(currentUserName); } } } if (appEvent instanceof AuthenticationFailureBadCredentialsEvent) { if (accessCounter.containsKey(currentUserName)) { accessCounter.put(currentUserName, accessCounter.get(currentUserName) + 1); } else { accessCounter.put(currentUserName, 1); } lastFailedLogin.put(currentUserName, new Date()); } }

Target:
public void onApplicationEvent(AbstractAuthenticationEvent appEvent) { String currentUserName = extractUserName(appEvent); if (currentUserName == null || isLockMechanismDisabled()) { return; } if (appEvent instanceof AuthenticationSuccessEvent && accessCounter.containsKey(currentUserName) && accessCounter.get(currentUserName) < maxLoginFailures) { accessCounter.remove(currentUserName); lastFailedLogin.remove(currentUserName); } if (appEvent instanceof AuthenticationFailureBadCredentialsEvent) { if (accessCounter.containsKey(currentUserName)) { accessCounter.put(currentUserName, accessCounter.get(currentUserName) + 1); } else { accessCounter.put(currentUserName, 1); } lastFailedLogin.put(currentUserName, new Date()); } }
Source:
public static double breakSize(PDFLine l2, PDFLine l1) { if(l2==null || l1==null) return 0.0; float h1 = getH(l1); float h2 = getH(l2); if(h1 < 0.0f) log.info("negative height!!!!"); return (getY(l2, true) - getY(l1, false))/Math.min(h1,h2); }

Target:
public static double breakSize(PDFLine l2, PDFLine l1) { if(l2==null || l1==null) return 0.0; float h1 = getH(l1); float h2 = getH(l2); return (getY(l2, true) - getY(l1, false)) / Math.min(h1,h2); }
Source:
public void testMatchResults(final double pLoH) { final Fingerprint fpObserved = new Fingerprint("test", null, "noop"); final Fingerprint fpExpected = new Fingerprint("test", null, "noop"); final HaplotypeProbabilities hpHet = new HaplotypeProbabilitiesFromGenotype(snp, hb, 0.0001, 1.0, 0.0001); final HaplotypeProbabilities hpHomRef = new HaplotypeProbabilitiesFromGenotype(snp, hb, 1.0, 0.00001, 0.000000001); fpExpected.add(hpHet); fpObserved.add(hpHomRef); MatchResults mr = FingerprintChecker.calculateMatchResults(fpObserved, fpExpected, 0.01, pLoH); Assert.assertTrue(mr.getLodTN() > mr.getLOD() ); Assert.assertTrue(mr.getLOD() < 0); Assert.assertTrue(mr.getLodTN() > mr.getLodNT()); }

Target:
public void testMatchResults(final double pLoH) { final Fingerprint fpObserved = new Fingerprint("test", null, "noop"); final Fingerprint fpExpected = new Fingerprint("test", null, "noop"); final HaplotypeProbabilities hpHet = new HaplotypeProbabilitiesFromGenotype(snp, hb, 0.0001, 1.0, 0.0001); final HaplotypeProbabilities hpHomRef = new HaplotypeProbabilitiesFromGenotype(snp, hb, 1.0, 0.00001, 0.000000001); fpExpected.add(hpHet); fpObserved.add(hpHomRef); final MatchResults mr = FingerprintChecker.calculateMatchResults(fpObserved, fpExpected, 0.01, pLoH); Assert.assertTrue(mr.getLodTN() > mr.getLOD()); Assert.assertTrue(mr.getLOD() < 0); Assert.assertTrue(mr.getLodTN() > mr.getLodNT()); }