auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static StringSchemaInfo getStringSchemaInfo(TSnowflakeOutputProperties outputProperties, Schema mainSchema, List<Field> columns) { boolean isUpperCase = false; boolean upsert = false; if (outputProperties != null) { isUpperCase = outputProperties.convertColumnsAndTableToUppercase.getValue(); upsert = UPSERT.equals(outputProperties.outputAction.getValue()); } List<String> keyStr = new ArrayList<>(); List<String> columnsStr = new ArrayList<>(); <START> int i = 0; for (Field overlapField : columns) { Field f; if ((f = overlapField) == null && (Boolean.valueOf((f = mainSchema.getFields().get(i)).getProp(SnowflakeAvroRegistry.TALEND_FIELD_AUTOINCREMENTED)))) { i++; continue; } <END> i++; String dbColumnName = f.getProp(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME); if (dbColumnName == null) { dbColumnName = f.name(); } String fName = isUpperCase ? dbColumnName.toUpperCase() : dbColumnName; columnsStr.add(fName); if (null != f.getProp(SchemaConstants.TALEND_COLUMN_IS_KEY)) { keyStr.add(fName); } } if (upsert) { keyStr.clear(); keyStr.add(outputProperties.upsertKeyColumn.getValue()); } return new StringSchemaInfo(keyStr, columnsStr); }</code><technical_language>deleted expression simplify if statement readability a f.getProp(SnowflakeAvroRegistry.TALEND_FIELD_AUTOINCREMENTED) ? I understand :kiss:</technical_language>

Target:
private static StringSchemaInfo getStringSchemaInfo(TSnowflakeOutputProperties outputProperties, Schema mainSchema, List<Field> columns) { boolean isUpperCase = false; boolean upsert = false; if (outputProperties != null) { isUpperCase = outputProperties.convertColumnsAndTableToUppercase.getValue(); upsert = UPSERT.equals(outputProperties.outputAction.getValue()); } List<String> keyStr = new ArrayList<>(); List<String> columnsStr = new ArrayList<>(); int i = 0; for (Field overlapField : columns) { Field f = overlapField == null ? mainSchema.getFields().get(i) : overlapField; i++; if (Boolean.valueOf(f.getProp(SnowflakeAvroRegistry.TALEND_FIELD_AUTOINCREMENTED))) { continue; } String dbColumnName = f.getProp(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME); if (dbColumnName == null) { dbColumnName = f.name(); } String fName = isUpperCase ? dbColumnName.toUpperCase() : dbColumnName; columnsStr.add(fName); if (null != f.getProp(SchemaConstants.TALEND_COLUMN_IS_KEY)) { keyStr.add(fName); } } if (upsert) { keyStr.clear(); keyStr.add(outputProperties.upsertKeyColumn.getValue()); } return new StringSchemaInfo(keyStr, columnsStr); }
Source:
<code>private void assertNextIterations(TestNavigatable navigatable, TestContext context, int startingElement) { <START> TreeItem previousSelection = (TreeItem)context.getItem(startingElement); <END> for (int expectedElement = startingElement + 1; expectedElement <= context.getNumberOfNodes(); expectedElement++) { TreeItem nextItem = navigatable.getNextItem(previousSelection); StringBuilder messageBuilder = new StringBuilder(); messageBuilder.append("Error with configuration: Starting iteration point=").append( startingElement).append(", previsous item=").append(previousSelection.getText()); assertNotNull(messageBuilder.toString(), nextItem); assertEquals(messageBuilder.toString(), expectedElement, Integer.valueOf(nextItem.getText()) .intValue()); previousSelection = nextItem; } assertNull(navigatable.getNextItem(previousSelection)); }</code><technical_language>I TestContext.getItem(int) return a TreeItem directly</technical_language>

Target:
private void assertNextIterations(TestNavigatable navigatable, TestContext context, int startingElement) { TreeItem previousSelection = context.getItem(startingElement); for (int expectedElement = startingElement + 1; expectedElement <= context.getNumberOfNodes(); expectedElement++) { TreeItem nextItem = navigatable.getNextItem(previousSelection); StringBuilder messageBuilder = new StringBuilder(); messageBuilder.append("Error with configuration: Starting iteration point=").append( startingElement).append(", previsous item=").append(previousSelection.getText()); assertNotNull(messageBuilder.toString(), nextItem); assertEquals(messageBuilder.toString(), expectedElement, Integer.valueOf(nextItem.getText()) .intValue()); previousSelection = nextItem; } assertNull(navigatable.getNextItem(previousSelection)); }
Source:
<code>public synchronized Map<String, Object> getScopeElements() { if (elements == null) { elements = new HashMap<>(); elements.put("audio", audioManager); elements.put("voice", voiceManager); } <START> return elements; <END> }</code><technical_language>If audio voice manager reference is removed (service disappears appears again) references. I create map once</technical_language>

Target:
public Map<String, Object> getScopeElements() { Map<String, Object> elements = new HashMap<>(); elements.put("audio", audioManager); elements.put("voice", voiceManager); return Collections.unmodifiableMap(elements); }
Source:
<code>private void initialize(List<LogSegment> segmentsToLoad, long segmentCapacityInBytes) throws IOException { if (segmentsToLoad.size() == 0) { segmentsToLoad = Collections.singletonList(checkArgsAndGetFirstSegment(segmentCapacityInBytes)); } long totalSegments = -1; <START> for (LogSegment segment : segmentsToLoad) { <END> if (segment.getName().isEmpty()) { totalSegments = 1; } else { totalSegments = totalSegments == -1 ? capacityInBytes / segment.getCapacityInBytes() : totalSegments; } segmentsByName.put(segment.getName(), segment); } remainingUnallocatedSegments.set(totalSegments - segmentsByName.size()); activeSegment = segmentsByName.lastEntry().getValue(); }</code><technical_language>set for totalSegments for loop segment is good enough find value. prefer for loop populate segmentsByName</technical_language>

