auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Map<String, List<String>> getTableToBrokersMap() { int controllerIdx = RANDOM.nextInt(controllerUrls.length); for (int i = 0; i < controllerFetchRetries; i++) { try { String brokerTableQueryResp = IOUtils.toString( new URL(String.format(CONTROLLER_ONLINE_TABLE_BROKERS_MAP_URL_TEMPLATE, controllerUrls[controllerIdx]))); Map<String, List<String>> tablesToBrokersMap = OBJECT_MAPPER.readValue(brokerTableQueryResp, Map.class); for (String table : tablesToBrokersMap.keySet()) { List<String> brokerHostPorts = new ArrayList<>(); for (String broker : tablesToBrokersMap.get(table)) { brokerHostPorts.add(broker.replace("Broker_", "").replace("_", ":")); } tablesToBrokersMap.put(table, brokerHostPorts); } return tablesToBrokersMap; } catch (Exception e) { LOGGER.warn(String.format("Unable to fetch controller broker information from '%s', retry in %d millseconds", controllerUrls[controllerIdx], this.controllerFetchRetriesIntervalMills), e); controllerIdx = (controllerIdx + 1) % controllerUrls.length; try { Thread.sleep(controllerFetchRetriesIntervalMills); } catch (InterruptedException interruptedException) { } } } LOGGER.warn( String.format("Failed to fetch controller broker information with %d retries", this.controllerFetchRetries)); return null; }

Target:
private Map<String, List<String>> getTableToBrokersMap() { int controllerIdx = RANDOM.nextInt(_controllerUrls.length); for (int i = 0; i < _controllerFetchRetries; i++) { try { String brokerTableQueryResp = IOUtils.toString( new URL(String.format(CONTROLLER_ONLINE_TABLE_BROKERS_MAP_URL_TEMPLATE, _controllerUrls[controllerIdx]))); Map<String, List<String>> tablesToBrokersMap = OBJECT_MAPPER.readValue(brokerTableQueryResp, Map.class); for (String table : tablesToBrokersMap.keySet()) { List<String> brokerHostPorts = new ArrayList<>(); for (String broker : tablesToBrokersMap.get(table)) { brokerHostPorts.add(Utils.generateBrokerHostPort(broker)); } tablesToBrokersMap.put(table, brokerHostPorts); } return tablesToBrokersMap; } catch (Exception e) { LOGGER.warn("Unable to fetch controller broker information from '{}', retry in millseconds", _controllerUrls[controllerIdx], _controllerFetchRetriesIntervalMills, e); controllerIdx = (controllerIdx + 1) % _controllerUrls.length; try { Thread.sleep(_controllerFetchRetriesIntervalMills); } catch (InterruptedException interruptedException) { } } } LOGGER.warn("Failed to fetch controller broker information with retries", _controllerFetchRetries); return null; }
Source:
public void doUserCancel_chargeStatusDuringAuthorisation_needsCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); WorldpayCancelResponse worldpayResponse = mock(WorldpayCancelResponse.class); when(worldpayResponse.cancelStatus()).thenReturn(BaseCancelResponse.CancelStatus.CANCELLED); GatewayResponse.GatewayResponseBuilder<WorldpayCancelResponse> gatewayResponseBuilder = responseBuilder(); GatewayResponse cancelResponse = gatewayResponseBuilder.withResponse(worldpayResponse).build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockChargeDao.findByExternalId(externalChargeId)).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProviders.byName(chargeEntity.getPaymentGatewayName())).thenReturn(mockPaymentProvider); when(mockPaymentProvider.cancel(argThat(aCancelGatewayRequestMatching(chargeEntity)))).thenReturn(cancelResponse); chargeCancelService.doUserCancel(externalChargeId); verify(mockPaymentProvider).cancel(argThat(aCancelGatewayRequestMatching(chargeEntity))); verify(chargeService).transitionChargeState(externalChargeId, USER_CANCELLED); verifyNoMoreInteractions(ignoreStubs(mockChargeDao)); }

Target:
public void doUserCancel_chargeStatusDuringAuthorisation_needsCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); WorldpayCancelResponse worldpayResponse = new WorldpayCancelResponse(); GatewayResponse.GatewayResponseBuilder<WorldpayCancelResponse> gatewayResponseBuilder = responseBuilder(); GatewayResponse cancelResponse = gatewayResponseBuilder.withResponse(worldpayResponse).build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockChargeDao.findByExternalId(externalChargeId)).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProviders.byName(chargeEntity.getPaymentGatewayName())).thenReturn(mockPaymentProvider); when(mockPaymentProvider.cancel(argThat(aCancelGatewayRequestMatching(chargeEntity)))).thenReturn(cancelResponse); chargeCancelService.doUserCancel(externalChargeId); verify(mockPaymentProvider).cancel(argThat(aCancelGatewayRequestMatching(chargeEntity))); verify(chargeService).transitionChargeState(externalChargeId, USER_CANCELLED); }
Source:
public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConfigureConsoleOptionsParams queryParams = new ConfigureConsoleOptionsParams(consoleOptions, true); try { URI baseUri = getUriInfo().getBaseUri(); URL engineBaseUrl = new URL(baseUri.getScheme(), baseUri.getHost(), baseUri.getPort(), ""); queryParams.setEngineBaseUrl(engineBaseUrl.toString()); } catch (MalformedURLException e) { } queryParams.setConsoleClientResourcesUrl(BrandingManager.getInstance().getMessage("obrand.common.console_client_resources_url")); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, queryParams).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(Charset.forName("UTF-8")), ApiMediaType.APPLICATION_X_VIRT_VIEWER); return builder.build(); }

