auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setUp() { TestUtils.setUpOcBinary(); TestUtils.cleanupGitFolder("nodejs-ex"); OpenShiftExplorerView explorer = new OpenShiftExplorerView(); explorer.open(); this.connection = explorer.getOpenShift3Connection(requiredConnection.getConnection()); this.project = connection.getProject(requiredProject.getProjectName()); this.project.expand(); this.project.getService(OpenShiftResources.NODEJS_SERVICE).select(); new ContextMenu(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select(); new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION); new FinishButton().click(); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION)); explorer.activate(); this.project.getService(OpenShiftResources.NODEJS_SERVICE).select(); new ContextMenu(OpenShiftLabel.ContextMenu.NEW_ADAPTER_FROM_EXPLORER).select(); new DefaultShell(OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS); new FinishButton().click(); <START> new WaitWhile(new ShellWithTextIsAvailable(""), TimePeriod.LONG); <END> new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE).test()); this.adapter = new ServerAdapter(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE); this.adapter.select(); new ContextMenu("Restart in Debug").select(); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); }</code><technical_language>Shouldnt OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS</technical_language>

Target:
public void setUp() { TestUtils.setUpOcBinary(); TestUtils.cleanupGitFolder(OpenShiftResources.NODEJS_GIT_NAME); OpenShiftExplorerView explorer = new OpenShiftExplorerView(); explorer.open(); this.connection = explorer.getOpenShift3Connection(requiredConnection.getConnection()); this.project = connection.getProject(requiredProject.getProjectName()); this.project.expand(); this.project.getService(OpenShiftResources.NODEJS_SERVICE).select(); new ContextMenu(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select(); new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION); new FinishButton().click(); new WaitWhile(new ShellWithTextIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION)); explorer.activate(); this.project.getService(OpenShiftResources.NODEJS_SERVICE).select(); new ContextMenu(OpenShiftLabel.ContextMenu.NEW_ADAPTER_FROM_EXPLORER).select(); new DefaultShell(OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS); new FinishButton().click(); new WaitWhile(new ShellWithTextIsAvailable(""), TimePeriod.LONG); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE).test()); this.adapter = new ServerAdapter(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE); this.adapter.select(); new ContextMenu("Restart in Debug").select(); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); }
Source:
<code>private void removeDiskImages() { List<DiskImage> images = DisksFilter.filterImageDisks(getVm().getDiskMap().values(), ONLY_NOT_SHAREABLE, ONLY_ACTIVE); boolean shouldWipe = false; for (DiskImage image : images) { image.setStorageIds(new ArrayList<>(Arrays.asList(getParameters().getStorageDomainId()))); image.setStoragePoolId(getParameters().getStoragePoolId()); shouldWipe |= image.isWipeAfterDelete(); } <START> List<Guid> allMemoryDisks = MemoryUtils.getMemoryDiskIdsFromSnapshots(getVm().getSnapshots()); <END> for (Guid memoryDiskId : allMemoryDisks) { DiskImage metadataDisk = createMemoryDisk(memoryDiskId, shouldWipe); images.add(metadataDisk); } removeVmImages(images); }</code><technical_language>here, this code remove duplicates try remove memory volumes twice, right</technical_language>

Target:
private void removeDiskImages() { List<DiskImage> images = DisksFilter.filterImageDisks(getVm().getDiskMap().values(), ONLY_NOT_SHAREABLE, ONLY_ACTIVE); boolean shouldWipe = false; for (DiskImage image : images) { image.setStorageIds(new ArrayList<>(Arrays.asList(getParameters().getStorageDomainId()))); image.setStoragePoolId(getParameters().getStoragePoolId()); shouldWipe |= image.isWipeAfterDelete(); } Set<Guid> allMemoryDisks = MemoryUtils.getMemoryDiskIdsFromSnapshots(getVm().getSnapshots()); for (Guid memoryDiskId : allMemoryDisks) { DiskImage metadataDisk = createMemoryDisk(memoryDiskId, shouldWipe); images.add(metadataDisk); } removeVmImages(images); }
Source:
<code>Pair<String, Boolean> process(OMUpdateEventBatch events) { LOG.info("Starting a 'process' run of FileSizeCountTask."); Iterator<OMDBUpdateEvent> eventIterator = events.getIterator(); while (eventIterator.hasNext()) { OMDBUpdateEvent<String, OmKeyInfo> omdbUpdateEvent = eventIterator.next(); String updatedKey = omdbUpdateEvent.getKey(); OmKeyInfo updatedValue = omdbUpdateEvent.getValue(); try{ switch (omdbUpdateEvent.getAction()) { case PUT: updateCountForKey(updatedValue, "PUT"); break; case DELETE: updateCountForKey(updatedValue, "DELETE"); break; <START> default: LOG.debug("Skipping DB update event : " + omdbUpdateEvent <END> .getAction()); } } catch (IOException e) { LOG.error("Unexpected exception while updating key data : ", updatedKey, e); return new ImmutablePair<>(getTaskName(), false); } } LOG.info("Completed a 'process' run of FileSizeCountTask."); return new ImmutablePair<>(getTaskName(), true); }</code><technical_language>Set log level trace for this is meaningful info</technical_language>

