auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void single_file() throws Exception { PhpIniSensor sensor = new PhpIniSensor(null); ActiveRules activeRules = new ActiveRulesBuilder() .create(RuleKey.of("repo1", "rule1")) .activate() .build(); CheckFactory checkFactory = new CheckFactory(activeRules); Checks<PhpIniCheck> checks = checkFactory.<PhpIniCheck>create("repo1").addAnnotatedChecks(MyCheck.class); DefaultInputFile file1 = new DefaultInputFile("php.ini", "php.ini").initMetadata("line1\nline2\n"); context.fileSystem().add(file1); sensor.execute(context, checks); Collection<Issue> issues = context.allIssues(); assertThat(issues).hasSize(1); Issue issue = issues.iterator().next(); assertThat(issue.ruleKey().rule()).isEqualTo("rule1"); assertThat(issue.primaryLocation().inputComponent()).isEqualTo(file1); assertThat(issue.primaryLocation().message()).isEqualTo("message1"); assertThat(issue.primaryLocation().textRange().start().line()).isEqualTo(2); }

Target:
public void single_file() throws Exception { File baseDir = new File("src/test/resources/phpini"); SensorContextTester context = SensorContextTester.create(baseDir); DefaultInputFile file1 = setupSingleFile(baseDir, context); sensor().execute(context, checks()); Collection<Issue> issues = context.allIssues(); assertThat(issues).hasSize(1); Issue issue = issues.iterator().next(); assertThat(issue.ruleKey().rule()).isEqualTo("rule1"); assertThat(issue.primaryLocation().inputComponent()).isEqualTo(file1); assertThat(issue.primaryLocation().message()).isEqualTo("message1"); assertThat(issue.primaryLocation().textRange().start().line()).isEqualTo(2); }
Source:
public IServer getServer(IModule module, IModuleArtifact moduleArtifact, IProgressMonitor monitor) throws CoreException { IServer server = ServerCore.getDefaultServer(module); if (server != null && !ServerUtil.containsModule(server, module, monitor)) { IServerWorkingCopy wc = server.createWorkingCopy(); try { ServerUtil.modifyModules(wc, new IModule[] { module }, new IModule[0], monitor); wc.save(false, monitor); } catch (CoreException ce) { server = null; } } IServer[] servers = getCompatibleServers(module); if( servers.length == 1 ) return servers[0]; Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (server == null) { FullPublishToServerWizard wizard = new FullPublishToServerWizard(module, moduleArtifact); WizardDialog dialog = new WizardDialog(shell, wizard); if (dialog.open() == Window.CANCEL) { if (monitor != null) monitor.setCanceled(true); return null; } try { Job.getJobManager().join("org.eclipse.wst.server.ui.family", null); } catch (Exception e) { } server = wizard.getServer(); boolean preferred = wizard.isPreferredServer(); if (server != null && preferred) { try { ServerCore.setDefaultServer(module, server, monitor); } catch (CoreException ce) { String message = "Could not save server preference information."; ErrorDialog.openError(shell, "Server Error", message, ce.getStatus()); } } } try { Job.getJobManager().join("org.eclipse.wst.server.ui.family", new NullProgressMonitor()); } catch (Exception e) { } return server; }

Target:
public IServer getServer(IModule module, IModuleArtifact moduleArtifact, IProgressMonitor monitor) throws CoreException { IServer server = ServerCore.getDefaultServer(module); if (server != null && !ServerUtil.containsModule(server, module, monitor)) { IServerWorkingCopy wc = server.createWorkingCopy(); try { ServerUtil.modifyModules(wc, new IModule[] { module }, new IModule[0], monitor); wc.save(false, monitor); } catch (CoreException ce) { WTPOveridePlugin.logError(ce); server = null; } } IServer[] servers = getCompatibleServers(module); if( servers.length == 1 ) return servers[0]; Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (server == null) { FullPublishToServerWizard wizard = new FullPublishToServerWizard(module, moduleArtifact); WizardDialog dialog = new WizardDialog(shell, wizard); if (dialog.open() == Window.CANCEL) { if (monitor != null) monitor.setCanceled(true); return null; } joinJobFamily(); server = wizard.getServer(); boolean preferred = wizard.isPreferredServer(); if (server != null && preferred) { try { ServerCore.setDefaultServer(module, server, monitor); } catch (CoreException ce) { String message = "Could not save server preference information."; ErrorDialog.openError(shell, "Server Error", message, ce.getStatus()); } } } joinJobFamily(); return server; }
Source:
private void populateCPUList(ClusterModel clusterModel, List<ServerCpu> cpus, boolean canChangeArchitecture) { ServerCpu oldSelectedCpu = clusterModel.getCPU().getSelectedItem(); clusterModel.getCPU().setItems(cpus); clusterModel.getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrDefault(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); if (clusterModel.getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (clusterModel.getIsEdit()) { if (canChangeArchitecture) { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(ArchitectureType.values()))); } else { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(clusterModel.getEntity() .getArchitecture()))); } ArchitectureType oldSelectedArch = (ArchitectureType) clusterModel.getArchitecture().getSelectedItem(); if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } } else { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(ArchitectureType.values()))); getArchitecture().setSelectedItem(ArchitectureType.undefined); } }

Target:
private void populateCPUList(ClusterModel clusterModel, List<ServerCpu> cpus, boolean canChangeArchitecture) { ServerCpu oldSelectedCpu = clusterModel.getCPU().getSelectedItem(); clusterModel.getCPU().setItems(cpus); clusterModel.getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrDefault(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); if (clusterModel.getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (clusterModel.getIsEdit()) { if (canChangeArchitecture) { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(ArchitectureType.values()))); } else { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(clusterModel.getEntity() .getArchitecture()))); } ArchitectureType oldSelectedArch = (ArchitectureType) clusterModel.getArchitecture().getSelectedItem(); if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } } else { filterUnsupportedArchs(clusterModel); getArchitecture().setSelectedItem(ArchitectureType.undefined); } }
Source:
void updateResultsTable(Collection<Persona> results) { Object[][] rows = new Object[results.size()][2]; int i = 0; for (Persona result : results) { rows[i] = new String[]{String.valueOf(result.getId()), result.getName()}; i++; } DefaultTableModel updatedTableModel = new PersonaFilterTableModel( rows, new String[]{"ID", "Name"} ); filterResultsTable.setModel(updatedTableModel); filterResultsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); filterResultsTable.getColumnModel().getColumn(0).setMaxWidth(100); filterResultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); }

