auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Block createMap( MapType mapType, MethodHandle keyEqual, MethodHandle keyHashCode, MethodHandle keyIndeterminate, State state, ConnectorSession session, Block keyBlock, Block valueBlock) { checkCondition(keyBlock.getPositionCount() == valueBlock.getPositionCount(), INVALID_FUNCTION_ARGUMENT, "Key and value arrays must be the same length"); PageBuilder pageBuilder = state.getPageBuilder(); if (pageBuilder.isFull()) { pageBuilder.reset(); } MapBlockBuilder mapBlockBuilder = (MapBlockBuilder) pageBuilder.getBlockBuilder(0); BlockBuilder blockBuilder = mapBlockBuilder.beginBlockEntry(); for (int i = 0; i < keyBlock.getPositionCount(); i++) { if (keyBlock.isNull(i)) { mapBlockBuilder.closeEntry(); throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "map key cannot be null"); } if (isIndeterminate(keyIndeterminate, mapType.getKeyType(), keyBlock, i)) { mapBlockBuilder.closeEntry(); throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "map key cannot be indeterminate"); } mapType.getKeyType().appendTo(keyBlock, i, blockBuilder); mapType.getValueType().appendTo(valueBlock, i, blockBuilder); } try { mapBlockBuilder.closeEntryStrict(); } catch (DuplicateMapKeyException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e.getDetailedMessage(mapType.getKeyType(), session), e); } finally { pageBuilder.declarePosition(); } return mapType.getObject(mapBlockBuilder, mapBlockBuilder.getPositionCount() - 1); }

Target:
public static Block createMap( MapType mapType, MethodHandle keyEqual, MethodHandle keyHashCode, MethodHandle keyIndeterminate, State state, ConnectorSession session, Block keyBlock, Block valueBlock) { checkCondition(keyBlock.getPositionCount() == valueBlock.getPositionCount(), INVALID_FUNCTION_ARGUMENT, "Key and value arrays must be the same length"); PageBuilder pageBuilder = state.getPageBuilder(); if (pageBuilder.isFull()) { pageBuilder.reset(); } MapBlockBuilder mapBlockBuilder = (MapBlockBuilder) pageBuilder.getBlockBuilder(0); BlockBuilder blockBuilder = mapBlockBuilder.beginBlockEntry(); for (int i = 0; i < keyBlock.getPositionCount(); i++) { if (keyBlock.isNull(i)) { mapBlockBuilder.closeEntry(); throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "map key cannot be null"); } Object keyObject = readNativeValue(mapType.getKeyType(), keyBlock, i); try { if ((boolean) keyIndeterminate.invoke(keyObject, false)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "map key cannot be indeterminate: " + mapType.getKeyType().getObjectValue(session, keyBlock, i)); } } catch (Throwable t) { mapBlockBuilder.closeEntry(); throw internalError(t); } mapType.getKeyType().appendTo(keyBlock, i, blockBuilder); mapType.getValueType().appendTo(valueBlock, i, blockBuilder); } try { mapBlockBuilder.closeEntryStrict(); } catch (DuplicateMapKeyException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e.getDetailedMessage(mapType.getKeyType(), session), e); } finally { pageBuilder.declarePosition(); } return mapType.getObject(mapBlockBuilder, mapBlockBuilder.getPositionCount() - 1); }
Source:
public void start() { LOG.info("Starting Leshan client ..."); endpointsManager.start(); engine.start(); for (LwM2mObjectEnabler objectEnabler : objectTree.getObjectEnablers().values()) { if (objectEnabler instanceof Startable) { ((Startable) objectEnabler).start(); } } if (LOG.isInfoEnabled()) { LOG.info("Leshan client[endpoint:{}] started.", engine.getEndpoint()); } }

Target:
public void start() { LOG.info("Starting Leshan client ..."); endpointsManager.start(); engine.start(); objectTree.start(); if (LOG.isInfoEnabled()) { LOG.info("Leshan client[endpoint:{}] started.", engine.getEndpoint()); } }
Source:
public static <T> void put(String key, T value) { throwExceptionIf(key == null, "Key cannot be null"); throwExceptionIf(value == null, "Value cannot be null"); String fullText = getMarshalledValue(value, null); storage.put(key, fullText); }

Target:
public static <T> boolean put(String key, T value) { if (key == null) { throw new NullPointerException("Key cannot be null"); } if (value == null) { throw new NullPointerException("Value cannot be null"); } String cipherText = encoder.encode(value); if (cipherText == null) { return false; } String fullText = DataUtil.addType(cipherText, value.getClass(), false); return storage.put(key, fullText); }
Source:
public <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { initBaseDAO((BaseDAODbFacade) dao); return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }

Target:
protected <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { initBaseDAO((BaseDAODbFacade) dao); return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }
Source:
protected void addOrUpdateLoggerLevel(FeaturesRunner runner, FrameworkMethod method) { for (Loggable loggable : getLoggables(runner, method)) { if (loggable.level() != null) { String loggerName = getLoggerName(loggable); LoggerContext context = LoggerContext.getContext(false); if (!context.hasLogger(loggerName)) { org.apache.logging.log4j.Logger logger = LogManager.getLogger(loggerName); Configurator.setLevel(logger.getName(), Level.OFF); } originalLevelByLogger.put(buildKey(loggable, method), context.getLogger(loggerName).getLevel()); Configurator.setLevel(loggerName, Level.toLevel(loggable.level())); } } }