Target:
public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConfigureConsoleOptionsParams queryParams = new ConfigureConsoleOptionsParams(consoleOptions, true); queryParams.setConsoleClientResourcesUrl(BrandingManager.getInstance().getMessage("obrand.common.console_client_resources_url")); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, queryParams).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(Charset.forName("UTF-8")), ApiMediaType.APPLICATION_X_VIRT_VIEWER); return builder.build(); }
Source:
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { super.onReceivedSslError(view, handler, error); try { JSONObject obj = new JSONObject(); obj.put("type", LOAD_ERROR_EVENT); obj.put("url", error.getUrl()); obj.put("code", 0); obj.put("sslerror", error.getPrimaryError()); String message; switch (error.getPrimaryError()) { case SslError.SSL_DATE_INVALID: message = "The date of the certificate is invalid"; break; case SslError.SSL_EXPIRED: message = "The certificate has expired"; break; case SslError.SSL_IDMISMATCH: message = "Hostname mismatch"; break; default: case SslError.SSL_INVALID: message = "A generic error occurred"; break; case SslError.SSL_MAX_ERROR: message = "<SSL_MAX_ERROR>"; break; case SslError.SSL_NOTYETVALID: message = "The certificate is not yet valid"; break; case SslError.SSL_UNTRUSTED: message = "The certificate authority is not trusted"; break; } obj.put("message", message); sendUpdate(obj, true, PluginResult.Status.ERROR); } catch (JSONException ex) { LOG.d(LOG_TAG, "Should never happen"); } handler.cancel(); }

Target:
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { super.onReceivedSslError(view, handler, error); try { JSONObject obj = new JSONObject(); obj.put("type", LOAD_ERROR_EVENT); obj.put("url", error.getUrl()); obj.put("code", 0); obj.put("sslerror", error.getPrimaryError()); String message; switch (error.getPrimaryError()) { case SslError.SSL_DATE_INVALID: message = "The date of the certificate is invalid"; break; case SslError.SSL_EXPIRED: message = "The certificate has expired"; break; case SslError.SSL_IDMISMATCH: message = "Hostname mismatch"; break; default: case SslError.SSL_INVALID: message = "A generic error occurred"; break; case SslError.SSL_NOTYETVALID: message = "The certificate is not yet valid"; break; case SslError.SSL_UNTRUSTED: message = "The certificate authority is not trusted"; break; } obj.put("message", message); sendUpdate(obj, true, PluginResult.Status.ERROR); } catch (JSONException ex) { LOG.d(LOG_TAG, "Should never happen"); } handler.cancel(); }
Source:
public List<PartitionId> getAllPartitionIds(String partitionClass) { List<PartitionId> staticPartitionIds = staticClusterManager.getAllPartitionIds(partitionClass); return staticPartitionIds; }

Target:
public List<PartitionId> getAllPartitionIds(String partitionClass) { return staticClusterManager.getAllPartitionIds(partitionClass); }
Source:
public Generate(Supplier<Integer> interval) { this.interval = interval; Simulator.pushEvent(new GenerateEvent(0)); }

Target:
public Generate(Supplier<Integer> interval) { this.interval = interval; Simulator.pushEvent(new GenerateEvent(interval.get())); }
Source:
public String toString() { StringBuilder sb=new StringBuilder(); Iterator<Map.Entry<String, String>> iterator = iterator(); while(iterator.hasNext()) { Map.Entry<String, String> entry=iterator.next(); sb.append(entry.getKey()); sb.append(": "); sb.append(entry.getValue()); sb.append("\n"); } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> entry: this) { sb.append(entry.getKey()); sb.append(": "); sb.append(entry.getValue()); sb.append("\n"); } return sb.toString(); }
Source:
private void inspectGetCommand() { File configInfoDir = new VoltFile(m_voltdbRoot, Constants.CONFIG_DIR); switch (m_getOption) { case DEPLOYMENT: { File depFH = new VoltFile(configInfoDir, "deployment.xml"); if (!depFH.exists()) { System.out.println("FATAL: Deployment file \"" + depFH.getAbsolutePath() + "\" not found."); exit(-1); } m_pathToDeployment = depFH.getAbsolutePath(); return; } case SCHEMA: case CLASSES: { File catalogFH = new VoltFile(configInfoDir, "catalog.jar"); if (!catalogFH.exists()) { System.out.println("FATAL: Catalog jar file \"" + catalogFH.getAbsolutePath() + "\" not found. " + "Please make sure the database path points to an initialized database"); exit(-1); } m_pathToCatalog = catalogFH.getAbsolutePath(); return; } } }

Target:
private void inspectGetCommand() { String parentPath = "."; if (!m_voltdbRoot.exists()) { try { parentPath = m_voltdbRoot.getCanonicalFile().getParent(); } catch (IOException io) System.err.println("FATAL: " + parentPath + " does not contain a " + "valid database root directory. Use the --dir option to specify the path to the root."); referToDocAndExit(); } File configInfoDir = new VoltFile(m_voltdbRoot, Constants.CONFIG_DIR); switch (m_getOption) { case DEPLOYMENT: { File depFH = new VoltFile(configInfoDir, "deployment.xml"); if (!depFH.exists()) { System.out.println("FATAL: Deployment file \"" + depFH.getAbsolutePath() + "\" not found."); referToDocAndExit(); } m_pathToDeployment = depFH.getAbsolutePath(); return; } case SCHEMA: { File catalogFH = new VoltFile(configInfoDir, "catalog.jar"); if (!catalogFH.exists()) { try { parentPath = m_voltdbRoot.getCanonicalFile().getParent(); } catch (IOException io) System.out.println("FATAL: Schema not found in the provided database directory " + parentPath + ". Make sure the database has been started "); referToDocAndExit(); } m_pathToCatalog = catalogFH.getAbsolutePath(); return; } } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sf__inspector); smartStore = SalesforceSDKManagerWithSmartStore.getInstance() .getSmartStore(); queryText = (MultiAutoCompleteTextView) findViewById(R.id.sf__inspector_query_text); pageSizeText = (EditText) findViewById(R.id.sf__inspector_pagesize_text); pageIndexText = (EditText) findViewById(R.id.sf__inspector_pageindex_text); resultGrid = (GridView) findViewById(R.id.sf__inspector_result_grid); setupAutocomplete(queryText); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sf__inspector); queryText = (MultiAutoCompleteTextView) findViewById(R.id.sf__inspector_query_text); pageSizeText = (EditText) findViewById(R.id.sf__inspector_pagesize_text); pageIndexText = (EditText) findViewById(R.id.sf__inspector_pageindex_text); resultGrid = (GridView) findViewById(R.id.sf__inspector_result_grid); }
Source:
<S> CompletionStage<List<S>> run(final SphereClient client, final Function<T, S> resultsMapper) { return queryPage(client, 0).thenApply(result -> { final Stream<S> firstStream = result.getResults().stream().map(resultsMapper); Stream<S> nextStream = queryNextPages(client, result.getTotal(), resultsMapper) .flatMap(stage -> stage.toCompletableFuture().join()); return concat(firstStream, nextStream) .collect(toList()); }); }