Target:
private void updateResultsTable(Collection<Persona> results) { Object[][] rows = new Object[results.size()][2]; int i = 0; for (Persona result : results) { rows[i] = new String[]{String.valueOf(result.getId()), result.getName()}; i++; } DefaultTableModel updatedTableModel = new PersonaFilterTableModel( rows, new String[]{"ID", "Name"} ); filterResultsTable.setModel(updatedTableModel); filterResultsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); filterResultsTable.getColumnModel().getColumn(0).setMaxWidth(100); filterResultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); }
Source:
public int hashCode() { int result = this.getDevice().getDeviceIdentification().hashCode(); result = 31 * result + this.index; return result; }

Target:
public int hashCode() { return Objects.hash(this.device, this.index); }
Source:
public void placeNewOrder(Market market, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if(orderType==OrderType.BUY && price*volume> this.cashInHand){ throw new StockMarketExpection("Cannot place order for "+symbol+" since there is not enough money. Trader: "+this.name); } Order newOrder; if (orderType == OrderType.BUY) { newOrder = new BuyOrder(symbol, volume, price, this); } else if(orderType == OrderType.SELL){ newOrder = new SellOrder(symbol, volume, price, this); }else{ throw new StockMarketExpection("Type Error"); } if (OrderUtility.isAlreadyPresent(ordersPlaced, newOrder)) { throw new StockMarketExpection("The order is duplicated"); } if (orderType == OrderType.SELL && !OrderUtility.owns(position, symbol)) { throw new StockMarketExpection("The trader haven't own this stock"); } if (orderType == OrderType.SELL && volume > OrderUtility.ownedQuantity(position, symbol)) { throw new StockMarketExpection("The trader does not own enough of the stock."); } m.addOrder(newOrder); ordersPlaced.add(newOrder); }

Target:
public void placeNewOrder(Market market, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if(orderType==OrderType.BUY && price*volume> this.cashInHand) { throw new StockMarketExpection("Cannot place order for "+symbol+" since there is not enough money. Trader: "+this.name); } Order newOrder; if (orderType == OrderType.BUY) { newOrder = new BuyOrder(symbol, volume, price, this); } else if(orderType == OrderType.SELL){ newOrder = new SellOrder(symbol, volume, price, this); }else{ throw new StockMarketExpection("Type Error"); } if (OrderUtility.isAlreadyPresent(ordersPlaced, newOrder)) { throw new StockMarketExpection("The order is duplicated"); } if (orderType == OrderType.SELL && !OrderUtility.owns(position, symbol)) { throw new StockMarketExpection("The trader does not own this stock"); } if (orderType == OrderType.SELL && volume > OrderUtility.ownedQuantity(position, symbol)) { throw new StockMarketExpection("The trader does not own enough of the stock."); } m.addOrder(newOrder); ordersPlaced.add(newOrder); }
Source:
protected ConcreteEventStore( Clock clock, IdGenerator idGenerator, EventHasher eventHasher, MessageSender<ResourceUpdatedMessage> sender, EventPersistenceStore persistenceStore, MetricRegistry metricRegistry, String metricPrefix ) { this.clock = checkNotNull(clock); this.idGenerator = checkNotNull(idGenerator); this.sender = checkNotNull(sender); this.eventHasher = checkNotNull(eventHasher); this.persistenceStore = checkNotNull(persistenceStore); this.metricRegistry = metricRegistry; write = metricPrefix + "write"; }

Target:
protected ConcreteEventStore( Clock clock, IdGenerator idGenerator, EventHasher eventHasher, MessageSender<ResourceUpdatedMessage> sender, EventPersistenceStore persistenceStore, MetricRegistry metricRegistry, String metricPrefix ) { this.clock = checkNotNull(clock); this.idGenerator = checkNotNull(idGenerator); this.sender = checkNotNull(sender); this.eventHasher = checkNotNull(eventHasher); this.persistenceStore = checkNotNull(persistenceStore); this.metricRegistry = metricRegistry; write = metricPrefix + "write."; }
Source:
public void testFileSize() throws Exception { File file = File.createTempFile("forge", "testFileSize"); file.deleteOnExit(); try (FileOutputStream fos = new FileOutputStream(file)) { Streams.write(new ByteArrayInputStream("Test".getBytes()), fos); FileResource<?> fileResource = factory.create(file).reify(FileResource.class); Assert.assertEquals(file.length(), fileResource.getSize()); file.delete(); } }

Target:
public void testFileSize() throws Exception { File file = File.createTempFile("forge", "testFileSize"); file.deleteOnExit(); try (FileWriter write = new FileWriter(file)) { write.append("Test"); FileResource<?> fileResource = factory.create(file).reify(FileResource.class); Assert.assertEquals(file.length(), fileResource.getSize()); } file.delete(); }
Source:
public Builder tag(final String tagName, final String value) { Objects.requireNonNull(tagName, "tagName"); Objects.requireNonNull(value, "value"); if (!tagName.isEmpty() && !value.isEmpty() && CheckTags.isTagNameLegal(tagName) && CheckTags.isTagValueLegal(value)) { tags.put(tagName, value); } return this; }

Target:
public Builder tag(final String tagName, final String value) { Objects.requireNonNull(tagName, "tagName"); Objects.requireNonNull(value, "value"); if (CheckTags.isLegalFullCheck(tagName, value)) { tags.put(tagName, value); } return this; }
Source:
public final byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, String.format("%s starting...", taskId)); userControllerTask.initialize(); try (final MetricTrackerManager metricTrackerManager = this.metricTrackerManager;) { metricTrackerManager.registerTrackers(metricTrackerSet); int iteration = 0; while(!userControllerTask.isTerminated(iteration)) { metricTrackerManager.start(); ctrlMessageBroadcast.send(CtrlMessage.RUN); sendData(iteration); receiveData(iteration); userControllerTask.run(iteration); metricTrackerManager.stop(); updateTopology(); iteration++; } ctrlMessageBroadcast.send(CtrlMessage.TERMINATE); userControllerTask.cleanup(); } return null; }

