auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PushResponse push(PushRequest request) throws GitException, UnauthorizedException { String remoteName = request.getRemote(); String remoteUri = getRepository().getConfig().getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, ConfigConstants.CONFIG_KEY_URL); try { PushCommand pushCommand = getGit().push(); if (request.getRemote() != null) { pushCommand.setRemote(remoteName); } List<String> refSpec = request.getRefSpec(); if (!refSpec.isEmpty()) { List<RefSpec> refSpecInst = new ArrayList<>(refSpec.size()); refSpecInst.addAll(refSpec.stream().map(RefSpec::new).collect(Collectors.toList())); pushCommand.setRefSpecs(refSpecInst); } pushCommand.setForce(request.isForce()); int timeout = request.getTimeout(); if (timeout > 0) { pushCommand.setTimeout(timeout); } @SuppressWarnings("unchecked") Iterable<PushResult> list = (Iterable<PushResult>)executeRemoteCommand(remoteUri, pushCommand); PushResult pushResult = list.iterator().next(); String currentBranch = getCurrentBranch(); return generatePushResponse(request, pushResult, currentBranch); } catch (GitAPIException exception) { return newDto(PushResponse.class).withCommandOutput(exception.getMessage()); } }

Target:
public PushResponse push(PushRequest request) throws GitException, UnauthorizedException { String remoteName = request.getRemote(); String remoteUri = getRepository().getConfig().getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, ConfigConstants.CONFIG_KEY_URL); PushResponse pushResponseDto = newDto(PushResponse.class); try { PushCommand pushCommand = getGit().push(); if (request.getRemote() != null) { pushCommand.setRemote(remoteName); } List<String> refSpec = request.getRefSpec(); if (!refSpec.isEmpty()) { List<RefSpec> refSpecInst = new ArrayList<>(refSpec.size()); refSpecInst.addAll(refSpec.stream().map(RefSpec::new).collect(Collectors.toList())); pushCommand.setRefSpecs(refSpecInst); } pushCommand.setForce(request.isForce()); int timeout = request.getTimeout(); if (timeout > 0) { pushCommand.setTimeout(timeout); } @SuppressWarnings("unchecked") Iterable<PushResult> pushResults = (Iterable<PushResult>)executeRemoteCommand(remoteUri, pushCommand); PushResult pushResult = pushResults.iterator().next(); return addCommandOutputUpdates(pushResponseDto, request, pushResult); } catch (GitAPIException exception) { if ("origin: not found.".equals(exception.getMessage())) { throw new GitException(ERROR_NO_REMOTE_REPOSITORY, exception); } else { throw new GitException(exception.getMessage(), exception); } } }
Source:
public List<ChangeMessage> byChange(ReviewDb db, ChangeNotes notes) throws OrmException { List<ChangeMessage> changeMessages; if (!migration.readChangeMessages()) { ImmutableListMultimap.Builder<PatchSet.Id, ChangeMessage> result = ImmutableListMultimap.builder(); for (ChangeMessage cm : db.changeMessages().byChange(notes.getChangeId())) { result.put(cm.getPatchSetId(), cm); } changeMessages = sortChangeMessages(result.build().values()); } else { changeMessages = sortChangeMessages(notes.load().getChangeMessages().values()); } return changeMessages; }

Target:
public List<ChangeMessage> byChange(ReviewDb db, ChangeNotes notes) throws OrmException { if (!migration.readChangeMessages()) { ImmutableListMultimap.Builder<PatchSet.Id, ChangeMessage> result = ImmutableListMultimap.builder(); for (ChangeMessage cm : db.changeMessages().byChange(notes.getChangeId())) { result.put(cm.getPatchSetId(), cm); } return sortChangeMessages(result.build().values()); } else { return sortChangeMessages(notes.load().getChangeMessages().values()); } }
Source:
public static SampleDto asMinimalDto(Sample from) { DetailedSampleDto dto = new DetailedSampleDto(); if (isDetailedSample(from)) { dto.setSampleClassId(((DetailedSample) from).getSampleClass().getId()); } dto.setId(from.getId()); dto.setName(from.getName()); dto.setDescription(from.getDescription()); dto.setUpdatedById(from.getLastModifier().getUserId()); if (!isStringEmptyOrNull(from.getIdentificationBarcode())) { dto.setIdentificationBarcode(from.getIdentificationBarcode()); } dto.setLocationLabel(BoxUtils.makeLocationLabel(from)); dto.setBoxId(from.getBox() == null ? null : from.getBox().getId()); dto.setSampleType(from.getSampleType()); if (from.getReceivedDate() != null) { dto.setReceivedDate(dateTimeFormatter.print(from.getReceivedDate().getTime())); } if (from.getQcPassed() != null) { dto.setQcPassed(from.getQcPassed()); } if (!isStringEmptyOrNull(from.getAlias())) { dto.setAlias(from.getAlias()); } dto.setProjectId(from.getProject().getProjectId()); dto.setScientificName(from.getScientificName()); if (!isStringEmptyOrNull(from.getTaxonIdentifier())) { dto.setTaxonIdentifier(from.getTaxonIdentifier()); } dto.setVolume(from.getVolume()); dto.setDiscarded(from.isDiscarded()); dto.setLastModified(getDateAsString(from.getLastModified())); return dto; }

Target:
public static SampleDto asMinimalDto(Sample from) { DetailedSampleDto dto = new DetailedSampleDto(); copySampleFields(from, dto); if (isDetailedSample(from)) { dto.setSampleClassId(((DetailedSample) from).getSampleClass().getId()); } return dto; }
Source:
public boolean shouldWarn(SolGame game) { hero = game.getHero(); if (hero.isTranscendent()) { return false; } Vector2 position = hero.getPosition(); Vector2 velocity = hero.getVelocity(); float acc = hero.getAcceleration(); float speed = velocity.len(); float speedAngle = SolMath.angle(velocity); if (acc <= 0 || speed < 2 * acc) { return false; } float breakWay = speed * speed / acc / 2; breakWay += 2 * speed; Vector2 finalPos = SolMath.getVec(0, 0); SolMath.fromAl(finalPos, speedAngle, breakWay); finalPos.add(position); warnCallback.show = false; game.getObjectManager().getWorld().rayCast(warnCallback, position, finalPos); SolMath.free(finalPos); return warnCallback.show; }