Target:
<S> CompletionStage<List<S>> run(final SphereClient client, final Function<T, S> resultsMapper) { return queryPage(client, 0) .thenApply(result -> concatPagedResultToList(result, client, resultsMapper)); }
Source:
private boolean isWritesetWritable(DistributionSchedule.WriteSet writeSet, long key, int allowedNonWritableCount) { if (allowedNonWritableCount < 0) { allowedNonWritableCount = 0; } final int sz = writeSet.size(); final int requiredWritable = sz - allowedNonWritableCount; int nonWritableCount = 0; for (int i = 0; i < sz; i++) { if (!bk.getBookieClient().isWritable(getCurrentEnsemble().get(i), key)) { nonWritableCount++; if (nonWritableCount >= allowedNonWritableCount) { return false; } } else { final int knownWritable = i - nonWritableCount; if (knownWritable >= requiredWritable) { return true; } } } return true; }

Target:
private boolean isWritesetWritable(DistributionSchedule.WriteSet writeSet, long key, int allowedNonWritableCount) { if (allowedNonWritableCount < 0) { allowedNonWritableCount = 0; } final int sz = writeSet.size(); final int requiredWritable = sz - allowedNonWritableCount; int nonWritableCount = 0; List<BookieSocketAddress> currentEnsemble = getCurrentEnsemble(); for (int i = 0; i < sz; i++) { if (!clientCtx.getBookieClient().isWritable(currentEnsemble.get(i), key)) { nonWritableCount++; if (nonWritableCount >= allowedNonWritableCount) { return false; } } else { final int knownWritable = i - nonWritableCount; if (knownWritable >= requiredWritable) { return true; } } } return true; }
Source:
public void synchronizeKeyToPassive(PassiveSynchronizationChannel<EhcacheEntityMessage> syncChannel, int concurrencyKey) { LOGGER.info("Sync started for concurrency key {}.", concurrencyKey); if (concurrencyKey == DEFAULT_KEY) { stateService.getStateRepositoryManager().syncMessageFor(storeIdentifier).forEach(syncChannel::synchronizeToPassive); } else { BlockingQueue<EhcacheDataSyncMessage> messageQ = new SynchronousQueue<>(); int segmentId = concurrencyKey - DEFAULT_KEY - 1; CompletableFuture<Void> asyncGet = CompletableFuture.runAsync(() -> doGetsForSync(segmentId, messageQ)); try { boolean done = false; while (!done) { EhcacheDataSyncMessage msg = messageQ.take(); if (msg instanceof LastDataSyncMessage) { done = true; } else { syncChannel.synchronizeToPassive(msg); } } asyncGet.get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } sendMessageTrackerReplication(syncChannel, concurrencyKey - 1); LOGGER.info("Sync complete for concurrency key {}.", concurrencyKey); }

Target:
public void synchronizeKeyToPassive(PassiveSynchronizationChannel<EhcacheEntityMessage> syncChannel, int concurrencyKey) { LOGGER.info("Sync started for concurrency key {}.", concurrencyKey); if (concurrencyKey == DEFAULT_KEY) { stateService.getStateRepositoryManager().syncMessageFor(storeIdentifier).forEach(syncChannel::synchronizeToPassive); } else { boolean interrupted = false; BlockingQueue<DataSyncMessageHandler> messageQ = new SynchronousQueue<>(); int segmentId = concurrencyKey - DEFAULT_KEY - 1; Thread thisThread = Thread.currentThread(); CompletableFuture<Void> asyncGet = CompletableFuture.runAsync( () -> doGetsForSync(segmentId, messageQ, syncChannel, thisThread), SYNC_GETS_EXECUTOR); try { try { while (messageQ.take().execute()) ; } catch (InterruptedException e) { interrupted = true; } if (interrupted) { asyncGet.get(10, TimeUnit.SECONDS); throw new InterruptedException(); } else { asyncGet.get(); } } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new RuntimeException(e); } } sendMessageTrackerReplication(syncChannel, concurrencyKey - 1); LOGGER.info("Sync complete for concurrency key {}.", concurrencyKey); }
Source:
public void sync() throws IOException { if (transactionEntries.size() > 0) { String key = TxConstants.TransactionLog.NUM_ENTRIES_APPENDED; internalWriter.appendRaw(key.getBytes(), 0, key.getBytes().length, new SequenceFile.ValueBytes() { @Override public void writeUncompressedBytes(DataOutputStream outStream) throws IOException { outStream.write(toBytes(transactionEntries.size())); outStream.flush(); } @Override public void writeCompressedBytes(DataOutputStream outStream) throws IllegalArgumentException, IOException { throw new IllegalArgumentException("UncompressedBytes cannot be compressed!"); } @Override public int getSize() { return Integer.SIZE / Byte.SIZE; } }); } for (Entry entry : transactionEntries) { internalWriter.append(entry.getKey(), entry.getEdit()); } transactionEntries.clear(); internalWriter.syncFs(); }

Target:
public void sync() throws IOException { internalWriter.syncFs(); }
Source:
public void cleanup() throws Exception { deleteDirectory("/storages/storage-common-proxies/maven-central/org/carlspring/maven/derby-maven-plugin"); deleteDirectory("/storages/storage-common-proxies/maven-oracle/com/oracle/jdbc/ojdbc8"); deleteDirectory("/storages/storage-common-proxies/maven-central/org/carlspring/properties-injector"); deleteDirectory("/storages/storage-common-proxies/maven-central/javax/media/jai_core"); artifactEntryService.deleteAll(); }

