auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map getGuestOsInto(){ Map resultMap = map(); resultMap.put("kernel","2.6.32-642.el6.x86_64"); resultMap.put("type", "linux"); resultMap.put("version", "6.7"); resultMap.put("arch", "x86_64"); resultMap.put("codename", "Santiago"); resultMap.put("distribution", "Red Hat Enterprise Linux Server"); return resultMap; }

Target:
private <T, U> Map<T, U> getGuestOsInto(){ Map resultMap = map(); resultMap.put("kernel","2.6.32-642.el6.x86_64"); resultMap.put("type", "linux"); resultMap.put("version", "6.7"); resultMap.put("arch", "x86_64"); resultMap.put("codename", "Santiago"); resultMap.put("distribution", "Red Hat Enterprise Linux Server"); return resultMap; }
Source:
public void testValidateOverlapWithOtherPools( String range1From, String range1To, String range2From, String range2To, boolean overlapping) { MacRange range1 = new MacRange(); range1.setMacFrom(range1From); range1.setMacTo(range1To); MacRange range2 = new MacRange(); range2.setMacFrom(range2From); range2.setMacTo(range2To); command.getParameters().getMacPool().setId(Guid.newGuid()); command.getParameters().getMacPool().setName("p1"); command.getParameters().getMacPool().setRanges(Collections.singletonList(range1)); MacPool macPool2 = new MacPool(); macPool2.setId(Guid.newGuid()); macPool2.setName("p2"); macPool2.setRanges(Collections.singletonList(range2)); when(macPoolDao.getAll()).thenReturn(Collections.singletonList(macPool2)); MacPool oldMacPool = new MacPool(); oldMacPool.setId(Guid.newGuid()); when(macPoolDao.get(any())).thenReturn(oldMacPool); when(macPoolPerCluster.isDuplicateMacAddressesAllowed(any())).thenReturn(false); assertEquals(!overlapping, command.validate()); }

Target:
public void testValidateOverlapWithOtherPools( String range1From, String range1To, String range2From, String range2To, boolean overlapping) { MacRange range1 = new MacRange(); range1.setMacFrom(range1From); range1.setMacTo(range1To); MacRange range2 = new MacRange(); range2.setMacFrom(range2From); range2.setMacTo(range2To); command.getParameters().getMacPool().setRanges(Collections.singletonList(range1)); MacPool macPool2 = new MacPool(); macPool2.setId(Guid.newGuid()); macPool2.setName("p2"); macPool2.setRanges(Collections.singletonList(range2)); when(macPoolDao.getAll()).thenReturn(Collections.singletonList(macPool2)); MacPool oldMacPool = new MacPool(); oldMacPool.setId(Guid.newGuid()); when(macPoolDao.get(any())).thenReturn(oldMacPool); when(macPoolPerCluster.isDuplicateMacAddressesAllowed(any())).thenReturn(false); assertEquals(!overlapping, command.validate()); }
Source:
protected boolean shouldSkip() { if (super.shouldSkip()) { return true; } String principal = null; InstancedConfiguration conf = InstancedConfiguration.defaults(); if (conf.isSet(mPrincipalProperty)) { principal = conf.get(mPrincipalProperty); } if (principal == null || principal.isEmpty()) { System.out.format("Skip validation for secure HDFS. %s is not specified.%n", PRINCIPAL_MAP.get(mProcess).getName()); return true; } return false; }

Target:
protected boolean shouldSkip() { if (super.shouldSkip()) { return true; } String principal = null; if (mConf.isSet(mPrincipalProperty)) { principal = mConf.get(mPrincipalProperty); } if (principal == null || principal.isEmpty()) { System.out.format("Skip validation for secure HDFS. %s is not specified.%n", PRINCIPAL_MAP.get(mProcess).getName()); return true; } return false; }
Source:
private void parseAndInitializeRegkeyFromRequest() { String regkeyFromRequest = getRequestParamValue(Const.ParamsNames.REGKEY); if (regkeyFromRequest != null && regkeyFromRequest.contains("${amp}" + Const.ParamsNames.NEXT_URL + "=")) { String[] split = regkeyFromRequest.split("\\$\\{amp\\}" + Const.ParamsNames.NEXT_URL + "="); regkey = split[0]; nextUrlFromRegkey = SanitizationHelper.desanitizeFromNextUrl(split[1]); } else { regkey = regkeyFromRequest; nextUrlFromRegkey = null; } }

Target:
private void parseAndInitializeRegkeyFromRequest() { String regkeyFromRequest = getRegkeyFromRequest(); boolean isNextParamInRegkey = regkeyFromRequest != null && regkeyFromRequest.contains("${amp}" + Const.ParamsNames.NEXT_URL + "="); if (isNextParamInRegkey) { String[] split = regkeyFromRequest.split("\\$\\{amp\\}" + Const.ParamsNames.NEXT_URL + "="); regkey = split[0]; nextUrlFromRegkey = SanitizationHelper.desanitizeFromNextUrl(split[1]); } else { regkey = regkeyFromRequest; nextUrlFromRegkey = null; } }
Source:
public void loadsFromDbOnCacheMissTest() throws Exception { EventTypeCache etc = new EventTypeCache(dbRepo, client); EventType et = buildEventType(); Mockito .doReturn(et) .when(dbRepo) .findByName(et.getName()); etc.get(et.getName()); etc.get(et.getName()); verify(dbRepo, times(1)).findByName(et.getName()); }

