auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String injectContextDependentValuesForTest(String content) { Date now = new Date(); return content.replace("<!-- test.url -->", TestProperties.TEAMMATES_URL) .replace("<!-- studentmotd.url -->", Config.STUDENT_MOTD_URL) .replace("<!-- version -->", TestProperties.TEAMMATES_VERSION) .replace("<!-- test.student1 -->", TestProperties.TEST_STUDENT1_ACCOUNT) .replace("<!-- test.student1.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT1_ACCOUNT)) .replace("<!-- test.student2 -->", TestProperties.TEST_STUDENT2_ACCOUNT) .replace("<!-- test.student2.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT2_ACCOUNT)) .replace("<!-- test.instructor -->", TestProperties.TEST_INSTRUCTOR_ACCOUNT) .replace("<!-- test.instructor.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_INSTRUCTOR_ACCOUNT)) .replace("<!-- test.admin -->", TestProperties.TEST_ADMIN_ACCOUNT) .replace("<!-- test.admin.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_ADMIN_ACCOUNT)) .replace("<!-- nexthour.date -->", TimeHelper.formatDate(TimeHelper.getNextHour())) .replace("<!-- now.datetime -->", TimeHelper.formatTime12H(now)) .replace("<!-- now.datetime.comments -->", TimeHelper.formatDateTimeForComments(now, 8)); }

Target:
public static String injectContextDependentValuesForTest(String content) { Date now = new Date(); return content.replace("<!-- test.url -->", TestProperties.TEAMMATES_URL) .replace("<!-- studentmotd.url -->", Config.STUDENT_MOTD_URL) .replace("<!-- version -->", TestProperties.TEAMMATES_VERSION) .replace("<!-- test.student1 -->", TestProperties.TEST_STUDENT1_ACCOUNT) .replace("<!-- test.student1.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT1_ACCOUNT)) .replace("<!-- test.student2 -->", TestProperties.TEST_STUDENT2_ACCOUNT) .replace("<!-- test.student2.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT2_ACCOUNT)) .replace("<!-- test.instructor -->", TestProperties.TEST_INSTRUCTOR_ACCOUNT) .replace("<!-- test.instructor.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_INSTRUCTOR_ACCOUNT)) .replace("<!-- test.admin -->", TestProperties.TEST_ADMIN_ACCOUNT) .replace("<!-- test.admin.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_ADMIN_ACCOUNT)) .replace("<!-- nexthour.date -->", TimeHelper.formatDate(TimeHelper.getNextHour())) .replace("<!-- now.datetime -->", TimeHelper.formatTime12H(now)) .replace("<!-- now.datetime.comments -->", TimeHelper.formatDateTimeForComments(now, 0)); }
Source:
public void testFindLiveVersionContainer() throws Exception{ Container c = new Container(); c.setFriendlyName("Versionable Container Working"); c.setTitle("Versionable Container Working"); c.setMaxContentlets(2); c.setPreLoop("preloop code"); c.setPostLoop("postloop code"); Structure st=CacheLocator.getContentTypeCache().getStructureByVelocityVarName("host"); List<ContainerStructure> csList = new ArrayList<ContainerStructure>(); ContainerStructure cs = new ContainerStructure(); cs.setStructureId(st.getInode()); cs.setCode("this is the code"); csList.add(cs); c = APILocator.getContainerAPI().save(c, csList, host, user, false); APILocator.getVersionableAPI().setLive(c); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(c.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),c.getTitle()); assertEquals(verAPI.getInode(),c.getInode()); APILocator.getContainerAPI().delete(c, user, false); }

Target:
public void testFindLiveVersionContainer() throws Exception{ Structure structure = new StructureDataGen().nextPersisted(); Container container = new ContainerDataGen().withStructure(structure, "").nextPersisted(); APILocator.getVersionableAPI().setLive(container); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(container.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),container.getTitle()); assertEquals(verAPI.getInode(),container.getInode()); APILocator.getContainerAPI().delete(container, user, false); APILocator.getStructureAPI().delete(structure, user); }
Source:
public ObjectRetentionConfiguration getObjectRetention(String bucketName, String objectName, String versionId) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidResponseException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); if ( !(versionId == null || versionId.isEmpty())) { queryParamMap.put("versionId",versionId); } HttpResponse response = executeGet(bucketName, objectName, null, queryParamMap); ObjectRetentionConfiguration result = new ObjectRetentionConfiguration(); try { result.parseXml(response.body().charStream()); } finally { response.body().close(); } return result; }

Target:
public ObjectRetentionConfiguration getObjectRetention(String bucketName, String objectName, String versionId) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidResponseException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); if (versionId == null) { queryParamMap.put("versionId", ""); } else { queryParamMap.put("versionId", versionId); } HttpResponse response = executeGet(bucketName, objectName, null, queryParamMap); ObjectRetentionConfiguration result = new ObjectRetentionConfiguration(); try { result.parseXml(response.body().charStream()); } finally { response.body().close(); } return result; }
Source:
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { final List<StudentPortalBean> studentPortalBeans = new ArrayList<StudentPortalBean>(); final List<String> genericDegreeWarnings = new ArrayList<String>(); final Student student = AccessControl.getPerson().getStudent(); if (student != null) { for (final Registration registration : student.getAllRegistrations()) { if (considerRegistration(registration.getLastStateType())) { final DegreeCurricularPlan degreeCurricularPlan = registration.getLastDegreeCurricularPlan(); if (registration.getAttendingExecutionCoursesForCurrentExecutionPeriod().isEmpty() == false) { studentPortalBeans.add(new StudentPortalBean(registration.getDegree(), student, registration.getAttendingExecutionCoursesForCurrentExecutionPeriod(), degreeCurricularPlan)); } if (hasSpecialSeasonEnrolments(student)) { genericDegreeWarnings.addAll(getEnrolmentPeriodCoursesAfterSpecialSeason(degreeCurricularPlan)); } else { genericDegreeWarnings.addAll(getEnrolmentPeriodCourses(degreeCurricularPlan)); } genericDegreeWarnings.addAll(getEnrolmentPeriodInSpecialSeasonEvaluations(degreeCurricularPlan)); genericDegreeWarnings.addAll(getEnrolmentPeriodClasses(degreeCurricularPlan)); } } } request.setAttribute("genericDegreeWarnings", genericDegreeWarnings); request.setAttribute("studentPortalBeans", studentPortalBeans); request.setAttribute("executionSemester", ExecutionSemester.readActualExecutionSemester().getQualifiedName()); return mapping.findForward("studentPortal"); }