Target:
public void cleanup() throws Exception { deleteDirectoryRelativeToVaultDirectory( "storages/storage-common-proxies/maven-central/org/carlspring/maven/derby-maven-plugin"); deleteDirectoryRelativeToVaultDirectory("storages/storage-common-proxies/maven-oracle/com/oracle/jdbc/ojdbc8"); deleteDirectoryRelativeToVaultDirectory( "storages/storage-common-proxies/maven-central/org/carlspring/properties-injector"); deleteDirectoryRelativeToVaultDirectory("storages/storage-common-proxies/maven-central/javax/media/jai_core"); artifactEntryService.deleteAll(); }
Source:
private static File asTemp(InputStream in, String prefix, String suffix, File dir) throws IOException { dir.mkdirs(); File tmp = File.createTempFile(prefix, suffix, dir); boolean keep = false; try { FileOutputStream out = new FileOutputStream(tmp); try { byte[] data = new byte[8192]; int n; while ((n = in.read(data)) > 0) { out.write(data, 0, n); } keep = true; return tmp; } finally { out.close(); } } finally { if (!keep) { tmp.delete(); } } }

Target:
private static File asTemp(InputStream in, String prefix, String suffix, File dir) throws IOException { File tmp = File.createTempFile(prefix, suffix, dir); boolean keep = false; try { FileOutputStream out = new FileOutputStream(tmp); try { byte[] data = new byte[8192]; int n; while ((n = in.read(data)) > 0) { out.write(data, 0, n); } keep = true; return tmp; } finally { out.close(); } } finally { if (!keep) { tmp.delete(); } } }
Source:
public Function<Row, Row> makePostComputeManipulatorFn( final GroupByQuery query, final MetricManipulationFn fn ) { final Set<String> optimizedDims = extractionsToRewrite(query, false); final Function<Row, Row> preCompute = makePreComputeManipulatorFn(query, fn); if (optimizedDims.isEmpty()) { return preCompute; } final Map<String, ExtractionFn> extractionFnMap = new HashMap<>(); for (DimensionSpec dimensionSpec : query.getDimensions()) { final String dimension = dimensionSpec.getOutputName(); if (optimizedDims.contains(dimension)) { extractionFnMap.put(dimension, dimensionSpec.getExtractionFn()); } } return new Function<Row, Row>() { @Nullable @Override public Row apply(Row input) { Row preRow = preCompute.apply(input); if (preRow instanceof MapBasedRow) { MapBasedRow preMapRow = (MapBasedRow) preRow; Map<String, Object> event = Maps.newHashMap(preMapRow.getEvent()); for (String dim : optimizedDims) { final Object eventVal = event.get(dim); event.remove(dim); event.put(dim, extractionFnMap.get(dim).apply(eventVal == null ? "" : eventVal)); } return new MapBasedRow(preMapRow.getTimestamp(), event); } else { return preRow; } } }; }

Target:
public Function<Row, Row> makePostComputeManipulatorFn( final GroupByQuery query, final MetricManipulationFn fn ) { final Set<String> optimizedDims = ImmutableSet.copyOf( Iterables.transform( extractionsToRewrite(query), new Function<DimensionSpec, String>() { @Override public String apply(DimensionSpec input) { return input.getOutputName(); } } ) ); final Function<Row, Row> preCompute = makePreComputeManipulatorFn(query, fn); if (optimizedDims.isEmpty()) { return preCompute; } final Map<String, ExtractionFn> extractionFnMap = new HashMap<>(); for (DimensionSpec dimensionSpec : query.getDimensions()) { final String dimension = dimensionSpec.getOutputName(); if (optimizedDims.contains(dimension)) { extractionFnMap.put(dimension, dimensionSpec.getExtractionFn()); } } return new Function<Row, Row>() { @Nullable @Override public Row apply(Row input) { Row preRow = preCompute.apply(input); if (preRow instanceof MapBasedRow) { MapBasedRow preMapRow = (MapBasedRow) preRow; Map<String, Object> event = Maps.newHashMap(preMapRow.getEvent()); for (String dim : optimizedDims) { final Object eventVal = event.get(dim); event.put(dim, extractionFnMap.get(dim).apply(eventVal)); } return new MapBasedRow(preMapRow.getTimestamp(), event); } else { return preRow; } } }; }
Source:
private static List<String> getScopeOfOperations(String oauth2SchemeKey, Operation operation) { List<Map<String, List<String>>> security = operation.getSecurity(); if (security != null) { for (Map<String, List<String>> requirement : security) { if (requirement.get(oauth2SchemeKey) != null) { return requirement.get(oauth2SchemeKey); } } } return getScopeOfOperationsFromExtensions(operation); }

Target:
private List<String> getScopeOfOperations(String oauth2SchemeKey, Operation operation) { List<Map<String, List<String>>> security = operation.getSecurity(); if (security != null) { for (Map<String, List<String>> requirement : security) { if (requirement.get(oauth2SchemeKey) != null) { return requirement.get(oauth2SchemeKey); } } } return getScopeOfOperationsFromExtensions(operation); }
Source:
public SubPlan createSubPlans(Session session, Plan plan, boolean forceSingleNode, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector) { Fragmenter fragmenter = new Fragmenter( session, metadata, plan.getStatsAndCosts(), new PlanSanityChecker(forceSingleNode), warningCollector, sqlParser, idAllocator, new SymbolAllocator(plan.getTypes().allTypes()), getTableWriterNodeIds(plan.getRoot())); FragmentProperties properties = new FragmentProperties(new PartitioningScheme( Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getRoot().getOutputVariables())); if (forceSingleNode || isForceSingleNodeOutput(session)) { properties = properties.setSingleNodeDistribution(); } PlanNode root = SimplePlanRewriter.rewriteWith(fragmenter, plan.getRoot(), properties); SubPlan subPlan = fragmenter.buildRootFragment(root, properties); subPlan = reassignPartitioningHandleIfNecessary(session, subPlan); subPlan = analyzeGroupedExecution(session, subPlan, false); checkState(!isForceSingleNodeOutput(session) || subPlan.getFragment().getPartitioning().isSingleNode(), "Root of PlanFragment is not single node"); sanityCheckFragmentedPlan(subPlan, warningCollector, getQueryMaxStageCount(session), config.getStageCountWarningThreshold()); return subPlan; }