Target:
Pair<String, Boolean> process(OMUpdateEventBatch events) { LOG.info("Starting a 'process' run of FileSizeCountTask."); Iterator<OMDBUpdateEvent> eventIterator = events.getIterator(); updateCountFromDB(); while (eventIterator.hasNext()) { OMDBUpdateEvent<String, OmKeyInfo> omdbUpdateEvent = eventIterator.next(); String updatedKey = omdbUpdateEvent.getKey(); OmKeyInfo omKeyInfo = omdbUpdateEvent.getValue(); try{ switch (omdbUpdateEvent.getAction()) { case PUT: updateUpperBoundCount(omKeyInfo, PUT); break; case DELETE: updateUpperBoundCount(omKeyInfo, DELETE); break; default: LOG.trace("Skipping DB update event : " + omdbUpdateEvent .getAction()); } } catch (IOException e) { LOG.error("Unexpected exception while updating key data : {}", updatedKey, e.getMessage()); return new ImmutablePair<>(getTaskName(), false); } populateFileCountBySizeDB(); } LOG.info("Completed a 'process' run of FileSizeCountTask."); return new ImmutablePair<>(getTaskName(), true); }
Source:
<code>private void throwIfInvalidSetup(PingableLeader cachedService, PingableLeader pingedService, String pingedServiceUuid) { if (cachedService == null) { return; } IllegalStateException exception = new IllegalStateException( "There is a fatal problem with the leadership election configuration! " + "This is probably caused by invalid pref files setting up the cluster " <START> + "(exception.g. for lock server look at lock.prefs, leader.prefs, and lock_client.prefs)." <END> + "If the preferences are specified with a host port pair list and localhost index " + "then make sure that the localhost index is correct (exception.g. actually the localhost)."); if (cachedService != pingedService) { log.error("Remote potential leaders are claiming to be each other!", exception); throw Throwables.rewrap(exception); } if (pingedServiceUuid.equals(getUUID())) { log.error("Remote potential leader is claiming to be you!", exception); throw Throwables.rewrap(exception); } }</code><technical_language>This 'e' 'exception'</technical_language>

Target:
private void throwIfInvalidSetup(PingableLeader cachedService, PingableLeader pingedService, String pingedServiceUuid) { if (cachedService == null) { return; } IllegalStateException exception = new IllegalStateException( "There is a fatal problem with the leadership election configuration! " + "This is probably caused by invalid pref files setting up the cluster " + "(e.g. for lock server look at lock.prefs, leader.prefs, and lock_client.prefs)." + "If the preferences are specified with a host port pair list and localhost index " + "then make sure that the localhost index is correct (e.g. actually the localhost)."); if (cachedService != pingedService) { log.error("Remote potential leaders are claiming to be each other!", exception); throw Throwables.rewrap(exception); } if (pingedServiceUuid.equals(getUUID())) { log.error("Remote potential leader is claiming to be you!", exception); throw Throwables.rewrap(exception); } }
Source:
<code>public boolean couldMatch(ScriptPath path) { <START> return path.eventLower.startsWith("bigdoors door"); <END> }</code><technical_language>Please match format of couldMatch methods in Denizen... return false true..</technical_language>

Target:
public boolean couldMatch(ScriptPath path) { if (!path.eventLower.startsWith("bigdoors door")) { return false; } return true; }
Source:
<code>public void statusMessageAndContinueSearch_withManyLogs_searchCorrectly() { <START> Instant today = TimeHelper.getInstantDaysOffsetFromNow(0); <END> AdminEmailLogPageAction action = getAction(); ShowPageResult result = getShowPageResult(action); verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage()); long nextSearch = today.toEpochMilli() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000; action = getAction("offset", String.valueOf(nextSearch)); result = getShowPageResult(action); verifyManyLogs(56, 55, 110, result.data, result.getStatusMessage()); nextSearch = today.toEpochMilli() - 112 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000; action = getAction("offset", String.valueOf(nextSearch)); result = getShowPageResult(action); verifyManyLogs(39, 111, 149, result.data, result.getStatusMessage()); action = getAction("filterQuery", "receiver:email1@email.com"); result = getShowPageResult(action); verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage()); nextSearch = today.toEpochMilli() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000; action = getAction("filterQuery", "receiver:email1@email.com", "offset", String.valueOf(nextSearch)); result = getShowPageResult(action); verifyManyLogs(95, 55, 69, result.data, result.getStatusMessage()); }</code><technical_language>Instant = Instant.now()</technical_language>

Target:
public void statusMessageAndContinueSearch_withManyLogs_searchCorrectly() { Instant today = Instant.now(); AdminEmailLogPageAction action = getAction(); ShowPageResult result = getShowPageResult(action); verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage()); long nextSearch = today.toEpochMilli() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000; action = getAction("offset", String.valueOf(nextSearch)); result = getShowPageResult(action); verifyManyLogs(56, 55, 110, result.data, result.getStatusMessage()); nextSearch = today.toEpochMilli() - 112 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000; action = getAction("offset", String.valueOf(nextSearch)); result = getShowPageResult(action); verifyManyLogs(39, 111, 149, result.data, result.getStatusMessage()); action = getAction("filterQuery", "receiver:email1@email.com"); result = getShowPageResult(action); verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage()); nextSearch = today.toEpochMilli() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000; action = getAction("filterQuery", "receiver:email1@email.com", "offset", String.valueOf(nextSearch)); result = getShowPageResult(action); verifyManyLogs(95, 55, 69, result.data, result.getStatusMessage()); }
Source:
<code>public void run() { try { log.debug("Start event notification service iteration"); firstMatchSimpleFilter.clearFilterEntries(); firstMatchSimpleFilter.addFilterEntries(eventsManager.getAuditLogEventSubscribers()); firstMatchSimpleFilter.addFilterEntries( <START> FirstMatchSimpleFilter.parse(prop.getProperty(NotificationProperties.FILTER)) <END> ); String dbDownSubscribers = prop.getProperty(NotificationProperties.FAILED_QUERIES_NOTIFICATION_RECIPIENTS, true); if (!StringUtils.isEmpty(dbDownSubscribers)) { for (String subscriber : dbDownSubscribers.split(",")) { FilterEntry.createEntryFromAddress( EventsManager.DATABASE_UNREACHABLE, false, EventNotificationMethod.EMAIL.name(), subscriber); } } for (AuditLogEvent event : eventsManager.getAuditLogEvents()) { firstMatchSimpleFilter.processEvent(event); eventsManager.updateAuditLogEventProcessed(event.getId()); } deleteObsoleteHistoryData(); log.debug("Finished event notification service iteration"); } catch (Throwable t) { log.error("Exception while querying for notifications.", t); if (t instanceof SQLException) { distributeDbDownEvent(); } if (!Thread.interrupted()) { log.error(String.format("Failed to run the service."), t); } } }</code><technical_language>need parse time... parse time add array time</technical_language>

