auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean executeCommand(String command) { ICommandService commandService = getCommandService(); IHandlerService handlerService = getHandlerService(); if (commandService == null || handlerService == null) { CheatSheetPlugin.logError( "Could not get ICommandService or IHandlerService while trying to execute: " + command, null); return false; } try { ParameterizedCommand pCommand = commandService.deserialize(command); handlerService.executeCommand(pCommand, null); return true; } catch (CommandException e) { CheatSheetPlugin.logError("Could not execute command: " + command, e); return false; } }

Target:
private boolean executeCommand(String command) { ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class); if (commandService == null || handlerService == null) { CheatSheetPlugin.logError( "Could not get ICommandService or IHandlerService while trying to execute: " + command, null); return false; } try { ParameterizedCommand pCommand = commandService.deserialize(command); handlerService.executeCommand(pCommand, null); return true; } catch (CommandException e) { CheatSheetPlugin.logError("Could not execute command: " + command, e); return false; } }
Source:
public ConnectionType setNetworkConnection( ConnectionType type) { Map<String, Integer> mode = ImmutableMap.of("type", type.getBitMask()); return new ConnectionType(((Number) executeMethod.execute(DriverCommand.SET_NETWORK_CONNECTION, ImmutableMap .of("parameters", mode))) .intValue()); }

Target:
public ConnectionType setNetworkConnection( ConnectionType type) { Map<String, ConnectionType> mode = ImmutableMap.of("type", type); return new ConnectionType(((Number) executeMethod.execute(DriverCommand.SET_NETWORK_CONNECTION, ImmutableMap .of("parameters", mode))) .intValue()); }
Source:
public List<String> getGroupNamesForUser(String userName) { if (userName == null) { return new ArrayList<>(); } AuthUser user = getUser(userName); if (user == null) { return new ArrayList<>(); } return user.getGroupNames(); }

Target:
public List<String> getGroupNamesForUser(String userName) { if (userName == null) { return Collections.emptyList(); } AuthUser user = getUser(userName); if (user == null) { return Collections.emptyList(); } return user.getGroupNames(); }
Source:
private String generateName(BaseArtifactType artifact) { String name = ""; String artifactId = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_ARTIFACT_ID); String version = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_VERSION); String snapshotId = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_SNAPSHOT_ID); String classifier = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_CLASSIFIER); String type = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_TYPE); if (artifact.getName().contains(artifactId)) { name += artifactId; if (version.contains("SNAPSHOT")) { if (StringUtils.isNotBlank(snapshotId)) { name += MAVEN_SEPARATOR + version.substring(0, version.indexOf("SNAPSHOT")) + snapshotId; } else { name += MAVEN_SEPARATOR + version; } } else { name += MAVEN_SEPARATOR + version; } if (classifier != null) { name += MAVEN_SEPARATOR + classifier; } name += MAVEN_FILE_EXTENSION_SEPARATOR + type; return name; } else { return artifact.getName(); } }

Target:
private String generateName(BaseArtifactType artifact) { String artifactId = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_ARTIFACT_ID); String version = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_VERSION); String snapshotId = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_SNAPSHOT_ID); String classifier = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_CLASSIFIER); String type = SrampModelUtils.getCustomProperty(artifact, JavaModel.PROP_MAVEN_TYPE); if (artifact.getName().contains(artifactId)) { StringBuilder name = new StringBuilder(""); name.append(artifactId); if (version.contains("SNAPSHOT")) { if (StringUtils.isNotBlank(snapshotId)) { name.append(MAVEN_SEPARATOR).append(version.substring(0, version.indexOf("SNAPSHOT"))).append(snapshotId); } else { name.append(MAVEN_SEPARATOR).append(version); } } else { name.append(MAVEN_SEPARATOR).append(version); } if (classifier != null) { name.append(MAVEN_SEPARATOR).append(classifier); } name.append(MAVEN_FILE_EXTENSION_SEPARATOR).append(type); return name.toString(); } else { return artifact.getName(); } }
Source:
public <V extends DirectiveValue, T extends Directive<V>> void addDirective(@Nonnull T d) { Directive<? extends DirectiveValue> directive = this.directives.get(d.getClass()); if (directive == null) { this.directives.put(d.getClass(), d); this.expandDefaultSrc(); this.resolveSelf(); this.optimise(); } else { throw new IllegalArgumentException( "Policy contains more than one " + directive.getName() + " directive. All but the first instance will be ignored."); } }

Target:
public <V extends DirectiveValue, T extends Directive<V>> void addDirective(@Nonnull T d) { Directive<? extends DirectiveValue> directive = this.directives.get(d.getClass()); if (directive == null) { this.directives.put(d.getClass(), d); this.expandDefaultSrc(); this.resolveSelf(); this.optimise(); } }
Source:
public void putAll(Map<? extends String, ? extends List<Object>> map) { for (Map.Entry<? extends String, ? extends List<Object>> entry : map.entrySet()) { List<Object> objs = entry.getValue(); putResponseHeader(entry.getKey(), objs.get(0)); for (int i=1; i < objs.size(); i++) { add(entry.getKey(), objs.get(i)); } } }

Target:
public void putAll(Map<? extends String, ? extends List<Object>> map) { for (Map.Entry<? extends String, ? extends List<Object>> entry : map.entrySet()) { List<Object> objs = entry.getValue(); if (!objs.isEmpty()) { putResponseHeader(entry.getKey(), objs.get(0)); for (int i = 1; i < objs.size(); i++) { add(entry.getKey(), objs.get(i)); } } } }
Source:
public void createControl(Composite parent) { fPane= new CreateTextFilePreviewer(parent, SWT.BORDER | SWT.FLAT); Dialog.applyDialogFont(fPane); fSourceViewer = new SourceViewer(fPane, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); fSourceViewer.setEditable(false); Control sourceViewerControl= fSourceViewer.getControl(); sourceViewerControl.setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); IPreferenceStore preferenceStore= EditorsUI.getPreferenceStore(); Color bg = getColorFromStore(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, sourceViewerControl.getDisplay()); Color fg = getColorFromStore(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, sourceViewerControl.getDisplay()); sourceViewerControl.setBackground(bg); sourceViewerControl.setForeground(fg); disposeColors(); fForegroundColor= fg; fBackgroundColor= bg; sourceViewerControl.addDisposeListener(e -> disposeColors()); fPane.setContent(sourceViewerControl); }