Target:
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { List<StudentPortalBean> studentPortalBeans = new ArrayList<StudentPortalBean>(); List<String> genericDegreeWarnings = new ArrayList<String>(); final Student student = AccessControl.getPerson().getStudent(); if (student != null) { for (Registration registration : student.getAllRegistrations()) { DegreeCurricularPlan degreeCurricularPlan = registration.getLastDegreeCurricularPlan(); if (registration.getAttendingExecutionCoursesForCurrentExecutionPeriod().isEmpty() == false) { studentPortalBeans.add(new StudentPortalBean(registration.getDegree(), student, registration .getAttendingExecutionCoursesForCurrentExecutionPeriod(), degreeCurricularPlan)); } if (hasSpecialSeasonEnrolments(student)) { genericDegreeWarnings.addAll(getEnrolmentPeriodCoursesAfterSpecialSeason(degreeCurricularPlan)); } else { genericDegreeWarnings.addAll(getEnrolmentPeriodCourses(degreeCurricularPlan)); } genericDegreeWarnings.addAll(getEnrolmentPeriodInSpecialSeasonEvaluations(degreeCurricularPlan)); genericDegreeWarnings.addAll(getEnrolmentPeriodClasses(degreeCurricularPlan)); } } request.setAttribute("genericDegreeWarnings", genericDegreeWarnings); request.setAttribute("studentPortalBeans", studentPortalBeans); request.setAttribute("executionSemester", ExecutionSemester.readActualExecutionSemester().getQualifiedName()); return mapping.findForward("studentPortal"); }
Source:
private void writeHeadersFrame( final ChannelHandlerContext ctx, Http2HeadersFrame headersFrame, final ChannelPromise promise) { if (isStreamIdValid(headersFrame.stream().id())) { encoder().writeHeaders(ctx, headersFrame.stream().id(), headersFrame.headers(), headersFrame.padding(), headersFrame.isEndStream(), promise); } else { final DefaultHttp2FrameStream stream = (DefaultHttp2FrameStream) headersFrame.stream(); final Http2Connection connection = connection(); final int streamId = connection.local().incrementAndGetNextStreamId(); if (streamId < 0) { promise.setFailure(new Http2NoMoreStreamIdsException()); onHttp2Frame(ctx, new DefaultHttp2GoAwayFrame(connection.isServer() ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1, NO_ERROR.code(), writeAscii(ctx.alloc(), "Stream IDs exhausted on local stream creation"))); return; } stream.id = streamId; Object old = frameStreamToInitializeMap.put(streamId, stream); assert old == null; ChannelPromise writeHeadersPromise = ctx.newPromise(); writeHeadersPromise.addListener(new GenericFutureListener<Future<Void>>() { @Override public void operationComplete(Future<Void> operationFuture) { if (!operationFuture.isSuccess()) { frameStreamToInitializeMap.remove(streamId); promise.setFailure(operationFuture.cause()); } else { promise.setSuccess(operationFuture.getNow()); } } }); encoder().writeHeaders(ctx, streamId, headersFrame.headers(), headersFrame.padding(), headersFrame.isEndStream(), writeHeadersPromise); if (!promise.isDone()) { numBufferedStreams++; promise.addListener(bufferedStreamsListener); } } }

Target:
private void writeHeadersFrame( final ChannelHandlerContext ctx, Http2HeadersFrame headersFrame, final ChannelPromise promise) { if (isStreamIdValid(headersFrame.stream().id())) { encoder().writeHeaders(ctx, headersFrame.stream().id(), headersFrame.headers(), headersFrame.padding(), headersFrame.isEndStream(), promise); } else { final DefaultHttp2FrameStream stream = (DefaultHttp2FrameStream) headersFrame.stream(); final Http2Connection connection = connection(); final int streamId = connection.local().incrementAndGetNextStreamId(); if (streamId < 0) { promise.setFailure(new Http2NoMoreStreamIdsException()); onHttp2Frame(ctx, new DefaultHttp2GoAwayFrame(connection.isServer() ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1, NO_ERROR.code(), writeAscii(ctx.alloc(), "Stream IDs exhausted on local stream creation"))); return; } stream.id = streamId; Object old = frameStreamToInitializeMap.put(streamId, stream); assert old == null; promise.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture channelFuture) { if (!channelFuture.isSuccess()) { frameStreamToInitializeMap.remove(streamId); } } }); encoder().writeHeaders(ctx, streamId, headersFrame.headers(), headersFrame.padding(), headersFrame.isEndStream(), promise); if (!promise.isDone()) { numBufferedStreams++; promise.addListener(bufferedStreamsListener); } } }
Source:
private IConnectionWrapper createConnection(IServer server) throws MalformedURLException { ConnectorProviderRegistry connectorProviders = OpenShiftCoreActivator.getDefault().getConnectorProviders(); VersionKey version = new VersionDetector(server).guess(); if (version != null) { JMXConnectorProvider provider = connectorProviders.getProvider(version); return new OpenshiftConnectionWrapper(this, server, provider); } return null; }

Target:
private IConnectionWrapper createConnection(IServer server) throws MalformedURLException { ConnectorProviderRegistry connectorProviders = OpenShiftCoreActivator.getDefault().getConnectorProviders(); VersionKey version = new VersionDetector(server).guess(); if (version != null) { JMXConnectorProvider provider = connectorProviders.getProvider(version); if (provider != null) { return new OpenshiftConnectionWrapper(this, server, provider); } } return null; }
Source:
private static void launchReporter(final URL directory) { LaunchTask launchReporter = new LaunchTask() { @Override public void run() { ApplicationContext context = loadContext(directory, REPORTER_CONFIGURATION, environmentProperties); final ReportingService reportingService = ReportingProvider.getService(context); reportingService.renderReport(true); } }; builder.addMainTask(launchReporter); }