Target:
public final byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, String.format("%s starting...", taskId)); userControllerTask.initialize(); try (final MetricsCollector metricsCollector = this.metricsCollector;) { metricsCollector.registerTrackers(metricTrackerSet); int iteration = 0; while(!userControllerTask.isTerminated(iteration)) { metricsCollector.start(); ctrlMessageBroadcast.send(CtrlMessage.RUN); sendData(iteration); receiveData(iteration); runUserControllerTask(iteration); metricsCollector.stop(); updateTopology(); iteration++; } ctrlMessageBroadcast.send(CtrlMessage.TERMINATE); userControllerTask.cleanup(); } return null; }
Source:
private void getModel(String modelId, Consumer consumer, ActionListener<Model> modelActionListener) { ModelAndConsumer cachedModel = localModelCache.get(modelId); if (cachedModel != null) { cachedModel.consumers.add(consumer); modelActionListener.onResponse(cachedModel.model); logger.trace(() -> new ParameterizedMessage("[{}] loaded from cache", modelId)); return; } if (loadModelIfNecessary(modelId, consumer, modelActionListener) == false) { logger.trace(() -> new ParameterizedMessage("[{}] is loading or loaded, added new listener to queue", modelId)); } }

Target:
private void getModel(String modelId, Consumer consumer, ActionListener<Model> modelActionListener) { ModelAndConsumer cachedModel = localModelCache.get(modelId); if (cachedModel != null) { cachedModel.consumers.add(consumer); modelActionListener.onResponse(cachedModel.model); logger.trace(() -> new ParameterizedMessage("[{}] loaded from cache", modelId)); return; } if (loadModelIfNecessary(modelId, consumer, modelActionListener)) { logger.trace(() -> new ParameterizedMessage("[{}] is loading or loaded, added new listener to queue", modelId)); } }
Source:
public void testUpdatingDefaultVersionHostedWorkflow() { ApiClient webClient = getWebClient(); WorkflowsApi workflowsApi = new WorkflowsApi(getWebClient()); HostedApi hostedApi = new HostedApi(webClient); Workflow hostedWorkflow = hostedApi.createHostedWorkflow("awesomeTool", "cwl", null, null); SourceFile file = new SourceFile(); file.setContent("cwlVersion: v1.0\\nclass: Workflow\\ninputs:\\ninp: File\\nex: string\\noutputs:\\nclassout:\\ntype: File\\noutputSource: compile/classfile\\nsteps:\\nuntar:\\nrun: tar-param.cwl\\nin:\\ntarfile: inp\\nextractfile: ex\\nout: [example_out]\\ncompile:\\nrun: arguments.cwl\\nin:\\nsrc: untar/example_out\\nout: [classfile]"); file.setType(SourceFile.TypeEnum.DOCKSTORE_CWL); file.setPath("/Dockstore.cwl"); Workflow dockstoreWorkflow = hostedApi.editHostedWorkflow(hostedWorkflow.getId(), Lists.newArrayList(file)); Optional<WorkflowVersion> first = dockstoreWorkflow.getWorkflowVersions().stream().max(Comparator.comparingInt((WorkflowVersion t) -> Integer.parseInt(t.getName()))); Assert.assertEquals("correct number of source files", 1, first.get().getSourceFiles().size()); if (first.isPresent()) { workflowsApi.updateDefaultVersion(hostedWorkflow.getId(), first.get().getName()); } }

Target:
public void testUpdatingDefaultVersionHostedWorkflow() { ApiClient webClient = getWebClient(); WorkflowsApi workflowsApi = new WorkflowsApi(getWebClient()); HostedApi hostedApi = new HostedApi(webClient); Workflow hostedWorkflow = hostedApi.createHostedWorkflow("awesomeTool", "cwl", null, null); SourceFile file = new SourceFile(); file.setContent("cwlVersion: v1.0\\nclass: Workflow\\ninputs:\\ninp: File\\nex: string\\noutputs:\\nclassout:\\ntype: File\\noutputSource: compile/classfile\\nsteps:\\nuntar:\\nrun: tar-param.cwl\\nin:\\ntarfile: inp\\nextractfile: ex\\nout: [example_out]\\ncompile:\\nrun: arguments.cwl\\nin:\\nsrc: untar/example_out\\nout: [classfile]"); file.setType(SourceFile.TypeEnum.DOCKSTORE_CWL); file.setPath("/Dockstore.cwl"); Workflow dockstoreWorkflow = hostedApi.editHostedWorkflow(hostedWorkflow.getId(), Lists.newArrayList(file)); Optional<WorkflowVersion> first = dockstoreWorkflow.getWorkflowVersions().stream().max(Comparator.comparingInt((WorkflowVersion t) -> Integer.parseInt(t.getName()))); Assert.assertEquals("correct number of source files", 1, first.get().getSourceFiles().size()); assertTrue(first.isPresent()); workflowsApi.updateWorkflowDefaultVersion(hostedWorkflow.getId(), first.get().getName()); }
Source:
public void testLocal() throws Exception { final String OUTPUT = TEST_OUTPUT_GCS_FOLDER + "CountReadsITCase-testLocal-output.txt"; String[] ARGS = { "--apiKey=" + API_KEY, "--project=genomics-pipelines", "--output=" + OUTPUT, "--references=1:550000:560000", "--BAMFilePath=" + TEST_BAM_FNAME }; final long EXPECTED = 685; GenomicsOptions popts = PipelineOptionsFactory.create().as(GenomicsOptions.class); popts.setApiKey(API_KEY); GcsUtil gcsUtil = new GcsUtil.GcsUtilFactory().create(popts); touchOutput(gcsUtil, OUTPUT); CountReads.main(ARGS); BufferedReader reader = new BufferedReader(Channels.newReader(gcsUtil.open(GcsPath.fromUri(OUTPUT)), "UTF-8")); long got = Long.parseLong(reader.readLine()); Assert.assertEquals(EXPECTED, got); }