Target:
public void createControl(Composite parent) { fPane= new CreateTextFilePreviewer(parent, SWT.BORDER | SWT.FLAT); Dialog.applyDialogFont(fPane); fSourceViewer = new SourceViewer(fPane, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); fSourceViewer.setEditable(false); Control sourceViewerControl= fSourceViewer.getControl(); sourceViewerControl.setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); IPreferenceStore preferenceStore= EditorsUI.getPreferenceStore(); Color bg = getColorFromStore(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, sourceViewerControl.getDisplay()); Color fg = getColorFromStore(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, sourceViewerControl.getDisplay()); Color selBg = getColorFromStore(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND, sourceViewerControl.getDisplay()); Color selFg = getColorFromStore(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND, sourceViewerControl.getDisplay()); sourceViewerControl.setBackground(bg); sourceViewerControl.setForeground(fg); if (sourceViewerControl instanceof StyledText) { StyledText styledText = (StyledText) sourceViewerControl; styledText.setSelectionBackground(selBg); styledText.setSelectionForeground(selFg); } disposeColors(); fForegroundColor= fg; fBackgroundColor= bg; fSelectionForegroundColor= selFg; fSelectionBackgroundColor= selBg; sourceViewerControl.addDisposeListener(e -> disposeColors()); fPane.setContent(sourceViewerControl); }
Source:
protected ReferencedEnvelope calculateBounds() { ReferencedEnvelope extent = ReferencedEnvelope.create( getSchema().getCoordinateReferenceSystem() ); for( SimpleFeature feature : list ){ if( feature == null ) continue; ReferencedEnvelope bbox = ReferencedEnvelope.reference( feature.getBounds() ); if( bbox == null || bbox.isEmpty() || bbox.isNull() ) continue; extent.expandToInclude( bbox ); } return extent; }

Target:
protected ReferencedEnvelope calculateBounds() { ReferencedEnvelope extent = ReferencedEnvelope.create( getSchema().getCoordinateReferenceSystem() ); for( SimpleFeature feature : list ){ if( feature == null ) { continue; } ReferencedEnvelope bbox = ReferencedEnvelope.reference( feature.getBounds() ); if( bbox == null || bbox.isEmpty() || bbox.isNull() ) { continue; } extent.expandToInclude( bbox ); } return extent; }
Source:
protected void updateRows(long topicId) { ReplyThread thread = ReplyController.get().getThread(topicId); List<ForumMessage> messages = thread.getMessages(start); int totalCount = ReplyController.get().getThread(topic.id).getTotalCount(); assert messages.size() >= Math.min(ServiceConstants.SHORT_STEP_VALUE, totalCount - start) : "ForumMessageProvider: messages for cell list is not adequate" ; updateRowData(start, messages); updateRowCount(totalCount, true); }

Target:
protected void updateRows(long topicId) { ReplyThread thread = ReplyController.get().getThread(topicId); List<ForumMessage> messages = thread.getMessages(start); int totalCount = ReplyController.get().getThread(topic.id).getTotalCount(); if (messages.size() < Math.min(ServiceConstants.SHORT_STEP_VALUE, totalCount - start)) { throw new RuntimeException("ForumMessageProvider: messages for cell list is not adequate") ; } updateRowData(start, messages); updateRowCount(totalCount, true); }
Source:
public Publisher publish(Event event) { List<Subscription> subscriptions = subscriptionsByEvent.getOrDefault(event.getClass(), emptyList()); if (!subscriptions.isEmpty()) { List<Subscription> toHandle = subscriptions.stream() .filter(subscription -> subscription.matches(event)) .collect(toList()); subscriptions.stream() .filter(subscription -> subscription.needUnsubscribeAfter(event)) .forEach(this::unsubscribe); if (event instanceof Single) { subscriptionsByEvent.remove(event.getClass()); } if (!toHandle.isEmpty()) { executor.execute(new Command(toHandle, event)); } } return this; }

Target:
public Publisher publish(Event event) { List<Subscription> subscriptions = subscriptionsByEvent.getOrDefault(event.getClass(), emptyList()); subscriptions.stream() .filter(subscription -> subscription.matches(event)) .map(subscription -> new Command(subscription, event)) .forEach(executor::execute); subscriptions.stream() .filter(subscription -> subscription.needUnsubscribeAfter(event)) .forEach(this::unsubscribe); if (event instanceof OneOffEvent) { subscriptionsByEvent.remove(event.getClass()); } return this; }
Source:
public AdsBaseObject triggerIncontentLeaderboard() { final String incontentLeaderboard = AdsContent.getSlotSelector(AdsContent.INCONTENT_LEADERBOARD); try { new WebDriverWait(driver, 5).until(new ExpectedCondition<Object>() { @Override public Object apply(WebDriver webDriver) { jsActions.execute("$('#mw-content-text h2')[1].scrollIntoView(true);"); return driver.findElements(By.cssSelector(incontentLeaderboard)).size() > 0; } }); } catch (org.openqa.selenium.TimeoutException e) { PageObjectLogging.logError("Incontent leaderboard", e); } return this; }

Target:
public AdsBaseObject triggerIncontentLeaderboard() { triggerAdSlot(AdsContent.getSlotSelector(AdsContent.INCONTENT_LEADERBOARD), "$('#mw-content-text h2')[1].scrollIntoView(true);"); return this; }
Source:
public void triggerMisfired(Trigger trigger) { log.warn("Trigger misfired for for Job: \nKey: {}\nJob Key: {}\nStart: {}\nEnd: {}\n" + "Final Fire Time: {}\nNext Fire Time: {}\nMisfire Instruction: {}\nPriority: {}", trigger.getKey(), trigger.getJobKey(), trigger.getStartTime(), trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getNextFireTime(), trigger.getMisfireInstruction(), trigger.getPriority()); String id = trigger.getJobKey().getName(); JobStatus js = jobCurator.find(id); if (js == null) { throw new RuntimeException("No JobStatus for job with id of " + id); } if (!trigger.mayFireAgain()) { log.warn("Job not allowed to fire again. Setting state to FAILED.", id); js.setState(JobStatus.JobState.FAILED); js.setResult("Failed run. Will not attempt again."); } else { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); js.setResult("Will reattempt job at or after " + sdf.format(trigger.getNextFireTime())); js.setState(JobStatus.JobState.PENDING); } jobCurator.merge(js); }

