auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ExtendedJSONObject getObsoleteIds() { String s = sharedPrefs.getString(HealthReportConstants.PREF_OBSOLETE_DOCUMENT_IDS_TO_DELETION_ATTEMPTS_REMAINING, null); if (s == null) { return new ExtendedJSONObject(); } try { return ExtendedJSONObject.parseJSONObject(s); } catch (Exception e) { Logger.warn(LOG_TAG, "Got exception getting obsolete ids.", e); return new ExtendedJSONObject(); } }

Target:
protected ExtendedJSONObject getObsoleteIds() { String s = sharedPrefs.getString(HealthReportConstants.PREF_OBSOLETE_DOCUMENT_IDS_TO_DELETION_ATTEMPTS_REMAINING, null); if (s == null) { String lastId = sharedPrefs.getString(HealthReportConstants.PREF_LAST_UPLOAD_DOCUMENT_ID, null); if (lastId == null) { return new ExtendedJSONObject(); } ExtendedJSONObject ids = new ExtendedJSONObject(); ids.put(lastId, HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID); setObsoleteIds(ids); return ids; } try { return ExtendedJSONObject.parseJSONObject(s); } catch (Exception e) { Logger.warn(LOG_TAG, "Got exception getting obsolete ids.", e); return new ExtendedJSONObject(); } }
Source:
protected List<Block> parseContent(RssMacroParameters parameters, String content, MacroTransformationContext context) throws MacroExecutionException { if (content == null) { content = StringUtils.EMPTY; } return this.getMacroContentParser().parse(content, context, false, context.isInline()).getChildren(); }

Target:
protected List<Block> parseContent(RssMacroParameters parameters, String content, MacroTransformationContext context) throws MacroExecutionException { return this.getMacroContentParser().parse(content, context, false, context.isInline()).getChildren(); }
Source:
public LogOffset append(int partition, M message) { ExcerptAppender appender = partitions.get(partition).acquireAppender(); if (codec != null) { appender.writeDocument(w -> w.write().bytes(codec.encode(message))); } else { appender.writeDocument(w -> w.write("msg").object(message)); } long offset = appender.lastIndexAppended(); LogOffset ret = new LogOffsetImpl(name, partition, offset); if (log.isDebugEnabled()) { log.debug(String.format("append to %s, value: %s", ret, message)); } return ret; }

Target:
public LogOffset append(int partition, M message) { ExcerptAppender appender = partitions.get(partition).acquireAppender(); if (NO_CODEC.equals(codec)) { appender.writeDocument(w -> w.write(MSG_KEY).object(message)); } else { appender.writeDocument(w -> w.write().bytes(codec.encode(message))); } long offset = appender.lastIndexAppended(); LogOffset ret = new LogOffsetImpl(name, partition, offset); if (log.isDebugEnabled()) { log.debug(String.format("append to %s, value: %s", ret, message)); } return ret; }
Source:
private String getInstalledVdsIdIfExists(SSHClient client) { try { ByteArrayOutputStream out = new ConstraintByteArrayOutputStream(256); client.executeCommand(Config.<String> getValue(ConfigValues.GetVdsmIdByVdsmToolCommand), null, out, null); return new String(out.toByteArray(), Charset.forName("UTF-8")); } catch (Exception e) { log.warn( "Failed to initiate vdsm-id request on host with message {}", e.getMessage() ); return null; } }

Target:
private String getInstalledVdsIdIfExists(SSHClient client) { try { ByteArrayOutputStream out = new ConstraintByteArrayOutputStream(256); client.executeCommand(Config.<String> getValue(ConfigValues.GetVdsmIdByVdsmToolCommand), null, out, null); return new String(out.toByteArray(), Charset.forName("UTF-8")); } catch (Exception e) { log.warn( "Failed to initiate vdsm-id request on host: {}", e.getMessage() ); log.debug("Exception", e); return null; } }
Source:
public void showError(@StringRes final int errorResId, @Nullable final Icon icon, @StringRes final int actionTextResId, @Nullable final View.OnClickListener actionListener) { if (baseFragment.isResumed()) { AlertDialogFragment.newInstance(0, errorResId, actionListener == null ? null : new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { actionListener.onClick(((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE)); } } ).show(baseFragment.getFragmentManager(), null); } }

Target:
public void showError(@StringRes final int errorResId, @Nullable final Icon icon, @StringRes final int actionTextResId, @Nullable final View.OnClickListener actionListener) { if (baseFragment.isResumed()) { AlertDialogFragment.newInstance(0, errorResId, actionListener == null ? null : new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { actionListener.onClick(((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE)); } } ).show(baseFragment.getChildFragmentManager(), null); } }
Source:
public void exit() { try { client.logout(creds); } catch (Exception e) { throw Throwables.propagate(e); } client.getInputProtocol().getTransport().close(); client.getOutputProtocol().getTransport().close(); }

