auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Map<String, ?> getMappingSource(final MutableTable table) { if (table.getColumnByName(FIELD_ID) == null) { final MutableColumn idColumn = new MutableColumn(FIELD_ID, ColumnType.STRING).setTable(table).setPrimaryKey( true); table.addColumn(0, idColumn); } final Map<String, Map<String, String>> propertiesMap = new LinkedHashMap<>(); for (Column column : table.getColumns()) { final String columnName = column.getName(); if (FIELD_ID.equals(columnName)) { continue; } final String fieldName = getValidatedFieldName(columnName); final Map<String, String> propertyMap = new HashMap<>(); final String type = getType(column); propertyMap.put("type", type); propertiesMap.put(fieldName, propertyMap); } final Map<String, Map<String, Map<String, String>>> mapping = new HashMap<>(); <START> mapping.put("properties", propertiesMap); <END> return mapping; }</code><technical_language>This key ("properties") is multiple locations. a constant</technical_language>

Target:
public static Map<String, ?> getMappingSource(final MutableTable table) { if (table.getColumnByName(FIELD_ID) == null) { final MutableColumn idColumn = new MutableColumn(FIELD_ID, ColumnType.STRING).setTable(table).setPrimaryKey( true); table.addColumn(0, idColumn); } final Map<String, Map<String, String>> propertiesMap = new LinkedHashMap<>(); for (Column column : table.getColumns()) { final String columnName = column.getName(); if (FIELD_ID.equals(columnName)) { continue; } final String fieldName = getValidatedFieldName(columnName); final Map<String, String> propertyMap = new HashMap<>(); final String type = getType(column); propertyMap.put("type", type); propertiesMap.put(fieldName, propertyMap); } final Map<String, Map<String, Map<String, String>>> mapping = new HashMap<>(); mapping.put(ElasticSearchMetaData.PROPERTIES_KEY, propertiesMap); return mapping; }
Source:
<code>public MenuController(final MainController mainController, final MenuBar menuBar) { this.mainController = mainController; menuBar.setUseSystemMenuBar(true); menuBar.getMenus().add(createMenu("_File", createWorkspaceLoader("Select Workspace Folder", new KeyCodeCombination(KeyCode.O, KeyCombination.CONTROL_DOWN)), createMenuItem("Exit", event -> mainController.exitProgram()))); menuBar.getMenus().add(createMenu("_Navigate", createMenuItem("Previous", new KeyCodeCombination(KeyCode.ESCAPE), event -> mainController.previousView()), createMenuItem("Show Phylogenetic tree", <START> new KeyCodeCombination(KeyCode.Q, KeyCombination.CONTROL_DOWN), <END> event -> mainController.toggleNewick()), createGenomeGraphLoader("Load Genome Graph", new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN)))); menuBar.getMenus().add(createMenu("_Help", createMenuItem("Shortcuts", new KeyCodeCombination(KeyCode.F1), event -> mainController.toggleOverlay()))); }</code><technical_language>Please KeyCombination.SHORTCUT_DOWN works mac</technical_language>

Target:
public MenuController(final MainController mainController, final MenuBar menuBar) { this.mainController = mainController; this.menuBar = menuBar; initFileMenu(); initNavigateMenu(); initHelpMenu(); }
Source:
<code>private void setupMigrations(Sprinkles sprinkles) { sprinkles.addMigration(getInitialMigration()); <START> sprinkles.addMigration(getMigrationForVersion095()); <END> }</code><technical_language>call getMigrationToVersion0_9_6 upgrade version 0.9.6 version</technical_language>

Target:
private void setupMigrations(Sprinkles sprinkles) { sprinkles.addMigration(getInitialMigration()); sprinkles.addMigration(getMigrationToVersion_0_9_6()); }
Source:
<code>private String limiterKey(Request request) { String pathTemplate = request.header(OkhttpTraceInterceptor.PATH_TEMPLATE_HEADER); if (pathTemplate == null) { return FALLBACK; } else { <START> return request.url().host() + " " + request.method() + " " + pathTemplate; <END> } }</code><technical_language>I time key a proper object</technical_language>

Target:
private Key limiterKey(Request request) { String pathTemplate = request.header(OkhttpTraceInterceptor.PATH_TEMPLATE_HEADER); if (pathTemplate == null) { return ImmutableKey.builder().hostname(request.url().host()).build(); } else { return ImmutableKey.builder() .hostname(request.url().host()) .method(request.method()) .pathTemplate(pathTemplate) .build(); } }
Source:
<code>protected <T> Observable buildUseCaseObservable(final Map<String, T> parameters) { <START> if (parameters == null || !parameters.containsKey(KEY_SURVEY_GROUP_ID)) { <END> return Observable.error(new IllegalArgumentException("missing survey group id")); } if (!connectivityStateManager.isConnectionAvailable()) { return Observable.just(new SyncResult(SyncResult.ResultCode.ERROR_NO_NETWORK, 0)); } return userRepository.mobileSyncAllowed().concatMap(new Func1<Boolean, Observable<SyncResult>>() { @Override public Observable<SyncResult> call(Boolean syncAllowed) { if (!syncAllowed && !connectivityStateManager.isWifiConnected()) { return Observable.just(new SyncResult( SyncResult.ResultCode.ERROR_SYNC_NOT_ALLOWED_OVER_3G, 0)); } else { return syncDataPoints(parameters); } } }); }</code><technical_language>Do want update this key _and_ there</technical_language>

Target:
protected <T> Observable buildUseCaseObservable(final Map<String, T> parameters) { if (parameters == null || parameters.get(KEY_SURVEY_GROUP_ID) == null) { return Observable.error(new IllegalArgumentException("Missing survey group id")); } if (!connectivityStateManager.isConnectionAvailable()) { return Observable.just(new SyncResult(SyncResult.ResultCode.ERROR_NO_NETWORK, 0)); } return userRepository.mobileSyncAllowed().concatMap(new Func1<Boolean, Observable<SyncResult>>() { @Override public Observable<SyncResult> call(Boolean syncAllowed) { if (!syncAllowed && !connectivityStateManager.isWifiConnected()) { return Observable.just(new SyncResult( SyncResult.ResultCode.ERROR_SYNC_NOT_ALLOWED_OVER_3G, 0)); } else { return syncDataPoints(parameters); } } }); }
Source:
<code>public Map<Integer, Long> getCursors(String streamName) { assert(m_0 == null); Map<Integer, Long> result = new TreeMap<>(); <START> int blockOffset = m_slotManager.blockOffset(streamName); <END> for(Integer pid : m_slotManager.m_localPartitionIds.keySet()) { result.put(pid, m_lb.get(blockOffset)); blockOffset++; } return result; }</code><technical_language>want handle this stream in map a null check</technical_language>

