auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public RecordReader<NullWritable, StructuredRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { if (!(split instanceof FileSplit)) { throw new IllegalStateException("Input split is not a FileSplit."); } FileSplit fileSplit = (FileSplit) split; String pathField = context.getConfiguration().get(PATH_FIELD); boolean filenameOnly = context.getConfiguration().getBoolean(FILENAME_ONLY, false); String format = context.getConfiguration().get(FORMAT); String path = filenameOnly ? fileSplit.getPath().getName() : fileSplit.getPath().toUri().toString(); String schema = context.getConfiguration().get(SCHEMA); if ("avro".equalsIgnoreCase(format)) { RecordReader<AvroKey<GenericRecord>, NullWritable> delegate = (new AvroKeyInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingAvroRecordReader(delegate, pathField, path, Schema.parseJson(schema)); } else if ("parquet".equalsIgnoreCase(format)) { RecordReader<Void, GenericRecord> delegate = (new AvroParquetInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingParquetRecordReader(delegate, pathField, path, Schema.parseJson(schema)); } else { RecordReader<LongWritable, Text> delegate = (new TextInputFormat()).createRecordReader(split, context); return new TrackingTextRecordReader(delegate, pathField, path, getTextOutputSchema(pathField)); } }

Target:
public RecordReader<NullWritable, StructuredRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { if (!(split instanceof FileSplit)) { throw new IllegalStateException("Input split is not a FileSplit."); } FileSplit fileSplit = (FileSplit) split; String pathField = context.getConfiguration().get(PATH_FIELD); boolean filenameOnly = context.getConfiguration().getBoolean(FILENAME_ONLY, false); String format = context.getConfiguration().get(FORMAT); String path = filenameOnly ? fileSplit.getPath().getName() : fileSplit.getPath().toUri().toString(); String schema = context.getConfiguration().get(SCHEMA); Schema parsedSchema = Schema.parseJson(schema); if ("avro".equalsIgnoreCase(format)) { RecordReader<AvroKey<GenericRecord>, NullWritable> delegate = (new AvroKeyInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingAvroRecordReader(delegate, pathField, path, parsedSchema); } else if ("parquet".equalsIgnoreCase(format)) { RecordReader<Void, GenericRecord> delegate = (new AvroParquetInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingParquetRecordReader(delegate, pathField, path, parsedSchema); } else { RecordReader<LongWritable, Text> delegate = (new TextInputFormat()).createRecordReader(split, context); return new TrackingTextRecordReader(delegate, pathField, path, parsedSchema); } }
Source:
public void onMessage(Message message) { MessageProperties messageProperties = message.getMessageProperties(); if (messageProperties != null) { byte[] correlationId = messageProperties.getCorrelationId(); if (correlationId != null) { if (logger.isDebugEnabled()) { logger.debug("onMessage: " + message); } RabbitFuture<?> future = this.pending.remove(new String(correlationId, this.charset)); if (future != null) { if (future instanceof AsyncRabbitTemplate.RabbitConverterFuture) { Object converted = this.template.getMessageConverter().fromMessage(message); ((RabbitConverterFuture<Object>) future).set(converted); } else { ((RabbitMessageFuture) future).set(message); } } else { if (logger.isDebugEnabled()) { logger.debug("No pending reply - perhaps timed out"); } } } } }

Target:
public void onMessage(Message message) { MessageProperties messageProperties = message.getMessageProperties(); if (messageProperties != null) { byte[] correlationId = messageProperties.getCorrelationId(); if (correlationId != null) { if (logger.isDebugEnabled()) { logger.debug("onMessage: " + message); } RabbitFuture<?> future = this.pending.remove(new String(correlationId, this.charset)); if (future != null) { if (future instanceof AsyncRabbitTemplate.RabbitConverterFuture) { Object converted = this.template.getMessageConverter().fromMessage(message); ((RabbitConverterFuture<Object>) future).set(converted); } else { ((RabbitMessageFuture) future).set(message); } } else { if (logger.isWarnEnabled()) { logger.warn("No pending reply - perhaps timed out: " + message); } } } } }
Source:
protected boolean canRunActions(ArrayList<VdcReturnValueBase> returnValues) { if (getCommands().size() == 1) { CorrelationIdTracker.setCorrelationId(getCommands().get(0).getCorrelationId()); returnValues.add(getCommands().get(0).canDoActionOnly()); } else { checkCanDoActionsAsynchronously(returnValues); } if (isRunOnlyIfAllCanDoPass) { for (VdcReturnValueBase value : returnValues) { if (!value.getCanDoAction()) { return false; } } } return true; }

Target:
private boolean canRunActions(ArrayList<VdcReturnValueBase> returnValues) { if (getCommands().size() == 1) { CorrelationIdTracker.setCorrelationId(getCommands().get(0).getCorrelationId()); returnValues.add(getCommands().get(0).canDoActionOnly()); } else { checkCanDoActionsAsynchronously(returnValues); } if (isRunOnlyIfAllCanDoPass) { for (VdcReturnValueBase value : returnValues) { if (!value.getCanDoAction()) { return false; } } } return true; }
Source:
public static JSONArray getJsonArrayDuplicateDataNodes(int dataNodeCount, String hostname, int basePort, HardwareState hardwareState, JSONArray disks) throws JSONException { JSONArray jsonArray = new JSONArray(); for (int i = 0; i < dataNodeCount; ++i) { jsonArray.put(getJsonDataNode(hostname, basePort + i, hardwareState, disks)); } return jsonArray; }

Target:
public static JSONArray getJsonArrayDuplicateDataNodes(int dataNodeCount, String hostname, int basePort, HardwareState hardwareState, JSONArray disks) throws JSONException { JSONArray jsonArray = new JSONArray(); for (int i = 0; i < dataNodeCount; ++i) { jsonArray.put(getJsonDataNode(hostname, basePort, hardwareState, disks)); } return jsonArray; }
Source:
public void checkChunksForPlayback() { try { int chunkCount = this.packetizerCupertino.getChunkCount(); logger.info("Stream: [" + this.streamName + "] contains [" + chunkCount + "] chunks"); if (chunkCount >= readyForPlaybackMinimumChunkCount) { logger.info("Raising STREAM_READY_FOR_PLAYBACK event"); raiseReadyForPlaybackEvent(); } } catch (Exception err) { logger.error(err); } }

Target:
public void checkChunksForPlayback() { try { int chunkCount = this.packetizerCupertino.getChunkCount(); logger.info("Stream contains [" + chunkCount + "] chuncks"); if (chunkCount >= readyForPlaybackMinimumChunkCount) { logger.info("Raising STREAM_READY_FOR_PLAYBACK event"); raiseReadyForPlaybackEvent(); } } catch (Exception err) { logger.error(err); } }
Source:
public void component2(Span span) { try (Span component2Span = getTracer().buildSpan("Component2") .addReference(References.FOLLOWS_FROM, span.context()) .withTag("sql", "INSERT order INTO Orders") .withTag("component", "database") .start()) { try { synchronized (this) { wait(500); } } catch (Exception e) { e.printStackTrace(); } callService(component2Span); delay(500); } }

Target:
public void component2(Span span) { try (Span component2Span = getTracer().buildSpan("Component2") .addReference(References.FOLLOWS_FROM, span.context()) .withTag("sql", "INSERT order INTO Orders") .withTag("component", "database") .start()) { delay(500); callService(component2Span); delay(500); } }
Source:
public void testAsSet_ignoresPermutations() { assertEquals( asSet(new MetricTarget[]{MANAGEMENT_CENTER}), asSet(new MetricTarget[]{MANAGEMENT_CENTER, MANAGEMENT_CENTER}) ); assertEquals( asSet(new MetricTarget[]{JMX, MANAGEMENT_CENTER}), asSet(new MetricTarget[]{MANAGEMENT_CENTER, JMX}) ); }

Target:
public void testAsSet_ignoresPermutations() { assertSame( MetricTarget.asSet(new MetricTarget[]{MANAGEMENT_CENTER}), MetricTarget.asSet(new MetricTarget[]{MANAGEMENT_CENTER, MANAGEMENT_CENTER}) ); assertSame( MetricTarget.asSet(new MetricTarget[]{JMX, MANAGEMENT_CENTER}), MetricTarget.asSet(new MetricTarget[]{MANAGEMENT_CENTER, JMX}) ); }
Source:
private static Set<Object> getSelectionContents( @NonNull IStructuredSelection selection) { Set<Object> result = new HashSet<>(); for (Object o : selection.toList()) { IResource resource = AdapterUtils.adapt(o, IResource.class); if (addResource(resource, result)) { continue; } ResourceMapping mapping = AdapterUtils.adapt(o, ResourceMapping.class); if (mapping != null) { for (IResource r : extractResourcesFromMapping(mapping)) { addResource(r, result); } } else { IPath location = AdapterUtils.adapt(o, IPath.class); if (location != null) { result.add(location); } } } return result; }

Target:
private static Set<Object> getSelectionContents( @NonNull IStructuredSelection selection) { Set<Object> result = new HashSet<>(); for (Object o : selection.toList()) { IResource resource = AdapterUtils.adapt(o, IResource.class); if (resource != null) { result.add(resource); continue; } ResourceMapping mapping = AdapterUtils.adapt(o, ResourceMapping.class); if (mapping != null) { result.addAll(extractResourcesFromMapping(mapping)); } else { IPath location = AdapterUtils.adapt(o, IPath.class); if (location != null) { result.add(location); } } } return result; }
Source:
private List<String> findBlockMatches(String searchLowercase) { ResourceUrn curUrn; List<String> l=new ArrayList<String>(); for (ResourceUrn urn : assetManager.getAvailableAssets(BlockFamilyDefinition.class)) { curUrn = urn; try{ Optional<BlockFamilyDefinition> def = assetManager.getAsset(urn, BlockFamilyDefinition.class); if (def.isPresent() && def.get().isLoadable() && matchesSearch(searchLowercase, def.get())) { String s = new BlockUri(def.get().getUrn()).toString(); l.add(s); } } catch(Exception e){ List<String> EmptyList=new ArrayList<String>(); console.addMessage("Note : Search may not return results if invalid assets are present"); console.addMessage("Error parsing : "+curUrn.toString()); console.addMessage(e.toString()); return(EmptyList); } } return l; }

Target:
private List<String> findBlockMatches(String searchLowercase) { ResourceUrn curUrn; List<String> outputList=new ArrayList<String>(); for (ResourceUrn urn : assetManager.getAvailableAssets(BlockFamilyDefinition.class)) { curUrn = urn; try{ Optional<BlockFamilyDefinition> def = assetManager.getAsset(urn, BlockFamilyDefinition.class); if (def.isPresent() && def.get().isLoadable() && matchesSearch(searchLowercase, def.get())) { outputList.add(new BlockUri(def.get().getUrn()).toString()); } } catch(Exception e){ console.addMessage("Note : Search may not return results if invalid assets are present"); console.addMessage("Error parsing : "+curUrn.toString()); console.addMessage(e.toString()); continue; } } return outputList; }
Source:
public Vector3d getSize(Vector3d dest) { return dest.set(maxX - minX, maxY - minY, maxZ - minZ); }

Target:
public Vector3d getSize(Vector3d dest) { return dest.set(lengthX(), lengthY(), lengthZ()); }
Source:
public static boolean isPublishDateInTheFuture(String dateCreated) { Date pubDate = DateTimeUtils.dateFromIso8601(dateCreated); Date now = new Date(); return pubDate != null && pubDate.after(now); }

Target:
public static boolean isPublishDateInTheFuture(String dateCreated) { return isPublishDateInTheFuture(dateCreated, new Date()); }
Source:
public synchronized void stopStats() { if (statsTask != null) { if (statsTask.cancel(true)) { statsTask = null; } else { log.error("Statistics task was not cancelled"); } Utils.shutdownAndWait(executor); if (!executor.isTerminated()) { log.warn("Failed to terminate statistics executor service."); } this.executor = null; this.statsTask = null; } if (sizeThread != null) { log.debug("Interrupting size thread"); sizeThread.interrupt(); try { sizeThread.join(); } catch (InterruptedException e) { log.error("Interrupted while waiting for stat thread to end."); sizeThread.interrupt(); } sizeThread = null; } }

Target:
public synchronized void stopStats() { if (statsTask != null) { if (statsTask.cancel(true)) { statsTask = null; } else { log.error("Statistics task was not cancelled"); } Utils.shutdownAndWait(executor); if (!executor.isTerminated()) { log.warn("Failed to terminate statistics executor service."); } this.statsTask = null; this.executor = Executors.newScheduledThreadPool(1); } if (sizeThread != null) { log.debug("Interrupting size thread"); sizeThread.interrupt(); try { sizeThread.join(); } catch (InterruptedException e) { log.error("Interrupted while waiting for stat thread to end."); sizeThread.interrupt(); } sizeThread = null; } }
Source:
private void pullOrganisationCredentials() { Credentials orgUnitCredentials = null; try { OrganisationUnit orgUnit = mOrgUnitDataSource.getUserOrgUnit(insertedCredentials); if (orgUnit == null) { notifyInvalidCredentials(); return; } orgUnitCredentials = new Credentials(insertedCredentials.getServerURL(), orgUnit.getCode(), orgUnit.getPin()); } catch (ApiCallException e) { if(e.getCause() instanceof IOException){ notifyUnexpectedError(); }else { e.printStackTrace(); notifyConfigJsonNotPresent(); } } catch (NetworkException e) { e.printStackTrace(); checkUserCredentialsWithOrgUnit( mCredentialsLocalDataSource.getOrganisationCredentials(), true); } if (orgUnitCredentials != null) { mCredentialsLocalDataSource.saveOrganisationCredentials(orgUnitCredentials); } checkUserCredentialsWithOrgUnit(orgUnitCredentials, false); }

Target:
private void pullOrganisationCredentials() { Credentials orgUnitCredentials = null; try { OrganisationUnit orgUnit = mOrgUnitDataSource.getUserOrgUnit(insertedCredentials); if (orgUnit == null) { notifyInvalidCredentials(); return; } orgUnitCredentials = new Credentials(insertedCredentials.getServerURL(), orgUnit.getCode(), orgUnit.getPin()); } catch (ApiCallException e) { if(e.getCause() instanceof IOException){ notifyUnexpectedError(); }else { e.printStackTrace(); notifyConfigJsonNotPresent(); } } catch (NetworkException e) { e.printStackTrace(); checkUserCredentialsWithOrgUnit( mCredentialsLocalDataSource.getOrganisationCredentials(), true); } if (orgUnitCredentials != null) { mCredentialsLocalDataSource.saveOrganisationCredentials(orgUnitCredentials); checkUserCredentialsWithOrgUnit(orgUnitCredentials, false); } else { notifyUnexpectedError(); } }
Source:
private DefaultScoredCandidates.Builder findByCommonAlias( T subject, DefaultScoredCandidates.Builder equivalents, ResultDescription desc ) { desc.startStage("Resolving Barb Aliases:"); subject.getAliasUrls().forEach(alias -> desc.appendText(alias)); desc.finishStage(); Set<Iterable<LookupEntry>> entriesSet = subject.getAliases().stream().map(alias -> { Iterable<LookupEntry> entries = lookupEntryStore.entriesForAliases( Optional.of(alias.getNamespace()), ImmutableSet.of(alias.getValue()) ); return entries; }).collect(Collectors.toSet()); entriesSet.forEach(iterableLookupEntry -> { iterableLookupEntry.forEach(entry -> { Identified identified = resolver.findByCanonicalUris( ImmutableSet.of(entry.uri()) ).getFirstValue().requireValue(); if (identified.getAliasUrls().size() !=0) { boolean match = false; for (String alias : identified.getAliasUrls()) { if (subject.getAliasUrls().contains(alias)) { match = true; } } if (match) { equivalents.addEquivalent((T) identified, Score.ONE); desc.appendText("Resolved %s", identified.getCanonicalUri()); } } }); }); return equivalents; }

Target:
private DefaultScoredCandidates.Builder findByCommonAlias( T subject, DefaultScoredCandidates.Builder equivalents, ResultDescription desc ) { desc.startStage("Resolving Barb Aliases:"); subject.getAliasUrls().forEach(alias -> desc.appendText(alias)); desc.finishStage(); Set<Iterable<LookupEntry>> entriesSet = subject.getAliases().stream().map(alias -> lookupEntryStore.entriesForAliases( Optional.of(alias.getNamespace()), ImmutableSet.of(alias.getValue()) )).collect(Collectors.toSet()); entriesSet.forEach(iterableLookupEntry -> { iterableLookupEntry.forEach(entry -> { Identified identified = resolver.findByCanonicalUris( ImmutableSet.of(entry.uri()) ).getFirstValue().requireValue(); if (identified.getAliasUrls().isEmpty()) { boolean match = false; for (String alias : identified.getAliasUrls()) { if (subject.getAliasUrls().contains(alias)) { match = true; break; } } if (match) { equivalents.addEquivalent((T) identified, Score.ONE); desc.appendText("Resolved %s", identified.getCanonicalUri()); } } }); }); return equivalents; }
Source:
private static void checkFile(final ModelRepository modelRepo, final File file, final Kind kind) { if (modelRepo != null && file != null) { try { synchronized (FolderObserver.class) { if ((kind == ENTRY_CREATE || kind == ENTRY_MODIFY)) { if (parsers.contains(getExtension(file.getName()))) { try (FileInputStream inputStream = FileUtils.openInputStream(file)) { modelRepo.addOrRefreshModel(file.getName(), inputStream); } } else { ignoredFiles.add(file); } } else if (kind == ENTRY_DELETE) { modelRepo.removeModel(file.getName()); } } } catch (Exception e) { LoggerFactory.getLogger(FolderObserver.class).error( "Error handling update of file '" + file.getAbsolutePath() + "': {}.", e.getMessage(), e); } } }

Target:
private static void checkFile(final ModelRepository modelRepo, final File file, final Kind kind) { if (modelRepo != null && file != null) { try { synchronized (FolderObserver.class) { if ((kind == ENTRY_CREATE || kind == ENTRY_MODIFY)) { if (parsers.contains(getExtension(file.getName()))) { try (FileInputStream inputStream = FileUtils.openInputStream(file)) { modelRepo.addOrRefreshModel(file.getName(), inputStream); } } else { ignoredFiles.add(file); } } else if (kind == ENTRY_DELETE) { modelRepo.removeModel(file.getName()); } } } catch (Exception e) { LoggerFactory.getLogger(FolderObserver.class).error("Error handling update of file '{}': {}.", file.getAbsolutePath(), e.getMessage(), e); } } }
Source:
default <R> ReactiveSeq<R> retry(final Function<? super T, ? extends R> fn, final int retries, final long delay, final TimeUnit timeUnit) { final Function<T, R> retry = t -> { final long[] sleep = { timeUnit.toMillis(delay) }; Throwable exception = null; for (int count = retries; count >=0; count--) { try { return fn.apply(t); } catch (final Throwable e) { exception = e; ExceptionSoftener.softenRunnable(() -> Thread.sleep(sleep[0])) .run(); sleep[0] = sleep[0] * 2; } } ExceptionSoftener.throwSoftenedException(exception); return null; }; return map(retry); }

Target:
default <R> ReactiveSeq<R> retry(final Function<? super T, ? extends R> fn, final int retries, final long delay, final TimeUnit timeUnit) { return (ReactiveSeq) FoldableTraversable.super.retry(fn, retries, delay, timeUnit); }
Source:
public ResponseEntity<?> syndicate(HttpServletRequest request, @RequestParam(value = "revision", required = false) Integer revisionNumber) throws IOException { ArticleVersionIdentifier versionId = getArticleVersionIdentifier(request, revisionNumber); SyndicationInputView input = readJsonFromRequest(request, SyndicationInputView.class); Syndication created = syndicationCrudService.syndicate(versionId, input.getTarget()); return reportOk(created.toString()); }

Target:
public ResponseEntity<Object> syndicate(HttpServletRequest request, @RequestParam(value = "revision", required = false) Integer revisionNumber) throws IOException { ArticleVersionIdentifier versionId = getArticleVersionIdentifier(request, revisionNumber); SyndicationInputView input = readJsonFromRequest(request, SyndicationInputView.class); Syndication created = syndicationCrudService.syndicate(versionId, input.getTarget()); return reportOk(created.toString()); }
Source:
public void onDestroyView() { mapView.onDestroy(); mapboxMap = null; unbinder.unbind(); unbinder = null; WikipediaApp.getInstance().getRefWatcher().watch(this); super.onDestroyView(); }

Target:
public void onDestroyView() { mapView.onDestroy(); mapboxMap = null; unbinder.unbind(); unbinder = null; super.onDestroyView(); }
Source:
private boolean isNewerVersion(Version isoClusterVersion) { VDS vds = getVdsByVdsId(getParameters().getVdsId()); Version vdsClusterVersion = vds.getVdsGroupCompatibilityVersion(); log.debugFormat( "cluster major {0} minor {1} iso major {2} minor {3}", vdsClusterVersion.getMajor(), vdsClusterVersion.getMinor(), isoClusterVersion.getMajor(), isoClusterVersion.getMinor() ); return (vdsClusterVersion.getMajor() == isoClusterVersion.getMajor() && vdsClusterVersion.getMinor() <= isoClusterVersion.getMinor()); }

Target:
private boolean isNewerVersion(Version isoClusterVersion) { VDS vds = getVdsByVdsId(getParameters().getVdsId()); Version vdsClusterVersion = vds.getVdsGroupCompatibilityVersion(); log.debugFormat( "vdsClusterVersion {0} isoClusterVersion {1}", vdsClusterVersion.toString(), isoClusterVersion.toString() ); return (vdsClusterVersion.getMajor() == isoClusterVersion.getMajor() && vdsClusterVersion.getMinor() <= isoClusterVersion.getMinor()); }
Source:
public double overnightIndexRate(OvernightIndex index, LocalDate fixingDate) { ArgChecker.notNull(index, "index"); ArgChecker.notNull(fixingDate, "fixingDate"); if (!fixingDate.isAfter(valuationDate)) { OptionalDouble fixedRate = timeSeries(index).get(fixingDate); if (fixedRate.isPresent()) { return fixedRate.getAsDouble(); } else if (fixingDate.isBefore(valuationDate)) { throw new PricingException(Messages.format("Unable to get fixing for on date {}", index, fixingDate)); } } LocalDate fixingStartDate = index.calculateEffectiveFromFixing(fixingDate); LocalDate fixingEndDate = index.calculateMaturityFromEffective(fixingStartDate); double fixingYearFraction = index.getDayCount().yearFraction(fixingStartDate, fixingEndDate); return multicurve.getSimplyCompoundForwardRate( Legacy.overnightIndex(index), relativeTime(fixingStartDate), relativeTime(fixingEndDate), fixingYearFraction); }

Target:
public double overnightIndexRate(OvernightIndex index, LocalDate fixingDate) { ArgChecker.notNull(index, "index"); ArgChecker.notNull(fixingDate, "fixingDate"); LocalDate publicationDate = index.calculatePublicationFromFixing(fixingDate); if (!publicationDate.isAfter(valuationDate)) { OptionalDouble fixedRate = timeSeries(index).get(fixingDate); if (fixedRate.isPresent()) { return fixedRate.getAsDouble(); } else if (publicationDate.isBefore(valuationDate)) { throw new PricingException(Messages.format("Unable to get fixing for on date {}", index, fixingDate)); } } LocalDate fixingStartDate = index.calculateEffectiveFromFixing(fixingDate); LocalDate fixingEndDate = index.calculateMaturityFromEffective(fixingStartDate); double fixingYearFraction = index.getDayCount().yearFraction(fixingStartDate, fixingEndDate); return multicurve.getSimplyCompoundForwardRate( Legacy.overnightIndex(index), relativeTime(fixingStartDate), relativeTime(fixingEndDate), fixingYearFraction); }
Source:
private void switchPortSpeed() { if (fixedPortSettings == null) { logger.debug("No fixed port setting (autodetect ENABLED), switch between specification standard settings"); if (portSettings == DSMRPortSettings.HIGH_SPEED_SETTINGS) { portSettings = DSMRPortSettings.LOW_SPEED_SETTINGS; } else { portSettings = DSMRPortSettings.HIGH_SPEED_SETTINGS; } logger.debug("Switched port settings to:" + portSettings); } else { portSettings = fixedPortSettings; logger.info("Fixed port settings configured (autodetect DISABLED):" + portSettings); } }

Target:
private void switchPortSpeed() { if (fixedPortSettings == null) { logger.debug("No fixed port setting (autodetect ENABLED), switch between specification standard settings"); if (portSettings == DSMRPortSettings.HIGH_SPEED_SETTINGS) { portSettings = DSMRPortSettings.LOW_SPEED_SETTINGS; } else { portSettings = DSMRPortSettings.HIGH_SPEED_SETTINGS; } logger.debug("Switched port settings to: {}", portSettings); } else { portSettings = fixedPortSettings; logger.info("Fixed port settings configured (autodetect DISABLED): {}", portSettings); } }
Source:
public boolean shouldPull(DockerImageName imageName) { Logger logger = DockerLoggerFactory.getLogger(imageName.toString()); ImageData imageData = LOCAL_IMAGES_CACHE.get(imageName); if (imageData != null) { logger.trace("{} is already in image name cache", imageName); } else { logger.debug("{} is not in image name cache, updating...", imageName); imageData = LOCAL_IMAGES_CACHE.refreshCache(imageName).orElse(null); } if (imageData != null && !shouldPullCached(imageName, imageData)) { return false; } log.trace("Should pull image: {}", imageName); return true; }

Target:
public boolean shouldPull(DockerImageName imageName) { Logger logger = DockerLoggerFactory.getLogger(imageName.toString()); ImageData cachedImageData = LOCAL_IMAGES_CACHE.get(imageName); if (cachedImageData != null) { logger.trace("{} is already in image name cache", imageName); } else { logger.debug("{} is not in image name cache, updating...", imageName); cachedImageData = LOCAL_IMAGES_CACHE.refreshCache(imageName).orElse(null); if (cachedImageData == null) { log.debug("Not available locally, should pull image: {}", imageName); return true; } } if (shouldPullCached(imageName, cachedImageData)) { log.debug("Should pull locally available image: {}", imageName); return true; } else { log.debug("Using locally available and not pulling image: {}", imageName); return false; } }
Source:
public Map<String, Serializable> getResultMap() { return resultMap; }

Target:
public Map<String, Serializable> getResultMap() { throw new UnsupportedOperationException(); }
Source:
public Blob resolveBlobFromDownloadUrl(String url) { String baseUrl = getBaseDownloadUrl(url); if (!baseUrl.equals(Framework.getProperty("nuxeo.url"))) { return null; } String uri = url.substring(baseUrl.length() + 1); Pair<String, String> pair = getDownloadPathAndActionFromUri(uri); if (pair == null) { return null; } String path = pair.getLeft(); Map<String, String> parsedUrl = parseDownloadPath(path); if (parsedUrl == null) { return null; } DocumentModel doc = getDownloadDocument(parsedUrl.get("repository"), parsedUrl.get("docId")); if (doc == null) { return null; } return resolveBlob(doc, parsedUrl.get("xpath")); }

Target:
public Blob resolveBlobFromDownloadUrl(String url) { String nuxeoUrl = Framework.getProperty("nuxeo.url"); if (!url.startsWith(nuxeoUrl)) { return null; } String path = url.substring(nuxeoUrl.length() + 1); Pair<String, Action> pair = getDownloadPathAndAction(path); if (pair == null) { return null; } String downloadPath = pair.getLeft(); try { DownloadBlobInfo downloadBlobInfo = new DownloadBlobInfo(downloadPath); DocumentModel doc = getDownloadDocument(downloadBlobInfo.repository, downloadBlobInfo.docId); if (doc == null) { return null; } return resolveBlob(doc, downloadBlobInfo.xpath); } catch (IllegalArgumentException e) { return null; } }
Source:
public synchronized ITmfTimestamp readEnd() { byte[] inputNameBytes = ("<" + fRecordInputElement.getInputName()).getBytes(); try { Long pos = fFile.length() - inputNameBytes.length; while (pos >= 0) { searchloop: while (pos >= 0) { fFile.seek(pos); for (byte c : inputNameBytes) { if (c != fFile.read()) { break searchloop; } } pos--; } ITmfLocation location = new TmfLongLocation(pos); ITmfContext context = seekEvent(location); ITmfEvent event = parseEvent(context); context.dispose(); if (event != null) { return event.getTimestamp(); } pos -= inputNameBytes.length; } } catch (IOException e) { return null; } return null; }

Target:
public synchronized ITmfTimestamp readEnd() { byte[] inputNameBytes = ("<" + fRecordInputElement.getElementName()).getBytes(); byte[] testBytes = new byte[inputNameBytes.length]; try { Long pos = fFile.length() - inputNameBytes.length; while (pos >= 0) { while (pos >= 0) { fFile.seek(pos); fFile.read(testBytes, 0, testBytes.length); if (Arrays.equals(inputNameBytes, testBytes)) { break; } pos--; } ITmfLocation location = new TmfLongLocation(pos); ITmfContext context = seekEvent(location); ITmfEvent event = parseEvent(context); context.dispose(); if (event != null) { return event.getTimestamp(); } pos -= inputNameBytes.length; } } catch (IOException e) { Activator.logError("Error seeking last event. File: " + getPath(), e); } return null; }
Source:
@Override public void onReadyForRead(ReadableDistributedMetaStorage metastorage) { ClusterIdAndTag idAndTag = readKey(metastorage, CLUSTER_ID_TAG_KEY, "Reading cluster ID and tag from metastorage failed, " + "default values will be generated"); if (log.isInfoEnabled()) log.info("Cluster ID and tag has been read from metastorage: " + idAndTag); if (idAndTag != null) { localClusterId = idAndTag.id(); localClusterTag = idAndTag.tag(); } }

Target:
@Override public void onReadyForRead(ReadableDistributedMetaStorage metastorage) { ClusterIdAndTag idAndTag = readKey(metastorage, CLUSTER_ID_TAG_KEY, "Reading cluster ID and tag " + "from metastorage failed, default values will be generated"); if (log.isInfoEnabled()) log.info("Cluster ID and tag has been read from metastorage: " + idAndTag); if (idAndTag != null) { localClusterId = idAndTag.id(); localClusterTag = idAndTag.tag(); } }
Source:
public void testNormalizeOnDouble() throws Exception { assertNormalize("trunc(29.1947)", isLiteral(29L)); assertNormalize("trunc(-29.1947)", isLiteral(-29L)); assertNormalize("trunc(29.1947, 0)", isFunction(TruncFunction.NAME, List.of(DataTypes.DOUBLE, DataTypes.INTEGER))); assertNormalize("trunc(cast(null as double))", isFunction(TruncFunction.NAME, List.of(DataTypes.DOUBLE))); }

Target:
public void testNormalizeOnDouble() throws Exception { assertNormalize("trunc(29.1947)", isLiteral(29L)); assertNormalize("trunc(-29.1947)", isLiteral(-29L)); assertNormalize("trunc(-29.1947, 0)", isLiteral(-29.0)); assertNormalize("trunc(29.1947, 0)", isLiteral(29.0)); assertNormalize("trunc(29.1947, 1)", isLiteral(29.1d)); assertNormalize("trunc(cast(null as double))", isLiteral(null, DataTypes.LONG)); }
Source:
public static ModelNode addRedeployStep(PathAddress address) { final ModelNode redeployOperation = new ModelNode(); redeployOperation.get(OP).set(REDEPLOY); redeployOperation.get(OP_ADDR).set(address.toModelNode()); return redeployOperation; }

Target:
private static ModelNode addRedeployStep(PathAddress address) { return Operations.createOperation(REDEPLOY, address.toModelNode()); }
Source:
void updateTopologyHandler(String topologyName, Config updateConfig) throws TopologyRuntimeManagementException, PackingException, UpdateDryRunResponse { assert !potentialStaleExecutionData; String newParallelism = updateConfig.getStringValue(RUNTIME_MANAGER_COMPONENT_PARALLELISM_KEY); String userRuntimeConfig = updateConfig.getStringValue(RUNTIME_MANAGER_RUNTIME_CONFIG_KEY); if (newParallelism != null && !newParallelism.isEmpty()) { updateTopologyComponentParallelism(topologyName, newParallelism); } else if (userRuntimeConfig != null && !userRuntimeConfig.isEmpty()) { updateTopologyUserRuntimeConfig(topologyName, userRuntimeConfig); } else { throw new TopologyRuntimeManagementException( String.format("Missing arguments. Not taking action.")); } LOG.fine("Scheduler updated topology successfully."); }

Target:
void updateTopologyHandler(String topologyName, Config updateConfig) throws TopologyRuntimeManagementException, PackingException, UpdateDryRunResponse { assert !potentialStaleExecutionData; String newParallelism = updateConfig.getStringValue(RUNTIME_MANAGER_COMPONENT_PARALLELISM_KEY); String userRuntimeConfig = updateConfig.getStringValue(RUNTIME_MANAGER_RUNTIME_CONFIG_KEY); if (newParallelism != null && !newParallelism.isEmpty() && userRuntimeConfig != null && !userRuntimeConfig.isEmpty()) { throw new TopologyRuntimeManagementException( "parallelism and runtime config can not be updated at the same time."); } if (newParallelism != null && !newParallelism.isEmpty()) { updateTopologyComponentParallelism(topologyName, newParallelism); } else if (userRuntimeConfig != null && !userRuntimeConfig.isEmpty()) { updateTopologyUserRuntimeConfig(topologyName, userRuntimeConfig); } else { throw new TopologyRuntimeManagementException("Missing arguments. Not taking action."); } LOG.fine("Scheduler updated topology successfully."); }
Source:
public void testIntersectsOnGeometryCollection() { OGCGeometry ogcGeometry = OGCGeometry.fromText("GEOMETRYCOLLECTION (POINT (1 1))"); assertTrue(ogcGeometry.intersects(OGCGeometry.fromText("POINT (1 1)"))); }

Target:
public void testIntersectsOnGeometryCollection() { OGCGeometry ogcGeometry = OGCGeometry.fromText("GEOMETRYCOLLECTION (POINT (1 1))"); assertTrue(ogcGeometry.intersects(OGCGeometry.fromText("POINT (1 1)"))); ogcGeometry = OGCGeometry.fromText("POINT (1 1)"); assertTrue(ogcGeometry.intersects(OGCGeometry.fromText("GEOMETRYCOLLECTION (POINT (1 1))"))); }
Source:
private void returnLocation() { if (location != null && (location.getLatitude() == 0d && location.getLongitude() == 0d && location.getAccuracy() == 0d)) { Toast.makeText( this, StringUtils.getStringRobust(CommCareApplication.instance(), R.string.wait_for_location_fix), Toast.LENGTH_LONG).show(); } else { Intent i = new Intent(); i.putExtra(FormEntryConstants.LOCATION_RESULT, GeoUtils.locationToString(location)); setResult(RESULT_OK, i); finish(); } }

Target:
private void returnLocation() { if (location == null || (location.getLatitude() == 0d && location.getLongitude() == 0d && location.getAccuracy() == 0d)) { Toast.makeText( this, StringUtils.getStringRobust(CommCareApplication.instance(), R.string.wait_for_location_fix), Toast.LENGTH_LONG).show(); } else { Intent i = new Intent(); i.putExtra(FormEntryConstants.LOCATION_RESULT, GeoUtils.locationToString(location)); setResult(RESULT_OK, i); finish(); } }
Source:
ChecksumResult(long rowCount, Map<String, Object> checksums) { for (Object checksum : checksums.values()) { checkArgument( checksum == null || checksum instanceof Long || checksum instanceof Double || checksum instanceof SqlVarbinary, "checksum can only be one of (null, Long, Double, SqlVarbinary), found %s", checksum == null ? "null" : checksum.getClass().getName()); } this.rowCount = rowCount; this.checksums = unmodifiableMap(requireNonNull(checksums, "checksums is null")); }

Target:
ChecksumResult(long rowCount, Map<String, Object> checksums) { this.rowCount = rowCount; this.checksums = unmodifiableMap(requireNonNull(checksums, "checksums is null")); for (Object checksum : checksums.values()) { checkArgument( checksum == null || checksum instanceof Long || checksum instanceof Double || checksum instanceof SqlVarbinary, "checksum can only be one of (null, Long, Double, SqlVarbinary), found %s", checksum == null ? "null" : checksum.getClass().getName()); } }
Source:
protected static List<Index> listIndexesInDatabase(SQLDatabase db) throws SQLException { String sqlIndexNames = String.format("SELECT DISTINCT index_name FROM %s", INDEX_METADATA_TABLE_NAME); Cursor cursorIndexNames = null; ArrayList<Index> indexes = new ArrayList<Index>(); try { cursorIndexNames = db.rawQuery(sqlIndexNames, new String[]{}); while (cursorIndexNames.moveToNext()) { String indexName = cursorIndexNames.getString(0); String sqlIndexes = String.format("SELECT index_type, field_name, index_settings FROM %s "+ "WHERE index_name = ?", INDEX_METADATA_TABLE_NAME); Cursor cursorIndexes = null; try { cursorIndexes = db.rawQuery(sqlIndexes, new String[]{indexName}); int i=0; IndexType indexType = null; String settings = null; ArrayList<FieldSort> fieldNames = new ArrayList<FieldSort>(); while (cursorIndexes.moveToNext()) { if (i++ == 0) { indexType = IndexType.enumValue(cursorIndexes.getString(0)); settings = cursorIndexes.getString(2); } fieldNames.add(new FieldSort(cursorIndexes.getString(1))); } Map<String, Object> settingsMap = JSONUtils.deserialize(settings.getBytes(Charset.forName("UTF-8"))); if (settingsMap.containsKey("tokenize") && settingsMap.get("tokenize") instanceof String) { indexes.add(new Index(fieldNames, indexName, indexType, (String)settingsMap.get("tokenize"))); } else { indexes.add(new Index(fieldNames, indexName, indexType)); } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexes); } } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexNames); } return indexes; }

Target:
protected static List<Index> listIndexesInDatabase(SQLDatabase db) throws SQLException { String sqlIndexNames = String.format("SELECT DISTINCT index_name FROM %s", INDEX_METADATA_TABLE_NAME); Cursor cursorIndexNames = null; ArrayList<Index> indexes = new ArrayList<Index>(); try { cursorIndexNames = db.rawQuery(sqlIndexNames, new String[]{}); while (cursorIndexNames.moveToNext()) { String indexName = cursorIndexNames.getString(0); String sqlIndexes = String.format("SELECT index_type, field_name, index_settings FROM %s "+ "WHERE index_name = ?", INDEX_METADATA_TABLE_NAME); Cursor cursorIndexes = null; try { cursorIndexes = db.rawQuery(sqlIndexes, new String[]{indexName}); IndexType indexType = null; String settings = null; ArrayList<FieldSort> fieldNames = new ArrayList<FieldSort>(); boolean first = true; while (cursorIndexes.moveToNext()) { if (first) { indexType = IndexType.enumValue(cursorIndexes.getString(0)); settings = cursorIndexes.getString(2); first = false; } fieldNames.add(new FieldSort(cursorIndexes.getString(1))); } Map<String, Object> settingsMap = JSONUtils.deserialize(settings.getBytes(Charset.forName("UTF-8"))); if (settingsMap.containsKey("tokenize") && settingsMap.get("tokenize") instanceof String) { indexes.add(new Index(fieldNames, indexName, indexType, (String)settingsMap.get("tokenize"))); } else { indexes.add(new Index(fieldNames, indexName, indexType)); } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexes); } } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexNames); } return indexes; }
Source:
public final void testValidOnlyInterAndRootCert(){ X509Certificate certToCheck = getTestCert("/entrust_intermediate_old.cer"); Assert.assertTrue("Our truststore should this chain of trust",certValidator.validateCert(certToCheck)); }