Target:
public void testLocal() throws Exception { final String OUTPUT = TEST_OUTPUT_GCS_FOLDER + "CountReadsITCase-testLocal-output.txt"; String[] ARGS = { "--apiKey=" + API_KEY, "--project=" + TEST_PROJECT, "--output=" + OUTPUT, "--references=1:550000:560000", "--BAMFilePath=" + TEST_BAM_FNAME }; final long EXPECTED = 685; GenomicsOptions popts = PipelineOptionsFactory.create().as(GenomicsOptions.class); popts.setApiKey(API_KEY); GcsUtil gcsUtil = new GcsUtil.GcsUtilFactory().create(popts); touchOutput(gcsUtil, OUTPUT); CountReads.main(ARGS); BufferedReader reader = new BufferedReader(Channels.newReader(gcsUtil.open(GcsPath.fromUri(OUTPUT)), "UTF-8")); long got = Long.parseLong(reader.readLine()); Assert.assertEquals(EXPECTED, got); }
Source:
public void setUp() { serviceRead = new Retrofit.Builder() .baseUrl(APIUtils.GET_API) .addConverterFactory(JacksonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .client(HttpClientBuilder()) .build() .create(OpenFoodAPIService.class); OkHttpClient httpClientWithAuth = new OkHttpClient.Builder() .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)) .addInterceptor(chain -> { Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder() .header("Authorization", "Basic b2ZmOm9mZg==") .header("Accept", "application/json") .method(original.method(), original.body()); Request request = requestBuilder.build(); return chain.proceed(request); }) .build(); serviceWrite = new Retrofit.Builder() .baseUrl(APIUtils.GET_API) .addConverterFactory(JacksonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .client(httpClientWithAuth) .build() .create(OpenFoodAPIService.class); }

Target:
public void setUp() { serviceRead = new Retrofit.Builder() .baseUrl(APIUtils.GET_API) .addConverterFactory(JacksonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .client(HttpClientBuilder()) .build() .create(OpenFoodAPIService.class); OkHttpClient httpClientWithAuth = new OkHttpClient.Builder() .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)) .addInterceptor(chain -> { Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder() .header("Authorization", "Basic b2ZmOm9mZg==") .header("Accept", "application/json") .method(original.method(), original.body()); Request request = requestBuilder.build(); return chain.proceed(request); }) .build(); serviceWrite = new Retrofit.Builder() .baseUrl(APIUtils.DEV_API) .addConverterFactory(JacksonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .client(httpClientWithAuth) .build() .create(OpenFoodAPIService.class); }
Source:
private List<GroupInfo> list(ListRequest listParameter) throws RestApiException { List<GroupInfo> list = null; String query = ""; if (listParameter.getLimit() > 0) { query = UrlUtils.appendToUrlQuery(query, "n=" + listParameter.getLimit()); } String url = GroupApiRestClient.BASE_URL + "/"; if (!Strings.isNullOrEmpty(query)) { url += '?' + query; } JsonElement result = gerritRestClient.getRequest(url); if (result == null) { list = new ArrayList<GroupInfo>(); } else { list = groupsParser.parseGroupInfos(result); } return list; }

Target:
private List<GroupInfo> list(ListRequest listParameter) throws RestApiException { List<GroupInfo> list = null; String query = ""; if (listParameter.getLimit() > 0) { query = UrlUtils.appendToUrlQuery(query, "n=" + listParameter.getLimit()); } if (listParameter.getStart() > 0) { query = UrlUtils.appendToUrlQuery(query, "S=" + listParameter.getLimit()); } if (listParameter.getOwned()) { query = UrlUtils.appendToUrlQuery(query, "owned"); } if ((listParameter.getSuggest() != null) && (listParameter.getSuggest().length() > 0)) { query = UrlUtils.appendToUrlQuery(query, "suggest=" + listParameter.getSuggest()); } if ((listParameter.getOptions() != null) && (listParameter.getOptions().size() > 0)) { throw new NotImplementedException(); } if ((listParameter.getProjects() != null) && (listParameter.getProjects().size() > 0)) { throw new NotImplementedException(); } if ((listParameter.getGroups() != null) && (listParameter.getGroups().size() > 0)) { throw new NotImplementedException(); } if (listParameter.getUser() != null) { throw new NotImplementedException(); } if (listParameter.getSubstring() != null) { throw new NotImplementedException(); } String url = GroupApiRestClient.getBaseRequestPath() + "/"; if (!Strings.isNullOrEmpty(query)) { url += '?' + query; } JsonElement result = gerritRestClient.getRequest(url); if (result == null) { list = Collections.emptyList(); } else { list = groupsParser.parseGroupInfos(result); } return list; }
Source:
public List<AbstractWorkflowDefinition<? extends WorkflowState>> getWorkflowDefinitions() { synchronized (workflowDefinitions) { return new ArrayList<>(workflowDefinitions.values()); } }

Target:
public List<AbstractWorkflowDefinition<? extends WorkflowState>> getWorkflowDefinitions() { return new ArrayList<>(workflowDefinitions.values()); }
Source:
protected void delete(LogEntry delegate, String reason, RequestContext context) throws ResourceDoesNotSupportOperationException { throw new UnsupportedOperationException("delete not supported"); }

Target:
protected void delete(LogEntry delegate, String reason, RequestContext context) throws ResourceDoesNotSupportOperationException { throw new ResourceDoesNotSupportOperationException(); }
Source:
public void testTransformAdhocQueryToCheckPolicy_InValidDirection() { AdhocQueryRequestEventType eventA = new AdhocQueryRequestEventType(); eventA.setDirection("in_outbound"); CheckPolicyRequestType result = instance.transformAdhocQueryToCheckPolicy(eventA); assertNull("We should expect null checkPolicyEngine ", result); eventA.setDirection(null); assertNull(instance.transformAdhocQueryToCheckPolicy(eventA)); assertNull(instance.transformAdhocQueryToCheckPolicy(null)); }