Target:
public void triggerMisfired(Trigger trigger) { log.warn("Trigger misfired for for Job: \nKey: {}\nJob Key: {}\nStart: {}\nEnd: {}\n" + "Final Fire Time: {}\nNext Fire Time: {}\nMisfire Instruction: {}\nPriority: {}", trigger.getKey(), trigger.getJobKey(), trigger.getStartTime(), trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getNextFireTime(), trigger.getMisfireInstruction(), trigger.getPriority()); try { String id = trigger.getJobKey().getName(); JobStatus js = jobCurator.find(id); if (js == null) { throw new RuntimeException("No JobStatus for job with id of " + id); } if (!trigger.mayFireAgain()) { log.warn("Job not allowed to fire again. Setting state to FAILED.", id); js.setState(JobStatus.JobState.FAILED); js.setResult("Failed run. Will not attempt again."); } else { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); js.setResult("Will reattempt job at or after " + sdf.format(trigger.getNextFireTime())); js.setState(JobStatus.JobState.PENDING); } jobCurator.merge(js); } catch (Exception e) { log.error("Unable to capture misfire into job status: {}", e.getMessage()); } }
Source:
public MaterialDialog showDiscardChangesDialog() { MaterialDialog discardDialog = new MaterialDialog.Builder(this) .content(R.string.discard_unsaved_changes) .positiveText(R.string.dialog_ok) .negativeText(R.string.dialog_cancel) .onPositive((dialog, which) -> { Timber.i("TemplateEditor:: OK button pressed to confirm discard changes"); clearTempModelFiles(this); mEditedModelFileName = null; mEditedModel = null; finishWithAnimation(ActivityTransitionAnimation.RIGHT); }) .build(); discardDialog.show(); return discardDialog; }

Target:
public MaterialDialog showDiscardChangesDialog() { MaterialDialog discardDialog = DiscardChangesDialog.getDefault(this) .onPositive((dialog, which) -> { Timber.i("TemplateEditor:: OK button pressed to confirm discard changes"); TemporaryModel.clearTempModelFiles(); mTempModel = null; finishWithAnimation(ActivityTransitionAnimation.RIGHT); }) .build(); discardDialog.show(); return discardDialog; }
Source:
public GenericRecord toAvro(Schema schema, DocumentModel input) { String logicalType = getLogicalType(schema); GenericRecord record = new GenericData.Record(schema); if (DOCUMENT_MODEL.equals(logicalType)) { record.put(PATH, input.getPathAsString()); record.put(ID, input.getId()); } for (Field field : schema.getFields()) { if (field.name().equals(ID) || field.name().equals(PATH)) { continue; } if (field.schema().getType() == Type.RECORD && (DOCUMENT_MODEL.equals(logicalType) || DOCUMENT_TYPE.equals(logicalType))) { record.put(field.name(), service.toAvro(field.schema(), input)); } else { Property p = input.getProperty(service.decodeName(field.name())); record.put(field.name(), service.toAvro(field.schema(), p)); } } return record; }

Target:
public GenericRecord toAvro(Schema schema, DocumentModel input) { String logicalType = getLogicalType(schema); GenericRecord record = new GenericData.Record(schema); if (DOCUMENT_MODEL.equals(logicalType)) { record.put(PATH, input.getPathAsString()); record.put(UUID, input.getId()); } for (Field field : schema.getFields()) { if (field.name().equals(UUID) || field.name().equals(PATH)) { continue; } if (field.schema().getType() == Type.RECORD && (DOCUMENT_MODEL.equals(logicalType) || DOCUMENT_TYPE.equals(logicalType))) { record.put(field.name(), service.toAvro(field.schema(), input)); } else { Property p = input.getProperty(service.decodeName(field.name())); record.put(field.name(), service.toAvro(field.schema(), p)); } } return record; }
Source:
public VersionNumber getNeededDependenciesMinimumJavaVersion() { VersionNumber versionNumber = null; try { versionNumber = minimumJavaVersion == null ? null : new VersionNumber(minimumJavaVersion); } catch (NumberFormatException nfe) { logBadMinJavaVersion("'minimumJavaVersion' was specified for plugin ''{0}'' but unparseable (received {1})", this.name, minimumJavaVersion); } for (Plugin p: getNeededDependencies()) { VersionNumber v = p.getNeededDependenciesMinimumJavaVersion(); if (v == null) { continue; } if (versionNumber == null || v.isNewerThan(versionNumber)) { versionNumber = v; } } return versionNumber; }

Target:
public VersionNumber getNeededDependenciesMinimumJavaVersion() { VersionNumber versionNumber = null; try { versionNumber = minimumJavaVersion == null ? null : new VersionNumber(minimumJavaVersion); } catch (NumberFormatException nfe) { logBadMinJavaVersion(); } for (Plugin p: getNeededDependencies()) { VersionNumber v = p.getNeededDependenciesMinimumJavaVersion(); if (v == null) { continue; } if (versionNumber == null || v.isNewerThan(versionNumber)) { versionNumber = v; } } return versionNumber; }
Source:
private boolean isMandatory(MethodExpression expression) { return expression.getMethod().getWords().get(0).equals(MANDATORY) ? true : false; }

Target:
private boolean isMandatory(MethodExpression expression) { return expression.getMethod().equals(MANDATORY) ? true : false; }
Source:
private String receive(TelnetClient client) { StringBuffer strBuffer; try { strBuffer = new StringBuffer(); byte[] buf = new byte[4096]; int len = 0; Thread.sleep(750L); while ((len = client.getInputStream().read(buf)) != 0) { strBuffer.append(new String(buf, 0, len)); Thread.sleep(750L); if (client.getInputStream().available() == 0) break; } return strBuffer.toString(); } catch (Exception e) { logger.warn("Could not send command " + command, e); } return null; }