Target:
public void loadsFromDbOnCacheMissTest() throws Exception { final EventTypeCache etc = new EventTypeCache(dbRepo, client); final EventType et = buildEventType(); Mockito .doReturn(et) .when(dbRepo) .findByName(et.getName()); assertThat(etc.get(et.getName()), equalTo(et)); assertThat(etc.get(et.getName()), equalTo(et)); verify(dbRepo, times(1)).findByName(et.getName()); }
Source:
private String getBody() throws IOException { String jobID = jobState.getId().value(); String status = jobState.getStatus().toString(); String hostname = "UNKNOWN"; List<TaskState> tasks = jobState.getTasks(); String allTaskStatusesString = String.join(System.lineSeparator(), tasks.stream() .map(task -> task.getId().getReadableName() + " (" + task.getId().toString() + ") Status: " + task.getStatus().toString()) .collect(Collectors.toList())); try { hostname = InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException e) { logger.debug("Could not get hostname", e); } final Properties properties = EmailConfiguration.getConfiguration().getProperties(); String templatePath = properties.getProperty(EmailConfiguration.TEMPLATE_PATH); String bodyTemplate = new String(Files.readAllBytes(Paths.get(PASchedulerProperties.getAbsolutePath(templatePath)))); return String.format(bodyTemplate, jobID, status, allTaskStatusesString, hostname); }

Target:
private String getBody() throws IOException { String jobID = jobState.getId().value(); String status = jobState.getStatus().toString(); String hostname = "UNKNOWN"; List<TaskState> tasks = jobState.getTasks(); String allTaskStatusesString = String.join(System.lineSeparator(), tasks.stream() .map(task -> task.getId().getReadableName() + " (" + task.getId().toString() + ") Status: " + task.getStatus().toString()) .collect(Collectors.toList())); try { hostname = InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException e) { logger.debug("Could not get hostname", e); } final Properties properties = EmailConfiguration.getConfiguration().getProperties(); String templatePath = properties.getProperty(EmailConfiguration.TEMPLATE_PATH); String bodyTemplate = Files.toString(new File(PASchedulerProperties.getAbsolutePath(templatePath)), Charset.defaultCharset()); Map<String, String> values = new HashMap<>(); values.put("JOB_ID", jobID); values.put("JOB_STATUS", status); values.put("JOB_TASKS", allTaskStatusesString); values.put("HOST_NAME", hostname); String emailBody = StrSubstitutor.replace(bodyTemplate, values, "%", "%"); return emailBody; }
Source:
private void writeRecordsToFile ( final List<SAMRecord> recs, final File targetFile, final File referenceFile, final SAMFileHeader samHeader) throws IOException { try (final SAMFileWriter writer = new SAMFileWriterFactory() .makeWriter(samHeader, true, targetFile, referenceFile)) { for (SAMRecord rec : recs) { writer.addAlignment(rec); } } }

Target:
private void writeRecordsToFile ( final List<SAMRecord> recs, final File targetFile, final File referenceFile, final SAMFileHeader samHeader) { try (final SAMFileWriter writer = new SAMFileWriterFactory() .makeWriter(samHeader, true, targetFile, referenceFile)) { for (SAMRecord rec : recs) { writer.addAlignment(rec); } } }
Source:
public boolean mightContain(Write write) { Locks.lockIfCondition(pageLock.readLock(), this == currentPage); try { boolean mightContain; Type valueType = write.getValue().getType(); if (filter.mightContain(write.getRecord(), write.getKey(), write.getValue())) { mightContain = true; } else if (valueType == Type.STRING) { mightContain = filter.mightContain( write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift(Tag .create((String) write.getValue() .getObject())))); } else if (valueType == Type.TAG) { mightContain = filter.mightContain( write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift(write .getValue().getObject().toString()))); } else { mightContain = false; } return mightContain; } finally { Locks.unlockIfCondition(pageLock.readLock(), this == currentPage); } }

Target:
public boolean mightContain(Write write) { Locks.lockIfCondition(pageLock.readLock(), this == currentPage); try { Type valueType = write.getValue().getType(); if (filter.mightContain(write.getRecord(), write.getKey(), write.getValue())) { return true; } else if (valueType == Type.STRING) { return filter.mightContain( write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift(Tag .create((String) write.getValue() .getObject())))); } else if (valueType == Type.TAG) { return filter.mightContain( write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift(write .getValue().getObject().toString()))); } else { return false; } } finally { Locks.unlockIfCondition(pageLock.readLock(), this == currentPage); } }
Source:
public UUID getUniqueId() { Entity spongeEntity = (Entity)this; net.minecraft.entity.Entity thisEntity = (net.minecraft.entity.Entity)spongeEntity; return thisEntity.getUniqueID(); }

Target:
public UUID getUniqueId() { return this.getUniqueID(); }
Source:
private FutureVDSCall<VDSReturnValue> invokeSetupNetworksCommand(int timeout) { final HostSetupNetworksVdsCommandParameters parameters = createSetupNetworksParameters(timeout); FutureVDSCall<VDSReturnValue> setupNetworksTask = getVdsBroker().runFutureVdsCommand(FutureVDSCommandType.HostSetupNetworks, parameters); if (parameters.isRollbackOnFailure()) { HostSetupNetworkPoller poller = new HostSetupNetworkPoller(); boolean taskCompleted = poller.pollWhileWaitingForTaskCompletionWithDefaultTimeout(setupNetworksTask, getVdsId()); if (!taskCompleted) { throw new RuntimeException("Give up waiting for task to complete"); } } return setupNetworksTask; }

Target:
private FutureVDSCall<VDSReturnValue> invokeSetupNetworksCommand(int timeout) { final HostSetupNetworksVdsCommandParameters parameters = createSetupNetworksParameters(timeout); FutureVDSCall<VDSReturnValue> setupNetworksTask = getVdsBroker().runFutureVdsCommand(FutureVDSCommandType.HostSetupNetworks, parameters); if (parameters.isRollbackOnFailure()) { HostSetupNetworkPoller poller = new HostSetupNetworkPoller(); boolean taskCompleted = poller.pollWhileWaitingForTaskCompletion(setupNetworksTask, getVdsId(), TimeUnit.MINUTES.toMillis(3)); if (!taskCompleted) { throw new RuntimeException("Give up waiting for task to complete"); } } return setupNetworksTask; }
Source:
public long getIgnoredPlayerTimeout(UUID uuid) { return ignoredPlayerTimeouts.get(uuid); }