Target:
public Map<Integer, Long> getCursors(String streamName) { assert(m_fileRef0 == null); Map<Integer, Long> result = new TreeMap<>(); Integer blockNum = m_slotMapper.streamNameToBlockNum(streamName); if (blockNum != null) { int blockOffset = m_slotMapper.blockOffset(blockNum) + 1; for(Integer pid : m_slotMapper.m_localPartitionIds.keySet()) { result.put(pid, m_lb.get(blockOffset)); blockOffset++; } } return result; }
Source:
<code>public void createAvailabilityMetric( @Suspended final AsyncResponse asyncResponse, @ApiParam(required = true) MetricDefinition metricDefinition, @Context UriInfo uriInfo ) { <START> if(metricDefinition.getType() != null && metricDefinition.getType() != MetricType.AVAILABILITY) { <END> asyncResponse.resume(badRequest(new ApiError("MetricDefinition type does not match " + MetricType .AVAILABILITY.getText()))); } URI location = uriInfo.getBaseUriBuilder().path("/availability/{id}").build(metricDefinition.getId()); Metric<AvailabilityType> metric = new Metric<>(new MetricId<>(tenantId, AVAILABILITY, metricDefinition.getId()), metricDefinition.getTags(), metricDefinition.getDataRetention()); metricsService.createMetric(metric).subscribe(new MetricCreatedObserver(asyncResponse, location)); }</code><technical_language>Replace if (AVAILABILITY != metricDefinition.getType()) {</technical_language>

Target:
public void createAvailabilityMetric( @Suspended final AsyncResponse asyncResponse, @ApiParam(required = true) MetricDefinition metricDefinition, @Context UriInfo uriInfo ) { if(metricDefinition.getType() != null && MetricType.AVAILABILITY != metricDefinition.getType()) { asyncResponse.resume(badRequest(new ApiError("MetricDefinition type does not match " + MetricType .AVAILABILITY.getText()))); } URI location = uriInfo.getBaseUriBuilder().path("/availability/{id}").build(metricDefinition.getId()); Metric<AvailabilityType> metric = new Metric<>(new MetricId<>(tenantId, AVAILABILITY, metricDefinition.getId()), metricDefinition.getTags(), metricDefinition.getDataRetention()); metricsService.createMetric(metric).subscribe(new MetricCreatedObserver(asyncResponse, location)); }
Source:
<code>public void StringUtilUnquote() throws Exception { <START> Assert.assertTrue(StringUtil.unquoteString("\"\n\"").equals("\n")); <END> Assert.assertTrue(StringUtil.unquoteString("\"\r\"").equals("\r")); Assert.assertTrue(StringUtil.unquoteString("\"\f\"").equals("\f")); Assert.assertTrue(StringUtil.unquoteString("\"\t\"").equals("\t")); Assert.assertTrue(StringUtil.unquoteString("\"\\x20\"").equals(" ")); Assert.assertTrue(StringUtil.unquoteString("\"\\u0020\"").equals(" ")); Assert.assertTrue(StringUtil.unquoteString("\"\\U00000020\"").equals(" ")); Assert.assertTrue(StringUtil.unquoteString("\"\\U00000020\"").equals(" ")); try { StringUtil.unquoteString("\"\\U00110000\""); throw new AssertionError(); } catch (IllegalArgumentException e) { } try { StringUtil.unquoteString("\"\\U0000d801\""); throw new AssertionError(); } catch (IllegalArgumentException e) { } }</code><technical_language>This test wanted, I think. "\"\n\""</technical_language>

Target:
public void StringUtilUnquote() throws Exception { Assert.assertTrue(StringUtil.unquoteString("\"\\n\"").equals("\n")); Assert.assertTrue(StringUtil.unquoteString("\"\\r\"").equals("\r")); Assert.assertTrue(StringUtil.unquoteString("\"\\f\"").equals("\f")); Assert.assertTrue(StringUtil.unquoteString("\"\\t\"").equals("\t")); Assert.assertTrue(StringUtil.unquoteString("\"\\x20\"").equals(" ")); Assert.assertTrue(StringUtil.unquoteString("\"\\u0020\"").equals(" ")); Assert.assertTrue(StringUtil.unquoteString("\"\\U00000020\"").equals(" ")); Assert.assertTrue(StringUtil.unquoteString("\"\\U00000020\"").equals(" ")); try { StringUtil.unquoteString("\"\\U00110000\""); throw new AssertionError(); } catch (IllegalArgumentException e) { } try { StringUtil.unquoteString("\"\\U0000d801\""); throw new AssertionError(); } catch (IllegalArgumentException e) { } }
Source:
<code>public boolean canUserEditTemplate(PipelineTemplateConfig template, CaseInsensitiveString username, List<Role> roles) { <START> return template.getAuthorization().getAdminsConfig().isAdmin(new AdminUser(username), roles); <END> }</code><technical_language>Try pushing methods getAuthorization().getViewConfig().isAdmin getAuthorization().getAdminsConfig().isAdmin Authorization class</technical_language>

Target:
public boolean canUserEditTemplate(PipelineTemplateConfig template, CaseInsensitiveString username, List<Role> roles) { return template.getAuthorization().isUserAnAdmin(username, roles); }
Source:
<code>public List<ElementEventsType> getElementEventTypes(final List<INetworkNodeInfo> networkNodeInfoList) { List<Future<ElementEventsType>> futureEvents = new ArrayList<>(); List<String> ids = new ArrayList<>(); networkNodeInfoList.forEach(networkNodeInfo -> { ids.add(networkNodeInfo.getId()); }); try { futureEvents.add(elementEventTypeDownloadService.getElementEventTypeAsync(ids)); } catch (QuadrigaException e1) { logger.error("An exception occured: " + e1); } List<ElementEventsType> elementEventsTypeList = new ArrayList<>(); for (Future<ElementEventsType> future : futureEvents) { ElementEventsType elementEventsType = null; try { elementEventsType = future.get(); logger.debug("Done with retrieving networks."); } catch (InterruptedException | ExecutionException e) { logger.error( "Unable to execute a qstore asynchronosly for relation event id: " + ids, e); } finally { <START> if(elementEventsType != null) <END> elementEventsTypeList.add(elementEventsType); } } return elementEventsTypeList; }</code><technical_language>code style</technical_language>

Target:
public List<ElementEventsType> getElementEventTypes(final List<INetworkNodeInfo> networkNodeInfoList) { List<Future<ElementEventsType>> futureEvents = new ArrayList<>(); List<String> ids = new ArrayList<>(); networkNodeInfoList.forEach(networkNodeInfo -> { ids.add(networkNodeInfo.getId()); }); try { futureEvents.add(elementEventTypeDownloadService.getElementEventTypeAsync(ids)); } catch (QuadrigaException e1) { logger.error("An exception occured: " + e1); } List<ElementEventsType> elementEventsTypeList = new ArrayList<>(); for (Future<ElementEventsType> future : futureEvents) { ElementEventsType elementEventsType = null; try { elementEventsType = future.get(); logger.debug("Done with retrieving networks."); } catch (InterruptedException | ExecutionException e) { logger.error( "Unable to execute a qstore asynchronosly for relation event id: " + ids, e); } finally { if(elementEventsType != null){ elementEventsTypeList.add(elementEventsType); } } } return elementEventsTypeList; }
Source:
<code>public SearchStringCollector(EventBus eventBus) { eventBus.addHandler(ApplySearchStringEvent.getType(), event -> { String searchString = event.getSearchString(); <START> int colonIndex = searchString.indexOf(':'); <END> if (!activePresenters.contains(searchString.substring(0, colonIndex + 1))) { searchStringMap.put(searchString.substring(0, colonIndex + 1), searchString); } }); }</code><technical_language>safe side, check if colonIndex is >= 0</technical_language>

Target:
public SearchStringCollector(EventBus eventBus) { eventBus.addHandler(ApplySearchStringEvent.getType(), event -> { String searchString = event.getSearchString(); int colonIndex = searchString.indexOf(':'); if (colonIndex >= 0) { String defaultSearchString = searchString.substring(0, colonIndex + 1); if (!activePresenters.contains(defaultSearchString)) { searchStringMap.put(defaultSearchString, searchString); } } }); }
Source:
<code>public abstract Object execute(ExecutionEvent event) throws ExecutionException; public IServer getServer(IModule module) { IServer toRepublish = null; if( module != null ) { IServer[] servers = ServerCore.getServers(); ArrayList<IServer> matched = new ArrayList<IServer>(); for( int i = 0; i < servers.length; i++ ) { boolean found = false; IModule[] deployed = servers[i].getModules(); for( int j = 0; j < deployed.length && !found; j++ ) if( deployed[j].getId().equals(module.getId())) found = true; if( found ) matched.add(servers[i]); } if( matched.size() == 0 || matched.size() > 1 ) { <START> toRepublish = matched.get(0); <END> } else toRepublish = matched.get(0); } return toRepublish; }</code><technical_language>huh? something's wrong</technical_language>

Target:
public abstract Object execute(ExecutionEvent event) throws ExecutionException; protected IModule getModule(IResource resource) { if (resource != null) { ArrayList<IModule> possibleModules = new ArrayList<IModule>(); IModuleArtifact[] moduleArtifacts = ServerPlugin.getModuleArtifacts(resource); if (moduleArtifacts != null && moduleArtifacts.length > 0) { for( int i = 0; i < moduleArtifacts.length; i++ ) { if( moduleArtifacts[i].getModule() != null && !possibleModules.contains(moduleArtifacts[i].getModule())) { possibleModules.add(moduleArtifacts[i].getModule()); } } } return promptForModule(possibleModules); } return null; }
Source:
<code>public void testRenameProcessVariableForInitColumns(){ TaskListViewImpl taskListView = view; GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test",taskListView.getInitColumns(),taskListView.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("Id",-1,"")); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("performance",-1,"")); taskListView.initCellPreview(extendedPagedTable); final Column<TaskSummary, String> createdOnColumn = taskListView.createTextColumn(COLUMN_CREATED_ON, task -> DateUtils.getDateTimeStr(task.getCreatedOn())); ColumnMeta<TaskSummary> actionsColumnMeta = taskListView.initActionsColumn(); extendedPagedTable.addSelectionIgnoreColumn(actionsColumnMeta.getColumn()); List<ColumnMeta<TaskSummary>> columnMetas = taskListView.getGeneralColumnMetas(extendedPagedTable, createdOnColumn, actionsColumnMeta); <START> assertEquals(15,columnMetas.size()); <END> assertEquals(0,columnMetas.stream().filter(column -> column.getCaption().equals("Var_Id")) .collect(Collectors.toList()).size()); List<ColumnMeta<TaskSummary>> tmp = taskListView.renameProcessVariables(extendedPagedTable, columnMetas); columnMetas.addAll(tmp); assertEquals(17,columnMetas.size()); assertEquals(1, columnMetas.stream() .filter(column -> column.getCaption().equals("Var_Id")) .collect(Collectors.toList()).size()); }</code><technical_language>@bxf12315 above, please assertThat AssertJ library</technical_language>

Target:
public void testRenameProcessVariableForInitColumns(){ GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test",view.getInitColumns(),view.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); List<GridColumnPreference> gridColumnPreferenceList = extendedPagedTable.getGridPreferencesStore().getColumnPreferences(); gridColumnPreferenceList.add(new GridColumnPreference("Id",-1,"")); gridColumnPreferenceList.add(new GridColumnPreference("performance",-1,"")); view.initCellPreview(extendedPagedTable); final Column<TaskSummary, String> createdOnColumn = view.createTextColumn(COLUMN_CREATED_ON, task -> DateUtils.getDateTimeStr(task.getCreatedOn())); ColumnMeta<TaskSummary> actionsColumnMeta = view.initActionsColumn(); extendedPagedTable.addSelectionIgnoreColumn(actionsColumnMeta.getColumn()); List<ColumnMeta<TaskSummary>> columnMetas = view.getGeneralColumnMetas(extendedPagedTable, createdOnColumn, actionsColumnMeta); assertThat(columnMetas.stream()).extracting(c -> c.getCaption()).hasSize(15).doesNotContain("Var_Id"); List<ColumnMeta<TaskSummary>> tmp = view.renameVariables(extendedPagedTable, columnMetas); columnMetas.addAll(tmp); assertThat(columnMetas.stream()).extracting(c -> c.getCaption()).hasSize(17).containsOnlyOnce("Var_Id"); }
Source:
<code>public KieServerRouter() { configRepositoryServiceLoader.forEach(repo -> repository = repo); log.info("KIE Server router repository implementation is " + repository); <START> MANAGEMENT_SECURED = Boolean.parseBoolean(System.getProperty(KIE_ROUTER_MANAGEMENT_SECURED, "false")); <END> IDENTITY_PROVIDER = System.getProperty(KieServerRouterConstants.KIE_ROUTER_IDENTITY_PROVIDER, "default"); }</code><technical_language>Is a specific reason initialization of attributes in constructor other constants</technical_language>

Target:
public KieServerRouter() { this(MANAGEMENT_SECURED, IDENTITY_PROVIDER); }
Source:
<code>public void testDoesNotCallbackWhenHeartbeatAlive() throws InterruptedException { ContainerHeartbeatClient client = mock(ContainerHeartbeatClient.class); CountDownLatch countDownLatch = new CountDownLatch(1); Runnable onExpired = countDownLatch::countDown; ContainerHeartbeatResponse response = new ContainerHeartbeatResponse(true); when(client.requestHeartbeat()).thenReturn(response); ScheduledExecutorService scheduler = buildScheduledExecutorService(); ContainerHeartbeatMonitor monitor = new ContainerHeartbeatMonitor(onExpired, client, scheduler); monitor.start(); <START> boolean success = countDownLatch.await(2, TimeUnit.SECONDS); <END> assertFalse(success); assertEquals(1, countDownLatch.getCount()); verify(scheduler, never()).schedule(any(Runnable.class), anyLong(), any()); monitor.stop(); verify(scheduler).shutdown(); }</code><technical_language>I author of tests. But, do need wait for 2 seconds for this test? verifying scheduler for task submissions sufficient</technical_language>

Target:
public void testDoesNotCallbackWhenHeartbeatAlive() throws InterruptedException { ContainerHeartbeatResponse response = new ContainerHeartbeatResponse(true); when(this.containerHeartbeatClient.requestHeartbeat()).thenReturn(response); this.containerHeartbeatMonitor.start(); boolean fixedRateTaskCompleted = this.schedulerFixedRateExecutionLatch.await(2, TimeUnit.SECONDS); assertTrue("Did not complete heartbeat check", fixedRateTaskCompleted); verify(this.scheduler, never()).schedule(any(Runnable.class), anyLong(), any()); verify(this.onExpired, never()).run(); this.containerHeartbeatMonitor.stop(); verify(this.scheduler).shutdown(); }
Source:
<code>public boolean afterLRANotification() { boolean notifiedAll = true; if (afterLRAListeners != null) { Client client = ClientBuilder.newClient(); try { Iterator<AfterLRAListener> listeners = afterLRAListeners.iterator(); while (listeners.hasNext()) { AfterLRAListener participant = listeners.next(); Response response = null; try { Future<Response> asyncResponse = client.target(participant.notificationURI) .request() .header(LRA.LRA_HTTP_ENDED_CONTEXT_HEADER, id) .header(LRA_HTTP_RECOVERY_HEADER, participant.recoveryId.toASCIIString()) .async() .put(Entity.text(status.name())); response = asyncResponse.get(PARTICIPANT_TIMEOUT, TimeUnit.SECONDS); <START> if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { <END> listeners.remove(); } else { notifiedAll = false; } response = null; } catch (WebApplicationException | InterruptedException | ExecutionException | TimeoutException e) { notifiedAll = false; if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("Could not notify AfterLRA listener at %s (%s)", participant.notificationURI, e.getMessage()); } } finally { if (response != null) { response.close(); } } } } finally { client.close(); } } return notifiedAll; }</code><technical_language>spec requires a 200 OK response</technical_language>

Target:
public boolean afterLRANotification() { boolean notifiedAll = true; if (afterLRAListeners != null) { Client client = ClientBuilder.newClient(); try { Iterator<AfterLRAListener> listeners = afterLRAListeners.iterator(); while (listeners.hasNext()) { AfterLRAListener participant = listeners.next(); Response response = null; try { Future<Response> asyncResponse = client.target(participant.notificationURI) .request() .header(LRA.LRA_HTTP_ENDED_CONTEXT_HEADER, id) .header(LRA_HTTP_RECOVERY_HEADER, participant.recoveryId.toASCIIString()) .async() .put(Entity.text(status.name())); response = asyncResponse.get(PARTICIPANT_TIMEOUT, TimeUnit.SECONDS); if (response.getStatus() == 200) { listeners.remove(); } else { notifiedAll = false; } response = null; } catch (WebApplicationException | InterruptedException | ExecutionException | TimeoutException e) { notifiedAll = false; if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("Could not notify AfterLRA listener at %s (%s)", participant.notificationURI, e.getMessage()); } } finally { if (response != null) { response.close(); } } } } finally { client.close(); } } return notifiedAll; }
Source:
<code>protected Boolean doCall() { LOGGER.info("Waiting for network interfaces to be detached: {}", attachedNetworkInterfaces); <START> PagedList<NetworkInterface> networkInterfaces = context.getAzureClient().getNetworkInterfaces(context.getResourceGroupName()); networkInterfaces.loadAll(); List<NetworkInterface> filteredNetworkInterfaces = networkInterfaces .stream() .filter(networkInterface -> attachedNetworkInterfaces .contains(networkInterface.name())) .collect(Collectors.toList()); <END> attachedNetworkInterfaces = filteredNetworkInterfaces .stream() .filter(ni -> ni.virtualMachineId() != null) .map(NetworkInterface::name) .collect(Collectors.toSet()); return attachedNetworkInterfaces.isEmpty(); }</code><technical_language>This part AzureUtils AzureClient findNetworkInterfacesByName</technical_language>

Target:
protected Boolean doCall() { LOGGER.info("Waiting for network interfaces to be detached: {}", attachedNetworkInterfaces); AzureClient azureClient = context.getAzureClient(); String resourceGroupName = context.getResourceGroupName(); List<NetworkInterface> filteredNetworkInterfaces = azureClient.getNetworkInterfaceListByNames(resourceGroupName, attachedNetworkInterfaces); attachedNetworkInterfaces = filteredNetworkInterfaces .stream() .filter(ni -> ni.virtualMachineId() != null) .map(NetworkInterface::name) .collect(Collectors.toSet()); return attachedNetworkInterfaces.isEmpty(); }
Source:
<code>protected Statement classBlock(final RunNotifier notifier) { Statement statement = childrenInvoker(notifier); <START> if (areAllChildrenIgnored() == false) { <END> statement = withBeforeClasses(statement); statement = withAfterClasses(statement); statement = withClassRules(statement); } return statement; }</code><technical_language>if (!areAllChildrenIgnored()) {</technical_language>

Target:
protected Statement classBlock(final RunNotifier notifier) { Statement statement = childrenInvoker(notifier); if (!areAllChildrenIgnored()) { statement = withBeforeClasses(statement); statement = withAfterClasses(statement); statement = withClassRules(statement); } return statement; }
Source:
<code>public CloseableIteration<? extends Entry<RyaStatement, BindingSet>, RyaDAOException> queryWithBindingSet( final Collection<Entry<RyaStatement, BindingSet>> stmts, MongoDBRdfConfiguration conf) throws RyaDAOException { <START> if (conf == null) { <END> conf = configuration; } final Multimap<RyaStatement, BindingSet> rangeMap = HashMultimap.create(); try { for (final Map.Entry<RyaStatement, BindingSet> stmtbs : stmts) { final RyaStatement stmt = stmtbs.getKey(); final BindingSet bs = stmtbs.getValue(); rangeMap.put(stmt, bs); } final RyaStatementBindingSetCursorIterator iterator = new RyaStatementBindingSetCursorIterator( getCollection(conf), rangeMap, strategy, conf.getAuthorizations()); return iterator; } catch (final Exception e) { throw new RyaDAOException(e); } }</code><technical_language>Check stmts is null</technical_language>

Target:
public CloseableIteration<? extends Entry<RyaStatement, BindingSet>, RyaDAOException> queryWithBindingSet( final Collection<Entry<RyaStatement, BindingSet>> stmts, MongoDBRdfConfiguration conf) throws RyaDAOException { Preconditions.checkNotNull(stmts); Preconditions.checkNotNull(conf); final Multimap<RyaStatement, BindingSet> rangeMap = HashMultimap.create(); try { for (final Map.Entry<RyaStatement, BindingSet> stmtbs : stmts) { final RyaStatement stmt = stmtbs.getKey(); final BindingSet bs = stmtbs.getValue(); rangeMap.put(stmt, bs); } final RyaStatementBindingSetCursorIterator iterator = new RyaStatementBindingSetCursorIterator( getCollection(conf), rangeMap, strategy, conf.getAuthorizations()); return iterator; } catch (final Exception e) { throw new RyaDAOException(e); } }
Source:
<code>public synchronized <V> Map<K, V> getNextTrainingData() { if (trainingDataKeySet.isEmpty()) { return Collections.emptyMap(); } final Iterator<K> iterator = trainingDataKeySet.iterator(); final List<K> nextTrainingDataKeyList = new ArrayList<>(); while (iterator.hasNext() && nextTrainingDataKeyList.size() < miniBatchSize) { nextTrainingDataKeyList.add(iterator.next()); } trainingDataKeySet.removeAll(nextTrainingDataKeyList); final Map<K, V> nextTrainingData = new HashMap<>(); for (final K key : nextTrainingDataKeyList) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingData.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } <START> LOG.log(Level.INFO, "next training data size = " + nextTrainingData.size()); <END> return nextTrainingData; }</code><technical_language>certain, want double check nextTrainingDataKeyList.size() nextTrainingData.size() identical this log</technical_language>

Target:
public <V> Map<K, V> getNextTrainingData() { final List<K> nextTrainingDataKeyList = new ArrayList<>(miniBatchSize); synchronized (this) { if (trainingDataKeySet.isEmpty()) { LOG.log(Level.INFO, "no more training data for current epoch"); return Collections.emptyMap(); } final Iterator<K> iterator = trainingDataKeySet.iterator(); while (iterator.hasNext() && nextTrainingDataKeyList.size() < miniBatchSize) { nextTrainingDataKeyList.add(iterator.next()); } trainingDataKeySet.removeAll(nextTrainingDataKeyList); } final Map<K, V> nextTrainingData = new HashMap<>(); for (final K key : nextTrainingDataKeyList) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingData.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } LOG.log(Level.INFO, "Size of training data for next mini-batch: {0}", nextTrainingData.size()); if (nextTrainingDataKeyList.size() != nextTrainingData.size()) { LOG.log(Level.INFO, "The number of assigned data keys for next mini-batch is {0}," + " but ths size of actually prepared training data is {1}", new Object[]{nextTrainingDataKeyList.size(), nextTrainingData.size()}); } return nextTrainingData; }
Source:
<code>public Map<Integer, EmulatedMachine> getOsEmulatedMachines() { Map<Integer, EmulatedMachine> <START> emList = <END> new HashMap<>(); for (int osId : getOsIds()) { String emValue = getValueByVersion(idToUnameLookup.get(osId), "emulatedMachine", null); if (emValue != null) { try { EmulatedMachine em = EmulatedMachine.valueOf(emValue); if (em != null) { emList.put(osId, em); } } catch (Exception ex) { log.error("osinfo: unknow Emulated Machine value {}", emValue); } } } return emList; }</code><technical_language>of is a map, a list :) - I more names like: osIdToEmulatedMachine - need is a list map, holds</technical_language>