Target:
public void exit() { try { client.logout(creds); client.getInputProtocol().getTransport().close(); client.getOutputProtocol().getTransport().close(); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public CompletionStage<Void> preload() { long stamp = acquireReadLock(); NonBlockingStore<Object, Object> nonBlockingStore = getStoreLocked(storeStatus -> storeStatus.config.preload()); if (nonBlockingStore == null) { releaseReadLock(stamp); return CompletableFutures.completedNull(); } Publisher<MarshallableEntry<Object, Object>> publisher = nonBlockingStore.publishEntries( IntSets.immutableRangeSet(segmentCount), null, true); long start = timeService.time(); final long maxEntries = getMaxEntries(); final long flags = getFlagsForStateInsertion(); AdvancedCache<?,?> tmpCache = this.cache.wired().withStorageMediaType(); DataConversion keyDataConversion = tmpCache.getKeyDataConversion(); DataConversion valueDataConversion = tmpCache.getValueDataConversion(); return Flowable.fromPublisher(publisher) .doFinally(() -> releaseReadLock(stamp)) .take(maxEntries) .concatMapSingle(me -> preloadKey(flags, me, keyDataConversion, valueDataConversion)) .count() .toCompletionStage() .thenAccept(insertAmount -> { this.preloaded = insertAmount < maxEntries; log.debugf("Preloaded %d keys in %s", insertAmount, Util.prettyPrintTime(timeService.timeDuration(start, MILLISECONDS))); }); }

Target:
public CompletionStage<Void> preload() { long stamp = acquireReadLock(); NonBlockingStore<Object, Object> nonBlockingStore = getStoreLocked(status -> status.config.preload()); if (nonBlockingStore == null) { releaseReadLock(stamp); return CompletableFutures.completedNull(); } Publisher<MarshallableEntry<Object, Object>> publisher = nonBlockingStore.publishEntries( IntSets.immutableRangeSet(segmentCount), null, true); long start = timeService.time(); final long maxEntries = getMaxEntries(); final long flags = getFlagsForStateInsertion(); AdvancedCache<?,?> tmpCache = this.cache.wired().withStorageMediaType(); DataConversion keyDataConversion = tmpCache.getKeyDataConversion(); DataConversion valueDataConversion = tmpCache.getValueDataConversion(); return Flowable.fromPublisher(publisher) .doFinally(() -> releaseReadLock(stamp)) .take(maxEntries) .concatMapSingle(me -> preloadEntry(flags, me, keyDataConversion, valueDataConversion)) .count() .toCompletionStage() .thenAccept(insertAmount -> { this.preloaded = insertAmount < maxEntries; log.debugf("Preloaded %d keys in %s", insertAmount, Util.prettyPrintTime(timeService.timeDuration(start, MILLISECONDS))); }); }
Source:
private long milliTime() { return System.nanoTime() / 1000000l; }

Target:
private long milliTime() { return System.currentTimeMillis(); }
Source:
public void testSerializeNullableString() { String randomString = getRandomString(10); ByteBuffer outputBuffer = ByteBuffer.allocate(4 + randomString.getBytes().length); Utils.serializeNullableString(outputBuffer, randomString); outputBuffer.flip(); int length = outputBuffer.getInt(); assertTrue("Input string length " + randomString.getBytes().length + " didn't match output string length " + length, (randomString.getBytes().length == length)); byte[] output = new byte[length]; outputBuffer.get(output); assertTrue("Output buffer shouldn't have any remaining " + outputBuffer.remaining(), outputBuffer.remaining() == 0); String outputString = new String(output); assertEquals("Output string \"" + outputString + "\" didn't match input string \"" + randomString + "\"", outputString, randomString); randomString = null; outputBuffer = ByteBuffer.allocate(4); Utils.serializeNullableString(outputBuffer, randomString); outputBuffer.flip(); length = outputBuffer.getInt(); assertTrue("Input string length 0 didn't match output string length " + length, (0 == length)); output = new byte[length]; outputBuffer.get(output); assertTrue("Output buffer shouldn't have any remaining " + outputBuffer.remaining(), outputBuffer.remaining() == 0); outputString = new String(output); assertTrue("Output string \"" + outputString + "\" expected to be empty", (outputString.equals(""))); }

Target:
public void testSerializeNullableString() { String randomString = getRandomString(10); ByteBuffer outputBuffer = ByteBuffer.allocate(4 + randomString.getBytes().length); Utils.serializeNullableString(outputBuffer, randomString); outputBuffer.flip(); int length = outputBuffer.getInt(); assertEquals("Input and output string lengths don't match ", randomString.getBytes().length, length); byte[] output = new byte[length]; outputBuffer.get(output); assertFalse("Output buffer shouldn't have any remaining, but has " + outputBuffer.remaining() + " bytes", outputBuffer.hasRemaining()); String outputString = new String(output); assertEquals("Input and output strings don't match", randomString, outputString); randomString = null; outputBuffer = ByteBuffer.allocate(4); Utils.serializeNullableString(outputBuffer, randomString); outputBuffer.flip(); length = outputBuffer.getInt(); assertEquals("Input and output string lengths don't match", 0, length); output = new byte[length]; outputBuffer.get(output); assertFalse("Output buffer shouldn't have any remaining, but has " + outputBuffer.remaining() + " bytes", outputBuffer.hasRemaining()); outputString = new String(output); assertEquals("Output string \"" + outputString + "\" expected to be empty", outputString, ""); }
Source:
public Map<String, String> deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { Object environment = jsonParser.readValueAs(Object.class); try { if (environment instanceof Map) { return (Map<String, String>) environment; } if (environment instanceof List) { return ((List<String>) environment).stream() .collect(Collectors.toMap(item -> item.split("=")[0], item -> item.split("=")[1])); } } catch (Exception e) { throw new RuntimeException(format("Unsupported value '%s'.", environment.toString())); } if (environment instanceof String) { if (((String) environment).isEmpty()) { return new HashMap<>(); } throw new RuntimeException(format("Unsupported value '%s'.", environment.toString())); } throw new RuntimeException(format("Unsupported type '%s'.", environment.getClass())); }

Target:
public Map<String, String> deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { Object environment = jsonParser.readValueAs(Object.class); if (environment instanceof Map) { return (Map<String, String>) environment; } try { if (environment instanceof List) { return parseArrayEnvironment((List<String>) environment); } } catch (IllegalArgumentException ie) { throw ctxt.mappingException(ie.getMessage()); } catch (Exception e) { throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, environment)); } if (environment instanceof String) { if (((String) environment).isEmpty()) { return new HashMap<>(); } throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, environment)); } throw ctxt.mappingException(format("Unsupported type '%s'.", environment.getClass())); }
Source:
DataSegment uploadDataSegment( DataSegment segment, final int binaryVersion, final long size, final File compressedSegmentData, final String azurePath ) throws StorageException, IOException, URISyntaxException { azureStorage.uploadBlob(compressedSegmentData, config.getContainer(), azurePath); final DataSegment outSegment = segment .withSize(size) .withLoadSpec(this.makeLoadSpec(new URI(azurePath))) .withBinaryVersion(binaryVersion); log.info("Deleting file [%s]", compressedSegmentData); compressedSegmentData.delete(); return outSegment; }