Target:
public final void testValidOnlyInterAndRootCert() { X509Certificate certToCheck = getTestCert("/entrust_intermediate_old.cer"); Assert.assertTrue("Our truststore should contain only intermediate and root cert", certValidator.validateCert(certToCheck)); }
Source:
boolean delayNextTimeToRun(Date timeToRunTheVm) { this.timeToRunTheVm = timeToRunTheVm; return ++numOfSkips < MAXIMUM_NUM_OF_SKIPS_BEFORE_AUTO_START_VM; }

Target:
boolean delayNextTimeToRun(Date timeToRunTheVm) { this.timeToRunTheVm = timeToRunTheVm; numOfSkips = ++numOfSkips % MAXIMUM_NUM_OF_SKIPS_BEFORE_AUTO_START_VM; return numOfSkips != 0; }
Source:
public void testCreate() throws StripeException { Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", 1); params.put("currency", "usd"); params.put("id", "sapphire-elite"); params.put("interval", "month"); params.put("name", "Sapphire Elite"); Plan plan = Plan.create(params); assertNotNull(plan); verifyRequest( APIResource.RequestMethod.POST, "/v1/plans", params ); }

Target:
public void testCreate() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", 1); params.put("currency", "usd"); params.put("id", "sapphire-elite"); params.put("interval", "month"); params.put("name", "Sapphire Elite"); final Plan plan = Plan.create(params); assertNotNull(plan); verifyRequest( APIResource.RequestMethod.POST, "/v1/plans", params ); }
Source:
public void checkResourceIsCloseable() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(1); config.setBlockWhenExhausted(false); try(JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, config, 1000, "default", "foobared", 2)){ Jedis jedis = pool.getResource(); try { jedis.set("hello", "jedis"); } finally { jedis.close(); } try (Jedis jedis2 = pool.getResource()){ assertEquals(jedis, jedis2); } } }