Target:
public void testTransformAdhocQueryToCheckPolicy_InValidDirection() { AdhocQueryRequestEventType eventA = new AdhocQueryRequestEventType(); eventA.setDirection("in_outbound"); CheckPolicyRequestType result = adhocQueryTransformHelp.transformAdhocQueryToCheckPolicy(eventA); assertNull("We should expect null checkPolicyEngine ", result); eventA.setDirection(null); assertNull(adhocQueryTransformHelp.transformAdhocQueryToCheckPolicy(eventA)); }
Source:
public IBinder onBind(Intent intent) { Log.d(TAG, "Received onBind event"); if(intent.getAction() != null && intent.getAction().equals("android.media.browse.MediaBrowserService")) { return super.onBind(intent); } else { return mBinder; } }

Target:
public IBinder onBind(Intent intent) { Log.d(TAG, "Received onBind event"); if(intent.getAction() != null && TextUtils.equals(intent.getAction(), MediaBrowserServiceCompat.SERVICE_INTERFACE)) { return super.onBind(intent); } else { return mBinder; } }
Source:
protected void processNoPrimaryReference(APMSpanBuilder builder, TraceReporter reporter) { initTopLevelState(this, reporter); List<String> traceIds = builder.references.stream().map(ref -> { if (ref.getReferredTo() instanceof APMSpan) { return ((APMSpan)ref.getReferredTo()).getTraceContext().getTraceId(); } else if (ref.getReferredTo() instanceof APMSpanBuilder) { return ((APMSpanBuilder)ref.getReferredTo()).getState().get(Constants.HAWKULAR_APM_TRACEID).toString(); } return null; }).distinct().collect(Collectors.toList()); if (traceIds.size() > 0) { if (traceIds.size() > 1) { log.warning("References should all belong to the same 'trace' instance"); } if (builder.references.get(0).getReferredTo() instanceof APMSpan) { traceContext.initTraceState(((APMSpan)builder.references.get(0).getReferredTo()).getTraceContext()); } else if (builder.references.get(0).getReferredTo() instanceof APMSpanBuilder) { traceContext.initTraceState(((APMSpanBuilder)builder.references.get(0).getReferredTo()).getState()); } } processRemainingReferences(builder, null); makeInternalLink(builder); }

Target:
protected void processNoPrimaryReference(APMSpanBuilder builder, TraceReporter reporter) { initTopLevelState(this, reporter); Set<String> traceIds = builder.references.stream().map(ref -> { if (ref.getReferredTo() instanceof APMSpan) { return ((APMSpan)ref.getReferredTo()).getTraceContext().getTraceId(); } else if (ref.getReferredTo() instanceof APMSpanBuilder) { return ((APMSpanBuilder)ref.getReferredTo()).getState().get(Constants.HAWKULAR_APM_TRACEID).toString(); } log.warning("Reference refers to an unsupported SpanContext implementation: " + ref.getReferredTo()); return null; }).collect(Collectors.toSet()); if (traceIds.size() > 0) { if (traceIds.size() > 1) { log.warning("References should all belong to the same 'trace' instance"); } if (builder.references.get(0).getReferredTo() instanceof APMSpan) { traceContext.initTraceState(((APMSpan)builder.references.get(0).getReferredTo()).getTraceContext()); } else if (builder.references.get(0).getReferredTo() instanceof APMSpanBuilder) { traceContext.initTraceState(((APMSpanBuilder)builder.references.get(0).getReferredTo()).getState()); } } processRemainingReferences(builder, null); makeInternalLink(builder); }
Source:
public final boolean mightBeRacilyClean(final int smudge_s, final int smudge_ns) { final int base = infoOffset + P_MTIME; final int mtime = NB.decodeInt32(info, base); if (smudge_s < mtime) return true; if (smudge_s == mtime) return smudge_ns <= NB.decodeInt32(info, base + 4); return false; }

Target:
public final boolean mightBeRacilyClean(final int smudge_s, final int smudge_ns) { final int base = infoOffset + P_MTIME; final int mtime = NB.decodeInt32(info, base); if (smudge_s == mtime) return smudge_ns <= NB.decodeInt32(info, base + 4); return false; }
Source:
public TaskLockHelper getTaskLockHelper() { return Preconditions.checkNotNull(taskLockHelper, "segmentLockHelper is not initialized yet"); }