Target:
private static void launchReporter(final URL directory) { LaunchTask launchReporter = new LaunchTask() { @Override public void run() { ApplicationContext context = loadContext(directory, REPORTER_CONFIGURATION, environmentProperties); final ReportingService reportingService = (ReportingService) context.getBean("reportingService"); reportingService.renderReport(true); } }; builder.addMainTask(launchReporter); }
Source:
public void setUp() { Project project = new Project(MockUtil.mockContextForProject(), "testProject"); ProjectManager.getInstance().setCurrentProject(project); testSprite = new SingleSprite("sprite"); project.getDefaultScene().addSprite(testSprite); ProjectManager.getInstance().setCurrentSprite(testSprite); ProjectManager.getInstance().setCurrentlyEditedScene(project.getDefaultScene()); testSprite.look.setXInUserInterfaceDimensionUnit(LOOK_X_POSITION); testSprite.look.setYInUserInterfaceDimensionUnit(LOOK_Y_POSITION); testSprite.look.setTransparencyInUserInterfaceDimensionUnit(LOOK_ALPHA); testSprite.look.setBrightnessInUserInterfaceDimensionUnit(LOOK_BRIGHTNESS); testSprite.look.setColorInUserInterfaceDimensionUnit(LOOK_COLOR); testSprite.look.setSizeInUserInterfaceDimensionUnit(LOOK_SCALE); testSprite.look.setDirectionInUserInterfaceDimensionUnit(LOOK_ROTATION); }

Target:
public void setUp() { Project project = new Project(MockUtil.mockContextForProject(), "testProject"); ProjectManager.getInstance().setCurrentProject(project); testSprite = new SingleSprite("sprite"); project.getDefaultScene().addSprite(testSprite); ProjectManager.getInstance().setCurrentSprite(testSprite); testSprite.look.setXInUserInterfaceDimensionUnit(LOOK_X_POSITION); testSprite.look.setYInUserInterfaceDimensionUnit(LOOK_Y_POSITION); testSprite.look.setTransparencyInUserInterfaceDimensionUnit(LOOK_ALPHA); testSprite.look.setBrightnessInUserInterfaceDimensionUnit(LOOK_BRIGHTNESS); testSprite.look.setColorInUserInterfaceDimensionUnit(LOOK_COLOR); testSprite.look.setSizeInUserInterfaceDimensionUnit(LOOK_SCALE); testSprite.look.setDirectionInUserInterfaceDimensionUnit(LOOK_ROTATION); }
Source:
private void setDefaultAssignee(String channel, String sender, String subcomponent, @CheckForNull String owner) { if (!isSenderAuthorized(channel,sender)) { insufficientPermissionError(channel); return; } sendMessage(channel,String.format("Changing default assignee of subcomponent %s to %s",subcomponent,owner)); try { final JiraRestClient client = JiraHelper.createJiraClient(); final Component component = JiraHelper.getComponent(client, IrcBotConfig.JIRA_DEFAULT_PROJECT, subcomponent); Promise<Component> updateComponent = client.getComponentClient().updateComponent(component.getSelf(), new ComponentInput(component.getName(), component.getDescription(), owner != null ? owner : "", AssigneeType.COMPONENT_LEAD)); JiraHelper.wait(updateComponent); sendMessage(channel, owner != null ? "Default assignee set to " + owner : "Default assignee has been removed"); } catch (Exception e) { sendMessage(channel,"Failed to set default assignee: "+e.getMessage()); e.printStackTrace(); } }

Target:
private void setDefaultAssignee(String channel, String sender, String subcomponent, @CheckForNull String owner) { if (!isSenderAuthorized(channel,sender)) { insufficientPermissionError(channel); return; } sendMessage(channel,String.format("Changing default assignee of subcomponent %s to %s",subcomponent,owner)); try { final JiraRestClient client = JiraHelper.createJiraClient(); final Component component = JiraHelper.getComponent(client, IrcBotConfig.JIRA_DEFAULT_PROJECT, subcomponent); Promise<Component> updateComponent = client.getComponentClient().updateComponent(component.getSelf(), new ComponentInput(null, null, owner != null ? owner : "", AssigneeType.COMPONENT_LEAD)); JiraHelper.wait(updateComponent); sendMessage(channel, owner != null ? "Default assignee set to " + owner : "Default assignee has been removed"); } catch (Exception e) { sendMessage(channel,"Failed to set default assignee: "+e.getMessage()); e.printStackTrace(); } }
Source:
public CloudBlobMetadata getOldestDeletedBlob(String partitionPath) throws CloudStorageException { List<CloudBlobMetadata> deadBlobs = requestAgent.doWithRetries( () -> cloudDestination.getDeletedBlobs(partitionPath, System.currentTimeMillis(), queryLimit), "GetDeadBlobs", partitionPath); return deadBlobs.isEmpty() ? null : deadBlobs.get(0); }

Target:
public CloudBlobMetadata getOldestDeletedBlob(String partitionPath) throws CloudStorageException { List<CloudBlobMetadata> deadBlobs = requestAgent.doWithRetries( () -> cloudDestination.getDeletedBlobs(partitionPath, 1, System.currentTimeMillis(), 1), "GetDeadBlobs", partitionPath); return deadBlobs.isEmpty() ? null : deadBlobs.get(0); }
Source:
private void addFileToZip(File zipFile, File file, String fileName) throws IOException, URISyntaxException { String entryName = fileName == null ? file.getName() : fileName; Map<String, String> env = new HashMap<>(); env.put("useTempFile", Boolean.toString(this.useTempFile)); try (FileSystem fs = FileSystems.newFileSystem(getZipURI(zipFile), env)) { Path dest = fs.getPath("/", entryName); Files.createDirectories(dest.getParent()); Files.copy(file.toPath(), dest, StandardCopyOption.REPLACE_EXISTING); } }