Target:
public void run() { try { try { log.debug("Start event notification service iteration"); firstMatchSimpleFilter.clearFilterEntries(); firstMatchSimpleFilter.addFilterEntries(eventsManager.getAuditLogEventSubscribers()); firstMatchSimpleFilter.addFilterEntries( configurationFilters ); String dbDownSubscribers = prop.getProperty(NotificationProperties.FAILED_QUERIES_NOTIFICATION_RECIPIENTS, true); if (!StringUtils.isEmpty(dbDownSubscribers)) { for (String subscriber : dbDownSubscribers.split(",")) { FilterEntry.createEntry( EventsManager.DATABASE_UNREACHABLE, false, EventNotificationMethod.EMAIL.name(), subscriber); } } for (AuditLogEvent event : eventsManager.getAuditLogEvents()) { firstMatchSimpleFilter.processEvent(event); eventsManager.updateAuditLogEventProcessed(event.getId()); } deleteObsoleteHistoryData(); log.debug("Finished event notification service iteration"); } catch (SQLException se) { distributeDbDownEvent(); throw se; } } catch (Throwable t) { log.error(String.format("Failed to run the service."), t); } }
Source:
<code>private static Map<Column, ObserverSpecification> readObservers(DataInputStream dis) throws IOException { ImmutableMap.Builder<Column, ObserverSpecification> omapBuilder = new ImmutableMap.Builder<Column, ObserverSpecification>(); <START> ImmutableMap<Column, ObserverSpecification> omap = ImmutableMap.of(); <END> int num = WritableUtils.readVInt(dis); for (int i = 0; i < num; i++) { Column col = ColumnUtil.readColumn(dis); String clazz = dis.readUTF(); Map<String, String> params = new HashMap<>(); int numParams = WritableUtils.readVInt(dis); for (int j = 0; j < numParams; j++) { String k = dis.readUTF(); String v = dis.readUTF(); params.put(k, v); } ObserverSpecification ospec = new ObserverSpecification(clazz, params); omapBuilder.put(col, ospec); } omap = omapBuilder.build(); return omap; }</code><technical_language>omap dropped</technical_language>

Target:
private static Map<Column, ObserverSpecification> readObservers(DataInputStream dis) throws IOException { ImmutableMap.Builder<Column, ObserverSpecification> omapBuilder = new ImmutableMap.Builder<Column, ObserverSpecification>(); int num = WritableUtils.readVInt(dis); for (int i = 0; i < num; i++) { Column col = ColumnUtil.readColumn(dis); String clazz = dis.readUTF(); Map<String, String> params = new HashMap<>(); int numParams = WritableUtils.readVInt(dis); for (int j = 0; j < numParams; j++) { String k = dis.readUTF(); String v = dis.readUTF(); params.put(k, v); } ObserverSpecification ospec = new ObserverSpecification(clazz, params); omapBuilder.put(col, ospec); } return omapBuilder.build(); }
Source:
<code>public void init() { if (isNeedFillDefaults()) { fillDefaults(); } if (isContextMode()) { adaptFormToEditable(); } <START> String provider = getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_CLOUD); int indexOf = cloudProviders.indexOf(provider); if (indexOf != -1) { labelledCombo.select(indexOf); } <END> getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_ENDPOINT); String endPoint = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_ENDPOINT)); endpointText.setText(endPoint); String clusterId = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_CLUSTER_ID)); clusterIDText.setText(clusterId); String token = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_TOKEN)); tokenText.setText(token); String folder = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER)); dbfsDepFolderText.setText(folder); useSparkPropertiesBtn.setSelection(getConnection().isUseSparkProperties()); updateStatus(IStatus.OK, EMPTY_STRING); }</code><technical_language>behavior if user import databriks metadata 7.2.1 master? provider selected? default component configuration</technical_language>

Target:
public void init() { if (isNeedFillDefaults()) { fillDefaults(); } if (isContextMode()) { adaptFormToEditable(); } String providerValue = getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_CLOUD_PROVIDER); if (providerValue != null) { cloudProviderCombo.setText(getDatabriksCloudProviderByVaule(providerValue).getProviderLableName()); } else { cloudProviderCombo.setText(EDatabriksCloudProvider.AWS.getProviderLableName()); } String endPoint = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_ENDPOINT)); endpointText.setText(endPoint); String clusterId = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_CLUSTER_ID)); clusterIDText.setText(clusterId); String token = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_TOKEN)); tokenText.setText(token); String folder = StringUtils .trimToEmpty(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER)); dbfsDepFolderText.setText(folder); useSparkPropertiesBtn.setSelection(getConnection().isUseSparkProperties()); updateStatus(IStatus.OK, EMPTY_STRING); }
Source:
<code>public WebElement getNameField(int instrNum) { <START> return browser.driver.findElement(By.id(Const.ParamsNames.INSTRUCTOR_NAME + instrNum)); <END> }</code><technical_language>I @FindBy defined top instead of findElement() againt</technical_language>

Target:
public WebElement getNameField(int instrNum) { return browser.driver.findElement(By.id("instructorname" + instrNum)); }
Source:
<code>public static void init(String fileContent) { Mapping mapping = JsonUtils.safeEval(fileContent); JSONObject mappingJson = new JSONObject(mapping); documentationPathMap = new HashMap<String, String>(); for (String docTag : mappingJson.keySet()) { <START> JSONValue url = mappingJson.get(docTag); <END> JSONString urlString = url.isString(); if (docTag != null && urlString != null && !docTag.isEmpty() && !urlString.stringValue().isEmpty() && !documentationPathMap.containsKey(docTag)) { documentationPathMap.put(docTag, urlString.stringValue()); } } }</code><technical_language>Is this redundant? do: JSONString urlString = mappingJson.get(docTag).isString(); I url anywhere</technical_language>

