auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(MessageFormat.format(PDEUIMessages.RenamePluginProcessor_changeTitle, new Object[] {fInfo.getCurrentValue(), fInfo.getNewValue()})); SubMonitor subMonitor = SubMonitor.convert(pm, "", getTotalWork()); CreateHeaderChangeOperation op = new CreateHeaderChangeOperation(fInfo.getBase(), Constants.BUNDLE_SYMBOLICNAME, fInfo.getCurrentValue(), fInfo.getNewValue()); op.run(subMonitor.newChild(1)); change.add(op.getChange()); if (fInfo.isRenameProject()) { change.add(createProjectChange(subMonitor.newChild( 1))); } if (fInfo.isUpdateReferences()) change.addAll(createReferenceChanges(subMonitor.newChild(2))); return change; }

Target:
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(MessageFormat.format(PDEUIMessages.RenamePluginProcessor_changeTitle, new Object[] {fInfo.getCurrentValue(), fInfo.getNewValue()})); SubMonitor subMonitor = SubMonitor.convert(pm, getTotalWork()); CreateHeaderChangeOperation op = new CreateHeaderChangeOperation(fInfo.getBase(), Constants.BUNDLE_SYMBOLICNAME, fInfo.getCurrentValue(), fInfo.getNewValue()); op.run(subMonitor.newChild(1)); change.add(op.getChange()); if (fInfo.isRenameProject()) { change.add(createProjectChange(subMonitor.newChild( 1))); } if (fInfo.isUpdateReferences()) change.addAll(createReferenceChanges(subMonitor.newChild(2))); return change; }
Source:
private int getMaxHaddexAgeInMonths(int clientID, int orgID) { return sysConfigBL.getIntValue(SYS_CONFIG_MAX_HADDEX_AGE_IN_MONTHS, 24, clientID, orgID); }