Target:
protected void addOrUpdateLoggerLevel(FeaturesRunner runner, FrameworkMethod method) { for (LoggerLevel logger : getLoggers(runner, method)) { if (logger.level() != null) { String loggerName = getLoggerName(logger); LoggerContext context = LoggerContext.getContext(false); if (!context.hasLogger(loggerName)) { Configurator.setLevel(loggerName, Level.OFF); } originalLevelByLogger.put(buildKey(logger, method), context.getLogger(loggerName).getLevel()); Configurator.setLevel(loggerName, Level.toLevel(logger.level())); } } }
Source:
public void refreshBuilds(final RefreshRequest request, final GetBuildsRequest buildRequest, final IOperationMonitor monitor) throws CoreException { final List<IBuild> result = BuildRunner.run(new BuildRunnableWithResult<List<IBuild>>() { @Override public List<IBuild> run() throws CoreException { return server.getBehaviour().getBuilds(buildRequest, monitor); } }); if (result == null) { return; } final BuildServer original = server.getOriginal(); original.getLoader().getRealm().syncExec(new Runnable() { public void run() { Date refreshDate = new Date(); for (IBuildPlan modelPlan : request.getModel().getPlans()) { if (modelPlan.getServer() == original && modelPlan.getId().equals(buildRequest.getPlan().getId())) { updateLastBuild(request, modelPlan, result.get(0), refreshDate); } for (IBuildPlan modelChildPlan : modelPlan.getChildren()) { if (modelChildPlan.getServer() == original && modelChildPlan.getId().equals(buildRequest.getPlan().getId())) { updateLastBuild(request, modelChildPlan, result.get(0), refreshDate); } } } } }); }

Target:
public void refreshBuilds(final RefreshRequest request, final GetBuildsRequest buildRequest, final IOperationMonitor monitor) throws CoreException { final List<IBuild> result = BuildRunner.run(new BuildRunnableWithResult<List<IBuild>>() { @Override public List<IBuild> run() throws CoreException { return server.getBehaviour().getBuilds(buildRequest, monitor); } }); if (result == null) { return; } final BuildServer original = server.getOriginal(); original.getLoader().getRealm().syncExec(new Runnable() { public void run() { Date refreshDate = new Date(); for (IBuildPlan modelPlan : request.getModel().getPlans()) { if (modelPlan.getServer() == original && modelPlan.getId().equals(buildRequest.getPlan().getId())) { updateLastBuild(request, modelPlan, result.get(0), refreshDate); } } } }); }
Source:
public Result mediaList(Long folderId) { Folder folder = folderManager.findById(folderId); if (!Secured.viewFolder(folder)) { return forbidden("Dazu hast du keine Berechtigung"); } Folder rootFolder = FolderManager.findRoot(folder); List<Media> mediaSet = folder.files; List<Folder> folderList = folder.folders; return created(list.render(mediaSet, folderList, rootFolder.group.id)); }

Target:
public Result mediaList(Long folderId) { Folder folder = folderManager.findById(folderId); if (!Secured.viewFolder(folder)) { return forbidden("Dazu hast du keine Berechtigung"); } Folder rootFolder = FolderManager.findRoot(folder); List<Media> mediaSet = folder.files; List<Folder> folderList = folder.folders; for (Media media : mediaSet) { media.sizeInByte = mediaManager.bytesToString(media.size, false); } return ok(list.render(mediaSet, folderList, rootFolder.group.id)); }
Source:
public static boolean assertSameHtml(String expected, String actual, boolean isPart, boolean isDifferenceToBeShown) { String processedExpected = convertToStandardHtml(expected, isPart); String processedActual = convertToStandardHtml(actual, isPart); if (!AssertHelper.isContainsRegex(processedExpected, processedActual)) { if (isDifferenceToBeShown) { processedActual = AppPage.processPageSourceForFailureCase(processedActual); processedExpected = AppPage.processPageSourceForFailureCase(processedExpected); assertEquals("<expected>\n" + processedExpected + "</expected>", "<actual>\n" + processedActual + "</actual>"); } return false; } return true; }

Target:
private static boolean assertSameHtml(String expected, String actual, boolean isPart, boolean isDifferenceToBeShown) { String processedExpected = convertToStandardHtml(expected, isPart); String processedActual = convertToStandardHtml(actual, isPart); if (!AssertHelper.isContainsRegex(processedExpected, processedActual)) { if (isDifferenceToBeShown) { processedActual = AppPage.processPageSourceForFailureCase(processedActual); processedExpected = AppPage.processPageSourceForFailureCase(processedExpected); assertEquals("<expected>\n" + processedExpected + "</expected>", "<actual>\n" + processedActual + "</actual>"); } return false; } return true; }
Source:
private void createNodeIdToDAGNode() { nodeIdToDAGNode = new TreeMap<String, DAGNode<Job>>(); for (Task<? extends Serializable> task : allTasks) { if (task.getWork() instanceof MapredWork) { DAGNode<Job> dagNode = asDAGNode(task); nodeIdToDAGNode.put(dagNode.getName(), dagNode); } } Map<String, List<String>> nodeIdToDependencies = getNodeIdToDependencies(); for (Map.Entry<String, List<String>> entry : nodeIdToDependencies.entrySet()) { String nodeId = entry.getKey(); List<String> successorIds = entry.getValue(); DAGNode<Job> dagNode = nodeIdToDAGNode.get(nodeId); List<DAGNode<? extends Job>> dagSuccessors = new ArrayList<DAGNode<? extends Job>>( successorIds.size()); for (String sId : successorIds) { DAGNode<Job> successor = nodeIdToDAGNode.get(sId); dagSuccessors.add(successor); } dagNode.setSuccessors(dagSuccessors); } }

Target:
private void createNodeIdToDAGNode() { nodeIdToDAGNode = Maps.newTreeMap(); for (Task<? extends Serializable> task : allTasks) { if (task.getWork() instanceof MapredWork) { DAGNode<Job> dagNode = asDAGNode(task); nodeIdToDAGNode.put(dagNode.getName(), dagNode); } } Map<String, List<String>> nodeIdToDependencies = getNodeIdToDependencies(); for (Map.Entry<String, List<String>> entry : nodeIdToDependencies.entrySet()) { String nodeId = entry.getKey(); List<String> successorIds = entry.getValue(); DAGNode<Job> dagNode = nodeIdToDAGNode.get(nodeId); List<DAGNode<? extends Job>> dagSuccessors = Lists.newArrayListWithCapacity(successorIds.size()); for (String sId : successorIds) { DAGNode<Job> successor = nodeIdToDAGNode.get(sId); dagSuccessors.add(successor); } dagNode.setSuccessors(dagSuccessors); } }
Source:
public static int calculateGc(final byte[] bases, final int startIndex, final int endIndex, final CalculateGcState state) { if (state.init) { state.init = false; state.gcCount = 0; state.nCount = 0; for (int i = startIndex; i < endIndex; ++i) { final byte base = bases[i]; if (base == 'G' || base == 'C') ++state.gcCount; else if (base == 'N') ++state.nCount; } } else { final byte newBase = bases[endIndex - 1]; if (newBase == 'G' || newBase == 'C') ++state.gcCount; else if (newBase == 'N') ++state.nCount; if (state.priorBase == 'G' || state.priorBase == 'C') --state.gcCount; else if (state.priorBase == 'N') --state.nCount; } state.priorBase = bases[startIndex]; if (state.nCount > 4) return -1; else return (state.gcCount * 100) / (endIndex - startIndex); }