Target:
private void addFileToZip(File zipFile, File file, String fileName) throws IOException, URISyntaxException { String entryName = fileName == null ? file.getName() : fileName; Map<String, Object> env = new HashMap<>(); env.put("useTempFile", this.useTempFile); try (FileSystem fs = FileSystems.newFileSystem(getZipURI(zipFile), env)) { Path dest = fs.getPath("/", entryName); Files.createDirectories(dest.getParent()); Files.copy(file.toPath(), dest, StandardCopyOption.REPLACE_EXISTING); } }
Source:
@Override public ReentrantReadWriteLockWithTracking.ReadLock readLock() { return readLock; }

Target:
@Override public ReentrantReadWriteLock.ReadLock readLock() { return readLock; }
Source:
private static void validateIssuer(Issuer issuer) throws WSSecurityException { if (SamlConstants.URN_OASIS_NAMES.equals(issuer.getFormat())) { if (StringUtils.isNotBlank(issuer.getSPProvidedID())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (StringUtils.isNotBlank(issuer.getNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (StringUtils.isNotBlank(issuer.getSPNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } } }

Target:
private static void validateIssuer(Issuer issuer) throws WSSecurityException { if (SamlConstants.URN_OASIS_NAMES.equals(issuer.getFormat())) { if (StringUtils.isNotBlank(issuer.getSPProvidedID())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, getCustomErrorMsg(SamlConstants.SECURITY_ASSERTION_SPPROVIDEDID)); } if (StringUtils.isNotBlank(issuer.getNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, getCustomErrorMsg(SamlConstants.SECURITY_ASSERTION_NAME_QUALIFIER)); } if (StringUtils.isNotBlank(issuer.getSPNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, getCustomErrorMsg(SamlConstants.SECURITY_ASSERTION_SPNAME_QUALIFIER)); } } }
Source:
public void processElement(ProcessContext context) { if (converter == null) { AvroRegistry registry = new AvroRegistry(); converter = registry.createIndexedRecordConverter(context.element().getClass()); } IndexedRecord inputRecord = (IndexedRecord) converter.convertToAvro(context.element()); Schema schema = inputRecord.getSchema(); String columnToNormalize = properties.columnToNormalize.getValue(); String delim = properties.fieldSeparator.getValue(); boolean discardTrailingEmptyStr = properties.discardTrailingEmptyStr.getValue(); boolean trim = properties.trim.getValue(); if (!StringUtils.isEmpty(columnToNormalize)) { int indexColumnToNormalize = schema.getField(columnToNormalize).pos(); List<Object> inputValues = getInputFields(inputRecord, columnToNormalize); if (inputValues.size() == 1) { String[] strs = delimit(inputValues.get(0), delim, discardTrailingEmptyStr, trim); for (int i=0; i<strs.length; i++) { GenericRecord outputRecord = new GenericData.Record(schema); for(int j=0; j<schema.getFields().size(); j++) { if(j != indexColumnToNormalize) { outputRecord.put(j, inputRecord.get(j)); } } outputRecord.put(indexColumnToNormalize, strs[i]); context.output(outputRecord); } } } }

Target:
public void processElement(ProcessContext context) throws Exception { IndexedRecord inputRecord = context.element(); String columnToNormalize = properties.columnToNormalize.getValue(); boolean isList = properties.isList.getValue(); String delim = null; if (!isList) { try { NormalizeDelimiter normalizeDelimiter = NormalizeDelimiter.valueOf(properties.fieldSeparator.getValue()); delim = normalizeDelimiter.getDelimiter(); } catch (IllegalArgumentException ex) { if (NormalizeConstant.Delimiter.OTHER.equals(properties.fieldSeparator.getValue())) { delim = properties.otherSeparator.getValue(); } } } boolean isDiscardTrailingEmptyStr = properties.discardTrailingEmptyStr.getValue(); boolean isTrim = properties.trim.getValue(); if (StringUtils.isNotEmpty(columnToNormalize)) { String[] path = columnToNormalize.split("\\."); List<Object> normalizedFields = NormalizeUtils.getInputFields(inputRecord, columnToNormalize); Schema schema = NormalizeUtils.transformSchema(inputRecord.getSchema(), path, 0); if (NormalizeUtils.isSimpleField(normalizedFields)) { normalizedFields = NormalizeUtils.delimit(String.valueOf(normalizedFields.get(0)), delim, isDiscardTrailingEmptyStr, isTrim); } for (Object outputValue : normalizedFields) { GenericRecord outputRecord = NormalizeUtils.generateNormalizedRecord(context.element(), context.element().getSchema(), schema, path, 0, outputValue); context.output(outputRecord); } } }
Source:
public Icu4jRules(String[] args) throws IOException { if (args.length < 3) { throw new IllegalArgumentException(COMMAND_USAGE); } Path fullWhitelistedApiFile = null; if ("--full-whitelisted-api".equals(args[0])) { fullWhitelistedApiFile = Paths.get(args[1]); if (args.length < 5) { throw new IllegalArgumentException(COMMAND_USAGE); } String[] newArgs = new String[args.length - 2]; System.arraycopy(args, 2, newArgs, 0, args.length - 2); args = newArgs; } String[] inputDirNames = new String[args.length - 2]; System.arraycopy(args, 0, inputDirNames, 0, args.length - 2); inputFileGenerator = Icu4jTransformRules.createInputFileGenerator(inputDirNames); Path corePlatformApiFile = Paths.get(args[args.length - 1]); rules = createTransformRules(corePlatformApiFile, fullWhitelistedApiFile); outputSourceFileGenerator = Icu4jTransformRules.createOutputFileGenerator(args[args.length - 2]); }

Target:
public Icu4jRules(String[] args) throws IOException { if (args.length < 3) { throw new IllegalArgumentException(COMMAND_USAGE); } Path whitelistedApiPath = null; if ("--hide-non-whitelisted-api".equals(args[0])) { whitelistedApiPath = Paths.get(args[1]); if (args.length < 5) { throw new IllegalArgumentException(COMMAND_USAGE); } String[] newArgs = new String[args.length - 2]; System.arraycopy(args, 2, newArgs, 0, args.length - 2); args = newArgs; } String[] inputDirNames = new String[args.length - 2]; System.arraycopy(args, 0, inputDirNames, 0, args.length - 2); inputFileGenerator = Icu4jTransformRules.createInputFileGenerator(inputDirNames); Path corePlatformApiFile = Paths.get(args[args.length - 1]); rules = createTransformRules(corePlatformApiFile, whitelistedApiPath); outputSourceFileGenerator = Icu4jTransformRules.createOutputFileGenerator(args[args.length - 2]); }
Source:
void askTserverToRemoveWAL(HostAndPort address, AccumuloConfiguration conf, Entry<String,ArrayList<Path>> entry, final GCStatus status) { firstSeenDead.remove(address); Client tserver = null; try { tserver = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf); tserver.removeLogs(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), paths2strings(entry.getValue())); log.debug("asking tserver to delete " + entry.getValue() + " from " + entry.getKey()); status.currentLog.deleted += entry.getValue().size(); } catch (TException e) { log.warn("Error talking to " + address + ": " + e); } finally { if (tserver != null) ThriftUtil.returnClient(tserver); } }

Target:
void askTserverToRemoveWAL(HostAndPort address, AccumuloConfiguration conf, Entry<String,ArrayList<Path>> entry, final GCStatus status) { firstSeenDead.remove(address); Client tserver = null; try { tserver = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf); tserver.removeLogs(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), paths2strings(entry.getValue())); log.debug("asked tserver to delete " + entry.getValue() + " from " + entry.getKey()); status.currentLog.deleted += entry.getValue().size(); } catch (TException e) { log.warn("Error talking to " + address + ": " + e); } finally { if (tserver != null) ThriftUtil.returnClient(tserver); } }
Source:
public String resolve(TranscriptConsequence transcriptConsequence) throws EnsemblWebServiceException { String entrezGeneId = null; if (transcriptConsequence != null && transcriptConsequence.getGeneSymbol() != null && !transcriptConsequence.getGeneSymbol().trim().isEmpty()) { entrezGeneId = this.hugoSymbolToEntrezGeneIdMap.get(transcriptConsequence.getGeneSymbol()); } return entrezGeneId; }