Target:
private int getMaxHaddexAgeInMonths(int clientID, int orgID) { final int months = sysConfigBL.getIntValue(SYS_CONFIG_MAX_HADDEX_AGE_IN_MONTHS, 24, clientID, orgID); if (months > 0) { return months; } return Integer.MAX_VALUE; }
Source:
public QueryRunner<SegmentAnalysis> mergeRunners( ExecutorService exec, Iterable<QueryRunner<SegmentAnalysis>> queryRunners ) { final ListeningExecutorService queryExecutor = MoreExecutors.listeningDecorator(exec); return new ConcatQueryRunner<SegmentAnalysis>( Sequences.map( Sequences.simple(queryRunners), new Function<QueryRunner<SegmentAnalysis>, QueryRunner<SegmentAnalysis>>() { @Override public QueryRunner<SegmentAnalysis> apply(final QueryRunner<SegmentAnalysis> input) { return new QueryRunner<SegmentAnalysis>() { @Override public Sequence<SegmentAnalysis> run( final Query<SegmentAnalysis> query, final Map<String, Object> responseContext ) { final int priority = query.getContextPriority(0); ListenableFuture<Sequence<SegmentAnalysis>> future = queryExecutor.submit( new AbstractPrioritizedCallable<Sequence<SegmentAnalysis>>(priority) { @Override public Sequence<SegmentAnalysis> call() throws Exception { return Sequences.simple( Sequences.toList(input.run(query, responseContext), new ArrayList<SegmentAnalysis>()) ); } } ); try { queryWatcher.registerQuery(query, future); final Number timeout = query.getContextValue("timeout", (Number) null); return timeout == null ? future.get() : future.get(timeout.longValue(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { log.warn(e, "Query interrupted, cancelling pending results, query id [%s]", query.getId()); future.cancel(true); throw new QueryInterruptedException("Query interrupted"); } catch(CancellationException e) { throw new QueryInterruptedException("Query cancelled"); } catch(TimeoutException e) { log.info("Query timeout, cancelling pending results for query id [%s]", query.getId()); future.cancel(true); throw new QueryInterruptedException("Query timeout"); } catch (ExecutionException e) { throw Throwables.propagate(e.getCause()); } } }; } } ) ); }

Target:
public QueryRunner<SegmentAnalysis> mergeRunners( ExecutorService exec, Iterable<QueryRunner<SegmentAnalysis>> queryRunners ) { return new ChainedExecutionQueryRunner<>( exec, toolChest.getOrdering(), queryWatcher, queryRunners ); }
Source:
public void testGenerateSingleTypeEnumConstantMatcher() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); Map<String,Object> testMap = new HashMap<>(); final Enum enumEntry = new Enum("ds3_job_status", ImmutableList.of("IN_PROGRESS", "COMPLETED", "CANCELED")); testMap.put("enumEntry", enumEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "source-templates/TypedefEnumMatcher.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "static ds3_job_status _match_ds3_job_status(const ds3_log* log, const xmlChar* text) {" + "\n" + " if (xmlStrcmp(text, (const xmlChar*) \"IN_PROGRESS\") == 0) {" + "\n" + " return IN_PROGRESS;" + "\n" + " } else if (xmlStrcmp(text, (const xmlChar*) \"COMPLETED\") == 0) {" + "\n" + " return COMPLETED;" + "\n" + " } else if (xmlStrcmp(text, (const xmlChar*) \"CANCELED\") == 0) {" + "\n" + " return CANCELED;" + "\n" + " } else {" + "\n" + " ds3_log_message(log, DS3_ERROR, \"ERROR: Unknown value of '%s'. Returning IN_PROGRESS for safety.\", text);" + "\n" + " return IN_PROGRESS;" + "\n" + " }" + "\n" + "}" + "\n"; assertEquals(expectedOutput, output); }

Target:
public void testGenerateSingleTypeEnumConstantMatcher() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final Enum enumEntry = new Enum("ds3_job_status", ImmutableList.of("IN_PROGRESS", "COMPLETED", "CANCELED")); testMap.put("enumEntry", enumEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "source-templates/TypedefEnumMatcher.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "static ds3_job_status _match_ds3_job_status(const ds3_log* log, const xmlChar* text) {" + "\n" + " if (xmlStrcmp(text, (const xmlChar*) \"IN_PROGRESS\") == 0) {" + "\n" + " return IN_PROGRESS;" + "\n" + " } else if (xmlStrcmp(text, (const xmlChar*) \"COMPLETED\") == 0) {" + "\n" + " return COMPLETED;" + "\n" + " } else if (xmlStrcmp(text, (const xmlChar*) \"CANCELED\") == 0) {" + "\n" + " return CANCELED;" + "\n" + " } else {" + "\n" + " ds3_log_message(log, DS3_ERROR, \"ERROR: Unknown value of '%s'. Returning IN_PROGRESS for safety.\", text);" + "\n" + " return IN_PROGRESS;" + "\n" + " }" + "\n" + "}" + "\n"; assertEquals(expectedOutput, output); }
Source:
public VersionNumber getCurrentLevel() throws IOException { VersionNumber from = new VersionNumber("1.0"); File state = getUpdateStateFile(); if (state.exists()) { from = new VersionNumber(defaultIfBlank(readFileToString(state), "1.0").trim()); } return from; }

Target:
public VersionNumber getCurrentLevel() { VersionNumber from = new VersionNumber("1.0"); File state = getUpdateStateFile(); if (state.exists()) { try { from = new VersionNumber(defaultIfBlank(readFileToString(state), "1.0").trim()); } catch (IOException ex) { LOGGER.log(Level.SEVERE, "Cannot read the current version file", ex); return null; } } return from; }
Source:
@RequirePOST public HttpResponse doCheckUpdatesServer() throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); int sleep = SystemProperties.getInteger(PluginManager.class.getName() + ".sleepTimeMilis", 1000); int retries = SystemProperties.getInteger(PluginManager.class.getName() + ".retries", 3); retries = retries > 0 ? retries : 3; sleep = sleep > 0 ? sleep : 1000; FormValidation response = null; int i = 0; boolean success = false; while(i < retries && !success) { i++; try { response = checkUpdatesServer(); lastErrorCheckUpdateCenters = response.getMessage(); success = (response.kind == FormValidation.Kind.OK); } catch (Exception e) { lastErrorCheckUpdateCenters = e.getLocalizedMessage(); } if (!success) { LOGGER.warning(String.format("The attempt #%s to check updates server failed. Exception: %s", i, lastErrorCheckUpdateCenters)); if (i < retries) { LOGGER.info(String.format("Will retry after %s milliseconds", sleep)); try { Thread.sleep(sleep); } catch (InterruptedException ie) { LOGGER.info("The wait for a new attempt to check updates server was interrupted. Exception: " + ie); } } else { LOGGER.info(String.format("Attempted to check updates server for %s times with no success, raising an error", retries)); LOGGER.severe(String.format("Error checking updates server for %s times. Last exception was: %s", retries, lastErrorCheckUpdateCenters)); if(!LOGGER.isLoggable(Level.WARNING)) { LOGGER.severe("Change the log level to WARNING or below to see the error message of every attempt"); } lastErrorCheckUpdateCenters = Messages.PluginManager_CheckUpdateServerError(lastErrorCheckUpdateCenters); } } } return HttpResponses.forwardToPreviousPage(); }

Target:
@RequirePOST public HttpResponse doCheckUpdatesServer() throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); Retrier<FormValidation> updateServerRetrier = new Retrier.Builder<>( this::checkUpdatesServer, (currentAttempt, result) -> result.kind == FormValidation.Kind.OK, "check updates server") .withAttempts(CHECK_UPDATE_ATTEMPTS) .withDelay(CHECK_UPDATE_SLEEP_TIME_MILLIS) .withDuringActionExceptions(new Class[] {Exception.class}) .withDuringActionExceptionListener( (attempt, e) -> FormValidation.errorWithMarkup(e.getClass().getSimpleName() + ": " + e.getLocalizedMessage())) .build(); try { FormValidation result = updateServerRetrier.start(); if (!FormValidation.Kind.OK.equals(result.kind)) { LOGGER.log(Level.SEVERE, Messages.PluginManager_UpdateSiteError(CHECK_UPDATE_ATTEMPTS, result.getMessage())); if (CHECK_UPDATE_ATTEMPTS > 1 && !Logger.getLogger(Retrier.class.getName()).isLoggable(Level.WARNING)) { LOGGER.log(Level.SEVERE, Messages.PluginManager_UpdateSiteChangeLogLevel(Retrier.class.getName())); } lastErrorCheckUpdateCenters = Messages.PluginManager_CheckUpdateServerError(result.getMessage()); } else { lastErrorCheckUpdateCenters = null; } } catch (Exception e) { LOGGER.log(Level.WARNING, Messages.PluginManager_UnexpectedException(), e); throw new IOException(e); } return HttpResponses.forwardToPreviousPage(); }
Source:
public void getPopUpData(File file){ try { ExifInterface exif_data = new ExifInterface(file.getAbsolutePath()); Date lastModDate = new Date(file.lastModified()); long length = file.length()/1024; String img_width = exif_data.getAttribute(ExifInterface.TAG_IMAGE_WIDTH); String img_height = exif_data.getAttribute(ExifInterface.TAG_IMAGE_LENGTH); if(img_width.isEmpty() || img_height.isEmpty() || img_width.equals("0") || img_height.equals("0") ) { try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; ParcelFileDescriptor fd = getContentResolver().openFileDescriptor(Uri.fromFile(file), "r"); if (fd != null) { BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor(), null, options); img_width = options.outWidth + ""; img_height = options.outHeight + ""; fd.close(); options = null; } } catch (Exception e) { } } ((TextView)pwindo.getContentView().findViewById(R.id.path)).setText(file.getAbsolutePath()); ((TextView)pwindo.getContentView().findViewById(R.id.time)).setText(lastModDate.toString()); ((TextView)pwindo.getContentView().findViewById(R.id.image_width)).setText(img_width); ((TextView)pwindo.getContentView().findViewById(R.id.height)).setText(img_height); ((TextView)pwindo.getContentView().findViewById(R.id.size)).setText(Long.toString(length)+ "KB"); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void getPopUpData(File file){ try { ExifInterface exif_data = new ExifInterface(file.getAbsolutePath()); Date lastModDate = new Date(file.lastModified()); long length = file.length()/1024; String img_width = exif_data.getAttribute(ExifInterface.TAG_IMAGE_WIDTH); String img_height = exif_data.getAttribute(ExifInterface.TAG_IMAGE_LENGTH); if("0".equals(img_width) || "0".equals(img_height)) { try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; ParcelFileDescriptor fd = getContentResolver().openFileDescriptor(Uri.fromFile(file), "r"); if (fd != null) { BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor(), null, options); img_width = options.outWidth + ""; img_height = options.outHeight + ""; fd.close(); options = null; } } catch (Exception e) { } } ((TextView)pwindo.getContentView().findViewById(R.id.path)).setText(file.getAbsolutePath()); ((TextView)pwindo.getContentView().findViewById(R.id.time)).setText(lastModDate.toString()); ((TextView)pwindo.getContentView().findViewById(R.id.image_width)).setText(img_width); ((TextView)pwindo.getContentView().findViewById(R.id.height)).setText(img_height); ((TextView)pwindo.getContentView().findViewById(R.id.size)).setText(Long.toString(length)+ "KB"); } catch (IOException e) { e.printStackTrace(); } }
Source:
public void counterexampleFoundWithAllParametersIsCorrect() { String propertyName = "mySuperProperty"; String[] arguments = {"first", "second", "third"}; long[] seeds = {12345, 8842}; String assertionName = "assertion name"; AssertionError error = new AssertionError(assertionName); AssertionError actual = PropertyFalsified.counterexampleFound( propertyName, arguments, seeds, error); String expected = format("Property named 'mySuperProperty' failed (assertion name)%n" + "With arguments: [first, second, third]%n" + "Seeds for reproduction: [12345, 8842]"); assertThat(actual.getMessage(), is(expected)); }

Target:
public void counterexampleFoundWithAllParametersIsCorrect() { String propertyName = "mySuperProperty"; String[] arguments = {"first", "second", "third"}; long[] seeds = {12345, 8842}; String assertionName = "assertion name"; AssertionError error = new AssertionError(assertionName); AssertionError actual = PropertyFalsified.counterexampleFound( propertyName, arguments, seeds, error); String expected = format("Property named 'mySuperProperty' failed (assertion name)%n" + "With arguments: [first, second, third]%n" + "Seeds for reproduction: [12345, 8842]"); assertThat(actual.getMessage(), equalTo(expected)); }
Source:
public void testMultipleInvocations() throws NoHeadException, ConcurrentRefUpdateException, NoMessageException, UnmergedPathException, JGitInternalException { Git git = new Git(db); CommitCommand commitCmd = git.commit(); commitCmd.setMessage("initial commit").call(); try { commitCmd.setAuthor(author); fail("didn't caught the expected exception"); } catch (IllegalStateException e) { } LogCommand logCmd = git.log(); logCmd.call(); try { logCmd.call(); fail("didn't caught the expected exception"); } catch (IllegalStateException e) { } }

Target:
public void testMultipleInvocations() throws NoHeadException, ConcurrentRefUpdateException, NoMessageException, UnmergedPathException, JGitInternalException { Git git = new Git(db); CommitCommand commitCmd = git.commit(); commitCmd.setMessage("initial commit").call(); try { commitCmd.setAuthor(author); fail("didn't catch the expected exception"); } catch (IllegalStateException e) { } LogCommand logCmd = git.log(); logCmd.call(); try { logCmd.call(); fail("didn't catch the expected exception"); } catch (IllegalStateException e) { } }
Source:
private static void validate(AggregatedPayload payload) { if (payload == null) { throw new InvalidDataException("Invalid request body"); } Set<ConstraintViolation<AggregatedPayload>> constraintViolations = validator.validate(payload); for (ConstraintViolation<AggregatedPayload> constraintViolation : constraintViolations) { String source = constraintViolation.getPropertyPath().toString().equalsIgnoreCase("valid") ? "" : constraintViolation.getPropertyPath().toString(); String metricName = ""; Object leafBean = constraintViolation.getLeafBean(); if (leafBean instanceof BluefloodGauge) { metricName = ((BluefloodGauge) leafBean).getName(); } else if (leafBean instanceof BluefloodCounter) { metricName = ((BluefloodCounter) leafBean).getName(); } else if (leafBean instanceof BluefloodTimer) { metricName = ((BluefloodTimer) leafBean).getName(); } else if (leafBean instanceof BluefloodSet) { metricName = ((BluefloodSet) leafBean).getName(); } if ((metricName.isEmpty()) && (payload.getAllMetricNames().size() > 0)) { metricName = payload.getAllMetricNames().get(0); } payload.validationErrors.add(new ErrorResponse.ErrorData(payload.getTenantId(), metricName, source, constraintViolation.getMessage())); } }

Target:
private static void validate(AggregatedPayload payload) { if (payload == null) { throw new InvalidDataException("Invalid request body"); } Set<ConstraintViolation<AggregatedPayload>> constraintViolations = validator.validate(payload); for (ConstraintViolation<AggregatedPayload> constraintViolation : constraintViolations) { String source = constraintViolation.getPropertyPath().toString().equalsIgnoreCase("valid") ? "" : constraintViolation.getPropertyPath().toString(); String metricName = ""; Object leafBean = constraintViolation.getLeafBean(); if (leafBean instanceof BluefloodGauge) { metricName = ((BluefloodGauge) leafBean).getName(); } else if (leafBean instanceof BluefloodCounter) { metricName = ((BluefloodCounter) leafBean).getName(); } else if (leafBean instanceof BluefloodTimer) { metricName = ((BluefloodTimer) leafBean).getName(); } else if (leafBean instanceof BluefloodSet) { metricName = ((BluefloodSet) leafBean).getName(); } payload.validationErrors.add(new ErrorResponse.ErrorData(payload.getTenantId(), metricName, source, constraintViolation.getMessage(), payload.getTimestamp())); } }
Source:
private List<ArchiveEvent> cleanupJobsBeyondSizeLimit(Set<Path> jobArchivesToRemove) { Set<String> jobIdsToRemoveFromOverview = new HashSet<>(); for (Path archive : jobArchivesToRemove) { jobIdsToRemoveFromOverview.add(archive.getName()); try { archive.getFileSystem().delete(archive, false); } catch (IOException ioe) { LOG.error("Error while deleting old archive " + archive, ioe); } } return cleanupExpiredJobs(jobIdsToRemoveFromOverview); }

Target:
private List<ArchiveEvent> cleanupJobsBeyondSizeLimit(Set<Path> jobArchivesToRemove) { Set<String> jobIdsToRemoveFromOverview = new HashSet<>(); for (Path archive : jobArchivesToRemove) { jobIdsToRemoveFromOverview.add(archive.getName()); try { archive.getFileSystem().delete(archive, false); } catch (IOException ioe) { LOG.warn("Could not delete old archive " + archive, ioe); } } return cleanupExpiredJobs(jobIdsToRemoveFromOverview); }
Source:
public void should_save_issues_from_external_report() { if (sqSupportsExternalIssues()) { orchestrator.resetData(); SonarScanner build = Tests.createScanner() .setProjectDir(TestUtils.projectDir("tslint-report-project")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY) .setProjectVersion("1.0") .setSourceDirs("src"); build.setProperty("sonar.typescript.tslint.reportPaths", "report.json"); orchestrator.executeBuild(build); SearchRequest request = new SearchRequest(); request.setComponentKeys(Collections.singletonList(PROJECT_KEY)); List<Issue> issuesList = newWsClient().issues().search(request).getIssuesList(); assertThat(issuesList).extracting("line").containsExactlyInAnyOrder(3, 5, 5, 7); assertThat(issuesList).extracting("rule").containsExactlyInAnyOrder( "external_tslint_repo:no-unused-expression", "external_tslint_repo:prefer-const", "external_tslint_repo:semicolon", "external_tslint_repo:curly"); } }

Target:
public void should_save_issues_from_external_report() { orchestrator.resetData(); SonarScanner build = Tests.createScanner() .setProjectDir(TestUtils.projectDir("tslint-report-project")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY) .setProjectVersion("1.0") .setSourceDirs("src"); build.setProperty("sonar.typescript.tslint.reportPaths", "report.json"); orchestrator.executeBuild(build); SearchRequest request = new SearchRequest(); request.setComponentKeys(Collections.singletonList(PROJECT_KEY)); List<Issue> issuesList = newWsClient().issues().search(request).getIssuesList(); assertThat(issuesList).extracting("line").containsExactlyInAnyOrder(3, 5, 5, 7); assertThat(issuesList).extracting("rule").containsExactlyInAnyOrder( "external_tslint_repo:no-unused-expression", "external_tslint_repo:prefer-const", "external_tslint_repo:semicolon", "external_tslint_repo:curly"); }
Source:
private void drawTiles( Canvas canvas ) { if( mPreviouslyDrawnTiles.size() > 0 ) { drawTilesConsideringPreviouslyDrawnLevel( canvas ); } else { drawTilesWithoutConsideringPreviouslyDrawnLevel( canvas ); } Log.d( getClass().getSimpleName(), "prevous tile count: " + mPreviouslyDrawnTiles.size() ); }

Target:
private void drawTiles( Canvas canvas ) { if( mPreviouslyDrawnTiles.size() > 0 ) { drawTilesConsideringPreviouslyDrawnLevel( canvas ); } else { drawTilesWithoutConsideringPreviouslyDrawnLevel( canvas ); } }
Source:
public MessageSource<Object> jdbcMessageSource() { JdbcPollingChannelAdapter jdbcPollingChannelAdapter = new JdbcPollingChannelAdapter(dataSource, properties.getQuery()); jdbcPollingChannelAdapter.setMaxRowsPerPoll(properties.getMaxRowsPerPoll()); if (properties.getUpdate() != null) { jdbcPollingChannelAdapter.setUpdateSql(properties.getUpdate()); } return jdbcPollingChannelAdapter; }

Target:
public MessageSource<Object> jdbcMessageSource() { JdbcPollingChannelAdapter jdbcPollingChannelAdapter = new JdbcPollingChannelAdapter(dataSource, properties.getQuery()); jdbcPollingChannelAdapter.setMaxRowsPerPoll(properties.getMaxRowsPerPoll()); jdbcPollingChannelAdapter.setUpdateSql(properties.getUpdate()); return jdbcPollingChannelAdapter; }
Source:
private InteractionRewriter visitInteractionAwareExpressionStatement(ExpressionStatement stat) { InteractionRewriter rewriter = new InteractionRewriter(resources, getCurrentWithOrMockClosure()); if(isInterationExpression(rewriter, stat)) { insideInteraction = true; super.doVisitExpressionStatement(stat); insideInteraction = false; } else { super.doVisitExpressionStatement(stat); } return rewriter; }

Target:
private InteractionRewriter visitInteractionAwareExpressionStatement(ExpressionStatement stat) { InteractionRewriter rewriter = new InteractionRewriter(resources, getCurrentWithOrMockClosure()); if (isInteractionExpression(rewriter, stat)) { insideInteraction = true; super.doVisitExpressionStatement(stat); insideInteraction = false; } else { super.doVisitExpressionStatement(stat); } return rewriter; }
Source:
public Builder<String> taskCreator(final String batchId, final TaskOnBatch task) throws EvrythngClientException { return postAccepted(String.format(PATH_BATCH_TASKS, batchId), task); }

Target:
public Builder<AcceptedResourceResponse> taskCreator(final String batchId, final TaskOnBatch task) throws EvrythngClientException { return postAsynchronously(String.format(PATH_BATCH_TASKS, batchId), task, Pattern.compile(".*/([^/]*)$")); }
Source:
public void handleRequests(Request request) throws InterruptedException { try { DataInputStream stream = new DataInputStream(request.getInputStream()); RequestOrResponseType type = RequestOrResponseType.values()[stream.readShort()]; switch (type) { case PutRequest: handlePutRequest(request); break; case GetRequest: handleGetRequest(request); break; case DeleteRequest: handleDeleteRequest(request); break; case TtlUpdateRequest: handleTtlUpdateRequest(request); break; case ReplicaMetadataRequest: handleReplicaMetadataRequest(request); break; case AdminRequest: throw new UnsupportedOperationException("Request type not supported"); default: throw new UnsupportedOperationException("Request type not supported"); } } catch (Exception e) { logger.error("Error while handling request " + request + " closing connection", e); requestResponseChannel.closeConnection(request); } }

Target:
public void handleRequests(Request request) throws InterruptedException { try { DataInputStream stream = new DataInputStream(request.getInputStream()); RequestOrResponseType type = RequestOrResponseType.values()[stream.readShort()]; switch (type) { case PutRequest: handlePutRequest(request); break; case GetRequest: handleGetRequest(request); break; case DeleteRequest: handleDeleteRequest(request); break; case TtlUpdateRequest: handleTtlUpdateRequest(request); break; case ReplicaMetadataRequest: handleReplicaMetadataRequest(request); break; case AdminRequest: handleAdminRequest(request); break; default: throw new UnsupportedOperationException("Request type not supported"); } } catch (Exception e) { logger.error("Error while handling request " + request + " closing connection", e); requestResponseChannel.closeConnection(request); } }
Source:
private CachedJob<T> initializeOrEnsureRefMatch(final JobRef<T> ref) throws IllegalStateException { if (!_cachedJob.isPresent()) { LOGGER.info() .setMessage("initializing") .addData("ref", ref) .log(); _cachedJob = Optional.of(new CachedJob<>(_injector, ref)); } final JobRef<T> oldRef = _cachedJob.get().getRef(); if (!oldRef.equals(ref)) { LOGGER.error() .setMessage("JobRef in received message does not match cached JobRef") .addData("cached", oldRef) .addData("new", ref) .log(); stopForever(); throw new IllegalStateException("got JobRef id=" + ref.getJobId() + " but already initialized with id=" + oldRef.getJobId()); } return _cachedJob.get(); }

Target:
private CachedJob<T> initializeOrEnsureRefMatch(final JobRef<T> ref) throws IllegalStateException, NoSuchJobException { if (!_cachedJob.isPresent()) { LOGGER.info() .setMessage("initializing") .addData("ref", ref) .log(); _cachedJob = Optional.of(CachedJob.createAndLoad(_injector, ref, _periodicMetrics)); } final JobRef<T> oldRef = _cachedJob.get().getRef(); if (!oldRef.equals(ref)) { throw new IllegalStateException(String.format("got JobRef %s, but already initialized with %s", ref, oldRef)); } return _cachedJob.get(); }
Source:
public void partActivated(IWorkbenchPart part) { if (part == AbstractTimeGraphView.this) { synchronized (FIND_ACTION) { if (fFindActionHandler == null) { fFindActionHandler = new ActionHandler(FIND_ACTION); } @SuppressWarnings("null") final Object service = PlatformUI.getWorkbench().getService(IHandlerService.class); fFindHandlerActivation = ((IHandlerService) service).activateHandler(ActionFactory.FIND.getCommandId(), fFindActionHandler); } } FIND_ACTION.partActivated(part); }

Target:
public void partActivated(IWorkbenchPart part) { if (part == AbstractTimeGraphView.this) { synchronized (FIND_ACTION) { if (fFindActionHandler == null) { fFindActionHandler = new ActionHandler(FIND_ACTION); } final Object service = PlatformUI.getWorkbench().getService(IHandlerService.class); fFindHandlerActivation = ((IHandlerService) service).activateHandler(ActionFactory.FIND.getCommandId(), fFindActionHandler); } } FIND_ACTION.partActivated(part); }
Source:
public boolean await(long deadline) throws InterruptedException { final WorkManager mgr = Framework.getService(WorkManager.class); if (mgr.awaitCompletion(deadline - System.currentTimeMillis(), TimeUnit.MILLISECONDS)) { return true; } logInfos(mgr); return false; }

Target:
public boolean await(long deadline) throws InterruptedException { WorkManager workManager = Framework.getService(WorkManager.class); if (workManager.awaitCompletion(deadline - System.currentTimeMillis(), TimeUnit.MILLISECONDS)) { return true; } logInfos(workManager); return false; }
Source:
public void setVideoConstraints(Map<String, VideoConstraints> newVideoConstraintsMap) { Map<String, VideoConstraints> videoConstraintsMapCopy = this.videoConstraintsMap; boolean needsUpdate = newVideoConstraintsMap.size() != videoConstraintsMapCopy.size(); if (!needsUpdate) { for (Map.Entry<String, VideoConstraints> videoConstraintsEntry : newVideoConstraintsMap.entrySet()) { String endpointId = videoConstraintsEntry.getKey(); VideoConstraints newVideoConstraints = videoConstraintsEntry.getValue(); VideoConstraints oldVideoConstraints = videoConstraintsMapCopy.get(endpointId); if (!newVideoConstraints.equals(oldVideoConstraints)) { needsUpdate = true; break; } } } if (needsUpdate) { this.videoConstraintsMap = newVideoConstraintsMap; update(); } }

Target:
public void setVideoConstraints(Map<String, VideoConstraints> newVideoConstraintsMap) { if (!this.videoConstraintsMap.equals(newVideoConstraintsMap)) { this.videoConstraintsMap = newVideoConstraintsMap; update(); } }
Source:
private void writePreviousDirectory() { if (previousDirectory == null) { return; } try { FileWriter writer = new FileWriter("prev_directory.txt"); writer.write(previousDirectory.getAbsolutePath()); writer.close(); } catch (IOException e) { } }

Target:
private void writePreviousDirectory() { if (previousDirectory == null) { return; } try { FileWriter writer = new FileWriter("prev_directory.txt"); writer.write(previousDirectory.getAbsolutePath()); writer.close(); } catch (IOException e) { LOG.log(Level.WARNING, e.getMessage()); } }
Source:
public void testGetJobManagerLogsList() throws Exception { List<LogInfo> logsList = Arrays.asList( new LogInfo("jobmanager.log", 0L), new LogInfo("jobmanager.out", 0L), new LogInfo("test.log", 0L)); JobManagerLogListHandler jobManagerLogListHandler = createHandler(logsList); LogListInfo logListInfo = jobManagerLogListHandler.handleRequest(testRequest, mockRestfulGateway).get(); assertThat(logListInfo.getLogInfos(), hasSize(logsList.size())); }

Target:
public void testGetJobManagerLogsList() throws Exception { String jobmanagerLogContent = "jobmanager log content"; String jobmanagerStdoutContent = "jobmanager stdout content"; String jobmanagerCustomLogContent = "jobmanager custom log content"; LogInfo jobmanagerLog = new LogInfo("jobmanager.log", jobmanagerLogContent.length()); LogInfo jobmanagerStdout = new LogInfo("jobmanager.out", jobmanagerStdoutContent.length()); LogInfo customLog = new LogInfo("test.log", jobmanagerCustomLogContent.length()); Map<LogInfo, String> logInfo2ContentMap = new HashMap<>(3); logInfo2ContentMap.put(jobmanagerLog, jobmanagerLogContent); logInfo2ContentMap.put(jobmanagerStdout, jobmanagerStdoutContent); logInfo2ContentMap.put(customLog, jobmanagerCustomLogContent); Map<String, LogInfo> fileNameAndLogInfoMap = new HashMap<>(3); fileNameAndLogInfoMap.put(jobmanagerLog.getName(), jobmanagerLog); fileNameAndLogInfoMap.put(jobmanagerStdout.getName(), jobmanagerStdout); fileNameAndLogInfoMap.put(customLog.getName(), customLog); JobManagerLogListHandler jobManagerLogListHandler = createHandler(logInfo2ContentMap); LogListInfo logListInfo = jobManagerLogListHandler.handleRequest(testRequest, mockRestfulGateway).get(); assertThat(logListInfo.getLogInfos(), hasSize(logInfo2ContentMap.size())); for (LogInfo logInfo : logListInfo.getLogInfos()) { assertEquals(logInfo, fileNameAndLogInfoMap.get(logInfo.getName())); } }
Source:
private void createLinkedRename() { cursorPosition = textEditor.getCursorPosition(); LinkedModelParams params = dtoFactory.createDto(LinkedModelParams.class); params.setUri(textEditor.getDocument().getFile().getLocation().toString()); params.setOffset(textEditor.getCursorOffset()); extensionServiceClient .getLinkedModeModel(params) .then( linkedModeModel -> { clientServerEventService .sendFileTrackingSuspendEvent() .then( success -> { if (linkedModeModel == null) { showError(); isActiveLinkedEditor = false; return; } activateLinkedModeIntoEditor(linkedModeModel); }); }) .catchError( arg -> { isActiveLinkedEditor = false; showError(); }); }

Target:
private void createLinkedRename() { cursorPosition = textEditor.getCursorPosition(); Document document = textEditor.getDocument(); TextDocumentPositionParams params = dtoBuildHelper.createTDPP(document, textEditor.getCursorOffset()); extensionServiceClient .getLinkedModeModel(params) .then( ranges -> { clientServerEventService .sendFileTrackingSuspendEvent() .then( success -> { if (ranges == null || ranges.isEmpty()) { showError(); isActiveLinkedEditor = false; clientServerEventService.sendFileTrackingResumeEvent(); return; } activateLinkedModeIntoEditor(ranges); }); }) .catchError( arg -> { isActiveLinkedEditor = false; showError(); }); }
Source:
private static void waitUntilState(final String serverName, final String state) throws TimeoutException { RetryTaskExecutor<Void> taskExecutor = new RetryTaskExecutor<Void>(); taskExecutor.retryTask(new Callable<Void>() { public Void call() throws Exception { String serverStatus = this.checkServerStatus(); if (!serverStatus.equals(state)) throw new Exception("Server not in state " + state); return null; } private String checkServerStatus() { ModelNode op = new ModelNode(); op.get(OP_ADDR).add(HOST, "master"); op.get(OP_ADDR).add(SERVER_CONFIG, serverName); op.get(OP).set(READ_ATTRIBUTE_OPERATION); op.get(NAME).set(STATUS); return domainMasterLifecycleUtil.executeForResult(op).asString(); } }); }

Target:
private static void waitUntilState(final String serverName, final String state) throws TimeoutException { RetryTaskExecutor<Void> taskExecutor = new RetryTaskExecutor<Void>(); taskExecutor.retryTask(new Callable<Void>() { public Void call() throws Exception { String serverStatus = this.checkServerStatus(); if (!serverStatus.equals(state)) throw new Exception("Server not in state " + state); return null; } private String checkServerStatus() { ModelNode op = new ModelNode(); op.get(OP_ADDR).add(HOST, MASTER); op.get(OP_ADDR).add(SERVER_CONFIG, serverName); op.get(OP).set(READ_ATTRIBUTE_OPERATION); op.get(NAME).set(STATUS); return domainMasterLifecycleUtil.executeForResult(op).asString(); } }); }
Source:
protected void testExecute_searchCourseId_shouldSucceed() { loginAsAdmin(); String[] submissionParams = new String[] { Const.ParamsNames.ADMIN_SEARCH_KEY, acc.getCourseId() }; SearchInstructorsAction action = getAction(submissionParams); JsonResult result = getJsonResult(action); InstructorsData response = (InstructorsData) result.getOutput(); assertTrue(response.getInstructors().stream() .anyMatch(i -> i.getName().equals(acc.getName()))); }

Target:
protected void testExecute_searchCourseId_shouldSucceed() { loginAsAdmin(); String[] submissionParams = new String[] { Const.ParamsNames.ADMIN_SEARCH_KEY, acc.getCourseId() }; SearchInstructorsAction action = getAction(submissionParams); JsonResult result = getJsonResult(action); InstructorsData response = (InstructorsData) result.getOutput(); assertTrue(response.getInstructors().stream() .filter(i -> i.getName().equals(acc.getName())) .findAny() .isPresent()); }
Source:
public MegaDeviceHttpSocket(Socket s) { this.s = s; try { this.is = s.getInputStream(); this.os = s.getOutputStream(); } catch (IOException e) { logger.debug("ERROR: " + e.getMessage()); } }

Target:
public MegaDeviceHttpSocket(Socket s) { this.s = s; try { this.is = s.getInputStream(); this.os = s.getOutputStream(); } catch (IOException e) { logger.error("ERROR: {}. Unable to start socket. ", e.getMessage()); } }
Source:
public VoidResult call() throws NoSuchChangeException, InvalidChangeOperationException, OrmException { final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl ctl = changeControlFactory.validateFor(changeId); change = ctl.getChange(); patchSet = db.patchSets().get(patchSetId); if (patchSet == null) { throw new NoSuchChangeException(changeId); } drafts = drafts(); publishDrafts(); final boolean isCurrent = patchSetId.equals(change.currentPatchSetId()); if (isCurrent && change.getStatus().isOpen()) { publishApprovals(ctl); } else if (!approvals.isEmpty() && !forceMessage) { throw new InvalidChangeOperationException("Change is closed"); } else { publishMessageOnly(); } touchChange(); email(); fireHook(); return VoidResult.INSTANCE; }

Target:
public VoidResult call() throws NoSuchChangeException, InvalidChangeOperationException, OrmException { final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl ctl = changeControlFactory.validateFor(changeId); change = ctl.getChange(); patchSet = db.patchSets().get(patchSetId); if (patchSet == null) { throw new NoSuchChangeException(changeId); } drafts = drafts(); publishDrafts(); final boolean isCurrent = patchSetId.equals(change.currentPatchSetId()); if (isCurrent && change.getStatus().isOpen()) { publishApprovals(ctl); } else if (approvals.isEmpty() || forceMessage) { publishMessageOnly(); } else { throw new InvalidChangeOperationException("Change is closed"); } touchChange(); email(); fireHook(); return VoidResult.INSTANCE; }
Source:
void addQueryParamIterable(String name, Iterable values, boolean urlEncodeValue) { for (Object value: values) { addQueryParamString(name, value.toString(), urlEncodeValue); } }

Target:
void addQueryParamIterable(String name, Iterable values, boolean urlEncodeValue) { for (Object value : values) { addQueryParam(name, value, urlEncodeValue); } }
Source:
private ImmutableListMultimap<String, Availability> getAvailabilities(List<Episode> episodes) { ImmutableListMultimap<String, Availability> availabilities; try { availabilities = availabilities(episodes); } catch (GlycerinException e) { throw Throwables.propagate(e); } return availabilities; }

Target:
private ImmutableListMultimap<String, Availability> getAvailabilities(List<Episode> episodes) { ImmutableListMultimap<String, Availability> availabilities; try { return availabilities(episodes); } catch (GlycerinException e) { throw Throwables.propagate(e); } }
Source:
private void replaceFilePathsWithBytes(ModelNode request, ModelNode opDescOutcome) throws CommandFormatException { ModelNode requestProps = opDescOutcome.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES) { String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); try { request.get(prop.getName()).set(Util.readBytes(localFile)); } catch (OperationFormatException e) { throw new CommandFormatException(e); } } } }