Target:
private void initialize(List<LogSegment> segmentsToLoad, long segmentCapacityInBytes) throws IOException { if (segmentsToLoad.size() == 0) { segmentsToLoad = Collections.singletonList(checkArgsAndGetFirstSegment(segmentCapacityInBytes)); } LogSegment firstSegment = segmentsToLoad.get(0); long totalSegments = firstSegment.getName().isEmpty() ? 1 : capacityInBytes / firstSegment.getCapacityInBytes(); for (LogSegment segment : segmentsToLoad) { segmentsByName.put(segment.getName(), segment); } remainingUnallocatedSegments.set(totalSegments - segmentsByName.size()); activeSegment = segmentsByName.lastEntry().getValue(); }
Source:
<code>public void test() { Expression actual = expression("NOT(orderkey = 3 AND custkey = 3 AND orderkey < 10)"); SymbolAliases symbolAliases = SymbolAliases.builder() .put("X", new SymbolReference("orderkey")) .put("Y", new SymbolReference("custkey")) .build(); ExpressionVerifier verifier = new ExpressionVerifier(symbolAliases); assertTrue(verifier.process(actual, expression("NOT(X = 3 AND Y = 3 AND X < 10)"))); assertThrows(() -> verifier.process(actual, expression("NOT(X = 3 AND Y = 3 AND Z < 10)"))); assertFalse(verifier.process(actual, expression("NOT(X = 3 AND X = 3 AND X < 10)"))); RowExpressionVerifier rowExpressionVerifier = new RowExpressionVerifier(symbolAliases, metadata, TEST_SESSION); <START> assertTrue(rowExpressionVerifier.process(expression("NOT(X = 3 AND Y = 3 AND X < 10)"), translate(actual))); <END> assertThrows(() -> rowExpressionVerifier.process(expression("NOT(X = 3 AND Y = 3 AND Z < 10)"), translate(actual))); assertFalse(rowExpressionVerifier.process(expression("NOT(X = 3 AND X = 3 AND X < 10)"), translate(actual))); }</code><technical_language>this reverse symbol alias ExpressionVerifier</technical_language>

Target:
public void test() { Expression actual = expression("NOT(orderkey = 3 AND custkey = 3 AND orderkey < 10)"); SymbolAliases symbolAliases = SymbolAliases.builder() .put("X", new SymbolReference("orderkey")) .put("Y", new SymbolReference("custkey")) .build(); ExpressionVerifier verifier = new ExpressionVerifier(symbolAliases); RowExpressionVerifier rowExpressionVerifier = new RowExpressionVerifier(symbolAliases, metadata, TEST_SESSION); assertTrue(process(actual, expression("NOT(X = 3 AND Y = 3 AND X < 10)"), symbolAliases, metadata)); assertThrows(() -> verifier.process(actual, expression("NOT(X = 3 AND Y = 3 AND Z < 10)"))); assertThrows(() -> rowExpressionVerifier.process(expression("NOT(X = 3 AND Y = 3 AND Z < 10)"), translate(actual))); assertFalse(process(actual, expression("NOT(X = 3 AND X = 3 AND X < 10)"), symbolAliases, metadata)); }
Source:
<code>public boolean equals(Object o) { <START> return reflectionEquals(this, o); <END> }</code><technical_language>simply equals instead of relying reflectionEquals? ;) if underlying Table proper equals implemented instead of hacking here</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TpcdsDataSource that = (TpcdsDataSource) o; return scaleFactor == that.scaleFactor && table == that.table; }
Source:
<code>protected void deactivate() { <START> threadPool.shutdown(); <END> logger.info("jetty thread pool shutdown"); }</code><technical_language>I ThreadPoolExecutor#shutdownNow() stop actively executing tasks waiting tasks well</technical_language>

Target:
protected void deactivate() { try { if (commonHttpClient != null) { commonHttpClient.stop(); commonHttpClientFacade = null; commonHttpClient = null; threadPool = null; logger.info("jetty shared http client stopped"); } } catch (Exception e) { logger.error("error while stopping jetty shared http client", e); } }
Source:
<code>public void finish() { String shellText = getText(); new PushButton("Finish").click(); <START> new WaitWhile(new ShellIsActive(shellText)); <END> }</code><technical_language>ShellIsAvailable(this)</technical_language>

Target:
public void finish() { new PushButton("Finish").click(); new WaitWhile(new ShellIsAvailable(this)); }
Source:
<code><START> private Path generateArtifact(String id, <END> String version) throws IOException { try { return generate(id, version); } catch (NoSuchAlgorithmException | JAXBException | NugetFormatException e) { throw new IOException(e); } }</code><technical_language>public for generateArtifact(packageId, packageVersion, 0) method calls</technical_language>

Target:
public Path generateArtifact(String id, String version) throws IOException { try { return generate(id, version); } catch (NoSuchAlgorithmException | JAXBException | NugetFormatException e) { throw new IOException(e); } }
Source:
<code>private Collection<Snapshot> getSnapshotsToBeExportedWithMemory() { if (getParameters().getCopyCollapse()) { Snapshot activeSnapshot = snapshotDao.get(getVmId(), SnapshotType.ACTIVE); return activeSnapshot.containsMemory() ? Collections.singleton(activeSnapshot) : Collections.emptyList(); } else { return <START> snapshotDao.getAll(getVmId()).stream().filter(s -> s.containsMemory()).collect(Collectors.toList()); <END> } }</code><technical_language>Style: Snapshot::containsMemory</technical_language>

Target:
private Collection<Snapshot> getSnapshotsToBeExportedWithMemory() { if (getParameters().getCopyCollapse()) { Snapshot activeSnapshot = snapshotDao.get(getVmId(), SnapshotType.ACTIVE); return activeSnapshot.containsMemory() ? Collections.singleton(activeSnapshot) : Collections.emptyList(); } else { return snapshotDao.getAll(getVmId()).stream().filter(Snapshot::containsMemory).collect(Collectors.toList()); } }
Source:
<code>public String toString() { return "IotasSource{" + <START> "declaredStreams=" + outputStreams + <END> "} " + super.toString(); }</code><technical_language>minor: regenerate toString reflect renamed variables</technical_language>