Target:
DataSegment uploadDataSegment( DataSegment segment, final int binaryVersion, final long size, final File compressedSegmentData, final String azurePath ) throws StorageException, IOException, URISyntaxException { azureStorage.uploadBlob(compressedSegmentData, config.getContainer(), azurePath); final DataSegment outSegment = segment .withSize(size) .withLoadSpec(this.makeLoadSpec(new URI(azurePath))) .withBinaryVersion(binaryVersion); log.debug("Deleting file [%s]", compressedSegmentData); compressedSegmentData.delete(); return outSegment; }
Source:
private RunResult runDelivery(ShardProcessingSession session) { ShardIndex index = session.shardIndex(); Page<InboxMessage> startingPage = inboxStorage.readAll(index, pageSize); Optional<Page<InboxMessage>> maybePage = Optional.of(startingPage); boolean continueAllowed = true; List<DeliveryStage> stages = new ArrayList<>(); Iterable<CatchUp> catchUpJobs = ImmutableList.copyOf(catchUpStorage.readAll()); while (continueAllowed && maybePage.isPresent()) { Page<InboxMessage> currentPage = maybePage.get(); ImmutableList<InboxMessage> messages = currentPage.contents(); if (!messages.isEmpty()) { DeliveryAction action = new GroupByTargetAndDeliver(deliveries); Conveyor conveyor = new Conveyor(messages, deliveredMessages); List<Station> stations = conveyorStationsFor(catchUpJobs, action); DeliveryStage stage = launch(conveyor, stations, index); continueAllowed = monitorTellsToContinue(stage); stages.add(stage); } if (continueAllowed) { if(messages.size() < pageSize) { catchUpJobs = ImmutableList.copyOf(catchUpStorage.readAll()); } maybePage = currentPage.next(); } } int totalMessagesDelivered = stages.stream() .map(DeliveryStage::getMessagesDelivered) .reduce(0, Integer::sum); return new RunResult(totalMessagesDelivered, !continueAllowed); }

Target:
private RunResult runDelivery(ShardProcessingSession session) { ShardIndex index = session.shardIndex(); Page<InboxMessage> startingPage = inboxStorage.readAll(index, pageSize); Optional<Page<InboxMessage>> maybePage = Optional.of(startingPage); boolean shouldContinue = true; List<DeliveryStage> stages = new ArrayList<>(); Iterable<CatchUp> catchUpJobs = refreshCatchUpJobs(); while (shouldContinue && maybePage.isPresent()) { Page<InboxMessage> currentPage = maybePage.get(); ImmutableList<InboxMessage> messages = currentPage.contents(); if (!messages.isEmpty()) { DeliveryStage stage = deliverMessages(messages, index, catchUpJobs); stages.add(stage); shouldContinue = monitorTellsToContinueAfter(stage); } if (shouldContinue) { if(messages.size() < pageSize) { catchUpJobs = refreshCatchUpJobs(); } maybePage = currentPage.next(); } } int totalMessagesDelivered = stages.stream() .map(DeliveryStage::getMessagesDelivered) .reduce(0, Integer::sum); return new RunResult(totalMessagesDelivered, !shouldContinue); }
Source:
public boolean uploadBlob(BlobId blobId, long blobSize, CloudBlobMetadata cloudBlobMetadata, InputStream blobInputStream) throws CloudStorageException { Objects.requireNonNull(blobId, "BlobId cannot be null"); Objects.requireNonNull(blobInputStream, "Input stream cannot be null"); BlobRequestOptions options = null; OperationContext opContext = null; azureMetrics.blobUploadRequestCount.inc(); try { Timer.Context storageTimer = azureMetrics.blobUploadTime.time(); CloudBlobContainer azureContainer = getContainer(blobId, true); String azureBlobName = getAzureBlobName(blobId); CloudBlockBlob azureBlob = azureContainer.getBlockBlobReference(azureBlobName); if (azureBlob.exists()) { logger.debug("Skipping upload of blob as it already exists in Azure container {}.", blobId, azureContainer.getName()); azureMetrics.blobSkippedCount.inc(); return false; } azureBlob.setMetadata(getMetadataMap(cloudBlobMetadata)); azureBlob.upload(blobInputStream, blobSize, null, options, opContext); storageTimer.stop(); Timer.Context docTimer = azureMetrics.documentCreateTime.time(); documentClient.createDocument(cosmosCollectionLink, cloudBlobMetadata, defaultRequestOptions, true); docTimer.stop(); logger.debug("Uploaded blob to Azure container {}.", blobId, azureContainer.getName()); azureMetrics.blobUploadedCount.inc(); return true; } catch (URISyntaxException | StorageException | DocumentClientException | IOException e) { azureMetrics.blobUploadErrorCount.inc(); updateErrorMetrics(e); throw new CloudStorageException("Error uploading blob " + blobId, e); } }

Target:
public boolean uploadBlob(BlobId blobId, long blobSize, CloudBlobMetadata cloudBlobMetadata, InputStream blobInputStream) throws CloudStorageException { Objects.requireNonNull(blobId, "BlobId cannot be null"); Objects.requireNonNull(blobInputStream, "Input stream cannot be null"); BlobRequestOptions options = null; OperationContext opContext = null; azureMetrics.blobUploadRequestCount.inc(); try { Timer.Context storageTimer = azureMetrics.blobUploadTime.time(); CloudBlobContainer azureContainer = getContainer(blobId, true); String azureBlobName = getAzureBlobName(blobId); CloudBlockBlob azureBlob = azureContainer.getBlockBlobReference(azureBlobName); if (azureBlob.exists()) { logger.debug("Skipping upload of blob as it already exists in Azure container {}.", blobId, azureContainer.getName()); azureMetrics.blobUploadSkippedCount.inc(); return false; } azureBlob.setMetadata(getMetadataMap(cloudBlobMetadata)); azureBlob.upload(blobInputStream, blobSize, null, options, opContext); storageTimer.stop(); Timer.Context docTimer = azureMetrics.documentCreateTime.time(); documentClient.createDocument(cosmosCollectionLink, cloudBlobMetadata, defaultRequestOptions, true); docTimer.stop(); logger.debug("Uploaded blob to Azure container {}.", blobId, azureContainer.getName()); azureMetrics.blobUploadSuccessCount.inc(); return true; } catch (URISyntaxException | StorageException | DocumentClientException | IOException e) { azureMetrics.blobUploadErrorCount.inc(); updateErrorMetrics(e); throw new CloudStorageException("Error uploading blob " + blobId, e); } }
Source:
public String toString() { return "[id: " + this.id + " entryType: " + this.entryType + " size: " + this.size + "]"; }

Target:
public String toString() { return "[id: " + id + " entryType: " + entryType + " size: " + size + "]"; }
Source:
public void startRuntime() { String tempDir = AppConstants.getInstance().getString("log.dir", null); v8 = V8.createV8Runtime("J2V8Javascript", tempDir); }