Target:
public static int calculateGc(final byte[] bases, final int startIndex, final int endIndex, final CalculateGcState state) { if (state.init) { state.init = false; state.gcCount = 0; state.nCount = 0; for (int i = startIndex; i < endIndex; ++i) { final byte base = bases[i]; if (SequenceUtil.basesEqual(base, (byte)'G') || SequenceUtil.basesEqual(base, (byte)'C')) ++state.gcCount; else if (SequenceUtil.basesEqual(base, (byte)'N')) ++state.nCount; } } else { final byte newBase = bases[endIndex - 1]; if (SequenceUtil.basesEqual(newBase, (byte)'G') || SequenceUtil.basesEqual(newBase, (byte)'C')) ++state.gcCount; else if (newBase == 'N') ++state.nCount; if (SequenceUtil.basesEqual(state.priorBase, (byte)'G') || SequenceUtil.basesEqual(state.priorBase, (byte)'C')) --state.gcCount; else if (SequenceUtil.basesEqual(state.priorBase, (byte)'N')) --state.nCount; } state.priorBase = bases[startIndex]; if (state.nCount > 4) return -1; else return (state.gcCount * 100) / (endIndex - startIndex); }
Source:
private static void createLink(IFolder parentFolder, IPath location, String targetName) { File source = new File(location.toString()); IWorkspace workspace = ResourcesPlugin.getWorkspace(); try { if (source.isDirectory()) { IFolder folder = parentFolder.getFolder(targetName); IStatus result = workspace.validateLinkLocation(folder, location); if (result.isOK() || result.matches(IStatus.INFO | IStatus.WARNING)) { folder.createLink(location, IResource.REPLACE, null); } else { Activator.getDefault().logError("Invalid Trace Location"); } } else { IFile file = parentFolder.getFile(targetName); IStatus result = workspace.validateLinkLocation(file, location); if (result.isOK() || result.matches(IStatus.INFO | IStatus.WARNING)) { file.createLink(location, IResource.REPLACE, null); } else { Activator.getDefault().logError("Invalid Trace Location"); } } } catch (CoreException e) { final Exception e1 = e; TraceUtils.displayErrorMsg("Error", e1.getMessage(), e1); Activator.getDefault().logError(e.getMessage(), e); } }

Target:
private static void createLink(IFolder parentFolder, IPath location, String targetName) { File source = new File(location.toString()); IWorkspace workspace = ResourcesPlugin.getWorkspace(); try { if (source.isDirectory()) { IFolder folder = parentFolder.getFolder(targetName); IStatus result = workspace.validateLinkLocation(folder, location); if (result.isOK() || result.matches(IStatus.INFO | IStatus.WARNING)) { folder.createLink(location, IResource.REPLACE, null); } else { Activator.getDefault().logError("Invalid Trace Location"); } } else { IFile file = parentFolder.getFile(targetName); IStatus result = workspace.validateLinkLocation(file, location); if (result.isOK() || result.matches(IStatus.INFO | IStatus.WARNING)) { file.createLink(location, IResource.REPLACE, null); } else { Activator.getDefault().logError("Invalid Trace Location"); } } } catch (CoreException e) { TraceUtils.displayErrorMsg(e.getClass().getSimpleName(), e.getMessage(), e); } }
Source:
private String parseTimer(String value) { if (value.equals("OFF/OFF")) return "Off/Off"; if (value.equals("ON/OFF")) return "On/Off"; if (value.equals("OFF/ON")) return "Off/On"; if (value.equals("ON/ON")) return "On/Off"; return "None"; }

Target:
private DaikinTimer parseTimer(String value) { if (value.equals("OFF/OFF")) return DaikinTimer.OffOff; if (value.equals("ON/OFF")) return DaikinTimer.OnOff; if (value.equals("OFF/ON")) return DaikinTimer.OffOn; if (value.equals("ON/ON")) return DaikinTimer.OnOn; return DaikinTimer.None; }
Source:
private void verifyClientShallow() throws IOException, PackProtocolException { AsyncRevObjectQueue q = walk.parseAny(clientShallowCommits, true); try { for (;;) { try { RevObject o = q.next(); if (!(o instanceof RevCommit)) { throw new PackProtocolException( MessageFormat.format( JGitText.get().invalidShallowObject, o.name())); } } catch (MissingObjectException notCommit) { clientShallowCommits.remove(notCommit.getObjectId()); continue; } } } finally { q.release(); } }

Target:
private void verifyClientShallow() throws IOException, PackProtocolException { AsyncRevObjectQueue q = walk.parseAny(clientShallowCommits, true); try { for (;;) { try { RevObject o = q.next(); if (o == null) { break; } if (!(o instanceof RevCommit)) { throw new PackProtocolException( MessageFormat.format( JGitText.get().invalidShallowObject, o.name())); } } catch (MissingObjectException notCommit) { clientShallowCommits.remove(notCommit.getObjectId()); continue; } } } finally { q.release(); } }
Source:
private IAccessRule loadAccessRule() throws IOException { int problemId = loadInt(); IPath pattern = loadPath(); return JavaCore.newAccessRule(pattern, problemId); }

Target:
private IAccessRule loadAccessRule() throws IOException { int problemId = loadInt(); IPath pattern = loadPath(); return getAccessRule(pattern, problemId); }
Source:
public void calculateSerializedSize() { ByteBuf buf = Unpooled.buffer(); serialize(buf); serializedSize = buf.writerIndex(); log.warn("It is an expensive operation"); }

