auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean deleteAllFromRecycleBin(XWikiContext context) throws XWikiException { RefactoringScriptService refactoring = (RefactoringScriptService) Utils.getComponent(ScriptService.class, "refactoring"); PermanentlyDeleteRequest deleteRequest = refactoring.createPermanentlyDeleteRequest(Collections.emptyList()); deleteRequest.setInteractive(isAsync(context.getRequest())); try { JobExecutor jobExecutor = Utils.getComponent(JobExecutor.class); Job job = jobExecutor.execute(RefactoringJobs.PERMANENTLY_DELETE, deleteRequest); if (isAsync(context.getRequest())) { List<String> jobId = job.getRequest().getId(); sendRedirect(context.getResponse(), Utils.getRedirect("view", "xpage=delete&jobId=" + serializeJobId(jobId), context)); return true; } try { job.join(); } catch (InterruptedException e) { throw new XWikiException("Failed to delete all from the recycle bin", e); } return false; } catch (JobException e) { throw new XWikiException("Failed to schedule the delete all from recycle bin job", e); } }

Target:
private boolean deleteAllFromRecycleBin(XWikiContext context) throws XWikiException { RefactoringScriptService refactoring = (RefactoringScriptService) Utils.getComponent(ScriptService.class, "refactoring"); PermanentlyDeleteRequest deleteRequest = refactoring.createPermanentlyDeleteRequest(Collections.emptyList()); deleteRequest.setInteractive(isAsync(context.getRequest())); deleteRequest.setCheckAuthorRights(false); try { JobExecutor jobExecutor = Utils.getComponent(JobExecutor.class); Job job = jobExecutor.execute(RefactoringJobs.PERMANENTLY_DELETE, deleteRequest); if (isAsync(context.getRequest())) { List<String> jobId = job.getRequest().getId(); sendRedirect(context.getResponse(), Utils.getRedirect("view", "xpage=delete&jobId=" + serializeJobId(jobId), context)); return true; } try { job.join(); } catch (InterruptedException e) { throw new XWikiException("Failed to delete all from the recycle bin", e); } return false; } catch (JobException e) { throw new XWikiException("Failed to schedule the delete all from recycle bin job", e); } }
Source:
public MicroProfileClientFactoryBean(MicroProfileClientConfigurableImpl<RestClientBuilder> configuration, String baseUri, Class<?> aClass, ExecutorService executorService, TLSConfiguration secConfig) { super(new MicroProfileServiceFactoryBean()); this.configuration = configuration.getConfiguration(); this.comparator = MicroProfileClientProviderFactory.createComparator(this); this.executorService = (executorService == null) ? defaultExecutorService() : executorService; this.secConfig = secConfig; super.setAddress(baseUri); super.setServiceClass(aClass); super.setProviderComparator(comparator); super.setProperties(this.configuration.getProperties()); registeredProviders = new ArrayList<>(); registeredProviders.addAll(processProviders()); if (!configuration.isDefaultExceptionMapperDisabled()) { registeredProviders.add(new ProviderInfo<>(new DefaultResponseExceptionMapper(), getBus(), false)); } registeredProviders.add(new ProviderInfo<>(new JsrJsonpProvider(), getBus(), false)); super.setProviders(registeredProviders); }

Target:
public MicroProfileClientFactoryBean(MicroProfileClientConfigurableImpl<RestClientBuilder> configuration, String baseUri, Class<?> aClass, ExecutorService executorService, TLSConfiguration secConfig) { super(new MicroProfileServiceFactoryBean()); this.configuration = configuration.getConfiguration(); this.comparator = MicroProfileClientProviderFactory.createComparator(this); this.executorService = (executorService == null) ? Utils.defaultExecutorService() : executorService; this.secConfig = secConfig; super.setAddress(baseUri); super.setServiceClass(aClass); super.setProviderComparator(comparator); super.setProperties(this.configuration.getProperties()); registeredProviders = new ArrayList<>(); registeredProviders.addAll(processProviders()); if (!configuration.isDefaultExceptionMapperDisabled()) { registeredProviders.add(new ProviderInfo<>(new DefaultResponseExceptionMapper(), getBus(), false)); } registeredProviders.add(new ProviderInfo<>(new JsrJsonpProvider(), getBus(), false)); super.setProviders(registeredProviders); }
Source:
public static ISaveablePart getSaveable(Object o) { if (o instanceof ISaveablePart) { return (ISaveablePart) o; } return Adapters.getAdapter(o, ISaveablePart.class, true); }

Target:
public static ISaveablePart getSaveable(Object o) { return Adapters.getAdapter(o, ISaveablePart.class, true); }
Source:
public Matrix muli(final Matrix matrix) { if (matrix.isDense()) { ((NumericOps) breezeMatrix).$colon$times$eq(((DenseMatrix) matrix).breezeMatrix, MatrixOps.EMULI_DD); return this; } else { throw new UnsupportedOperationException(); } }

Target:
public Matrix muli(final Matrix matrix) { if (matrix.isDense()) { ((NumericOps) breezeMatrix).$colon$times$eq(((DenseMatrix) matrix).breezeMatrix, MatrixOps.EMULI_DD); } else { ((NumericOps) breezeMatrix).$colon$times$eq(((CSCMatrix) matrix).getBreezeMatrix(), MatrixOps.EMULI_MM); } return this; }
Source:
public InternalThreadExecutor() { super(0, Config.<Integer> GetValue(ConfigValues.DefaultMaxThreadPoolSize), 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); }

Target:
public InternalThreadExecutor() { super(Config.<Integer> GetValue(ConfigValues.DefaultMinThreadPoolSize), Config.<Integer> GetValue(ConfigValues.DefaultMaxThreadPoolSize), 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); }
Source:
private boolean perform(Run<?, ?> run, TaskListener listener, boolean disableInProgress) { StashBuildState state; PrintStream logger = listener.getLogger(); Result buildResult = run.getResult(); if (buildResult == null && disableInProgress) { return true; } else if (buildResult == null) { state = StashBuildState.INPROGRESS; } else if (buildResult == Result.SUCCESS || (buildResult == Result.UNSTABLE && considerUnstableAsSuccess)) { state = StashBuildState.SUCCESSFUL; } else if (buildResult == Result.ABORTED && disableAbortAsFailures) { return true; } else if (buildResult.equals(Result.NOT_BUILT)) { logger.println("NOT BUILT"); return true; } else { state = StashBuildState.FAILED; } return processJenkinsEvent(run, listener, state); }