Target:
public String toString() { return "IotasSource{" + "outputStreams=" + outputStreams + "} " + super.toString(); }
Source:
<code>private void schedulePeriodicWorks() { m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { if (m_statsManager != null) { m_statsManager.sendNotification(); } } }, 0, StatsManager.POLL_INTERVAL, TimeUnit.MILLISECONDS)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { <START> ((RealVoltDB)VoltDB.instance()).getFLC().checkCounter(System.currentTimeMillis()); <END> } }, 0, 10, TimeUnit.SECONDS)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { SystemStatsCollector.asyncSampleSystemNow(false, false); } }, 0, 5, TimeUnit.SECONDS)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { SystemStatsCollector.asyncSampleSystemNow(true, false); } }, 0, 1, TimeUnit.MINUTES)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { SystemStatsCollector.asyncSampleSystemNow(true, true); } }, 0, 6, TimeUnit.MINUTES)); EnterpriseMaintenance em = EnterpriseMaintenance.get(); if (em != null) { em.setupMaintenaceTasks(); } GCInspector.instance.start(m_periodicPriorityWorkThread, m_gcStats); }</code><technical_language>m_flc.checkCounter(timestamp) directly</technical_language>

Target:
private void schedulePeriodicWorks() { m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { if (m_statsManager != null) { m_statsManager.sendNotification(); } } }, 0, StatsManager.POLL_INTERVAL, TimeUnit.MILLISECONDS)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { ScheduledExecutorService es = VoltDB.instance().getSES(false); if (es != null && !es.isShutdown()) { es.submit(new Runnable() { @Override public void run() { long timestamp = System.currentTimeMillis(); m_flc.checkCounter(timestamp); } }); } } }, 0, 10, TimeUnit.SECONDS)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { SystemStatsCollector.asyncSampleSystemNow(false, false); } }, 0, 5, TimeUnit.SECONDS)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { SystemStatsCollector.asyncSampleSystemNow(true, false); } }, 0, 1, TimeUnit.MINUTES)); m_periodicWorks.add(scheduleWork(new Runnable() { @Override public void run() { SystemStatsCollector.asyncSampleSystemNow(true, true); } }, 0, 6, TimeUnit.MINUTES)); EnterpriseMaintenance em = EnterpriseMaintenance.get(); if (em != null) { em.setupMaintenaceTasks(); } GCInspector.instance.start(m_periodicPriorityWorkThread, m_gcStats); }
Source:
<code>public boolean isAlreadyVotedMessageVisible() { wait.forElementVisible(votedMessage); <START> return votedMessage.isDisplayed(); <END> }</code><technical_language>Right return false - in case votedMessage is visible, this method throw exception reaching timeout. please: - catch this exception cast appropriately bool - decide want call expect false - in this case want wait 30 seconds (or default timeout is)</technical_language>

Target:
public boolean isAlreadyVotedMessageVisible() { return isElementDisplayed(votedMessage); }
Source:
<code>public void setUp() throws Exception { super.setUp(); final ApplicationSpec simpleSpec = ApplicationSpec.builder().name("simple-app"). entities(ImmutableSet.of(new EntitySpec("simple-ent", RestMockSimpleEntity.class.getName(), ImmutableMap.of("install.version", "1.0.0")))). locations(ImmutableSet.of("localhost")). build(); ClientResponse response = clientDeploy(simpleSpec); <START> assertTrue(response.getStatus() >= 200 && response.getStatus() <= 299); <END> application = response.getLocation(); waitForApplicationToBeRunning(application); }</code><technical_language>do , response); - if assertion fails jenkins get response was</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); final ApplicationSpec simpleSpec = ApplicationSpec.builder().name("simple-app"). entities(ImmutableSet.of(new EntitySpec("simple-ent", RestMockSimpleEntity.class.getName(), ImmutableMap.of("install.version", "1.0.0")))). locations(ImmutableSet.of("localhost")). build(); ClientResponse response = clientDeploy(simpleSpec); int status = response.getStatus(); assertTrue(status >= 200 && status <= 299, "expected HTTP Response of 2xx but got " + status); application = response.getLocation(); waitForApplicationToBeRunning(application); }
Source:
<code>public ExpiringCacheAsync(long expiry) throws IllegalArgumentException { <START> this.expiry = TimeUnit.MILLISECONDS.toNanos(expiry); <END> if (expiry <= 0) { throw new IllegalArgumentException("Cache expire time must be greater than 0"); } }</code><technical_language>sense check argument in front of it</technical_language>

Target:
public ExpiringCacheAsync(long expiry) throws IllegalArgumentException { if (expiry <= 0) { throw new IllegalArgumentException("Cache expire time must be greater than 0"); } this.expiry = TimeUnit.MILLISECONDS.toNanos(expiry); }
Source:
<code>public static void declareExchange(Connection connection, String exchangeName, Hashtable<String, String> properties) throws IOException { Boolean exchangeAvailable = false; Channel channel = connection.createChannel(); String exchangeType = properties .get(RabbitMQConstants.EXCHANGE_TYPE); String durable = properties.get(RabbitMQConstants.EXCHANGE_DURABLE); <START> String autoDelete = properties.get(RabbitMQConstants.EXCHANGE_AUTODELETE); <END> try { channel.exchangeDeclarePassive(exchangeName); exchangeAvailable = true; } catch (IOException e) { log.info("Exchange :" + exchangeName + " not found.Declaring exchange."); } if (!exchangeAvailable) { if (!channel.isOpen()) { channel = connection.createChannel(); log.debug("Channel is not open. Creating a new channel."); } try { if (exchangeType != null && !exchangeType.equals("")) { if (durable != null && !durable.equals("")) { if (autoDelete != null && !autoDelete.isEmpty()) { channel.exchangeDeclare(exchangeName, exchangeType, Boolean.parseBoolean(durable), Boolean.parseBoolean(autoDelete), null); } else { channel.exchangeDeclare(exchangeName, exchangeType, Boolean.parseBoolean(durable)); } } else { channel.exchangeDeclare(exchangeName, exchangeType, true); } } else { channel.exchangeDeclare(exchangeName, "direct", true); } } catch (IOException e) { handleException("Error occurred while declaring exchange.", e); } } try { channel.close(); } catch (TimeoutException e) { log.error("Error occurred while closing connection.", e); } }</code><technical_language>Please check if a method get default if is null, avoid null check L160</technical_language>

Target:
public static void declareExchange(Connection connection, String exchangeName, Hashtable<String, String> properties) throws IOException { Boolean exchangeAvailable = false; Channel channel = connection.createChannel(); String exchangeType = properties .getOrDefault(RabbitMQConstants.EXCHANGE_TYPE, RabbitMQConstants.EXCHANGE_TYPE_DEFAULT); String durable = properties .getOrDefault(RabbitMQConstants.EXCHANGE_DURABLE, RabbitMQConstants.EXCHANGE_DURABLE_DEFAULT); String autoDelete = properties .getOrDefault(RabbitMQConstants.EXCHANGE_AUTODELETE, RabbitMQConstants.EXCHANGE_AUTODELETE_DEFAULT); if (exchangeType.isEmpty()) { exchangeType = RabbitMQConstants.EXCHANGE_TYPE_DEFAULT; } if (durable.isEmpty()) { durable = RabbitMQConstants.EXCHANGE_DURABLE_DEFAULT; } if (autoDelete.isEmpty()) { autoDelete = RabbitMQConstants.EXCHANGE_AUTODELETE_DEFAULT; } try { channel.exchangeDeclarePassive(exchangeName); exchangeAvailable = true; } catch (IOException e) { log.info("Exchange :" + exchangeName + " not found.Declaring exchange."); } if (!exchangeAvailable) { if (!channel.isOpen()) { channel = connection.createChannel(); log.debug("Channel is not open. Creating a new channel."); } try { channel.exchangeDeclare(exchangeName, exchangeType, Boolean.parseBoolean(durable), Boolean.parseBoolean(autoDelete), null); } catch (IOException e) { handleException("Error occurred while declaring exchange.", e); } } try { channel.close(); } catch (TimeoutException e) { log.error("Error occurred while closing connection.", e); } }
Source:
<code>private void removeListener(OrderedRealmCollection<T> data) { if (data instanceof RealmResults) { RealmResults realmResults = (RealmResults) data; <START> realmResults.realm.handlerController.removeWeakChangeListener(listener); <END> } else if (data instanceof RealmList) { RealmList realmList = (RealmList) data; realmList.realm.handlerController.removeWeakChangeListener(listener); } else { throw new IllegalArgumentException("RealmCollection not supported: " + data.getClass()); } }</code><technical_language>this is largely unnecessary for RecyclerView adapters lifecycle callbacks for is attached/detached. reason this (ugly) code is part of RealmBaseAdapter is standard ListView adapters do callbacks forced weak change listeners. change listeners collections granularity currently. I remove this code completely realmResults.addChangeListener(listener) instead</technical_language>

Target:
private void removeListener(OrderedRealmCollection<T> data) { BaseRealm realm = getRealm(data); if (realm != null && !realm.isClosed()) { realm.removeChangeListener(listener); } }
Source:
<code>public void testCooperativeSubscription() { builder.addSource(null, "source1", null, null, null, "topic1"); builder.addSource(null, "source2", null, null, null, "topic2"); builder.addProcessor("processor", new MockProcessorSupplier(), "source1", "source2"); final Set<TaskId> prevTasks = mkSet( new TaskId(0, 1), new TaskId(1, 1), new TaskId(2, 1)); final Set<TaskId> standbyTasks = mkSet( new TaskId(0, 1), new TaskId(1, 1), new TaskId(2, 1), new TaskId(0, 2), new TaskId(1, 2), new TaskId(2, 2)); final UUID processId = UUID.randomUUID(); createMockTaskManager(prevTasks, standbyTasks, processId, builder); EasyMock.replay(taskManager); configureDefaultPartitionAssignor(); final Set<String> topics = mkSet("topic1", "topic2"); final Subscription subscription = new Subscription( new ArrayList<>(topics), partitionAssignor.subscriptionUserData(topics)); Collections.sort(subscription.topics()); assertEquals(asList("topic1", "topic2"), subscription.topics()); <START> final SubscriptionInfo info = getInfo(processId, getTaskOffsetSums(prevTasks, standbyTasks), null); <END> assertEquals(info, SubscriptionInfo.decode(subscription.userData())); }</code><technical_language>nit: mocked task manager call getTaskOffsetSums(...) call taskManager.getTaskOffsetSums() here? Ditto elsewhere</technical_language>

Target:
public void testCooperativeSubscription() { builder.addSource(null, "source1", null, null, null, "topic1"); builder.addSource(null, "source2", null, null, null, "topic2"); builder.addProcessor("processor", new MockProcessorSupplier(), "source1", "source2"); final Set<TaskId> prevTasks = mkSet( new TaskId(0, 1), new TaskId(1, 1), new TaskId(2, 1)); final Set<TaskId> standbyTasks = mkSet( new TaskId(0, 1), new TaskId(1, 1), new TaskId(2, 1), new TaskId(0, 2), new TaskId(1, 2), new TaskId(2, 2)); createMockTaskManager(prevTasks, standbyTasks); configureDefaultPartitionAssignor(); final Set<String> topics = mkSet("topic1", "topic2"); final Subscription subscription = new Subscription( new ArrayList<>(topics), partitionAssignor.subscriptionUserData(topics)); Collections.sort(subscription.topics()); assertEquals(asList("topic1", "topic2"), subscription.topics()); final SubscriptionInfo info = getInfo(uuid1, prevTasks, standbyTasks); assertEquals(info, SubscriptionInfo.decode(subscription.userData())); }
Source:
<code>boolean verifyOrCreateRemoteSpecialFolder(Account account, String folderName, Folder remoteFolder, MessagingListener listener, MessagingController controller) throws MessagingException { if (folderName.equals(account.getTrashFolderName()) || folderName.equals(account.getSentFolderName()) || folderName.equals(account.getDraftsFolderName())) { <START> if (!remoteFolder.exists()) { <END> if (!remoteFolder.create(FolderType.HOLDS_MESSAGES)) { for (MessagingListener l : controller.getListeners(listener)) { l.synchronizeMailboxFinished(account, folderName, 0, 0); } Timber.i("Done synchronizing folder %s", folderName); return false; } } } return true; }</code><technical_language>combine if's reduce nesting a bit</technical_language>

Target:
boolean verifyOrCreateRemoteSpecialFolder(Account account, String folderName, Folder remoteFolder, MessagingListener listener, MessagingController controller) throws MessagingException { if ((folderName.equals(account.getTrashFolderName()) || folderName.equals(account.getSentFolderName()) || folderName.equals(account.getDraftsFolderName())) && !remoteFolder.exists() && !remoteFolder.create(FolderType.HOLDS_MESSAGES)) { for (MessagingListener l : controller.getListeners(listener)) { l.synchronizeMailboxFinished(account, folderName, 0, 0); } Timber.i("Done synchronizing folder %s", folderName); return false; } return true; }
Source:
<code>public boolean hasFailedChecksum() { return !sourceMd5.equals(md5); <START> } <END></code><technical_language>Add new line</technical_language>

Target:
public boolean hasFailedChecksum() { return isMissingSourceMd5() ? false : !sourceMd5.equals(md5); }
Source:
<code>public Enumeration<URL> getResources(final String name) throws IOException { <START> final Vector<URL> resources = new Vector<URL>(); <END> final Enumeration<URL> parentResources = this.getParent().getResources(name); while (parentResources.hasMoreElements()) { resources.add(parentResources.nextElement()); } final Enumeration<URL> childResources = this.findResources(name); while (childResources.hasMoreElements()) { resources.add(childResources.nextElement()); } return resources.elements(); }</code><technical_language>nit: final Vector<URL> resources = new Vector<>();</technical_language>

Target:
public Enumeration<URL> getResources(final String name) throws IOException { final Vector<URL> resources = new Vector<>(); final Enumeration<URL> parentResources = this.getParent().getResources(name); while (parentResources.hasMoreElements()) { resources.add(parentResources.nextElement()); } final Enumeration<URL> childResources = this.findResources(name); while (childResources.hasMoreElements()) { resources.add(childResources.nextElement()); } return resources.elements(); }
Source:
<code>public GerritConstantsProperties() throws IOException { InputStream constantsStream = <START> GerritTopMenus.class.getResourceAsStream(GERRIT_CONSTANTS_PROPERTIES); <END> if (constantsStream != null) { load(constantsStream); } else { log.error("Cannot locate Gerrit constants from classpath", GERRIT_CONSTANTS_PROPERTIES); } }</code><technical_language>class GerritConstantsProperties.class even: getClass().getResourceAsStream(GERRIT_CONSTANTS_PROPERTIES)</technical_language>

Target:
public GerritConstantsProperties() throws IOException { InputStream constantsStream = getClass().getResourceAsStream(GERRIT_CONSTANTS_PROPERTIES); if (constantsStream != null) { try { load(constantsStream); } finally { constantsStream.close(); } } else { log.error("Cannot locate Gerrit constants from classpath", GERRIT_CONSTANTS_PROPERTIES); } }
Source:
<code>public List<Class<? extends WindupRuleProvider>> getExecuteAfter() { <START> Rules ann = this.getClass().getAnnotation(Rules.class); <END> if(ann != null) return Arrays.asList(ann.after()); else return Collections.emptyList(); }</code><technical_language>Rename "ann" "rules", "rulesAnnotation" more descriptive</technical_language>

Target:
public List<Class<? extends WindupRuleProvider>> getExecuteAfter() { Rules rulesAnnotation = this.getClass().getAnnotation(Rules.class); if(rulesAnnotation != null) return Arrays.asList(rulesAnnotation.after()); else return Collections.emptyList(); }
Source:
<code>public void testSTLineFromText() throws Exception { assertQuery("select ST_AsText(ST_LineFromText('LINESTRING EMPTY'))", "select 'MULTILINESTRING EMPTY'"); assertQuery("select ST_AsText(ST_LineFromText('LineString(1 1, 2 2, 1 3)'))", "select 'LINESTRING (1 1, 2 2, 1 3)'"); <START> assertQueryFails("select ST_AsText(ST_LineFromText('MULTILineString EMPTY'))", "ST_LineFromText only applies to LineString. Input type is: MultiLineString"); <END> assertQueryFails("select ST_AsText(ST_LineFromText('Polygon ((1 1, 1 4, 4 4, 4 1))'))", "ST_LineFromText only applies to LineString. Input type is: Polygon"); }</code><technical_language>nit: this test suite, WKT strings consistent. For example, LineString, MULTILineString, MULTILINESTRING, etc. a pass align. Perhaps, uppercase WKT type prefixes? 'POLYGON...', 'POINT...', 'LINESTRING...'</technical_language>

Target:
public void testSTLineFromText() throws Exception { assertFunction("ST_AsText(ST_LineFromText('LINESTRING EMPTY'))", VARCHAR, "MULTILINESTRING EMPTY"); assertFunction("ST_AsText(ST_LineFromText('LINESTRING (1 1, 2 2, 1 3)'))", VARCHAR, "LINESTRING (1 1, 2 2, 1 3)"); assertInvalidFunction("ST_AsText(ST_LineFromText('MULTILINESTRING EMPTY'))", "ST_LineFromText only applies to LINE_STRING. Input type is: MULTI_LINE_STRING"); assertInvalidFunction("ST_AsText(ST_LineFromText('POLYGON ((1 1, 1 4, 4 4, 4 1))'))", "ST_LineFromText only applies to LINE_STRING. Input type is: POLYGON"); }
Source:
<code>public void should_pass_given_percent_of_samples() throws Exception { samplerConfiguration.setPercentage(0.3d); int numberOfSampledElements = countNumberOfSampledElements(); <START> then(numberOfSampledElements).isCloseTo(30, withPercentage(30)); <END> }</code><technical_language>30% is a hefty error rate... need that? FWIW I 3% sweet spot</technical_language>

Target:
public void should_pass_given_percent_of_samples() throws Exception { int numberOfIterations = 10000; float percentage = 0.3f; samplerConfiguration.setPercentage(percentage); int numberOfSampledElements = countNumberOfSampledElements(numberOfIterations); then(numberOfSampledElements).isCloseTo((int) (numberOfIterations * percentage), withPercentage(3)); }
Source:
<code>public ReplicaPolicy getReplicaPolicy() { if (replicaPolicy == null) { replicaPolicy = new ReplicaPolicy(networkHealthCheck, this); replicaPolicy.setQuorumSize(quorumSize); replicaPolicy.setVoteOnReplicationFailure(voteOnReplicationFailure); replicaPolicy.setVoteRetries(voteRetries); replicaPolicy.setVoteRetryWait(voteRetryWait); if (clusterName != null && clusterName.length() > 0) { replicaPolicy.setClusterName(clusterName); } if (groupName != null && groupName.length() > 0) { replicaPolicy.setGroupName(groupName); } <START> replicaPolicy.setQuorumVoteWait(quorumVoteWait); <END> } return replicaPolicy; }</code><technical_language>pass parameter ReplicePolicy constructor escape validation perform</technical_language>

Target:
public ReplicaPolicy getReplicaPolicy() { if (replicaPolicy == null) { replicaPolicy = new ReplicaPolicy(networkHealthCheck, this, quorumVoteWait); replicaPolicy.setQuorumSize(quorumSize); replicaPolicy.setVoteOnReplicationFailure(voteOnReplicationFailure); replicaPolicy.setVoteRetries(voteRetries); replicaPolicy.setVoteRetryWait(voteRetryWait); if (clusterName != null && clusterName.length() > 0) { replicaPolicy.setClusterName(clusterName); } if (groupName != null && groupName.length() > 0) { replicaPolicy.setGroupName(groupName); } } return replicaPolicy; }
Source:
<code>public void setup() throws Exception { JmhJenkinsRule j = new JmhJenkinsRule(); webClient = j.createWebClient(); webClient.setJavaScriptEnabled(false); webClient.setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setPrintContentOnFailingStatusCode(false); <START> webClient.login("user33", "user33"); <END> }</code><technical_language>If is a mock user, call "mockUser" is assumptions is real</technical_language>

Target:
public void setup() throws Exception { JmhJenkinsRule j = new JmhJenkinsRule(); webClient = j.createWebClient(); webClient.setJavaScriptEnabled(false); webClient.setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setPrintContentOnFailingStatusCode(false); webClient.login("mockUser", "mockUser"); }
Source:
<code>public void removeMembership(CohortMembership cohortMembership) { List<CohortMembership> memberToRemoveList = getMembers().stream() .filter(m -> m.equals(cohortMembership)) .collect(Collectors.toList()); <START> memberToRemoveList.forEach(m -> m.setEndDate(new Date())); <END> }</code><technical_language>I this able lookup membership matching patient remove a call works too: Cohort.removeMembership(new CohortMembership(Context.getPatientService().getPatient(patientId)))</technical_language>

Target:
public void removeMembership(CohortMembership cohortMembership) { List<CohortMembership> memberToRemoveList = getMembers().stream() .filter(m -> m.equals(cohortMembership) || m.getPatient().getPatientId().equals(cohortMembership.getPatient().getPatientId())) .collect(Collectors.toList()); memberToRemoveList.forEach(m -> m.setEndDate(new Date())); }
Source:
<code>public Connection getsqlConnection() { dataSource = null; try{ if(isJndiLookup) { dataSource = (DataSource) InitialContext.doLookup("jdbc/DataSourcetoPublishHealthStatRDBMS"); } else { dataSource = (DataSource) DataSourceManager.getInstance() .getDataSourceRepository().getDataSource("DataSourcetoPublishHealthStatRDBMS") .getDSObject(); } if (dataSource != null) { connection = dataSource.getConnection(); } <START> <END> } catch (Exception e) { e.printStackTrace(); System.out.println("Error " + e.getMessage()); } return connection; }</code><technical_language>Code blank lines, please remove format</technical_language>

Target:
public Connection getsqlConnection() throws RestAPIException { dataSource = null; try { if (isJndiLookup) { dataSource = (DataSource) InitialContext.doLookup("jdbc/DataSourcetoPublishHealthStatRDBMS"); } else { dataSource = (DataSource) DataSourceManager.getInstance() .getDataSourceRepository().getDataSource("DataSourcetoPublishHealthStatRDBMS") .getDSObject(); } if (dataSource != null) { connection = dataSource.getConnection(); } } catch (SQLException ex) { log.error("SQLException: ", ex); throw new RestAPIException(ex.getMessage(),ex); } catch (DataSourceException ex) { log.error("DataSourceException: ", ex); throw new RestAPIException(ex.getMessage(),ex); } catch (NamingException ex) { log.error("DataSourceException: ", ex); throw new RestAPIException(ex.getMessage(),ex); } return connection; }
Source:
<code><START> public synchronized void loadGameVersionsFromPackageManager(GameSettings gameSettings, Path launcherDirectory, Path gameDirectory) { <END> final Path cacheDirectory = launcherDirectory.resolve(DirectoryUtils.CACHE_DIR_NAME); packageManager.initLocalStorage(gameDirectory, cacheDirectory); packageManager.sync(); final List<TerasologyGameVersion> allInstalledGames = getInstalledGames(gameDirectory); for (GameJob job : GameJob.values()) { final List<TerasologyGameVersion> installedGames = allInstalledGames.stream() .filter(gameVersion -> gameVersion.getJob().equals(job)) .collect(Collectors.toList()); final List<Integer> installedBuildNumbers = installedGames.stream() .map(TerasologyGameVersion::getBuildNumber) .collect(Collectors.toList()); final List<TerasologyGameVersion> availableGames = packageManager.getPackageVersions(GamePackageType.byJobName(job.name())) .stream() .filter(buildNumber -> !installedBuildNumbers.contains(buildNumber)) .map(buildNumber -> getGameVersion(buildNumber, job, cacheDirectory)) .collect(Collectors.toList()); availableGames.addAll(installedGames); availableGames.sort(Comparator.comparing(TerasologyGameVersion::getBuildNumber).reversed()); availableGames.add(0, makeLatestFrom(availableGames.get(0))); gameVersionLists.put(job, availableGames); } }</code><technical_language>@praj-foss Please get confused, I stream API clean this code a bit Note self: happy this code mutates state, e.g., filling version lists. I (now) find difficult is understand part of code changes variables. some point, reduce number of class members group information logically together</technical_language>

Target:
public synchronized void loadGameVersionsFromPackageManager(GameSettings gameSettings, Path launcherDirectory, Path gameDirectory) { final Path cacheDirectory = launcherDirectory.resolve(DirectoryUtils.CACHE_DIR_NAME); packageManager.initLocalStorage(gameDirectory, cacheDirectory); packageManager.sync(); final List<TerasologyGameVersion> allInstalledGames = getInstalledGames(gameDirectory); for (GameJob job : GameJob.values()) { final List<TerasologyGameVersion> availableGames = packageManager.getPackageVersions(PackageBuild.byJobName(job.name())) .stream() .map(buildNumber -> getGameVersion(buildNumber, job, cacheDirectory)) .collect(Collectors.toList()); allInstalledGames.stream() .filter(gameVersion -> gameVersion.getJob().equals(job)) .forEach(installedGame -> { for (TerasologyGameVersion availableGame : availableGames) { if (availableGame.getBuildNumber().equals(installedGame.getBuildNumber())) { availableGame.setInstallationPath(installedGame.getInstallationPath()); availableGame.setGameJar(installedGame.getGameJar()); break; } } }); availableGames.sort(Comparator.comparing(TerasologyGameVersion::getBuildNumber).reversed()); availableGames.add(0, makeLatestFrom(availableGames.get(0))); gameVersionLists.put(job, availableGames); } }
Source:
<code>private Map<TopicPartition, Long> prepareClose(final boolean clean) { final Map<TopicPartition, Long> checkpoint; switch (state()) { case CREATED: checkpoint = Collections.emptyMap(); break; case RUNNING: closeTopology(clean); if (clean) { stateMgr.flush(); recordCollector.flush(); checkpoint = checkpointableOffsets(); } else { checkpoint = null; executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush", log); } break; case RESTORING: executeAndMaybeSwallow(clean, stateMgr::flush, "state manager flush", log); checkpoint = Collections.emptyMap(); break; case SUSPENDED: ENDED` do not need to checkpoint, since when suspending we've already committed the state checkpoint = null; break; case CLOSED: checkpoint = Collections.emptyMap(); <START> break; <END> default: throw new IllegalStateException("Unknown state " + state() + " while prepare closing active task " + id); } return checkpoint; }</code><technical_language>merge case CLOSED CREATED? elaborate do empty checkpoint map instead of null</technical_language>

Target:
private Map<TopicPartition, Long> prepareClose(final boolean clean) { final Map<TopicPartition, Long> checkpoint; switch (state()) { case CREATED: checkpoint = Collections.emptyMap(); break; case RUNNING: closeTopology(clean); if (clean) { stateMgr.flush(); recordCollector.flush(); checkpoint = checkpointableOffsets(); } else { checkpoint = null; executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush", log); } break; case RESTORING: executeAndMaybeSwallow(clean, stateMgr::flush, "state manager flush", log); checkpoint = Collections.emptyMap(); break; case SUSPENDED: case CLOSED: checkpoint = null; break; default: throw new IllegalStateException("Unknown state " + state() + " while prepare closing active task " + id); } return checkpoint; }
Source:
<code>public String getPathForHadoop() { <START> return null; <END> }</code><technical_language>message is deleted. New link - <LINK_0>!topic/druid-user/bd9dXKcJ8tg</technical_language>

Target:
public String getPathForHadoop() { return String.format("gs://%s/%s", config.getBucket(), config.getPrefix()); }
Source:
<code>private <K, V> Tuple<K, V> resolveDynamicContent(K key, V value) { final K adaptedKey; if (key instanceof String) { adaptedKey = (K) replaceDynamicContentInString((String) key); } else { adaptedKey = key; } final V adaptedValue; <START> if (value instanceof String) { <END> adaptedValue = (V) replaceDynamicContentInString((String) value); } else { adaptedValue = value; } return Tuple.createTuple(adaptedKey, adaptedValue); }</code><technical_language>Cool attempt! :+1: reduce some redundancy processing of key is identical</technical_language>

Target:
private <K, V> KeyValue<K, V> resolveDynamicContent(K key, V value) { final K adaptedKey = resolveDynamicContentIfRequired(key); final V adaptedValue = resolveDynamicContentIfRequired(value); return KeyValue.with(adaptedKey, adaptedValue); }
Source:
<code>private List<TaskStatusEvent> events(final List<Long> timestamps) { final ImmutableList.Builder<TaskStatusEvent> builder = ImmutableList.builder(); final List<Long> copy = Lists.newArrayList(timestamps); <START> copy.sort((t1, t2) -> { <END> if (t1 > t2) { return 1; } else if (t1 < t2) { return -1; } return 0; }); for (final Long timestamp : copy) { final TaskStatus taskStatus = TaskStatus.newBuilder() .setJob(DUMMY_JOB) .setGoal(Goal.START) .setState(State.RUNNING) .build(); builder.add(new TaskStatusEvent(taskStatus, timestamp, "")); } return builder.build(); }</code><technical_language>I this is Collection.sort(copy) Long implements Comparable</technical_language>

Target:
private List<TaskStatusEvent> events(final List<Long> timestamps) { final ImmutableList.Builder<TaskStatusEvent> builder = ImmutableList.builder(); final List<Long> copy = Lists.newArrayList(timestamps); Collections.sort(copy); for (final Long timestamp : timestamps) { final TaskStatus taskStatus = TaskStatus.newBuilder() .setJob(DUMMY_JOB) .setGoal(Goal.START) .setState(State.RUNNING) .build(); builder.add(new TaskStatusEvent(taskStatus, timestamp, "")); } return builder.build(); }
Source:
<code>AggregationInfo buildAggregationInfo() { String expression; if (_name.equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { expression = "*"; } else { List<? extends AstNode> children = getChildren(); if (children == null || children.isEmpty()) { throw new Pql2CompilationException("Aggregation function expects non-null argument"); } if (_name.equalsIgnoreCase(AggregationFunctionType.DISTINCT.getName()) && children.size() == 1 && children .get(0) instanceof StarExpressionAstNode) { throw new Pql2CompilationException( "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name as argument to DISTINCT function"); } Set<String> expressions = new HashSet<>(); StringBuilder distinctColumnExpr = new StringBuilder(); int numChildren = children.size(); for (int i = 0; i < numChildren; ++i) { expression = TransformExpressionTree.getStandardExpression(children.get(i)); if (expressions.add(expression)) { if (i != 0) { distinctColumnExpr.append(AGGREGATION_FUNCTION_ARG_SEPARATOR); } distinctColumnExpr.append(expression); } } expression = distinctColumnExpr.toString(); } <START> AggregationInfo aggregationInfo = new AggregationInfo(); <END> aggregationInfo.setAggregationType(_name); aggregationInfo.putToAggregationParams(CompilerConstants.COLUMN_KEY_IN_AGGREGATION_INFO, expression); aggregationInfo.setIsInSelectList(_isInSelectList); return aggregationInfo; }</code><technical_language>instead fix AggregationInfo in multiple arguments instead</technical_language>

Target:
AggregationInfo buildAggregationInfo() { String expression; if (_name.equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { expression = "*"; } else { List<? extends AstNode> children = getChildren(); if (children == null || children.isEmpty()) { throw new Pql2CompilationException("Aggregation function expects non-null argument"); } if (_name.equalsIgnoreCase(AggregationFunctionType.DISTINCT.getName()) && children.size() == 1 && children .get(0) instanceof StarExpressionAstNode) { throw new Pql2CompilationException( "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name as argument to DISTINCT function"); } Set<String> expressions = new HashSet<>(); StringBuilder distinctColumnExpr = new StringBuilder(); int numChildren = children.size(); for (int i = 0; i < numChildren; ++i) { expression = TransformExpressionTree.getStandardExpression(children.get(i)); if (expressions.add(expression)) { if (i != 0) { distinctColumnExpr.append(CompilerConstants.AGGREGATION_FUNCTION_ARG_SEPARATOR); } distinctColumnExpr.append(expression); } } expression = distinctColumnExpr.toString(); } AggregationInfo aggregationInfo = new AggregationInfo(); aggregationInfo.setAggregationType(_name); aggregationInfo.putToAggregationParams(CompilerConstants.COLUMN_KEY_IN_AGGREGATION_INFO, expression); aggregationInfo.setIsInSelectList(_isInSelectList); return aggregationInfo; }
Source:
<code>private void handleSuccessors(CfgBlock block, ProgramState incomingState) { ProgramState currentState = incomingState; if (block instanceof CfgBranchingBlock) { CfgBranchingBlock branchingBlock = (CfgBranchingBlock) block; Tree branchingTree = branchingBlock.branchingTree(); if (branchingTree.is( Kind.IF_STATEMENT, Kind.WHILE_STATEMENT, Kind.FOR_STATEMENT, Kind.DO_WHILE_STATEMENT, Kind.CONDITIONAL_AND, Kind.CONDITIONAL_OR)) { handleConditionSuccessors(branchingBlock, currentState); return; <START> } else if (branchingTree.is(Kind.FOR_IN_STATEMENT, Kind.FOR_OF_STATEMENT)) { <END> ForObjectStatementTree forTree = (ForObjectStatementTree) branchingTree; Tree variable = forTree.variableOrExpression(); if (variable.is(Kind.VAR_DECLARATION)) { VariableDeclarationTree declaration = (VariableDeclarationTree) variable; variable = declaration.variables().get(0); } currentState = store(currentState, variable, forTree.expression()); } } pushAllSuccessors(block, currentState); }</code><technical_language>@pynicolas action, works fine if (branchingTree.is(Kind.FOR_IN_STATEMENT, Kind.FOR_OF_STATEMENT)). I suggest following: if (branchingTree.is(Kind.FOR_IN_STATEMENT, Kind.FOR_OF_STATEMENT)) { // previous code of clause pushAllSuccessors(block, currentState); } else { handleConditionSuccessors(branchingBlock, currentState); }</technical_language>

Target:
private void handleSuccessors(CfgBlock block, ProgramState incomingState) { ProgramState currentState = incomingState; if (block instanceof CfgBranchingBlock) { CfgBranchingBlock branchingBlock = (CfgBranchingBlock) block; Tree branchingTree = branchingBlock.branchingTree(); if (branchingTree.is( Kind.IF_STATEMENT, Kind.WHILE_STATEMENT, Kind.FOR_STATEMENT, Kind.DO_WHILE_STATEMENT, Kind.CONDITIONAL_AND, Kind.CONDITIONAL_OR)) { handleConditionSuccessors(branchingBlock, currentState); return; } else if (branchingTree.is(Kind.FOR_IN_STATEMENT, Kind.FOR_OF_STATEMENT)) { ForObjectStatementTree forTree = (ForObjectStatementTree) branchingTree; Tree variable = forTree.variableOrExpression(); if (variable.is(Kind.VAR_DECLARATION)) { VariableDeclarationTree declaration = (VariableDeclarationTree) variable; variable = declaration.variables().get(0); } currentState = store(currentState, variable, SymbolicValue.UNKNOWN); } } pushAllSuccessors(block, currentState); }
Source:
<code>public void testNotFound() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setBody(payloadFromResource("/not-found.json"))); DigitalOceanApi api = api(server.getUrl("/")); ImageApi imageApi = api.getImageApi(); try { imageApi.list(); fail("Request should have failed"); } catch (Exception ex) { assertTrue(ex instanceof ResourceNotFoundException, "Exception should be a ResourceNotFoundException"); <START> assertEquals(ex.getMessage(), "Not Found"); <END> } finally { api.close(); server.shutdown(); } }</code><technical_language>a constant</technical_language>

Target:
public void testNotFound() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setBody(payloadFromResource("/not-found.json"))); DigitalOceanApi api = api(server.getUrl("/")); ImageApi imageApi = api.getImageApi(); try { imageApi.list(); fail("Request should have failed"); } catch (Exception ex) { assertTrue(ex instanceof ResourceNotFoundException, "Exception should be a ResourceNotFoundException"); assertEquals(ex.getMessage(), NOT_FOUND); } finally { api.close(); server.shutdown(); } }
Source:
<code>protected Map<VmTemplate, List<DiskImage>> buildFromOVFs(List<String> ovfList) { OvfManager ovfManager = new OvfManager(); Map<VmTemplate, List<DiskImage>> templates = new HashMap<>(); OvfHelper ovfHelper = new OvfHelper(); for (String ovf : ovfList) { try { if (ovfManager.IsOvfTemplate(ovf)) { VmTemplate vmTemplate = ovfHelper.readVmTemplateFromOvf(ovf); <START> List templateDisks = new ArrayList(vmTemplate.getDiskTemplateMap().values()); <END> templates.put(vmTemplate, templateDisks); } } catch (OvfReaderException ex) { auditLogOvfLoadError(ex.getName()); } } return templates; }</code><technical_language>add generics type: <DiskImage></technical_language>

Target:
protected Map<VmTemplate, List<DiskImage>> buildFromOVFs(List<String> ovfList) { OvfManager ovfManager = new OvfManager(); Map<VmTemplate, List<DiskImage>> templateDisksMap = new HashMap<>(); OvfHelper ovfHelper = new OvfHelper(); for (String ovf : ovfList) { try { if (ovfManager.IsOvfTemplate(ovf)) { VmTemplate vmTemplate = ovfHelper.readVmTemplateFromOvf(ovf); List<DiskImage> templateDisks = new ArrayList(vmTemplate.getDiskTemplateMap().values()); templateDisksMap.put(vmTemplate, templateDisks); } } catch (OvfReaderException ex) { auditLogOvfLoadError(ex.getName()); } } return templateDisksMap; }