Target:
private void replaceFilePathsWithBytes(ModelNode request, ModelNode opDescOutcome) throws CommandFormatException { ModelNode requestProps = opDescOutcome.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES && request.hasDefined(prop.getName())) { String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); if (!localFile.exists()) continue; try { request.get(prop.getName()).set(Util.readBytes(localFile)); } catch (OperationFormatException e) { throw new CommandFormatException(e); } } } }
Source:
public TestDistributedQueriesNoHashGeneration() { super(() -> createQueryRunner(ImmutableMap.of(), ImmutableMap.of("optimizer.optimize-hash-generation", "false")), FeatureSelection.all().without(ENGINE_ONLY).build()); }

Target:
public TestDistributedQueriesNoHashGeneration() { super(() -> createQueryRunner(ImmutableMap.of(), ImmutableMap.of("optimizer.optimize-hash-generation", "false"))); }
Source:
public int getColumnIndex(String columnName) throws DDFException { return mSchema != null ? mSchema.getColumnIndex(columnName) : -1; }

Target:
public int getColumnIndex(String columnName) throws DDFException { return mSchema.getColumnIndex(columnName); }
Source:
public void delete_a_simple_job() { FreeStyleJob j = jenkins.jobs.create(FreeStyleJob.class, "simple-job"); assertTrue(j.open().getTitle().contains(j.name)); j.delete(); assertFalse(j.open().getTitle().contains(j.name)); }

