auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void stage(final Repository repository, final List<IFile> modifiedFiles, final List<IFile> untrackedFiles) { final Collection<IFile> targets = new ArrayList<IFile>(modifiedFiles); targets.addAll(untrackedFiles); Job job = new Job(UIText.StagingView_StagingJobLabel) { @Override protected IStatus run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor); if (subMonitor.isCanceled()) { return Status.CANCEL_STATUS; } subMonitor.beginTask(NLS.bind( UIText.StagingView_StagingJobTaskName, repository .getDirectory().getParentFile().getName()), modifiedFiles.size() + untrackedFiles.size()); AddToIndexOperation indexOperation = new AddToIndexOperation( modifiedFiles); try { indexOperation.execute(subMonitor.newChild( modifiedFiles.size(), SubMonitor.SUPPRESS_NONE)); if (subMonitor.isCanceled()) { reload(repository, modifiedFiles); return Status.CANCEL_STATUS; } modified.get(repository).removeAll(modifiedFiles); untracked.get(repository).removeAll(untrackedFiles); staged.get(repository).addAll(modifiedFiles); staged.get(repository).addAll(untrackedFiles); refreshUI(repository); } catch (CoreException e) { return new Status(IStatus.ERROR, Activator.getPluginId(), <START> "Failed to stage files", e); END> } finally { subMonitor.done(); } return Status.OK_STATUS; } }; job.setRule(new MultiRule(targets.toArray(new IFile[targets.size()]))); job.schedule(); }</code><technical_language>error message exernalized</technical_language>

Target:
private void stage(final Repository repository, final List<IFile> modifiedFiles, final List<IFile> untrackedFiles) { final Collection<IFile> targets = new ArrayList<IFile>(modifiedFiles); targets.addAll(untrackedFiles); Job job = new Job(UIText.StagingView_StagingJobLabel) { @Override protected IStatus run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor); if (subMonitor.isCanceled()) return Status.CANCEL_STATUS; subMonitor.beginTask(NLS.bind( UIText.StagingView_StagingJobTaskName, repository .getDirectory().getParentFile().getName()), modifiedFiles.size() + untrackedFiles.size()); AddToIndexOperation indexOperation = new AddToIndexOperation( modifiedFiles); try { indexOperation.execute(subMonitor.newChild( modifiedFiles.size(), SubMonitor.SUPPRESS_NONE)); if (subMonitor.isCanceled()) { reload(repository, modifiedFiles); return Status.CANCEL_STATUS; } modified.get(repository).removeAll(modifiedFiles); untracked.get(repository).removeAll(untrackedFiles); staged.get(repository).addAll(modifiedFiles); staged.get(repository).addAll(untrackedFiles); refreshUI(repository); } catch (CoreException e) { return new Status(IStatus.ERROR, Activator.getPluginId(), UIText.StagingView_FailedToStageFiles, e); } finally { subMonitor.done(); } return Status.OK_STATUS; } }; job.setRule(new MultiRule(targets.toArray(new IFile[targets.size()]))); job.schedule(); }
Source:
<code>@Test public void testClearErases() throws IOException { QueueFile queue = new QueueFile(file); byte[] expected = values[253]; queue.add(expected); byte[] data = new byte[expected.length]; queue.raf.seek(QueueFile.Element.HEADER_LENGTH + 16); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(expected); queue.clear(); <START> queue.raf.seek(16 + QueueFile.Element.HEADER_LENGTH); <END> queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(new byte[expected.length]); }</code><technical_language>flip? This is inconsistent 6 lines up</technical_language>

Target:
@Test public void testClearErases() throws IOException { QueueFile queue = new QueueFile(file); byte[] expected = values[253]; queue.add(expected); byte[] data = new byte[expected.length]; queue.raf.seek(HEADER_LENGTH + Element.HEADER_LENGTH); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(expected); queue.clear(); queue.raf.seek(HEADER_LENGTH + Element.HEADER_LENGTH); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(new byte[expected.length]); }
Source:
<code>public ShowFindDialogAction(@NonNull TimeGraphViewer timeGraphViewer) { fFilterDialog = TimeGraphFindDialog.getInstance(timeGraphViewer.getControl().getShell(), this); fTimeGraphViewer = timeGraphViewer; <START> setText("search"); <END> setToolTipText("Show search dialog"); setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH)); }</code><technical_language>Externalize strings</technical_language>