Target:
public static void init(String fileContent) { Mapping mapping = JsonUtils.safeEval(fileContent); JSONObject mappingJson = new JSONObject(mapping); documentationPathMap = new HashMap<String, String>(); for (String docTag : mappingJson.keySet()) { JSONString urlString = mappingJson.get(docTag).isString(); if (docTag != null && urlString != null && !docTag.isEmpty() && !urlString.stringValue().isEmpty() && !documentationPathMap.containsKey(docTag)) { documentationPathMap.put(docTag, urlString.stringValue()); } } }
Source:
<code>public void run() { <START> for(; namesystem != null ;) { <END> if(namesystem.isRunning()) checkLeases(); try { Thread.sleep(HdfsServerConstants.NAMENODE_LEASE_RECHECK_INTERVAL); } catch(InterruptedException ie) { if (LOG.isDebugEnabled()) { LOG.debug(name + " is interrupted.", ie); } } } }</code><technical_language>~~Can while loop instead~~ appears namesystem null, do infinite loop checking namesystem time. this leads next point a shut LeaseMonitor. Shutting NamespaceProcessor shut LeaseMonitor. Currently, interrupts it, break out of loop properly shut thread. follow logic of Monitor in HDFS here</technical_language>

Target:
public void run() { while(shouldRunMonitor) { if(namesystem.isRunning()) checkLeases(); try { Thread.sleep(HdfsServerConstants.NAMENODE_LEASE_RECHECK_INTERVAL); } catch(InterruptedException ie) { if (LOG.isDebugEnabled()) { LOG.debug(name + " is interrupted.", ie); } } } LOG.warn("Exiting LeaseMonitor."); }
Source:
<code><START> public int getGracePeriodDaysForCompaction() { <END> return config.get(PRIAM_PRE + ".forgottenFileGracePeriodDaysForCompaction", 5); }</code><technical_language>Do want change PRIAM_PRE + ".forgottenFileGracePeriodDaysForCompaction gracePeriodDaysForCompaction</technical_language>

Target:
public int getGracePeriodDaysForCompaction() { return config.get(PRIAM_PRE + ".gracePeriodDaysForCompaction", 5); }
Source:
<code>public SubmissionDefinitionRest fromModel(SubmissionConfig obj) { SubmissionDefinitionRest sd = new SubmissionDefinitionRest(); sd.setName(obj.getSubmissionName()); sd.setDefaultConf(obj.isDefaultConf()); List<SubmissionSectionRest> panels = new LinkedList<SubmissionSectionRest>(); for (int idx = 0; idx < obj.getNumberOfSteps(); idx++) { SubmissionStepConfig step = obj.getStep(idx); SubmissionSectionRest sp = panelConverter.convert(step); panels.add(sp); } HttpServletRequest request = requestService.getCurrentRequest().getHttpServletRequest(); Context context = null; try { context = ContextUtil.obtainContext(request); List<Collection> collections = panelConverter.getSubmissionConfigReader().getCollectionsBySubmissionConfig(context, obj.getSubmissionName()); List<CollectionRest> collectionsRest = collections.stream().map((collection) -> collectionConverter.convert(collection)).collect( Collectors.toList()); sd.setCollections(collectionsRest); <START> } catch (SQLException e) { <END> log.error(e.getMessage(), e); } sd.setPanels(panels); return sd; }</code><technical_language>sense catch this Exception continue then? I pass, DSpaceApiExceptionControllerAdvice class [translate exception INTERNAL SERVER error](<LINK_0></technical_language>

Target:
public SubmissionDefinitionRest fromModel(SubmissionConfig obj) { SubmissionDefinitionRest sd = new SubmissionDefinitionRest(); sd.setName(obj.getSubmissionName()); sd.setDefaultConf(obj.isDefaultConf()); List<SubmissionSectionRest> panels = new LinkedList<SubmissionSectionRest>(); for (int idx = 0; idx < obj.getNumberOfSteps(); idx++) { SubmissionStepConfig step = obj.getStep(idx); SubmissionSectionRest sp = panelConverter.convert(step); panels.add(sp); } HttpServletRequest request = requestService.getCurrentRequest().getHttpServletRequest(); Context context = null; try { context = ContextUtil.obtainContext(request); List<Collection> collections = panelConverter.getSubmissionConfigReader().getCollectionsBySubmissionConfig(context, obj.getSubmissionName()); List<CollectionRest> collectionsRest = collections.stream().map((collection) -> collectionConverter.convert(collection)).collect( Collectors.toList()); sd.setCollections(collectionsRest); } catch (SQLException | IllegalStateException | SubmissionConfigReaderException e) { log.error(e.getMessage(), e); } sd.setPanels(panels); return sd; }
Source:
<code>public static String threadDump() { final StringBuilder dump = new StringBuilder(); @SuppressWarnings("checkstyle:AbbreviationAsWordInName") <START> final java.lang.management.ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); <END> final java.lang.management.ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(threadMXBean.getAllThreadIds(), 100); for (Entry<Thread, StackTraceElement[]> entry: Thread.getAllStackTraces().entrySet()) { Thread t = entry.getKey(); ThreadInfo threadInfo = threadMXBean.getThreadInfo(t.getId()); if (threadInfo == null) { continue; } dump.append('"'); dump.append(threadInfo.getThreadName()); dump.append("\" "); if (t.isDaemon()) { dump.append("(DAEMON)"); } dump.append("\n lock: "); dump.append(threadInfo.getLockName()); dump.append(" owner: "); dump.append(threadInfo.getLockOwnerName()); final Thread.State state = threadInfo.getThreadState(); dump.append("\n java.lang.Thread.State: "); dump.append(state); for (final StackTraceElement stackTraceElement : entry.getValue()) { dump.append("\n at "); dump.append(stackTraceElement); } dump.append("\n\n"); } return dump.toString(); }</code><technical_language>rename</technical_language>