Target:
public TaskLockHelper getTaskLockHelper() { return Preconditions.checkNotNull(taskLockHelper, "taskLockHelper is not initialized yet"); }
Source:
public void onUrlClick(@NonNull String href, @Nullable String titleString) { if (href.startsWith(" href = "https:" + href; } L.d("Link clicked was " + href); if (href.startsWith("/wiki/")) { PageTitle title = TextUtils.isEmpty(titleString) ? getWikiSite().titleForInternalLink(href) : PageTitle.withSeparateFragment(titleString, UriUtil.getFragment(href), getWikiSite()); onInternalLinkClicked(title); } else if (href.startsWith("#")) { onPageLinkClicked(href.substring(1)); } else if (fragment != null && fragment.getTitle() != null) { String parsoidFragmentLinkPrefix = "./" + fragment.getTitle().getText() + "#"; if (href.startsWith(parsoidFragmentLinkPrefix)) { onPageLinkClicked(href.substring(parsoidFragmentLinkPrefix.length())); } } else { Uri uri = Uri.parse(href); String authority = uri.getAuthority(); if (authority != null && WikiSite.supportedAuthority(authority) && uri.getPath().startsWith("/wiki/")) { WikiSite wiki = new WikiSite(authority, getWikiSite().languageCode()); PageTitle title = wiki.titleForUri(uri); onInternalLinkClicked(title); } else { if (context == null) { return; } if (href.startsWith("/w/")) { href = String.format("%1$s://%2$s", getWikiSite().scheme(), getWikiSite().authority()) + href; } handleExternalLink(context, Uri.parse(href)); } } }

Target:
public void onUrlClick(@NonNull String href, @Nullable String titleString) { if (href.startsWith(" href = "https:" + href; } L.d("Link clicked was " + href); if (href.startsWith("/wiki/")) { PageTitle title = TextUtils.isEmpty(titleString) ? getWikiSite().titleForInternalLink(href) : PageTitle.withSeparateFragment(titleString, UriUtil.getFragment(href), getWikiSite()); onInternalLinkClicked(title); } else if (href.startsWith("#")) { onPageLinkClicked(href.substring(1)); } else if (href.startsWith("./") && fragment != null && fragment.getTitle() != null) { String parsoidFragmentLinkPrefix = "./" + fragment.getTitle().getText() + "#"; if (href.startsWith(parsoidFragmentLinkPrefix)) { onPageLinkClicked(href.substring(parsoidFragmentLinkPrefix.length())); } } else { Uri uri = Uri.parse(href); String authority = uri.getAuthority(); if (authority != null && WikiSite.supportedAuthority(authority) && uri.getPath().startsWith("/wiki/")) { WikiSite wiki = new WikiSite(authority, getWikiSite().languageCode()); PageTitle title = wiki.titleForUri(uri); onInternalLinkClicked(title); } else { if (context == null) { return; } if (href.startsWith("/w/")) { href = String.format("%1$s://%2$s", getWikiSite().scheme(), getWikiSite().authority()) + href; } handleExternalLink(context, Uri.parse(href)); } } }
Source:
private void removeDirectMember(PerunSession sess, Group group, Member member) throws InternalErrorException, NotGroupMemberException, GroupNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException { lockGroupMembership(group, Collections.singletonList(member)); member.setSourceGroupId(group.getId()); getGroupsManagerImpl().removeMember(sess, group, member); if (this.getGroupsManagerImpl().isGroupMember(sess, group, member)) { getPerunBl().getAuditer().log(sess, new DirectMemberRemovedFromGroup(member, group)); return; } else { notifyMemberRemovalFromGroup(sess, group, member); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, member, group); getPerunBl().getAuditer().log(sess, new MemberRemovedFromGroupTotally(member, group)); } List<Integer> relations = groupsManagerImpl.getResultGroupsIds(sess, group.getId()); for (Integer groupId : relations) { removeRelationMembers(sess, groupsManagerImpl.getGroupById(sess, groupId), Collections.singletonList(member), group.getId()); } if (!VosManager.MEMBERS_GROUP.equals(group.getName())) { recalculateMemberGroupStatusRecursively(sess, member, group); } addMemberToGroupsFromTriggerAttribute(sess, group, member); }

Target:
private void removeDirectMember(PerunSession sess, Group group, Member member) throws InternalErrorException, NotGroupMemberException, GroupNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException { lockGroupMembership(group, Collections.singletonList(member)); member.setSourceGroupId(group.getId()); getGroupsManagerImpl().removeMember(sess, group, member); if (this.getGroupsManagerImpl().isGroupMember(sess, group, member)) { getPerunBl().getAuditer().log(sess, new DirectMemberRemovedFromGroup(member, group)); return; } else { notifyMemberRemovalFromGroup(sess, group, member); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, member, group); getPerunBl().getAuditer().log(sess, new MemberRemovedFromGroupTotally(member, group)); } List<Integer> relations = groupsManagerImpl.getResultGroupsIds(sess, group.getId()); for (Integer groupId : relations) { removeRelationMembers(sess, groupsManagerImpl.getGroupById(sess, groupId), Collections.singletonList(member), group.getId()); } if (!VosManager.MEMBERS_GROUP.equals(group.getName())) { recalculateMemberGroupStatusRecursively(sess, member, group); } if (!getGroupsManagerImpl().isGroupMember(sess, group, member)) { addMemberToGroupsFromTriggerAttribute(sess, group, member); } }
Source:
public void triggerOnScrollSlots() { JavascriptExecutor js = driver; js.executeScript("window.scrollTo(0, document.body.scrollHeight);"); }

Target:
public void triggerOnScrollSlots() { jsActions.scrollToBottom(driver); }
Source:
protected void setColumnOrder(int size) { int[] order = new int[size]; Arrays.setAll(order, i -> i); Table table = (Table) getControl(); table.setColumnOrder(order); }

Target:
protected void setColumnOrder(int size) { int[] order = new int[size]; Arrays.setAll(order, IntUnaryOperator.identity()); Table table = (Table) getControl(); table.setColumnOrder(order); }
Source:
protected long getNextBackoff() { if (currentBackoff == null) { currentBackoff = createBackoffBuilder().build(); } try { return currentBackoff.nextBackOffMillis(); } catch (IOException e) { return BackOff.STOP; } }

Target:
protected long getNextBackoff() { if (currentBackoff == null) { currentBackoff = createBackoff(); } try { return currentBackoff.nextBackOffMillis(); } catch (IOException e) { return BackOff.STOP; } }
Source:
public Builder tag(@Nullable String tag) { this.tag = tag; return this; }

Target:
@NonNull public Builder tag(@Nullable String tag) { this.tag = tag; return this; }
Source:
public String getPrefix(String namespaceURI) { for (Map.Entry<String, String> stringStringEntry : prefixToUri.entrySet()) { if (stringStringEntry.getValue().equals(namespaceURI)) return stringStringEntry.getKey(); } return null; }

Target:
public String getPrefix(String namespaceURI) { for (Map.Entry<String, String> prexiToUriEntry : prefixToUri.entrySet()) { if (prexiToUriEntry.getValue().equals(namespaceURI)) { return prexiToUriEntry.getKey(); } } return null; }
Source:
private void cacheWriterDeleteAllCall(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries, Set<K> successes, Map<K, Exception> failures) { if (cacheWriter != null) { KeysIterable entriesKeys = new KeysIterable(entries); Set<K> toDelete = new HashSet<K>(); for (Map.Entry<? extends K, ? extends V> entry: entries) { toDelete.add(entry.getKey()); } try { cacheWriter.deleteAll(entriesKeys); successes.addAll(toDelete); } catch (Exception e) { for (Map.Entry<? extends K, ? extends V> entry: entries) { failures.put(entry.getKey(), e); } } } }

Target:
private void cacheWriterDeleteAllCall(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries, Set<K> successes, Map<K, Exception> failures) { if (cacheWriter != null) { Set<K> toDelete = new HashSet<K>(); for (Map.Entry<? extends K, ? extends V> entry: entries) { toDelete.add(entry.getKey()); } try { cacheWriter.deleteAll(toDelete); successes.addAll(toDelete); } catch (Exception e) { for (Map.Entry<? extends K, ? extends V> entry: entries) { failures.put(entry.getKey(), e); } } } }
Source:
private void checkObjectCollision(PackedObjectInfo obj) throws IOException { ObjectTypeAndSize info = openDatabase(obj, new ObjectTypeAndSize()); final byte[] readBuffer = buffer(); final byte[] curBuffer = new byte[readBuffer.length]; long sz = info.size; try (ObjectStream cur = readCurs.open(obj, info.type).openStream()) { if (cur.getSize() != sz) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } try (InputStream pck = inflate(Source.DATABASE, sz)) { while (0 < sz) { int n = (int) Math.min(readBuffer.length, sz); IO.readFully(cur, curBuffer, 0, n); IO.readFully(pck, readBuffer, 0, n); for (int i = 0; i < n; i++) { if (curBuffer[i] != readBuffer[i]) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } } sz -= n; } stats.addNumBytesDuplicated(sz); stats.incrementObjectsDuplicated(); } } catch (MissingObjectException notLocal) { } }

Target:
private void checkObjectCollision(PackedObjectInfo obj) throws IOException { ObjectTypeAndSize info = openDatabase(obj, new ObjectTypeAndSize()); final byte[] readBuffer = buffer(); final byte[] curBuffer = new byte[readBuffer.length]; long sz = info.size; try (ObjectStream cur = readCurs.open(obj, info.type).openStream()) { if (cur.getSize() != sz) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } try (InputStream pck = inflate(Source.DATABASE, sz)) { while (0 < sz) { int n = (int) Math.min(readBuffer.length, sz); IO.readFully(cur, curBuffer, 0, n); IO.readFully(pck, readBuffer, 0, n); for (int i = 0; i < n; i++) { if (curBuffer[i] != readBuffer[i]) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } } sz -= n; } stats.increaseNumBytesDuplicated(sz); stats.incrementObjectsDuplicated(); } } catch (MissingObjectException notLocal) { } }
Source:
private boolean isBoardNameEmpty(String newName) { if (newName.equals("")) { return true; } return false; }

