auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void enqueue(Callback callback) { DeferredTracer tracer = new DeferredTracer("acquire-limiter"); ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { tracer.withTrace(() -> { enqueueInternal(callback); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }

Target:
public void enqueue(Callback callback) { DeferredTracer tracer = new DeferredTracer("OkHttp: enqueue"); ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { tracer.withTrace(() -> { enqueueInternal(callback); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }
Source:
public void execute(Tuple tuple) { HashMap<String, String[]> metadata = (HashMap<String, String[]>) tuple .getValueByField("metadata"); String isBoolean = KeyValues.getValue(isSitemapKey, metadata); if (StringUtils.isBlank(isBoolean) || !isBoolean.equalsIgnoreCase("true")) { this.collector.emit(tuple.getValues()); this.collector.ack(tuple); return; } byte[] content = tuple.getBinaryByField("content"); String url = tuple.getStringByField("url"); String ct = KeyValues.getValue(HttpHeaders.CONTENT_TYPE, metadata); List<Values> outlinks = parseSiteMap(url, content, ct); if (outlinks == null) { this.collector.fail(tuple); return; } for (Values ol : outlinks) { collector.emit(statusStreamName, new Values(ol)); } this.collector.ack(tuple); }

Target:
public void execute(Tuple tuple) { HashMap<String, String[]> metadata = (HashMap<String, String[]>) tuple .getValueByField("metadata"); String isSitemap = KeyValues.getValue(isSitemapKey, metadata); if (!Boolean.valueOf(isSitemap)) { this.collector.emit(tuple.getValues()); this.collector.ack(tuple); return; } byte[] content = tuple.getBinaryByField("content"); String url = tuple.getStringByField("url"); String ct = KeyValues.getValue(HttpHeaders.CONTENT_TYPE, metadata); List<Values> outlinks = parseSiteMap(url, content, ct); for (Values ol : outlinks) { collector.emit(Constants.StatusStreamName, ol); } collector.emit(Constants.StatusStreamName, new Values(url, metadata, Status.FETCHED)); this.collector.ack(tuple); }
Source:
private SSLContext buildSslContext() throws SSLInitializationException { final SSLContext sslContext; try { final SSLContextBuilder sslContextBuilder = new SSLContextBuilder(); sslContextBuilder.setProtocol(configuration.getProtocol()); sslContextBuilder.setProvider(configuration.getProvider()); loadKeyMaterial(sslContextBuilder); loadTrustMaterial(sslContextBuilder); sslContext = sslContextBuilder.build(); } catch (Exception e) { throw new SSLInitializationException(e.getMessage(), e); } return sslContext; }

Target:
private SSLContext buildSslContext() throws SSLInitializationException { final SSLContext sslContext; try { final SSLContextBuilder sslContextBuilder = new SSLContextBuilder(); sslContextBuilder.setProtocol(configuration.getProtocol()); final String configuredProvider = configuration.getProvider(); if (configuredProvider != null) { sslContextBuilder.setProvider(configuredProvider); } loadKeyMaterial(sslContextBuilder); loadTrustMaterial(sslContextBuilder); sslContext = sslContextBuilder.build(); } catch (Exception e) { throw new SSLInitializationException(e.getMessage(), e); } return sslContext; }
Source:
public long computeNextDeliveryTimestamp(long delay, TimeUnit unit) { if (delay > 0) { try { return ZonedDateTime.now() .plus(delay, Temporals.chronoUnit(unit)) .toInstant() .toEpochMilli(); } catch (ArithmeticException e) { LOGGER.warn("The was caused by conversation {}({}) followed by addition to current timestamp. Falling back to Long.MAX_VALUE.", e.getMessage(), delay, unit.name()); return Long.MAX_VALUE; } } return NO_DELAY; }

Target:
public long computeNextDeliveryTimestamp(long delay, TimeUnit unit) { if (delay > 0) { try { return ZonedDateTime.now() .plus(delay, Temporals.chronoUnit(unit)) .toInstant() .toEpochMilli(); } catch (ArithmeticException e) { LOGGER.warn("Exception encountered while computed JMS next delivery (delay {}). Fallback to (Long.MAX_VALUE) ms", delay, unit.name(), Long.MAX_VALUE, e); return Long.MAX_VALUE; } } return NO_DELAY; }
Source:
private void initPositionListFromGeoJsonFile() { featureCollection = FeatureCollection.fromJson(loadGeoJsonFromAsset("boston_charge_stations.geojson")); pointList = new ArrayList<>(); for (Feature singleLocation : featureCollection.features()) { Point singleLocationPoint = (Point) singleLocation.geometry(); pointList.add(singleLocationPoint); } }

Target:
private void initPositionListFromGeoJsonFile() { featureCollection = FeatureCollection.fromJson(loadGeoJsonFromAsset("boston_charge_stations.geojson")); pointList = new ArrayList<>(); for (Feature singleLocation : featureCollection.features()) { pointList.add((Point) singleLocation.geometry()); } }
Source:
public boolean disconnect() { if (outpoint.fromTx != null) { TransactionOutput output = outpoint.fromTx.getOutput((int) outpoint.getIndex()); outpoint.fromTx = null; if (output.getSpentBy() == this) { output.markAsUnspent(); return true; } else { return false; } } else { if (outpoint.connectedOutput != null) { TransactionOutput output = outpoint.connectedOutput; outpoint.connectedOutput = null; if (output.getSpentBy() == this) { output.markAsUnspent(); return true; } else { return false; } } else { return false; } } }

Target:
public boolean disconnect() { TransactionOutput connectedOutput; if (outpoint.fromTx != null) { connectedOutput = outpoint.fromTx.getOutput((int) outpoint.getIndex()); outpoint.fromTx = null; } else if (outpoint.connectedOutput != null) { connectedOutput = outpoint.connectedOutput; outpoint.connectedOutput = null; } else { return false; } if (connectedOutput!=null && connectedOutput.getSpentBy() == this) { connectedOutput.markAsUnspent(); return true; } else { return false; } }
Source:
public static Scanner factory(String key) { if (StringUtils.isAlphanumeric(key)) { return new Scanner(key); } else { throw new IllegalArgumentException("plugin key must be alphanumeric, strictly"); } }

Target:
public static Scanner factory(String key) { if (StringUtils.isAlphanumeric(key)) { return new Scanner(key); } else { throw new IllegalArgumentException("scanner key must be alphanumeric, strictly"); } }
Source:
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (!this.capturedAutoChannelCandidates && this.beanFactory != null) { Object autoCreateChannelCandidates = beanFactory.getBean("$autoCreateChannelCandidates"); if (autoCreateChannelCandidates != null){ @SuppressWarnings("unchecked") Collection<String> autoCreateChannelCandidatesNames = (Collection<String>) new DirectFieldAccessor(autoCreateChannelCandidates).getPropertyValue("channelNames"); this.siBeanNames.addAll(autoCreateChannelCandidatesNames); } this.capturedAutoChannelCandidates = true; } if (bean instanceof MBeanExporter && !(bean instanceof IntegrationMBeanExporter)) { MBeanExporter mbeanExporter = (MBeanExporter) bean; DirectFieldAccessor mbeDfa = new DirectFieldAccessor(mbeanExporter); @SuppressWarnings("unchecked") Set<String> excludedNames = (Set<String>) mbeDfa.getPropertyValue(EXCLUDED_BEANS_PROPERTY_NAME); if (excludedNames != null) { siBeanNames.addAll(excludedNames); } mbeDfa.setPropertyValue(EXCLUDED_BEANS_PROPERTY_NAME, siBeanNames); } String className = ClassUtils.getUserClass(bean).getName(); if (StringUtils.hasText(className)){ if (className.startsWith(SI_ROOT_PACKAGE) && !(className.endsWith(IntegrationMBeanExporter.class.getName()))){ siBeanNames.add(beanName); } } return bean; }

Target:
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (!this.capturedAutoChannelCandidates && this.beanFactory != null) { Object autoCreateChannelCandidates = beanFactory.getBean("$autoCreateChannelCandidates"); if (autoCreateChannelCandidates != null){ @SuppressWarnings("unchecked") Collection<String> autoCreateChannelCandidatesNames = (Collection<String>) new DirectFieldAccessor(autoCreateChannelCandidates).getPropertyValue("channelNames"); this.siBeanNames.addAll(autoCreateChannelCandidatesNames); } this.capturedAutoChannelCandidates = true; } if (bean instanceof MBeanExporter && !(bean instanceof IntegrationMBeanExporter)) { MBeanExporter mbeanExporter = (MBeanExporter) bean; DirectFieldAccessor mbeDfa = new DirectFieldAccessor(mbeanExporter); @SuppressWarnings("unchecked") Set<String> excludedNames = (Set<String>) mbeDfa.getPropertyValue(EXCLUDED_BEANS_PROPERTY_NAME); if (excludedNames != null) { siBeanNames.addAll(excludedNames); } mbeDfa.setPropertyValue(EXCLUDED_BEANS_PROPERTY_NAME, siBeanNames); } return bean; }
Source:
public boolean createOrUpdateAndStartSupervisor(SupervisorSpec spec) { Preconditions.checkState(started, "SupervisorManager not started"); Preconditions.checkNotNull(spec, "spec"); Preconditions.checkNotNull(spec.getId(), "spec.getId()"); synchronized (lock) { possiblyStopAndRemoveSupervisorInternal(spec.getId(), false); return createAndStartSupervisorInternal(spec, true); } }

Target:
public boolean createOrUpdateAndStartSupervisor(SupervisorSpec spec) { Preconditions.checkState(started, "SupervisorManager not started"); Preconditions.checkNotNull(spec, "spec"); Preconditions.checkNotNull(spec.getId(), "spec.getId()"); synchronized (lock) { Preconditions.checkState(started, "SupervisorManager not started"); possiblyStopAndRemoveSupervisorInternal(spec.getId(), false); return createAndStartSupervisorInternal(spec, true); } }
Source:
protected String testForInvalidValue(final String value) { if (value == null || value.isEmpty() || invalidValues == null) { return null; } String testValue; if (!isCaseSensitive) { testValue = value.toLowerCase(); } else { testValue = value; } if (invalidValues.contains(testValue)) { return invalidValueErrorMessage; } else { return null; } }

Target:
private String testForInvalidValue(final String value) { if (value == null || value.isEmpty() || invalidValues == null) { return null; } String testValue; if (!isCaseSensitive) { testValue = value.toLowerCase(); } else { testValue = value; } if (invalidValues.contains(testValue)) { return invalidValueErrorMessage; } else { return null; } }
Source:
public Optional<Entity> getEntityFromUUID(UUID uuid) { for (net.minecraft.entity.Entity entity : this.loadedEntityList) { if (entity.getUniqueID().equals(uuid)) { return Optional.of((Entity) entity); } } return Optional.absent(); }

Target:
public Optional<Entity> getEntityFromUUID(UUID uuid) { if ((Object) this instanceof WorldServer) { return Optional.fromNullable((Entity) ((WorldServer) (Object) this).getEntityFromUuid(uuid)); } for (net.minecraft.entity.Entity entity : this.loadedEntityList) { if (entity.getUniqueID().equals(uuid)) { return Optional.of((Entity) entity); } } return Optional.absent(); }
Source:
public void updatePeriodicData() { log.info("test"); if (!isNavXReady && (classInstantiationTime + 1 < Timer.getFPGATimestamp())) { System.out.println("REACHED"); log.info("reached"); setCurrentHeading(FACING_AWAY_FROM_DRIVERS); isNavXReady = true; } updatePose(); }

Target:
public void updatePeriodicData() { if (!isNavXReady && (classInstantiationTime + 1 < Timer.getFPGATimestamp())) { setCurrentHeading(FACING_AWAY_FROM_DRIVERS); isNavXReady = true; } updatePose(); }
Source:
public Optional<HttpUrl> redirectToNext(HttpUrl existingUrl) { Optional<Integer> existingUrlIndex = indexFor(existingUrl); int numAttempts = 0; int potentialNextIndex = existingUrlIndex.orElse(currentUrl.get()); while (numAttempts < baseUrls.size()) { potentialNextIndex = (potentialNextIndex + 1) % baseUrls.size(); Boolean maybeInCache = this.failedUrls.getIfPresent(baseUrls.get(potentialNextIndex)); if (maybeInCache == null) { return redirectTo(existingUrl, baseUrls.get(potentialNextIndex)); } numAttempts++; } return Optional.empty(); }

Target:
public Optional<HttpUrl> redirectToNext(HttpUrl existingUrl) { Optional<Integer> existingUrlIndex = indexFor(existingUrl); int numAttempts = 0; int potentialNextIndex = existingUrlIndex.orElse(currentUrl.get()); while (numAttempts < baseUrls.size()) { potentialNextIndex = (potentialNextIndex + 1) % baseUrls.size(); UrlAvailability isFailed = failedUrls.getIfPresent(baseUrls.get(potentialNextIndex)); if (isFailed == null) { return redirectTo(existingUrl, baseUrls.get(potentialNextIndex)); } numAttempts++; } return redirectTo(existingUrl, baseUrls.get((existingUrlIndex.orElse(currentUrl.get()) + 1) % baseUrls.size())); }
Source:
public Map<String, Object> toSoyData(Paginator paginator, @Nullable String revision, DateFormatter df) throws IOException { Map<String, Object> data = Maps.newHashMapWithExpectedSize(3); List<Map<String, Object>> entries = Lists.newArrayListWithCapacity(paginator.getLimit()); for (RevCommit c : paginator) { if (verbose) { entries.add(new CommitSoyData().setRevWalk(paginator.getWalk()).toSoyData(req, c, Field.setOf(FIELDS, Field.DIFF_TREE), df)); } else { entries.add(new CommitSoyData().toSoyData(req, c, FIELDS, df)); } } data.put("entries", entries); ObjectId next = paginator.getNextStart(); if (next != null) { data.put("nextUrl", copyAndCanonicalize(view, revision) .replaceParam(LogServlet.START_PARAM, next.name()) .toUrl()); } ObjectId prev = paginator.getPreviousStart(); if (prev != null) { GitilesView.Builder prevView = copyAndCanonicalize(view, revision); if (!prevView.getRevision().getId().equals(prev)) { prevView.replaceParam(LogServlet.START_PARAM, prev.name()); } data.put("previousUrl", prevView.toUrl()); } return data; }

Target:
public Map<String, Object> toSoyData(Paginator paginator, @Nullable String revision, DateFormatter df) throws IOException { Map<String, Object> data = Maps.newHashMapWithExpectedSize(3); List<Map<String, Object>> entries = Lists.newArrayListWithCapacity(paginator.getLimit()); for (RevCommit c : paginator) { if (verbose) { entries.add(new CommitSoyData().setRevWalk(paginator.getWalk()).toSoyData(req, c, VERBOSE_FIELDS, df)); } else { entries.add(new CommitSoyData().toSoyData(req, c, FIELDS, df)); } } data.put("entries", entries); ObjectId next = paginator.getNextStart(); if (next != null) { data.put("nextUrl", copyAndCanonicalize(view, revision) .replaceParam(LogServlet.START_PARAM, next.name()) .toUrl()); } ObjectId prev = paginator.getPreviousStart(); if (prev != null) { GitilesView.Builder prevView = copyAndCanonicalize(view, revision); if (!prevView.getRevision().getId().equals(prev)) { prevView.replaceParam(LogServlet.START_PARAM, prev.name()); } data.put("previousUrl", prevView.toUrl()); } return data; }
Source:
public TouchInterceptFrameLayout(@NonNull Context context) { this(context, null); setTag("TIFL"); }

Target:
public TouchInterceptFrameLayout(@NonNull Context context) { this(context, null); init(); }
Source:
List<? extends ConstraintViolation> validate(Message message) { final Map<FieldDescriptor, Object> options = messageDescriptor.getOptions() .getAllFields(); for (FieldDescriptor optionDescriptor : options.keySet()) { if (OPTION_REQUIRED_FIELD.equals(optionDescriptor.getName())) { final JavaType optionType = optionDescriptor.getJavaType(); if (optionType == JavaType.STRING) { final String requiredFieldExpression = (String) options.get(optionDescriptor); final ImmutableList<RequiredFieldOption> fieldOptions = parse(requiredFieldExpression); if (!alternativeFound(message, fieldOptions)) { ConstraintViolation requiredFieldNotFound = ConstraintViolation.newBuilder() .setMsgFormat("None of the fields match the " + "`required_field` definition: %s") .addParam(requiredFieldExpression) .build(); violations.add(requiredFieldNotFound); } } else { log().warn("`{}` is not of string type. Found: {}", OPTION_REQUIRED_FIELD, optionType); } } } return violations.build(); }

Target:
List<? extends ConstraintViolation> validate(Message message) { final Map<FieldDescriptor, Object> options = messageDescriptor.getOptions() .getAllFields(); for (FieldDescriptor optionDescriptor : options.keySet()) { if (OPTION_REQUIRED_FIELD.equals(optionDescriptor.getName())) { final JavaType optionType = optionDescriptor.getJavaType(); if (optionType == JavaType.STRING) { final String requiredFieldExpression = (String) options.get(optionDescriptor); final ImmutableList<RequiredFieldOption> fieldOptions = parse(requiredFieldExpression); if (!alternativeFound(message, fieldOptions)) { final String msgFormat = "None of the fields match the `required_field` definition: %s"; ConstraintViolation requiredFieldNotFound = ConstraintViolation.newBuilder() .setMsgFormat(msgFormat) .addParam(requiredFieldExpression) .build(); violations.add(requiredFieldNotFound); } } else { log().warn("`{}` is not of string type. Found: {}", OPTION_REQUIRED_FIELD, optionType); } } } return violations.build(); }
Source:
public final boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) { if (isDone()) { return false; } if (n.isScript() || n.isModuleBody()) { return true; } int line = n.getLineno(); if (getLastLineOfCurrentComment() > line) { return true; } while (hasRemainingComments() && !isCommentAdjacentToLine(line)) { if (getFirstLineOfNextComment() - getLastLineOfCurrentComment() > 1) { parent.addChildBefore(newFloatingComment(currentCommentGroup), n); } addNextCommentTo(currentCommentGroup); } if (getLastLineOfCurrentComment() == line) { linkCommentGroupToNode(currentCommentGroup, n); } else if (getLastLineOfCurrentComment() == line - 1) { linkCommentGroupToNode(currentCommentGroup, n); } else if (!hasRemainingComments()) { parent.addChildBefore(newFloatingComment(currentCommentGroup), n); } addNextCommentTo(currentCommentGroup); return true; }

Target:
public final boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) { if (isDone()) { return false; } if (n.isScript() || n.isModuleBody()) { return true; } int line = n.getLineno(); if (getLastLineOfCurrentComment() > line) { return true; } while (hasRemainingComments() && !isCommentAdjacentToLine(line)) { if (getLastLineOfCurrentComment() > line) { return true; } if (getFirstLineOfNextComment() - getLastLineOfCurrentComment() > 1) { parent.addChildBefore(newFloatingCommentFromBuffer(), n); } addNextCommentToBuffer(); } if (getLastLineOfCurrentComment() == line) { linkCommentBufferToNode(n); } else if (getLastLineOfCurrentComment() == line - 1) { linkCommentBufferToNode(n); } else if (!hasRemainingComments()) { parent.addChildBefore(newFloatingCommentFromBuffer(), n); } addNextCommentToBuffer(); return true; }
Source:
public void systemConfigFSShouldUseGITasScheme() { SpacesAPI spacesAPI = mock(SpacesAPI.class); producer.resolveFSURI(spacesAPI, SpacesAPI.DEFAULT_SPACE, "system"); verify(spacesAPI).resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT,SpacesAPI.DEFAULT_SPACE, "system" ); }

Target:
public void systemConfigFSShouldUseGITasScheme() { SpacesAPI spacesAPI = mock(SpacesAPI.class); producer.resolveFSURI(spacesAPI, SpacesAPI.DEFAULT_SPACE, SystemConfigProducer.SYSTEM); verify(spacesAPI).resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, SystemConfigProducer.SYSTEM); }
Source:
private ListenableFuture<Void> initInternal(Context context, AppConfig appConfig) { if (mInitialized.getAndSet(true)) { return mInitInternalFuture; } mInitInternalFuture = CallbackToFutureAdapter.getFuture( completer -> { mCameraExecutor.execute(() -> { mContext = context.getApplicationContext(); mCameraFactory = appConfig.getCameraFactory(null); if (mCameraFactory == null) { completer.setException(new IllegalStateException( "Invalid app configuration provided. Missing CameraFactory.")); return; } mSurfaceManager = appConfig.getDeviceSurfaceManager(null); if (mSurfaceManager == null) { completer.setException(new IllegalStateException( "Invalid app configuration provided. Missing " + "CameraDeviceSurfaceManager.")); return; } mSurfaceManager.init(); mDefaultConfigFactory = appConfig.getUseCaseConfigRepository(null); if (mDefaultConfigFactory == null) { completer.setException(new IllegalStateException( "Invalid app configuration provided. Missing " + "UseCaseConfigFactory.")); return; } if (mCameraExecutor instanceof CameraExecutor) { CameraExecutor executor = (CameraExecutor) mCameraExecutor; executor.init(mCameraFactory); } mCameraRepository.init(mCameraFactory); completer.set(null); }); return "CameraX initInternal"; }); return mInitInternalFuture; }