Target:
public static String threadDump() { final StringBuilder dump = new StringBuilder(); final java.lang.management.ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean(); final java.lang.management.ThreadInfo[] threadInfos = threadMxBean.getThreadInfo(threadMxBean.getAllThreadIds(), 100); for (Entry<Thread, StackTraceElement[]> entry: Thread.getAllStackTraces().entrySet()) { Thread t = entry.getKey(); ThreadInfo threadInfo = threadMxBean.getThreadInfo(t.getId()); if (threadInfo == null) { continue; } dump.append('"'); dump.append(threadInfo.getThreadName()); dump.append("\" "); if (t.isDaemon()) { dump.append("(DAEMON)"); } dump.append("\n lock: "); dump.append(threadInfo.getLockName()); dump.append(" owner: "); dump.append(threadInfo.getLockOwnerName()); final Thread.State state = threadInfo.getThreadState(); dump.append("\n java.lang.Thread.State: "); dump.append(state); for (final StackTraceElement stackTraceElement : entry.getValue()) { dump.append("\n at "); dump.append(stackTraceElement); } dump.append("\n\n"); } return dump.toString(); }
Source:
<code>public void testConnection() throws Exception { try(SpliceWatcher watcher2 = new SpliceWatcher(CLASS_NAME)) { watcher2.setConnection( watcher2.connectionBuilder().useOLAP(true).build() ); <START> ResultSet rs = watcher2.executeQuery("select testConnection() from test"); <END> String result = rs.next() ? rs.getString(1) : null; Assert.assertNotNull(result); Assert.assertTrue(result, result.compareTo("Got an internal connection") == 0); } }</code><technical_language>missing try-with-resources for this ResultSet</technical_language>

Target:
public void testConnection() throws Exception { try(SpliceWatcher watcher2 = new SpliceWatcher(CLASS_NAME)) { watcher2.setConnection( watcher2.connectionBuilder().useOLAP(true).build() ); try(ResultSet rs = watcher2.executeQuery("select testConnection() from test")) { String result = rs.next() ? rs.getString(1) : null; Assert.assertNotNull(result); Assert.assertTrue(result, result.compareTo("Got an internal connection") == 0); } } }
Source:
<code>private Path executeNcksAndOutputToFile(String baseFilename, Path tempFile) throws IOException, InterruptedException { List<String> ncksCommand = new ArrayList<>(); ncksCommand.add(ncksPath); ncksCommand.add("--no_nm_prn"); ncksCommand.add("-a"); ncksCommand.add(tempFile.toString()); logger.info(ncksCommand.toString()); ProcessBuilder processor = new ProcessBuilder(ncksCommand); processor.redirectError(ProcessBuilder.Redirect.PIPE); final Process process = processor.start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); StringBuilder builder = new StringBuilder(); String line; while ((line = br.readLine()) != null) { builder.append(line + System.getProperty("line.separator")); } try { process.waitFor(); } catch (InterruptedException e) { logger.error(String.format("Interrupted: '%s'", e.getMessage())); <START> logger.error(process.getErrorStream().toString()); <END> throw e; } String rawOutput = builder.toString(); String outputCSV = parseNcks(rawOutput); String csvFilename = String.format("%s.%s", baseFilename, extension); File csvFile = new File(csvFilename); FileUtils.writeStringToFile(csvFile, outputCSV); return csvFile.toPath(); }</code><technical_language>I consume error stream of catching exceptions. @jonescc is a java guru. more me</technical_language>

Target:
private Path executeNcksAndOutputToFile(String baseFilename, Path tempFile) throws IOException, InterruptedException { List<String> ncksCommand = new ArrayList<>(); ncksCommand.add(ncksPath); ncksCommand.add("--no_nm_prn"); ncksCommand.add("-a"); ncksCommand.add(tempFile.toString()); logger.info(ncksCommand.toString()); ProcessBuilder processor = new ProcessBuilder(ncksCommand); processor.redirectError(ProcessBuilder.Redirect.PIPE); final Process process = processor.start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); InputStreamReader errorStream = new InputStreamReader(process.getErrorStream()); BufferedReader bufferedErrorStream = new BufferedReader(errorStream); StringBuilder builder = new StringBuilder(); String line; String errLine = null; while ((line = br.readLine()) != null || (errLine = bufferedErrorStream.readLine()) != null) { if (line != null) { builder.append(line + System.getProperty("line.separator")); } if (errLine != null) { logger.error(errLine); } } try { process.waitFor(); } catch (InterruptedException e) { logger.error(String.format("Interrupted: '%s'", e.getMessage())); throw e; } String rawOutput = builder.toString(); String outputCSV = parseNcks(rawOutput); String csvFilename = String.format("%s.%s", baseFilename, extension); File csvFile = new File(csvFilename); FileUtils.writeStringToFile(csvFile, outputCSV); return csvFile.toPath(); }
Source:
<code>public static Collection<ExtMap> populateGroups(final ExtensionProxy extension, final String namespace, final ExtMap input) { final Collection<ExtMap> groups = new ArrayList<>(); queryImpl(extension, namespace, input, new QueryResultHandler() { @Override public boolean handle(Collection<ExtMap> queryResults) { <START> boolean result = true; <END> for (ExtMap queryResult : queryResults) { if (groups.size() < QUERIES_RESULTS_LIMIT) { groups.add(queryResult); } else { result = false; break; } } return result; } }); return groups; }</code><technical_language>if this is case, "handle" is identical principal records groups</technical_language>

Target:
public static Collection<ExtMap> populateGroups(final ExtensionProxy extension, final String namespace, final ExtMap input) { final Collection<ExtMap> groups = new ArrayList<>(); queryImpl(extension, namespace, input, new LimitingQueryResultSizeHandler(groups)); return groups; }
Source:
<code>public Session getSession(String keyspace) { Session session = sessions.get(keyspace); if (session == null) { LOG.debug("Constructing session for keyspace [" + keyspace + "]"); session = initializeSession(keyspace); <START> sessions.put(keyspace, session); <END> } return session; }</code><technical_language>hurt, confusing put session map again</technical_language>