Target:
private boolean perform(Run<?, ?> run, TaskListener listener, boolean disableInProgress) { StashBuildState state; PrintStream logger = listener.getLogger(); Result buildResult = run.getResult(); if (buildResult == null && disableInProgress) { return true; } else if (buildResult == null) { state = StashBuildState.INPROGRESS; } else if (buildResult == Result.SUCCESS) { state = StashBuildState.SUCCESSFUL; } else if (buildResult == Result.UNSTABLE && considerUnstableAsSuccess) { logger.println("UNSTABLE reported to stash as SUCCESSFUL"); state = StashBuildState.SUCCESSFUL; } else if (buildResult == Result.ABORTED && disableInProgress) { logger.println("ABORTED"); return true; } else if (buildResult.equals(Result.NOT_BUILT)) { logger.println("NOT BUILT"); return true; } else { state = StashBuildState.FAILED; } return processJenkinsEvent(run, listener, state); }
Source:
public String buildCollectorFile(ConcurStandardAccountingExtractFile saeFileContents) { ConcurStandardAccountingExtractCollectorBatchBuilder builder = createBatchBuilder(); int sequenceNumber = calculateBatchSequenceNumber(); CollectorBatch collectorBatch = builder.buildCollectorBatchFromStandardAccountingExtract(sequenceNumber, saeFileContents); if (collectorBatch == null) { LOG.error("There was a problem preparing the data for the Collector file; will not create a file. See earlier logs for details."); return null; } String collectorFilePath = buildCollectorFilePath(saeFileContents.getOriginalFileName()); boolean fileCreatedSuccessfully = collectorFlatFileSerializerService.serializeToFlatFile(collectorFilePath, collectorBatch); if (!fileCreatedSuccessfully) { LOG.error("An error occurred while writing the data to the Collector file; see earlier logs for details."); collectorFilePath = null; } return collectorFilePath; }

Target:
public String buildCollectorFile(ConcurStandardAccountingExtractFile saeFileContents) { CollectorBatch collectorBatch = buildCollectorBatch(saeFileContents); if (collectorBatch == null) { LOG.error("There was a problem preparing the data for the Collector file; will not create a file. See earlier logs for details."); return StringUtils.EMPTY; } return writeToCollectorFile(saeFileContents.getOriginalFileName(), collectorBatch); }
Source:
private TreeWalk createFileWalker(Repository db, List<FilterPath> paths) { final TreeWalk fileWalker = new TreeWalk(db); fileWalker.setRecursive(true); if (paths.size() > 0) { pathFilters = paths; List<String> stringPaths = new ArrayList<String>(paths.size()); for (FilterPath p : paths) { stringPaths.add(p.getPath()); } currentWalk.setTreeFilter(AndTreeFilter.create(PathFilterGroup .createFromStrings(stringPaths), TreeFilter.ANY_DIFF)); fileWalker.setFilter(currentWalk.getTreeFilter().clone()); } else { pathFilters = null; currentWalk.setTreeFilter(TreeFilter.ALL); fileWalker.setFilter(TreeFilter.ANY_DIFF); } return fileWalker; }

Target:
private TreeWalk createFileWalker(Repository db, List<FilterPath> paths) { final TreeWalk fileWalker = new TreeWalk(db); fileWalker.setRecursive(true); if (paths.size() > 0) { pathFilters = paths; List<String> stringPaths = new ArrayList<String>(paths.size()); for (FilterPath p : paths) stringPaths.add(p.getPath()); currentWalk.setTreeFilter(AndTreeFilter.create(PathFilterGroup .createFromStrings(stringPaths), TreeFilter.ANY_DIFF)); fileWalker.setFilter(currentWalk.getTreeFilter().clone()); } else { pathFilters = null; currentWalk.setTreeFilter(TreeFilter.ALL); fileWalker.setFilter(TreeFilter.ANY_DIFF); } return fileWalker; }
Source:
public void testGetBaseParameters() throws UnsupportedEncodingException { exportEventProcessor.context = context; exportEventProcessor.request = request; exportEventProcessor.configurationService = configurationService; exportEventProcessor.trackerUrlVersion = "Z39.88-2004"; when(exportEventProcessor.getCurrentDateString()).thenReturn("2020-01-24T13:24:33Z"); when(request.getRemoteAddr()).thenReturn("test-client-ip"); when(request.getHeader("USER-AGENT")).thenReturn("test-user-agent"); when(request.getHeader("referer")).thenReturn("test-referer"); when(configurationService.getBooleanProperty("useProxies", false)).thenReturn(false); when(configurationService.getProperty("dspace.hostname")).thenReturn("localhost"); when(item.getHandle()).thenReturn("123456/1"); when(exportEventProcessor.getBaseParameters(item)).thenCallRealMethod(); String result = exportEventProcessor.getBaseParameters(item); String expected = "url_ver=Z39.88-2004&req_id=test-client-ip&req_dat=test-user-agent&rft.artnum=" + "oai%3Alocalhost%3A123456%2F1&rfr_dat=test-referer&rfr_id=localhost&url_tim=2020-01-24T13%3A24%3A33Z"; assertThat(result, is(expected)); }

Target:
public void testGetBaseParameters() throws UnsupportedEncodingException { exportEventProcessor.context = context; exportEventProcessor.request = request; exportEventProcessor.configurationService = configurationService; exportEventProcessor.trackerUrlVersion = "Z39.88-2004"; when(exportEventProcessor.getCurrentDateString()).thenReturn("2020-01-24T13:24:33Z"); when(request.getRemoteAddr()).thenReturn("test-client-ip"); when(request.getHeader("USER-AGENT")).thenReturn("test-user-agent"); when(request.getHeader("referer")).thenReturn("test-referer"); when(item.getHandle()).thenReturn("123456/1"); when(exportEventProcessor.getBaseParameters(item)).thenCallRealMethod(); String result = exportEventProcessor.getBaseParameters(item); String expected = "url_ver=Z39.88-2004&req_id=test-client-ip&req_dat=test-user-agent&rft.artnum=" + "oai%3Alocalhost%3A123456%2F1&rfr_dat=test-referer&rfr_id=localhost&url_tim=2020-01-24T13%3A24%3A33Z"; assertThat(result, is(expected)); }
Source:
static List<Expression> fromInternal(Class<?> targetType, List<Expression> expressions) { final List<Expression> list = new ArrayList<>(); for (int i = 0; i < expressions.size(); i++) { list.add(fromInternal(expressions.get(i), targetType)); } return list; }