Target:
public void delete_a_simple_job() { FreeStyleJob j = jenkins.jobs.create(FreeStyleJob.class, "simple-job"); assertThat(j, pageObjectExists()); j.delete(); assertThat(j,pageObjectDoesNotExist()); }
Source:
DivType toDiv(Map<MediaUnit, String> mediaUnitIDs, LinkedList<Pair<String, String>> smLinkData, Mets mets) { DivType div = new DivType(); div.setID(metsReferrerId); div.setLABEL(super.getLabel()); div.setORDERLABEL(super.getOrderlabel()); div.setTYPE(super.getType()); smLinkData.addAll(super.getViews().parallelStream().map(View::getMediaUnit).map(mediaUnitIDs::get) .map(mediaUnitId -> Pair.of(metsReferrerId, mediaUnitId)).collect(Collectors.toList())); Optional<MdSecType> optionalDmdSec = createMdSec(MdSec.DMD_SEC); if (optionalDmdSec.isPresent()) { MdSecType dmdSec = optionalDmdSec.get(); String name = metsReferrerId + ':' + MdSec.DMD_SEC.toString(); dmdSec.setID(UUID.nameUUIDFromBytes(name.getBytes(StandardCharsets.UTF_8)).toString()); mets.getDmdSec().add(dmdSec); div.getDMDID().add(dmdSec); } Optional<AmdSecType> optionalAmdSec = createAmdSec(div); if (optionalAmdSec.isPresent()) { AmdSecType admSec = optionalAmdSec.get(); mets.getAmdSec().add(admSec); } for (ExistingOrLinkedStructure substructure : super.getChildren()) { div.getDiv().add(new DivXmlElementAccess((Structure) substructure).toDiv(mediaUnitIDs, smLinkData, mets)); } return div; }