Target:
public void checkResourceIsCloseable() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(1); config.setBlockWhenExhausted(false); try(JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, config, 1000, "default", "foobared", 2)){ Jedis jedis; try (Jedis jedis1 = pool.getResource()){ jedis = jedis1; jedis1.set("hello", "jedis"); } try (Jedis jedis2 = pool.getResource()){ assertEquals(jedis, jedis2); } } }
Source:
private void throwLoot(SolGame game, SolItem item, boolean onDeath) { Vector2 lootVelocity = new Vector2(); float speedAngle; float speed; Vector2 position = new Vector2(); if (onDeath) { speedAngle = SolRandom.randomFloat(180); speed = SolRandom.randomFloat(0, Loot.MAX_SPD); SolMath.fromAl(position, speedAngle, SolRandom.randomFloat(myHull.config.getApproxRadius())); } else { speedAngle = getAngle(); speed = 1f; SolMath.fromAl(position, speedAngle, myHull.config.getApproxRadius()); } SolMath.fromAl(lootVelocity, speedAngle, speed); lootVelocity.add(myHull.getVelocity()); position.add(myHull.getPosition()); Loot l = game.getLootBuilder().build(game, position, item, lootVelocity, Loot.MAX_LIFE, SolRandom.randomFloat(Loot.MAX_ROT_SPD), this); game.getObjectManager().addObjDelayed(l); if (!onDeath) { game.getSoundManager().play(game, game.getSpecialSounds().lootThrow, position, this); } }