Target:
private ListenableFuture<Void> initInternal(Context context, AppConfig appConfig) { Preconditions.checkState(!mInitialized.getAndSet(true), "CameraX.initInternal() should only be called once per instance"); return CallbackToFutureAdapter.getFuture( completer -> { mCameraExecutor.execute(() -> { mContext = context.getApplicationContext(); mCameraFactory = appConfig.getCameraFactory(null); if (mCameraFactory == null) { completer.setException(new IllegalArgumentException( "Invalid app configuration provided. Missing CameraFactory.")); return; } mSurfaceManager = appConfig.getDeviceSurfaceManager(null); if (mSurfaceManager == null) { completer.setException(new IllegalArgumentException( "Invalid app configuration provided. Missing " + "CameraDeviceSurfaceManager.")); return; } mSurfaceManager.init(); mDefaultConfigFactory = appConfig.getUseCaseConfigRepository(null); if (mDefaultConfigFactory == null) { completer.setException(new IllegalArgumentException( "Invalid app configuration provided. Missing " + "UseCaseConfigFactory.")); return; } if (mCameraExecutor instanceof CameraExecutor) { CameraExecutor executor = (CameraExecutor) mCameraExecutor; executor.init(mCameraFactory); } mCameraRepository.init(mCameraFactory); completer.set(null); }); return "CameraX initInternal"; }); }
Source:
public void onVoteClicked(String value) { PlaceRequest place = new PlaceRequest.Builder() .nameToken(NameTokens.CONFIRM_VOTE) .with("value", value) .build(); placeManager.revealPlace(place); }