Target:
private String receive(TelnetClient client) { StringBuffer strBuffer; try { strBuffer = new StringBuffer(); byte[] buf = new byte[4096]; int len = 0; Thread.sleep(750L); while ((len = client.getInputStream().read(buf)) != 0) { strBuffer.append(new String(buf, 0, len)); Thread.sleep(750L); if (client.getInputStream().available() == 0) break; } return strBuffer.toString(); } catch (Exception e) { logger.warn("Error receiving data", e); } return null; }
Source:
public void registerCache(String name) { CacheDescriptor defaultDescriptor = registry.getCacheDescriptor(DEFAULT_CACHE_ID); if (defaultDescriptor == null) { registerCache(name, DEFAULT_MAX_SIZE, DEFAULT_TTL, new CacheDescriptor()); } else { registerCache(name, defaultDescriptor.clone()); } }

Target:
public void registerCache(String name) { CacheDescriptor defaultDescriptor = registry.getDefaultDescriptor(); defaultDescriptor.name = name; registerCacheDescriptor(defaultDescriptor); maybeStart(name); }
Source:
public void csv_entriesAreEscaped() { CsvEntity csvEntity = new CsvEntity(); Map jsonMap = ImmutableMap.of( "hash", "hash1", "entry", ImmutableMap.of( "key1", "valu\te1", "key2", "val,ue2", "key3", "val\"ue3", "key4", "val\nue4" ) ); JsonNode node = JsonObjectMapper.convert(jsonMap, JsonNode.class); AbstractView view = new SingleResultView("foo", node); Object result = csvEntity.convert(view); assertThat(result.toString(), equalTo("hash,key1,key2,key3,key4\nhash1,valu\te1,\"val,ue2\",\"val\"\"ue3\",\"val\nue4\"")); }

Target:
public void csv_entriesAreEscaped() { CsvEntity csvEntity = new CsvEntity(); Map jsonMap = ImmutableMap.of( "hash", "hash1", "entry", ImmutableMap.of( "key1", "valu\te1", "key2", "val,ue2", "key3", "val\"ue3", "key4", "val\nue4" ) ); JsonNode node = JsonObjectMapper.convert(jsonMap, JsonNode.class); AbstractView view = new SingleResultView("foo", node); Object result = csvEntity.convert(view); assertThat(result.toString(), equalTo("hash,key1,key2,key3,key4\r\nhash1,valu\te1,\"val,ue2\",\"val\"\"ue3\",\"val\nue4\"")); }
Source:
public Money getMaintenanceCosts() { if (campaignOptions.payForMaintain()) { return getHangar().getUnitsStream() .filter(u -> u.requiresMaintenance() && null != u.getTech()) .map(Unit::getMaintenanceCost) .reduce(Money.zero(), (a, b) -> a.plus(b)); } return Money.zero(); }

Target:
public Money getMaintenanceCosts() { if (campaignOptions.payForMaintain()) { return getHangar().getUnitsStream() .filter(u -> u.requiresMaintenance() && (null != u.getTech())) .map(Unit::getMaintenanceCost) .reduce(Money.zero(), (a, b) -> a.plus(b)); } return Money.zero(); }
Source:
public void init() { post( "/feedback", APPLICATION_JSON, (req, res) -> { if (StringUtils.isNotEmpty(emailDestination)) { FeedbackRequest feedback = parseFeedbackRequest(util.safeGetBody(req)); feedback.setAuthUsername(getCurrentUser()); String emailSubject = getEmailSubject(feedback); String emailBody = getEmailBody(feedback); if (emailBody != null) { emailBody = emailBody.replaceAll("\\\\n", "\n"); } else { emailBody = ""; } Session emailSession = smtpClient.createSession(); MimeMessage message = new MimeMessage(emailSession); message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailDestination)); message.setSubject(emailSubject); message.setContent(emailBody, "text/html; charset=utf-8"); smtpClient.send(message); res.body("{}"); res.status(200); return res; } else { res.status(500); res.body("No destination email configured, feedback cannot be submitted."); LOGGER.debug("Feedback submission failed, destination email is not configured."); return res; } }); exception( Exception.class, (e, request, response) -> { response.status(500); response.body("Error submitting feedback"); LOGGER.debug("Feedback submission failed", e); }); enableRouteOverview(); }

Target:
public void init() { post( "/feedback", APPLICATION_JSON, (req, res) -> { if (StringUtils.isNotEmpty(emailDestination)) { FeedbackRequest feedback = parseFeedbackRequest(util.safeGetBody(req)); feedback.setAuthUsername(getCurrentUser()); String emailSubject = getEmailSubject(feedback); String emailBody = getEmailBody(feedback); if (emailBody != null) { emailBody = emailBody.replaceAll("\\\\n", "\n"); } else { emailBody = "<html/>"; } Session emailSession = smtpClient.createSession(); MimeMessage message = new MimeMessage(emailSession); message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailDestination)); message.setSubject(emailSubject); message.setContent(emailBody, "text/html; charset=utf-8"); smtpClient.send(message); res.body("{}"); res.status(200); return res; } else { res.status(500); res.body("No destination email configured, feedback cannot be submitted."); LOGGER.debug("Feedback submission failed, destination email is not configured."); return res; } }); exception( Exception.class, (e, request, response) -> { response.status(500); response.body("Error submitting feedback"); LOGGER.debug("Feedback submission failed", e); }); enableRouteOverview(); }
Source:
public void testDenseVector() { final double[] value1 = {0.1, 0.2, 0.3, 0.4, 0.5}; final double[] value2 = {0.1, 0.3, 0.5, 0.7, 0.9}; final Vector vec1 = factory.createDense(value1); final Vector vec2 = factory.createDense(value2); final Vector vec3 = factory.createDenseOnes(5); final Vector vec4 = factory.createDenseZeros(5); double dotResult = 0; for (int i = 0; i < vec1.length(); i++) { dotResult += vec1.get(i) * vec2.get(i); } assertEquals(dotResult, vec1.dot(vec2), 0.0); final Vector addVec = vec1.add(vec2); vec1.addi(vec2); assertEquals(addVec, vec1); final Vector scaleVec = vec1.scale(1.5); vec1.scalei(1.5); assertEquals(scaleVec, vec1); final Vector addScaleVec = vec1.add(vec2); vec1.axpy(1.0, vec2); assertEquals(addScaleVec, vec1); assertEquals(vec3, vec4.add(1)); vec4.subi(1); vec3.addi(-2); assertEquals(vec3, vec4); final Vector sliceVec = vec1.slice(2, 4); assertEquals(2, sliceVec.length()); assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); vec1.set(0, 1.0); assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); }