Target:
public Session getSession(String keyspace) { Session session = sessions.get(keyspace); if (session == null) { LOG.debug("Constructing session for keyspace [" + keyspace + "]"); session = initializeSession(keyspace); } return session; }
Source:
<code>public void initialize() { logger.debug("Initializing hue light handler."); final String configLightId = (String) getConfig().get(LIGHT_ID); if (configLightId != null) { lightId = configLightId; if (getHueBridgeHandler() != null) { ThingStatusInfo statusInfo = getBridge().getStatusInfo(); updateStatus(statusInfo.getStatus(), statusInfo.getStatusDetail(), statusInfo.getDescription()); FullLight fullLight = getLight(); if (fullLight != null) { String modelId = fullLight.getModelID().replaceAll(NORMALIZE_ID_REGEX, "_"); <START> updateProperty(Thing.PROPERTY_MODEL_ID, modelId); <END> updateProperty(Thing.PROPERTY_FIRMWARE_VERSION, fullLight.getSoftwareVersion()); String vendor = getVendor(modelId); if (vendor != null) { updateProperty(Thing.PROPERTY_VENDOR, vendor); } isOsramPar16 = OSRAM_PAR16_50_TW_MODEL_ID.equals(modelId); } } } }</code><technical_language>test this defined in a file? I <LINK_0> needs implemented in order this work expected (= exceptions in log)</technical_language>

Target:
public void initialize() { logger.debug("Initializing hue light handler."); final String configLightId = (String) getConfig().get(LIGHT_ID); if (configLightId != null) { lightId = configLightId; if (getHueBridgeHandler() != null) { ThingStatusInfo statusInfo = getBridge().getStatusInfo(); updateStatus(statusInfo.getStatus(), statusInfo.getStatusDetail(), statusInfo.getDescription()); updateProperties(); } } }
Source:
<code>public Map<String, Object> parse(String input) { try { Map<String, Object> map = new LinkedHashMap<>(); JsonNode root = objectMapper.readTree(input); Iterator<String> keysIter = (fieldNames == null ? root.fieldNames() : fieldNames.iterator()); while (keysIter.hasNext()) { String key = keysIter.next(); <START> if (exclude.contains(key)) { <END> continue; } JsonNode node = root.path(key); if (node.isArray()) { final List<Object> nodeValue = Lists.newArrayListWithExpectedSize(node.size()); for (final JsonNode subnode : node) { final Object subnodeValue = valueFunction.apply(subnode); if (subnodeValue != null) { nodeValue.add(subnodeValue); } } map.put(key.toLowerCase(), nodeValue); } else { final Object nodeValue = valueFunction.apply(node); if (nodeValue != null) { map.put(key.toLowerCase(), nodeValue); } } } return map; } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }</code><technical_language>Add lowercase well</technical_language>

Target:
public Map<String, Object> parse(String input) { try { Map<String, Object> map = new LinkedHashMap<>(); JsonNode root = objectMapper.readTree(input); Iterator<String> keysIter = (fieldNames == null ? root.fieldNames() : fieldNames.iterator()); while (keysIter.hasNext()) { String key = keysIter.next(); if (exclude.contains(key.toLowerCase())) { continue; } JsonNode node = root.path(key); if (node.isArray()) { final List<Object> nodeValue = Lists.newArrayListWithExpectedSize(node.size()); for (final JsonNode subnode : node) { final Object subnodeValue = valueFunction.apply(subnode); if (subnodeValue != null) { nodeValue.add(subnodeValue); } } map.put(key.toLowerCase(), nodeValue); } else { final Object nodeValue = valueFunction.apply(node); if (nodeValue != null) { map.put(key.toLowerCase(), nodeValue); } } } return map; } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }
Source:
<code>private HttpResponse handleGet(List<String> storeList) { logger.info("Received a Http GET Admin request"); String response; <START> if(storeList == null || storeList.isEmpty()) { <END> response = storeClientConfigs.getAllConfigs(); } else { response = storeClientConfigs.getSpecificConfigs(storeList); } HttpResponseStatus responseStatus; if(response.contains(StoreClientConfigService.ERROR_MESSAGE_PARAM_KEY) && response.contains(StoreClientConfigService.STORE_NOT_FOUND_ERROR)) { responseStatus = NOT_FOUND; } else { responseStatus = OK; } return sendResponse(responseStatus, response); }</code><technical_language>Generally speaking null empty things. Please mix semantically. line 78 List<String> storeList = Lists.newArrayList(); storeList is initialized a newArrayList, means worst case empty null</technical_language>

Target:
private HttpResponse handleGet(List<String> storeList) { logger.info("Handling a Http GET Admin request"); String response; if(storeList == null || storeList.isEmpty()) { response = storeClientConfigs.getAllConfigs(); } else { response = storeClientConfigs.getSpecificConfigs(storeList); } HttpResponseStatus responseStatus; if(response.contains(StoreClientConfigService.ERROR_MESSAGE_PARAM_KEY) && response.contains(StoreClientConfigService.STORE_NOT_FOUND_ERROR)) { responseStatus = NOT_FOUND; } else { responseStatus = OK; } return sendResponse(responseStatus, response); }
Source:
<code>public Event read(Player caster, GameMessage msg) { int targetPlayerId = msg.getPayload().getShort(false, ValueType.ADD); int targetSpellId = msg.getPayload().getShort(false, ByteOrder.LITTLE); MobList<Player> players = caster.getWorld().getPlayers(); Optional<Player> targetPlayer = players.retrieve(targetPlayerId); if (targetPlayer.isEmpty()) { <START> throw new InvalidSpellTargetException(targetPlayerId); <END> } return new CastOnPlayerEvent(caster, targetSpellId, targetPlayerId); }</code><technical_language>throw exception instead of returning? benefit that</technical_language>

Target:
public Event read(Player caster, GameMessage msg) { int targetId = msg.getPayload().getShort(false, ValueType.ADD); int spellId = msg.getPayload().getShort(false, ByteOrder.LITTLE); Optional<Player> targetPlayer = findTarget(caster, targetId); if (targetPlayer.isPresent()) { Player target = targetPlayer.get(); this.submitEventFor(target, new CastOnPlayerEvent(caster, spellId, target)); } return null; }
Source:
<code>public final Object getContents(final String directory) { File f = new File(directory); String[] content = f.list(); Object[] o = new Object[content.length]; <START> for (int i = 0; i < content.length; i++) { <END> o[i] = content[i]; } if (content != null) { SImmutableArray sia = new SImmutableArray(o, Classes.arrayClass); return sia; } else { return Nil.nilObject; } }</code><technical_language>Is this System.arraycopy(...)</technical_language>