Target:
private int calculateSerializedSize() { if (!opaque) { log.error("This operation only supported for an opaque SMR entry"); return 0; } int size = 0; for (Object smrArg : SMRArguments) { size += ((byte[])smrArg).length; } size += (SMRMethod.length() * Character.BYTES); size += Integer.BYTES; return size; }
Source:
private void attemptRecovery(final IOException originalIOException) throws IOException { try { super.continueWith(this.continuator.buildContinuation(originalIOException, this.getBytesRead())); } catch (final IOException ioe) { LOG.debug("Failed to automatically recover: {}", ioe.getMessage()); if (originalIOException != ioe) { originalIOException.addSuppressed(ioe); } throw originalIOException; } }

Target:
private void attemptRecovery(final IOException originalIOException) throws IOException { try { super.continueWith(this.continuator.buildContinuation(originalIOException, this.getBytesRead())); } catch (final UncheckedIOException | IOException ioe) { LOG.debug("Failed to automatically recover: {}", ioe.getMessage()); if (originalIOException != ioe) { originalIOException.addSuppressed(ioe); } throw originalIOException; } }
Source:
public void run() { try { state.runtime.stop(options); runtimes.remove(workspaceId); LOG.info( "Workspace '{}/{}' with id '{}' stopped by user '{}'", workspace.getNamespace(), workspace.getConfig().getName(), workspace.getId(), stoppedBy); publishWorkspaceStatusEvent(workspaceId, STOPPED, STOPPING, null); } catch (InfrastructureException e) { runtimes.remove(workspaceId); LOG.info( "Error occurs on workspace '{}/{}' with id '{}' stopped by user '{}'. Error: {}", workspace.getNamespace(), workspace.getConfig().getName(), workspace.getId(), stoppedBy, e); publishWorkspaceStatusEvent( workspaceId, STOPPED, STOPPING, "Error occurs on workspace runtime stop. Error: " + e.getMessage()); if (e instanceof InternalInfrastructureException) { LOG.error(e.getLocalizedMessage(), e); } throw new RuntimeException(e); } }

Target:
public void run() { String workspaceId = workspace.getId(); try { state.runtime.stop(options); runtimes.remove(workspaceId); LOG.info( "Workspace '{}/{}' with id '{}' stopped by user '{}'", workspace.getNamespace(), workspace.getConfig().getName(), workspaceId, stoppedBy); publishWorkspaceStatusEvent(workspaceId, STOPPED, STOPPING, null); } catch (InfrastructureException e) { runtimes.remove(workspaceId); LOG.info( "Error occurs on workspace '{}/{}' with id '{}' stopped by user '{}'. Error: {}", workspace.getNamespace(), workspace.getConfig().getName(), workspaceId, stoppedBy, e); publishWorkspaceStatusEvent( workspaceId, STOPPED, STOPPING, "Error occurs on workspace runtime stop. Error: " + e.getMessage()); if (e instanceof InternalInfrastructureException) { LOG.error(e.getLocalizedMessage(), e); } throw new RuntimeException(e); } }
Source:
public List<Attribute> getRequiredAttributes(PerunSession sess, Member member, boolean workWithUserAttributes) throws PrivilegeException, InternalErrorException, MemberNotExistsException { Utils.checkPerunSession(sess); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); List<Attribute> attributes = getAttributesManagerBl().getRequiredAttributes(sess, member, workWithUserAttributes); Iterator<Attribute> attrIter = attributes.iterator(); User u = null; while(attrIter.hasNext()) { Attribute attrNext = attrIter.next(); if (getAttributesManagerBl().isFromNamespace(sess, attrNext, NS_MEMBER_ATTR)){ if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attrNext, member, null)) attrIter.remove(); else attrNext.setWritable(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attrNext, member, null)); } else if (getAttributesManagerBl().isFromNamespace(sess, attrNext, NS_USER_ATTR)) { if (u == null) u = getPerunBl().getUsersManagerBl().getUserByMember(sess, member); if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attrNext, u, null)) attrIter.remove(); else attrNext.setWritable(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attrNext, u, null)); } else { throw new ConsistencyErrorException("There is some attribute which is not type of any possible choice."); } } return attributes; }

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, Member member, boolean workWithUserAttributes) throws PrivilegeException, InternalErrorException, MemberNotExistsException { Utils.checkPerunSession(sess); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); List<Attribute> attributes = getAttributesManagerBl().getRequiredAttributes(sess, member, workWithUserAttributes); Iterator<Attribute> attrIter = attributes.iterator(); User user = null; while(attrIter.hasNext()) { Attribute attrNext = attrIter.next(); if (getAttributesManagerBl().isFromNamespace(sess, attrNext, NS_MEMBER_ATTR)){ if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attrNext, member, null)) attrIter.remove(); else attrNext.setWritable(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attrNext, member, null)); } else if (getAttributesManagerBl().isFromNamespace(sess, attrNext, NS_USER_ATTR)) { if (user == null) user = getPerunBl().getUsersManagerBl().getUserByMember(sess, member); if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attrNext, user, null)) attrIter.remove(); else attrNext.setWritable(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attrNext, user, null)); } else { throw new ConsistencyErrorException("There is some attribute which is not type of any possible choice."); } } return attributes; }
Source:
public List<AuditLogWithHistory> getAuditLogsWithHistoryForId(final UUID accountId, final AuditLevel auditLevel, final InternalTenantContext context) throws AccountApiException { return transactionalSqlDao.execute(false, AccountApiException.class, new EntitySqlDaoTransactionWrapper<List<AuditLogWithHistory>>() { @Override public List<AuditLogWithHistory> inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws EntityPersistenceException, EventBusException { final AccountSqlDao transactional = entitySqlDaoWrapperFactory.become(AccountSqlDao.class); return auditDao.getAuditLogsWithHistoryForId(transactional, TableName.ACCOUNT, accountId, auditLevel, context); } }); }