Target:
public void testDenseVector() { final double[] value1 = {0.1, 0.2, 0.3, 0.4, 0.5}; final double[] value2 = {0.1, 0.3, 0.5, 0.7, 0.9}; final Vector vec1 = factory.createDense(value1); final Vector vec2 = factory.createDense(value2); final Vector vec3 = factory.createDenseOnes(5); final Vector vec4 = factory.createDenseZeros(5); double dotResult = 0; for (int i = 0; i < vec1.length(); i++) { dotResult += vec1.get(i) * vec2.get(i); } assertEquals(dotResult, vec1.dot(vec2), 0.0); final Vector addVec = vec1.add(vec2); vec1.addi(vec2); assertEquals(addVec, vec1); final Vector scaleVec = vec1.scale(1.5); vec1.scalei(1.5); assertEquals(scaleVec, vec1); final Vector addScaleVec = vec1.add(vec2); vec1.axpy(1.0, vec2); assertEquals(addScaleVec, vec1); assertEquals(vec3, vec4.add(1)); vec4.subi(1); vec3.addi(-2); assertEquals(vec3, vec4); final Vector sliceVec = vec1.slice(2, 4); assertEquals(2, sliceVec.length()); assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); sliceVec.set(0, 1.0); assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); }
Source:
public Reply<?> fetchAll() { List<CAPMessage> messages = repository.findAll(); if (messages.isEmpty()) { return Reply.with("Not found available messages").notFound(); } List<CAPMessageDTO> dtos = adaptCAPMessages(messages); return Reply.with(dtos).as(Json.class).ok(); }

Target:
public Reply<?> fetchAll() { List<CapMessage> messages = repository.findAll(); List<CapMessageDTO> dtos = adapt(messages); return Reply.with(dtos).as(Json.class).ok(); }
Source:
public static String getTime(long time) { if(time < 0) { return ""; } StringBuilder ret = new StringBuilder(); ret.append(new Date(time).toString()); ret.append(", "); long seconds = (System.currentTimeMillis() - time) / 1000; long day, hou, min, sec; day = seconds / (3600 * 24); seconds -= day * (3600 * 24); hou = seconds / 3600; seconds -= hou * 3600; min = seconds / 60; sec = seconds % 60; if (seconds < 0) { day = Math.abs(day); hou = Math.abs(hou); min = Math.abs(min); sec = Math.abs(sec); ret.append("in "); } if (day > 0) { ret.append(day).append("d "); ret.append(hou).append("h "); } else if (hou > 0) { ret.append(hou).append("h"); ret.append(min).append("mn "); } else if (min > 0) { ret.append(min).append("mn "); } else if (sec > 0) { ret.append(sec).append("s "); } if (seconds > 0) ret.append("ago"); return ret.toString(); }

Target:
public static String getTime(long time) { if(time < 0) { return ""; } StringBuilder ret = new StringBuilder(); ret.append(new Date(time).toString()); ret.append(", "); long seconds = (System.currentTimeMillis() - time) / 1000; long day, hou, min, sec; day = seconds / (3600 * 24); seconds -= day * (3600 * 24); hou = seconds / 3600; seconds -= hou * 3600; min = seconds / 60; sec = seconds % 60; if (seconds < 0) { day = Math.abs(day); hou = Math.abs(hou); min = Math.abs(min); sec = Math.abs(sec); ret.append("in "); } if (day > 0) { ret.append(day).append("d "); ret.append(hou).append("h "); } else if (hou > 0) { ret.append(hou).append("h"); ret.append(min).append("mn "); } else if (min > 0) { ret.append(min).append("mn "); } else if (sec > 0) { ret.append(sec).append("s "); } if (seconds > 0) { ret.append("ago"); } return ret.toString(); }
Source:
private Filter filterNotEqual(JSONArray array) { if (array.size() != 3) { throwUnexpectedArgumentCount("!=", 2); } final FilterFactory2 ff = parse.getFilterFactory(); if (parse.isString(array, 1)) { String key = parse.get(json, 1); Object value = parse.value(json, 2); return ff.notEqual(ff.property(key), ff.literal(value), false); } else { Expression expression1 = parse.string(json, 1); Expression expression2 = parse.string(json, 2); return ff.notEqual(expression1, expression2); } }

Target:
private Filter filterNotEqual(JSONArray array) { if (array.size() != 3) { throwUnexpectedArgumentCount("!=", 2); } Expression expression1 = comparisonExpression1(array); Expression expression2 = comparisonExpression2(array); return ff.notEqual(expression1, expression2); }
Source:
public Response alert(@QueryParam("id") List<Long> anomalyIds) { List<MergedAnomalyResultDTO> anomalies = this.anomalyDAO.findByIds(anomalyIds); for (MergedAnomalyResultDTO anomaly : anomalies) { AnomalySubscriptionGroupNotificationDTO anomalySubscriptionGroupNotificationDTO = new AnomalySubscriptionGroupNotificationDTO(); anomalySubscriptionGroupNotificationDTO.setAnomalyId(anomaly.getId()); anomalySubscriptionGroupNotificationDTO.setDetectionConfigId(anomaly.getDetectionConfigId()); anomalySubscriptionGroupNotificationManager.save(anomalySubscriptionGroupNotificationDTO); } return Response.ok().build(); }