Target:
public SubPlan createSubPlans(Session session, Plan plan, boolean forceSingleNode, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector) { Fragmenter fragmenter = new Fragmenter( session, metadata, plan.getStatsAndCosts(), new PlanSanityChecker(forceSingleNode), warningCollector, sqlParser, idAllocator, new PlanVariableAllocator(plan.getTypes().allVariables()), getTableWriterNodeIds(plan.getRoot())); FragmentProperties properties = new FragmentProperties(new PartitioningScheme( Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getRoot().getOutputVariables())); if (forceSingleNode || isForceSingleNodeOutput(session)) { properties = properties.setSingleNodeDistribution(); } PlanNode root = SimplePlanRewriter.rewriteWith(fragmenter, plan.getRoot(), properties); SubPlan subPlan = fragmenter.buildRootFragment(root, properties); subPlan = reassignPartitioningHandleIfNecessary(session, subPlan); subPlan = analyzeGroupedExecution(session, subPlan, false); checkState(!isForceSingleNodeOutput(session) || subPlan.getFragment().getPartitioning().isSingleNode(), "Root of PlanFragment is not single node"); sanityCheckFragmentedPlan(subPlan, warningCollector, getQueryMaxStageCount(session), config.getStageCountWarningThreshold()); return subPlan; }
Source:
public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); if (out.getVersion().onOrAfter(Version.V_7_8_0)) { out.writeOptionalFloat(requestsPerSecond); out.writeOptionalTimeValue(timeout); } if (out.getVersion().onOrAfter(Version.CURRENT)) { out.writeString(jobId); } }

Target:
public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); if (out.getVersion().onOrAfter(Version.V_7_8_0)) { out.writeOptionalFloat(requestsPerSecond); out.writeOptionalTimeValue(timeout); } if (out.getVersion().onOrAfter(Version.V_8_0_0)) { out.writeString(jobId); } }
Source:
public void testTraceFile() throws Throwable { TracepointActionManager tam = TracepointActionManager.getInstance(); IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager(); @SuppressWarnings( "unchecked" ) ArrayList<ITracepointAction> actions = (ArrayList<ITracepointAction>)tam.getActions().clone(); for (ITracepointAction a : actions) { tam.deleteAction(a); } IBreakpoint[] bpts = bm.getBreakpoints(); Assert.assertTrue(bpts.length == 0); super.setLaunchAttributes(); setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "${workspace_loc}"); String absoluteProgram = new Path("data/launch/bin/TracepointTestApp.exe").toFile().getAbsolutePath(); setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, absoluteProgram); setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE); setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE, IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TRACE_FILE); setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, TRACE_FILE); doLaunch(); Thread.sleep(1000); actions = tam.getActions(); Assert.assertTrue(String.format("Unexpected count of tracepoint actions: %d", actions.size()), actions.size() == 3); bpts = bm.getBreakpoints(); Assert.assertTrue(bpts.length == 2); for (IBreakpoint b : bpts) { Assert.assertTrue(b instanceof ICTracepoint); checkTracepoint((ICTracepoint)b); } terminateSession(); doLaunch(); Thread.sleep(1000); actions = tam.getActions(); Assert.assertTrue(actions.size() == 3); bpts = bm.getBreakpoints(); Assert.assertTrue(bpts.length == 2); for (IBreakpoint b : bpts) { Assert.assertTrue(b instanceof ICTracepoint); checkTracepoint((ICTracepoint)b); } }

Target:
public void testTraceFile() throws Throwable { deleteActionsAndBreakpoints(); startTraceFileSession(); checkActionsAndTracepoints(); }
Source:
private void encodeEventData(ObjectOutput out, Object data) throws IOException { if(data != null) { out.writeObject(data); }else{ logger.warn("encodeEventData data is null"); } }

Target:
private void encodeEventData(ObjectOutput out, Object data) throws IOException { out.writeObject(data); }
Source:
public void run() { try { int entryCount; ScanResults currentScanResults = scanResults.get(); if (isScanning || currentScanResults == null) { return; } else { entryCount = queueEntryCount.get(); } long processStartTimeMs = time.milliseconds(); for (int i = 0; i < entryCount; i++) { if (cancelled) { return; } Pair<IndexValue, IndexValue> entry = recentEntryQueue.poll(); if (entry == null) { throw new IllegalStateException( "Invalid queue state. Expected entryCount " + entryCount + " current index: " + i); } metrics.statsRecentEntryQueueSize.update(queueEntryCount.decrementAndGet()); IndexValue newValue = entry.getFirst(); if (newValue.getOffset().compareTo(currentScanResults.scannedEndOffset) >= 0) { if (newValue.isFlagSet(IndexValue.Flags.Delete_Index)) { processNewDelete(currentScanResults, newValue, entry.getSecond()); } else { processNewPut(currentScanResults, newValue); } } } metrics.statsRecentEntryQueueProcessTimeMs.update(time.milliseconds() - processStartTimeMs, TimeUnit.MILLISECONDS); } catch (Exception e) { logger.error("Unexpected exception while running QueueProcessor", e); metrics.blobStoreStatsErrorCount.inc(); } }