Target:
public Map<Integer, EmulatedMachine> getOsEmulatedMachines() { Map<Integer, EmulatedMachine> osIdToEmulatedMachine = new HashMap<>(); for (int osId : getOsIds()) { String emValue = getValueByVersion(idToUnameLookup.get(osId), "emulatedMachine", null); if (emValue != null) { try { EmulatedMachine em = EmulatedMachine.valueOf(emValue); if (em != null) { osIdToEmulatedMachine.put(osId, em); } } catch (Exception ex) { log.error("osinfo: unknow Emulated Machine value {}", emValue); } } } return osIdToEmulatedMachine; }
Source:
<code>public void mergeProjectsValidNameTests() { openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext()); onView(withText(R.string.merge)).perform(click()); onRecyclerView().atPosition(0) .performCheckItem(); onRecyclerView().atPosition(1) .performCheckItem(); onView(withId(R.id.confirm)).perform(click()); onView(allOf(withText(""), isDisplayed(), instanceOf(EditText.class))) .perform(replaceText(validName)); <START> closeSoftKeyboard(); <END> onView(Matchers.allOf(withId(android.R.id.button1), withText(R.string.ok))) .check(matches(Matchers.allOf(isDisplayed(), isEnabled()))); }</code><technical_language>this "closeSoftKeyboard()" is anything, wrong import. android.support.test.espresso.action.ViewActions.closeSoftKeyboard, is a ViewAction, done in a perform. if state outside, create a new ViewAction object it. correct for this be: android.support.test.espresso.Espresso.closeSoftKeyboard, is a standalone action "pressBack()". either: import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard; ... .perform(replaceText(validName), closeSoftKeyboard()); or: import static android.support.test.espresso.Espresso.closeSoftKeyboard; ... closeSoftKeyboard();</technical_language>