Target:
public Long getIgnoredPlayerTimeout(UUID uuid) { return ignoredPlayerTimeouts.get(uuid); }
Source:
public static void main(String[] args) throws Exception { String mode = args[0]; Map<String,Object> configMap = Util.createConfig(args); TStream<Bargain> bargains = createVwapTopology(); bargains.print(); StreamsContext<?> sc = StreamsContextFactory.getStreamsContext(mode); sc.submit(bargains.topology(), configMap).get(); }

Target:
public static void main(String[] args) throws Exception { String type = args[0]; Map<String,Object> configMap = Util.createConfig(args); TStream<Bargain> bargains = createVwapTopology(); bargains.print(); StreamsContext<?> sc = StreamsContextFactory.getStreamsContext(type); sc.submit(bargains.topology(), configMap).get(); }
Source:
public void run() { try { while (isOpen.get()) { List<RequestInfo> requestInfoList = pollForRequests(); List<ResponseInfo> responseInfoList = networkClient.sendAndPoll(requestInfoList); onResponse(responseInfoList); } } catch (Exception e) { logger.error("RequestResponseHandlerThread received exception: ", e); } finally { networkClient.close(); shutDownLatch.countDown(); cleanup(); } }

Target:
public void run() { try { while (isOpen.get()) { List<RequestInfo> requestInfoList = pollForRequests(); List<ResponseInfo> responseInfoList = networkClient.sendAndPoll(requestInfoList); onResponse(responseInfoList); } } catch (Exception e) { logger.error("Aborting, as requestResponseHandlerThread received an exception: ", e); } finally { networkClient.close(); shutDownLatch.countDown(); doClose(); } }
Source:
public Format getFormat(String formatName) { for (FormatType mFormatType : mFormatTypes) { for (Format format : mFormatType.getFormatList()) { if(format.getName().equals(formatName)) { return format; } } } return null; }

Target:
public Format getFormat(String formatName) { for (FormatType formatType : mFormatTypes) { for (Format format : formatType.getFormatList()) { if(format.getName().equals(formatName)) { return format; } } } return null; }
Source:
public int markAsAuthoritative(final Path dest, final BulkOperationState operationState) throws IOException { if (operationState == null) { return 0; } AncestorState state = (AncestorState)operationState; final String simpleDestKey = pathToParentKey(dest); final String destPathKey = simpleDestKey + "/"; final String opId = AncestorState.stateAsString(state); LOG.debug("{}: marking directories under as authoritative", opId, destPathKey); final List<DDBPathMetadata> dirsToUpdate = new ArrayList<>(); synchronized (state) { for (Map.Entry<Path, DDBPathMetadata> entry : state.getAncestry().entrySet()) { final Path path = entry.getKey(); final DDBPathMetadata md = entry.getValue(); final String key = pathToParentKey(path); if (md.getFileStatus().isDirectory() && (key.equals(simpleDestKey) || key.startsWith(destPathKey))) { md.setAuthoritativeDir(true); md.setLastUpdated(ttlTimeProvider.getNow()); LOG.debug("{}: added {}", opId, key); dirsToUpdate.add(md); } } processBatchWriteRequest(state, null, pathMetadataToItem(dirsToUpdate)); } return dirsToUpdate.size(); }

Target:
public int markAsAuthoritative( final Path dest, final BulkOperationState operationState) throws IOException { if (operationState == null) { return 0; } Preconditions.checkArgument(operationState instanceof AncestorState, "Not an AncestorState %s", operationState); final AncestorState state = (AncestorState)operationState; final String simpleDestKey = pathToParentKey(dest); final String destPathKey = simpleDestKey + "/"; final String opId = AncestorState.stateAsString(state); LOG.debug("{}: marking directories under as authoritative", opId, destPathKey); final List<DDBPathMetadata> dirsToUpdate = new ArrayList<>(); synchronized (state) { for (Map.Entry<Path, DDBPathMetadata> entry : state.getAncestry().entrySet()) { final Path path = entry.getKey(); final DDBPathMetadata md = entry.getValue(); final String key = pathToParentKey(path); if (md.getFileStatus().isDirectory() && (key.equals(simpleDestKey) || key.startsWith(destPathKey))) { md.setAuthoritativeDir(true); md.setLastUpdated(ttlTimeProvider.getNow()); LOG.debug("{}: added {}", opId, key); dirsToUpdate.add(md); } } processBatchWriteRequest(state, null, pathMetadataToItem(dirsToUpdate)); } return dirsToUpdate.size(); }
Source:
public Signature getCoercion(Type fromType, Type toType) { try { return globalFunctionNamespace.getCoercion(fromType, toType); } catch (PrestoException e) { if (!(e instanceof OperatorNotFoundException)) { throw e; } } throw new OperatorNotFoundException(OperatorType.CAST, ImmutableList.of(fromType.getTypeSignature()), toType.getTypeSignature()); }

Target:
public Signature getCoercion(Type fromType, Type toType) { return getCoercion(fromType.getTypeSignature(), toType.getTypeSignature()); }
Source:
private void holdExistingPartialPools(final Collection<Run> runs, final Collection<Pool<LibraryDilution>> pools) throws IOException { for (Run newRun : runs) { if (newRun.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Migrating run %s has unexpected number of sequencerPartitionContainers (%d)", newRun.getAlias(), newRun.getSequencerPartitionContainers().size())); } Run existingRun = serviceManager.getRunDao().getByAlias(newRun.getAlias()); if (existingRun != null) { if (existingRun.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Existing run %s has unexpected number of sequencerPartitionContainers (%d)", existingRun.getAlias(), existingRun.getSequencerPartitionContainers().size())); } SequencerPartitionContainer<SequencerPoolPartition> existingLanes = existingRun.getSequencerPartitionContainers().get(0); for (SequencerPoolPartition newLane : newRun.getSequencerPartitionContainers().get(0).getPartitions()) { Pool<?> existingPool = null; for (SequencerPoolPartition lane : existingLanes.getPartitions()) { if (lane.getPartitionNumber() == newLane.getPartitionNumber()) { existingPool = lane.getPool(); } } if (newLane.getPool() != null && existingPool != null) { log.debug(String.format("Holding pool %s from run %s lane %d to merge with existing pool", newLane.getPool().getAlias(), newRun.getAlias(), newLane.getPartitionNumber())); pools.remove(newLane.getPool()); } } } } }