Target:
public List<AuditLogWithHistory> getAuditLogsWithHistoryForId(final UUID accountId, final AuditLevel auditLevel, final InternalTenantContext context) throws AccountApiException { return transactionalSqlDao.execute(true, AccountApiException.class, new EntitySqlDaoTransactionWrapper<List<AuditLogWithHistory>>() { @Override public List<AuditLogWithHistory> inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) { final AccountSqlDao transactional = entitySqlDaoWrapperFactory.become(AccountSqlDao.class); return auditDao.getAuditLogsWithHistoryForId(transactional, TableName.ACCOUNT, accountId, auditLevel, context); } }); }
Source:
public void testStatementPeriodMONTHLY() { Calendar date = Calendar.getInstance(); Calendar aCalendar = Calendar.getInstance(); date = Calendar.getInstance(); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY); assertTrue(period == null); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS - 1); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY); assertTrue(period != null); assertTrue(period[0].toString(), period[0].before(period[1])); assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 1); aCalendar = Calendar.getInstance(); aCalendar.add(Calendar.MONTH, -1); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); }

Target:
public void testStatementPeriodMONTHLY() { Calendar date = Calendar.getInstance(); Calendar aCalendar = Calendar.getInstance(); date = Calendar.getInstance(); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY); assertTrue(period == null); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS - 1); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY); assertTrue(period != null); assertTrue(period.length == 2); assertTrue(period[0].toString(), period[0].before(period[1])); assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 1); aCalendar = Calendar.getInstance(); aCalendar.add(Calendar.MONTH, -1); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); }
Source:
public void spec103_mustSignalOnMethodsSequentially() throws Exception { notVerified(); }

Target:
public void spec103_mustSignalOnMethodsSequentially() throws Throwable { final int iterations = 100; final int elements = 10; stochasticTest(iterations, new Function<Integer, Void>() { @Override public Void apply(final Integer runNumber) throws Throwable { activePublisherTest(elements, new PublisherTestRun<T>() { @Override public void run(Publisher<T> pub) throws Throwable { final Latch callLatch = new Latch(env); final Latch completionLatch = new Latch(env); pub.subscribe(new Subscriber<T>() { private Subscription subs; private long gotElements = 0; private String state = "init"; @Override public void onSubscribe(Subscription s) { callLatch.assertOpen("Expected latch to be open during onSubscribe call, state seems to be: " + state); callLatch.close(); state = "onSubscribe"; subs = s; subs.request(1); callLatch.reOpen(); } @Override public void onNext(T ignore) { callLatch.assertOpen("Expected latch to be open during onNext call, state seems to be: " + state); callLatch.close(); state = "onNext-" + ignore; gotElements += 1; if (gotElements <= elements) subs.request(1); callLatch.reOpen(); } @Override public void onError(Throwable t) { callLatch.assertOpen("Expected latch to be open during onError call, state seems to be: " + state); callLatch.close(); state = "onError"; callLatch.reOpen(); } @Override public void onComplete() { callLatch.assertOpen("Expected latch to be open during onComplete call, state seems to be: " + state); callLatch.close(); state = "onComplete"; callLatch.reOpen(); completionLatch.close(); } }); completionLatch.expectClose(elements * env.defaultTimeoutMillis(), "Expected 10 elements to be drained"); } }); return null; } }); }
Source:
public void localeTwoLetterCodeResolves() { assertThat("A locale with a 2-letter code resolves correctly", LanguageUtil.getLocale("af").getDisplayLanguage().equals("Afrikaans")); }

Target:
public void localeTwoLetterCodeResolves() { assertThat("A locale with a 3-letter code resolves correctly", "Afrikaans", is(LanguageUtil.getLocale("af").getDisplayLanguage())); }
Source:
private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); char[] password = "testpassword".toCharArray(); String testTrustKeyStorePath = "src/test/testTrustKeyStore"; System.setProperty("javax.net.ssl.trustStore" , testTrustKeyStorePath); File file = new File(testTrustKeyStorePath); InputStream localCertIn = new FileInputStream(file); ks.load(localCertIn, password); localCertIn.close(); if (ks.containsAlias("nutch")) { return; } InputStream certIn = new FileInputStream("src/test/nutch.cer"); BufferedInputStream bis = new BufferedInputStream(certIn); CertificateFactory cf = CertificateFactory.getInstance("X.509"); while (bis.available() > 0) { Certificate cert = cf.generateCertificate(bis); ks.setCertificateEntry("nutch", cert); } certIn.close(); OutputStream out = new FileOutputStream(file); ks.store(out, password); out.close(); }

Target:
private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { String testTrustKeyStorePath = getResourcePath("testTrustKeyStore"); File file = new File(testTrustKeyStorePath); InputStream localCertIn = new FileInputStream(file); char[] password = "testpassword".toCharArray(); KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(localCertIn, password); localCertIn.close(); if (ks.containsAlias("nutch")) { return; } String cerFilePath = getResourcePath("nutch.cer"); InputStream certIn = new FileInputStream(cerFilePath); BufferedInputStream bis = new BufferedInputStream(certIn); CertificateFactory cf = CertificateFactory.getInstance("X.509"); while (bis.available() > 0) { Certificate cert = cf.generateCertificate(bis); ks.setCertificateEntry("nutch", cert); } certIn.close(); OutputStream out = new FileOutputStream(file); ks.store(out, password); out.close(); }
Source:
public void onCompletion(RecordMetadata recordMetadata, Exception e) { if (e != null) { if(body instanceof Exchange) { ((Exchange)body).setException(e); } } recordMetadatas.add(recordMetadata); if (count.decrementAndGet() == 0) { workerPool.submit(new Runnable() { @Override public void run() { log.trace("All messages sent, continue routing."); if(callback != null) { callback.done(false); } } }); } }

Target:
public void onCompletion(RecordMetadata recordMetadata, Exception e) { if (e != null) { if (body instanceof Exchange) { ((Exchange)body).setException(e); } if (body instanceof Message && ((Message)body).getExchange() != null) { ((Message)body).getExchange().setException(e); } } recordMetadatas.add(recordMetadata); if (count.decrementAndGet() == 0) { workerPool.submit(new Runnable() { @Override public void run() { log.trace("All messages sent, continue routing."); if (callback != null) { callback.done(false); } } }); } }
Source:
public DisksAllocationView() { diskAllocationTargetEnabled = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); driver.initialize(this); listHeader = new EntityModelCellTable(false, (Resources) GWT.create( PopupSimpleTableResources.class), true); }