Target:
public void onVoteClicked(String value) { PlaceRequest place = new PlaceRequest.Builder() .nameToken(NameTokens.CONFIRM_VOTE) .with(NameTokens.VALUE_PARAM, value) .build(); placeManager.revealPlace(place); }
Source:
private void redeployJobModule(CuratorFramework client, final Job job, RuntimeModuleDeploymentProperties deploymentProperties) throws Exception { ModuleDescriptor moduleDescriptor = job.getJobModuleDescriptor(); ModuleDeploymentStatus deploymentStatus = null; ModuleDeployment moduleDeployment = new ModuleDeployment(job, moduleDescriptor, deploymentProperties); if (deploymentProperties.getCount() > 0) { try { deploymentStatus = deployModule(client, moduleDeployment, instantiateContainerMatcher(client, moduleDescriptor)); } catch (NoContainerException e) { logger.warn("No containers available for redeployment of for stream {}", moduleDescriptor.getModuleLabel(), job.getName()); } finally { updateDeploymentUnitState(client, moduleDeployment, deploymentStatus); } } else { logUnwantedRedeployment(deploymentProperties.getCriteria(), moduleDescriptor.getModuleLabel()); } }

Target:
private void redeployJobModule(CuratorFramework client, final Job job, RuntimeModuleDeploymentProperties deploymentProperties) throws Exception { ModuleDescriptor moduleDescriptor = job.getJobModuleDescriptor(); ModuleDeploymentStatus deploymentStatus = null; ModuleDeployment moduleDeployment = new ModuleDeployment(job, moduleDescriptor, deploymentProperties); if (deploymentProperties.getCount() > 0) { try { deploymentStatus = deployModule(client, moduleDeployment, instantiateContainerMatcher(client, moduleDescriptor)); } catch (NoContainerException e) { logger.warn("No containers available for redeployment of for job {}", moduleDescriptor.getModuleLabel(), job.getName()); } finally { updateDeploymentUnitState(client, moduleDeployment, deploymentStatus); } } else { logUnwantedRedeployment(deploymentProperties.getCriteria(), moduleDescriptor.getModuleLabel()); } }
Source:
private void initCHPreparationHandler() { if (chPreparationHandler.hasCHProfiles()) { return; } Map<String, ProfileConfig> profilesByName = getProfilesByName(); for (CHProfileConfig chConfig : chPreparationHandler.getCHProfileConfigs()) { ProfileConfig profile = profilesByName.get(chConfig.getProfile()); assert profile != null : "there is no profile " + chConfig.getProfile(); FlagEncoder encoder = encodingManager.getEncoder(profile.getVehicle()); if (profile.isTurnCosts()) { assert encoder.supportsTurnCosts() : "encoder " + encoder + " should support turn costs"; int uTurnCosts = profile.hints().getInt(Routing.U_TURN_COSTS, INFINITE_U_TURN_COSTS); TurnCostProvider turnCostProvider = new DefaultTurnCostProvider(encoder, ghStorage.getTurnCostStorage(), uTurnCosts); chPreparationHandler.addCHProfile(CHProfile.edgeBased(profile.getName(), createWeighting(new HintsMap(profile.getWeighting()), encoder, turnCostProvider))); } else { chPreparationHandler.addCHProfile(CHProfile.nodeBased(profile.getName(), createWeighting(new HintsMap(profile.getWeighting()), encoder, NO_TURN_COST_PROVIDER))); } } }