Target:
private void holdExistingPartialPools(final Collection<Run> runs, final Collection<Pool<LibraryDilution>> pools) throws IOException { for (Run newRun : runs) { if (newRun.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Migrating run %s has unexpected number of sequencerPartitionContainers (%d)", newRun.getAlias(), newRun.getSequencerPartitionContainers().size())); } Run existingRun = serviceManager.getRunDao().getByAlias(newRun.getAlias()); if (existingRun != null) { if (existingRun.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Existing run %s has unexpected number of sequencerPartitionContainers (%d)", existingRun.getAlias(), existingRun.getSequencerPartitionContainers().size())); } SequencerPartitionContainer<SequencerPoolPartition> existingLanes = existingRun.getSequencerPartitionContainers().get(0); for (SequencerPoolPartition newLane : newRun.getSequencerPartitionContainers().get(0).getPartitions()) { Pool<?> existingPool = null; for (SequencerPoolPartition existingLane : existingLanes.getPartitions()) { if (existingLane.getPartitionNumber() == newLane.getPartitionNumber()) { existingPool = existingLane.getPool(); } } if (newLane.getPool() != null && existingPool != null) { log.debug(String.format("Holding pool %s from run %s lane %d to merge with existing pool", newLane.getPool().getAlias(), newRun.getAlias(), newLane.getPartitionNumber())); pools.remove(newLane.getPool()); } } } } }
Source:
public void testGetJobOutput() throws IOException { assertThat(ByteSources.asByteSource(api.getJobOutput(VAULT_NAME, archiveRetrievalJob).openStream())) .hasSameContentAs(buildData(PART_SIZE * 2 * MiB)); }

Target:
public void testGetJobOutput() throws IOException { Closer closer = Closer.create(); try { InputStream inputStream = closer.register(api.getJobOutput(VAULT_NAME, archiveRetrievalJob).openStream()); InputStream expectedInputStream = closer.register(buildData(PART_SIZE * 2 * MiB).openStream()); assertThat(inputStream).hasContentEqualTo(expectedInputStream); } finally { closer.close(); } }
Source:
void fetchReplies(Long topicId2, final long start, final long count) { ForumService service = ServiceCreator.createForumService(); final GetRepliesRequest input = new GetRepliesRequest(); input.accessCode = ACCESS_CODE; input.session = SessionController.get().getSessionForApiCall(); input.topic = new Topic(); input.topic.id = topicId; final Pager pager = new Pager(); pager.count = count; pager.start = start == 0 ? 0 : start - 1; pager.sortDirection = SortDirectionType.SortDirectionTypeAscending; pager.sortBy = "created"; input.pager = pager; service.getReplies(input, new AsyncCallback<GetRepliesResponse>() { @Override public void onSuccess(GetRepliesResponse output) { if (output.status == StatusType.StatusTypeSuccess) { if (output.replies != null) { replies.addAll(output.replies); long i = start == 0 ? 1 : start; for (Reply reply : output.replies) { Topic topic = input.topic; int replyId = reply.id.intValue(); addForumMessage((int) i, reply, topic, replyId); i++; } } } EventController.get().fireEventFromSource(new GetRepliesSuccess(input, output), replyController); } @Override public void onFailure(Throwable caught) { EventController.get().fireEventFromSource(new GetRepliesFailure(input, caught), replyController); } }); }

Target:
void fetchReplies(Long topicId2, final long start, final long count) { ForumService service = ServiceCreator.createForumService(); final GetRepliesRequest input = new GetRepliesRequest(); input.accessCode = ACCESS_CODE; input.session = SessionController.get().getSessionForApiCall(); input.topic = new Topic(); input.topic.id = topicId; final Pager pager = new Pager(); pager.count = count; pager.start = start == 0 ? Long.valueOf(0) : Long.valueOf(start - 1); pager.sortDirection = SortDirectionType.SortDirectionTypeAscending; pager.sortBy = "created"; input.pager = pager; service.getReplies(input, new AsyncCallback<GetRepliesResponse>() { @Override public void onSuccess(GetRepliesResponse output) { if (output.status == StatusType.StatusTypeSuccess) { if (output.replies != null) { replies.addAll(output.replies); long i = start == 0 ? Long.valueOf(1) : Long.valueOf(start); for (Reply reply : output.replies) { Topic topic = input.topic; int replyId = reply.id.intValue(); addForumMessage((int) i, reply, topic, replyId); i++; } } } EventController.get().fireEventFromSource(new GetRepliesSuccess(input, output), replyController); } @Override public void onFailure(Throwable caught) { EventController.get().fireEventFromSource(new GetRepliesFailure(input, caught), replyController); } }); }
Source:
BundleContext getBundleContext() { Bundle bundle = FrameworkUtil.getBundle(CatalogServiceImpl.class); return bundle.getBundleContext(); }

Target:
BundleContext getBundleContext() { Bundle bundle = FrameworkUtil.getBundle(CatalogServiceImpl.class); return bundle == null ? null : bundle.getBundleContext(); }
Source:
static List<EntryElement> makeEntryElementList(Object... value) { List<EntryElement> valueElements = new ArrayList<EntryElement>(); for (Object o : value) { Class<?> type = ClassUtils.primitiveToWrapper(o.getClass()); EntryElement entryElement = new EntryElement(type.getName(), o.toString()); valueElements.add(entryElement); } return valueElements; }

Target:
public static List<EntryElement> makeEntryElementList(Object... value) { List<EntryElement> valueElements = new ArrayList<EntryElement>(); for (Object o : value) { Class<?> type = ClassUtils.primitiveToWrapper(o.getClass()); EntryElement entryElement = new EntryElement(type.getName(), o.toString()); valueElements.add(entryElement); } return valueElements; }
Source:
public String getDescription() { final String desc = getGenericFieldValue("Description"); return ( StringUtil.isBlank(desc) ? getID() : desc ); }