Target:
public Response alert(@QueryParam("id") List<Long> anomalyIds) { List<MergedAnomalyResultDTO> anomalies = this.anomalyDAO.findByIds(anomalyIds); for (MergedAnomalyResultDTO anomaly : anomalies) { DetectionUtils.renotifyAnomaly(anomaly); } return Response.ok().build(); }
Source:
private void registerContributors(RegistryPageContributor contributor, List<String> objectClassNames) { pages.add(contributor); for (String string : objectClassNames) { manager.registerContributor(contributor, string); } }

Target:
private void registerContributors(RegistryPageContributor contributor, List<String> objectClassNames) { pages.add(contributor); for (String className : objectClassNames) { manager.registerContributor(contributor, className); } }
Source:
public void selectionChanged(SelectionChangedEvent event) { CounterChartViewer counterChartViewer = fCounterChartViewer; if (counterChartViewer == null) { return; } if (getTrace() == null) { return; } ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object entry = ((IStructuredSelection) selection).getFirstElement(); if (entry instanceof CounterTreeViewerEntry) { @NonNull Set<@NonNull Integer> quark = new TreeSet<>(); quark.add(((CounterTreeViewerEntry) entry).getQuark()); counterChartViewer.updateChart(quark); } } }

Target:
public void selectionChanged(SelectionChangedEvent event) { CounterChartViewer counterChartViewer = fCounterChartViewer; if (counterChartViewer == null) { return; } if (getTrace() == null) { return; } ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object entry = ((IStructuredSelection) selection).getFirstElement(); if (entry instanceof CounterTreeViewerEntry) { counterChartViewer.updateChart(((CounterTreeViewerEntry) entry).getQuark()); } } }
Source:
private void testNumBackendCalls(boolean optimizeFooterRead) throws Exception { final AzureBlobFileSystem fs = getFileSystem(optimizeFooterRead); for (int i = 1; i <= 4; i++) { String fileName = methodName.getMethodName() + i; int fileSize = i * ONE_MB; byte[] fileContent = getRandomBytesArray(fileSize); Path testFilePath = createFileWithContent(fs, fileName, fileContent); int length = AbfsInputStream.FOOTER_SIZE; try (FSDataInputStream iStream = fs.open(testFilePath)) { byte[] buffer = new byte[length]; Map<String, Long> metricMap = fs.getInstrumentationMap(); long requestsMadeBeforeTest = metricMap .get(CONNECTIONS_MADE.getStatName()); iStream.seek(fileSize - 8); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TEN * ONE_KB)); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TWENTY * ONE_KB)); iStream.read(buffer, 0, length); metricMap = fs.getInstrumentationMap(); long requestsMadeAfterTest = metricMap .get(CONNECTIONS_MADE.getStatName()); if (optimizeFooterRead) { assertEquals(1, requestsMadeAfterTest - requestsMadeBeforeTest); } else { assertEquals(3, requestsMadeAfterTest - requestsMadeBeforeTest); } } } }

Target:
private void testNumBackendCalls(boolean optimizeFooterRead) throws Exception { for (int i = 1; i <= 4; i++) { int fileSize = i * ONE_MB; final AzureBlobFileSystem fs = getFileSystem(optimizeFooterRead, fileSize); String fileName = methodName.getMethodName() + i; byte[] fileContent = getRandomBytesArray(fileSize); Path testFilePath = createFileWithContent(fs, fileName, fileContent); int length = AbfsInputStream.FOOTER_SIZE; try (FSDataInputStream iStream = fs.open(testFilePath)) { byte[] buffer = new byte[length]; Map<String, Long> metricMap = getInstrumentationMap(fs); long requestsMadeBeforeTest = metricMap .get(CONNECTIONS_MADE.getStatName()); iStream.seek(fileSize - 8); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TEN * ONE_KB)); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TWENTY * ONE_KB)); iStream.read(buffer, 0, length); metricMap = getInstrumentationMap(fs); long requestsMadeAfterTest = metricMap .get(CONNECTIONS_MADE.getStatName()); if (optimizeFooterRead) { assertEquals(1, requestsMadeAfterTest - requestsMadeBeforeTest); } else { assertEquals(3, requestsMadeAfterTest - requestsMadeBeforeTest); } } } }
Source:
public static String timestampMillis() { long now = System.currentTimeMillis(); long sec = now / 1000L; long msec = now % 1000L; return String.valueOf(sec) + "." + String.valueOf(msec); }

Target:
public static String timestampMillis() { long now = System.currentTimeMillis(); long secs = TimeUnit.MILLISECONDS.toSeconds(now); long msecs = now - TimeUnit.SECONDS.toMillis(secs); return String.format("%d.%03d", secs, msecs); }
Source:
public int liveMemberCount() { return callsOnInstance(() -> Gossiper.instance.getLiveMembers().size()).call(); }

Target:
public int liveMemberCount() { return sync(() -> Gossiper.instance.getLiveMembers()).call().size(); }
Source:
void read() { for (int bookieIndex : writeSet) { InetSocketAddress to = ensemble.get(bookieIndex); try { sendReadTo(to, this); } catch (InterruptedException ie) { LOG.error("Interrupted reading entry : ", this, ie); Thread.currentThread().interrupt(); fail(BKException.Code.InterruptedException); return; } } }