Target:
public void mergeProjectsValidNameTests() { openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext()); onView(withText(R.string.merge)).perform(click()); onRecyclerView().atPosition(0) .performCheckItem(); onRecyclerView().atPosition(1) .performCheckItem(); onView(withId(R.id.confirm)).perform(click()); onView(allOf(withText(""), isDisplayed(), instanceOf(EditText.class))) .perform(replaceText(VALIDNAME)); closeSoftKeyboard(); onView(allOf(withId(android.R.id.button1), withText(R.string.ok))) .check(matches(Matchers.allOf(isDisplayed(), isEnabled()))); }
Source:
<code>protected <T extends Descriptor> T merge(Collection<T> descriptors) { T descriptor = null; for (T d : descriptors) { if (d.remove()) { descriptor = null; continue; } <START> descriptor = descriptor == null ? d : (T) descriptor.merge(d); <END> } return descriptor; }</code><technical_language>descriptor.merge(d) modify descriptor, cloned first, modifying data in original collection of descriptors. need a clone mechanism... I making Descriptor implement Cloneable is a good way</technical_language>

Target:
protected <T extends Descriptor> T merge(Collection<T> descriptors) { T descriptor = null; for (T d : descriptors) { if (d.doesRemove()) { descriptor = null; } else { descriptor = descriptor == null ? d : (T) descriptor.merge(d); } } return descriptor; }
Source:
<code>private ReplicationPeerImpl createPeer(String peerId) throws ReplicationException { ReplicationPeerConfig peerConfig = peerStorage.getPeerConfig(peerId); boolean enabled = peerStorage.isPeerEnabled(peerId); SyncReplicationState syncReplicationState = peerStorage.getPeerSyncReplicationState(peerId); SyncReplicationState newSyncReplicationState = peerStorage.getPeerNewSyncReplicationState(peerId); ReplicationPeerConfig updatedPeerConfig = ReplicationPeerConfigUtil. addBasePeerConfigsIfNotPresent(this.conf, peerConfig); <START> peerStorage.updatePeerConfig(peerId,updatedPeerConfig); <END> return new ReplicationPeerImpl(ReplicationUtils.getPeerClusterConfiguration(peerConfig, conf), peerId, updatedPeerConfig, enabled, syncReplicationState, newSyncReplicationState); }</code><technical_language>I thinking this in master code paths. Ex: ReplicationPeerManager#create (for existing peers) addPeer() for new peers etc. configuration in storage remains consistent. RS code paths (ReplicationPeers) means if RS run configs result in a final state (depending RS this RPC last). this HMaster logical this is more admin operation RS based codepaths consumers of this config</technical_language>