Target:
public String getDescription() { return getGenericFieldValue("Description"); }
Source:
public void break_in_try_finally() { final CFG cfg = buildCFG("void fun() { while (foo()) {\n" + " try {\n" + " bar(\"try\");\n" + " break;\n" + " } finally {\n" + " qix(\"finally\");\n" + " }\n" + " }}"); final CFGChecker cfgChecker = checker( block( element(IDENTIFIER, "foo"), element(METHOD_INVOCATION) ).terminator(WHILE_STATEMENT).successors(0, 4), block(element(TRY_STATEMENT)).successors(3), block( element(Tree.Kind.IDENTIFIER, "bar"), element(STRING_LITERAL, "try"), element(METHOD_INVOCATION) ).successors(2).exceptions(1), new BlockChecker(BREAK_STATEMENT, 1).hasNoExitBlock(), block(element(IDENTIFIER, "qix"), element(STRING_LITERAL, "finally"), element(METHOD_INVOCATION) ).successors(0) ); cfgChecker.check(cfg); }

Target:
public void break_in_try_finally() { final CFG cfg = buildCFG("void fun() { while (foo()) {\n" + " try {\n" + " bar(\"try\");\n" + " break;\n" + " } finally {\n" + " qix(\"finally\");\n" + " }\n" + " }}"); final CFGChecker cfgChecker = checker( block( element(IDENTIFIER, "foo"), element(METHOD_INVOCATION) ).terminator(WHILE_STATEMENT).successors(0, 4), block(element(TRY_STATEMENT)).successors(3), block( element(Tree.Kind.IDENTIFIER, "bar"), element(STRING_LITERAL, "try"), element(METHOD_INVOCATION) ).successors(2).exceptions(1), terminator(BREAK_STATEMENT, 1).hasNoExitBlock(), block(element(IDENTIFIER, "qix"), element(STRING_LITERAL, "finally"), element(METHOD_INVOCATION) ).successors(0) ); cfgChecker.check(cfg); }
Source:
public String fileName() { return null; }

Target:
@Override public String fileName() { return null; }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { StringBuilder message = new StringBuilder(); String regionName = Application.get().getCurrentRegion().getName(); message.append(getResources().getString(R.string.region_dialog_Message2, regionName)).append("?"); AlertDialog dialog = new AlertDialog.Builder(getActivity()) .setMessage(message.toString()) .setPositiveButton("YES", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { ((ReportActivity) getActivity()).createIssueTypeListFragment(); } }) .setNegativeButton("NO", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { closeSuperActivity(); ((ReportActivity) getActivity()).createPreferencesActivity(); } }).create(); dialog.setCanceledOnTouchOutside(false); return dialog; }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { StringBuilder message = new StringBuilder(); String regionName = Application.get().getCurrentRegion().getName(); message.append(getResources().getString(R.string.region_dialog_message, regionName)).append("?"); AlertDialog dialog = new AlertDialog.Builder(getActivity()) .setMessage(message.toString()) .setPositiveButton("YES", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { ((ReportActivity) getActivity()).createIssueTypeListFragment(); } }) .setNegativeButton("NO", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { closeSuperActivity(); ((ReportActivity) getActivity()).createPreferencesActivity(); } }).create(); dialog.setCanceledOnTouchOutside(false); return dialog; }
Source:
private Blob getBlobFromMCCIIN000002UV01(final MCCIIN000002UV01 ack) { Blob asyncMessage = null; try { final JAXBContextHandler oHandler = new JAXBContextHandler(); final JAXBContext jc = oHandler.getJAXBContext("org.hl7.v3"); final Marshaller marshaller = jc.createMarshaller(); final ByteArrayOutputStream baOutStrm = new ByteArrayOutputStream(); baOutStrm.reset(); final org.hl7.v3.ObjectFactory factory = new org.hl7.v3.ObjectFactory(); final PIXConsumerMCCIIN000002UV01RequestType request = factory .createPIXConsumerMCCIIN000002UV01RequestType(); request.setMCCIIN000002UV01(ack); final JAXBElement<PIXConsumerMCCIIN000002UV01RequestType> oJaxbElement = factory .createPIXConsumerMCCIIN000002UV01Request(request); baOutStrm.close(); marshaller.marshal(oJaxbElement, baOutStrm); final byte[] buffer = baOutStrm.toByteArray(); asyncMessage = getSession().getLobHelper().createBlob(buffer); } catch (final Exception e) { LOG.error("Exception during Blob conversion :" + e.getMessage(), e); } return asyncMessage; }

Target:
private Blob getBlobFromMCCIIN000002UV01(final MCCIIN000002UV01 ack) { Blob asyncMessage = null; try { final JAXBContextHandler oHandler = new JAXBContextHandler(); final JAXBContext jc = oHandler.getJAXBContext("org.hl7.v3"); final Marshaller marshaller = jc.createMarshaller(); final ByteArrayOutputStream baOutStrm = new ByteArrayOutputStream(); baOutStrm.reset(); final org.hl7.v3.ObjectFactory factory = new org.hl7.v3.ObjectFactory(); final PIXConsumerMCCIIN000002UV01RequestType request = factory .createPIXConsumerMCCIIN000002UV01RequestType(); request.setMCCIIN000002UV01(ack); final JAXBElement<PIXConsumerMCCIIN000002UV01RequestType> oJaxbElement = factory .createPIXConsumerMCCIIN000002UV01Request(request); baOutStrm.close(); marshaller.marshal(oJaxbElement, baOutStrm); final byte[] buffer = baOutStrm.toByteArray(); asyncMessage = getSession().getLobHelper().createBlob(buffer); getSession().close(); } catch (final Exception e) { LOG.error("Exception during Blob conversion :" + e.getMessage(), e); } return asyncMessage; }
Source:
public OffsetDateTime getExpiresOn() { if (this.expiresOn == null) { return null; } return this.expiresOn; }

Target:
public OffsetDateTime getExpiresOn() { return this.expiresOn; }
Source:
public Authentication getGerritAuthentication() { return new Authentication(gerritAuthKeyFile, gerritUserName, Secret.toString(gerritAuthKeyFilePassword)); }