Target:
private void initCHPreparationHandler() { if (chPreparationHandler.hasCHProfiles()) { return; } for (CHProfileConfig chConfig : chPreparationHandler.getCHProfileConfigs()) { ProfileConfig profile = profilesByName.get(chConfig.getProfile()); FlagEncoder encoder = encodingManager.getEncoder(profile.getVehicle()); if (profile.isTurnCosts()) { assert encoder.supportsTurnCosts() : "encoder " + encoder + " should support turn costs"; int uTurnCosts = profile.getHints().getInt(Routing.U_TURN_COSTS, INFINITE_U_TURN_COSTS); TurnCostProvider turnCostProvider = new DefaultTurnCostProvider(encoder, ghStorage.getTurnCostStorage(), uTurnCosts); chPreparationHandler.addCHProfile(CHProfile.edgeBased(profile.getName(), createWeighting(new HintsMap(profile.getWeighting()), encoder, turnCostProvider))); } else { chPreparationHandler.addCHProfile(CHProfile.nodeBased(profile.getName(), createWeighting(new HintsMap(profile.getWeighting()), encoder, NO_TURN_COST_PROVIDER))); } } }
Source:
public static void verifyReadyForGodMode() { if (IS_GODMODE_ENABLED && isCiEnvironment() && !isGodModeTest()) { fail("GodMode should only be run locally, not in a CI environment. Please revert the change " + "to the test properties template file that enabled GodMode in CI."); } if (!isDevServer()) { fail("GodMode regeneration works only in dev server."); } if (isStudentMotdUrlEmpty()) { fail("Student MOTD URL defined in app.student.motd.url in build.properties " + "must not be empty. It is advised to use test-student-motd.html to test it."); } }