Target:
public ShowFindDialogAction(@NonNull TimeGraphViewer timeGraphViewer) { fFilterDialog = TimeGraphFindDialog.getInstance(timeGraphViewer.getControl().getShell(), this); fTimeGraphViewer = timeGraphViewer; setText(Messages.ShowFindDialogAction_Search); setToolTipText(Messages.ShowFindDialogAction_Show_search_dialog); setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH)); }
Source:
<code>public void testUnmarshallDateObject() { String expectedString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<date-object>\n" + " <localDate>2017-01-01</localDate>\n" + " <localDateTime>2017-01-01T10:10:10</localDateTime>\n" + " <localTime>10:10:10</localTime>\n" + "</date-object>\n"; Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(DateObject.class); Marshaller marshaller = MarshallerFactory.getMarshaller( extraClasses, MarshallingFormat.JAXB, getClass().getClassLoader() ); DateObject dateObject = marshaller.unmarshall( expectedString, DateObject.class ); assertNotNull( dateObject ); <START> assertEquals( "2017-01-01", dateObject.getLocalDate().toString() ); <END> assertEquals( "2017-01-01T10:10:10", dateObject.getLocalDateTime().toString() ); assertEquals( "10:10:10", dateObject.getLocalTime().toString() ); }</code><technical_language>I avoid toString() (not localized platform dependent iirc) althoug a matter of taste: assertEquals(LocalDate.of(2017, 1, 1), dateObject.getLocalDate());</technical_language>

Target:
public void testUnmarshallDateObject() { String expectedString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<date-object>\n" + " <localDate>2017-01-01</localDate>\n" + " <localDateTime>2017-01-01T10:10:10</localDateTime>\n" + " <localTime>10:10:10</localTime>\n" + " <offsetDateTime>2017-01-01T10:10:10+01:00</offsetDateTime>\n" + "</date-object>\n"; Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(DateObject.class); Marshaller marshaller = MarshallerFactory.getMarshaller( extraClasses, MarshallingFormat.JAXB, getClass().getClassLoader() ); DateObject dateObject = marshaller.unmarshall( expectedString, DateObject.class ); assertNotNull( dateObject ); assertEquals( LocalDate.of( 2017, 1, 1 ), dateObject.getLocalDate() ); assertEquals( LocalDateTime.of( 2017, 1, 1, 10, 10, 10 ), dateObject.getLocalDateTime() ); assertEquals( LocalTime.of( 10, 10, 10 ), dateObject.getLocalTime() ); assertEquals( OffsetDateTime.of( LocalDateTime.of( 2017, 1, 1, 10, 10, 10 ), ZoneOffset.ofHours( 1 ) ), dateObject.getOffsetDateTime() ); }
Source:
<code>public boolean tableExists(Handle handle, String tableName) { String databaseCharset = handle .createQuery("SELECT @@character_set_database") .map(StringMapper.FIRST) .first(); if (!databaseCharset.matches("utf.*")) { throw new ISE( <START> "Druid requires its MySQL database to be created with an UTF charset, found `%1$s`.%n" + <END> "The recommended charset is `utf8mb4`.", databaseCharset ); } else if (!"utf8mb4".equals(databaseCharset)) { log.warn("The current database charset `%1$s` does not match the recommended charset `utf8mb4`", databaseCharset); } return !handle.createQuery("SHOW tables LIKE :tableName") .bind("tableName", tableName) .list() .isEmpty(); }</code><technical_language>remove newlines ? confuses lots of logging systems</technical_language>

Target:
public boolean tableExists(Handle handle, String tableName) { String databaseCharset = handle .createQuery("SELECT @@character_set_database") .map(StringMapper.FIRST) .first(); if (!databaseCharset.matches("utf8.*")) { throw new ISE( "Druid requires its MySQL database to be created with an UTF8 charset, found `%1$s`. " + "The recommended charset is `utf8mb4`.", databaseCharset ); } else if (!"utf8mb4".equals(databaseCharset)) { log.warn("The current database charset `%1$s` does not match the recommended charset `utf8mb4`", databaseCharset); } return !handle.createQuery("SHOW tables LIKE :tableName") .bind("tableName", tableName) .list() .isEmpty(); }
Source:
<code>public static void putDocument(String indexName, Document document) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { PutResponse result = index.put(document); <START> if (Config.PERSISTENCE_CHECK_DURATION > 0) { <END> int elapsedTime = 0; boolean isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); result = index.put(document); isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, document, indexName)); } } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, document, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } }</code><technical_language>Reverse condition (i.e. a guard clause) reduce nesting</technical_language>

Target:
public static void putDocument(String indexName, Document document) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { PutResponse result = index.put(document); if (Config.PERSISTENCE_CHECK_DURATION == 0) { continue; } int elapsedTime = 0; boolean isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); result = index.put(document); isSuccessful = result.getResults().get(0).getCode() == StatusCode.OK; if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, document, indexName)); } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, document, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } }
Source:
<code>public Response remove() { get(); <START> return performAction(VdcActionType.RemoveVm, new RemoveVmParameters(asGuid(id), false)); <END> }</code><technical_language>"guid" instead of "asGuid(id)"</technical_language>

Target:
public Response remove() { get(); return performAction(VdcActionType.RemoveVm, new RemoveVmParameters(guid, false)); }
Source:
<code>public void testNoRecordPublisherTypeInConfig() { Properties testConfig = TestUtils.getStandardProperties(); <START> KinesisConfigUtil.validateEFOConfiguration(testConfig, new ArrayList<>()); <END> }</code><technical_language>@xiaolong-sn nit: Collections.emptyList() is more expressive</technical_language>

Target:
public void testNoRecordPublisherTypeInConfig() { Properties testConfig = TestUtils.getStandardProperties(); ConsumerConfigConstants.RecordPublisherType recordPublisherType = KinesisConfigUtil.validateRecordPublisherType(testConfig); assertEquals(recordPublisherType, ConsumerConfigConstants.RecordPublisherType.POLLING); }
Source:
<code>public PersistedData serializeNonNull(T value, PersistedDataSerializer serializer) { if (typeInfo.getRawType().isPrimitive()) { if (delegateHandler != null) { return delegateHandler.serialize(value, serializer); <START> } <END> return null; } TypeHandler<T> chosenHandler = delegateHandler; Class<?> runtimeClass = getRuntimeTypeIfMoreSpecific(typeInfo, value); if (!typeInfo.getRawType().equals(runtimeClass)) { TypeHandler<T> runtimeTypeHandler = (TypeHandler<T>) typeSerializationLibrary.getTypeHandler(runtimeClass); if (delegateHandler == null) { chosenHandler = runtimeTypeHandler; } else if (runtimeTypeHandler.getClass().equals(delegateHandler.getClass())) { chosenHandler = delegateHandler; } else if (!(runtimeTypeHandler instanceof ObjectFieldMapTypeHandler)) { chosenHandler = runtimeTypeHandler; } else if (!(delegateHandler instanceof ObjectFieldMapTypeHandler)) { chosenHandler = delegateHandler; } else { chosenHandler = runtimeTypeHandler; } } if (chosenHandler == delegateHandler) { return delegateHandler.serialize(value, serializer); } Map<String, PersistedData> typeValuePersistedDataMap = Maps.newLinkedHashMap(); typeValuePersistedDataMap.put( TYPE_FIELD, serializer.serialize(runtimeClass.getName()) ); typeValuePersistedDataMap.put( VALUE_FIELD, chosenHandler.serialize(value, serializer) ); return serializer.serialize(typeValuePersistedDataMap); }</code><technical_language>This change needed primitive types a TypeHandler (thus ensuring delegateHandler null). problem is propagating else. _could_ this change here, this is deferring change elsewhere</technical_language>