Target:
private ReplicationPeerImpl createPeer(String peerId) throws ReplicationException { ReplicationPeerConfig peerConfig = peerStorage.getPeerConfig(peerId); boolean enabled = peerStorage.isPeerEnabled(peerId); SyncReplicationState syncReplicationState = peerStorage.getPeerSyncReplicationState(peerId); SyncReplicationState newSyncReplicationState = peerStorage.getPeerNewSyncReplicationState(peerId); return new ReplicationPeerImpl(ReplicationUtils.getPeerClusterConfiguration(peerConfig, conf), peerId, peerConfig, enabled, syncReplicationState, newSyncReplicationState); }
Source:
<code>private void disconnectSession() { if (mSession == null) { return; } if (mSubscribers.size() > 0) { for (Subscriber subscriber : mSubscribers) { if (subscriber != null) { mSession.unsubscribe(subscriber); subscriber.destroy(); } } } <START> if (mPublisher != null) { <END> mSession.unpublish(mPublisher); mPublisher.destroy(); mPublisher = null; } mSession.disconnect(); }</code><technical_language>remove publisher's view disconnecting</technical_language>

Target:
private void disconnectSession() { if (mSession == null) { return; } if (mSubscribers.size() > 0) { for (Subscriber subscriber : mSubscribers) { if (subscriber != null) { mSession.unsubscribe(subscriber); subscriber.destroy(); } } } if (mPublisher != null) { mSession.unpublish(mPublisher); mContainer.removeView(mPublisher.getView()); mPublisher.destroy(); mPublisher = null; } mSession.disconnect(); }
Source:
<code>public TaskLogAutoCleanerConfig( @JsonProperty("enabled") boolean enabled, @JsonProperty("initialDelay") Long initialDelay, @JsonProperty("delay") Long delay, @JsonProperty("durationToRetain") Long durationToRetain ){ if (enabled) { Preconditions.checkNotNull(durationToRetain, "durationToRetain must be provided."); } this.enabled = enabled; this.initialDelay = initialDelay == null ? 60000 + new Random().nextInt(4*60000) : initialDelay.longValue(); <START> this.delay = delay == null ? 6*60*60*1000 : delay.longValue(); <END> this.durationToRetain = durationToRetain == null ? Long.MAX_VALUE : durationToRetain.longValue(); }</code><technical_language>Suggest sanity check for positive number</technical_language>