Target:
public void startRuntime() { v8 = V8.createV8Runtime(); }
Source:
private Map<String, List<String>> findPKUpdates() throws OrmException, SQLException { Map<String, List<String>> corrections = new HashMap<>(); ReviewDb db = dbFactory.open(); try { DatabaseMetaData meta = conn.getMetaData(); JavaSchemaModel jsm = new JavaSchemaModel(ReviewDb.class); for (RelationModel rm : jsm.getRelations()) { String tableName = rm.getRelationName(); List<String> relationPK = relationPK(rm); List<String> tablePK = dbTablePK(meta, tableName); if (!relationPK.equals(tablePK)) { corrections.put(tableName, relationPK); } } return corrections; } finally { db.close(); } }

Target:
private Map<String, List<String>> findPKUpdates() throws OrmException, SQLException { Map<String, List<String>> corrections = new TreeMap<>(); ReviewDb db = dbFactory.open(); try { DatabaseMetaData meta = conn.getMetaData(); JavaSchemaModel jsm = new JavaSchemaModel(ReviewDb.class); for (RelationModel rm : jsm.getRelations()) { String tableName = rm.getRelationName(); List<String> expectedPK = relationPK(rm); List<String> actualPK = dbTablePK(meta, tableName); if (!expectedPK.equals(actualPK)) { corrections.put(tableName, expectedPK); } } return corrections; } finally { db.close(); } }
Source:
public void updateResponseAsReference(ExecuteResponseDocument res, String reqID, String mimeType) throws ExceptionReport { prepareGenerator(); OutputDataType output = prepareOutput(res); InputStream stream; OutputReferenceType outReference = output.addNewReference(); if (schema != null) { outReference.setSchema(schema); } if (encoding != null) { outReference.setEncoding(encoding); } if (mimeType != null) { outReference.setMimeType(mimeType); } IDatabase db = DatabaseFactory.getDatabase(); try { if (encoding == null || encoding.equals("") || encoding.equalsIgnoreCase(IOHandler.DEFAULT_ENCODING)){ stream = generator.generateStream(super.obj, mimeType, schema); } else if (encoding.equalsIgnoreCase(IOHandler.ENCODING_BASE64)){ stream = generator.generateBase64Stream(super.obj, mimeType, schema); } else { throw new ExceptionReport("Unable to generate encoding " + encoding, ExceptionReport.NO_APPLICABLE_CODE); } } catch (IOException e){ LOGGER.error(e.getMessage(), e); throw new ExceptionReport("Error while generating Complex Data out of the process result", ExceptionReport.NO_APPLICABLE_CODE, e); } String storeReference = db.storeComplexValue(reqID, id, stream, COMPLEX_DATA_TYPE, mimeType); storeReference = storeReference.replace("#", "%23"); outReference.setHref(storeReference); this.mimeType = "text/xml"; }

Target:
public void updateResponseAsReference(ExecuteResponseDocument res, String reqID, String mimeType) throws ExceptionReport { prepareGenerator(); OutputDataType output = prepareOutput(res); InputStream stream = null; OutputReferenceType outReference = output.addNewReference(); if (schema != null) { outReference.setSchema(schema); } if (encoding != null) { outReference.setEncoding(encoding); } if (mimeType != null) { outReference.setMimeType(mimeType); } IDatabase db = DatabaseFactory.getDatabase(); try { if (encoding == null || encoding.equals("") || encoding.equalsIgnoreCase(IOHandler.DEFAULT_ENCODING)){ stream = generator.generateStream(super.obj, mimeType, schema); } else if (encoding.equalsIgnoreCase(IOHandler.ENCODING_BASE64)){ stream = generator.generateBase64Stream(super.obj, mimeType, schema); } else { throw new ExceptionReport("Unable to generate encoding " + encoding, ExceptionReport.NO_APPLICABLE_CODE); } String storeReference = db.storeComplexValue(reqID, id, stream, COMPLEX_DATA_TYPE, mimeType); storeReference = storeReference.replace("#", "%23"); outReference.setHref(storeReference); } catch (IOException e){ LOGGER.error(e.getMessage(), e); throw new ExceptionReport("Error while generating Complex Data out of the process result", ExceptionReport.NO_APPLICABLE_CODE, e); } finally { IOUtils.closeQuietly(stream); } this.mimeType = "text/xml"; }
Source:
public Future<Void> close() { final Promise<Void> closeDonePromise = new DefaultPromise<>(this.executor); this.allChannels.close().addListener(new GenericFutureListener<Future<Void>>() { @Override public void operationComplete(final Future<Void> future) { ApnsChannelPool.this.isClosed = true; final Promise<Void> cancelFuturePromise = new DefaultPromise<>(ApnsChannelPool.this.executor); final int numOfFuturesToCancel = pendingCreateChannelFutures.size(); if (numOfFuturesToCancel > 0) { final AtomicInteger numOfCanceledFutures = new AtomicInteger(0); for (Future<Channel> f : pendingCreateChannelFutures) { f.addListener(new GenericFutureListener<Future<? super Channel>>() { @Override public void operationComplete(Future<? super Channel> future) { if (numOfCanceledFutures.incrementAndGet() == numOfFuturesToCancel) { cancelFuturePromise.setSuccess(null); } } }); } } else { cancelFuturePromise.setSuccess(null); } cancelFuturePromise.addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { if (ApnsChannelPool.this.channelFactory instanceof Closeable) { ((Closeable) ApnsChannelPool.this.channelFactory).close(); } for (final Promise<Channel> acquisitionPromise : ApnsChannelPool.this.pendingAcquisitionPromises) { acquisitionPromise.tryFailure(POOL_CLOSED_EXCEPTION); } closeDonePromise.setSuccess(null); } }); } }); return closeDonePromise; }

Target:
public Future<Void> close() { final Promise<Void> closeDonePromise = new DefaultPromise<>(this.executor); this.allChannels.close().addListener(new GenericFutureListener<Future<Void>>() { @Override public void operationComplete(final Future<Void> future) { ApnsChannelPool.this.isClosed = true; final Promise<Void> waitForPendingCreateChannelFuturesPromise = new DefaultPromise<>(ApnsChannelPool.this.executor); final PromiseCombiner combiner = new PromiseCombiner(ApnsChannelPool.this.executor); for (final Future<Channel> f : pendingCreateChannelFutures) { combiner.add(f); } combiner.finish(waitForPendingCreateChannelFuturesPromise); waitForPendingCreateChannelFuturesPromise.addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { if (ApnsChannelPool.this.channelFactory instanceof Closeable) { ((Closeable) ApnsChannelPool.this.channelFactory).close(); } for (final Promise<Channel> acquisitionPromise : ApnsChannelPool.this.pendingAcquisitionPromises) { acquisitionPromise.tryFailure(POOL_CLOSED_EXCEPTION); } closeDonePromise.setSuccess(null); } }); } }); return closeDonePromise; }
Source:
public void addPages() { page = new EFactoryNewFileWizardPage(selection); initialObjectCreationpage = new ESONInitialObjectCreationPage("Whatever"); addPage(page); addPage(initialObjectCreationpage); }