Target:
DivType toDiv(Map<MediaUnit, String> mediaUnitIDs, LinkedList<Pair<String, String>> smLinkData, Mets mets) { DivType div = new DivType(); div.setID(metsReferrerId); div.setLABEL(super.getLabel()); div.setORDERLABEL(super.getOrderlabel()); div.setTYPE(super.getType()); smLinkData.addAll(super.getViews().parallelStream().map(View::getMediaUnit).map(mediaUnitIDs::get) .map(mediaUnitId -> Pair.of(metsReferrerId, mediaUnitId)).collect(Collectors.toList())); Optional<MdSecType> optionalDmdSec = createMdSec(super.getMetadata(), MdSec.DMD_SEC); if (optionalDmdSec.isPresent()) { MdSecType dmdSec = optionalDmdSec.get(); String name = metsReferrerId + ':' + MdSec.DMD_SEC.toString(); dmdSec.setID(UUID.nameUUIDFromBytes(name.getBytes(StandardCharsets.UTF_8)).toString()); mets.getDmdSec().add(dmdSec); div.getDMDID().add(dmdSec); } Optional<AmdSecType> optionalAmdSec = createAmdSec(super.getMetadata(), metsReferrerId, div); if (optionalAmdSec.isPresent()) { AmdSecType admSec = optionalAmdSec.get(); mets.getAmdSec().add(admSec); } for (StructuralElement substructure : super.getChildren()) { div.getDiv().add(new DivXmlElementAccess((IncludedStructuralElement) substructure).toDiv(mediaUnitIDs, smLinkData, mets)); } return div; }
Source:
public void updateMainBranchName(DbSession dbSession, String projectUuid, String newBranchKey) { Optional<BranchDto> branch = selectByKey(dbSession, projectUuid, BranchKeyType.BRANCH, newBranchKey); if (branch.isPresent()) { throw new IllegalArgumentException("Impossible to update branch name: a branch with name \"" + newBranchKey + "\" already exists in the project."); } mapper(dbSession).updateMainBranchName(projectUuid, newBranchKey); }