Target:
public Authentication getGerritAuthentication() { return new Authentication(gerritAuthKeyFile, gerritUserName, getGerritAuthKeyFilePassword()); }
Source:
public void shouldBeCaseInSensitiveOfColumnAndPropertyNames() throws Exception { expect(resultSetMetaData.getColumnCount()).andReturn(1).anyTimes(); expect(resultSetMetaData.getColumnLabel(1)).andReturn("LoNgfielD"); replay(resultSetMetaData); expect(ctx.columnMapperFor(Long.class)).andReturn(LongColumnMapper.WRAPPER); replay(ctx); expect(resultSet.getMetaData()).andReturn(resultSetMetaData); Long aLongVal = 100l; expect(resultSet.getLong(1)).andReturn(aLongVal); expect(resultSet.wasNull()).andReturn(false); replay(resultSet); SampleBean sampleBean = mapper.map(0, resultSet, ctx); assertSame(aLongVal, sampleBean.getLongField()); }

Target:
public void shouldBeCaseInSensitiveOfColumnAndPropertyNames() throws Exception { expect(resultSetMetaData.getColumnCount()).andReturn(1).anyTimes(); expect(resultSetMetaData.getColumnLabel(1)).andReturn("LoNgfielD"); replay(resultSetMetaData); expect(ctx.columnMapperFor(Long.class)).andReturn(LongColumnMapper.WRAPPER); replay(ctx); expect(resultSet.getMetaData()).andReturn(resultSetMetaData); Long aLongVal = 100l; expect(resultSet.getLong(1)).andReturn(aLongVal); expect(resultSet.wasNull()).andReturn(false); replay(resultSet); SampleBean sampleBean = mapper.map(0, resultSet, ctx); assertEquals(aLongVal, sampleBean.getLongField()); }
Source:
public int revokeAllEntitlements(Consumer consumer) { List<Entitlement> entsToDelete = entitlementCurator.listByConsumer(consumer); revokeEntitlements(entsToDelete); return entsToDelete.size(); }

Target:
public int revokeAllEntitlements(Consumer consumer) { return revokeAllEntitlements(consumer, true); }
Source:
public B2ResponseException(HttpCommand command, HttpResponse response, B2Error error) { super("request " + command.getCurrentRequest().getRequestLine() + " failed with code " + response.getStatusCode() + ", error: " + error.toString(), command, response); this.error = checkNotNull(error, "error"); }

Target:
public B2ResponseException(HttpCommand command, HttpResponse response, B2Error error) { super("request " + command.getCurrentRequest().getRequestLine() + " failed with code " + response.getStatusCode() + ", error: " + Preconditions.checkNotNull(error, "error").toString(), command, response); this.error = error; }
Source:
public Object run(){ RequestContext ctx = RequestContext.getCurrentContext(); HttpServletResponse response = ctx.getResponse(); HttpServletRequest request = ctx.getRequest(); Policy policy = findRequestPolicy(request); String key = findKey(request); Rate rate = limiter.consume(policy, key); response.setHeader(Headers.LIMIT, rate.getLimit().toString()); response.setHeader(Headers.REMAINING, Math.max(rate.getRemaining(), 0) + ""); response.setHeader(Headers.RESET, rate.getReset().toString()); if (rate.getRemaining() <= 0) { ctx.setResponseStatusCode(429); ctx.put("warning","on"); throw new RuntimeException(""); } return null; }

Target:
public Object run(){ RequestContext ctx = RequestContext.getCurrentContext(); HttpServletResponse response = ctx.getResponse(); HttpServletRequest request = ctx.getRequest(); Policy policy = findRequestPolicy(request); String key = findKey(request); Rate rate = limiter.consume(policy, key); response.setHeader(Headers.LIMIT, rate.getLimit().toString()); response.setHeader(Headers.REMAINING, String.valueOf(Math.max(rate.getRemaining(), 0))); response.setHeader(Headers.RESET, rate.getReset().toString()); if (rate.getRemaining() <= 0) { ctx.setResponseStatusCode(429); ctx.put("rateLimitExceeded","true"); throw new RuntimeException(""); } return null; }
Source:
public WorkflowStepPrompt getStep(int stepNumber) { if (stepNumber == 0) { return stockStep.getPrompt(); } else if (stepNumber == 1) { return qcStep.getPrompt(); } else if (stepNumber == 2) { return stockBoxStep.getPrompt(); } else if (stepNumber == 3) { return stockBoxPositionStep.getPrompt(); } else if (stepNumber == 4) { return aliquotStep.getPrompt(); } else if (stepNumber == 5) { return aliquotBoxStep.getPrompt(); } else { return aliquotHandlingSteps.get(asAliquotIndex(stepNumber)).getPrompt(); } }

Target:
public WorkflowStepPrompt getStep(int stepNumber) { switch (stepNumber) { case 0: return stockStep.getPrompt(); case 1: return qcStep.getPrompt(); case 2: return stockBoxStep.getPrompt(); case 3: return stockBoxPositionStep.getPrompt(); case 4: return aliquotStep.getPrompt(); case 5: return aliquotBoxStep.getPrompt(); default: return aliquotHandlingSteps.get(asAliquotIndex(stepNumber)).getPrompt(); } }
Source:
public VDS activate() { VDS vds = null; try { log.debugFormat( "Trying to activate host {0} , meanwhile setting status to Unassigned.", getVdsId()); vds = DbFacade.getInstance().getVdsDao().get(getVdsId()); VDSStatus newStatus = refreshCapabilities(new AtomicBoolean(), vds, true); if (log.isDebugEnabled()) { log.debugFormat( "Succeeded to refreshCapabilities for host {0} , new status will be {1} ", getVdsId(), newStatus); } if (vds.getTrustedService()){ List <String> hosts = new ArrayList<String> (); hosts.add(vds.getHostName()); AttestationValue value = AttestationService.getInstance().attestHosts(hosts).get(0); AttestationCacheManager.getInstance().updateCache(value); if (value.getTrustLevel() == AttestationResultEnum.TRUSTED) { vds.setStatus(VDSStatus.Up); } else { vds.setStatus(VDSStatus.NonOperational); } } } catch (java.lang.Exception e) { log.infoFormat("Failed to activate VDS = {0} with error: {1}.", getVdsId(), e.getMessage()); } finally { if (vds != null) { UpdateDynamicData(vds.getDynamicData()); monitoringStrategy.processHardwareCapabilities(vds); ResourceManager.getInstance().getEventListener().handleVdsVersion(vds.getId()); } } return vds; }