Target:
public DisksAllocationView() { diskAllocationTargetEnabled = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); driver.initialize(this); }
Source:
private void handleMissingResponse(Response response) { if (response instanceof UnsureResponse) { allFuture.hasUnsureResponse = true; } Map<Object, Collection<Address>> contactedNodes = this.contactedNodes == null ? new HashMap<>() : this.contactedNodes; Map<Address, List<Object>> requestedKeys; synchronized (contactedNodes) { for (Object key : keys) { contactedNodes.computeIfAbsent(key, k -> new ArrayList<>(4)).add(target); } requestedKeys = getKeysByOwner(ctx, keys, checkTopologyId(command), null, contactedNodes); } int pos = destinationIndex; for (Map.Entry<Address, List<Object>> addressKeys : requestedKeys.entrySet()) { allFuture.increment(); List<Object> keysForAddress = addressKeys.getValue(); ReadOnlyManyCommand remoteCommand = helper.copyForRemote(command, keysForAddress, ctx); remoteCommand.setTopologyId(command.getTopologyId()); Address target = addressKeys.getKey(); rpcManager.invokeCommand(target, remoteCommand, new MapResponseCollector(true, 1), rpcManager.getSyncRpcOptions()) .whenComplete(new ReadManyHandler(target, allFuture, ctx, command, keysForAddress, contactedNodes, pos, helper)); pos += keysForAddress.size(); } Arrays.fill(allFuture.results, pos, destinationIndex + keys.size(), LOST_PLACEHOLDER); allFuture.lostData = true; allFuture.countDown(); }

Target:
private void handleMissingResponse(Response response) { if (response instanceof UnsureResponse) { allFuture.hasUnsureResponse = true; } Map<Object, Collection<Address>> contactedNodes = this.contactedNodes == null ? new HashMap<>() : this.contactedNodes; Map<Address, List<Object>> requestedKeys; synchronized (contactedNodes) { for (Object key : keys) { contactedNodes.computeIfAbsent(key, k -> new ArrayList<>(4)).add(target); } requestedKeys = getKeysByOwner(ctx, keys, checkTopologyId(command), null, contactedNodes); } int pos = destinationIndex; for (Map.Entry<Address, List<Object>> addressKeys : requestedKeys.entrySet()) { allFuture.increment(); List<Object> keysForAddress = addressKeys.getValue(); ReadOnlyManyCommand remoteCommand = helper.copyForRemote(command, keysForAddress, ctx); remoteCommand.setTopologyId(command.getTopologyId()); Address target = addressKeys.getKey(); rpcManager.invokeCommand(target, remoteCommand, SingletonMapResponseCollector.ignoreLeavers(), rpcManager.getSyncRpcOptions()) .whenComplete(new ReadManyHandler(target, allFuture, ctx, command, keysForAddress, contactedNodes, pos, helper)); pos += keysForAddress.size(); } Arrays.fill(allFuture.results, pos, destinationIndex + keys.size(), LOST_PLACEHOLDER); allFuture.lostData = true; allFuture.countDown(); }
Source:
SweepResults runOneIteration( TableReference tableRef, byte[] startRow, SweepBatchConfig batchConfig) { Stopwatch watch = Stopwatch.createStarted(); try { log.info("Beginning"); SweepResults results = sweepRunner.run( tableRef, batchConfig, startRow); long elapsedMillis = watch.elapsed(TimeUnit.MILLISECONDS); log.info("Swept successfully.", LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), SafeArg.of("cellTs pairs examined", results.getCellTsPairsExamined()), SafeArg.of("cellTs pairs deleted", results.getStaleValuesDeleted()), SafeArg.of("time taken", elapsedMillis), SafeArg.of("last swept timestamp", results.getSweptTimestamp())); sweepPerfLogger.logSweepResults( SweepPerformanceResults.builder() .sweepResults(results) .tableName(tableRef.getQualifiedName()) .elapsedMillis(elapsedMillis) .build()); return results; } catch (RuntimeException e) { log.info("Failed to sweep.", LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), SafeArg.of("batchConfig", batchConfig)); throw e; } }

Target:
SweepResults runOneIteration( TableReference tableRef, byte[] startRow, SweepBatchConfig batchConfig) { Stopwatch watch = Stopwatch.createStarted(); try { SweepResults results = sweepRunner.run( tableRef, batchConfig, startRow); long elapsedMillis = watch.elapsed(TimeUnit.MILLISECONDS); log.info("Analyzed cell+timestamp pairs" + " from table {}" + " starting at row {}" + " and deleted stale values" + " in ms" + " up to timestamp {}.", SafeArg.of("cellTs pairs examined", results.getCellTsPairsExamined()), LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), SafeArg.of("cellTs pairs deleted", results.getStaleValuesDeleted()), SafeArg.of("time taken", elapsedMillis), SafeArg.of("last swept timestamp", results.getSweptTimestamp())); sweepPerfLogger.logSweepResults( SweepPerformanceResults.builder() .sweepResults(results) .tableName(tableRef.getQualifiedName()) .elapsedMillis(elapsedMillis) .build()); return results; } catch (RuntimeException e) { log.info("Failed to sweep table {}" + " at row {}" + " with candidate batch size {}," + " delete batch size {}," + " and cell+timestamp pairs to examine.", LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), SafeArg.of("candidateBatchSize", batchConfig.candidateBatchSize()), SafeArg.of("deleteBatchSize", batchConfig.deleteBatchSize()), SafeArg.of("maxCellTsPairsToExamine", batchConfig.maxCellTsPairsToExamine()), e); throw e; } }
Source:
public void run() { for(ManagedScheduledExecutorServiceImpl service : managedScheduledExecutorServices) { Collection<AbstractManagedThread> hungThreads = service.getHungThreads(); if (hungThreads != null && !hungThreads.isEmpty()) { for (AbstractManagedThread hungThread : hungThreads) { EeLogger.ROOT_LOGGER.abortingHungThread(hungThread.toString(), service.getName()); hungThread.interrupt(); } } } }