Target:
private static List<Expression> fromInternal(Class<?> targetType, List<Expression> expressions) { final List<Expression> list = new ArrayList<>(); for (int i = 0; i < expressions.size(); i++) { list.add(fromInternal(expressions.get(i), targetType)); } return list; }
Source:
protected Integer getUnspecifiedLocationId() { final List<Location> locations = locationDataManager.getLocationsByName("Unspecified Location", Operation.EQUAL); if (!locations.isEmpty()) { return locations.get(0).getLocid(); } return 0; }

Target:
protected Integer getUnspecifiedLocationId() { final List<Location> locations = locationDataManager.getLocationsByName(Location.UNSPECIFIED_LOCATION, Operation.EQUAL); if (!locations.isEmpty()) { return locations.get(0).getLocid(); } return 0; }
Source:
protected void tearDown() throws Exception { Log.i(TAG, "Tearing down"); if (mExecutorService != null) { mExecutorService.shutdownNow(); } closeQuietly(getServerListeningSocket()); closeQuietly(getServerSocket()); closeQuietly(getClientSocket()); closeQuietly(getMitmListeningSocket()); closeQuietly(getMitmServerSocket()); closeQuietly(getMitmClientSocket()); super.tearDown(); Log.i(TAG, "Tear down completed"); }

Target:
protected void tearDown() throws Exception { Log.i(TAG, "Tearing down"); try { if (mExecutorService != null) { mExecutorService.shutdownNow(); } OpenSSLHeartbleedTest.closeQuietly(getServerListeningSocket()); OpenSSLHeartbleedTest.closeQuietly(getServerSocket()); OpenSSLHeartbleedTest.closeQuietly(getClientSocket()); OpenSSLHeartbleedTest.closeQuietly(getMitmListeningSocket()); OpenSSLHeartbleedTest.closeQuietly(getMitmServerSocket()); OpenSSLHeartbleedTest.closeQuietly(getMitmClientSocket()); } finally { super.tearDown(); Log.i(TAG, "Tear down completed"); } }
Source:
private static void changeSecurityRealmForHttpMngmntInterface(String securityRealmName) throws Exception { try (ModelControllerClient client = getNativeModelControllerClient()) { ModelNode operation = createOpNode("core-service=management/management-interface=http-interface", ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION); operation.get(NAME).set("security-realm"); operation.get(VALUE).set(securityRealmName); CoreUtils.applyUpdate(operation, client); reloadServer(); } }

Target:
private static void changeSecurityRealmForHttpMngmntInterface(String securityRealmName) throws Exception { try (ModelControllerClient client = getNativeModelControllerClient()) { String originSecurityRealm = ""; ModelNode operation = createOpNode("core-service=management/management-interface=http-interface", READ_ATTRIBUTE_OPERATION); operation.get(NAME).set("security-realm"); final ModelNode result = client.execute(operation); if (SUCCESS.equals(result.get(OUTCOME).asString())) { originSecurityRealm = result.get(RESULT).asString(); } if (!originSecurityRealm.equals(securityRealmName)) { operation = createOpNode("core-service=management/management-interface=http-interface", ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION); operation.get(NAME).set("security-realm"); operation.get(VALUE).set(securityRealmName); CoreUtils.applyUpdate(operation, client); reloadServer(); } } }
Source:
public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); ReadableConfig tableOptions = helper.getOptions(); EncodingFormat<SerializationSchema<RowData>> encodingFormat = helper.discoverEncodingFormat( SerializationFormatFactory.class, FactoryUtil.FORMAT); helper.validateExcept(PROPERTIES_PREFIX); validateTableOptions(tableOptions); if (tableOptions.getOptional(TOPIC_PATTERN).isPresent()){ throw new ValidationException("Flink Kafka sink currently doesn't support 'topic-pattern'."); } String[] topics = tableOptions.get(TOPIC).split(","); if (topics.length > 1) { throw new ValidationException("Flink Kafka sink currently doesn't support topic list."); } DataType consumedDataType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); return createKafkaTableSink( consumedDataType, topics[0], getKafkaProperties(context.getCatalogTable().getOptions()), getFlinkKafkaPartitioner(tableOptions, context.getClassLoader()), encodingFormat, getSinkSemantic(tableOptions)); }

Target:
public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); ReadableConfig tableOptions = helper.getOptions(); EncodingFormat<SerializationSchema<RowData>> encodingFormat = helper.discoverEncodingFormat( SerializationFormatFactory.class, FactoryUtil.FORMAT); validateTableSinkOptions(tableOptions); helper.validateExcept(PROPERTIES_PREFIX); DataType consumedDataType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); return createKafkaTableSink( consumedDataType, tableOptions.get(TOPIC).get(0), getKafkaProperties(context.getCatalogTable().getOptions()), getFlinkKafkaPartitioner(tableOptions, context.getClassLoader()), encodingFormat, getSinkSemantic(tableOptions)); }
Source:
public byte[] getValue() { return address; }

Target:
public String getValue() { return HexUtils.byteArrayToHexString(address).substring(1); }
Source:
public CompareResult(Collection<T> oldItems, Collection<T> newItems) { T oldItemTemp; if (oldItems != null) { removed.addAll(oldItems); } if (newItems != null) { for (T newItem : newItems) { oldItemTemp = null; if(removed.indexOf(newItem) >= 0) { oldItemTemp = removed.get(removed.indexOf(newItem)).clone(); } if (!removed.remove(newItem)) { added.add(newItem); } else if(oldItemTemp != null) { changed.add(new Pair(oldItemTemp, newItem)); } } } }