Target:
public void addPages() { page = new EFactoryNewFileWizardPage(selection); initialObjectCreationpage = new ESONInitialObjectCreationPage("InitialObject"); addPage(page); addPage(initialObjectCreationpage); }
Source:
public void rollbackMigration(PartitionMigrationEvent event) { if (DESTINATION == event.getMigrationEndpoint()) { removeRecordStoresHavingLesserBackupCountThan(event.getPartitionId(), event.getCurrentReplicaIndex()); getMetaDataGenerator().removeUuidAndSequence(event.getPartitionId()); } mapServiceContext.reloadOwnedPartitions(); }

Target:
public void rollbackMigration(PartitionMigrationEvent event) { if (DESTINATION == event.getMigrationEndpoint()) { removeWbqCountersHavingLesserBackupCountThan(event.getPartitionId(), event.getCurrentReplicaIndex()); removeRecordStoresHavingLesserBackupCountThan(event.getPartitionId(), event.getCurrentReplicaIndex()); getMetaDataGenerator().removeUuidAndSequence(event.getPartitionId()); } mapServiceContext.reloadOwnedPartitions(); }
Source:
private void resizeIfPossible(Tag tag) { if (size >= MAX_TAGS) { final String msg = String.format("Cannot add Tag %s - Maximum number of tags (%d) reached.", tag, MAX_TAGS); throw new IllegalStateException(msg); } Object[] prevBuf = buf; init(size * 2); for (int i = 1; i < prevBuf.length; i += 2) { Tag t = (Tag) prevBuf[i]; if (t != null) { add(t); } } add(tag); }

Target:
private void resizeIfPossible(Tag tag) { if (size < MAX_TAGS) { Object[] prevBuf = buf; init(size * 2); for (int i = 1; i < prevBuf.length; i += 2) { Tag t = (Tag) prevBuf[i]; if (t != null) { add(t); } } add(tag); } else { final String msg = String.format("Cannot add Tag %s - Maximum number of tags (%d) reached.", tag, MAX_TAGS); LOGGER.error(msg); } }
Source:
private Element addFilesToDuplicationElement(Document doc, Element duplication, Match match) { Mark mark; for (Iterator<Mark> iterator = match.iterator(); iterator.hasNext();) { mark = iterator.next(); final Element file = doc.createElement("file"); file.setAttribute("line", String.valueOf(mark.getBeginLine())); file.setAttribute("path", mark.getFilename()); file.setAttribute("endline", String.valueOf(mark.getEndLine())); final int beginCol = mark.getBeginColumn(); final int endCol = mark.getEndColumn(); if (beginCol != -1) { file.setAttribute("column", String.valueOf(mark.getBeginColumn())); } if (endCol != -1) { file.setAttribute("endcolumn", String.valueOf(mark.getEndColumn())); } duplication.appendChild(file); } return duplication; }

Target:
private Element addFilesToDuplicationElement(Document doc, Element duplication, Match match) { Mark mark; for (Iterator<Mark> iterator = match.iterator(); iterator.hasNext();) { mark = iterator.next(); final Element file = doc.createElement("file"); file.setAttribute("line", String.valueOf(mark.getBeginLine())); file.setAttribute("path", mark.getFilename()); file.setAttribute("endline", String.valueOf(mark.getEndLine())); final int beginCol = mark.getBeginColumn(); final int endCol = mark.getEndColumn(); if (beginCol != -1) { file.setAttribute("column", String.valueOf(beginCol)); } if (endCol != -1) { file.setAttribute("endcolumn", String.valueOf(endCol)); } duplication.appendChild(file); } return duplication; }
Source:
public boolean isAttached(DialogField editor) { if (fAttachedDialogFields != null) { for (DialogField fAttachedDialogField : fAttachedDialogFields) { if (fAttachedDialogField == editor) { return true; } } } return false; }

Target:
public boolean isAttached(DialogField editor) { if (fAttachedDialogFields != null) { for (DialogField dialogField : fAttachedDialogFields) { if (dialogField == editor) { return true; } } } return false; }
Source:
public String draw () throws Exception { StringBuffer sb = new StringBuffer(); if ( this.containers != null ) { for ( String container: this.containers ) { if ( this.preview ) { sb.append( PreviewTemplateUtil.getMockBodyContent() ); } else { sb.append( "#parseContainer('" ).append( container ).append( "')" ); } } } return sb.toString(); }

Target:
public String draw () throws Exception { final StringBuilder sb = new StringBuilder(); if ( this.containers != null ) { for ( final String container: this.containers ) { if ( this.preview ) { sb.append( PreviewTemplateUtil.getMockBodyContent() ); } else { sb.append( "#parseContainer('" ).append( container ).append( "')" ); } } } return sb.toString(); }
Source:
private void removeTagCacheEntry(TagCacheEntry entry) { if (entry.parent == null) { return; } Map newParentChildren = new HashMap(); newParentChildren.putAll(entry.parent.children); newParentChildren.remove(entry.path.lastSegment()); entry.parent.children = newParentChildren; if (entry.parent.getTags().isEmpty() && entry.children.isEmpty()) { removeTagCacheEntry(entry.parent); } }

Target:
private void removeTagCacheEntry(TagCacheEntry entry) { if (entry.parent == null) { return; } Map newParentChildren = new HashMap(); newParentChildren.putAll(entry.parent.children); newParentChildren.remove(entry.path.lastSegment()); entry.parent.children = newParentChildren; if (entry.parent.isEmpty()) { removeTagCacheEntry(entry.parent); } }
Source:
public CloseableHttpResponse exportAsPMML(int modelId) throws MLHttpClientException { CloseableHttpResponse response; try { response = doHttpGet("/api/models/" + modelId + "/export?mode=pmml"); return response; } catch (MLHttpClientException e) { throw new MLHttpClientException("Failed to download model as PMML", e); } }