Target:
private boolean isBoardNameEmpty(String newName) { return newName.isEmpty(); }
Source:
RepeatableIterator(TransactionMap<K, ?> transactionMap, K from, K to, boolean forEntries) { super(forEntries); keyType = transactionMap.map.getKeyType(); Transaction transaction = transactionMap.getTransaction(); this.transactionId = transaction.transactionId; BitSet committingTransactions; RootReference mapRootReference; do { committingTransactions = transactionMap.getCommittingTransactions(); mapRootReference = transactionMap.getRootReference(); } while (committingTransactions != transactionMap.getCommittingTransactions()); this.snapshotCursor = new Cursor<>(mapRootReference.root, from, to); this.snapshotCommittingTransactions = committingTransactions; this.uncommittedCursor = new Cursor<>(transactionMap.map.flushAndGetRoot().root, from, to); fetchNext(); }

Target:
RepeatableIterator(TransactionMap<K, ?> transactionMap, K from, K to, boolean forEntries) { super(forEntries); keyType = transactionMap.map.getKeyType(); Transaction transaction = transactionMap.getTransaction(); this.transactionId = transaction.transactionId; Snapshot snapshot = transactionMap.getRootSnapshot(); this.snapshotCursor = new Cursor<>(snapshot.root.root, from, to); this.snapshotCommittingTransactions = snapshot.committingTransactions; snapshot = transactionMap.getCurrentRootSnapshot(); this.uncommittedCursor = new Cursor<>(snapshot.root.root, from, to); fetchNext(); }
Source:
protected boolean batchValidate(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) { IStatus status = Status.OK_STATUS; if (diagnostics != null) { if (!hasProcessed(eObject, context)) { if (canCompareUpperGeLower(eObject)) { status = batchValidator.validate( eObject, new NullProgressMonitor()); processed(eObject, context, status); appendDiagnostics(status, diagnostics); } } } return status.isOK(); }

Target:
protected boolean batchValidate(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) { IStatus status = Status.OK_STATUS; if (diagnostics != null) { if (!hasProcessed(eObject, context)) { status = batchValidator.validate( eObject, new NullProgressMonitor()); processed(eObject, context, status); appendDiagnostics(status, diagnostics); } } return status.isOK(); }
Source:
protected abstract InputStream getInputStreamInternal(RepositoryPath repositoryPath) throws IOException; protected RepositoryInputStream decorate(RepositoryPath repositoryPath, InputStream is) throws IOException { if (is == null || is instanceof RepositoryInputStream) { return (RepositoryInputStream) is; } try { is = new MultipleDigestInputStream(is); } catch (NoSuchAlgorithmException e) { throw new IOException(); } return new RepositoryInputStream(repositoryPath, is); }

Target:
protected abstract InputStream getInputStreamInternal(RepositoryPath repositoryPath) throws IOException; protected RepositoryInputStream decorate(RepositoryPath repositoryPath, InputStream is) throws IOException { if (is == null || is instanceof RepositoryInputStream) { return (RepositoryInputStream) is; } return new RepositoryInputStream(repositoryPath, is); }
Source:
List<?> handle(SendMessage command) { return Collections.emptyList(); }

Target:
List<? extends EventMessage> handle(SendMessage command) { return Collections.emptyList(); }
Source:
public static DefaultDruidTeslaAether getAetherClient(ExtensionsConfig config) { List<String> remoteUriList = config.getRemoteRepositories(); List<Repository> remoteRepositories = new ArrayList<Repository>(); for (String uri : remoteUriList) { try { URI u = new URI(uri); Repository r = new Repository(uri); if(u.getUserInfo() != null) { String[] auth = u.getUserInfo().split(":", 2); if(auth.length == 2) { r.setUsername(auth[0]); r.setPassword(auth[1]); } } remoteRepositories.add(r); } catch(URISyntaxException e) { throw Throwables.propagate(e); } } if (log.isTraceEnabled() || log.isDebugEnabled()) { return new DefaultDruidTeslaAether(config.getLocalRepository(), remoteRepositories); } PrintStream oldOut = System.out; try { System.setOut(new PrintStream( new OutputStream() { @Override public void write(int b) throws IOException { } @Override public void write(byte[] b) throws IOException { } @Override public void write(byte[] b, int off, int len) throws IOException { } } )); return new DefaultDruidTeslaAether(config.getLocalRepository(), remoteRepositories); } finally { System.setOut(oldOut); } }