Target:
public int updateMainBranchName(DbSession dbSession, String projectUuid, String newBranchKey) { long now = system2.now(); return mapper(dbSession).updateMainBranchName(projectUuid, newBranchKey, now); }
Source:
public TarArchiveEntry(final Path file, final String fileName) { final String normalizedName = normalizeFileName(fileName, false); this.file = file; if (Files.isDirectory(file)) { this.mode = DEFAULT_DIR_MODE; this.linkFlag = LF_DIR; final int nameLength = normalizedName.length(); if (nameLength == 0 || normalizedName.charAt(nameLength - 1) != '/') { this.name = normalizedName + "/"; } else { this.name = normalizedName; } } else { this.mode = DEFAULT_FILE_MODE; this.linkFlag = LF_NORMAL; try { this.size = Files.size(file); } catch (IOException e) { e.printStackTrace(); } this.name = normalizedName; } this.userName = ""; Set<String> availableAttributeViews = file.getFileSystem().supportedFileAttributeViews(); if (availableAttributeViews.contains("posix")) { try { final PosixFileAttributes posixFileAttributes = Files.readAttributes(file, PosixFileAttributes.class); setModTime(posixFileAttributes.lastModifiedTime()); this.userName = posixFileAttributes.owner().getName(); this.groupName = posixFileAttributes.group().getName(); if (availableAttributeViews.contains("unix")) { this.userId = ((Number) Files.getAttribute(file, "unix:uid")).longValue(); this.groupId = ((Number) Files.getAttribute(file, "unix:gid")).longValue(); } } catch (IOException e) { e.printStackTrace(); } } else if (availableAttributeViews.contains("dos")) { try { final DosFileAttributes dosFileAttributes = Files.readAttributes(file, DosFileAttributes.class); setModTime(dosFileAttributes.lastModifiedTime()); this.userName = Files.getOwner(file).getName(); } catch (IOException e) { e.printStackTrace(); } } else { try { final BasicFileAttributes basicFileAttributes = Files.readAttributes(file, BasicFileAttributes.class); setModTime(basicFileAttributes.lastModifiedTime()); this.userName = Files.getOwner(file).getName(); } catch (IOException e) { e.printStackTrace(); } } preserveAbsolutePath = false; }