Target:
public void run() { List<ManagedScheduledExecutorServiceImpl> threadSaveList; synchronized (managedScheduledExecutorServices) { threadSaveList = new ArrayList<>(managedScheduledExecutorServices); } for(ManagedScheduledExecutorServiceImpl service : threadSaveList) { Collection<AbstractManagedThread> hungThreads = service.getHungThreads(); if (hungThreads != null && !hungThreads.isEmpty()) { for (AbstractManagedThread hungThread : hungThreads) { EeLogger.ROOT_LOGGER.abortingHungThread(hungThread.toString(), service.getName()); hungThread.interrupt(); } } } }
Source:
private void getSealedPartitionsInDc(Datacenter dc, Map<String, Set<String>> dcToSealedPartitions, Map<String, Set<String>> nodeToNonExistentReplicas) { String dcName = dc.getName(); dcToSealedPartitions.put(dcName, new HashSet<>()); HelixAdmin admin = adminForDc.get(dcName); Set<String> allInstancesInHelix = new HashSet<>(admin.getInstancesInCluster(clusterName)); for (DataNodeId dataNodeId : dc.getDataNodes()) { DataNode dataNode = (DataNode) dataNodeId; Set<String> replicasOnNode = staticClusterMap.getReplicas(dataNode) .stream() .map(replicaId -> replicaId.getPartitionId().toPathString()) .collect(Collectors.toSet()); String instanceName = getInstanceName(dataNode); ensureOrThrow(allInstancesInHelix.contains(instanceName), "Instance not present in Helix " + instanceName); InstanceConfig instanceConfig = admin.getInstanceConfig(clusterName, instanceName); List<String> sealedReplicas = instanceConfig.getRecord().getListField(ClusterMapUtils.SEALED_STR); if (sealedReplicas != null) { for (String sealedReplica : sealedReplicas) { info("Replica is sealed on {}", sealedReplica, instanceName); dcToSealedPartitions.get(dcName).add(sealedReplica); if (!replicasOnNode.contains(sealedReplica)) { logger.warn("Replica is in sealed list but not on node {}", sealedReplica, replicasOnNode); nodeToNonExistentReplicas.computeIfAbsent(instanceName, key -> new HashSet<>()).add(sealedReplica); } } } } }

Target:
private void getSealedPartitionsInDc(Datacenter dc, Map<String, Set<String>> dcToSealedPartitions, Map<String, Set<String>> nodeToNonExistentReplicas) { String dcName = dc.getName(); dcToSealedPartitions.put(dcName, new HashSet<>()); HelixAdmin admin = adminForDc.get(dcName); Set<String> allInstancesInHelix = new HashSet<>(admin.getInstancesInCluster(clusterName)); for (DataNodeId dataNodeId : dc.getDataNodes()) { DataNode dataNode = (DataNode) dataNodeId; Set<String> replicasOnNode = staticClusterMap.getReplicas(dataNode) .stream() .map(replicaId -> replicaId.getPartitionId().toPathString()) .collect(Collectors.toSet()); String instanceName = getInstanceName(dataNode); ensureOrThrow(allInstancesInHelix.contains(instanceName), "Instance not present in Helix " + instanceName); InstanceConfig instanceConfig = admin.getInstanceConfig(clusterName, instanceName); List<String> sealedReplicas = instanceConfig.getRecord().getListField(ClusterMapUtils.SEALED_STR); if (sealedReplicas != null) { for (String sealedReplica : sealedReplicas) { info("Replica is sealed on {}", sealedReplica, instanceName); dcToSealedPartitions.get(dcName).add(sealedReplica); if (!replicasOnNode.contains(sealedReplica)) { logger.warn("Replica is in sealed list but not on node {}", sealedReplica, instanceName); nodeToNonExistentReplicas.computeIfAbsent(instanceName, key -> new HashSet<>()).add(sealedReplica); } } } } }
Source:
public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { logger.info("Selected Nodes: " + selectedNodes); logger.info("Analysing task: " + task.getInternal().getName()); String allocRam = task.getInternal().getGenericInformation().get(RAM_VARIABLE_NAME); if (allocRam != null) { return canRunTaskOnNode(selectedNodes, task, Integer.parseInt(allocRam)); } else { return true; } }

Target:
public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { logger.debug("Selected Nodes: " + selectedNodes); logger.debug("Analysing task: " + task.getInternal().getName()); String allocRam = task.getInternal().getGenericInformation().get(RAM_VARIABLE_NAME); if (allocRam != null) { return canRunTaskOnNode(selectedNodes, task, Integer.parseInt(allocRam)); } else { return true; } }
Source:
public void testResolvedSymRef() throws IOException { Ref ref = db.getRef(Constants.HEAD); assertEquals(Constants.HEAD, ref.getName()); assertTrue("is symbolic ref", ref instanceof SymbolicRef); assertSame(Ref.Storage.LOOSE, ref.getStorage()); Ref dst = ((SymbolicRef) ref).getTarget(); assertNotNull("has target", dst); assertEquals("refs/heads/master", dst.getName()); assertSame(dst.getObjectId(), ref.getObjectId()); assertSame(dst.getPeeledObjectId(), ref.getPeeledObjectId()); assertEquals(dst.isPeeled(), ref.isPeeled()); }

Target:
public void testResolvedSymRef() throws IOException { Ref ref = db.getRef(Constants.HEAD); assertEquals(Constants.HEAD, ref.getName()); assertTrue("is symbolic ref", ref.isSymbolic()); assertSame(Ref.Storage.LOOSE, ref.getStorage()); Ref dst = ref.getTarget(); assertNotNull("has target", dst); assertEquals("refs/heads/master", dst.getName()); assertSame(dst.getObjectId(), ref.getObjectId()); assertSame(dst.getPeeledObjectId(), ref.getPeeledObjectId()); assertEquals(dst.isPeeled(), ref.isPeeled()); }
Source:
public void fetchesUrls() throws Exception { final Release release = Mockito.mock(Release.class); final String url = "http://url"; final String htmlurl = "http://html_url"; final String assetsurl = "http://assets_url"; final String uploadurl = "http://upload_url"; Mockito.doReturn( Json.createObjectBuilder() .add("url", url) .add("html_url", htmlurl) .add("assets_url", assetsurl) .add("upload_url", uploadurl) .build() ).when(release).json(); final Release.Smart smart = new Release.Smart(release); MatcherAssert.assertThat( smart.url().toString(), Matchers.equalTo(url) ); MatcherAssert.assertThat( smart.htmlUrl().toString(), Matchers.equalTo(htmlurl) ); MatcherAssert.assertThat( smart.assetsUrl().toString(), Matchers.equalTo(assetsurl) ); MatcherAssert.assertThat( smart.uploadUrl().toString(), Matchers.equalTo(uploadurl) ); }