Target:
public static void verifyReadyForGodMode() { if (!isDevServer()) { fail("GodMode regeneration works only in dev server."); } if (isStudentMotdUrlEmpty()) { fail("Student MOTD URL defined in app.student.motd.url in build.properties " + "must not be empty. It is advised to use test-student-motd.html to test it."); } }
Source:
public void parseServiceCreationConfiguration() throws SAXException, JAXBException, ParserConfigurationException, IOException { final URL resource = XmlConfigurationTest.class.getResource("/configs/default-serializer.xml"); ConfigurationParser rootParser = new ConfigurationParser(resource.toExternalForm()); DefaultSerializationProviderConfigurationParser parser = new DefaultSerializationProviderConfigurationParser(); managerBuilder = parser.parseServiceCreationConfiguration(rootParser.getConfigRoot(), classLoader, managerBuilder); Configuration xmlConfig = managerBuilder.build(); assertThat(xmlConfig.getServiceCreationConfigurations().size(), is(1)); ServiceCreationConfiguration configuration = xmlConfig.getServiceCreationConfigurations().iterator().next(); assertThat(configuration, instanceOf(DefaultSerializationProviderConfiguration.class)); DefaultSerializationProviderConfiguration factoryConfiguration = (DefaultSerializationProviderConfiguration) configuration; assertThat(factoryConfiguration.getDefaultSerializers().size(), is(4)); assertThat(factoryConfiguration.getDefaultSerializers().get(CharSequence.class), Matchers.<Class<? extends Serializer>>equalTo(TestSerializer.class)); assertThat(factoryConfiguration.getDefaultSerializers().get(Number.class), Matchers.<Class<? extends Serializer>>equalTo(TestSerializer2.class)); assertThat(factoryConfiguration.getDefaultSerializers().get(Long.class), Matchers.<Class<? extends Serializer>>equalTo(TestSerializer3.class)); assertThat(factoryConfiguration.getDefaultSerializers().get(Integer.class), Matchers.<Class<? extends Serializer>>equalTo(TestSerializer4.class)); }