Target:
public String resolve(TranscriptConsequence transcriptConsequence) throws EnsemblWebServiceException { String entrezGeneId = null; if (transcriptConsequence != null && transcriptConsequence.getGeneSymbol() != null && !transcriptConsequence.getGeneSymbol().trim().isEmpty()) { entrezGeneId = this.ensemblService.getEntrezGeneIdByHugoSymbol(transcriptConsequence.getGeneSymbol()); } return entrezGeneId; }
Source:
public ParameterExpression(String paramName) { if (paramName == null || paramName.isEmpty()) { throw new IllegalArgumentException("Parameter name cannot be null or empty"); } this.paramName = paramName; }

Target:
public ParameterExpression(String paramName) { if (paramName == null || paramName.isEmpty()) { throw log.parameterNameCannotBeNulOrEmpty(); } this.paramName = paramName; }
Source:
public ProcessInstance execute(CommandContext commandContext) { if(this.internalProcessInstance.getStartTime() != null){ throw new ActivitiIllegalArgumentException("Process instance "+this.internalProcessInstance.getProcessInstanceId()+ " has already been started"); } ExecutionEntity processExecution = (ExecutionEntity) this.internalProcessInstance; processInstanceHelper = commandContext.getProcessEngineConfiguration().getProcessInstanceHelper(); processInstanceHelper.startProcessInstance(processExecution, commandContext, processExecution.getVariables(), processExecution.getCurrentFlowElement()); return processExecution; }

Target:
public ProcessInstance execute(CommandContext commandContext) { if(this.internalProcessInstance.getStartTime() != null){ throw new ActivitiIllegalArgumentException("Process instance " + this.internalProcessInstance.getProcessInstanceId() + " has already been started"); } ExecutionEntity processExecution = (ExecutionEntity) this.internalProcessInstance; ProcessInstanceHelper processInstanceHelper = commandContext.getProcessEngineConfiguration().getProcessInstanceHelper(); processInstanceHelper.startProcessInstance(processExecution, commandContext, processExecution.getVariables(), processExecution.getCurrentFlowElement()); return processExecution; }
Source:
public void addObjectsTest() throws Exception { Model model = getDepositRecordModel(); DepositRecord record = repository.createDepositRecord(pid, model); Resource res1 = model.createResource(); Resource res2 = model.createResource(); List<Resource> depositedObjs = new ArrayList<>(); depositedObjs.add(res1); depositedObjs.add(res2); record.addIngestedObjects(pid, depositedObjs); assertTrue(record.listDepositedObjects().size() == 2); }

Target:
public void addObjectsTest() throws Exception { Model model = getDepositRecordModel(); DepositRecord record = repository.createDepositRecord(pid, model); URI obj1Uri; URI obj2Uri; try (FcrepoResponse response = client.post(URI.create(serverAddress)).perform()) { obj1Uri = response.getLocation(); } try (FcrepoResponse response = client.post(URI.create(serverAddress)).perform()) { obj2Uri = response.getLocation(); } Resource res1 = model.createResource(obj1Uri.toString()); Resource res2 = model.createResource(obj2Uri.toString()); List<Resource> depositedObjs = new ArrayList<>(); depositedObjs.add(res1); depositedObjs.add(res2); record.addIngestedObjects(pid, depositedObjs); assertTrue(record.listDepositedObjects().size() == 2); }
Source:
private SlidingTimeWindowReservoir createIfAbsent(String meterNamePrefix, Tags tags, long window, TimeUnit timeUnit, Clock clock) { String key = meterNamePrefix + tags.stream() .map(tag -> tag.getKey() + tag.getValue()) .reduce(String::concat) .orElse(""); SlidingTimeWindowReservoir value; if ((value = timeWindowedDurationMeasurementsMap.get(key)) == null) { SlidingTimeWindowReservoir newValue = new SlidingTimeWindowReservoir(window, timeUnit, clock); timeWindowedDurationMeasurementsMap.put(key, newValue); return newValue; } return value; }