Target:
public void fetchesUrls() throws Exception { final Release release = Mockito.mock(Release.class); final String url = "http://url"; Mockito.doReturn( Json.createObjectBuilder() .add("url", url) .build() ).when(release).json(); final Release.Smart smart = new Release.Smart(release); MatcherAssert.assertThat( smart.url().toString(), Matchers.equalTo(url) ); }
Source:
private static Constructor<? extends Unbinder> findBindingConstructorForClass(Class<?> cls) { if (BINDINGS.containsKey(cls)) { if (debug) Log.d(TAG, "HIT: Cached in binding map."); return BINDINGS.get(cls); } String clsName = cls.getName(); if (clsName.startsWith("android.") || clsName.startsWith("java.") || clsName.startsWith("androidx.")) { if (debug) Log.d(TAG, "MISS: Reached framework class. Abandoning search."); return null; } Constructor<? extends Unbinder> bindingCtor; try { Class<?> bindingClass = cls.getClassLoader().loadClass(clsName + "_ViewBinding"); bindingCtor = (Constructor<? extends Unbinder>) bindingClass.getConstructor(cls, View.class); if (debug) Log.d(TAG, "HIT: Loaded binding class and constructor."); } catch (ClassNotFoundException e) { if (debug) Log.d(TAG, "Not found. Trying superclass " + cls.getSuperclass().getName()); bindingCtor = findBindingConstructorForClass(cls.getSuperclass()); } catch (NoSuchMethodException e) { throw new RuntimeException("Unable to find binding constructor for " + clsName, e); } BINDINGS.put(cls, bindingCtor); return bindingCtor; }

Target:
private static Constructor<? extends Unbinder> findBindingConstructorForClass(Class<?> cls) { Constructor<? extends Unbinder> bindingCtor = BINDINGS.get(cls); if (bindingCtor != null) { if (debug) Log.d(TAG, "HIT: Cached in binding map."); return bindingCtor; } String clsName = cls.getName(); if (clsName.startsWith("android.") || clsName.startsWith("java.") || clsName.startsWith("androidx.")) { if (debug) Log.d(TAG, "MISS: Reached framework class. Abandoning search."); return null; } try { Class<?> bindingClass = cls.getClassLoader().loadClass(clsName + "_ViewBinding"); bindingCtor = (Constructor<? extends Unbinder>) bindingClass.getConstructor(cls, View.class); if (debug) Log.d(TAG, "HIT: Loaded binding class and constructor."); } catch (ClassNotFoundException e) { if (debug) Log.d(TAG, "Not found. Trying superclass " + cls.getSuperclass().getName()); bindingCtor = findBindingConstructorForClass(cls.getSuperclass()); } catch (NoSuchMethodException e) { throw new RuntimeException("Unable to find binding constructor for " + clsName, e); } BINDINGS.put(cls, bindingCtor); return bindingCtor; }
Source:
void waitUntilConnectionIsOpen() { try { executorService.awaitTermination(connectTimeoutMillis, TimeUnit.MILLISECONDS); if (!connectionThread.get() || !webSocketClient.isOpen()) { throw new CouldNotConnect(); } } catch (final InterruptedException | ExecutionException e) { throw new CouldNotConnect(e); } }

Target:
void waitUntilConnectionIsOpen() { try { executorService.awaitTermination(connectTimeoutMillis, TimeUnit.MILLISECONDS); if (!connectionThread.get() || !webSocketClient.isOpen()) { throw new CouldNotConnect(); } } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } catch (final ExecutionException e) { throw new CouldNotConnect(e); } }
Source:
public int getProviderSpecVersionCode() { try { ProviderInfo info = mContext.getPackageManager().resolveContentProvider(FlashCardsContract.AUTHORITY, PackageManager.GET_META_DATA); if (info == null) { return -1; } Bundle metaData = info.metaData; if (metaData == null) { return DEFAULT_PROVIDER_SPEC_VALUE; } if (info.metaData.containsKey(PROVIDER_SPEC_META_DATA_KEY)) { return info.metaData.getInt(PROVIDER_SPEC_META_DATA_KEY); } else { return DEFAULT_PROVIDER_SPEC_VALUE; } } catch (Throwable t) { return -2; } }

Target:
private int getProviderSpecVersionCode() { ProviderInfo info = mContext.getPackageManager().resolveContentProvider(FlashCardsContract.AUTHORITY, PackageManager.GET_META_DATA); if (info == null) { return -1; } if (info.metaData != null && info.metaData.containsKey(PROVIDER_SPEC_META_DATA_KEY)) { return info.metaData.getInt(PROVIDER_SPEC_META_DATA_KEY); } else { return DEFAULT_PROVIDER_SPEC_VALUE; } }
Source:
public IndexCoordinates getIndexCoordinates() { return indexCoordinatesResolver.resolve(getEvaluationContext(null), IndexCoordinates.of(getIndexName())); }

Target:
public IndexCoordinates getIndexCoordinates() { return resolve(IndexCoordinates.of(getIndexName())); }
Source:
public boolean remove(SimpleUri id) { Setting setting = get(id); if (setting == null) { LOGGER.warn("The setting to remove with the id \"{}\" does not exist in the config.", id); return false; } else if (setting.hasSubscribers()) { LOGGER.warn("The setting with the id \"{}\" still has subscribers and cannot be removed.", id); return false; } settingMap.remove(id); return true; }

Target:
public boolean remove(SimpleUri id) { Setting setting = get(id); if (setting == null) { LOGGER.warn("Setting \"{}\" does not exist.", id); return false; } else if (setting.hasSubscribers()) { LOGGER.warn("Setting \"{}\" cannot be removed while it has subscribers.", id); return false; } settingMap.remove(id); return true; }