Target:
private void throwLoot(SolGame game, SolItem item, boolean onDeath) { Vector2 lootVelocity = new Vector2(); float velocityAngle; float speed; Vector2 position = new Vector2(); if (onDeath) { velocityAngle = SolRandom.randomFloat(180); speed = SolRandom.randomFloat(0, Loot.MAX_SPD); SolMath.fromAl(position, velocityAngle, SolRandom.randomFloat(myHull.config.getApproxRadius())); } else { velocityAngle = getAngle(); speed = 1f; SolMath.fromAl(position, velocityAngle, myHull.config.getApproxRadius()); } SolMath.fromAl(lootVelocity, velocityAngle, speed); lootVelocity.add(myHull.getVelocity()); position.add(myHull.getPosition()); Loot l = game.getLootBuilder().build(game, position, item, lootVelocity, Loot.MAX_LIFE, SolRandom.randomFloat(Loot.MAX_ROT_SPD), this); game.getObjectManager().addObjDelayed(l); if (!onDeath) { game.getSoundManager().play(game, game.getSpecialSounds().lootThrow, position, this); } }
Source:
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { String uri = environment.getProperty("sample.jwk-set-uri", "mock://localhost:0"); if (uri.startsWith("mock://")) { try { this.server.start(new URI(uri).getPort()); } catch (IOException | URISyntaxException e ) { throw new IllegalStateException(e); } Map<String, Object> properties = new HashMap<>(); String url = this.server.url("/.well-known/jwks.json").toString(); properties.put("sample.jwk-set-uri", url); MapPropertySource propertySource = new MapPropertySource("mock", properties); environment.getPropertySources().addFirst(propertySource); } }

Target:
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { String uri = environment.getProperty("sample.jwk-set-uri", "mock://localhost:0"); if (uri.startsWith("mock://")) { try { this.server.start(URI.create(uri).getPort()); } catch (IOException e) { throw new IllegalStateException(e); } Map<String, Object> properties = new HashMap<>(); String url = this.server.url("/.well-known/jwks.json").toString(); properties.put("sample.jwk-set-uri", url); MapPropertySource propertySource = new MapPropertySource("mock", properties); environment.getPropertySources().addFirst(propertySource); } }
Source:
protected PrintWriter createWriter(String outdir) throws IOException { new File(outdir).mkdirs(); String jvmArg = System.getProperty(JVM_ARG); if ((jvmArg != null) && (!jvmArg.trim().isEmpty())) { fileName = jvmArg; } return new PrintWriter(new BufferedWriter(new FileWriter(new File(outdir, fileName)))); }

Target:
protected PrintWriter createWriter(String outdir) throws IOException { new File(outdir).mkdirs(); String jvmArg = System.getProperty(JVM_ARG); if (jvmArg != null && !jvmArg.trim().isEmpty()) { fileName = jvmArg; } return new PrintWriter(new BufferedWriter(new FileWriter(new File(outdir, fileName)))); }
Source:
public void testAMeetingCanBeDeleted() { HomeTabletPage homePage = new HomeTabletPage(); SchedulePage schedulePage = homePage .clickScheduleBtn() .clickOverMeetingCreated(subject) .clickRemoveBtn() .confirmCredentials(password); Assert.assertTrue(schedulePage.isMessageMeetingDeletedDisplayed()); }

Target:
public void testAMeetingCanBeDeleted() { HomeTabletPage homeTabletPage = new HomeTabletPage(); SchedulePage schedulePage = homeTabletPage .clickScheduleBtn() .clickOverMeetingCreated(subject) .clickRemoveBtn() .confirmCredentials(password); Assert.assertTrue(schedulePage.isMessageMeetingDeletedDisplayed()); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpFields(); setUpListener(); Boolean addToClaim = getIntent().getBooleanExtra(ADD_TO_CLAIM, false); if(addToClaim) { User user = (User)getIntent().getSerializableExtra(EXTRA_USER); location = user.getLocation(); addLocationField.setText(location.getName() + "\n" + location.getAddress()); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpFields(); setUpListener(); boolean addToClaim = getIntent().getBooleanExtra(ADD_TO_CLAIM, false); if (addToClaim) { User user = (User)getIntent().getSerializableExtra(EXTRA_USER); location = user.getLocation(); addLocationField.setText(location.getName() + "\n" + location.getAddress()); } }
Source:
public void testGetSubscriptionCursors() throws IOException { final EventType eventType = createEventType(); final Subscription subscription = createSubscription(eventType); commitCursors(subscription); List<Cursor> actualCursors = getSubscriptionCursors(subscription); Assert.assertEquals(Arrays.asList(new Cursor("0", "25")), actualCursors); }

Target:
public void testGetSubscriptionCursors() throws IOException { final EventType eventType = createEventType(); final Subscription subscription = createSubscription(eventType); commitCursors(subscription, "[{\"partition\":\"0\",\"offset\":\"25\"}]") .then() .statusCode(HttpStatus.SC_OK); final List<Cursor> actualCursors = getSubscriptionCursors(subscription); Assert.assertEquals(Arrays.asList(new Cursor("0", "25")), actualCursors); }
Source:
public void taskRun() { try { if (myServerName != null && (myServerName.startsWith("http:") || myServerName.startsWith("https:") || myServerName.startsWith("ftp:"))) { httpTaskRun(); } else if (remoteUIXfer) { remoteUITaskRun(); } if (myServerName!=null && myServerName.startsWith("file:")) { fileTaskRun(); } else { stvTaskRun(); } if (Sage.DBG) System.out.println("Download completed for files server=" + myServerName + " src=" + mySrcFile + " dest=" + myDestFile + " abort=" + abort); } finally { cleanup(); if (uiMgrWeak == null) { resultMap.put(myDestFile, wasSuccessful() ? (Object)Boolean.TRUE : (Object)("Error: " + getStatusMessage())); } synchronized (fileMap) { fileMap.remove(myDestFile); } } }

Target:
public void taskRun() { try { if (myServerName != null && (myServerName.startsWith("http:") || myServerName.startsWith("https:") || myServerName.startsWith("ftp:"))) { httpTaskRun(); } else if (remoteUIXfer) { remoteUITaskRun(); } else if (myServerName!=null && myServerName.startsWith("file:")) { fileTaskRun(); } else { stvTaskRun(); } if (Sage.DBG) System.out.println("Download completed for files server=" + myServerName + " src=" + mySrcFile + " dest=" + myDestFile + " abort=" + abort); } finally { cleanup(); if (uiMgrWeak == null) { resultMap.put(myDestFile, wasSuccessful() ? (Object)Boolean.TRUE : (Object)("Error: " + getStatusMessage())); } synchronized (fileMap) { fileMap.remove(myDestFile); } } }
Source:
public void shouldNotIncludeAccountIdsInQueryMapForEmptyString() { var params = new GatewayAccountSearchParams(); params.setAccountIds(new CommaDelimitedSetParameter("")); Map<String, Object> queryMap = params.getQueryMap(); assertThat(queryMap, IsMapWithSize.anEmptyMap()); }

Target:
public void shouldNotIncludeAccountIdsInQueryMapForEmptyString() { var params = new GatewayAccountSearchParams(); params.setAccountIds(new CommaDelimitedSetParameter("")); Map<String, Object> queryMap = params.getQueryMap(); assertThat(queryMap, anEmptyMap()); }
Source:
public int read(final char[] chr, final int st, final int end) throws IOException { final int n = super.read(chr, st, end); if (n != -1) { branch.write(chr, st, n); } return n; }

Target:
public int read(final char[] chr, final int st, final int end) throws IOException { final int n = super.read(chr, st, end); if (n != EOF) { branch.write(chr, st, n); } return n; }