Target:
public void parseServiceCreationConfiguration() throws SAXException, JAXBException, ParserConfigurationException, IOException, ClassNotFoundException { Configuration xmlConfig = parseXmlConfiguration("/configs/default-serializer.xml"); assertThat(xmlConfig.getServiceCreationConfigurations()).hasSize(1); ServiceCreationConfiguration configuration = xmlConfig.getServiceCreationConfigurations().iterator().next(); assertThat(configuration).isExactlyInstanceOf(DefaultSerializationProviderConfiguration.class); DefaultSerializationProviderConfiguration factoryConfiguration = (DefaultSerializationProviderConfiguration) configuration; Map<Class<?>, Class<? extends Serializer<?>>> defaultSerializers = factoryConfiguration.getDefaultSerializers(); assertThat(defaultSerializers).hasSize(4); assertThat(defaultSerializers.get(CharSequence.class)).isEqualTo(TestSerializer.class); assertThat(defaultSerializers.get(Number.class)).isEqualTo(TestSerializer2.class); assertThat(defaultSerializers.get(Long.class)).isEqualTo(TestSerializer3.class); assertThat(defaultSerializers.get(Integer.class)).isEqualTo(TestSerializer4.class); }
Source:
private static String getDocumentProviderPathKitkatOrHigher(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } } else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } else if (isMediaDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } final String selection = "_id=?"; final String[] selectionArgs = new String[] { split[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } } return null; }

Target:
private static String getDocumentProviderPathKitkatOrHigher(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } } else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } else if (isMediaDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } final String selection = MediaStore.MediaColumns._ID + "=?"; final String[] selectionArgs = new String[] { split[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } } return null; }
Source:
public void copyFile_shouldNotCopyTheOutputstreamIfInputstreamIsNull() throws Exception { InputStream input = null; ByteArrayOutputStream output = spy(new ByteArrayOutputStream()); OpenmrsUtil.copyFile(input, output); assertEquals(null, input); assertNotEquals(null, output); verify(output, times(1)).close(); }

Target:
public void copyFile_shouldNotCopyTheOutputstreamIfInputstreamIsNull() throws Exception { InputStream input = null; ByteArrayOutputStream output = spy(new ByteArrayOutputStream()); OpenmrsUtil.copyFile(input, output); assertNull(input); assertNotNull(output); verify(output, times(1)).close(); }
Source:
public TypeProvider getTypes() { return TypeProvider.mutable(symbols); }

Target:
public TypeProvider getTypes() { return TypeProvider.viewOf(symbols); }
Source:
public void Placeholders_001_PublishedProvider() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); base.openRandomArticle(wikiURL); String articleTitle = PageContent.articleNamePrefix + base.getTimeStamp(); VisualEditModePageObject visualEditMode = base.goToArticleDefaultContentEditPage(wikiURL, articleTitle); ArticlePageObject article = (ArticlePageObject) visualEditMode.submit(PageType.Article); article.verifyArticleTitle(articleTitle); VetAddVideoComponentObject vetAddingVideo = article.clickAddVideoPlaceholder(); VetOptionsComponentObject vetOptions = vetAddingVideo.addVideoByUrl(VideoContent.youtubeVideoURL); vetOptions.submit(); article.verifyVideo(); }

Target:
public void Placeholders_001_PublishedProvider() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); base.openRandomArticle(wikiURL); String articleTitle = PageContent.articleNamePrefix + base.getTimeStamp(); VisualEditModePageObject visualEditMode = base.goToArticleDefaultContentEditPage(wikiURL, articleTitle); ArticlePageObject article = visualEditMode.submitArticle(); article.verifyArticleTitle(articleTitle); VetAddVideoComponentObject vetAddingVideo = article.clickAddVideoPlaceholder(); VetOptionsComponentObject vetOptions = vetAddingVideo.addVideoByUrl(VideoContent.youtubeVideoURL); vetOptions.submit(); article.verifyVideo(); }
Source:
protected EnvVars buildEnv(AbstractProject<?, ?> job) { EnvVars env = new EnvVars(); for (EnvironmentContributor contributor : EnvironmentContributor.all()) { try { contributor.buildEnvironmentFor(job, env, TaskListener.NULL); } catch (Throwable e) { LOGGER.log(Level.WARNING, "Unhandled exception. Skipping environment contributor" + contributor, e); } } return env; }

Target:
protected EnvVars buildEnv(AbstractProject<?, ?> job) { EnvVars env = new EnvVars(); for (EnvironmentContributor contributor : EnvironmentContributor.all()) { try { contributor.buildEnvironmentFor(job, env, TaskListener.NULL); } catch (Throwable e) { LOGGER.warn("Unhandled exception. Skipping environment contributor " + contributor, e); } } return env; }
Source:
@JavaScriptMethod public synchronized String[][] clearDangerousApprovedSignatures() throws IOException { Jenkins.getInstance().checkPermission(Jenkins.RUN_SCRIPTS); TreeSet<String> newApprovedSignatures = new TreeSet<>(); for (String signature : approvedSignatures) { if(!StaticWhitelist.isBlacklisted(signature)){ newApprovedSignatures.add(signature); } } approvedSignatures.clear(); approvedSignatures.addAll(newApprovedSignatures); TreeSet<String> newAclApprovedSignatures = new TreeSet<>(); for (String signature : aclApprovedSignatures) { if(!StaticWhitelist.isBlacklisted(signature)){ newAclApprovedSignatures.add(signature); } } aclApprovedSignatures.clear(); aclApprovedSignatures.addAll(newAclApprovedSignatures); save(); return reconfigure(); }