Target:
public CloseableHttpResponse exportAsPMML(int modelId) throws MLHttpClientException { CloseableHttpResponse response; try { response = doHttpGet("/api/models/" + modelId + "/export?mode=pmml"); return response; } catch (MLHttpClientException e) { throw new MLHttpClientException("Failed to download model as PMML for model [id] "+ modelId, e); } }
Source:
public void testExtractIpv4AddressEmptyString() { assertThat(VdsBrokerObjectsBuilder.extractAddress(ImmutableMap.of(ADDR, "")), nullValue()); }

Target:
public void testExtractIpv4AddressEmptyString() { assertThat(VdsBrokerObjectsBuilder.extractAddress(ImmutableMap.of(VdsProperties.ADDR, "")), nullValue()); }
Source:
@Override public TResult current() { if (curAccumulator == null) { curAccumulator = accumulatorInitializer.apply(); } TResult result = null; TSource o = enumerator.current(); TKey prevKey = keySelector.apply(o); curAccumulator = accumulatorAdder.apply(curAccumulator, o); while (enumerator.moveNext()) { o = enumerator.current(); TKey curKey = keySelector.apply(o); if (comparator.compare(prevKey, curKey) != 0) { result = resultSelector.apply(prevKey, curAccumulator); curAccumulator = accumulatorInitializer.apply(); break; } else { curAccumulator = accumulatorAdder.apply(curAccumulator, o); } prevKey = curKey; } if (result == null) { result = resultSelector.apply(prevKey, curAccumulator); curAccumulator = null; } return result; }

Target:
@Override public TResult current() { if (isLastMoveNextFalse) { throw new NoSuchElementException(); } return curResult; }
Source:
public boolean isSingleton() { return false; }

Target:
public boolean isSingleton() { return true; }
Source:
public void testConfigJvmHeapMemory() { MemorySize jvmHeapMemory = MemorySize.parse("50m"); Configuration conf = new Configuration(); conf.set(JobManagerOptions.JVM_HEAP_MEMORY, jvmHeapMemory); JobManagerProcessSpec jobManagerProcessSpec = JobManagerProcessUtils.processSpecFromConfig(conf); assertThat(jobManagerProcessSpec.getJvmHeapMemorySize(), is(jvmHeapMemory)); MatcherAssert.assertThat( testLoggerResource.getMessages(), hasItem(containsString("The configured or derived JVM heap memory size (50.000mb (52428800 bytes)) is less than its recommended minimum value (128 mb)"))); jvmHeapMemory = MemorySize.parse("150m"); conf.set(JobManagerOptions.JVM_HEAP_MEMORY, jvmHeapMemory); conf.set(JobManagerOptions.JOB_STORE_CACHE_SIZE, 200L * 1024L * 1024L); jobManagerProcessSpec = JobManagerProcessUtils.processSpecFromConfig(conf); assertThat(jobManagerProcessSpec.getJvmHeapMemorySize(), is(jvmHeapMemory)); MatcherAssert.assertThat( testLoggerResource.getMessages(), hasItem(containsString("The configured or derived JVM heap memory size (jobmanager.memory.heap.size: 150.000mb (157286400 bytes)) is less than the configured or default size " + "of the job store cache (jobstore.cache-size: 200.000mb (209715200 bytes))"))); }

Target:
public void testConfigJvmHeapMemory() { MemorySize jvmHeapSize = MemorySize.parse("50m"); Configuration conf = new Configuration(); conf.set(JobManagerOptions.JVM_HEAP_MEMORY, jvmHeapSize); JobManagerProcessSpec JobManagerProcessSpec = JobManagerProcessUtils.processSpecFromConfig(conf); assertThat(JobManagerProcessSpec.getJvmHeapMemorySize(), is(jvmHeapSize)); }
Source:
protected void collectSubstitutionsPaths(ISourceContainer[] containers, Map<String, String> entries) { for (ISourceContainer container : containers) { if (container instanceof MapEntrySourceContainer) { MapEntrySourceContainer sourceSubContainer = (MapEntrySourceContainer) container; IPath from = sourceSubContainer.getBackendPath(); IPath to = sourceSubContainer.getLocalPath(); if (from != null && to != null) { entries.put(from.toOSString(), to.toOSString()); } } if (container.isComposite()) { ISourceContainer[] childContainers; try { childContainers = container.getSourceContainers(); } catch (CoreException e) { childContainers = new ISourceContainer[0]; } if (container instanceof MappingSourceContainer) { MappingSourceContainer mappingSourceContainer = (MappingSourceContainer) container; if (mappingSourceContainer.isMappingWithBackendEnabled()) { collectSubstitutionsPaths(childContainers, entries); } else { } } else { collectSubstitutionsPaths(childContainers, entries); } } } }

Target:
protected void collectSubstitutionsPaths(ISourceContainer[] containers, Map<String, String> entries) { for (ISourceContainer container : containers) { if (container instanceof MapEntrySourceContainer) { MapEntrySourceContainer sourceSubContainer = (MapEntrySourceContainer) container; IPath from = sourceSubContainer.getBackendPath(); IPath to = sourceSubContainer.getLocalPath(); if (from != null && to != null) { entries.put(from.toOSString(), to.toOSString()); } } else if (container.isComposite()) { ISourceContainer[] childContainers; try { childContainers = container.getSourceContainers(); } catch (CoreException e) { childContainers = new ISourceContainer[0]; } if (container instanceof MappingSourceContainer) { MappingSourceContainer mappingSourceContainer = (MappingSourceContainer) container; if (mappingSourceContainer.isMappingWithBackendEnabled()) { collectSubstitutionsPaths(childContainers, entries); } else { } } else { collectSubstitutionsPaths(childContainers, entries); } } } }
Source:
public Result emailSignIn() { SignIn signInRequest = parseJson(request(), SignIn.class); if (isBlank(signInRequest.getStudyId())) { throw new BadRequestException("Study identifier is required."); } Study study = studyService.getStudy(signInRequest.getStudyId()); verifySupportedVersionOrThrowException(study); CriteriaContext context = getCriteriaContext(study.getStudyIdentifier()); UserSession session = null; try { session = authenticationService.emailSignIn(context, signInRequest); } catch(ConsentRequiredException e) { logAuthenticationSuccess(e.getUserSession()); throw e; } logAuthenticationSuccess(session); return okResult(UserSessionInfo.toJSON(session)); }