Target:
void read() { for (int bookieIndex : writeSet) { BookieSocketAddress to = ensemble.get(bookieIndex); try { sendReadTo(to, this); } catch (InterruptedException ie) { LOG.error("Interrupted reading entry : ", this, ie); Thread.currentThread().interrupt(); fail(BKException.Code.InterruptedException); return; } } }
Source:
protected void perform(HttpAction action) { Cache cache = SPARQL_Query_Cache.getCache(); cache.clear(); ContentType ct = FusekiLib.getContentType(action) ; if ( ct == null ) ct = ctSPARQLUpdate ; if ( matchContentType(ctSPARQLUpdate, ct) ) { executeBody(action) ; return ; } if ( isHtmlForm(ct) ) { executeForm(action) ; return ; } ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: " + action.request.getContentType()) ; }

Target:
protected void perform(HttpAction action) { Cache cache = SPARQL_Query_Cache.getCache(SPARQL_Query_Cache.getDatasetUri(action)); cache.clear(); ContentType ct = FusekiLib.getContentType(action) ; if ( ct == null ) ct = ctSPARQLUpdate ; if ( matchContentType(ctSPARQLUpdate, ct) ) { executeBody(action) ; return ; } if ( isHtmlForm(ct) ) { executeForm(action) ; return ; } ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: " + action.request.getContentType()) ; }
Source:
private String getErrorCode(String responseBody) { try { JSONObject jsonObj = new JSONObject(responseBody); return jsonObj.getString("error_code"); } catch (JSONException ex) { String error = "Unable to get error_code from 401 response"; logger.warn(error); return error; } }

Target:
private String getErrorCode(String responseBody) { try { JSONObject jsonObj = new JSONObject(responseBody); return jsonObj.getString("error_code"); } catch (JSONException ex) { logger.warn("Unable to get error_code from 401 response"); return null; } }
Source:
private ObjectId writeAndReadBackFromTempFile(ObjectId objectId) throws Exception { File file = File.createTempFile("ObjectIdSerializerTest_", ""); ObjectIdSerializer.write(new FileOutputStream(file), objectId); return ObjectIdSerializer.read(new FileInputStream(file)); }

Target:
private ObjectId writeAndReadBackFromTempFile(ObjectId objectId) throws Exception { File file = File.createTempFile("ObjectIdSerializerTest_", ""); try (OutputStream out = new FileOutputStream(file)) { ObjectIdSerializer.write(out, objectId); } try (InputStream in = new FileInputStream(file)) { return ObjectIdSerializer.read(in); } }
Source:
public LogCommand add(ObjectId start) throws MissingObjectException, IncorrectObjectTypeException, IOException { return add(true, start); }

Target:
public LogCommand add(ObjectId start) throws MissingObjectException, IncorrectObjectTypeException, JGitInternalException { return add(true, start); }
Source:
public Collector<?, ?, ?> build(Type containerType) { Class<? extends Enum> componentType = (Class<? extends Enum>) findGenericParameter(containerType, EnumSet.class) .map(GenericTypes::getErasedType) .orElseThrow(() -> new IllegalStateException("Cannot determine EnumSet element type")); return Collector.of( () -> EnumSet.noneOf(componentType), EnumSet::add, (left, right) -> { if (left.size() < right.size()) { right.addAll(left); return right; } else { left.addAll(right); return left; } }, Function.identity()); }

Target:
public Collector<?, ?, ?> build(Type containerType) { Class<? extends Enum> componentType = (Class<? extends Enum>) findGenericParameter(containerType, EnumSet.class) .map(GenericTypes::getErasedType) .orElseThrow(() -> new IllegalStateException("Cannot determine EnumSet element type")); return Collector.of( () -> EnumSet.noneOf(componentType), EnumSet::add, (left, right) -> { left.addAll(right); return left; }, Function.identity()); }
Source:
public SpatialIndexBuilderOperatorFactory( int operatorId, PlanNodeId planNodeId, List<Type> types, List<Integer> outputChannels, int indexChannel, Optional<Integer> radiusChannel, Optional<Integer> partitionChannel, SpatialPredicate spatialRelationshipTest, Optional<String> kdbTreeJson, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.outputChannels = ImmutableList.copyOf(requireNonNull(outputChannels, "outputChannels is null")); List<Type> outputTypes = outputChannels.stream() .map(types::get) .collect(toImmutableList()); pagesSpatialIndexFactory = new PagesSpatialIndexFactory(types, outputTypes); this.indexChannel = indexChannel; this.radiusChannel = radiusChannel; this.partitionChannel = requireNonNull(partitionChannel, "partitionChannel is null"); this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = requireNonNull(filterFunctionFactory, "filterFunctionFactory is null"); this.pagesIndexFactory = pagesIndexFactory; this.expectedPositions = expectedPositions; kdbTreeJson.ifPresent(json -> this.spatialPartitions.putAll(KDB_TREE_CODEC.fromJson(json).findAllLeafNodes())); }

Target:
public SpatialIndexBuilderOperatorFactory( int operatorId, PlanNodeId planNodeId, List<Type> types, List<Integer> outputChannels, int indexChannel, Optional<Integer> radiusChannel, Optional<Integer> partitionChannel, SpatialPredicate spatialRelationshipTest, Optional<String> kdbTreeJson, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.outputChannels = ImmutableList.copyOf(requireNonNull(outputChannels, "outputChannels is null")); List<Type> outputTypes = outputChannels.stream() .map(types::get) .collect(toImmutableList()); pagesSpatialIndexFactory = new PagesSpatialIndexFactory(types, outputTypes); this.indexChannel = indexChannel; this.radiusChannel = radiusChannel; this.partitionChannel = requireNonNull(partitionChannel, "partitionChannel is null"); this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = requireNonNull(filterFunctionFactory, "filterFunctionFactory is null"); this.pagesIndexFactory = pagesIndexFactory; this.expectedPositions = expectedPositions; kdbTreeJson.ifPresent(json -> this.spatialPartitions.putAll(KdbTreeUtils.fromJson(json).getLeaves())); }
Source:
private String formatAccountAttribute(AccountAttribute who) { String name = anonymousCowardName; if (who != null && who.name != null) { name = who.name; } return name; }

Target:
private String formatAccountAttribute(AccountAttribute who) { if (who != null && who.name != null) { return who.name; } return anonymousCowardName; }
Source:
public int run() throws IOException { Preconditions.checkArgument(target != null, "A Parquet file is required."); Path inputFile = new Path(target); Map<String, Long> columnSizes = getColumnSizeInBytes(inputFile); Map<String, Float> columnPercentage = getColumnPercentage(columnSizes); if (columns != null && columns.size() > 0) { for (String inputColumn : columns) { long size = 0; float percentage = 0; for (String column : columnSizes.keySet()) { if (column.startsWith(inputColumn)) { size += columnSizes.get(column); percentage += columnPercentage.get(column); } } console.info(inputColumn + "->" + " Size In Bytes: " + size + " Size In Percentage: " + percentage); } } else { for (String column : columnSizes.keySet()) { console.info(column + "->" + " Size In Bytes: " + columnSizes.get(column) + " Size In Percentage: " + columnPercentage.get(column)); } } return 0; }

Target:
public int run() throws IOException { Preconditions.checkArgument(target != null, "A Parquet file is required."); Path inputFile = new Path(target); Map<String, Long> columnSizes = getColumnSizeInBytes(inputFile); Map<String, Float> columnRatio = getColumnRatio(columnSizes); if (columns != null && columns.size() > 0) { for (String inputColumn : columns) { long size = 0; float ratio = 0; for (String column : columnSizes.keySet()) { if (column.equals(inputColumn) || column.startsWith(inputColumn + ".")) { size += columnSizes.get(column); ratio += columnRatio.get(column); } } console.info(inputColumn + "->" + " Size In Bytes: " + size + " Size In Ratio: " + ratio); } } else { for (String column : columnSizes.keySet()) { console.info(column + "->" + " Size In Bytes: " + columnSizes.get(column) + " Size In Ratio: " + columnRatio.get(column)); } } return 0; }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; BlockTree block = methodTree.block(); if (block != null) { CloseableVisitor visitor = new CloseableVisitor(methodTree.parameters(), this); block.accept(visitor); for (Tree issueTree : visitor.getIssueTrees()) { Type reportedType = null; if(issueTree.is(Tree.Kind.ASSIGNMENT)) { reportedType = ((AssignmentExpressionTree) issueTree).expression().symbolType(); } else if(issueTree.is(Tree.Kind.VARIABLE)) { reportedType = ((VariableTree) issueTree).initializer().symbolType(); } else if(issueTree.is(Tree.Kind.NEW_CLASS)) { reportedType = ((NewClassTree) issueTree).symbolType(); } addIssue(issueTree, String.format("Close this \"%s\".", reportedType.name())); } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; BlockTree block = methodTree.block(); if (block != null) { CloseableVisitor visitor = new CloseableVisitor(methodTree.parameters()); block.accept(visitor); for (Tree issueTree : visitor.getIssueTrees()) { Type reportedType = null; if(issueTree.is(Tree.Kind.ASSIGNMENT)) { reportedType = ((AssignmentExpressionTree) issueTree).expression().symbolType(); } else if(issueTree.is(Tree.Kind.VARIABLE)) { reportedType = ((VariableTree) issueTree).initializer().symbolType(); } else if(issueTree.is(Tree.Kind.NEW_CLASS)) { reportedType = ((NewClassTree) issueTree).symbolType(); } addIssue(issueTree, String.format("Close this \"%s\".", reportedType.name())); } } }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getParameters().getQuotaId(), VdcObjectType.Quota, ActionGroup.CONSUME_QUOTA)); return permissionList; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getParameters().getQuotaId(), VdcObjectType.Quota, getActionType().getActionGroup())); return permissionList; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { ConditionalBreakpointDialog dialog = new ConditionalBreakpointDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), injector); dialog.create(); dialog.open(); dialog.getReturnCode(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { ConditionalBreakpointDialog dialog = new ConditionalBreakpointDialog(HandlerUtil.getActiveShell(event), injector); dialog.create(); dialog.open(); dialog.getReturnCode(); return null; }
Source:
public MutateRowRequest adapt(RowMutations mutations) { Mutation mutation = Mutation.create(); mutationAdapters.rowMutationsAdapter.adapt(mutations, mutation); return toMutateRowRequest(mutations.getRow(), mutation); }

Target:
public MutateRowRequest adapt(RowMutations mutations) { RowMutation rowMutation = newRowMutationModel(mutations.getRow()); adapt(mutations, rowMutation); return rowMutation.toProto(requestContext); }
Source:
public MojoParameterMetadataProvider(MavenProject project, Plugin plugin) { this.project = project; this.plugin = plugin; maven = (MavenImpl) MavenPlugin.getMaven(); parameters = new HashMap<String, List<MojoParameter>>(); }

Target:
public MojoParameterMetadataProvider(MavenProject project, Plugin plugin) { this.project = project; this.plugin = plugin; maven = (MavenImpl) MavenPlugin.getMaven(); parameters = new HashMap<>(); }
Source:
private BufferedImage takeScreenshotAsImage(WebDriver webdriver, WebElement element) { if (!(webdriver instanceof TakesScreenshot)) { log.warn("Cannot take screenshot because browser does not support screenshots"); return null; } byte[] screen = ((TakesScreenshot) webdriver).getScreenshotAs(OutputType.BYTES); Point elementLocation = element.getLocation(); try { BufferedImage img = ImageIO.read(new ByteArrayInputStream(screen)); int elementWidth = element.getSize().getWidth(); int elementHeight = element.getSize().getHeight(); if (elementWidth > img.getWidth()) { elementWidth = img.getWidth() - elementLocation.getX(); } if (elementHeight > img.getHeight()) { elementHeight = img.getHeight() - elementLocation.getY(); } return img.getSubimage(elementLocation.getX(), elementLocation.getY(), elementWidth, elementHeight); } catch (IOException e) { log.error("Failed to take screenshot of " + element, e); return null; } catch (RasterFormatException e) { log.warn("Cannot take screenshot because element is not displayed on current screen position"); return null; } }

Target:
private BufferedImage takeScreenshotAsImage(WebDriver webdriver, WebElement element) { if (!(webdriver instanceof TakesScreenshot)) { log.warn("Cannot take screenshot because browser does not support screenshots"); return null; } byte[] screen = ((TakesScreenshot) webdriver).getScreenshotAs(OutputType.BYTES); Point elementLocation = element.getLocation(); try { BufferedImage img = ImageIO.read(new ByteArrayInputStream(screen)); int elementWidth = element.getSize().getWidth(); int elementHeight = element.getSize().getHeight(); if (elementWidth > img.getWidth()) { elementWidth = img.getWidth() - elementLocation.getX(); } if (elementHeight > img.getHeight()) { elementHeight = img.getHeight() - elementLocation.getY(); } return img.getSubimage(elementLocation.getX(), elementLocation.getY(), elementWidth, elementHeight); } catch (IOException e) { log.error("Failed to take screenshot of {}", element, e); return null; } catch (RasterFormatException e) { log.warn("Cannot take screenshot because element is not displayed on current screen position"); return null; } }