Target:
@JavaScriptMethod public synchronized String[][] clearDangerousApprovedSignatures() throws IOException { Jenkins.getInstance().checkPermission(Jenkins.RUN_SCRIPTS); Iterator<String> it = approvedSignatures.iterator(); while (it.hasNext()) { if (StaticWhitelist.isBlacklisted(it.next())) { it.remove(); } } it = aclApprovedSignatures.iterator(); while (it.hasNext()) { if (StaticWhitelist.isBlacklisted(it.next())) { it.remove(); } } save(); return reconfigure(); }
Source:
private static Map<String, String> authDictionary() { final String[] authMessages = { "General Server Error", "Username Not Found", "Bad Credentials", "Disabled LDAP Service", "Corrupted Configuration", "MS Active Directory", "Account Disabled", "Account Expired", "Account Locked", "Logon Not Permitted At Time", "Logon Not Permitted At Workstation", "Password Expired", "Password Reset Required", "Wrong IP Address", "Access Denied" }; final Map<String, String> dict = new HashMap<>(); for (int i = 0; i < authMessages.length; i++) { dict.put(String.format("code %02d", i + 1), authMessages[i]); } return dict; }

Target:
private static Map<String, String> authDictionary() { final Map<String, String> dict = new HashMap<>(); dict.put("code 01", "General Server Error"); dict.put("code 02", "Username Not Found"); dict.put("code 03", "Bad Credentials"); dict.put("code 04", "Disabled LDAP Service"); dict.put("code 05", "Corrupted Configuration"); dict.put("code 06", "MS Active Directory"); dict.put("code 07", "Account Disabled"); dict.put("code 08", "Account Expired"); dict.put("code 09", "Account Locked"); dict.put("code 10", "Logon Not Permitted At Time"); dict.put("code 11", "Logon Not Permitted At Workstation"); dict.put("code 12", "Password Expired"); dict.put("code 13", "Password Reset Required"); dict.put("code 14", "Wrong IP Address"); dict.put("code 15", "Access Denied"); return Collections.unmodifiableMap(dict); }
Source:
public static GlusterHook map(GlusterHookEntity entity, GlusterHook hook) { GlusterHook model = hook != null ? hook : new GlusterHook(); if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getClusterId() != null) { model.setCluster(new Cluster()); model.getCluster().setId(entity.getClusterId().toString()); } if (entity.getHookKey() != null) { model.setName(entity.getHookKey()); } if (entity.getGlusterCommand() != null) { model.setGlusterCommand(entity.getGlusterCommand()); } if (entity.getStage() != null) { model.setGlusterStage(map(entity.getStage(),null)); } if (entity.getStatus() != null) { model.setHookStatus(map(entity.getStatus(),null)); } if (entity.getContentType() != null) { model.setContentType(map(entity.getContentType(), null)); } if (entity.getChecksum() != null) { model.setChecksum(entity.getChecksum()); } if (entity.getContent() != null) { model.setContent(entity.getContent()); } if (entity.getConflictStatus() != null) { model.setConflictStatus(entity.getConflictStatus()); model.setConflicts(mapConflicts(entity)); } if (entity.getServerHooks() != null && !entity.getServerHooks().isEmpty()) { model.setServerHooks(new GlusterServerHooks()); for (GlusterServerHook serverHookEntity : entity.getServerHooks()) { model.getServerHooks().getGlusterServerHooks().add(map(serverHookEntity)); } } return model; }

Target:
public static GlusterHook map(GlusterHookEntity entity, GlusterHook hook) { GlusterHook model = hook != null ? hook : new GlusterHook(); if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getClusterId() != null) { model.setCluster(new Cluster()); model.getCluster().setId(entity.getClusterId().toString()); } if (entity.getHookKey() != null) { model.setName(entity.getHookKey()); } if (entity.getGlusterCommand() != null) { model.setGlusterCommand(entity.getGlusterCommand()); } if (entity.getStage() != null) { model.setStage(map(entity.getStage(),null)); } if (entity.getStatus() != null) { model.setStatus(map(entity.getStatus(),null)); } if (entity.getContentType() != null) { model.setContentType(map(entity.getContentType(), null)); } if (entity.getChecksum() != null) { model.setChecksum(entity.getChecksum()); } if (entity.getContent() != null) { model.setContent(entity.getContent()); } if (entity.getConflictStatus() != null) { model.setConflictStatus(entity.getConflictStatus()); model.setConflicts(mapConflicts(entity)); } if (entity.getServerHooks() != null && !entity.getServerHooks().isEmpty()) { model.setServerHooks(new GlusterServerHooks()); for (GlusterServerHook serverHookEntity : entity.getServerHooks()) { model.getServerHooks().getGlusterServerHooks().add(map(serverHookEntity)); } } return model; }
Source:
private void startContainerScrub() { boolean enabled = config.getBoolean( HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED, HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED_DEFAULT); if (!enabled) { LOG.info("Background container scrubber has been disabled by {}", HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED); } else { if (this.scrubber == null) { this.scrubber = new ContainerScrubber(containerSet, config); } if (this.scrubber.isHalted()) { scrubber.up(); } } }

Target:
private void startContainerScrub() { boolean enabled = config.getBoolean( HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED, HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED_DEFAULT); if (!enabled) { LOG.info("Background container scrubber has been disabled by {}", HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED); } else { if (this.scrubber == null) { this.scrubber = new ContainerScrubber(containerSet, config); } scrubber.up(); } }
Source:
public void buyFromBank(Market m, String symbol, int volume) throws StockMarketExpection { Stock stockBeingPurchased = m.getStockForSymbol(symbol); if (stockBeingPurchased.getPrice() * volume > this.cashInHand) { throw new StockMarketExpection("Trader.buyFromBank: Not enough cash on hand to make purchase. Trader: " + this.name); } cashInHand = (cashInHand - stockBeingPurchased.getPrice() * volume); BuyOrder order = new BuyOrder(symbol, volume, stockBeingPurchased.getPrice(), this); addToPosition(order); }