Target:
public TarArchiveEntry(final Path file, final String fileName) throws IOException { final String normalizedName = normalizeFileName(fileName, false); this.file = file; readFileMode(file, normalizedName); this.userName = ""; readOsSpecificProperties(file); preserveAbsolutePath = false; }
Source:
public BackendImplementor<?> create(String name, BackendBuildContext buildContext, ConfigurationPropertySource propertySource) { EventContext backendContext = EventContexts.fromBackendName( name ); ElasticsearchClientFactory clientFactory = new ElasticsearchClientFactoryImpl(); boolean logPrettyPrinting = LOG_JSON_PRETTY_PRINTING.get( propertySource ); GsonProvider initialGsonProvider = DefaultGsonProvider.create( GsonBuilder::new, logPrettyPrinting ); ElasticsearchClientImplementor client = clientFactory.create( propertySource, initialGsonProvider ); try { GsonProvider dialectSpecificGsonProvider = DefaultGsonProvider.create( this::createES5GsonBuilderBase, logPrettyPrinting ); client.init( dialectSpecificGsonProvider ); MultiTenancyStrategy multiTenancyStrategy = getMultiTenancyStrategy( name, propertySource ); ElasticsearchWorkFactory workFactory = new ElasticsearchStubWorkFactory( dialectSpecificGsonProvider, multiTenancyStrategy ); ElasticsearchWorkBuilderFactory workBuilderFactory = new ElasticsearchWorkBuilderFactoryImpl( dialectSpecificGsonProvider ); ElasticsearchAnalysisDefinitionRegistry analysisDefinitionRegistry = getAnalysisDefinitionRegistry( backendContext, buildContext, propertySource ); return new ElasticsearchBackendImpl( client, name, workFactory, workBuilderFactory, analysisDefinitionRegistry, multiTenancyStrategy ); } catch (RuntimeException e) { new SuppressingCloser( e ).push( ElasticsearchClientImplementor::close, client ); throw e; } }