Target:
public CompareResult(Collection<T> oldItems, Collection<T> newItems) { if (oldItems != null) { removed.addAll(oldItems); } if (newItems != null) { for (T newItem : newItems) { if (!removed.remove(newItem)) { added.add(newItem); } } } }
Source:
protected void setWebAppInitParameter(String property, String value) { if (!(j.jenkins.servletContext instanceof ContextHandler.Context)) { throw new IllegalArgumentException("This only works with Jetty"); } ((ContextHandler.Context)j.jenkins.servletContext).getContextHandler().getInitParams().put(property, value); }

Target:
protected void setWebAppInitParameter(String property, String value) { Assume.assumeThat(j.jenkins.servletContext, Matchers.instanceOf(ContextHandler.Context.class)); ((ContextHandler.Context)j.jenkins.servletContext).getContextHandler().getInitParams().put(property, value); }
Source:
public CustomProgressDialog generateProgressDialog(int taskId) { if (CommCareApplication._().isConsumerApp()) { return ConsumerAppsUtil.getGenericConsumerAppsProgressDialog(taskId, false); } else if (taskId != DIALOG_UPGRADE_INSTALL) { Log.w(TAG, "taskId passed to generateProgressDialog does not match " + "any valid possibilities in CommCareSetupActivity"); return null; } else { return generateNormalUpdateDialog(taskId); } }

Target:
public CustomProgressDialog generateProgressDialog(int taskId) { if (CommCareApplication._().isConsumerApp()) { return ConsumerAppsUtil.getGenericConsumerAppsProgressDialog(taskId, false); } else if (taskId != DIALOG_UPGRADE_INSTALL) { Log.w(TAG, "taskId passed to generateProgressDialog does not match " + "any valid possibilities in CommCareSetupActivity"); return null; } else { return generateNormalUpdateInstallDialog(taskId); } }
Source:
public void testAddBatchContextEntries() { BatchPropertyContext batchPropertyContext = new BatchPropertyContext(); batchPropertyContext.setBatchContextEntries(entries); Properties bean1 = batchPropertyContext.getBatchProperties("bean1"); assertEquals(4, bean1.size()); assertEquals("bean1readerName", bean1.getProperty("readerName")); assertEquals("bean1writerName", bean1.getProperty("readerWriter")); assertEquals("jobProperty1value", bean1.getProperty("jobProperty1")); assertEquals("jobProperty2value", bean1.getProperty("jobProperty2")); Properties bean2 = batchPropertyContext.getBatchProperties("bean2"); assertEquals(4, bean2.size()); assertEquals("bean2readerName", bean2.getProperty("readerName")); assertEquals("bean2writerName", bean2.getProperty("readerWriter")); assertEquals("jobProperty1value", bean2.getProperty("jobProperty1")); assertEquals("jobProperty2value", bean2.getProperty("jobProperty2")); Properties jobProperties = batchPropertyContext.getBatchProperties("testJob.job-testJob"); assertEquals(2, jobProperties.size()); assertEquals("jobProperty1value", jobProperties.getProperty("jobProperty1")); assertEquals("jobProperty2value", jobProperties.getProperty("jobProperty2")); }

Target:
public void testAddBatchContextEntries() { BatchPropertyContext batchPropertyContext = new BatchPropertyContext(); batchPropertyContext.setBatchContextEntries(entries); Properties step1BatchProperties = batchPropertyContext.getBatchProperties("job1.step1"); assertEquals(4, step1BatchProperties.size()); assertEquals("step1PropertyValue1", step1BatchProperties.getProperty("step1PropertyName1")); assertEquals("step1PropertyValue2", step1BatchProperties.getProperty("step1PropertyName2")); assertEquals("jobProperty1value", step1BatchProperties.getProperty("jobProperty1")); assertEquals("jobProperty2value", step1BatchProperties.getProperty("jobProperty2")); Properties step2BatchProperties = batchPropertyContext.getBatchProperties("job1.step2"); assertEquals(4, step2BatchProperties.size()); assertEquals("step2PropertyValue1", step2BatchProperties.getProperty("step2PropertyName1")); assertEquals("step2PropertyValue2", step2BatchProperties.getProperty("step2PropertyName2")); assertEquals("jobProperty1value", step2BatchProperties.getProperty("jobProperty1")); assertEquals("jobProperty2value", step2BatchProperties.getProperty("jobProperty2")); Properties jobProperties = batchPropertyContext.getBatchProperties("job1.job-job1"); assertEquals(2, jobProperties.size()); assertEquals("jobProperty1value", jobProperties.getProperty("jobProperty1")); assertEquals("jobProperty2value", jobProperties.getProperty("jobProperty2")); }
Source:
public OutputToGeneralTestEventsConverter createTestEventsConverter(@NotNull String testFrameworkName, @NotNull TestConsoleProperties consoleProperties) { if (testFrameworkName == "gotest") { return new GotestEventsConverter(consoleProperties); } if (testFrameworkName == "gocheck") { return new GocheckEventsConverter(consoleProperties); } throw new RuntimeException("Unexpected test framework: " + testFrameworkName); }

Target:
public OutputToGeneralTestEventsConverter createTestEventsConverter(@NotNull String testFrameworkName, @NotNull TestConsoleProperties consoleProperties) { if (myConfiguration.getType() == GotestRunConfigurationType.getInstance()) { return new GotestEventsConverter(consoleProperties); } if (myConfiguration.getType() == GocheckRunConfigurationType.getInstance()) { return new GocheckEventsConverter(consoleProperties); } throw new RuntimeException("Unexpected test framework: " + testFrameworkName); }
Source:
public int getParentWeight(EObject a) { return NORMAL; }

Target:
public int getParentWeight(EObject a) { return SIGNIFICANT; }
Source:
public void setValue(String value) { assertNotFrozen(); this.setValue(value.toCharArray()); }

Target:
public void setValue(String value) { assertNotFrozen(); setValue(fKind, value.toCharArray()); }
Source:
private void addAll(Object array) throws JSONException { if (array.getClass().isArray()) { int length = Array.getLength(array); this.myArrayList.ensureCapacity(length); for (int i = 0; i < length; i += 1) { this.put(JSONObject.wrap(Array.get(array, i))); } } else { throw new JSONException( "JSONArray initial value should be a string or collection or array."); } }