Target:
public boolean shouldWarn(SolGame game) { hero = game.getHero(); if (hero.isTranscendent()) { return false; } Vector2 position = hero.getPosition(); Vector2 velocity = hero.getVelocity(); float acc = hero.getAcceleration(); float speed = velocity.len(); float velocityAngle = SolMath.angle(velocity); if (acc <= 0 || speed < 2 * acc) { return false; } float breakWay = speed * speed / acc / 2; breakWay += 2 * speed; Vector2 finalPos = SolMath.getVec(0, 0); SolMath.fromAl(finalPos, velocityAngle, breakWay); finalPos.add(position); warnCallback.show = false; game.getObjectManager().getWorld().rayCast(warnCallback, position, finalPos); SolMath.free(finalPos); return warnCallback.show; }
Source:
public void displaying_a_custom_build_description() throws Exception { givenThat(dave).wasAbleTo( Navigate.to(jenkins.url()), HaveAProjectCreated.called("Example Github Project").andConfiguredTo( ExecuteAShellScript.that(outputsGithubProjectLog()), SetBuildDescription.to("Revision: \\1").basedOnLogLineMatching("Checking out Revision ([^\\w]{6})") ), ScheduleABuild.of("Example Github Project") ); when(dave).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); then(dave).should(seeThat(ProjectWidget.of("Example Github Project").details(), is("Revision: 67f4b3"))); }