Target:
public void run() { try { int entryCount; ScanResults currentScanResults = scanResults.get(); if (isScanning || currentScanResults == null) { return; } else { entryCount = queueEntryCount.get(); } long processStartTimeMs = time.milliseconds(); for (int i = 0; i < entryCount && !cancelled; i++) { Pair<IndexValue, IndexValue> entry = recentEntryQueue.poll(); if (entry == null) { throw new IllegalStateException( String.format("Invalid queue state in store %s. Expected entryCount %d, current index: %d", storeId, entryCount, i)); } metrics.statsRecentEntryQueueSize.update(queueEntryCount.decrementAndGet()); IndexValue newValue = entry.getFirst(); if (newValue.getOffset().compareTo(currentScanResults.scannedEndOffset) >= 0) { if (newValue.isFlagSet(IndexValue.Flags.Delete_Index)) { processNewDelete(currentScanResults, newValue, entry.getSecond()); } else { processNewPut(currentScanResults, newValue); } } } metrics.statsRecentEntryQueueProcessTimeMs.update(time.milliseconds() - processStartTimeMs, TimeUnit.MILLISECONDS); } catch (Exception e) { logger.error("Unexpected exception while running QueueProcessor in store {}", storeId, e); metrics.blobStoreStatsQueueProcessorErrorCount.inc(); } }
Source:
public CreateDDiagramElementCommand(final TransactionalEditingDomain domain, final EObject semantic, final EdgeMapping mapping, final EdgeTarget source, final EdgeTarget target) { this(domain, semantic); edgeCandidate = new DEdgeCandidate(mapping, semantic, source, target, RefreshIdsHolder.getOrCreateHolder(getParentDiagram())); this.container = (DragAndDropTarget) source; }

Target:
public CreateDDiagramElementCommand(final TransactionalEditingDomain domain, final EObject semantic, final EdgeMapping mapping, final EdgeTarget source, final EdgeTarget target) { this(domain, semantic); this.container = (DragAndDropTarget) source; edgeCandidate = new DEdgeCandidate(mapping, semantic, source, target, RefreshIdsHolder.getOrCreateHolder(getParentDiagram())); }
Source:
public void doubleConversionValidation() throws Exception { BpmnModel bpmnModel = readXMLFile(); assertNotNull(bpmnModel); validateModel(bpmnModel); bpmnModel = exportAndReadXMLFile(bpmnModel); validateModel(bpmnModel); }

Target:
public void doubleConversionValidation() throws Exception { BpmnModel bpmnModel = readXMLFile(); assertNotNull(bpmnModel); validateModel(bpmnModel); bpmnModel = exportAndReadXMLFile(bpmnModel); assertNotNull(bpmnModel); validateModel(bpmnModel); }
Source:
public void testStartWithReconnectFuture() throws Exception { Future<Void> future = Future.future(); CountDownLatch latch = new CountDownLatch(1); RabbitMQOptions options = "true".equalsIgnoreCase(System.getProperty("rabbitmq.local")) ? config().setUri(CLOUD_AMQP_URI) : config(); options.setConnectionRetries(3); options.setConnectionRetryDelay(1L); RabbitMQClient.create(Vertx.vertx(), options).start(future.completer()); future.setHandler(onFailure(v -> { latch.countDown(); })); awaitLatch(latch); assertTrue(future.isComplete() && future.failed()); }

Target:
public void testStartWithReconnectFuture() throws Exception { Future<Void> future = Future.future(); CountDownLatch latch = new CountDownLatch(1); RabbitMQOptions options = "true".equalsIgnoreCase(System.getProperty("rabbitmq.local")) ? config() : config().setUri(CLOUD_AMQP_URI); options.setConnectionRetries(3); options.setConnectionRetryDelay(1L); RabbitMQClient.create(Vertx.vertx(), options).start(future.completer()); future.setHandler(onFailure(v -> { latch.countDown(); })); awaitLatch(latch); assertTrue(future.isComplete() && future.failed()); }
Source:
public void shouldSendEmailToAuthorIfIsNotConnected() { Post likedPost = mock(Post.class); String postOwner = "postOwner"; String likeOwner = "likeOwner"; String summary = "blabla"; LikePostEvent postLikedEvent = new LikePostEvent(likedPost, likeOwner); User liker = new User(likeOwner); User author = new User(postOwner); Long postId = new Long(928839); String postUrl = new String("<LINK_0>"); when(likedPost.getAuthor()).thenReturn(author); when(likedPost.getPostContent()).thenReturn(new Story(summary)); when(likedPost.getId()).thenReturn(postId); when(connectedUserService.isConnected(postOwner)).thenReturn(false); when(userService.findUserByUsername(likeOwner)).thenReturn(of(liker)); pushNotificationEventHandler.sendLikeNotificationToPostAuthor(postLikedEvent); verify(mailService, atLeastOnce()).sendLikedPostNotificationMail( new MailParameter(author, liker, summary, postUrl)); }

Target:
public void shouldSendEmailToAuthorIfIsNotConnected() { Post likedPost = mock(Post.class); String postOwner = "postOwner"; String likeOwner = "likeOwner"; String summary = "blabla"; LikePostEvent postLikedEvent = new LikePostEvent(likedPost, likeOwner); User liker = new User(likeOwner); User author = new User(postOwner); Long postId = new Long(928839); String postUrl = new String("<LINK_0>"); when(likedPost.getAuthor()).thenReturn(author); when(likedPost.summary()).thenReturn(summary); when(likedPost.getId()).thenReturn(postId); when(connectedUserService.isConnected(postOwner)).thenReturn(false); when(userService.findUserByUsername(likeOwner)).thenReturn(of(liker)); pushNotificationEventHandler.sendLikeNotificationToPostAuthor(postLikedEvent); verify(mailService, atLeastOnce()).sendLikedPostNotificationMail( new MailParameter(author, liker, summary, postUrl)); }
Source:
private static String getTracePath(String projectName, String traceName, Boolean isExperiment) { String separator = "/"; StringJoiner filePath = new StringJoiner(separator, separator, separator); filePath.add(projectName); String childrenName = isExperiment ? "Experiments" : "Traces"; filePath.add(childrenName); filePath.add(traceName); return filePath.toString(); }

Target:
private static String getTracePath(String projectName, String traceName, Boolean isExperiment) { String separator = "/"; StringJoiner filePath = new StringJoiner(separator, separator, separator); filePath.add(projectName); String childrenName = isExperiment ? "Experiments" : "Traces"; filePath.add(childrenName); filePath.add(traceName); return String.valueOf(filePath); }
Source:
public void testVariantClear() { System.out.println("------------------------------------------"); VARIANT variant = new VARIANT(new SHORT(33333)); HRESULT hr = OleAuto.INSTANCE.VariantClear(variant.getPointer()); assertTrue("hr: " + hr.intValue(), hr.intValue() == 0); System.out.println(variant.toString(true)); System.out.println("------------------------------------------"); }