Target:
public static DefaultTeslaAether getAetherClient(ExtensionsConfig config) { List<String> remoteUriList = config.getRemoteRepositories(); List<Repository> remoteRepositories = Lists.newArrayList(); for (String uri : remoteUriList) { try { URI u = new URI(uri); Repository r = new Repository(uri); if(u.getUserInfo() != null) { String[] auth = u.getUserInfo().split(":", 2); if(auth.length == 2) { r.setUsername(auth[0]); r.setPassword(auth[1]); } else { log.warn( "Invalid credentials in repository URI, expecting [<user>:<password>], got [%s] for [%s]", u.getUserInfo(), uri ); } } remoteRepositories.add(r); } catch(URISyntaxException e) { throw Throwables.propagate(e); } } if (log.isTraceEnabled() || log.isDebugEnabled()) { return new DefaultTeslaAether( config.getLocalRepository(), remoteRepositories.toArray(new Repository[remoteRepositories.size()]) ); } PrintStream oldOut = System.out; try { System.setOut(new PrintStream( new OutputStream() { @Override public void write(int b) throws IOException { } @Override public void write(byte[] b) throws IOException { } @Override public void write(byte[] b, int off, int len) throws IOException { } } )); return new DefaultTeslaAether( config.getLocalRepository(), remoteRepositories.toArray(new Repository[remoteRepositories.size()]) ); } finally { System.setOut(oldOut); } }
Source:
public void simplePlainSeleniumTest() { RemoteWebDriver driver = chrome.getWebDriver(); driver.get("http://host.testcontainers.internal:" + 8080 + "/foo"); List<WebElement> hElement = driver.findElementsByTagName("h"); assertTrue("The h element is found", hElement != null && hElement.size() > 0); }

Target:
public void simplePlainSeleniumTest() { RemoteWebDriver driver = chrome.getWebDriver(); driver.get("http://host.testcontainers.internal:" + port + "/foo.html"); List<WebElement> hElement = driver.findElementsByTagName("h"); assertTrue("The h element is found", hElement != null && hElement.size() > 0); }
Source:
protected List<Map<String, Object>> read(final List<String> names, final String key, final String value) { logger.debug("Reading key / value: / {}", key, value); final List<Map<String, Object>> listAttributes = new ArrayList<>(); if (key.equals(getIdAttribute())) { final Map<String,Object> profile = profiles.get(value); if (profile != null) { listAttributes.add(populateAttributes(profile, names)); } } else { for (Map<String,Object> profile : profiles.values()) { if (profile.get(key).equals(value)) { listAttributes.add(populateAttributes(profile, names)); } } } logger.debug("Found: {}", listAttributes); return listAttributes; }

Target:
protected List<Map<String, Object>> read(final List<String> names, final String key, final String value) { logger.debug("Reading key / value: / {}", key, value); final List<Map<String, Object>> listAttributes; if (key.equals(getIdAttribute())) { listAttributes = new ArrayList<>(); final Map<String,Object> profile = profiles.get(value); if (profile != null) { listAttributes.add(populateAttributes(profile, names)); } } else { listAttributes = profiles.entrySet().stream() .filter(p -> p.getValue().get(key).equals(value)) .map(p -> populateAttributes(p.getValue(), names)) .collect(Collectors.toList()); } logger.debug("Found: {}", listAttributes); return listAttributes; }
Source:
private void addIndexOptions(JsonObject field, EntityIndexBinding binding, String fieldName, String fieldType, Field.Index index, AnalyzerReference analyzerReference) { String elasticsearchIndex; switch ( index ) { case ANALYZED: case ANALYZED_NO_NORMS: elasticsearchIndex = canTypeBeAnalyzed( fieldType ) ? ANALYZED : NOT_ANALYZED; break; case NOT_ANALYZED: case NOT_ANALYZED_NO_NORMS: elasticsearchIndex = NOT_ANALYZED; break; case NO: elasticsearchIndex = "no"; default: throw new AssertionFailure( "Unexpected index type: " + index ); } field.addProperty( "index", elasticsearchIndex ); if ( "no".equals( elasticsearchIndex ) && FieldHelper.isSortableField( binding, fieldName ) ) { field.addProperty( "doc_values", true ); } if ( ANALYZED.equals( elasticsearchIndex ) && analyzerReference != null ) { String analyzerName = analyzerName( binding.getDocumentBuilder().getBeanClass(), fieldName, analyzerReference ); if ( analyzerName != null ) { field.addProperty( "analyzer", analyzerName ); } } }

Target:
private void addIndexOptions(JsonObject field, EntityIndexBinding binding, String fieldName, String fieldType, Field.Index index, AnalyzerReference analyzerReference) { String elasticsearchIndex; switch ( index ) { case ANALYZED: case ANALYZED_NO_NORMS: elasticsearchIndex = canTypeBeAnalyzed( fieldType ) ? ANALYZED : NOT_ANALYZED; break; case NOT_ANALYZED: case NOT_ANALYZED_NO_NORMS: elasticsearchIndex = NOT_ANALYZED; break; case NO: elasticsearchIndex = NOT_INDEXED; break; default: throw new AssertionFailure( "Unexpected index type: " + index ); } field.addProperty( "index", elasticsearchIndex ); if ( NOT_INDEXED.equals( elasticsearchIndex ) && FieldHelper.isSortableField( binding, fieldName ) ) { field.addProperty( "doc_values", true ); } if ( ANALYZED.equals( elasticsearchIndex ) && analyzerReference != null ) { String analyzerName = analyzerName( binding.getDocumentBuilder().getBeanClass(), fieldName, analyzerReference ); if ( analyzerName != null ) { field.addProperty( "analyzer", analyzerName ); } } }