Target:
private void addAll(Object array) throws JSONException { if (array.getClass().isArray()) { int length = Array.getLength(array); this.myArrayList.ensureCapacity(this.myArrayList.size() + length); for (int i = 0; i < length; i += 1) { this.put(JSONObject.wrap(Array.get(array, i))); } } else { throw new JSONException( "JSONArray initial value should be a string or collection or array."); } }
Source:
public void scan() throws IOException { if (!rowGroupOpen) { openRowGroup(); } beginScan(presentStream, null); ensureValuesCapacity(); makeInnerQualifyingSet(); QualifyingSet input = hasNulls ? innerQualifyingSet : inputQualifyingSet; int numInput = input.getPositionCount(); if (inDictionaryStream != null) { if (inDictionaryFlags == null || inDictionaryFlags.length < numInput) { inDictionaryFlags = new boolean[roundupSize(numInput)]; } int begin = hasNulls ? innerPosInRowGroup : posInRowGroup; int end = input.getEnd(); inDictionaryStream.getSetBits(input.getPositions(), numInput, begin, end - begin, inDictionaryFlags); } if (filter != null) { outputQualifyingSet.reset(numInput); } if (numInput > 0) { if (filter != null) { outputQualifyingSet.reset(numInput); resultsProcessor.reset(); numInnerResults = dataStream.scan(input.getPositions(), 0, numInput, input.getEnd(), resultsProcessor); outputQualifyingSet.setPositionCount(numInnerResults); } else { resultsProcessor.reset(); numInnerResults = dataStream.scan(input.getPositions(), 0, numInput, input.getEnd(), resultsProcessor); } } if (hasNulls) { innerPosInRowGroup = innerQualifyingSet.getEnd(); } addNullsAfterScan(filter != null ? outputQualifyingSet : inputQualifyingSet, inputQualifyingSet.getEnd()); if (filter != null) { outputQualifyingSet.setEnd(inputQualifyingSet.getEnd()); } endScan(presentStream); }

Target:
public void scan() throws IOException { if (!rowGroupOpen) { openRowGroup(); } beginScan(presentStream, null); ensureValuesCapacity(); makeInnerQualifyingSet(); QualifyingSet input = hasNulls ? innerQualifyingSet : inputQualifyingSet; int numInput = input.getPositionCount(); if (inDictionaryStream != null) { if (inDictionaryFlags == null || inDictionaryFlags.length < numInput) { inDictionaryFlags = newBooleanArrayForReuse(numInput); } int begin = hasNulls ? innerPosInRowGroup : posInRowGroup; int end = input.getEnd(); inDictionaryStream.getSetBits(input.getPositions(), numInput, begin, end - begin, inDictionaryFlags); } if (filter != null) { outputQualifyingSet.reset(numInput); } if (numInput > 0) { resultsProcessor.reset(); if (filter != null) { numInnerResults = dataStream.scan(input.getPositions(), 0, numInput, input.getEnd(), resultsProcessor); outputQualifyingSet.setPositionCount(numInnerResults); } else { numInnerResults = dataStream.scan(input.getPositions(), 0, numInput, input.getEnd(), resultsProcessor); } } if (hasNulls) { innerPosInRowGroup = innerQualifyingSet.getEnd(); } addNullsAfterScan(filter != null ? outputQualifyingSet : inputQualifyingSet, inputQualifyingSet.getEnd()); if (filter != null) { outputQualifyingSet.setEnd(inputQualifyingSet.getEnd()); } endScan(presentStream); }
Source:
public <T> T readEntity(Class<T> typeToReadAs) { try { return ObjectMapperSingleton.getContext(typeToReadAs).reader(typeToReadAs).readValue(body); } catch (Exception e) { LOG.error(e, e.getMessage()); throw new ClientResponseException(e.getMessage(), 0, e); } }

Target:
public <T> T readEntity(Class<T> typeToReadAs) { try { return ObjectMapperSingleton.getContext(typeToReadAs).reader(typeToReadAs).readValue(responseInputStream); } catch (Exception e) { LOG.error(e, e.getMessage()); throw new ClientResponseException(e.getMessage(), 0, e); } }
Source:
public void run() { List<CucumberFeature> features = featureSupplier.get(); bus.send(new TestRunStarted(bus.getTime())); StepDefinitionReporter stepDefinitionReporter = plugins.stepDefinitionReporter(); runnerSupplier.get().reportStepDefinitions(stepDefinitionReporter); final int requestedThreads = runtimeOptions.getThreads(); if (!features.isEmpty()) { for (CucumberFeature feature : features) { feature.sendTestSourceRead(bus); } ParallelFeatureRunner.run(new FeatureRunner(filters, runnerSupplier), features, requestedThreads); } bus.send(new TestRunFinished(bus.getTime())); }

Target:
public void run() { final List<CucumberFeature> features = featureSupplier.get(); bus.send(new TestRunStarted(bus.getTime())); for (CucumberFeature feature : features) { feature.sendTestSourceRead(bus); } final StepDefinitionReporter stepDefinitionReporter = plugins.stepDefinitionReporter(); runnerSupplier.get().reportStepDefinitions(stepDefinitionReporter); final FeatureCompiler compiler = new FeatureCompiler(); for (CucumberFeature feature : features) { for (final PickleEvent pickleEvent : compiler.compileFeature(feature)) { if (filters.matchesFilters(pickleEvent)) { executor.execute(new Runnable() { @Override public void run() { runnerSupplier.get().runPickle(pickleEvent); } }); } } } executor.shutdown(); try { while (!executor.awaitTermination(1, TimeUnit.DAYS)) ; } catch (InterruptedException e) { throw new CucumberException(e); } bus.send(new TestRunFinished(bus.getTime())); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ConnectionEndpoint)) { return false; } ConnectionEndpoint other = (ConnectionEndpoint) obj; return Arrays.equals(fAddress, other.fAddress) && fPort == other.fPort; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ConnectionEndpoint)) { return false; } ConnectionEndpoint other = (ConnectionEndpoint) obj; return Arrays.equals(fAddress, other.fAddress) && fPort == other.fPort; }
Source:
public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException { URIBuilder uriBuilder = new URIBuilder(BASIC_SEARCH_URL); uriBuilder.addParameter("query", query); uriBuilder.addParameter("sort", "score"); URI uri = uriBuilder.build(); return uri.toURL(); }

Target:
public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException { return new URIBuilder(BASIC_SEARCH_URL) .addParameter("query", query) .addParameter("sort", "score") .build() .toURL(); }
Source:
public boolean await() throws InterruptedException { if (!latch.await(TestConstants.TIMEOUT_DURATION, TestConstants.TIMEOUT_UNIT)) { throw new InterruptedException("Timeout elapsed."); } return latch.await(TestConstants.TIMEOUT_DURATION, TestConstants.TIMEOUT_UNIT); }

Target:
public void await() throws InterruptedException { if (!latch.await(TestConstants.TIMEOUT_DURATION, TestConstants.TIMEOUT_UNIT)) { throw new InterruptedException("Timeout elapsed."); } }
Source:
private QueryResult executeQueryControl() { Query query = queryPair.getControl(); QueryResult setupResult = null; QueryResult queryResult = null; try { setupResult = setup(query, testPreQueryResults, testPrequery -> executeQuery(testGateway, testUsername, testPassword, queryPair.getTest(), testPrequery, testTimeout, sessionProperties)); if (setupResult.getState() == State.SUCCESS) { queryResult = executeQuery(testGateway, testUsername, testPassword, queryPair.getTest(), query.getQuery(), testTimeout, sessionProperties); } } finally { int retry = 0; QueryResult tearDownResult; do { tearDownResult = tearDown(query, controlPostQueryResults, controlPostquery -> executeQuery(controlGateway, controlUsername, controlPassword, queryPair.getControl(), controlPostquery, controlTimeout, sessionProperties)); if (tearDownResult.getState() == State.SUCCESS) { break; } try { TimeUnit.MINUTES.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } retry++; } while (retry < controlTeardownRetries); if (tearDownResult.getState() != State.SUCCESS) { queryResult = tearDownResult; if (tearDownResult.getException() != null) { if (setupResult.getException() != null) { tearDownResult.addSuppressed(setupResult.getException()); } if (queryResult.getException() != null) { tearDownResult.addSuppressed(queryResult.getException()); } } } } return queryResult; }

Target:
private QueryResult executeQueryControl() { Query query = queryPair.getControl(); QueryResult setupResult = null; QueryResult queryResult = null; try { setupResult = setup(query, controlPreQueryResults, controlPrequery -> executeQuery(controlGateway, controlUsername, controlPassword, queryPair.getControl(), controlPrequery, controlTimeout, sessionProperties)); if (setupResult.getState() == State.SUCCESS) { queryResult = executeQuery(controlGateway, controlUsername, controlPassword, queryPair.getControl(), query.getQuery(), controlTimeout, sessionProperties); } } finally { int retry = 0; QueryResult tearDownResult; do { tearDownResult = tearDown(query, controlPostQueryResults, controlPostquery -> executeQuery(controlGateway, controlUsername, controlPassword, queryPair.getControl(), controlPostquery, controlTimeout, sessionProperties)); if (tearDownResult.getState() == State.SUCCESS) { break; } try { TimeUnit.MINUTES.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } retry++; } while (retry < controlTeardownRetries); if (tearDownResult.getState() != State.SUCCESS) { if (tearDownResult.getException() != null) { if (setupResult.getException() != null) { tearDownResult.addSuppressed(setupResult.getException()); } if (queryResult.getException() != null) { tearDownResult.addSuppressed(queryResult.getException()); } } queryResult = tearDownResult; } } return queryResult; }
Source:
public void testConvertWeaselBeaconToSpan_withPageLoadBeacon_withBackendTraceId() throws ServletException, IOException { MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest(); mockHttpServletRequest.setParameter("ty", "pl"); mockHttpServletRequest.setParameter("d", "518"); mockHttpServletRequest.setParameter("r", "1496751574200"); mockHttpServletRequest.setParameter("ts", "-197"); mockHttpServletRequest.setParameter("t", "a6b5fd025be24191"); mockHttpServletRequest.setParameter("bt", "6210be349041096e"); servlet.doPost(mockHttpServletRequest, new MockHttpServletResponse()); final List<MockSpan> finishedSpans = mockTracer.finishedSpans(); assertThat(finishedSpans).hasSize(1); MockSpan span = finishedSpans.get(0); final String spanIdOfPageloadTrace = B3HeaderFormat.getB3Identifiers(mockTracer, span).getSpanId(); final B3HeaderFormat.B3Identifiers traceIdsOfServerSpan = B3HeaderFormat.B3Identifiers.builder() .traceId("6210be349041096e") .spanId("6210be349041096e") .build(); verify(reportingSpanEventListener).update(eq(traceIdsOfServerSpan), newSpanIdentifiers, eq(Collections.singletonMap("parent_id", spanIdOfPageloadTrace))); assertSoftly(softly -> softly.assertThat(span.tags()) .containsEntry("type", "pageload") .containsEntry("trace_id", "6210be349041096e") .doesNotContainEntry(Tags.SAMPLING_PRIORITY.getKey(), 0)); }