Target:
public VDS activate() { VDS vds = null; try { log.debugFormat( "Trying to activate host {0} , meanwhile setting status to Unassigned.", getVdsId()); vds = DbFacade.getInstance().getVdsDao().get(getVdsId()); VDSStatus newStatus = refreshCapabilities(new AtomicBoolean(), vds, true); if (log.isDebugEnabled()) { log.debugFormat( "Succeeded to refreshCapabilities for host {0} , new status will be {1} ", getVdsId(), newStatus); } } catch (java.lang.Exception e) { log.infoFormat("Failed to activate VDS = {0} with error: {1}.", getVdsId(), e.getMessage()); } finally { if (vds != null) { UpdateDynamicData(vds.getDynamicData()); monitoringStrategy.processHardwareCapabilities(vds); ResourceManager.getInstance().getEventListener().handleVdsVersion(vds.getId()); } } return vds; }
Source:
private Tuple2<Integer, Set<String>> deleteBundleByIdentifier(final DeleteBundlesByIdentifierForm deleteBundlesByIdentifierForm, final InitDataObject initData) throws DotDataException { int successCount = 0; final Set<String> fails = new LinkedHashSet<>(); for (final String bundleId : deleteBundlesByIdentifierForm.getIdentifiers()) { try { this.bundleAPI.deleteBundleAndDependencies(bundleId, initData.getUser()); successCount++; } catch (Exception e) { fails.add(bundleId); } } return Tuple.of(successCount, fails); }

Target:
private Tuple2<Integer, Set<String>> deleteBundleByIdentifier(final DeleteBundlesByIdentifierForm deleteBundlesByIdentifierForm, final InitDataObject initData) throws DotDataException { int successCount = 0; final Set<String> fails = new LinkedHashSet<>(); for (final String bundleId : deleteBundlesByIdentifierForm.getIdentifiers()) { try { this.bundleAPI.deleteBundleAndDependencies(bundleId, initData.getUser()); successCount++; } catch (Exception e) { Logger.debug(this,"Exception on deleting bundle with id: " + bundleId,e); fails.add(bundleId); } } return Tuple.of(successCount, fails); }
Source:
public void apply() { clickButton("Apply"); elasticSleep(1000); assertThat(driver, hasContent("Saved")); }

Target:
public void apply() { clickButton("Apply"); waitFor(driver, hasContent("Saved"), 5); }
Source:
public TDHttpClient(TDClientConfig config) { this.config = config; ClientConfig httpConfig = new ClientConfig(); httpConfig.connectorProvider(new JettyConnectorProvider()); httpConfig .property(ClientProperties.CONNECT_TIMEOUT, config.getConnectTimeoutMillis()) .property(ClientProperties.READ_TIMEOUT, config.getConnectTimeoutMillis()); httpConfig.property(JettyClientProperties.DISABLE_COOKIES, true); httpConfig.property(ClientProperties.ASYNC_THREADPOOL_SIZE, config.getConnectionPoolSize()); if (config.getProxy().isPresent()) { ProxyConfig proxyConfig = config.getProxy().get(); logger.trace("proxy configuration: " + proxyConfig); httpConfig.property(ClientProperties.PROXY_URI, proxyConfig.getUri()); } this.objectMapper = new ObjectMapper() .registerModule(new JsonOrgModule()) .registerModule(new GuavaModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); this.httpClient = ClientBuilder.newClient(httpConfig); }

Target:
public TDHttpClient(TDClientConfig config) { this.config = config; this.httpClient = config.isUseSSL() ? new HttpClient(new SslContextFactory()) : new HttpClient(); httpClient.setConnectTimeout(config.getConnectTimeoutMillis()); httpClient.setIdleTimeout(config.getIdleTimeoutMillis()); httpClient.setTCPNoDelay(true); httpClient.setExecutor(new QueuedThreadPool(config.getConnectionPoolSize(), 2)); httpClient.setCookieStore(new HttpCookieStore.Empty()); httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, "td-client-java-" + TDClient.getVersion())); if (config.getProxy().isPresent()) { final ProxyConfig proxyConfig = config.getProxy().get(); logger.trace("proxy configuration: " + proxyConfig); HttpProxy httpProxy = new HttpProxy(new Origin.Address(proxyConfig.getHost(), proxyConfig.getPort()), proxyConfig.useSSL()); httpProxy.getExcludedAddresses().add(proxyConfig.getHost() + ":" + proxyConfig.getPort()); httpClient.getProxyConfiguration().getProxies().add(httpProxy); if (proxyConfig.requireAuthentication()) { httpClient.getAuthenticationStore().addAuthenticationResult(new ProxyAuthResult(proxyConfig)); } } this.objectMapper = new ObjectMapper() .registerModule(new JsonOrgModule()) .registerModule(new GuavaModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { httpClient.start(); } catch (Exception e) { logger.error("Failed to initialize Jetty client", e); throw Throwables.propagate(e); } }
Source:
public FluxSink<CoreEvent> get() { final FluxSinkRecorder<CoreEvent> sinkRef = new FluxSinkRecorder<>(); Flux<CoreEvent> onErrorFlux = Flux.create(sinkRef) .map(beforeRouting()) .concatMap(route()) .onErrorContinue(MessagingException.class, onRoutingError()) .map(afterRouting()) .doOnNext(result -> fireEndNotification(getOriginalEvent(result), result, getException(result))) .doOnNext(TemplateOnErrorHandler.this::resolveHandling); onErrorFlux.subscribe(); return sinkRef.getFluxSink(); }