Target:
public final Object getContents(final String directory) { File f = new File(directory); String[] content = f.list(); if (content == null) { return Nil.nilObject; } Object[] o = new Object[content.length]; System.arraycopy(content, 0, o, 0, content.length); return new SImmutableArray(o, Classes.arrayClass); }
Source:
<code>boolean validateGroup(AmbariTProxyConfiguration tProxyConfiguration, String proxyUserName, UserEntity userEntity) { String allowedGroups = tProxyConfiguration.getAllowedGroups(proxyUserName); if (StringUtils.isNotEmpty(allowedGroups)) { Set<String> groupSpecs = Arrays.stream(allowedGroups.split("\\s*,\\s*")) .map(s -> s.trim().toLowerCase()) .collect(toSet()); if (groupSpecs.contains("*")) { return true; } else { Set<MemberEntity> memberEntities = userEntity.getMemberEntities(); if (memberEntities != null) { <START> for (MemberEntity memberEntity : memberEntities) { <END> GroupEntity group = memberEntity.getGroup(); if (group != null) { String groupName = group.getGroupName(); if (groupSpecs.contains(groupName.toLowerCase())) { return true; } } } } } } return false; }</code><technical_language>a perfect place for Java Streams map(), filter(), map(), findAny()</technical_language>

Target:
boolean validateGroup(AmbariTProxyConfiguration tProxyConfiguration, String proxyUserName, UserEntity userEntity) { String allowedGroups = tProxyConfiguration.getAllowedGroups(proxyUserName); if (StringUtils.isNotEmpty(allowedGroups)) { Set<String> groupSpecs = Arrays.stream(allowedGroups.split("\\s*,\\s*")) .map(s -> s.trim().toLowerCase()) .collect(toSet()); if (groupSpecs.contains("*")) { return true; } else { Set<MemberEntity> memberEntities = userEntity.getMemberEntities(); if (memberEntities != null) { for (MemberEntity memberEntity : memberEntities) { GroupEntity group = memberEntity.getGroup(); if (group != null) { String groupName = group.getGroupName(); if (StringUtils.isNotEmpty(groupName) && groupSpecs.contains(groupName.toLowerCase())) { return true; } } } } } } return false; }
Source:
<code>public void execute() throws Exception { if (!CassandraMonitor.isCassadraStarted()) { <START> logger.debug("Cassandra is not started, hence SnapshotMetaService will not run"); <END> return; } try { logger.info("Initializaing SnapshotMetaService"); snapshotName = generateSnapshotName(); metaFileWriter.cleanupOldMetaFiles(); cassandraOperations.takeSnapshot(snapshotName); Path metaFilePath = processSnapshot(); metaFileWriter.uploadMetaFile(metaFilePath, true); logger.info("Finished processing snapshot meta service"); } catch (Exception e) { logger.error("Error while executing SnapshotMetaService", e); } }</code><technical_language>Cassandra started</technical_language>

Target:
public void execute() throws Exception { if (!CassandraMonitor.hasCassadraStarted()) { logger.debug("Cassandra has not started, hence SnapshotMetaService will not run"); return; } try { Instant snapshotInstant = DateUtil.getInstant(); snapshotName = generateSnapshotName(snapshotInstant); logger.info("Initializing SnapshotMetaService for taking a snapshot {}" + snapshotName); metaFileManager.cleanupOldMetaFiles(); cassandraOperations.takeSnapshot(snapshotName); processSnapshot(snapshotInstant).uploadMetaFile(true); logger.info("Finished processing snapshot meta service"); } catch (Exception e) { logger.error("Error while executing SnapshotMetaService", e); } }
Source:
<code><START> public Placement(@NonNull String divName, long networkId, long siteId, int... adTypes) { <END> setDivName(divName); setNetworkId(networkId); setSiteId(siteId); if (adTypes == null || adTypes.length < 1) { throw new IllegalArgumentException("At least one ad type must be specified"); } for (int adType : adTypes ) { addAdType(adType); } }</code><technical_language>arguments required, right? nice for remaining setters return _this_ optional parameters a builder pattern construction. Placement placement = new Placement("div1", 1L, 2L, 10L, 11L, 12L) .addZoneId(100L) .setCampaignId(101L) .setEventIds(Arrays.asList(4, 5, 6, 7)));</technical_language>

Target:
public Placement(@NonNull String divName, long networkId, long siteId, int... adTypes) { setDivName(divName); setNetworkId(networkId); setSiteId(siteId); if (adTypes == null || adTypes.length < 1) { throw new IllegalArgumentException("At least one ad type must be specified"); } addAdTypes(adTypes); }
Source:
<code>public void loadSegment() throws Exception { _indexSegment = ImmutableSegmentLoader.load(new File(INDEX_DIR, SEGMENT_NAME), ReadMode.heap); _upsertIndexSegment = ImmutableSegmentLoader.load(new File(INDEX_DIR, SEGMENT_NAME), ReadMode.heap); ((ImmutableSegmentImpl) _upsertIndexSegment) <START> .enableUpsert(new PartitionUpsertMetadataManager("testTable", 0, _serverMetrics), <END> new ThreadSafeMutableRoaringBitmap()); }</code><technical_language>(nit) Mock a ServerMetrics locally instead of a member variable</technical_language>