Target:
public void testConvertWeaselBeaconToSpan_withPageLoadBeacon_withBackendTraceId() throws ServletException, IOException { MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest(); mockHttpServletRequest.setParameter("ty", "pl"); mockHttpServletRequest.setParameter("d", "518"); mockHttpServletRequest.setParameter("r", "1496751574200"); mockHttpServletRequest.setParameter("ts", "-197"); mockHttpServletRequest.setParameter("t", "a6b5fd025be24191"); final String backendTraceId = "6210be349041096e"; mockHttpServletRequest.setParameter("bt", backendTraceId); final String backendSpanId = "6210be349041096e"; mockHttpServletRequest.setParameter("m_bs", backendSpanId); servlet.doPost(mockHttpServletRequest, new MockHttpServletResponse()); final List<MockSpan> finishedSpans = mockTracer.finishedSpans(); assertThat(finishedSpans).hasSize(1); MockSpan span = finishedSpans.get(0); final String spanIdOfPageloadTrace = B3HeaderFormat.getB3Identifiers(mockTracer, span).getSpanId(); final B3HeaderFormat.B3Identifiers traceIdsOfServerSpan = B3HeaderFormat.B3Identifiers.builder() .traceId(backendTraceId) .spanId(backendSpanId) .build(); final B3HeaderFormat.B3Identifiers newSpanIdentifiers = B3HeaderFormat.B3Identifiers.builder() .traceId(backendTraceId) .spanId(backendSpanId) .parentSpanId(spanIdOfPageloadTrace) .build(); verify(reportingSpanEventListener).update(eq(traceIdsOfServerSpan), eq(newSpanIdentifiers), eq(Collections.emptyMap())); assertSoftly(softly -> softly.assertThat(span.tags()) .containsEntry("type", "pageload") .containsEntry("trace_id", backendTraceId) .doesNotContainEntry(Tags.SAMPLING_PRIORITY.getKey(), 0)); }
Source:
private void processDataOrChildChange(WatchedEvent event, long notificationTime) { final String path = event.getPath(); if (event.getType() == EventType.NodeChildrenChanged || event.getType() == EventType.NodeCreated || event.getType() == EventType.NodeDeleted) { Set<IZkChildListener> childListeners = _childListener.get(path); if (childListeners != null && !childListeners.isEmpty()) { fireChildChangedEvents(path, childListeners); } } if (event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted || event.getType() == EventType.NodeCreated) { boolean isPathExist = event.getType() != EventType.NodeDeleted; Set<IZkDataListenerEntry> listeners = _dataListener.get(path); if (listeners != null && !listeners.isEmpty()) { fireDataChangedEvents(event.getPath(), listeners, notificationTime, isPathExist); } } }

Target:
private void processDataOrChildChange(WatchedEvent event, long notificationTime) { final String path = event.getPath(); final boolean pathExists = event.getType() != EventType.NodeDeleted; if (event.getType() == EventType.NodeChildrenChanged || event.getType() == EventType.NodeCreated || event.getType() == EventType.NodeDeleted) { Set<IZkChildListener> childListeners = _childListener.get(path); if (childListeners != null && !childListeners.isEmpty()) { fireChildChangedEvents(path, childListeners, pathExists); } } if (event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted || event.getType() == EventType.NodeCreated) { Set<IZkDataListenerEntry> listeners = _dataListener.get(path); if (listeners != null && !listeners.isEmpty()) { fireDataChangedEvents(event.getPath(), listeners, OptionalLong.of(notificationTime), pathExists); } } }
Source:
public void testGetFields() throws Exception { BugzillaRestClient client = new BugzillaRestClient(actualFixture.location()); assertNotNull(client.getClient()); assertNull(client.getClient().getLoginToken()); File file = File.createTempFile("mylyn", "fields"); try { BugzillaRestFieldResponse fields = client.getFields(new NullOperationMonitor()); BugzillaRestField[] fieldArray = fields.getFields(); Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); out.write(new Gson().toJson(fieldArray)); out.close(); assertEquals(IOUtils.toString(CommonTestUtil.getResource(this, "testdata/fields.json")), IOUtils.toString(new FileInputStream(file))); } finally { file.delete(); } }

Target:
public void testGetFields() throws Exception { BugzillaRestClient client = BugzillaRestConnector.getDefault().getClient(actualFixture.repository().getId()); BugzillaRestFieldResponse fields = client.getFields(new NullOperationMonitor()); BugzillaRestField[] fieldArray = fields.getFields(); assertEquals(IOUtils.toString(CommonTestUtil.getResource(this, "testdata/fields.json")), new Gson().toJson(fieldArray)); assertConfigurationFieldNames(Arrays.asList(fields.getFields())); }
Source:
public boolean isSampleCourse(String courseId) { if(courseId == null){ Assumption.fail("Course ID is null"); } return StringHelper.isMatching(courseId, FieldValidator.REGEX_SAMPLE_COURSE_ID); }

Target:
public boolean isSampleCourse(String courseId) { Assumption.assertNotNull("Course ID is null", courseId); return StringHelper.isMatching(courseId, FieldValidator.REGEX_SAMPLE_COURSE_ID); }
Source:
public boolean canRegisterSynchronization() { return Assert.checkNotNullParam("transactionSynchronizationRegistry", transactionSynchronizationRegistry). getTransactionStatus() == Status.STATUS_ACTIVE; }

Target:
public boolean canRegisterSynchronization() { return locateTransactionSynchronizationRegistry(). getTransactionStatus() == Status.STATUS_ACTIVE; }
Source:
protected boolean determinePageCompletion() { if (getElementViewer().getCheckedElements().length <= 0) { return false; } validateProject(); if ((fExperimentName != null) && (fCreateExperimentCheckbox.getSelection())) { String name = fExperimentNameText.getText(); if ((fTraceExperimentElement != null) && (name != null)) { TmfExperimentElement element = fTraceExperimentElement.getExperiment(name); if (element != null) { setMessage(null); setErrorMessage(NLS.bind(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorExperimentAlreadyExists, name)); return false; } } } return true; }

Target:
protected boolean determinePageCompletion() { if (getElementViewer().getCheckedElements().length <= 0) { return false; } validateProject(); if ((fExperimentName != null) && (fCreateExperimentCheckbox.getSelection())) { String name = fExperimentNameText.getText().trim(); if (name.isEmpty()) { setMessage(null); setErrorMessage(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorEmptyExperimentName); return false; } IWorkspace workspace = ResourcesPlugin.getWorkspace(); if ((workspace != null) && (!workspace.validateName(name, IResource.FILE).isOK())) { setMessage(null); setErrorMessage(NLS.bind(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorExperimentNameInvalid, name)); return false; } TmfExperimentFolder experimentFolder = fExperimentFolderElement; if (experimentFolder != null) { TmfExperimentElement element = experimentFolder.getExperiment(name); if (element != null) { setMessage(null); setErrorMessage(NLS.bind(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorExperimentAlreadyExists, name)); return false; } IFolder expResource = experimentFolder.getResource(); IResource res = expResource.findMember(name); if (res != null) { setMessage(null); setErrorMessage(NLS.bind(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorResourceAlreadyExists, name)); return false; } } } return true; }
Source:
public View getOverflowMenuAnchor() { View view = getToolbar().findViewById(R.id.menu_overflow_button); return getToolbar(); }

Target:
public View getOverflowMenuAnchor() { View view = getToolbar().findViewById(R.id.menu_overflow_button); return view == null ? getToolbar() : view; }
Source:
public HttpConnection execute(HttpConnection connection) { connection.connectionFactory = factory; connection.requestProperties.put("Accept", "application/json"); connection.responseInterceptors.addAll(this.responseInterceptors); connection.requestInterceptors.addAll(this.requestInterceptors); InputStream es = null; try { connection = connection.execute(); int code = connection.getConnection().getResponseCode(); String response = connection.getConnection().getResponseMessage(); if (code / 100 == 2) { return connection; } else { final CouchDbException ex; switch (code) { case HttpURLConnection.HTTP_NOT_FOUND: ex = new NoDocumentException(response); break; case HttpURLConnection.HTTP_CONFLICT: ex = new DocumentConflictException(response); break; case HttpURLConnection.HTTP_PRECON_FAILED: ex = new PreconditionFailedException(response); break; default: ex = new CouchDbException(response, code); break; } es = connection.getConnection().getErrorStream(); if (es != null) { Class<? extends CouchDbException> exceptionClass = ex.getClass(); try { Gson g = new GsonBuilder().registerTypeAdapter(exceptionClass, new InstanceCreator<CouchDbException>() { @Override public CouchDbException createInstance(Type type) { return ex; } }).create(); g.fromJson(new InputStreamReader(es), exceptionClass); } catch (JsonParseException e) { } } throw ex; } } catch (IOException ioe) { throw new CouchDbException("Error retrieving server response", ioe); } finally { close(es); } }

Target:
public HttpConnection execute(HttpConnection connection) { connection.connectionFactory = factory; connection.requestProperties.put("Accept", "application/json"); connection.responseInterceptors.addAll(this.responseInterceptors); connection.requestInterceptors.addAll(this.requestInterceptors); InputStream es = null; try { connection = connection.execute(); int code = connection.getConnection().getResponseCode(); String response = connection.getConnection().getResponseMessage(); if (code / 100 == 2) { return connection; } else { final CouchDbException ex; switch (code) { case HttpURLConnection.HTTP_NOT_FOUND: ex = new NoDocumentException(response); break; case HttpURLConnection.HTTP_CONFLICT: ex = new DocumentConflictException(response); break; case HttpURLConnection.HTTP_PRECON_FAILED: ex = new PreconditionFailedException(response); break; default: ex = new CouchDbException(response, code); break; } es = connection.getConnection().getErrorStream(); if (es != null) { byte[] errorResponse = IOUtils.toByteArray(es); Class<? extends CouchDbException> exceptionClass = ex.getClass(); try { Gson g = new GsonBuilder().registerTypeAdapter(exceptionClass, new InstanceCreator<CouchDbException>() { @Override public CouchDbException createInstance(Type type) { return ex; } }).create(); g.fromJson(new InputStreamReader(new ByteArrayInputStream(errorResponse), "UTF-8"), exceptionClass); } catch (JsonParseException e) { ex.error = new String(errorResponse, "UTF-8"); } } throw ex; } } catch (IOException ioe) { throw new CouchDbException("Error retrieving server response", ioe); } finally { close(es); } }
Source:
private void assertHasPillar(Grid grid, Point point, boolean needsPillar){ boolean hasPillar = false; for (Entity entity : grid.get(point)){ if (entity instanceof Box && !((Box)entity).isDestructible()){ hasPillar = true; } } assertEquals(hasPillar, needsPillar); }

Target:
private void assertHasPillar(Grid grid, Point point, boolean needsPillar){ boolean hasPillar = false; for (Entity entity : grid.get(point)){ if (entity instanceof Pillar){ hasPillar = true; } } assertEquals(hasPillar, needsPillar); }
Source:
public void serialize(MultimapAggregationState state, BlockBuilder out) { if (state.isEmpty()) { out.appendNull(); } else { BlockBuilder entryBuilder = out.beginBlockEntry(); state.forEach((keyBlock, valueBlock, position) -> { BlockBuilder rowBlockBuilder = entryBuilder.beginBlockEntry(); valueType.appendTo(valueBlock, position, rowBlockBuilder); keyType.appendTo(keyBlock, position, rowBlockBuilder); entryBuilder.closeEntry(); }); out.closeEntry(); } }

Target:
public void serialize(MultimapAggregationState state, BlockBuilder out) { if (state.isEmpty()) { out.appendNull(); return; } BlockBuilder entryBuilder = out.beginBlockEntry(); state.forEach((keyBlock, valueBlock, position) -> { BlockBuilder rowBlockBuilder = entryBuilder.beginBlockEntry(); valueType.appendTo(valueBlock, position, rowBlockBuilder); keyType.appendTo(keyBlock, position, rowBlockBuilder); entryBuilder.closeEntry(); }); out.closeEntry(); }
Source:
public FXDialogService() { this(null, null); }

Target:
public FXDialogService() { this(null); }
Source:
public String toString() { StringBuffer buffer = new StringBuffer(); boolean needParens=(getBoost() != 1.0) || (getMinimumNumberShouldMatch() > 0) ; if (needParens) { buffer.append("("); } for (Query q : must) { buffer.append("+"); buffer.append("("); buffer.append(q); buffer.append(")"); } for (Query q : must_not) { buffer.append("~"); buffer.append("("); buffer.append(q); buffer.append(")"); } for (Query q : should) { buffer.append("("); buffer.append(q); buffer.append(")"); } if (needParens) { buffer.append(")"); } buffer.append("~"); buffer.append(getMinimumNumberShouldMatch()); buffer.append("^"); buffer.append(getBoost()); return buffer.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("("); if (must != null) { for (Query q : must) { builder.append("+").append("(").append(q).append(")"); } } if (must_not != null) { for (Query q : must_not) { builder.append("-").append("(").append(q).append(")"); } } if (should != null) { for (Query q : should) { builder.append("(").append(q).append(")"); } } builder.append("~").append(minimumNumberShouldMatch); builder.append("^").append(boost); builder.append(")"); return builder.toString(); }