Target:
private SlidingTimeWindowReservoir createIfAbsent(String meterNamePrefix, Tags tags, long window, TimeUnit timeUnit, Clock clock) { String key = meterNamePrefix + tags.stream() .map(tag -> tag.getKey() + tag.getValue()) .reduce(String::concat) .orElse(""); timeWindowedDurationMeasurementsMap.putIfAbsent(key, new SlidingTimeWindowReservoir(window, timeUnit, clock)); return timeWindowedDurationMeasurementsMap.get(key); }
Source:
private ShardSpecs determineShardSpecs( final TaskToolbox toolbox, final FirehoseFactory firehoseFactory, final File firehoseTempDir ) throws IOException { final ObjectMapper jsonMapper = toolbox.getObjectMapper(); final IndexTuningConfig tuningConfig = ingestionSchema.getTuningConfig(); final IndexIOConfig ioConfig = ingestionSchema.getIOConfig(); final GranularitySpec granularitySpec = ingestionSchema.getDataSchema().getGranularitySpec(); final boolean determineIntervals = !granularitySpec.bucketIntervals().isPresent(); final boolean guaranteedRollup = tuningConfig.isForceGuaranteedRollup() && !tuningConfig.isForceExtendableShardSpecs() && !ioConfig.isAppendToExisting(); final boolean determineNumPartitions = tuningConfig.getNumShards() == null && guaranteedRollup; final boolean useExtendableShardSpec = !guaranteedRollup; if (!determineNumPartitions && !determineIntervals) { log.info("Skipping determine partition scan"); return createShardSpecsWithoutDataScan(jsonMapper, granularitySpec, tuningConfig, useExtendableShardSpec); } return createShardSpecsFromData( jsonMapper, ingestionSchema, firehoseFactory, firehoseTempDir, granularitySpec, tuningConfig, determineIntervals, determineNumPartitions, useExtendableShardSpec ); }

Target:
private ShardSpecs determineShardSpecs( final TaskToolbox toolbox, final FirehoseFactory firehoseFactory, final File firehoseTempDir ) throws IOException { final ObjectMapper jsonMapper = toolbox.getObjectMapper(); final IndexTuningConfig tuningConfig = ingestionSchema.getTuningConfig(); final IndexIOConfig ioConfig = ingestionSchema.getIOConfig(); final GranularitySpec granularitySpec = ingestionSchema.getDataSchema().getGranularitySpec(); final boolean determineIntervals = !granularitySpec.bucketIntervals().isPresent(); final boolean guaranteedRollup = isGuaranteedRollup(ioConfig, tuningConfig); final boolean determineNumPartitions = tuningConfig.getNumShards() == null && guaranteedRollup; final boolean useExtendableShardSpec = !guaranteedRollup; if (!determineNumPartitions && !determineIntervals) { log.info("Skipping determine partition scan"); return createShardSpecWithoutInputScan(jsonMapper, granularitySpec, tuningConfig, useExtendableShardSpec); } else { return createShardSpecsFromInput( jsonMapper, ingestionSchema, firehoseFactory, firehoseTempDir, granularitySpec, tuningConfig, determineIntervals, determineNumPartitions, useExtendableShardSpec ); } }
Source:
public void testGetInvalidityInfoForSectionName_invalid_returnSpecificErrorString() { String invalidSectionName = "Percent Symbol % Section"; String actual = validator.getInvalidityInfoForSectionName(invalidSectionName); assertEquals("Invalid section name (invalid char) should return error string that is specific to section name", "\"Percent Symbol % Section\" is not acceptable to TEAMMATES as a/an section name " + "because it contains invalid characters. All section name must start with an " + "alphanumeric character, and cannot contain any vertical bar (|) or percent sign " + "(%).", actual); }

Target:
public void testGetInvalidityInfoForSectionName_invalid_returnSpecificErrorString() { String invalidSectionName = "Percent Symbol % Section"; String actual = validator.getInvalidityInfoForSectionName(invalidSectionName); assertEquals("Invalid section name (invalid char) should return error string that is specific to section name", "\"Percent Symbol % Section\" is not acceptable to TEAMMATES as a/an section name " + "because it contains invalid characters. All section name must start with an " + "alphanumeric character, and cannot contain any vertical bar (|) or percent sign (%).", actual); }
Source:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry<K, V> e = (MVCCEntry<K, V>) ctx.lookupEntry(key); if (e == null) return null; if (prevValue == null && !hasFlag(Flag.COMMAND_RETRY)) { prevValue = e.getValue(); prevMetadata = e.getMetadata(); } Object oldPrevValue = e.getValue(hasFlag(Flag.COMMAND_RETRY)); if (valueUnchanged(oldPrevValue, prevValue, value) || valueRemoved(oldPrevValue, prevValue)) { log.tracef("Execute read-write function on previous value %s and previous metadata %s", prevValue, prevMetadata); R ret = f.apply(value, EntryViews.readWrite(e, prevValue, prevMetadata)); return snapshot(ret); } return f.apply(value, EntryViews.readWrite(e, e.getValue(), e.getMetadata())); }