Target:
public void displaying_a_custom_build_description() throws Exception { givenThat(dave).wasAbleTo( Navigate.to(jenkins.url()), HaveAProjectCreated.called("Example Github Project").andConfiguredTo( ExecuteAShellScript.that(outputsGithubProjectLog()), SetBuildDescription.to("Revision: \\1").basedOnLogLineMatching("Checking out Revision ([\\w]{6})") ), ScheduleABuild.of("Example Github Project") ); when(dave).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); then(dave).should(seeThat(ProjectWidget.of("Example Github Project").details(), is("Revision: 67f4b3"))); }
Source:
public MethodOutcome createFHIRPractitioner(@ResourceParam Practitioner practitioner) { practitioner = practitionerResource.createFHIRPractitioner(practitioner); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdDt(FHIRConstants.PERSON, practitioner.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Practitioner is successfully created"); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }

Target:
public MethodOutcome createFHIRPractitioner(@ResourceParam Practitioner practitioner) { practitioner = practitionerResource.createFHIRPractitioner(practitioner); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdType(FHIRConstants.PERSON, practitioner.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Practitioner is successfully created with id " + practitioner.getId()); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }
Source:
public void cancelFlow(ExecutableFlow exFlow, String userId) throws ExecutorManagerException { synchronized (exFlow) { if (runningFlows.containsKey(exFlow.getExecutionId())) { Pair<ExecutionReference, ExecutableFlow> pair = runningFlows.get(exFlow.getExecutionId()); callExecutorServer(pair.getFirst(), ConnectorParams.CANCEL_ACTION, userId); } else if (queuedFlowMap.containsKey(exFlow.getExecutionId())) { Pair<ExecutionReference, ExecutableFlow> pair = queuedFlowMap.get(exFlow.getExecutionId()); synchronized (pair) { dequeueFlow(exFlow.getExecutionId()); finalizeFlows(exFlow); } } else { throw new ExecutorManagerException("Execution " + exFlow.getExecutionId() + " of flow " + exFlow.getFlowId() + " isn't running."); } } }

Target:
public void cancelFlow(ExecutableFlow exFlow, String userId) throws ExecutorManagerException { synchronized (exFlow) { if (runningFlows.containsKey(exFlow.getExecutionId())) { Pair<ExecutionReference, ExecutableFlow> pair = runningFlows.get(exFlow.getExecutionId()); callExecutorServer(pair.getFirst(), ConnectorParams.CANCEL_ACTION, userId); } else if (queuedFlows.hasExecution(exFlow.getExecutionId())) { queuedFlows.dequeue(exFlow.getExecutionId()); finalizeFlows(exFlow); } else { throw new ExecutorManagerException("Execution " + exFlow.getExecutionId() + " of flow " + exFlow.getFlowId() + " isn't running."); } } }
Source:
public MaxwellContext(MaxwellConfig config) { this.config = config; this.replicationConnectionPool = new ConnectionPool("ReplicationConnectionPool", 10, 0, 10, config.replicationMysql.getConnectionURI(), config.replicationMysql.user, config.replicationMysql.password); this.rawMaxwellConnectionPool = new ConnectionPool("RawMaxwellConenectionPool", 1, 2, 100, config.maxwellMysql.getConnectionURI(false), config.maxwellMysql.user, config.maxwellMysql.password); this.maxwellConnectionPool = new ConnectionPool("MaxwellConnectionPool", 10, 0, 10, config.maxwellMysql.getConnectionURI(), config.maxwellMysql.user, config.maxwellMysql.password); this.maxwellConnectionPool.setCaching(false); if ( this.config.initPosition != null ) this.initialPosition = this.config.initPosition; }

Target:
public MaxwellContext(MaxwellConfig config) { this.config = config; this.replicationConnectionPool = new ConnectionPool("ReplicationConnectionPool", 10, 0, 10, config.replicationMysql.getConnectionURI(false), config.replicationMysql.user, config.replicationMysql.password); this.rawMaxwellConnectionPool = new ConnectionPool("RawMaxwellConnectionPool", 1, 2, 100, config.maxwellMysql.getConnectionURI(false), config.maxwellMysql.user, config.maxwellMysql.password); this.maxwellConnectionPool = new ConnectionPool("MaxwellConnectionPool", 10, 0, 10, config.maxwellMysql.getConnectionURI(), config.maxwellMysql.user, config.maxwellMysql.password); this.maxwellConnectionPool.setCaching(false); if ( this.config.initPosition != null ) this.initialPosition = this.config.initPosition; }
Source:
public boolean accepts(final JSONObject event) { final EventValidator validator = qualifiedValidators.stream().filter(it -> it.getQualifier().getMatch().equals( event.getString(it.getQualifier().getField()))) .map(EventValidator.class::cast).findFirst().orElse( defaultSchemaValidator); return validator.accepts(event); }

Target:
public boolean accepts(final JSONObject event) { final Predicate<QualifiedJSONSchemaValidator> matchingQualifier = it -> it.getQualifier().getMatch().equals(event.getString(it.getQualifier().getField())); final EventValidator validator = qualifiedValidators.stream().filter(matchingQualifier) .map(EventValidator.class::cast).findFirst().orElse( defaultSchemaValidator); return validator.accepts(event); }
Source:
public static void delayUntilTraceOpened(final ITmfProjectModelElement projectElement) throws TimeoutException { if (projectElement instanceof TmfTraceElement) { TmfTraceElement traceElement = (TmfTraceElement) projectElement; int cnt = 0; while ((traceElement.getTrace() == null) && (cnt++ < DELAY_COUNTER)) { delayThread(DEFAULT_DELAY); } if (traceElement.getTrace() == null) { throw new TimeoutException(); } } else { delayThread(DEFAULT_DELAY); } }

Target:
public static void delayUntilTraceOpened(final ITmfProjectModelElement projectElement) throws TimeoutException { if (projectElement instanceof TmfTraceElement) { TmfTraceElement traceElement = (TmfTraceElement) projectElement; final long deadline = System.nanoTime() + (DELAY_COUNTER * DEFAULT_DELAY * 1000000); do { delayThread(DEFAULT_DELAY); if (traceElement.getTrace() != null) { return; } } while (System.nanoTime() < deadline); throw new TimeoutException("Timeout while waiting for " + traceElement); } delayThread(DEFAULT_DELAY); }
Source:
private JClassType getBootstrapper() throws UnableToCompleteException { String typeName = lookupTypeNameByProperty("gwtp.bootstrapper"); if (typeName == null) { getTreeLogger() .log(TreeLogger.ERROR, "Error reading required configuration property 'gwtp.bootstrapper'!."); throw new UnableToCompleteException(); } return findAndVerifyType(typeName, Bootstrapper.class); }

Target:
private JClassType getBootstrapper() throws UnableToCompleteException { String typeName = lookupTypeNameByProperty(PROPERTY_NAME_BOOTSTRAPPER); if (typeName == null) { getTreeLogger() .log(TreeLogger.ERROR, PROPERTY_BOOTSTRAPPER_EMPTY); throw new UnableToCompleteException(); } return findAndVerifyType(typeName, Bootstrapper.class); }
Source:
public static Channel execRemote(String[] args, OutputStream out, OutputStream err, String user, String host, String password, int port, String[] envp) throws JSchException { JSch jsch = new JSch(); Session session = jsch.getSession(user, host, port); session.setPassword(password); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); StringBuilder command = new StringBuilder(); if (envp != null) { for (String var : envp) { command.append(String.format("export %s; ", var)); } } for (int i = 0; i < args.length; i++) { command.append(args[i] + ' '); } ChannelExec channel = (ChannelExec) session.openChannel("exec"); channel.setCommand(command.toString()); channel.setInputStream(null, true); channel.setOutputStream(out, true); channel.setExtOutputStream(err, true); channel.connect(); return channel; }

Target:
public static Channel execRemote(String[] args, OutputStream out, OutputStream err, String user, String host, String password, int port, String[] envp) throws JSchException { JSch jsch = new JSch(); Session session = jsch.getSession(user, host, port); session.setPassword(password); Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); StringBuilder command = new StringBuilder(); if (envp != null) { for (String var : envp) { command.append(String.format("export %s; ", var)); } } for (int i = 0; i < args.length; i++) { command.append(args[i] + ' '); } ChannelExec channel = (ChannelExec) session.openChannel("exec"); channel.setCommand(command.toString()); channel.setInputStream(null, true); channel.setOutputStream(out, true); channel.setExtOutputStream(err, true); channel.connect(); return channel; }
Source:
public void emit(Event event) { if (event instanceof ServiceMetricEvent) { ServiceMetricEvent metricEvent = (ServiceMetricEvent) event; String host = metricEvent.getHost(); String service = metricEvent.getService(); String metric = metricEvent.getMetric(); Map<String, Object> userDims = metricEvent.getUserDims(); Number value = metricEvent.getValue(); ImmutableList.Builder<String> nameBuilder = new ImmutableList.Builder<>(); LinkedHashMap<String, String> dims = new LinkedHashMap<>(); final DropwizardMetricSpec metricSpec = converter.addFilteredUserDims(service, metric, userDims, dims); if (metricSpec != null) { if (config.isIncludeDimensionNames()) { if (config.getPrefix() != null) { nameBuilder.add(config.getPrefix()); } nameBuilder.add("metric=" + metric); nameBuilder.add("service=" + service); if (config.getIncludeHost()) { nameBuilder.add("hostname=" + host); } dims.forEach((key, value1) -> nameBuilder.add(key + "=" + value1)); } else { nameBuilder.add(metric); nameBuilder.add(service); if (config.getIncludeHost()) { nameBuilder.add(host); } nameBuilder.addAll(dims.values()); } String fullName = StringUtils.replaceChar(Joiner.on(",").join(nameBuilder.build()), '/', "."); updateMetric(fullName, value, metricSpec); } else { log.debug("Service=[%s], Metric=[%s] has no mapping", service, metric); } } else if (event instanceof AlertEvent) { for (Emitter emitter : alertEmitters) { emitter.emit(event); } } else { throw new ISE("unknown event type [%s]", event.getClass()); } }

Target:
public void emit(Event event) { synchronized (started) { if (!started.get()) { throw new RejectedExecutionException("Dropwizard emitter Service not started."); } } if (event instanceof ServiceMetricEvent) { ServiceMetricEvent metricEvent = (ServiceMetricEvent) event; String host = metricEvent.getHost(); String service = metricEvent.getService(); String metric = metricEvent.getMetric(); Map<String, Object> userDims = metricEvent.getUserDims(); Number value = metricEvent.getValue(); ImmutableList.Builder<String> nameBuilder = new ImmutableList.Builder<>(); LinkedHashMap<String, String> dims = new LinkedHashMap<>(); final DropwizardMetricSpec metricSpec = converter.addFilteredUserDims(service, metric, userDims, dims); if (metricSpec != null) { if (config.getPrefix() != null) { nameBuilder.add(config.getPrefix()); } nameBuilder.add(StringUtils.format("metric=%s", metric)); nameBuilder.add(StringUtils.format("service=%s", service)); if (config.getIncludeHost()) { nameBuilder.add(StringUtils.format("hostname=%s", host)); } dims.forEach((key, value1) -> nameBuilder.add(StringUtils.format("%s=%s", key, value1))); String fullName = StringUtils.replaceChar(Joiner.on(",").join(nameBuilder.build()), '/', "."); updateMetric(fullName, value, metricSpec); } else { log.debug("Service=[%s], Metric=[%s] has no mapping", service, metric); } } else if (event instanceof AlertEvent) { for (Emitter emitter : alertEmitters) { emitter.emit(event); } } else { throw new ISE("unknown event type [%s]", event.getClass()); } }
Source:
public static boolean isSymLink(File file, final TaskListener listener) { if (file == null) return false; try { File canon; if (file.getParent() == null) { canon = file; } else { File canonDir = file.getParentFile().getCanonicalFile(); canon = new File(canonDir, file.getName()); } return !canon.getCanonicalFile().equals(canon.getAbsoluteFile()); } catch (IOException ex) { listener.getLogger().println("JENKINS-23234 isSymLink exception:" + ex); } return false; }

Target:
public static boolean isSymLink(File file, final TaskListener listener) { if (file == null) { return false; } try { File canon; if (file.getParent() == null) { canon = file; } else { File canonDir = file.getParentFile().getCanonicalFile(); canon = new File(canonDir, file.getName()); } return !canon.getCanonicalFile().equals(canon.getAbsoluteFile()); } catch (IOException ex) { ex.printStackTrace(listener.error("Ignoring exception when checking for symlink. file:" + file + " exception:" + ex.getMessage())); } return false; }
Source:
protected AnnotationDetailEditorPanel(String id, IModel<AnnotatorState> aModel) { super(id, aModel); setOutputMarkupId(true); add(createAnnotationFeatureForm()); }

Target:
public AnnotationDetailEditorPanel(String id, IModel<AnnotatorState> aModel) { super(id, aModel); setOutputMarkupId(true); add(createAnnotationFeatureForm()); }
Source:
public Scheduler cleanupResponseUrlDataScheduler() throws SchedulerException { return this.constructScheduler(AbstractSchedulingConfigBuilder.newBuilder() .withJobClass(ResponseDataCleanupJob.class).withThreadCountKey(KEY_CLEANUP_JOB_THREAD_COUNT) .withCronExpressionKey(KEY_CLEANUP_JOB_CRON_EXPRESSION).withJobStoreDbUrl(this.getDatabaseUrl()) .withJobStoreDbUsername(this.databaseUsername).withJobStoreDbPassword(this.databasePassword) .withJobStoreDbDriver(this.databaseDriver).build()); }

Target:
public Scheduler cleanupResponseUrlDataScheduler() throws SchedulerException { AbstractSchedulingConfigBuilder abstractSchedulingConfig = AbstractSchedulingConfigBuilder.newBuilder() .withJobClass(ResponseDataCleanupJob.class).withThreadCountKey(KEY_CLEANUP_JOB_THREAD_COUNT) .withCronExpressionKey(KEY_CLEANUP_JOB_CRON_EXPRESSION).withJobStoreDbUrl(this.getDatabaseUrl()) .withJobStoreDbUsername(this.databaseUsername).withJobStoreDbPassword(this.databasePassword) .withJobStoreDbDriver(this.databaseDriver).build(); return this.constructScheduler(abstractSchedulingConfig); }
Source:
protected Pattern getStartError() { return Pattern.compile(".*\\[org\\.jboss\\.as\\].*stopped in.*"); }

Target:
protected Pattern getStartError() { return Pattern.compile(".*\\[org\\.jboss\\.as\\].*started \\(with errors\\) in.*"); }
Source:
public ByteBuffer serialize(Long object) throws IOException { LOG.info("serializing {}", object); ByteBuffer byteBuffer = ByteBuffer.allocate(8); byteBuffer.putLong(object); byteBuffer.flip(); return byteBuffer; }

Target:
public ByteBuffer serialize(Long object) throws IOException { ByteBuffer byteBuffer = ByteBuffer.allocate(8); byteBuffer.putLong(object); byteBuffer.flip(); return byteBuffer; }
Source:
public void scan(Iterable<File> files) { simpleScan(files); }

Target:
public void scan(Iterable<File> files) { ProgressReport progressReport = new ProgressReport("Report about progress of Java AST analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(files)); boolean successfullyCompleted = false; try { for (File file : files) { simpleScan(file); progressReport.nextFile(); } successfullyCompleted = true; } finally { if (successfullyCompleted) { progressReport.stop(); } else { progressReport.cancel(); } } }
Source:
protected AsyncRequestResponseHandler(RequestResponseHandlerMetrics metrics, int workerCount, RestRequestService restRequestService) { this.metrics = metrics; metrics.trackAsyncRequestResponseHandler(this); if (isRunning()) { throw new IllegalStateException("Cannot modify scaling unit count after the service has started"); } else if (workerCount < 0) { throw new IllegalArgumentException("Request worker workerCount has to be >= 0"); } else if (workerCount > 0 && restRequestService == null) { throw new IllegalArgumentException("RestRequestService cannot be null"); } requestWorkersCount = workerCount; this.restRequestService = restRequestService; this.restRequestService.setupResponseHandler(this); logger.trace("Instantiated AsyncRequestResponseHandler"); }

Target:
protected AsyncRequestResponseHandler(RequestResponseHandlerMetrics metrics, int workerCount, RestRequestService restRequestService) { this.metrics = metrics; metrics.trackAsyncRequestResponseHandler(this); if (workerCount < 0) { throw new IllegalArgumentException("Request worker workerCount has to be >= 0"); } else if (workerCount > 0 && restRequestService == null) { throw new IllegalArgumentException("RestRequestService cannot be null"); } requestWorkersCount = workerCount; this.restRequestService = restRequestService; this.restRequestService.setupResponseHandler(this); logger.trace("Instantiated AsyncRequestResponseHandler"); }
Source:
protected void recordCapabilitiesAndRequirements(final OperationContext context, final ModelNode operation, Resource resource) throws OperationFailedException { Set<RuntimeCapability> capabilitySet = capabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : capabilities; for (RuntimeCapability capability : capabilitySet) { if (capability.isDynamicallyNamed()) { context.registerCapability(capability.fromBaseCapability(context.getCurrentAddress())); } else { context.registerCapability(capability); } } ModelNode model = resource.getModel(); for (AttributeDefinition ad : attributes) { if (model.hasDefined(ad.getName()) || ad.hasCapabilityRequirements()) { ad.addCapabilityRequirements(context, resource, model.get(ad.getName())); } } ImmutableManagementResourceRegistration mrr = context.getResourceRegistration(); if (mrr.getRequirements() != null) { for (CapabilityReferenceRecorder recorder : mrr.getRequirements()) { recorder.addCapabilityRequirements(context, resource, null); } } }

Target:
protected void recordCapabilitiesAndRequirements(final OperationContext context, final ModelNode operation, Resource resource) throws OperationFailedException { Set<RuntimeCapability> capabilitySet = capabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : capabilities; for (RuntimeCapability capability : capabilitySet) { if (capability.isDynamicallyNamed()) { context.registerCapability(capability.fromBaseCapability(context.getCurrentAddress())); } else { context.registerCapability(capability); } } ModelNode model = resource.getModel(); for (AttributeDefinition ad : attributes) { if (model.hasDefined(ad.getName()) || ad.hasCapabilityRequirements()) { ad.addCapabilityRequirements(context, resource, model.get(ad.getName())); } } ImmutableManagementResourceRegistration mrr = context.getResourceRegistration(); assert mrr.getRequirements() != null; for (CapabilityReferenceRecorder recorder : mrr.getRequirements()) { recorder.addCapabilityRequirements(context, resource, null); } }
Source:
protected void initUserList() { try { this.user.addAll(serviceManager.getUserService().getAllActiveUsersSortedByNameAndSurname()); } catch (RuntimeException rte) { Helper.setErrorMessage("errorLoadingMany", new String[] {Helper.getTranslation("aktiveBenutzer") }); logger.warn("RuntimeException caught. List of users could be empty!"); } }

Target:
protected void initUserList() { try { this.user.addAll(serviceManager.getUserService().getAllActiveUsersSortedByNameAndSurname()); } catch (RuntimeException rte) { logger.warn("RuntimeException caught. List of users could be empty!"); Helper.setErrorMessage("errorLoadingMany", new Object[] {Helper.getTranslation("aktiveBenutzer") }); } }
Source:
public RowExpression toRowExpression(Subfield subfield, Type columnType) { List<Subfield.PathElement> path = subfield.getPath(); List<Type> types = new ArrayList<>(); types.add(columnType); for (int i = 0; i < path.size(); i++) { Type type = types.get(i); if (type instanceof RowType) { types.add(getFieldType((RowType) type, ((Subfield.NestedField) path.get(i)).getName())); } else if (type instanceof ArrayType) { types.add(((ArrayType) type).getElementType()); } else if (type instanceof MapType) { types.add(((MapType) type).getValueType()); } else { verify(false, "Unexpected type: " + type); } } return toRowExpression(subfield, types); }

Target:
public RowExpression toRowExpression(Subfield subfield, Type columnType) { List<Subfield.PathElement> path = subfield.getPath(); ImmutableList.Builder<Type> types = ImmutableList.builder(); types.add(columnType); Type type = columnType; for (int i = 0; i < path.size(); i++) { if (type instanceof RowType) { type = getFieldType((RowType) type, ((Subfield.NestedField) path.get(i)).getName()); types.add(type); } else if (type instanceof ArrayType) { type = ((ArrayType) type).getElementType(); types.add(type); } else if (type instanceof MapType) { type = ((MapType) type).getValueType(); types.add(type); } else { verify(false, "Unexpected type: " + type); } } return toRowExpression(subfield, types.build()); }
Source:
public String getHealthStatus() { return healthStatus; }

Target:
public String getHealthStatus() { return this.healthStatus; }
Source:
public List<SurveyedLocale> listPublicLocalesByGeocell(List<String> geocells, int pageSize) { PersistenceManager pm = PersistenceFilter.getManager(); String queryString = ":p1.contains(geocells) && pointType != 'Household'"; javax.jdo.Query query = pm.newQuery(SurveyedLocale.class,queryString); prepareCursor(null, pageSize, query); List<SurveyedLocale> results = (List<SurveyedLocale>) query.execute(geocells); return results; }

Target:
public List<SurveyedLocale> listPublicLocalesByGeocell(List<String> geocells, int pageSize) { PersistenceManager pm = PersistenceFilter.getManager(); String queryString = ":p1.contains(geocells) && localeType != 'Household'"; javax.jdo.Query query = pm.newQuery(SurveyedLocale.class,queryString); prepareCursor(null, pageSize, query); List<SurveyedLocale> results = (List<SurveyedLocale>) query.execute(geocells); return results; }
Source:
public Object findInjectableValue( Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance ) { if(Key.class.isAssignableFrom(valueId.getClass())){ return injector.getInstance((Key) valueId); } if(String.class.isAssignableFrom(valueId.getClass())){ try { return injector.getInstance(getClass().getClassLoader().loadClass((String)valueId)); } catch (ClassNotFoundException e) { throw new IAE(e, "Cannot load class [%s]", valueId.toString()); } } throw new IAE("Unknown class type [%s]", valueId.getClass().getCanonicalName()); }

Target:
public Object findInjectableValue( Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance ) { if(valueId instanceof Key){ return injector.getInstance((Key) valueId); } throw new IAE("Unknown class type [%s] for valueId [%s]", valueId.getClass().getCanonicalName(), valueId.toString()); }
Source:
public StatusOnlyReturnForXmlRpc glusterVolumeGeoRepSessionDelete(String volumeName, String remoteHost, String remoteVolumeName) { try { return new StatusOnlyReturnForXmlRpc(vdsServer.glusterVolumeGeoRepSessionDelete(volumeName, remoteVolumeName, remoteVolumeName)); } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } }

Target:
public StatusOnlyReturnForXmlRpc glusterVolumeGeoRepSessionDelete(String volumeName, String remoteHost, String remoteVolumeName) { try { return new StatusOnlyReturnForXmlRpc(vdsServer.glusterVolumeGeoRepSessionDelete(volumeName, remoteHost, remoteVolumeName)); } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } }
Source:
public String launch() throws Exception { LOG.error("Launching app in python app"); try { if (mode == LaunchMode.LOCAL) { appIdentifier = app.runLocal(); return "LocalMode"; } else { StramAppLauncher appLauncher = null; appLauncher = new StramAppLauncher(app.getName(), app.getConf()); appLauncher.loadDependencies(); PythonAppFactory appFactory = new PythonAppFactory(app.getName(), app); this.appIdentifier = appLauncher.launchApp(appFactory); return this.appIdentifier.toString(); } } catch (Exception e) { e.printStackTrace(); LOG.error("Failed TO Launch PYTHON Streaming Application"); LOG.error("Encountered Exception " + e.getMessage()); throw e; } }

Target:
public String launch() throws Exception { LOG.info("Launching app in python app"); try { if (mode == LaunchMode.LOCAL) { appIdentifier = app.runLocal(); return "LocalMode"; } else { StramAppLauncher appLauncher = null; appLauncher = new StramAppLauncher(app.getName(), app.getConf()); appLauncher.loadDependencies(); PythonAppFactory appFactory = new PythonAppFactory(app.getName(), app); this.appIdentifier = appLauncher.launchApp(appFactory); return this.appIdentifier.toString(); } } catch (Exception e) { e.printStackTrace(); LOG.error("Failed TO Launch PYTHON Streaming Application"); LOG.error("Encountered Exception " + e.getMessage()); throw e; } }
Source:
public static AccessorNamingStrategy getAccessorNamingStrategy() { AccessorNamingStrategy impl = get( AccessorNamingStrategy.class ); if ( impl == null ) { impl = new DefaultAccessorNamingStrategy(); } return impl; }

Target:
public static AccessorNamingStrategy getAccessorNamingStrategy() { return ACCESSOR_NAMING_STRATEGY; }
Source:
private void add(File f) { if (f.isDirectory()) { addFolder(f); } else if (f.getName().endsWith(".java")) { registerSource(f); } else if (options.translateClassfiles() && f.getName().endsWith(".class")) { String filepath = ARGC.getCanonicalPath(f); String source = doSaveClassDecompiled(f); if (source == null) return; filepath = filepath.substring(0, filepath.length() - 5) + "java"; System.out.println("discompiled: " + filepath); System.out.println(source); try { PrintStream out = new PrintStream(new FileOutputStream(filepath)); out.println(source); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } registerSource(new File(filepath)); } }

Target:
private void add(File f) { if (f.isDirectory()) { addFolder(f); } else if (f.getName().endsWith(".java")) { registerSource(f); } else if (options.translateClassfiles() && f.getName().endsWith(".class")) { String filepath = ARGC.getCanonicalPath(f); String source = doSaveClassDecompiled(f); if (source == null) return; filepath = filepath.substring(0, filepath.length() - 5) + "java"; try { PrintStream out = new PrintStream(new FileOutputStream(filepath)); out.println(source); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } registerSource(new File(filepath)); } else if (this.addSourceList) { File dir = options.fileUtil().getResourceDirectory(); if (dir != null) { String filename = ARGC.getCanonicalPath(f); if (filename.indexOf("/.") >= 0) { return; } filename = filename.substring(root.length()); File of = new File(dir.getAbsolutePath() + "/" + filename + "sss"); of.getParentFile().mkdirs(); try { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(of)); BufferedInputStream in = new BufferedInputStream(new FileInputStream(f)); for (int c; (c = in.read()) >= 0; ) { out.write(c); } out.flush(); out.close(); in.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }
Source:
public String getEntities(String query) throws URISyntaxException, IOException { URI uri = new URIBuilder().setPath(config.getProxyControllerUrl() + "/entities/").setParameter("query", query).build(); final Executor executor = Executor.newInstance(getHttpClient(100, 5000, 1)); return executor.execute(Request.Get(uri)).returnContent().asString(); }

Target:
public String getEntities(String query) throws URISyntaxException, IOException { URI uri = new URIBuilder().setPath(config.getProxyControllerUrl() + "/entities/").setParameter("query", query).build(); return getExecutor().execute(Request.Get(uri)).returnContent().asString(); }
Source:
protected Bitmap getBitmapFromUrl(String url) throws ImageStore.CantGetImageException { ImageStore is = new ImageStore(context, "Push Notifications"); return is.getImage(url); }

Target:
protected Bitmap getBitmapFromUrl(String url) { ImageStore is = new ImageStore(context, "MixpanelPushNotification"); try { Bitmap bm = is.getImage(url); return bm; } catch (ImageStore.CantGetImageException e) { return null; } }
Source:
public void Case5() { assertEquals(ImmutableList.of(0, 1, 1, 1), query().from(cat).orderBy(cat.id.asc()) .select(cat.mate.when(savedCats.get(0)).then(0).otherwise(1)).fetch()); List<Integer> rv = query().from(cat) .select(Expressions.cases() .when(cat.toes.in(2, 3)).then(cat.id.multiply(cat.toes)) .otherwise(4)).fetch(); assertInstancesOf(Integer.class, rv); }

Target:
public void Case5() { assertEquals(ImmutableList.of(0, 1, 1, 1), query().from(cat).orderBy(cat.id.asc()) .select(cat.mate.when(savedCats.get(0)).then(0).otherwise(1)).fetch()); }
Source:
public void toggle() { enabled = !enabled; System.out.println("Players location: " + Players.getMyPlayer().getLocation()); }

Target:
public void toggle() { enabled = !enabled; System.out.println("Location: " + Players.getMyPlayer().getLocation()); System.out.println("Plane: " + Game.getPlane()); }
Source:
protected void processIncoming() throws IOException, ClientConnectionException { if (this.ibuff == null) { int read = readBuffer(headerBuffer); if (read <= 0) { return; } this.message = getMessage(headerBuffer, read); int contentLength = this.message.getContentLength(); if (contentLength == -1) { emitOnMessageReceived(this.message); return; } int length = this.message.getContent().getBytes(UTF8).length; if (contentLength == length - 1) { emitOnMessageReceived(this.message); return; } else if (contentLength > length) { this.ibuff = ByteBuffer.allocate(contentLength - length + 1); } else { String content = this.message.getContent(); this.message.withContent(content.substring(0, contentLength)); emitOnMessageReceived(this.message); headerBuffer.put(content.substring(contentLength).getBytes(UTF8)); } } readBuffer(this.ibuff); String additionalContent = new String(this.ibuff.array(), UTF8); int length = this.message.getContent().getBytes(UTF8).length + additionalContent.getBytes(UTF8).length; if (this.message.getContentLength() != length - 1) { return; } this.message.withAdditionalContent(additionalContent); emitOnMessageReceived(this.message); }

Target:
protected void processIncoming() throws IOException, ClientConnectionException { if (this.ibuff == null) { int read = readBuffer(headerBuffer); if (read <= 0) { return; } this.message = getMessage(headerBuffer, read); int contentLength = this.message.getContentLength(); if (contentLength == -1) { emitOnMessageReceived(this.message); return; } int length = this.message.getContent().length; if (contentLength == length - 1) { emitOnMessageReceived(this.message); return; } else if (contentLength > length) { this.ibuff = ByteBuffer.allocate(contentLength - length + 1); } else { byte[] content = this.message.getContent(); this.message.withContent(Arrays.copyOfRange(content, 0, contentLength)); emitOnMessageReceived(this.message); headerBuffer.put(Arrays.copyOfRange(content, contentLength, content.length)); } } readBuffer(this.ibuff); byte[] additionalContent = this.ibuff.array(); int length = this.message.getContent().length + additionalContent.length; if (this.message.getContentLength() != length - 1) { return; } this.message.withAdditionalContent(additionalContent); emitOnMessageReceived(this.message); }
Source:
private void install(Path binaryPath) { try { platformService.setUnixExecutableBit(binaryPath); } catch (IOException e) { logger.warn("Unix execute bit could not be set", e); } String command = binaryPath.toAbsolutePath().toString(); try { logger.info("Starting installer at {}", command); new ProcessBuilder(command).inheritIO().start(); } catch (IOException e) { logger.warn("Installation could not be started", e); } }

Target:
void install(Path binaryPath) { try { platformService.setUnixExecutableAndWritableBits(binaryPath); } catch (IOException e) { logger.warn("Unix execute bit could not be set", e); } String command = binaryPath.toAbsolutePath().toString(); try { logger.info("Starting installer at {}", command); new ProcessBuilder(command).inheritIO().start(); } catch (IOException e) { logger.warn("Installation could not be started", e); } }
Source:
CredentialInformation(String connectionString) { if (CoreUtils.isNullOrEmpty(connectionString)) { throw new IllegalArgumentException("'Connection string' cannot be null or empty."); } String[] args = connectionString.split(";"); if (args.length < 3) { throw new IllegalArgumentException("invalid connection string segment count"); } URL baseUri = null; String id = null; byte[] secret = null; for (String arg : args) { String segment = arg.trim(); String lowerCase = segment.toLowerCase(Locale.US); if (lowerCase.startsWith(ENDPOINT)) { try { baseUri = new URL(segment.substring(ENDPOINT.length())); } catch (MalformedURLException ex) { throw new IllegalArgumentException(ex); } } else if (lowerCase.startsWith(ID)) { id = segment.substring(ID.length()); } else if (lowerCase.startsWith(SECRET)) { String secretBase64 = segment.substring(SECRET.length()); secret = Base64.getDecoder().decode(secretBase64); } } this.baseUri = baseUri; this.id = id; this.secret = secret; if (this.baseUri == null || this.id == null || this.secret == null) { throw new IllegalArgumentException("Could not parse 'connectionString'." + " Expected format: 'endpoint={endpoint};id={id};secret={secret}'. Actual:" + connectionString); } }

Target:
CredentialInformation(String connectionString) { if (CoreUtils.isNullOrEmpty(connectionString)) { throw new IllegalArgumentException("'connectionString' cannot be null or empty."); } String[] args = connectionString.split(";"); if (args.length < 3) { throw new IllegalArgumentException("invalid connection string segment count"); } URL baseUri = null; String id = null; byte[] secret = null; for (String arg : args) { String segment = arg.trim(); String lowerCase = segment.toLowerCase(Locale.US); if (lowerCase.startsWith(ENDPOINT)) { try { baseUri = new URL(segment.substring(ENDPOINT.length())); } catch (MalformedURLException ex) { throw new IllegalArgumentException(ex); } } else if (lowerCase.startsWith(ID)) { id = segment.substring(ID.length()); } else if (lowerCase.startsWith(SECRET)) { String secretBase64 = segment.substring(SECRET.length()); secret = Base64.getDecoder().decode(secretBase64); } } this.baseUri = baseUri; this.id = id; this.secret = secret; if (this.baseUri == null || this.id == null || this.secret == null) { throw new IllegalArgumentException("Could not parse 'connectionString'." + " Expected format: 'endpoint={endpoint};id={id};secret={secret}'. Actual:" + connectionString); } }
Source:
public void testUndefined() { foldSame("var x = undefined"); foldSame("function f(f) {var undefined=2;var x = undefined;}"); enableNormalize(); fold("var x = undefined", "var x=void 0"); foldSame( "var undefined = 1;" + "function f() {var undefined=2;var x = undefined;}"); foldSame("function f(undefined) {}"); foldSame("try catch(undefined) {}"); foldSame("for (undefined in {}) {}"); foldSame("undefined++;"); disableNormalize(); foldSame("undefined += undefined;"); }

Target:
public void testUndefined() { foldSame("var x = undefined"); foldSame("function f(f) {var undefined=2;var x = undefined;}"); enableNormalize(); fold("var x = undefined", "var x=void 0"); foldSame( "var undefined = 1;" + "function f() {var undefined=2;var x = undefined;}"); foldSame("function f(undefined) {}"); foldSame("try catch(undefined) {}"); foldSame("for (undefined in {}) {}"); foldSame("undefined++;"); disableNormalize(); foldSame("undefined += undefined;"); enableNormalize(); fold("undefined += undefined;", "undefined = void 0 + void 0;"); }
Source:
private void importDocuments(YamlNode imdgRoot) throws Exception { YamlMapping rootAsMapping = asMapping(imdgRoot); YamlSequence importSeq = rootAsMapping.childAsSequence(ConfigSections.IMPORT.name); if (importSeq == null || importSeq.childCount() == 0) { return; } for (YamlNode importNode : importSeq.children()) { String resource = asScalar(importNode).nodeValue(); URL url = ConfigLoader.locateConfig(resource); if (url == null) { throw new InvalidConfigurationException("Failed to load resource: " + resource); } if (!currentlyImportedFiles.add(url.getPath())) { throw new InvalidConfigurationException("Cyclic loading of resource '" + url.getPath() + "' detected!"); } YamlNode rootLoaded; try { rootLoaded = YamlLoader.load(url.openStream()); } catch (Exception ex) { throw new InvalidConfigurationException("Loading YAML document from resource " + url.getPath() + " failed", ex); } YamlNode imdgRootLoaded = asMapping(rootLoaded).child(ConfigSections.HAZELCAST.name().toLowerCase()); replaceVariables(asW3cNode(imdgRootLoaded)); importDocuments(imdgRootLoaded); merge(imdgRootLoaded, imdgRoot); } ((MutableYamlMapping) rootAsMapping).removeChild(ConfigSections.IMPORT.name); }

Target:
private void importDocuments(YamlNode imdgRoot) throws Exception { YamlMapping rootAsMapping = asMapping(imdgRoot); YamlSequence importSeq = rootAsMapping.childAsSequence(ConfigSections.IMPORT.name); if (importSeq == null || importSeq.childCount() == 0) { return; } for (YamlNode importNode : importSeq.children()) { String resource = asScalar(importNode).nodeValue(); URL url = ConfigLoader.locateConfig(resource); if (url == null) { throw new InvalidConfigurationException("Failed to load resource: " + resource); } if (!currentlyImportedFiles.add(url.getPath())) { throw new InvalidConfigurationException("Resource '" + url.getPath() + "' is already loaded! This can be due to" + " duplicate or cyclic imports."); } YamlNode rootLoaded; try { rootLoaded = YamlLoader.load(url.openStream()); } catch (Exception ex) { throw new InvalidConfigurationException("Loading YAML document from resource " + url.getPath() + " failed", ex); } YamlNode imdgRootLoaded = asMapping(rootLoaded).child(ConfigSections.HAZELCAST.name.toLowerCase()); if (imdgRootLoaded == null) { return; } replaceVariables(asW3cNode(imdgRootLoaded)); importDocuments(imdgRootLoaded); merge(imdgRootLoaded, imdgRoot); } ((MutableYamlMapping) rootAsMapping).removeChild(ConfigSections.IMPORT.name); }
Source:
private static void checkSelfReference(@NotNull GoReferenceExpression o, PsiElement definition, AnnotationHolder holder) { GoExpression value = null; if (definition instanceof GoVarDefinition) { value = ((GoVarDefinition)definition).getValue(); } else if (definition instanceof GoConstDefinition) { value = ((GoConstDefinition)definition).getValue(); } if (value == null) return; PsiElement element = PsiTreeUtil.getTopmostParentOfType(o, GoExpression.class); if (element == null) return; if (value.equals(element)) holder.createErrorAnnotation(o, "Cyclic definition detected"); }

Target:
private static void checkSelfReference(@NotNull GoReferenceExpression o, PsiElement definition, AnnotationHolder holder) { GoExpression value = null; if (definition instanceof GoVarDefinition) { value = ((GoVarDefinition)definition).getValue(); } else if (definition instanceof GoConstDefinition) { value = ((GoConstDefinition)definition).getValue(); } if (value != null && value.equals(PsiTreeUtil.getTopmostParentOfType(o, GoExpression.class))) { holder.createErrorAnnotation(o, "Cyclic definition detected"); } }
Source:
public D save(D definition) { Assert.notNull(definition, "Definition may not be null"); String name = definition.getName(); String def = definition.getDefinition(); validateBeforeSave(name, def); if(!ComposedJobUtil.isComposedJobDefinition(def)){ List<ModuleDescriptor> moduleDescriptors = moduleDescriptors = parser.parse(name, def, definitionKind); List<ModuleDefinition> moduleDefinitions = createModuleDefinitions(moduleDescriptors); if (!moduleDefinitions.isEmpty()) { definition.setModuleDefinitions(moduleDefinitions); } } D savedDefinition = repository.save(definition); return afterSave(savedDefinition); }

Target:
public D save(D definition) { Assert.notNull(definition, "Definition may not be null"); String name = definition.getName(); String def = definition.getDefinition(); validateBeforeSave(name, def); if(!ComposedJobUtil.isComposedJobDefinition(def)){ List<ModuleDescriptor> moduleDescriptors = parser.parse(name, def, definitionKind); List<ModuleDefinition> moduleDefinitions = createModuleDefinitions(moduleDescriptors); if (!moduleDefinitions.isEmpty()) { definition.setModuleDefinitions(moduleDefinitions); } } D savedDefinition = repository.save(definition); return afterSave(savedDefinition); }