Target:
public PersistedData serializeNonNull(T value, PersistedDataSerializer serializer) { if (typeInfo.getRawType().isPrimitive()) { return delegateHandler.serialize(value, serializer); } TypeHandler<T> chosenHandler = delegateHandler; Class<?> runtimeClass = getRuntimeTypeIfMoreSpecific(typeInfo, value); if (!typeInfo.getRawType().equals(runtimeClass)) { TypeHandler<T> runtimeTypeHandler = (TypeHandler<T>) typeSerializationLibrary.getTypeHandler(runtimeClass); if (delegateHandler == null) { chosenHandler = runtimeTypeHandler; } else if (runtimeTypeHandler.getClass().equals(delegateHandler.getClass())) { chosenHandler = delegateHandler; } else if (!(runtimeTypeHandler instanceof ObjectFieldMapTypeHandler)) { chosenHandler = runtimeTypeHandler; } else if (!(delegateHandler instanceof ObjectFieldMapTypeHandler)) { chosenHandler = delegateHandler; } else { chosenHandler = runtimeTypeHandler; } } if (chosenHandler == delegateHandler) { return delegateHandler.serialize(value, serializer); } Map<String, PersistedData> typeValuePersistedDataMap = Maps.newLinkedHashMap(); typeValuePersistedDataMap.put( TYPE_FIELD, serializer.serialize(runtimeClass.getName()) ); typeValuePersistedDataMap.put( VALUE_FIELD, chosenHandler.serialize(value, serializer) ); return serializer.serialize(typeValuePersistedDataMap); }
Source:
<code>private List<File> getPluginFiles() throws IOException { if (pluginsDir == null || !pluginsDir.exists()) { return Collections.emptyList(); } <START> return Arrays.asList(pluginsDir.listFiles(new FileFilter() { <END> @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".jar"); } })); }</code><technical_language>listFiles return null if directory exists accessible calling process. I guard this: File[] plugins = pluginsDir.listFiles(); if (plugins == null) { log.warn("Cannot list " + pluginsDir.getAbsolutePath()); return Collections.emptyList(); } return Arrays.asList(plugins);</technical_language>

Target:
private List<File> getPluginFiles() throws IOException { if (pluginsDir == null || !pluginsDir.exists()) { return Collections.emptyList(); } File[] plugins = pluginsDir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isFile() && pathname.getName().endsWith(".jar"); } }); if (plugins == null) { log.warn("Cannot list " + pluginsDir.getAbsolutePath()); return Collections.emptyList(); } return Arrays.asList(plugins); }
Source:
<code>public ImageGenerator() { <START> imageWidth = 200; <END> imageHeight = 200; imageBuffer = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_ARGB); }</code><technical_language>declare values <LINK_0></technical_language>

Target:
public ImageGenerator() { imageBuffer = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_ARGB); }
Source:
<code><START> public static Map<String, String> getExecutionInfo(Rule rule, boolean allowTagsPropagation) { <END> if (allowTagsPropagation){ return getExecutionInfo(rule); } else { return Collections.emptyMap(); } }</code><technical_language>this method is called in sides. Remove instead ternary operator call side</technical_language>