Target:
public Result emailSignIn() { SignIn signInRequest = parseJson(request(), SignIn.class); if (isBlank(signInRequest.getStudyId())) { throw new BadRequestException("Study identifier is required."); } Study study = studyService.getStudy(signInRequest.getStudyId()); verifySupportedVersionOrThrowException(study); CriteriaContext context = getCriteriaContext(study.getStudyIdentifier()); UserSession session = null; try { session = authenticationService.emailSignIn(context, signInRequest); } catch(ConsentRequiredException e) { setCookieAndRecordMetrics(e.getUserSession()); throw e; } setCookieAndRecordMetrics(session); return okResult(UserSessionInfo.toJSON(session)); }
Source:
public static Polygon randomPolygon(boolean hasAlt) { org.apache.lucene.geo.Polygon lucenePolygon = GeoTestUtil.nextPolygon(); while(area(lucenePolygon) == 0) { lucenePolygon = GeoTestUtil.nextPolygon(); } if (lucenePolygon.numHoles() > 0) { org.apache.lucene.geo.Polygon[] luceneHoles = lucenePolygon.getHoles(); List<LinearRing> holes = new ArrayList<>(); for (int i = 0; i < lucenePolygon.numHoles(); i++) { org.apache.lucene.geo.Polygon poly = luceneHoles[i]; holes.add(linearRing(poly.getPolyLons(), poly.getPolyLats(), hasAlt)); } return new Polygon(linearRing(lucenePolygon.getPolyLons(), lucenePolygon.getPolyLats(), hasAlt), holes); } return new Polygon(linearRing(lucenePolygon.getPolyLons(), lucenePolygon.getPolyLats(), hasAlt)); }

Target:
public static Polygon randomPolygon(boolean hasAlt) { org.apache.lucene.geo.Polygon lucenePolygon = randomValueOtherThanMany(p -> area(p) == 0, GeoTestUtil::nextPolygon); if (lucenePolygon.numHoles() > 0) { org.apache.lucene.geo.Polygon[] luceneHoles = lucenePolygon.getHoles(); List<LinearRing> holes = new ArrayList<>(); for (int i = 0; i < lucenePolygon.numHoles(); i++) { org.apache.lucene.geo.Polygon poly = luceneHoles[i]; holes.add(linearRing(poly.getPolyLons(), poly.getPolyLats(), hasAlt)); } return new Polygon(linearRing(lucenePolygon.getPolyLons(), lucenePolygon.getPolyLats(), hasAlt), holes); } return new Polygon(linearRing(lucenePolygon.getPolyLons(), lucenePolygon.getPolyLats(), hasAlt)); }
Source:
public boolean isKeyFrame(RawPacket pkt) { byte[] buf = pkt.getBuffer(); int off = pkt.getOffset(); int len = pkt.getLength(); if (frameMarkingsExtensionId != -1) { RawPacket.HeaderExtensions hes = pkt.getHeaderExtensions(); while (hes.hasNext()) { RawPacket.HeaderExtension he = hes.next(); if (he.getExtId() == frameMarkingsExtensionId) { return FrameMarkingHeaderExtension.isKeyframe(he); } } if (logger.isDebugEnabled()) { logger.debug("Packet with no frame marking, while frame marking" + " is enabled."); } } REDBlock redBlock = getPayloadBlock(buf, off, len); if (redBlock == null || redBlock.getLength() == 0) { return false; } final byte vp8PT = getDynamicRTPPayloadType(Constants.VP8), h264PT = getDynamicRTPPayloadType(Constants.H264); if (redBlock.getPayloadType() == vp8PT) { return org.jitsi.impl.neomedia.codec.video.vp8.DePacketizer .isKeyFrame(buf, redBlock.getOffset(), redBlock.getLength()); } else if (redBlock.getPayloadType() == h264PT) { return org.jitsi.impl.neomedia.codec.video.h264.DePacketizer .isKeyFrame( redBlock.getBuffer(), redBlock.getOffset(), redBlock.getLength()); } else { return false; } }

Target:
public boolean isKeyFrame(RawPacket pkt) { if (!RTPPacketPredicate.INSTANCE.test(pkt)) { return false; } byte[] buf = pkt.getBuffer(); int off = pkt.getOffset(); int len = pkt.getLength(); if (frameMarkingsExtensionId != -1) { RawPacket.HeaderExtensions hes = pkt.getHeaderExtensions(); while (hes.hasNext()) { RawPacket.HeaderExtension he = hes.next(); if (he.getExtId() == frameMarkingsExtensionId) { return FrameMarkingHeaderExtension.isKeyframe(he); } } if (logger.isDebugEnabled()) { logger.debug("Packet with no frame marking, while frame marking" + " is enabled."); } } REDBlock redBlock = getPayloadBlock(buf, off, len); if (redBlock == null || redBlock.getLength() == 0) { return false; } final byte vp8PT = getDynamicRTPPayloadType(Constants.VP8), h264PT = getDynamicRTPPayloadType(Constants.H264); if (redBlock.getPayloadType() == vp8PT) { return org.jitsi.impl.neomedia.codec.video.vp8.DePacketizer .isKeyFrame(buf, redBlock.getOffset(), redBlock.getLength()); } else if (redBlock.getPayloadType() == h264PT) { return org.jitsi.impl.neomedia.codec.video.h264.DePacketizer .isKeyFrame( redBlock.getBuffer(), redBlock.getOffset(), redBlock.getLength()); } else { return false; } }
Source:
protected void trackScriptEnd(Resource statusResource, String status, String output) { try { ModifiableValueMap properties = statusResource.adaptTo(ModifiableValueMap.class); properties.put(SCRIPT_STATUS, status); properties.put(SCRIPT_DATE_END, Calendar.getInstance()); if (output != null) { properties.put(SCRIPT_OUTPUT, output); } statusResource.getResourceResolver().commit(); } catch (PersistenceException e) { logger.error("On-deploy script status node could not be updated: - status: {}", statusResource.getPath(), status); throw new OnDeployEarlyTerminationException(e); } }

Target:
protected void trackScriptEnd(Resource statusResource, String status, String output) { try { ModifiableValueMap properties = statusResource.adaptTo(ModifiableValueMap.class); properties.put(SCRIPT_STATUS, status); properties.put(SCRIPT_DATE_END, Calendar.getInstance()); properties.put(SCRIPT_OUTPUT, output); statusResource.getResourceResolver().commit(); } catch (PersistenceException e) { logger.error("On-deploy script status node could not be updated: - status: {}", statusResource.getPath(), status); throw new OnDeployEarlyTerminationException(e); } }
Source:
public Long getDbGeneration(Guid id) { return getCallsHandler().executeRead("GetDbGeneration", new ParameterizedRowMapper<Long>() { @Override public Long mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getLong(1); }; } , getCustomMapSqlParameterSource() .addValue("vm_guid", id)); }