Target:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry<K, V> e = (MVCCEntry<K, V>) ctx.lookupEntry(key); if (e == null) return null; if (prevValue == null && !hasFlag(Flag.COMMAND_RETRY)) { prevValue = e.getValue(); prevMetadata = e.getMetadata(); } Object oldPrevValue = e.getValue(); CacheEntry<K, V> copy = e.clone(); R ret = f.apply(value, EntryViews.readWrite(copy, prevValue, prevMetadata)); if (valueMatcher.matches(oldPrevValue, prevValue, copy.getValue(), AnyEquivalence.getInstance())) { log.tracef("Execute read-write function on previous value %s and previous metadata %s", prevValue, prevMetadata); e.setValue(copy.getValue()); e.setMetadata(copy.getMetadata()); e.setChanged(copy.isChanged()); e.setRemoved(copy.isRemoved()); return snapshot(ret); } return f.apply(value, EntryViews.readWrite(e, e.getValue(), e.getMetadata())); }
Source:
private void runExecutableNode(final ExecutableNode node) throws IOException { prepareJobProperties(node); node.setStatus(Status.QUEUED); String jobId = node.getId(); String jobType = Optional.ofNullable(node.getInputProps()).map(props -> props.getString("type")).orElse(null); if (jobType != null && jobId != null) { Props rampProps = this.flow.getRampPropsForJob(jobId, jobType); if (rampProps != null) { this.flowIsRamping = true; logger.info(String.format( "RAMP_FLOW_ATTACH_PROPS_FOR_JOB : (flow.ExecId = %d, flow.Id = %s, flow.flowName = %s, job.id = %s, job.type = %s, props = %s)", this.flow.getExecutionId(), this.flow.getId(), this.flow.getFlowName(), jobId, jobType, rampProps.toString())); node.setRampProps(rampProps); } } final JobRunner runner = createJobRunner(node); this.logger.info("Submitting job '" + node.getNestedId() + "' to run."); try { this.executorService.submit(runner); this.activeJobRunners.add(runner); } catch (final RejectedExecutionException e) { this.logger.error(e); } }

Target:
private void runExecutableNode(final ExecutableNode node) throws IOException { prepareJobProperties(node); node.setStatus(Status.QUEUED); String jobId = node.getId(); String jobType = Optional.ofNullable(node.getInputProps()).map(props -> props.getString("type")).orElse(null); if (jobType != null && jobId != null) { Props rampProps = this.flow.getRampPropsForJob(jobId, jobType); if (rampProps != null) { this.flowIsRamping = true; logger.info(String.format( "RAMP_FLOW_ATTACH_PROPS_FOR_JOB : (flow.ExecId = %d, flow.Id = %s, flow.flowName = %s, job.id = %s, job.type = %s, props = %s)", this.flow.getExecutionId(), this.flow.getId(), this.flow.getFlowName(), jobId, jobType, rampProps.toString())); node.setRampProps(rampProps); } } else { logger.warn(String.format( "RAMP_FLOW_ATTACH_PROPS_FOR_JOB : (flow.ExecId = %d, flow.Id = %s, flow.flowName = %s) does not have Job Type or Id", this.flow.getExecutionId(), this.flow.getId(), this.flow.getFlowName())); } final JobRunner runner = createJobRunner(node); this.logger.info("Submitting job '" + node.getNestedId() + "' to run."); try { this.executorService.submit(runner); this.activeJobRunners.add(runner); } catch (final RejectedExecutionException e) { this.logger.error(e); } }
Source:
public WorkspaceDto addEnvironment(@ApiParam("The workspace id") @PathParam("id") String id, @ApiParam(value = "The new environment", required = true) EnvironmentDto newEnvironment, @ApiParam(value = "The name of the environment", required = true) @QueryParam("name") String envName) throws ServerException, BadRequestException, NotFoundException, ConflictException, ForbiddenException { requiredNotNull(newEnvironment, "New environment"); requiredNotNull(envName, "New environment name"); relativizeRecipeLinks(newEnvironment); workspaceManager.addEnvironment(id, envName, newEnvironment); return linksInjector.injectLinks(asDto(workspaceManager.getWorkspace(id)), getServiceContext()); }

Target:
public WorkspaceDto addEnvironment(@ApiParam("The workspace id") @PathParam("id") String id, @ApiParam(value = "The new environment", required = true) EnvironmentDto newEnvironment, @ApiParam(value = "The name of the environment", required = true) @QueryParam("name") String envName) throws ServerException, BadRequestException, NotFoundException, ConflictException, ForbiddenException { requiredNotNull(newEnvironment, "New environment"); requiredNotNull(envName, "New environment name"); relativizeRecipeLinks(newEnvironment); final WorkspaceImpl workspace = workspaceManager.getWorkspace(id); if (workspace.getConfig().getEnvironments().put(envName, new EnvironmentImpl(newEnvironment)) != null) { throw new ConflictException(format("Environment '%s' already exists", envName)); } validator.validateConfig(workspace.getConfig()); return linksInjector.injectLinks(asDto(workspaceManager.updateWorkspace(id, workspace)), getServiceContext()); }
Source:
public static String loadResource( final String name ) throws Exception { final InputStream in = VerifierWebWorkerServlet.class.getResourceAsStream( name ); final Reader reader = new InputStreamReader( in ); final StringBuilder text = new StringBuilder(); final char[] buf = new char[1024]; int len = 0; while ( ( len = reader.read( buf ) ) >= 0 ) { text.append( buf, 0, len ); } return text.toString(); }

Target:
public static String loadResource( final String name ) throws Exception { final InputStream in = VerifierWebWorkerServlet.class.getResourceAsStream( name ); final Reader reader = new InputStreamReader( in, StandardCharsets.UTF_8 ); final StringBuilder text = new StringBuilder(); final char[] buf = new char[1024]; int len = 0; while ( ( len = reader.read( buf ) ) >= 0 ) { text.append( buf, 0, len ); } return text.toString(); }
Source:
protected void zoomEntries(@NonNull Iterable<TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, @NonNull IProgressMonitor monitor) { Sampling sampling = new Sampling(zoomStartTime, zoomEndTime, resolution); for (TimeGraphEntry entry : entries) { if (zoomStartTime <= fStartTime && zoomEndTime >= fEndTime) { entry.setZoomedEventList(null); } else if (!sampling.equals(entry.getSampling())) { List<ITimeEvent> zoomedEventList = getEventList(entry, zoomStartTime, zoomEndTime, resolution, monitor); if (zoomedEventList != null && !monitor.isCanceled()) { entry.setZoomedEventList(zoomedEventList); entry.setSampling(sampling); } } } redraw(); }