Target:
public static ImmutableMap<String, String> getExecutionInfo(Rule rule, boolean allowTagsPropagation) { if (allowTagsPropagation) { return ImmutableMap.copyOf(getExecutionInfo(rule)); } else { return ImmutableMap.of(); } }
Source:
<code>public void init() { post( "/list/import", (request, response) -> { MultipartConfigElement multipartConfigElement = new MultipartConfigElement(""); request.raw().setAttribute("org.eclipse.jetty.multipartConfig", multipartConfigElement); String listType = request.headers(LIST_TYPE_HEADER); if (StringUtils.isBlank(listType)) { String exceptionMessage = String.format("The header %s must be set.", LIST_TYPE_HEADER); LOGGER.info(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; <START> } <END> List<Part> parts = new ArrayList<>(request.raw().getParts()); CreateInfo createInfo = parseAttachments(parts); if (createInfo == null) { String exceptionMessage = "Unable to parse the attachments."; LOGGER.info(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; } for (Splitter splitter : lookupSplitter(createInfo.contentType)) { List<String> ids = new LinkedList<>(); List<String> errorMessages = new LinkedList<>(); boolean isSplitSuccessful = false; try (Stream<StorableResource> stream = createStream(createInfo, splitter)) { isSplitSuccessful = true; stream .sequential() .peek(storableResource -> appendMessageIfError(errorMessages, storableResource)) .filter(storableResource -> !storableResource.isError()) .forEach( storableResource -> storeAndClose(ids::add, errorMessages::add, storableResource)); } catch (IOException e) { LOGGER.debug("Failed to split the incoming data. Trying the next splitter.", e); } if (isSplitSuccessful) { errorMessages.forEach( s -> LOGGER.debug(String.format("Unable to ingest split item: %s", s))); response.header("Added-IDs", ids.stream().collect(Collectors.joining(","))); break; } } IOUtils.closeQuietly(createInfo.getStream()); return ""; }); }</code><technical_language>this debug level</technical_language>

Target:
public void init() { post( "/list/import", (request, response) -> { MultipartConfigElement multipartConfigElement = new MultipartConfigElement(""); request.raw().setAttribute("org.eclipse.jetty.multipartConfig", multipartConfigElement); String listType = request.headers(LIST_TYPE_HEADER); if (StringUtils.isBlank(listType)) { String exceptionMessage = String.format("The header %s must be set.", LIST_TYPE_HEADER); LOGGER.info(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; } List<Part> parts = new ArrayList<>(request.raw().getParts()); AttachmentInfo attachmentInfo = parseAttachments(parts); if (attachmentInfo == null) { String exceptionMessage = "Unable to parse the attachments."; LOGGER.debug(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; } try (TemporaryFileBackedOutputStream temporaryFileBackedOutputStream = new TemporaryFileBackedOutputStream()) { IOUtils.copy(attachmentInfo.getStream(), temporaryFileBackedOutputStream); for (Splitter splitter : lookupSplitters(attachmentInfo.getContentType())) { if (attemptToSplitAndStore( response, listType, attachmentInfo, temporaryFileBackedOutputStream, splitter)) break; } } IOUtils.closeQuietly(attachmentInfo.getStream()); return ""; }); }
Source:
<code><START> public void testBadNumberOfArguments() throws HiveException { <END> ObjectInspector value1 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector value2 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector[] initArguments = new ObjectInspector[]{value1,value2}; UAParserUDF uaParserUDF = new UAParserUDF(); uaParserUDF.initialize(initArguments); ObjectInspector value3 = PrimitiveObjectInspectorFactory.javaIntObjectInspector; initArguments = new ObjectInspector[]{value3}; uaParserUDF.initialize(initArguments); }</code><technical_language>This method is separate tests (line 20 line 24). get split separate methods</technical_language>

Target:
public void testBadNumberOfArguments() throws HiveException { ObjectInspector value1 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector value2 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector[] initArguments = new ObjectInspector[]{value1, value2}; UAParserUDF uaParserUDF = new UAParserUDF(); uaParserUDF.initialize(initArguments); }
Source:
<code><START> public static void main(String[] args) { <END> try { LoggingFactory.init("INFO"); MapperInterface mapper = new MapperLinear(-1, 1, -1, 1); log.info("mapper {}", mapper); double result = mapper.calcOutput(0.5); log.info("{}", result); } catch (Exception e) { log.error("main threw", e); } }</code><technical_language>move this a unit test :)</technical_language>

Target:
public static void main(String[] args) { try { LoggingFactory.init("INFO"); Mapper mapper = new MapperLinear(); mapper.map(-1.0, 1.0, -1.0, 1.0); log.info("mapper {}", mapper); double result = mapper.calcOutput(0.5); log.info("{}", result); } catch (Exception e) { log.error("main threw", e); } }
Source:
<code>public boolean isAnnotatedOverride() { for (AnnotationTree annotationTree : modifiers.annotations()) { if (annotationTree.annotationType().is(Tree.Kind.IDENTIFIER) && isOverride((IdentifierTree) annotationTree.annotationType())) { return true; } else if (annotationTree.annotationType().is(Kind.MEMBER_SELECT)) { <START> MemberSelectExpressionTree mse = (MemberSelectExpressionTree) annotationTree.annotationType(); <END> if(isOverride(mse.identifier()) && mse.expression().is(Kind.MEMBER_SELECT)) { mse = (MemberSelectExpressionTree) mse.expression(); return "lang".equals(mse.identifier().name()) && mse.expression().is(Kind.IDENTIFIER) && "java".equals(((IdentifierTree) mse.expression()).name()); } } } return false; }</code><technical_language>handling of MemberSelect extracted a dedicated method</technical_language>

Target:
public boolean isAnnotatedOverride() { for (AnnotationTree annotationTree : modifiers.annotations()) { if (isJavaLangOverride(annotationTree.annotationType())) { return true; } } return false; }
Source:
<code>public NumericColumnSelector makeMathExpressionSelector(String expression) { final Expr parsed = Parser.parse(expression); final Set<String> required = Sets.newHashSet(Parser.findRequiredBindings(parsed)); final Map<String, Supplier<Number>> values = Maps.newHashMapWithExpectedSize(required.size()); for (final String columnName : required) { values.put( columnName, new Supplier<Number>() { @Override public Number get() { <START> return row.get().getFloatMetric(columnName); <END> } } ); } final Expr.ObjectBinding binding = Parser.withSuppliers(values); return new NumericColumnSelector() { @Override public Number get() { return parsed.eval(binding); } }; }</code><technical_language>this NumericColumnSelector reads floats? a check for long type well</technical_language>

Target:
public NumericColumnSelector makeMathExpressionSelector(String expression) { final Expr parsed = Parser.parse(expression); final List<String> required = Parser.findRequiredBindings(parsed); final Map<String, Supplier<Number>> values = Maps.newHashMapWithExpectedSize(required.size()); for (final String columnName : required) { values.put( columnName, new Supplier<Number>() { @Override public Number get() { return Evals.toNumber(row.get().getRaw(columnName)); } } ); } final Expr.ObjectBinding binding = Parser.withSuppliers(values); return new NumericColumnSelector() { @Override public Number get() { return parsed.eval(binding); } }; }
Source:
<code>public HookResult onMessage(SMTPSession session, Mail mail) { LOGGER.debug("sending mail"); try { queue.enQueue(mail); Collection<MailAddress> theRecipients = mail.getRecipients(); String recipientString = ""; if (theRecipients != null) { recipientString = theRecipients.toString(); } if (LOGGER.isInfoEnabled()) { <START> LOGGER.info("Successfully spooled mail " + mail.getName() + " from " + mail.getSender() + " on " + session.getRemoteAddress().getAddress().toString() + " for " + recipientString); <END> } } catch (MessagingException me) { LOGGER.error("Unknown error occurred while processing DATA.", me); return new HookResult(HookReturnCode.DENYSOFT, DSNStatus.getStatus(DSNStatus.TRANSIENT, DSNStatus.UNDEFINED_STATUS) + " Error processing message."); } return new HookResult(HookReturnCode.OK, DSNStatus.getStatus(DSNStatus.SUCCESS, DSNStatus.CONTENT_OTHER) + " Message received"); }</code><technical_language>remove if placeholder I</technical_language>

Target:
public HookResult onMessage(SMTPSession session, Mail mail) { LOGGER.debug("sending mail"); try { queue.enQueue(mail); LOGGER.info("Successfully spooled mail from on for {}", mail.getName(), mail.getSender(), session.getRemoteAddress().getAddress(), mail.getRecipients()); } catch (MessagingException me) { LOGGER.error("Unknown error occurred while processing DATA.", me); return new HookResult(HookReturnCode.DENYSOFT, DSNStatus.getStatus(DSNStatus.TRANSIENT, DSNStatus.UNDEFINED_STATUS) + " Error processing message."); } return new HookResult(HookReturnCode.OK, DSNStatus.getStatus(DSNStatus.SUCCESS, DSNStatus.CONTENT_OTHER) + " Message received"); }
Source:
<code>protected void populateColumnSchema(ArrayList<VoltTable.ColumnInfo> columns) { super.populateColumnSchema(columns); <START> columns.add(new ColumnInfo(Columns.CONSUMER_CLUSTER_ID, VoltType.INTEGER)); <END> columns.add(new ColumnInfo(Columns.STATE, VoltType.STRING)); columns.add(new ColumnInfo(Columns.SYNC_SNAPSHOT_STATE, VoltType.STRING)); columns.add(new ColumnInfo(Columns.ROWS_IN_SYNC_SNAPSHOT, VoltType.BIGINT)); columns.add(new ColumnInfo(Columns.ROWS_ACKED_FOR_SYNC_SNAPSHOT, VoltType.BIGINT)); columns.add(new ColumnInfo(Columns.QUEUE_DEPTH, VoltType.BIGINT)); }</code><technical_language>Small int is enough for this field. Please check Andrew if column is for compatibility</technical_language>

Target:
protected void populateColumnSchema(ArrayList<VoltTable.ColumnInfo> columns) { super.populateColumnSchema(columns); if (m_addConsumerIdStat) { columns.add(new ColumnInfo(Columns.CONSUMER_CLUSTER_ID, VoltType.SMALLINT)); } columns.add(new ColumnInfo(Columns.STATE, VoltType.STRING)); columns.add(new ColumnInfo(Columns.SYNC_SNAPSHOT_STATE, VoltType.STRING)); columns.add(new ColumnInfo(Columns.ROWS_IN_SYNC_SNAPSHOT, VoltType.BIGINT)); columns.add(new ColumnInfo(Columns.ROWS_ACKED_FOR_SYNC_SNAPSHOT, VoltType.BIGINT)); columns.add(new ColumnInfo(Columns.QUEUE_DEPTH, VoltType.BIGINT)); }
Source:
<code>protected Button getButton(int id) { <START> return buttons.get(new Integer(id)); <END> }</code><technical_language>pass id Java autoboxing care of it</technical_language>

Target:
protected Button getButton(int id) { return buttons.get(id); }
Source:
<code><START> private boolean isConstantFilterFunction(FilterFunction filter, Block[] constantBlocks) <END> { return Arrays.stream(filter.getInputChannels()).allMatch(channel -> constantBlocks[channel] != null); }</code><technical_language>static</technical_language>

Target:
private static boolean isConstantFilterFunction(FilterFunction filter, Block[] constantBlocks) { return Arrays.stream(filter.getInputChannels()).allMatch(channel -> constantBlocks[channel] != null); }
Source:
<code>public static List<String> parseTopicsList(Map<String, String> props) { List<String> topics = (List<String>) ConfigDef.parseType(TOPICS_CONFIG, props.get(TOPICS_CONFIG), Type.LIST); return topics .stream() <START> .filter(topic -> !topic.isEmpty()) .distinct() <END> .collect(Collectors.toList()); }</code><technical_language>fair enough</technical_language>

Target:
public static List<String> parseTopicsList(Map<String, String> props) { List<String> topics = (List<String>) ConfigDef.parseType(TOPICS_CONFIG, props.get(TOPICS_CONFIG), Type.LIST); if (topics == null) { return Collections.emptyList(); } return topics .stream() .filter(topic -> !topic.isEmpty()) .distinct() .collect(Collectors.toList()); }
Source:
<code>public String createString(final String key, final long value) { <START> return createString(key, "" + value); <END> }</code><technical_language>I prefer String.valueOf(value)</technical_language>

Target:
public String createString(final String key, final long value) { return createString(key, String.valueOf(value)); }
Source:
<code>public void saveOrUpdate( final D diagram, final ServiceCallback<D> callback ) { diagramServiceCaller.call( new RemoteCallback<M>() { <START> @Override <END> public void callback( M serverMetadata ) { AbstractClientDiagramService.this.updateClientMetadata( diagram ); diagram.getMetadata().setPath( serverMetadata.getPath() ); callback.onSuccess( diagram ); } }, ( message, throwable ) -> { callback.onError( new ClientRuntimeError( throwable ) ); return false; } ).saveOrUpdate( diagram ); }</code><technical_language>reason replace a lamda anonymous class</technical_language>

Target:
public void saveOrUpdate( final D diagram, final ServiceCallback<D> callback ) { diagramServiceCaller.call( serverMetadata-> { AbstractClientDiagramService.this.updateClientMetadata( diagram ); diagram.getMetadata().setPath( ( (M) serverMetadata).getPath() ); callback.onSuccess( diagram ); }, ( message, throwable ) -> { callback.onError( new ClientRuntimeError( throwable ) ); return false; } ).saveOrUpdate( diagram ); }
Source:
<code>protected void updatePoolProperties() { long maxDirectMemory = 64 * 1024 * 1024; try { <START> if (UnderlyingSystemInfo.JVM_PROVIDER.equals(JvmProvider.SUN) || UnderlyingSystemInfo.JVM_PROVIDER.equals(JvmProvider.ORACLE) || UnderlyingSystemInfo.JVM_PROVIDER.equals(JvmProvider.AZUL)) { <END> Class<?> vmClazz = Class.forName("sun.misc.VM"); Method directMemoryMethod = vmClazz.getMethod("maxDirectMemory"); directMemoryMethod.setAccessible(true); maxDirectMemory = (Long) directMemoryMethod.invoke(null); log.debug("Direct memory available for the JVM {}", maxDirectMemory); } } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Exception occurred trying to use the class sun.misc.VM via reflection", e); } } if (poolMinCapacity > (long) (maxDirectMemory * bufferPoolMinDirectMemoryOccupancy)) { poolMinCapacity = (long) (maxDirectMemory * bufferPoolMinDirectMemoryOccupancy); } if (poolMaxCapacity > (long) (maxDirectMemory * bufferPoolMaxDirectMemoryOccupancy)) { poolMaxCapacity = (long) (maxDirectMemory * bufferPoolMaxDirectMemoryOccupancy); } poolFactory.setBufferCapacity(bufferSize); int maxIdle = (int) (poolMinCapacity / bufferSize); int maxActive = (int) (poolMaxCapacity / bufferSize); super.setMaxIdle(maxIdle); super.setMaxActive(maxActive); log.info("|-Updated byte buffer pool capacity, maxIdle={} and maxActive={}", maxIdle, maxActive); log.info("|-Default byte buffer size set to {}", bufferSize); }</code><technical_language>remove this JVM check try get 'maxDirectMemory' JVM time fall 64MB if work? Then, maintain this list missing JVM provides value</technical_language>

Target:
protected void updatePoolProperties() { long maxDirectMemory = 64 * 1024 * 1024; try { Class<?> vmClazz = Class.forName("sun.misc.VM"); Method directMemoryMethod = vmClazz.getMethod("maxDirectMemory"); directMemoryMethod.setAccessible(true); maxDirectMemory = (Long) directMemoryMethod.invoke(null); log.debug("Direct memory available for the JVM {}", maxDirectMemory); } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Exception occurred trying to use the class sun.misc.VM via reflection", e); } } if (poolMinCapacity > (long) (maxDirectMemory * bufferPoolMinDirectMemoryOccupancy)) { poolMinCapacity = (long) (maxDirectMemory * bufferPoolMinDirectMemoryOccupancy); } if (poolMaxCapacity > (long) (maxDirectMemory * bufferPoolMaxDirectMemoryOccupancy)) { poolMaxCapacity = (long) (maxDirectMemory * bufferPoolMaxDirectMemoryOccupancy); } poolFactory.setBufferCapacity(bufferSize); int maxIdle = (int) (poolMinCapacity / bufferSize); int maxActive = (int) (poolMaxCapacity / bufferSize); super.setMaxIdle(maxIdle); super.setMaxActive(maxActive); log.info("|-Updated byte buffer pool capacity, maxIdle={} and maxActive={}", maxIdle, maxActive); log.info("|-Default byte buffer size set to {}", bufferSize); }
Source:
<code>public void run() { ITmfTrace pinnedTrace = fPinnedTrace; if (fNewInstance) { if (pinnedTrace == null) { return; } IFile file = TmfTraceManager.getInstance().getTraceContext(pinnedTrace).getEditorFile(); Object element = new TmfEditorLinkHelper().findSelection(new FileEditorInput(file)).getFirstElement(); <START> if (element instanceof TmfCommonProjectElement) { <END> OpenProjectElementThread openThread = new OpenProjectElementThread((TmfCommonProjectElement) element, file); openThread.start(); Thread waitThread = new Thread() { @Override public void run() { while (!TmfTraceManager.getInstance().getOpenedTraces().contains(openThread.getTrace())) { try { Thread.sleep(100); } catch (InterruptedException e) { return; } } Display.getDefault().asyncExec(() -> { IViewPart view = TmfViewFactory.newView(fViewId, true); if (view instanceof ITmfPinnable) { ((ITmfPinnable) view).setPinned(openThread.getTrace()); } }); } }; waitThread.start(); } return; } IViewPart view = TmfViewFactory.newView(fViewId, true); if (pinnedTrace != null && view instanceof ITmfPinnable) { ((ITmfPinnable) view).setPinned(pinnedTrace); } }</code><technical_language>I trace this too, a polling wait thread indirections</technical_language>

Target:
public void run() { ITmfTrace pinnedTrace = fPinnedTrace; if (fNewInstance) { if (pinnedTrace == null) { return; } IFile file = TmfTraceManager.getInstance().getTraceContext(pinnedTrace).getEditorFile(); Object element = new TmfEditorLinkHelper().findSelection(new FileEditorInput(file)).getFirstElement(); if (element instanceof TmfCommonProjectElement) { OpenProjectElementJob openJob = new OpenProjectElementJob((TmfCommonProjectElement) element, file); openJob.schedule(); Thread waitThread = new Thread() { @Override public void run() { while (!TmfTraceManager.getInstance().getOpenedTraces().contains(openJob.getTrace())) { try { Thread.sleep(100); } catch (InterruptedException e) { return; } } Display.getDefault().asyncExec(() -> { IViewPart view = TmfViewFactory.newView(fViewId, true); if (view instanceof ITmfPinnable) { ((ITmfPinnable) view).setPinned(openJob.getTrace()); } }); } }; waitThread.start(); } return; } IViewPart view = TmfViewFactory.newView(fViewId, true); if (pinnedTrace != null && view instanceof ITmfPinnable) { ((ITmfPinnable) view).setPinned(pinnedTrace); } }
Source:
<code>private synchronized CswSubscription deleteCswSubscription(String subscriptionId) throws CswException { String methodName = "deleteCswSubscription"; LogSanitizer logSanitizedId = LogSanitizer.cleanAndEncode(subscriptionId); LOGGER.trace("ENTERING: {}", methodName); <START> LOGGER.trace("subscriptionId = {}", LogSanitizer.cleanAndEncode(subscriptionId)); <END> if (StringUtils.isEmpty(subscriptionId)) { throw new CswException( "Unable to delete subscription because subscription ID is null or empty"); } CswSubscription subscription = getSubscription(subscriptionId); try { LOGGER.debug("Removing (unregistering) subscription: {}", logSanitizedId); ServiceRegistration sr = registeredSubscriptions.remove(subscriptionId); if (sr != null) { sr.unregister(); } else { LOGGER.debug("No ServiceRegistration found for subscription: {}", logSanitizedId); } Configuration subscriptionConfig = getSubscriptionConfiguration(subscriptionId); try { if (subscriptionConfig != null) { LOGGER.debug("Deleting subscription for subscriptionId = {}", logSanitizedId); subscriptionConfig.delete(); } else { LOGGER.debug("subscriptionConfig is NULL for ID = {}", logSanitizedId); } } catch (IOException e) { LOGGER.debug( "IOException trying to delete subscription's configuration for subscription ID {}", subscriptionId, e); } LOGGER.debug("Subscription removal complete"); } catch (Exception e) { LOGGER.debug("Could not delete subscription for {}", logSanitizedId, e); } LOGGER.trace("EXITING: (status = {})", methodName, false); return subscription; }</code><technical_language>this replaced logSanitizedId local variable</technical_language>

Target:
private synchronized CswSubscription deleteCswSubscription(String subscriptionId) throws CswException { String methodName = "deleteCswSubscription"; LogSanitizer logSanitizedId = LogSanitizer.sanitize(subscriptionId); LOGGER.trace("ENTERING: {}", methodName); LOGGER.trace("subscriptionId = {}", logSanitizedId); if (StringUtils.isEmpty(subscriptionId)) { throw new CswException( "Unable to delete subscription because subscription ID is null or empty"); } CswSubscription subscription = getSubscription(subscriptionId); try { LOGGER.debug("Removing (unregistering) subscription: {}", logSanitizedId); ServiceRegistration sr = registeredSubscriptions.remove(subscriptionId); if (sr != null) { sr.unregister(); } else { LOGGER.debug("No ServiceRegistration found for subscription: {}", logSanitizedId); } Configuration subscriptionConfig = getSubscriptionConfiguration(subscriptionId); try { if (subscriptionConfig != null) { LOGGER.debug("Deleting subscription for subscriptionId = {}", logSanitizedId); subscriptionConfig.delete(); } else { LOGGER.debug("subscriptionConfig is NULL for ID = {}", logSanitizedId); } } catch (IOException e) { LOGGER.debug( "IOException trying to delete subscription's configuration for subscription ID {}", subscriptionId, e); } LOGGER.debug("Subscription removal complete"); } catch (Exception e) { LOGGER.debug("Could not delete subscription for {}", logSanitizedId, e); } LOGGER.trace("EXITING: (status = {})", methodName, false); return subscription; }
Source:
<code>public void processCommands(String aQuery) { GerritUi.Ftracer.traceInfo("Process command : " + aQuery ); String lastSaved = fServerUtil.getLastSavedGerritServer(); if (lastSaved != null) { fTaskRepository = fServerUtil.getTaskRepo(lastSaved); } if (fTaskRepository == null) { fMapRepoServer = GerritServerUtility.getInstance().getGerritMapping(); if (fMapRepoServer.size() == 1) { Set<TaskRepository> mapSet = fMapRepoServer.keySet(); for (TaskRepository key: mapSet) { fTaskRepository = key; fServerUtil.saveLastGerritServer(key.getRepositoryUrl()); break; } } } if (fTaskRepository == null) { GerritUi.Ftracer.traceInfo(MESSAGE ); <START> UIUtils.showErrorDialog(MESSAGE, REASON); <END> } else { if (aQuery != null && !aQuery.equals("")) { updateTable (fTaskRepository, aQuery); } } }</code><technical_language>extracting lines a method rid of constants</technical_language>

Target:
public void processCommands(String aQuery) { GerritUi.Ftracer.traceInfo("Process command : " + aQuery ); String lastSaved = fServerUtil.getLastSavedGerritServer(); if (lastSaved != null) { fTaskRepository = fServerUtil.getTaskRepo(lastSaved); } if (fTaskRepository == null) { fMapRepoServer = GerritServerUtility.getInstance().getGerritMapping(); Set<TaskRepository> mapSet = fMapRepoServer.keySet(); if (fMapRepoServer.size() == 1) { for (TaskRepository key: mapSet) { fTaskRepository = key; fServerUtil.saveLastGerritServer(key.getRepositoryUrl()); break; } } else if (fMapRepoServer.size() > 1) { List<TaskRepository> listTaskRepository = new ArrayList<TaskRepository>(); for (TaskRepository key: mapSet) { listTaskRepository.add(key); } fTaskRepository = getSelectedRepositoryURL (listTaskRepository); if (fTaskRepository != null) { fServerUtil.saveLastGerritServer(fTaskRepository.getRepositoryUrl()); } } } if (fTaskRepository == null) { UIUtils.showErrorDialog("You need to define a Gerrit repository.", "No Gerrit repository has been selected yet."); } else { if (aQuery != null && !aQuery.equals("")) { updateTable (fTaskRepository, aQuery); } } }
Source:
<code>public String getLogMessage() { <START> return String.format("Processed integer %d", integerProgressStep.getInput()); <END> }</code><technical_language>"Entered concentration value: {input}"</technical_language>

Target:
public String getLogMessage() { return String.format("Entered concentration value: %d", integerProgressStep.getInput()); }
Source:
<code>public void testConfirmFlag() { DispatchCallback callback = new DispatchCallback(); <START> SqlLine line = new SqlLine(); <END> assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); line.runCommands( Collections.singletonList("!set confirm true"), callback); assertEquals(Boolean.TRUE, line.getOpts().getConfirm()); line.runCommands( Collections.singletonList("!set confirm false"), callback); assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); }</code><technical_language>please custom output stream here, e.g. sqlline.SqlLineArgsTest#testSetWrongColorScheme output clearer in case of success tests</technical_language>

Target:
public void testConfirmFlag() { try { DispatchCallback callback = new DispatchCallback(); SqlLine line = new SqlLine(); ByteArrayOutputStream os = new ByteArrayOutputStream(); assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); begin(line, os, false, "-e", "!set confirm true"); assertEquals(Boolean.TRUE, line.getOpts().getConfirm()); begin(line, os, false, "-e", "!set confirm false"); assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); } catch (Throwable e) { throw new RuntimeException(e); } }
Source:
<code>public Map<Method, MessagingGatewaySupport> getGateways() { <START> return Collections.unmodifiableMap(this.gatewayMap); <END> }</code><technical_language>this: return Collections.<Method, MessagingGatewaySupport> unmodifiableMap(this.gatewayMap); reconsider Java 8 finally :smile: fix merge</technical_language>

Target:
public Map<Method, MessagingGatewaySupport> getGateways() { return Collections.<Method, MessagingGatewaySupport>unmodifiableMap(this.gatewayMap); }
Source:
<code>public Transaction(final Integer id, final Integer userId, final Lot lot, final Date transactionDate, final Integer status, final Double quantity, final String comments, final Integer commitmentDate, final String sourceType, final Integer sourceId, final Integer sourceRecordId, final Double previousAmount, final Integer personId, final String inventoryID) { super(); this.id = id; this.userId = userId; this.lot = lot; this.transactionDate = transactionDate; this.status = status; this.quantity = quantity; this.comments = comments; this.commitmentDate = commitmentDate; this.sourceType = sourceType; this.sourceId = sourceId; this.sourceRecordId = sourceRecordId; this.previousAmount = previousAmount; this.personId = personId; <START> this.lot.setStockId(inventoryID); <END> }</code><technical_language>if this is needed check if lot is null in case is nullable in ims_transaction..</technical_language>

Target:
public Transaction(final Integer id, final Integer userId, final Lot lot, final Date transactionDate, final Integer status, final Double quantity, final String comments, final Integer commitmentDate, final String sourceType, final Integer sourceId, final Integer sourceRecordId, final Double previousAmount, final Integer personId, final String inventoryID) { super(); this.id = id; this.userId = userId; this.lot = lot; this.transactionDate = transactionDate; this.status = status; this.quantity = quantity; this.comments = comments; this.commitmentDate = commitmentDate; this.sourceType = sourceType; this.sourceId = sourceId; this.sourceRecordId = sourceRecordId; this.previousAmount = previousAmount; this.personId = personId; if (this.lot != null) { this.lot.setStockId(inventoryID); } }
Source:
<code>public void SignUp_validation2() { SignUpPageObject signUpPage = new SignUpPageObject(driver); signUpPage.openSignUpPage(); String userNameNotExisting = signUpPage.getTimeStamp(); <START> signUpPage.typeInUserName(userNameNotExisting); <END> String userNameEmail = Properties.emailQaart1; signUpPage.typeInEmail(userNameEmail); String passwordNotExisting = signUpPage.getTimeStamp(); signUpPage.typeInPassword(passwordNotExisting); signUpPage.selectToYoungBirthDate(); signUpPage.waitForTooYoungErrorMsg(); }</code><technical_language>do getTimeStamp() method</technical_language>

Target:
public void SignUp_validation2() { SignUpPageObject signUpPage = new SignUpPageObject(driver); signUpPage.openSignUpPage(); signUpPage.typeInUserName(signUpPage.getTimeStamp()); signUpPage.typeInEmail(Properties.emailQaart1); signUpPage.typeInPassword(signUpPage.getTimeStamp()); Calendar currentDate = Calendar.getInstance(); signUpPage.enterBirthDate( Integer.toString(currentDate.get(Calendar.MONTH) + 1), Integer.toString(currentDate.get(Calendar.DAY_OF_MONTH)), Integer.toString(currentDate.get(Calendar.YEAR)- PageContent.MIN_AGE) ); signUpPage.waitForTooYoungErrorMsg(); }
Source:
<code>static public Expectation<List<OperationResult>> multiOp( final OvsdbClient client, DatabaseSchema dbs, final List<Table.OvsdbOperation> ops) { final Expectation<List<OperationResult>> result = new Expectation<>(); TransactionBuilder transaction = client.transactBuilder(dbs); for (Table.OvsdbOperation op: ops) { transaction.add(op.op); } FutureCallback<List<OperationResult>> cb = new FutureCallback<List<OperationResult>>() { @Override public void onSuccess(List<OperationResult> rlist) { OvsdbOpException exc = null; Integer idx = 0; for (OperationResult r: rlist) { if <START> (exc == null && opResultHasError(r)) <END> { exc = new OvsdbOpException(client, ops, idx, r); } idx++; } if (exc != null) result.failure(exc); else result.success(rlist); } @Override public void onFailure(@Nonnull Throwable exc) { result.failure(new OvsdbException(client, exc)); } }; Futures.addCallback(transaction.execute(), cb, callingThreadExecutor); return result; }</code><technical_language>Add a break this if? Then, this condition is needed</technical_language>

Target:
static public Expectation<List<OperationResult>> multiOp( final OvsdbClient client, DatabaseSchema dbs, final List<Table.OvsdbOperation> ops) { final Expectation<List<OperationResult>> result = new Expectation<>(); TransactionBuilder transaction = client.transactBuilder(dbs); for (Table.OvsdbOperation op: ops) { transaction.add(op.op); } FutureCallback<List<OperationResult>> cb = new FutureCallback<List<OperationResult>>() { @Override public void onSuccess(List<OperationResult> rlist) { OvsdbOpException exc = null; Integer idx = 0; for (OperationResult r: rlist) { if (opResultHasError(r)) { exc = new OvsdbOpException(client, ops, idx, r); break; } idx++; } if (exc != null) result.failure(exc); else result.success(rlist); } @Override public void onFailure(@Nonnull Throwable exc) { result.failure(new OvsdbException(client, exc)); } }; Futures.addCallback(transaction.execute(), cb, callingThreadExecutor); return result; }
Source:
<code>public void changeEmailAddress() { <START> final String newEmailAddress = "myAwesomeEmail@email.co.uk"; <END> EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); prefPage.verifyNotificationMessage(); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress); editPrefPage.changeEmail(Configuration.getCredentials().email); editPrefPage.clickSaveButton(); prefPage.verifyNotificationMessage(); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), Configuration.getCredentials().email); }</code><technical_language>if is final is static? if is final static move this field class field</technical_language>

Target:
public void changeEmailAddress() { final String newEmailAddress = "myAwesomeEmail@email.co.uk"; final String oldEmailAddress = Configuration.getCredentials().email; EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); prefPage.verifyNotificationMessage(); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress); editPrefPage.changeEmail(oldEmailAddress); editPrefPage.clickSaveButton(); prefPage.verifyNotificationMessage(); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), oldEmailAddress); }