Target:
public void testVariantClear() { VARIANT variant = new VARIANT(new SHORT(33333)); HRESULT hr = OleAuto.INSTANCE.VariantClear(variant.getPointer()); assertTrue("hr: " + hr.intValue(), hr.intValue() == 0); }
Source:
public static ArrayList<Guid> getStorageIdList(String storageIds) { ArrayList<String> storageStringList = splitStringList(storageIds); ArrayList<Guid> storageGuidsList = new ArrayList<Guid>(); if (!(storageStringList == null || storageStringList.isEmpty())) { for (String storageGuidString : storageStringList) { storageGuidsList.add(Guid.createGuidFromString(storageGuidString)); } } if (storageGuidsList.isEmpty()) { storageGuidsList.add(Guid.Empty); } return storageGuidsList; }

Target:
public static ArrayList<Guid> getStorageIdList(String storageIds) { ArrayList<String> storageStringList = splitStringList(storageIds); ArrayList<Guid> storageGuidsList = new ArrayList<Guid>(); if (storageStringList != null) { for (String storageGuidString : storageStringList) { storageGuidsList.add(Guid.createGuidFromString(storageGuidString)); } } if (storageGuidsList.isEmpty()) { storageGuidsList.add(Guid.Empty); } return storageGuidsList; }
Source:
public String getPrettySize(long bytes){ double oneKB = 1024; double oneMB = oneKB * 1024; double oneGB = oneMB * 1014; double oneTB = oneGB * 1024; double onePB = oneTB * 1024; if (bytes/oneKB < 1){ return String.format("%.3f", bytes) + " bytes"; } if (bytes/oneMB < 1){ return String.format("%.3f", bytes/oneKB) + " KB"; } if (bytes/oneGB < 1){ return String.format("%.3f", bytes/oneMB) + " MB"; } if (bytes/oneTB < 1){ return String.format("%.3f", bytes/oneGB) + " GB"; } return String.valueOf(bytes/onePB) + " PB"; }

Target:
public String getPrettySize(long bytes){ if (bytes/ONE_KB < 1){ return String.format("%d", bytes) + " bytes"; } if (bytes/ONE_MB < 1){ return String.format("%.3f", bytes/ONE_KB) + " KB"; } if (bytes/ONE_GB < 1){ return String.format("%.3f", bytes/ONE_MB) + " MB"; } if (bytes/ONE_TB < 1){ return String.format("%.3f", bytes/ONE_GB) + " GB"; } if (bytes/ONE_PB < 1){ return String.format("%.3f", bytes/ONE_TB) + " TB"; } return String.format("%.3f", bytes/ONE_PB) + " PB"; }
Source:
private void assignSplits() { final Iterator<Integer> awaitingReader = readersAwaitingSplit.iterator(); while (awaitingReader.hasNext()) { final int awaitingSubtask = awaitingReader.next(); final Optional<FileSourceSplit> nextSplit = splitAssigner.getNext(null); if (nextSplit.isPresent()) { context.assignSplit(nextSplit.get(), awaitingSubtask); awaitingReader.remove(); } else { break; } } }

Target:
private void assignSplits() { final Iterator<Map.Entry<Integer, String>> awaitingReader = readersAwaitingSplit.entrySet().iterator(); while (awaitingReader.hasNext()) { final Map.Entry<Integer, String> nextAwaiting = awaitingReader.next(); final String hostname = nextAwaiting.getValue(); final int awaitingSubtask = nextAwaiting.getKey(); final Optional<FileSourceSplit> nextSplit = splitAssigner.getNext(hostname); if (nextSplit.isPresent()) { context.assignSplit(nextSplit.get(), awaitingSubtask); awaitingReader.remove(); } else { break; } } }
Source:
public Connection getConnection() throws SQLException { String username = config.getString(JdbcSourceConnectorConfig.CONNECTION_USER_CONFIG); Password dbPassword = config.getPassword(JdbcSourceConnectorConfig.CONNECTION_PASSWORD_CONFIG); Properties properties = new Properties(); if (username != null) { properties.setProperty("user", username); } if (dbPassword != null) { properties.setProperty("password", dbPassword.value()); } properties = addConnectionProperties(properties); DriverManager.setLoginTimeout(60); Connection connection = DriverManager.getConnection(jdbcUrl, properties); if (jdbcDriverInfo == null) { jdbcDriverInfo = createJdbcDriverInfo(connection); } connections.add(connection); return connection; }

Target:
public Connection getConnection() throws SQLException { String username = config.getString(JdbcSourceConnectorConfig.CONNECTION_USER_CONFIG); Password dbPassword = config.getPassword(JdbcSourceConnectorConfig.CONNECTION_PASSWORD_CONFIG); Properties properties = new Properties(); if (username != null) { properties.setProperty("user", username); } if (dbPassword != null) { properties.setProperty("password", dbPassword.value()); } properties = addConnectionProperties(properties); DriverManager.setLoginTimeout(40); Connection connection = DriverManager.getConnection(jdbcUrl, properties); if (jdbcDriverInfo == null) { jdbcDriverInfo = createJdbcDriverInfo(connection); } connections.add(connection); return connection; }
Source:
private static ThreadPoolType initThreadPoolType(Properties properties, String property, ThreadPoolType defaultValue) { SecurityManager security = System.getSecurityManager(); if (security != null) { try { security.checkPermission(new java.lang.RuntimePermission("modifyThreadGroup")); } catch (java.security.AccessControlException e) { return ThreadPoolType.SINGLE_THREAD; } } if (properties == null || properties.get(property) == null) { return defaultValue; } String value = properties.getProperty(property); try { return ThreadPoolType.valueOf(value); } catch (Exception e) { throw BootstrapLogger.LOG.invalidThreadPoolType(value); } }