Target:
public void loadSegment() throws Exception { _indexSegment = ImmutableSegmentLoader.load(new File(INDEX_DIR, SEGMENT_NAME), ReadMode.heap); ServerMetrics serverMetrics = Mockito.mock(ServerMetrics.class); _upsertIndexSegment = ImmutableSegmentLoader.load(new File(INDEX_DIR, SEGMENT_NAME), ReadMode.heap); ((ImmutableSegmentImpl) _upsertIndexSegment) .enableUpsert(new PartitionUpsertMetadataManager("testTable_REALTIME", 0, serverMetrics), new ThreadSafeMutableRoaringBitmap()); }
Source:
<code>public JSONInvoiceInfoResponse getInvoiceInfo(@NonNull final InvoiceId invoiceId, final String ad_language) { final JSONInvoiceInfoResponse.JSONInvoiceInfoResponseBuilder result = JSONInvoiceInfoResponse.builder(); final I_C_Invoice invoice = invoiceDAO.getByIdInTrx(invoiceId); <START> final CurrencyCode currency = Services.get(ICurrencyDAO.class).getCurrencyCodeById(CurrencyId.ofRepoId(invoice.getC_Currency_ID())); <END> final List<I_C_InvoiceLine> lines = invoiceDAO.retrieveLines(invoiceId); for (final I_C_InvoiceLine line : lines) { final String productName = productBL.getProductNameTrl(ProductId.ofRepoId(line.getM_Product_ID())).translate(ad_language); final BigDecimal taxRate = taxDAO.getRateById(TaxId.ofRepoId(line.getC_Tax_ID())).orElse(BigDecimal.ZERO); result.lineInfo(JSONInvoiceLineInfo.builder() .line_number(line.getLine()) .product_name(productName) .qty_invoiced(line.getQtyEntered()) .price(line.getPriceEntered()) .tax_rate(taxRate) .line_net_amt(line.getLineNetAmt()) .currency(currency) .build()); } return result.build(); }</code><technical_language>pls extract service field</technical_language>

Target:
public JSONInvoiceInfoResponse getInvoiceInfo(@NonNull final InvoiceId invoiceId, final String ad_language) { final JSONInvoiceInfoResponse.JSONInvoiceInfoResponseBuilder result = JSONInvoiceInfoResponse.builder(); final I_C_Invoice invoice = invoiceDAO.getByIdInTrx(invoiceId); final CurrencyCode currency = currencyDAO.getCurrencyCodeById(CurrencyId.ofRepoId(invoice.getC_Currency_ID())); final List<I_C_InvoiceLine> lines = invoiceDAO.retrieveLines(invoiceId); for (final I_C_InvoiceLine line : lines) { final String productName = productBL.getProductNameTrl(ProductId.ofRepoId(line.getM_Product_ID())).translate(ad_language); final Percent taxRate = taxDAO.getRateById(TaxId.ofRepoId(line.getC_Tax_ID())); result.lineInfo(JSONInvoiceLineInfo.builder() .lineNumber(line.getLine()) .productName(productName) .qtyInvoiced(line.getQtyEntered()) .price(line.getPriceEntered()) .taxRate(taxRate) .lineNetAmt(line.getLineNetAmt()) .currency(currency) .build()); } return result.build(); }
Source:
<code>private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) { EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL); storage_pool storagePool = getStoragePoolDAO().get(storagePoolId); StorageDomain masterDomain = getStorageDomainDAO().getMasterStorageDomainForPool(storagePoolId); boolean isMasterDomainInactiveOrUnknown = (masterDomain.getStatus() == StorageDomainStatus.InActive || masterDomain.getStatus() == StorageDomainStatus.Unknown); try { runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds.getId(), storagePoolId, vds.getVdsSpmId(), masterDomain.getId(), storagePool.getmaster_domain_version())).getSucceeded(); } catch (VDSNetworkException | VdcBLLException e) { <START> if (isMasterDomainInactiveOrUnknown) { <END> result.setSuccess(true); } else { log.errorFormat("Could not connect host {0} to pool {1}", vds.getName(), storagePool .getname()); result.setSuccess(false); } } catch (RuntimeException exp) { log.errorFormat("Could not connect host {0} to pool {1}", vds.getName(), storagePool .getname()); result.setSuccess(false); } if (result.isSuccess() && !isMasterDomainInactiveOrUnknown) { result.setSuccess(proceedVdsStats()); if (!result.isSuccess()) { AuditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_VDS_STATS_FAILED); } } return result; }</code><technical_language>of in case of network exception move NonOp. VdcBLLException thrown runVdsCommand() , in order understand network exception special code written</technical_language>

Target:
private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) { EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL); storage_pool storagePool = getStoragePoolDAO().get(storagePoolId); StorageDomain masterDomain = getStorageDomainDAO().getStorageDomainForPoolByType(storagePoolId, StorageDomainType.Master); boolean shouldProceedVdsStats = true; try { runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds.getId(), storagePoolId, vds.getVdsSpmId(), masterDomain.getId(), storagePool.getmaster_domain_version())).getSucceeded(); } catch (VdcBLLException e) { boolean isMasterDomainInactiveOrUnknown = (masterDomain.getStatus() == StorageDomainStatus.InActive || masterDomain.getStatus() == StorageDomainStatus.Unknown); if (e.getErrorCode() != VdcBllErrors.VDS_NETWORK_ERROR && isMasterDomainInactiveOrUnknown) { shouldProceedVdsStats = false; result.setSuccess(true); } else { log.errorFormat("Could not connect host {0} to pool {1}", vds.getName(), storagePool .getname()); result.setSuccess(false); } } catch (RuntimeException exp) { log.errorFormat("Could not connect host {0} to pool {1}", vds.getName(), storagePool .getname()); result.setSuccess(false); } if (result.isSuccess() && shouldProceedVdsStats) { result.setSuccess(proceedVdsStats()); if (!result.isSuccess()) { AuditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_VDS_STATS_FAILED); } } return result; }
Source:
<code>public void onStart() { super.onStart(); EventBus.getDefault().register(this); <START> autoDownload = prefs.getString(PREF_AUTO_DOWNLOAD,STRING_NO_FILTER); <END> keepUpdated = prefs.getString(PREF_KEEP_UPDATED,STRING_NO_FILTER); autoDelete = prefs.getString(PREF_AUTO_DELETE,STRING_NO_FILTER); loadSubscriptions(); }</code><technical_language>I loaded filtering items. way, Fragment need preferences member variables watch out updated</technical_language>

Target:
public void onStart() { super.onStart(); EventBus.getDefault().register(this); loadSubscriptions(); }