Target:
public Long getDbGeneration(Guid id) { return getCallsHandler().executeRead("GetDbGeneration", createLongMapper() , getCustomMapSqlParameterSource() .addValue("vm_guid", id)); }
Source:
private IBinding resolveBindingPromiscuous() { if (fBinding == null) { try { CPPSemantics.disablePromiscuousBindingResolution(); resolveBindingNormal(); } finally { CPPSemantics.enablePromiscuousBindingResolution(); } } if (!(fBinding instanceof ProblemBinding)) { return fBinding; } ProblemBinding problem = (ProblemBinding) fBinding; if (problem.getPromiscuousBinding() == null) { IBinding promiscuous = resolveBindingNormal(); problem.setPromiscuousBinding(promiscuous); fBinding = problem; } return problem.getPromiscuousBinding(); }

Target:
private IBinding resolveBindingPromiscuous() { if (fBinding == null) { try { CPPSemantics.disablePromiscuousBindingResolution(); resolveBindingNormal(); } finally { CPPSemantics.enablePromiscuousBindingResolution(); } } if (!(fBinding instanceof ProblemBinding)) { return fBinding; } ProblemBinding problem = (ProblemBinding) fBinding; IBinding promiscuous = problem.getPromiscuousBinding(); if (promiscuous == null) { promiscuous = resolveBindingNormal(); problem.setPromiscuousBinding(promiscuous); fBinding = problem; } return promiscuous; }
Source:
List<Tool> refreshToolsForUser(Long userId, String organization, String repository) { refreshBitbucketToken(userId); List<Token> tokens = tokenDAO.findByUserId(userId); Token quayToken = Token.extractToken(tokens, TokenType.QUAY_IO); Token githubToken = Token.extractToken(tokens, TokenType.GITHUB_COM); Token bitbucketToken = Token.extractToken(tokens, TokenType.BITBUCKET_ORG); Token gitlabToken = Token.extractToken(tokens, TokenType.GITLAB_COM); checkTokens(quayToken, githubToken, bitbucketToken, gitlabToken); if (quayToken == null) { throw new CustomWebApplicationException("Missing required Quay.io token", HttpStatus.SC_BAD_REQUEST); } QuayImageRegistry registry = new QuayImageRegistry(quayToken); return new ArrayList<>( registry.refreshTool(userId, userDAO, toolDAO, tagDAO, fileDAO, fileFormatDAO, client, githubToken, bitbucketToken, gitlabToken, organization, eventDAO, dashboardPrefix, repository)); }

Target:
List<Tool> refreshToolsForUser(Long userId, String organization, String repository) { refreshBitbucketToken(userId); List<Token> tokens = tokenDAO.findByUserId(userId); Token quayToken = Token.extractToken(tokens, TokenType.QUAY_IO); Token githubToken = Token.extractToken(tokens, TokenType.GITHUB_COM); Token bitbucketToken = Token.extractToken(tokens, TokenType.BITBUCKET_ORG); Token gitlabToken = Token.extractToken(tokens, TokenType.GITLAB_COM); checkTokens(quayToken, githubToken, bitbucketToken, gitlabToken); if (quayToken == null) { throw new CustomWebApplicationException("Missing required Quay.io token", HttpStatus.SC_BAD_REQUEST); } QuayImageRegistry registry = new QuayImageRegistry(quayToken); return registry.refreshTool(userId, userDAO, toolDAO, tagDAO, fileDAO, fileFormatDAO, client, githubToken, bitbucketToken, gitlabToken, organization, eventDAO, dashboardPrefix, repository); }
Source:
public ImportVmTemplateCommand(ImportVmTemplateParameters parameters) { super(parameters); setVmTemplate(parameters.getVmTemplate()); parameters.setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); setStoragePoolId(parameters.getStoragePoolId()); setVdsGroupId(parameters.getVdsGroupId()); setStorageDomainId(parameters.getStorageDomainId()); ImportUtils.updateGraphicsDevices(getVmTemplate(), getVmTemplate().getCompatibilityVersion()); }

Target:
public ImportVmTemplateCommand(ImportVmTemplateParameters parameters) { super(parameters); setVmTemplate(parameters.getVmTemplate()); parameters.setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); setStoragePoolId(parameters.getStoragePoolId()); setClusterId(parameters.getClusterId()); setStorageDomainId(parameters.getStorageDomainId()); setEffectiveCompatibilityVersion(CompatibilityVersionUtils.getEffective(getVmTemplate(), this::getCluster)); ImportUtils.updateGraphicsDevices(getVmTemplate(), getEffectiveCompatibilityVersion()); }
Source:
private void isConsentCookieSetToAccepted() { final String cookieValue = driver.manage().getCookieNamed("euconsent").getValue(); Assertion.assertEquals(cookieValue.length(), 48, "Incorrect length of accepted euconsent value"); }

Target:
private void isConsentCookieSetToAccepted() { Assertion.assertEquals( getEuConsentCookieValue().length(), 48, "Incorrect length of accepted euconsent value" ); }
Source:
public String getImageURLFromGallery(String articleName) { for (WebElement page : categoryGalleryItems) { if (page.findElement(By.cssSelector("a")).getAttribute("title").equals(articleName)) { return page.findElement(By.cssSelector("img")).getAttribute("src"); } } return null; }

Target:
public String getImageURLFromGallery(String articleName) { for (WebElement page : categoryGalleryItems) { if (page.findElement(By.cssSelector("a")).getAttribute("title").equals(articleName)) { return page.findElement(By.cssSelector("img")).getAttribute("src"); } } throw new NoSuchElementException( String.format("Could not find article with name %s", articleName)); }
Source:
public void shouldThrowConflictExceptionWhenCreatingAccountWithExistingName() throws Exception { AccountImpl account = accounts[0]; account.setName(accounts[1].getName()); accountDao.create(account); }

Target:
public void shouldThrowConflictExceptionWhenCreatingAccountWithExistingName() throws Exception { AccountImpl account = new AccountImpl(NameGenerator.generate("account", 5), accounts[0].getName(), "test"); accountDao.create(account); }