Target:
public BackendImplementor<?> create(String name, BackendBuildContext buildContext, ConfigurationPropertySource propertySource) { EventContext backendContext = EventContexts.fromBackendName( name ); boolean logPrettyPrinting = LOG_JSON_PRETTY_PRINTING.get( propertySource ); GsonProvider initialGsonProvider = DefaultGsonProvider.create( GsonBuilder::new, logPrettyPrinting ); ElasticsearchClientImplementor client = null; try { BeanProvider beanProvider = buildContext.getServiceManager().getBeanProvider(); try ( BeanHolder<? extends ElasticsearchClientFactory> clientFactoryHolder = CLIENT_FACTORY.getAndTransform( propertySource, beanProvider::getBean ) ) { client = clientFactoryHolder.get().create( propertySource, initialGsonProvider ); } GsonProvider dialectSpecificGsonProvider = DefaultGsonProvider.create( this::createES5GsonBuilderBase, logPrettyPrinting ); client.init( dialectSpecificGsonProvider ); Gson userFacingGson = new GsonBuilder().setPrettyPrinting().create(); ElasticsearchWorkBuilderFactory workFactory = new ElasticsearchWorkBuilderFactoryImpl( dialectSpecificGsonProvider ); ElasticsearchAnalysisDefinitionRegistry analysisDefinitionRegistry = getAnalysisDefinitionRegistry( backendContext, buildContext, propertySource ); return new ElasticsearchBackendImpl( client, dialectSpecificGsonProvider, name, workFactory, userFacingGson, analysisDefinitionRegistry, getMultiTenancyStrategy( name, propertySource ) ); } catch (RuntimeException e) { new SuppressingCloser( e ).push( ElasticsearchClientImplementor::close, client ); throw e; } }
Source:
public ParseInModule(Module seedModule) { this.seedModule = seedModule; this.extensionModule = seedModule; this.disambModule = seedModule; this.parsingModule = seedModule; this.grammar = KSyntax2GrammarStatesFilter.getGrammar(parsingModule); }

Target:
ParseInModule(Module seedModule) { this(seedModule, seedModule, seedModule, seedModule); }