Target:
public TaskLogAutoCleanerConfig( @JsonProperty("enabled") boolean enabled, @JsonProperty("initialDelay") Long initialDelay, @JsonProperty("delay") Long delay, @JsonProperty("durationToRetain") Long durationToRetain ){ if (enabled) { Preconditions.checkNotNull(durationToRetain, "durationToRetain must be provided."); } this.enabled = enabled; this.initialDelay = initialDelay == null ? 60000 + new Random().nextInt(4*60000) : initialDelay.longValue(); this.delay = delay == null ? 6*60*60*1000 : delay.longValue(); this.durationToRetain = durationToRetain == null ? Long.MAX_VALUE : durationToRetain.longValue(); Preconditions.checkArgument(this.initialDelay > 0, "initialDelay must be > 0."); Preconditions.checkArgument(this.delay > 0, "delay must be > 0."); Preconditions.checkArgument(this.durationToRetain > 0, "durationToRetain must be > 0."); }
Source:
<code>private void initApprovalType(final PatchSetPublishDetail r, final Panel body, final ApprovalType ct, final PermissionRange range) { body.add(new SmallHeading(ct.getCategory().getName() + ":")); final VerticalPanel vp = new VerticalPanel(); vp.setStyleName(Gerrit.RESOURCES.css().approvalCategoryList()); final List<ApprovalCategoryValue> lst = new ArrayList<ApprovalCategoryValue>(ct.getValues()); Collections.reverse(lst); final ApprovalCategory.Id catId = ct.getCategory().getId(); final PatchSetApproval prior = r.getChangeApproval(catId); for (final ApprovalCategoryValue buttonValue : lst) { if (!range.contains(buttonValue.getValue())) { continue; } final ValueRadioButton b = new ValueRadioButton(buttonValue, ct.getCategory().getName()); <START> b.setHTML(buttonValue.format()); <END> if (lastState != null && patchSetId.equals(lastState.patchSetId) && lastState.approvals.containsKey(buttonValue.getCategoryId())) { b.setValue(lastState.approvals.get(buttonValue.getCategoryId()).equals( buttonValue)); } else { b.setValue(prior != null ? buttonValue.getValue() == prior.getValue() : buttonValue.getValue() == 0); } approvalButtons.add(b); vp.add(b); } body.add(vp); }</code><technical_language>values assigned admin safe raw HTML, I a worried this change. If admin text of "Code < Ideal" "OK&Valid" in a this render correctly anymore, in past. fine, crazy values this. A small mention in release notes sufficient</technical_language>