Target:
public FluxSink<CoreEvent> get() { final FluxSinkRecorder<CoreEvent> sinkRef = new FluxSinkRecorder<>(); Flux<CoreEvent> onErrorFlux = Flux.create(sinkRef).map(beforeRouting()); if (!getMessageProcessors().isEmpty()) { onErrorFlux = onErrorFlux.compose(TemplateOnErrorHandler.this::route); } onErrorFlux = onErrorFlux .onErrorContinue(MessagingException.class, onRoutingError()) .map(afterRouting()) .doOnNext(result -> fireEndNotification(getOriginalEvent(result), result, getException(result))) .doOnNext(TemplateOnErrorHandler.this::resolveHandling); onErrorFlux.subscribe(); return sinkRef.getFluxSink(); }
Source:
public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() { try { Class<?> clazz = Class.forName("javafx.scene.text.Text$StyleableProperties"); Field styleablesField = clazz.getDeclaredField("STYLEABLES"); styleablesField.setAccessible(true); List<CssMetaData<? extends Styleable, ?>> styleables = (List<CssMetaData<? extends Styleable, ?>>) styleablesField.get(null); styleables = new ArrayList<>(styleables); styleables.add(StyleableProperties.BACKGROUND_COLOR); return styleables; } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } return null; }

Target:
public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() { List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(super.getCssMetaData()); styleables.add(StyleableProperties.BACKGROUND_FILL); return styleables; }
Source:
public Boolean delete( ProjectName projectName ) { return callWithContext( () -> { final Boolean result = doDelete( projectName ); LOG.info( "Project deleted: " + projectName ); return result; } ); }

Target:
public boolean delete( ProjectName projectName ) { return callWithContext( () -> { final boolean result = doDelete( projectName ); LOG.info( "Project deleted: " + projectName ); return result; } ); }
Source:
public void clear() { clearInternal(); }

Target:
public void clear() { clearInternal().incrementVersion(); }
Source:
public ItemInfo(String itemType, String itemName) { super(); this.itemType = itemType; this.itemName = itemName; }

Target:
public ItemInfo(String itemType, String itemName) { this.itemType = itemType; this.itemName = itemName; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TargetPatternPhaseKey)) { return false; } TargetPatternPhaseKey other = (TargetPatternPhaseKey) obj; return other.targetPatterns.equals(this.targetPatterns) && other.offset.equals(this.offset) && other.compileOneDependency == compileOneDependency && other.buildTestsOnly == buildTestsOnly && other.determineTests == determineTests && (other.buildTargetFilter == null && buildTargetFilter == null || other.buildTargetFilter != null && other.buildTargetFilter.equals(buildTargetFilter)) && other.buildManualTests == buildManualTests && other.expandTestSuites == expandTestSuites && Objects.equals(other.testFilter, testFilter); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TargetPatternPhaseKey)) { return false; } TargetPatternPhaseKey other = (TargetPatternPhaseKey) obj; return other.targetPatterns.equals(this.targetPatterns) && other.offset.equals(this.offset) && other.compileOneDependency == compileOneDependency && other.buildTestsOnly == buildTestsOnly && other.determineTests == determineTests && Objects.equals(other.buildTargetFilter, buildTargetFilter) && other.buildManualTests == buildManualTests && other.expandTestSuites == expandTestSuites && Objects.equals(other.testFilter, testFilter); }
Source:
@Override protected void execute(TaskListener listener) throws IOException, InterruptedException { if (get().isUseBrowser()) { return; } boolean due = false; for (UpdateSite site : Jenkins.getInstance().getUpdateCenter().getSites()) { if (site.isDue()) { due = true; break; } } if (!due) { final long now = System.currentTimeMillis(); for (Downloadable d : Downloadable.all()) { if (d.getDue() <= now) { d.updateNow(); } } return; } HttpResponse rsp = Jenkins.getInstance().getPluginManager().doCheckUpdatesServer(); if (rsp instanceof FormValidation) { listener.error(((FormValidation) rsp).renderHtml()); } }

Target:
@Override protected void execute(TaskListener listener) throws IOException, InterruptedException { if (get().isUseBrowser()) { return; } boolean due = false; for (UpdateSite site : Jenkins.getInstance().getUpdateCenter().getSites()) { if (site.isDue()) { due = true; break; } } if (!due) { final long now = System.currentTimeMillis(); for (Downloadable d : Downloadable.all()) { if (d.getDue() <= now) { try { d.updateNow(); } catch(Exception e) { LOGGER.log(Level.WARNING, String.format("Unable to update downloadable [%s]", d.getId()), e); } } } return; } HttpResponse rsp = Jenkins.getInstance().getPluginManager().doCheckUpdatesServer(); if (rsp instanceof FormValidation) { listener.error(((FormValidation) rsp).renderHtml()); } }
Source:
private String getCommitMessage(ICommitMessageProvider provider, boolean isFirstMessage) { return _buildCommitMessage(provider.getMessage(resourcesArray), isFirstMessage); }

Target:
private String getCommitMessage(ICommitMessageProvider provider, boolean isFirstMessage) { return buildCommitMessage(provider.getMessage(resourcesArray), isFirstMessage); }
Source:
private static boolean hasOnlyNonNullConstraint(ConstraintsByDomain constraints) { List<Class<? extends Constraint>> domains = constraints.domains().collect(Collectors.toList()); return domains.size() == 1 && constraints.get(ObjectConstraint.class) == ObjectConstraint.NOT_NULL; }

Target:
private static boolean hasOnlyNonNullConstraint(ConstraintsByDomain constraints) { return constraints.domains().count() == 1 && constraints.get(ObjectConstraint.class) == ObjectConstraint.NOT_NULL; }
Source:
private String calculateTotalDurationString(Result result) { DecimalFormat numberFormat = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); numberFormat.applyPattern("0.######"); return numberFormat.format(((double) result.getTimeDuration().toNanos())); }

Target:
private String calculateTotalDurationString(Result result) { DecimalFormat numberFormat = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); numberFormat.applyPattern("0.######"); return numberFormat.format(((double) result.getDuration().toNanos() / NANOS_PER_SECONDS)); }