Target:
private static ThreadPoolType initThreadPoolType(Properties properties, String property, ThreadPoolType defaultValue) { if (properties == null || properties.get(property) == null) { return defaultValue; } String value = properties.getProperty(property); try { return ThreadPoolType.valueOf(value); } catch (Exception e) { throw BootstrapLogger.LOG.invalidThreadPoolType(value); } }
Source:
public void setAddress(String addr) { if (null == address) { final EndpointReferenceType reference = new EndpointReferenceType(); final AttributedURIType a = new AttributedURIType(); a.setValue("/"); reference.setAddress(a); address = reference; } else { EndpointReferenceUtils.setAddress(address, addr); } }

Target:
public void setAddress(String addr) { if (null == address) { final EndpointReferenceType reference = new EndpointReferenceType(); final AttributedURIType a = new AttributedURIType(); a.setValue(addr); reference.setAddress(a); address = reference; } else { final AttributedURIType a = new AttributedURIType(); a.setValue(addr); address.setAddress(a); } }
Source:
private Ordering<Row> makeComparator( List<DimensionSpec> dimensions, List<AggregatorFactory> aggs, List<PostAggregator> postAggs ) { Ordering<Row> ordering = new Ordering<Row>() { @Override public int compare(Row left, Row right) { return Longs.compare(left.getTimestampFromEpoch(), right.getTimestampFromEpoch()); } }; Map<String, Object> possibleOrderDims = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); for (DimensionSpec spec : dimensions) { possibleOrderDims.put(spec.getOutputName(), spec); } for (final AggregatorFactory agg : aggs) { possibleOrderDims.put(agg.getName(), agg); } for (PostAggregator postAgg : postAggs) { possibleOrderDims.put(postAgg.getName(), postAgg); } for (OrderByColumnSpec columnSpec : columns) { String dimension = columnSpec.getDimension(); Object dimObj = possibleOrderDims.get(dimension); if (dimObj == null) { throw new ISE("Unknown column in order clause[%s]", columnSpec); } Ordering<Row> nextOrdering; if (dimObj instanceof DimensionSpec) { nextOrdering = dimensionOrdering(dimension, columnSpec.asNumber()); } else if (dimObj instanceof AggregatorFactory) { nextOrdering = metricOrdering(dimension, ((AggregatorFactory) dimObj).getComparator()); } else { nextOrdering = metricOrdering(dimension, ((PostAggregator) dimObj).getComparator()); } switch (columnSpec.getDirection()) { case DESCENDING: nextOrdering = nextOrdering.reverse(); } ordering = ordering.compound(nextOrdering); } return ordering; }

Target:
private Ordering<Row> makeComparator( List<DimensionSpec> dimensions, List<AggregatorFactory> aggs, List<PostAggregator> postAggs ) { Ordering<Row> ordering = new Ordering<Row>() { @Override public int compare(Row left, Row right) { return Longs.compare(left.getTimestampFromEpoch(), right.getTimestampFromEpoch()); } }; Map<String, Function<OrderByColumnSpec, Ordering<Row>>> possibleOrderDims = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); for (final DimensionSpec spec : dimensions) { possibleOrderDims.put( spec.getOutputName(), dimensionOrdering(spec.getOutputName()) ); } for (final AggregatorFactory agg : aggs) { possibleOrderDims.put( agg.getName(), metricOrdering(agg.getName(), agg.getComparator()) ); } for (final PostAggregator postAgg : postAggs) { possibleOrderDims.put( postAgg.getName(), metricOrdering(postAgg.getName(), postAgg.getComparator()) ); } for (OrderByColumnSpec columnSpec : columns) { Function<OrderByColumnSpec, Ordering<Row>> genOrderingFunc = possibleOrderDims.get(columnSpec.getDimension()); if (genOrderingFunc == null) { throw new ISE("Unknown column in order clause[%s]", columnSpec); } Ordering<Row> nextOrdering = genOrderingFunc.apply(columnSpec); switch (columnSpec.getDirection()) { case DESCENDING: nextOrdering = nextOrdering.reverse(); } ordering = ordering.compound(nextOrdering); } return ordering; }
Source:
public void saveFile() throws IOException { File file = new File("src/test/resources/testmetaOldFormat.xml"); testMetaOldFormat = FileReader.readFileToByteArray(file); }

Target:
public void saveFile() throws IOException { File file = new File("src/test/resources/testmetaOldFormat.xml"); testMetaOldFormat = IOUtils.toByteArray(file.toURI()); }
Source:
public void complete(ITextViewer viewer, int completionPosition, ICompilationUnit compilationUnit) { IDocument document = viewer.getDocument(); if (!(getContextType() instanceof JavaPostfixContextType)) return; Point selection = viewer.getSelectedRange(); String selectedText = null; if (selection.y != 0) { return; } JavaPostfixContext context = ((JavaPostfixContextType) getContextType()).createContext(document, completionPosition, selection.y, compilationUnit, currentNode, parentNode); context.setVariable("selection", selectedText); int start = context.getStart(); int end = context.getEnd(); IRegion region = new Region(start, end - start); Template[] templates = JavaPlugin.getDefault().getTemplateStore().getTemplates(getContextType().getId()); for (int i = 0; i != templates.length; i++) { Template template = templates[i]; if (context.canEvaluate(template)) { getProposals().add(new PostfixTemplateProposal(template, context, region, getImage())); } } }

Target:
public void complete(ITextViewer viewer, int completionPosition, ICompilationUnit compilationUnit) { IDocument document = viewer.getDocument(); if (!(getContextType() instanceof JavaPostfixContextType)) return; Point selection = viewer.getSelectedRange(); String selectedText = null; if (selection.y != 0) { return; } JavaPostfixContext context = ((JavaPostfixContextType) getContextType()).createContext(document, completionPosition, selection.y, compilationUnit, currentNode, parentNode); context.setVariable("selection", selectedText); int start = context.getStart(); int end = context.getEnd(); IRegion region = new Region(start, end - start); Template[] templates = JavaPlugin.getDefault().getTemplateStore().getTemplates(getContextType().getId()); for (Template template : templates) { if (context.canEvaluate(template)) { getProposals().add(new PostfixTemplateProposal(template, context, region, getImage())); } } }
Source:
public JensenShannonDistance() { base = null; }

Target:
public JensenShannonDistance() { base = Math.E; }