Target:
private void initApprovalType(final PatchSetPublishDetail r, final Panel body, final ApprovalType ct, final PermissionRange range) { body.add(new SmallHeading(ct.getCategory().getName() + ":")); final VerticalPanel vp = new VerticalPanel(); vp.setStyleName(Gerrit.RESOURCES.css().approvalCategoryList()); final List<ApprovalCategoryValue> lst = new ArrayList<ApprovalCategoryValue>(ct.getValues()); Collections.reverse(lst); final ApprovalCategory.Id catId = ct.getCategory().getId(); final PatchSetApproval prior = r.getChangeApproval(catId); for (final ApprovalCategoryValue buttonValue : lst) { if (!range.contains(buttonValue.getValue())) { continue; } ValueRadioButton b = new ValueRadioButton(ct.getCategory(), buttonValue); SafeHtml buf = new SafeHtmlBuilder().append(buttonValue.format()); buf = CommentLinkProcessor.apply(buf); SafeHtml.set(b, buf); if (lastState != null && patchSetId.equals(lastState.patchSetId) && lastState.approvals.containsKey(buttonValue.getCategoryId())) { b.setValue(lastState.approvals.get(buttonValue.getCategoryId()).equals( buttonValue)); } else { b.setValue(prior != null ? buttonValue.getValue() == prior.getValue() : buttonValue.getValue() == 0); } approvalButtons.add(b); vp.add(b); } body.add(vp); }
Source:
<code>ExtractEdge() throws NoCurrentCaseException{ <START> moduleName = NbBundle.getMessage(Chrome.class, "ExtractEdge.moduleName"); <END> moduleTempResultsDir = RAImageIngestModule.getRATempPath(Case.getCurrentCaseThrows(), EDGE) + File.separator + "results"; }</code><technical_language>I this of a protected field in a super class is written classes is new. A funny is I do callers of getter other classes - this breach of encapsulation currently appreciable in opinion. out of scope fix general problem perpetuate undesirable of protected fields in this new code. Please a private final field for module name call Bundle accessor need module name</technical_language>

Target:
ExtractEdge() throws NoCurrentCaseException { moduleTempResultPath = Paths.get(RAImageIngestModule.getRATempPath(Case.getCurrentCaseThrows(), EDGE), "results"); }
Source:
<code>public double getY() { double speed; try { speed = motionController.getSafely(); } catch (InvalidSensorException e) { LogKitten.w("Cancelling ChassisMoveDistance"); chassisMove.cancel(); cancel(); if (fallbackCommand != null) { <START> fallbackCommand.initialize(); <END> } speed = 0; } LogKitten.d("MotionProfileSpeed: " + speed); return speed; }</code><technical_language>this schedule() initialize()</technical_language>

Target:
public double getY() { double speed; try { speed = motionController.getSafely(); } catch (InvalidSensorException e) { LogKitten.w("Cancelling ChassisMoveDistance with InvalidSensorException"); chassisMove.cancel(); cancel(); if (fallbackCommand != null) { fallbackCommand.schedule(); } speed = 0; } LogKitten.d("MotionProfileSpeed: " + speed); return speed; }
Source:
<code>protected void ensurePagesListCapacity(long size) { int capacity = pageIndex(size) + 1; if (capacity > maxPages) { <START> throw LimitOverflowException.instance().put("Maximum number of pages (").put(maxPages).put(") breached in VirtualMemory"); <END> } pages.ensureCapacity(capacity); }</code><technical_language>this introduces file handle leak in ReadWriteMemory</technical_language>