Target:
public void buyFromBank(Market m, String symbol, int volume) throws StockMarketExpection { Stock stockBeingPurchased = m.getStockForSymbol(symbol); double totalCostOfStockPurchase = stockBeingPurchased.getPrice() * volume; if (totalCostOfStockPurchase > this.cashInHand) { throw new StockMarketExpection("Trader.buyFromBank: Not enough cash on hand to make purchase. Trader: " + this.name); } cashInHand = (cashInHand - totalCostOfStockPurchase); BuyOrder order = new BuyOrder(symbol, volume, stockBeingPurchased.getPrice(), this); addToPosition(order); }
Source:
public String getFamilyName() { return "Export function..."; }

Target:
public String getFamilyName() { return "Export function"; }
Source:
public long extractTimestampMillis(final Message message) { class ThriftTemplate implements TFieldIdEnum { private final String mFieldName; public ThriftTemplate(final String fieldName) { this.mFieldName = fieldName; } @Override public short getThriftFieldId() { return 1; } @Override public String getFieldName() { return mFieldName; } } try { long timestamp = mDeserializer.partialDeserializeI64(message.getPayload(), new ThriftTemplate(mConfig.getMessageTimestampName())); return toMillis(timestamp); } catch (TException e) { throw new RuntimeException(e); } }

Target:
public long extractTimestampMillis(final Message message) throws TException { class ThriftTemplate implements TFieldIdEnum { private final String mFieldName; public ThriftTemplate(final String fieldName) { this.mFieldName = fieldName; } @Override public short getThriftFieldId() { return 1; } @Override public String getFieldName() { return mFieldName; } } long timestamp = mDeserializer.partialDeserializeI64(message.getPayload(), new ThriftTemplate(mConfig.getMessageTimestampName())); return toMillis(timestamp); }
Source:
protected void configure(HttpSecurity http) throws Exception { http .apply( Saml2ServiceProviderConfigurer.saml2Login() ) .and() .authorizeRequests() .mvcMatchers("/login", "/logged-out").permitAll() .and() .logout() .logoutSuccessUrl("/logged-out") .and() ; }

Target:
protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().authenticated() .and() .saml2Login() ; }
Source:
private InterpreterResult runSqlList(String sql, InterpreterContext context) { List<SqlInfo> sqlLists = SqlLists.getSQLList(sql); List<SqlCommandParser.SqlCommandCall> sqlCommands = new ArrayList<>(); for (SqlInfo sqlInfo : sqlLists) { Optional<SqlCommandParser.SqlCommandCall> sqlCommand = parse(sqlInfo.getSqlContent()); if (!sqlCommand.isPresent()) { return new InterpreterResult(InterpreterResult.Code.ERROR, "Invalid Sql statement: " + sqlInfo.getSqlContent()); } sqlCommands.add(sqlCommand.get()); } for (SqlCommandParser.SqlCommandCall sqlCommand : sqlCommands) { try { callCommand(sqlCommand, context); context.out.flush(); } catch (Throwable e) { LOGGER.error("Fail to run sql:" + sqlCommand.operands[0] + "\n" + ExceptionUtils.getStackTrace(e)); return new InterpreterResult(InterpreterResult.Code.ERROR, "Fail to run sql command: " + sqlCommand.operands[0] + "\n" + ExceptionUtils.getStackTrace(e)); } } return new InterpreterResult(InterpreterResult.Code.SUCCESS); }

Target:
private InterpreterResult runSqlList(String sql, InterpreterContext context) { List<SqlInfo> sqlLists = SqlLists.getSQLList(sql); List<SqlCommandParser.SqlCommandCall> sqlCommands = new ArrayList<>(); for (SqlInfo sqlInfo : sqlLists) { Optional<SqlCommandParser.SqlCommandCall> sqlCommand = parse(sqlInfo.getSqlContent()); if (!sqlCommand.isPresent()) { return new InterpreterResult(InterpreterResult.Code.ERROR, "Invalid Sql statement: " + sqlInfo.getSqlContent()); } sqlCommands.add(sqlCommand.get()); } for (SqlCommandParser.SqlCommandCall sqlCommand : sqlCommands) { try { callCommand(sqlCommand, context); context.out.flush(); } catch (Throwable e) { LOGGER.error("Fail to run sql:" + sqlCommand.operands[0], e); return new InterpreterResult(InterpreterResult.Code.ERROR, "Fail to run sql command: " + sqlCommand.operands[0] + "\n" + ExceptionUtils.getStackTrace(e)); } } return new InterpreterResult(InterpreterResult.Code.SUCCESS); }
Source:
private void checkNamesAndDependencies(Set<ServiceTermination> terminationSet) { Set<String> uniqueNamesSet = new HashSet<>(); terminationSet.forEach( t -> { if (!uniqueNamesSet.add(t.getServiceName())) { throw new RuntimeException( String.format( "Duplicate termination found with service name %s", t.getServiceName())); } }); terminationSet.forEach( t -> { if (!uniqueNamesSet.containsAll(t.getDependencies())) { throw new RuntimeException( String.format( "Unknown dependency found in termination %s", t.getServiceName())); } }); }

Target:
private void checkNamesAndDependencies(Set<ServiceTermination> terminationSet) { Set<String> uniqueNamesSet = new HashSet<>(); terminationSet.forEach( t -> { if (!uniqueNamesSet.add(t.getServiceName())) { throw new ConfigurationException( String.format( "Duplicate termination found with service name %s", t.getServiceName())); } }); terminationSet.forEach( t -> { if (!uniqueNamesSet.containsAll(t.getDependencies())) { throw new RuntimeException( String.format("Unknown dependency found in termination %s", t.getServiceName())); } }); }
Source:
public static RevisionInfo fromEdit(EditInfo edit) { RevisionInfo revisionInfo = (RevisionInfo) createObject(); revisionInfo.takeFromEdit(edit); return revisionInfo; }

Target:
public static RevisionInfo fromEdit(EditInfo edit) { RevisionInfo revisionInfo = createObject().cast(); revisionInfo.takeFromEdit(edit); return revisionInfo; }