Target:
protected void zoomEntries(@NonNull Iterable<TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, @NonNull IProgressMonitor monitor) { Sampling sampling = new Sampling(zoomStartTime, zoomEndTime, resolution); for (TimeGraphEntry entry : entries) { if (zoomStartTime <= fStartTime && zoomEndTime >= fEndTime) { applyResults(() -> entry.setZoomedEventList(null)); } else if (!sampling.equals(entry.getSampling())) { List<ITimeEvent> zoomedEventList = getEventList(entry, zoomStartTime, zoomEndTime, resolution, monitor); if (zoomedEventList != null && !monitor.isCanceled()) { applyResults(() -> { entry.setZoomedEventList(zoomedEventList); entry.setSampling(sampling); }); } } } redraw(); }
Source:
public Object get(ResultSet resultSet, int column) throws SQLException { switch (this) { case OBJECT: return resultSet.getObject(column + 1); case STRING: return resultSet.getString(column + 1); case INT: return resultSet.getInt(column + 1); case LONG: return resultSet.getLong(column + 1); case DOUBLE: case DECIMAL: return resultSet.getDouble(column + 1); default: throw Util.unexpected(this); } }

Target:
public Object get(ResultSet resultSet, int column) throws SQLException { switch (this) { case OBJECT: return resultSet.getObject(column + 1); case STRING: return resultSet.getString(column + 1); case INT: return resultSet.getInt(column + 1); case LONG: return resultSet.getLong(column + 1); case DOUBLE: return resultSet.getDouble(column + 1); case DECIMAL: BigDecimal decimal = resultSet.getBigDecimal( column + 1 ); return decimal == null ? null : decimal.doubleValue(); default: throw Util.unexpected(this); } }
Source:
public CompletableFuture<CoordinationResponse> sendCoordinationRequest( JobID jobId, OperatorID operatorId, CoordinationRequest request) { ClientCoordinationHeaders headers = ClientCoordinationHeaders.getInstance(); ClientCoordinationMessageParameters params = new ClientCoordinationMessageParameters(); params.jobPathParameter.resolve(jobId); params.operatorPathParameter.resolve(operatorId); SerializedValue<CoordinationRequest> serializedRequest; try { serializedRequest = new SerializedValue<>(request); } catch (IOException e) { return FutureUtils.completedExceptionally(e); } ClientCoordinationRequestBody requestBody = new ClientCoordinationRequestBody(serializedRequest); return sendRequest(headers, params, requestBody).thenApply( responseBody -> { try { return responseBody .getSerializedCoordinationResponse() .deserializeValue(getClass().getClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new RuntimeException("Failed to deserialize coordination response", e); } }); }

Target:
public CompletableFuture<CoordinationResponse> sendCoordinationRequest( JobID jobId, OperatorID operatorId, CoordinationRequest request) { ClientCoordinationHeaders headers = ClientCoordinationHeaders.getInstance(); ClientCoordinationMessageParameters params = new ClientCoordinationMessageParameters(); params.jobPathParameter.resolve(jobId); params.operatorPathParameter.resolve(operatorId); SerializedValue<CoordinationRequest> serializedRequest; try { serializedRequest = new SerializedValue<>(request); } catch (IOException e) { return FutureUtils.completedExceptionally(e); } ClientCoordinationRequestBody requestBody = new ClientCoordinationRequestBody(serializedRequest); return sendRequest(headers, params, requestBody).thenApply( responseBody -> { try { return responseBody .getSerializedCoordinationResponse() .deserializeValue(getClass().getClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new CompletionException("Failed to deserialize coordination response", e); } }); }
Source:
public void testBasicSoftwareProcessStopEverythingExplicitly() throws Exception { MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class)); entity.start(ImmutableList.of(loc)); SimulatedDriver d = (SimulatedDriver) entity.getDriver(); Location machine = Iterables.getOnlyElement(entity.getLocations()); d.events.clear(); TaskAdaptable<Void> t1 = Entities.submit(entity, Effectors.invocation(entity, Startable.STOP, ConfigBag.newInstance().configure(StopSoftwareParameters.STOP_MACHINE, StopMachineMode.TRUE))); t1.asTask().get(); assertEquals(d.events, ImmutableList.of("stop")); assertEquals(entity.getLocations().size(), 0); assertTrue(loc.getAvailable().contains(machine)); }

Target:
public void testBasicSoftwareProcessStopEverythingExplicitly() throws Exception { MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class)); entity.start(ImmutableList.of(loc)); SimulatedDriver d = (SimulatedDriver) entity.getDriver(); Location machine = Iterables.getOnlyElement(entity.getLocations()); d.events.clear(); TaskAdaptable<Void> t1 = Entities.submit(entity, Effectors.invocation(entity, Startable.STOP, ConfigBag.newInstance().configure(StopSoftwareParameters.STOP_MACHINE, true))); t1.asTask().get(); assertEquals(d.events, ImmutableList.of("stop")); assertEquals(entity.getLocations().size(), 0); assertTrue(loc.getAvailable().contains(machine)); }
Source:
public void setSelectedElement(ObjectId objectId) { if (null == objectId) { return; } for (int i = 0; i < commits.size(); i++) if (objectId.equals(commits.get(i).objectId)) { combo.select(i); break; } }

Target:
public void setSelectedElement(ObjectId objectId) { if (objectId == null) { return; } for (int i = 0; i < commits.size(); i++) if (objectId.equals(commits.get(i).objectId)) { combo.select(i); break; } }
Source:
public void setQueues(Queue... queues) { final String[] queueNames = new String[queues.length]; for (int i = 0; i < queues.length; i++) { Assert.notNull(queues[i], "Queue (" + i + ") must not be null."); queueNames[i] = queues[i].getName(); } setQueueNames(queueNames); }

Target:
public final void setQueues(Queue... queues) { setQueueNames(collectQueueNames(queues)); }
Source:
protected EPackage createModel(EPackage parent, TestRemoteEPackage remotePackage) { EPackage pckg = EcoreFactory.eINSTANCE.createEPackage(); pckg.setName(remotePackage.name.replaceAll("Remote", "Local")); System.err.println(pckg); return pckg; }

Target:
protected EPackage createModel(EPackage parent, TestRemoteEPackage remotePackage) { EPackage pckg = EcoreFactory.eINSTANCE.createEPackage(); pckg.setName(remotePackage.name.replaceAll("Remote", "Local")); return pckg; }