Target:
protected void ensurePagesListCapacity(long size) { int capacity = pageIndex(size) + 1; pages.ensureCapacity(capacity); }
Source:
<code>public void verifyBuilder() { final RollingOperation.Builder builder = RollingOperation.newBuilder(); final String setDeploymentGroupName = "foo-group"; final List<HostSelector> setHostSelectors = ImmutableList.of(HostSelector.parse("foo=bar"), HostSelector.parse("baz=qux")); final JobId setJobId = JobId.fromString("foo:0.1.0"); final RolloutOptions setRolloutOptions = RolloutOptions.newBuilder() .setTimeout(1000) .setParallelism(2) .setMigrate(false) <START> .build(); <END> final RollingOperation.Reason setReason = RollingOperation.Reason.MANUAL; builder.setDeploymentGroupName(setDeploymentGroupName); builder.setJobId(setJobId); builder.setRolloutOptions(setRolloutOptions); builder.setReason(setReason); assertEquals("name", setDeploymentGroupName, builder.getDeploymentGroupName()); assertEquals("jobId", setJobId, builder.getJobId()); assertEquals("rolloutOptions", setRolloutOptions, builder.getRolloutOptions()); assertEquals("reason", setReason, builder.getReason()); final RollingOperation deploymentGroup = builder.build(); assertEquals("name", setDeploymentGroupName, deploymentGroup.getDeploymentGroupName()); assertEquals("jobId", setJobId, deploymentGroup.getJobId()); assertEquals("rolloutOptions", setRolloutOptions, deploymentGroup.getRolloutOptions()); assertEquals("reason", setReason, deploymentGroup.getReason()); }</code><technical_language>test overlap token well</technical_language>

Target:
public void verifyBuilder() { final RollingOperation.Builder builder = RollingOperation.newBuilder(); final String setDeploymentGroupName = "foo-group"; final JobId setJobId = JobId.fromString("foo:0.1.0"); final RolloutOptions setRolloutOptions = RolloutOptions.newBuilder() .setTimeout(1000) .setParallelism(2) .setMigrate(false) .build(); final RollingOperation.Reason setReason = RollingOperation.Reason.MANUAL; builder.setDeploymentGroupName(setDeploymentGroupName); builder.setJobId(setJobId); builder.setRolloutOptions(setRolloutOptions); builder.setReason(setReason); assertEquals("name", setDeploymentGroupName, builder.getDeploymentGroupName()); assertEquals("jobId", setJobId, builder.getJobId()); assertEquals("rolloutOptions", setRolloutOptions, builder.getRolloutOptions()); assertEquals("reason", setReason, builder.getReason()); final RollingOperation deploymentGroup = builder.build(); assertEquals("name", setDeploymentGroupName, deploymentGroup.getDeploymentGroupName()); assertEquals("jobId", setJobId, deploymentGroup.getJobId()); assertEquals("rolloutOptions", setRolloutOptions, deploymentGroup.getRolloutOptions()); assertEquals("reason", setReason, deploymentGroup.getReason()); }
Source:
<code>void validateValueParameter(String name, Object value) { Class<? extends IValueValidator> validators[] = wrappedParameter.validateValueWith(); <START> if (validators != null && validators.length>0) { <END> for(final Class<? extends IValueValidator> validator: validators) { validateValueParameter(validator, name, value); } } }</code><technical_language>Spaces</technical_language>

Target:
void validateValueParameter(String name, Object value) { final Class<? extends IValueValidator> validators[] = wrappedParameter.validateValueWith(); if (validators != null && validators.length > 0) { for(final Class<? extends IValueValidator> validator: validators) { validateValueParameter(validator, name, value); } } }
Source:
<code>public Tracer getTracer() { Object tracerObject = servletContext.getAttribute(TracerInitializer.SMALLRYE_OPENTRACING_TRACER); <START> TracingLogger.ROOT_LOGGER.warnf("Producing tracer from ServletContext, using %s", tracerObject); <END> if (tracerObject instanceof Tracer) { return (Tracer) tracerObject; } return null; }</code><technical_language>tracef</technical_language>

Target:
public Tracer getTracer() { Object tracerObject = servletContext.getAttribute(TracerInitializer.SMALLRYE_OPENTRACING_TRACER); TracingLogger.ROOT_LOGGER.producingTracer(tracerObject); if (tracerObject instanceof Tracer) { return (Tracer) tracerObject; } return null; }
Source:
<code>private boolean isUnused(ImportPackageObject pkg, Collection<?> exportedPackages, IProgressMonitor monitor) { if (exportedPackages != null && exportedPackages.contains(pkg.getValue())) { <START> monitor.done(); <END> return false; } return !provideJavaClasses(pkg, monitor); }</code><technical_language>Unnecessary</technical_language>

Target:
private boolean isUnused(ImportPackageObject pkg, Collection<?> exportedPackages, IProgressMonitor monitor) { if (exportedPackages != null && exportedPackages.contains(pkg.getValue())) { return false; } return !provideJavaClasses(pkg, monitor); }
Source:
<code>private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); <START> while (true) { <END> try { XmlUtils.nextElement(parser); } catch (XmlPullParserException e) { Log.e(TAG, "Got parser execption while getting next element", e); continue; } catch (Exception e) { Log.e(TAG, "Got execption while getting next element", e); continue; } ContentValues row = getRow(parser); if (row != null) { insertAddingDefaults(db, CARRIERS_TABLE, row); } else { break; } } db.setTransactionSuccessful(); } catch (SQLException e){ Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }</code><technical_language>other patches, do want change this implement "fail fast" code above</technical_language>

Target:
private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); while (parser.getEventType() != XmlPullParser.END_DOCUMENT) { try { XmlUtils.nextElement(parser); } catch (XmlPullParserException e) { Log.e(TAG, "Got parser execption while getting next element", e); continue; } ContentValues row = getRow(parser); if (row == null) { continue; } insertAddingDefaults(db, CARRIERS_TABLE, row); } db.setTransactionSuccessful(); } catch (XmlPullParserException e) { Log.e(TAG, "Got XmlPullParserException while loading apns.", e); } catch (IOException e) { Log.e(TAG, "Got IOException while loading apns.", e); } catch (SQLException e) { Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }