auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void sendVolume(String host, Command command) { logger.debug("Sending volume to host " + host + " for command " + command.toString()); volumeConfig conf = getTVVolume(host); String url = "http://" + host + "/1/audio/volume"; StringBuilder content = new StringBuilder(); int newvalue = conf.volume; if (command instanceof DecimalType) { logger.debug("Setting volume to decimal type"); newvalue = ((DecimalType)command).intValue(); } else if (command instanceof IncreaseDecreaseType) { if ((IncreaseDecreaseType)command == IncreaseDecreaseType.INCREASE) { logger.debug("Increased volume"); newvalue ++; } else { logger.debug("Decreased volume"); newvalue --; } } else { logger.warn("Unitl now only DecimalType and IncreaseDecreaseType commands are supported vor volume command"); return; } newvalue = Math.min(newvalue, conf.max); newvalue = Math.max(newvalue, conf.min); content.append("{\"muted\":\"" + conf.mute + "\", \"current\":\""+newvalue+"\"}"); logger.trace(content.toString()); String retval = HttpUtil.executeUrl("POST", url, IOUtils.toInputStream(content.toString()), CONTENT_TYPE_JSON, 1000); if (retval == null) { logger.warn("Sending Volume failed"); } else { logger.debug("Sending Volume successfull"); } }

Target:
private void sendVolume(String host, Command command) { logger.debug("Sending volume to host for command {}", host,command.toString()); volumeConfig conf = getTVVolume(host); String url = "http://" + host + "/1/audio/volume"; int newvalue = conf.volume; if (command instanceof DecimalType) { logger.debug("Setting volume to decimal type"); newvalue = ((DecimalType)command).intValue(); } else if (command instanceof IncreaseDecreaseType) { if ((IncreaseDecreaseType)command == IncreaseDecreaseType.INCREASE) { logger.debug("Increased volume"); newvalue ++; } else { logger.debug("Decreased volume"); newvalue --; } } else { logger.warn("Unitl now only DecimalType and IncreaseDecreaseType commands are supported vor volume command"); return; } newvalue = Math.min(newvalue, conf.max); newvalue = Math.max(newvalue, conf.min); String content = "{\"muted\":\"" + conf.mute + "\", \"current\":\""+newvalue+"\"}"; logger.trace(content); HttpUtil.executeUrl("POST", url, IOUtils.toInputStream(content), CONTENT_TYPE_JSON, 1000); }
Source:
public void logReport(String userId, String email, String siteId, String type, String title, String content) throws SQLException { Connection conn = null; try { conn = sqlService.borrowConnection(); sqlService.dbWrite(conn, insertReportSql, new String[] {userId, email, siteId, type, title, content}); } catch (SQLException sqlException){ logger.error("Failed to insert feedback report. Caught sql exception while generating report. '" + FeedbackEntityProvider.DB_ERROR + "' will be returned to the client.", sqlException); if (conn != null) { sqlService.returnConnection(conn); } throw new SQLException(); } }

Target:
public void logReport(String userId, String email, String siteId, String type, String title, String content) throws SQLException { Connection conn = null; try { conn = sqlService.borrowConnection(); sqlService.dbWrite(conn, insertReportSql, new String[] {userId, email, siteId, type, title, content}); } catch (SQLException sqlException){ logger.error("Failed to insert feedback report. Caught sql exception while generating report. '" + DB_ERROR + "' will be returned to the client.", sqlException); throw sqlException; } finally { if (conn != null) { sqlService.returnConnection(conn); } } }
Source:
public void onResume() { super.onResume(); boolean shouldBeHere = (CommCareApplication._().getVisibleAppRecords().size() == 1 && CommCareApplication._().getReadyAppRecords().size() == 0); if (!fromManager && !shouldBeHere) { Intent i = new Intent(this, CommCareHomeActivity.class); this.startActivity(i); } }

Target:
public void onResume() { super.onResume(); boolean shouldBeHere = fromManager || CommCareApplication._().shouldSeeMMVerification(); if (!shouldBeHere) { Intent i = new Intent(this, CommCareHomeActivity.class); startActivity(i); } }
Source:
public void killContainer(String containerId) throws DockerAccessException { try { String url = urlBuilder.killContainer(containerId); log.verbose(Logger.LogVerboseCategory.API,"POSTing %s", url); delegate.post(url, HTTP_NO_CONTENT, HTTP_NOT_MODIFIED); } catch (IOException ie) { throw new DockerAccessException(ie, "Unable to kill container id [%s]", containerId); } }

Target:
public void killContainer(String containerId) throws DockerAccessException { try { String url = urlBuilder.killContainer(containerId); log.verbose(Logger.LogVerboseCategory.API,"POST %s", url); delegate.post(url, HTTP_NO_CONTENT, HTTP_NOT_MODIFIED); } catch (IOException ie) { throw new DockerAccessException(ie, "Unable to kill container id [%s]", containerId); } }
Source:
public void send(final Sender sender) throws IOException { final byte[] payload = this.payload.load(); sender.send(payload); }

Target:
public void send(final Sender sender) throws IOException { Objects.requireNonNull(sender); final byte[] payload = this.payload.load(); sender.send(payload); }
Source:
private Collection<JM> getJoinOutput(K key, Object value, M message) { R record = Optional.ofNullable(value) .map(val -> (R) KV.of(key, val)) .orElse(null); JM output = joinOpSpec.getJoinFn().apply(message, record); return output != null ? Collections.singletonList(output) : Collections.emptyList(); }

Target:
private Collection<JM> getJoinOutput(K key, Object value, M message) { R record = value == null ? null : (R) KV.of(key, value); JM output = joinOpSpec.getJoinFn().apply(message, record); return output != null ? Collections.singletonList(output) : Collections.emptyList(); }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == FolderPickerActivity.DIRECTORY_REQUEST_CODE && resultCode == RESULT_OK) { Folder selectedFolder = (Folder) mFoldersSpinner.getSelectedItem(); String folderDirectory = selectedFolder.path; if (!folderDirectory.endsWith("/")) { folderDirectory += "/"; } String subDirectory = data.getStringExtra(FolderPickerActivity.EXTRA_RESULT_DIRECTORY) + "/"; subDirectory = (subDirectory).replace(folderDirectory.substring(0, folderDirectory.length()), ""); mSubDirectoryTextView.setText(subDirectory); PreferenceManager.getDefaultSharedPreferences(this) .edit().putString(PREF_FOLDER_SAVED_SUBDIRECTORY+selectedFolder.id, subDirectory) .apply(); } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == FolderPickerActivity.DIRECTORY_REQUEST_CODE && resultCode == RESULT_OK) { Folder selectedFolder = (Folder) mFoldersSpinner.getSelectedItem(); String folderDirectory = Util.formatPath(selectedFolder.path); String subDirectory = data.getStringExtra(FolderPickerActivity.EXTRA_RESULT_DIRECTORY); subDirectory = subDirectory.replace(folderDirectory, ""); mSubDirectoryTextView.setText(subDirectory); PreferenceManager.getDefaultSharedPreferences(this) .edit().putString(PREF_FOLDER_SAVED_SUBDIRECTORY + selectedFolder.id, subDirectory) .apply(); } }
Source:
mergeJoin(final Enumerable<TSource> outer, final Enumerable<TInner> inner, final Function1<TSource, TKey> outerKeySelector, final Function1<TInner, TKey> innerKeySelector, final Function2<TSource, TInner, TResult> resultSelector, boolean generateNullsOnLeft, boolean generateNullsOnRight) { if (generateNullsOnLeft) { throw new UnsupportedOperationException("not implemented"); } if (generateNullsOnRight) { throw new UnsupportedOperationException("not implemented"); } return new AbstractEnumerable<TResult>() { public Enumerator<TResult> enumerator() { return new MergeJoinEnumerator<>(outer.enumerator(), inner.enumerator(), outerKeySelector, innerKeySelector, resultSelector); } }; }

Target:
mergeJoin(final Enumerable<TSource> outer, final Enumerable<TInner> inner, final Function1<TSource, TKey> outerKeySelector, final Function1<TInner, TKey> innerKeySelector, final Function2<TSource, TInner, TResult> resultSelector, boolean generateNullsOnLeft, boolean generateNullsOnRight) { if (generateNullsOnLeft) { throw new UnsupportedOperationException( "not implemented, mergeJoin with generateNullsOnLeft"); } if (generateNullsOnRight) { throw new UnsupportedOperationException( "not implemented, mergeJoin with generateNullsOnRight"); } return new AbstractEnumerable<TResult>() { public Enumerator<TResult> enumerator() { return new MergeJoinEnumerator<>(outer.enumerator(), inner.enumerator(), outerKeySelector, innerKeySelector, resultSelector); } }; }
Source:
private void assertHeroAndMouseCoords(Vector2 mouseCoords, Vector2 heroCoords) { if(Double.isNaN(mouseCoords.x) || Double.isNaN(mouseCoords.y)) { System.err.println("Screen size: " + Gdx.graphics.getWidth() + " " + Gdx.graphics.getHeight()); throw new RuntimeException("Mouse coordinates are not valid: " + mouseCoords.x + " " + mouseCoords.y); } if(Double.isNaN(heroCoords.x) || Double.isNaN(heroCoords.y)) { System.err.println("Screen size: " + Gdx.graphics.getWidth() + " " + Gdx.graphics.getHeight()); throw new RuntimeException("Hero coordinates are not valid: " + heroCoords.x + " " + heroCoords.y); } }

Target:
private void assertHeroAndMouseCoords(Vector2 mouseCoords, Vector2 heroCoords) { if (Double.isNaN(mouseCoords.x) || Double.isNaN(mouseCoords.y)) { throw new RuntimeException("Mouse coordinates are not valid: " + mouseCoords.x + " " + mouseCoords.y); } if (Double.isNaN(heroCoords.x) || Double.isNaN(heroCoords.y)) { throw new RuntimeException("Hero coordinates are not valid: " + heroCoords.x + " " + heroCoords.y); } }
Source:
public Set<String> getAllGenres(final Record record) { Set<String> freeFormGenres = new HashSet<String>(); Set<String> genres = new HashSet<String>(); Set<String> allGenres = new HashSet<String>(); freeFormGenres = getFreeFormGenre(record, "[\\\\,;:]", "([\\p{L}\\p{N}]{4}|\\.*?[\\s)]|[..{2,}]|[AMUaw][adir][cirt])"); genres = getGenres(record); allGenres.addAll(freeFormGenres); allGenres.addAll(genres); return allGenres; }

Target:
public Set<String> getAllGenres(final Record record) { Set<String> allGenres = getGenres(record); allGenres.addAll(getFreeFormGenre(record)); return allGenres; }
Source:
public boolean findContactForAcquisition(IAcquisitionWork acquisition, Person person, PlanetarySystem system) { if (null == person || !canAcquireParts(person)) { return false; } DateTime currentDate = Utilities.getDateTimeDay(getCalendar()); TargetRoll target = getTargetForAcquisition(acquisition, person, false); target = system.getPrimaryPlanet().getAcquisitionMods(target, getDate(), getCampaignOptions(), getFaction(), acquisition.getTechBase() == Part.T_CLAN); if (target.getValue() == TargetRoll.IMPOSSIBLE) { if(getCampaignOptions().usePlanetAcquisitionVerboseReporting()) { addReport("<font color='red'><b>Can't search for " + acquisition.getAcquisitionName() + " on " + system.getPrintableName(currentDate) + " because:</b></font> " + target.getDesc()); } return false; } if(Compute.d6(2) < target.getValue()) { if(getCampaignOptions().usePlanetAcquisitionVerboseReporting()) { addReport("<font color='red'><b>No contacts available for " + acquisition.getAcquisitionName() + " on " + system.getPrintableName(currentDate) + "</b></font>"); } return false; } else { if(getCampaignOptions().usePlanetAcquisitionVerboseReporting()) { addReport("<font color='green'>Possible contact for " + acquisition.getAcquisitionName() + " on " + system.getPrintableName(currentDate) + "</font>"); } return true; } }

Target:
public boolean findContactForAcquisition(IAcquisitionWork acquisition, Person person, PlanetarySystem system) { DateTime currentDate = Utilities.getDateTimeDay(getCalendar()); TargetRoll target = getTargetForAcquisition(acquisition, person, false); target = system.getPrimaryPlanet().getAcquisitionMods(target, getDate(), getCampaignOptions(), getFaction(), acquisition.getTechBase() == Part.T_CLAN); if (target.getValue() == TargetRoll.IMPOSSIBLE) { if(getCampaignOptions().usePlanetAcquisitionVerboseReporting()) { addReport("<font color='red'><b>Can't search for " + acquisition.getAcquisitionName() + " on " + system.getPrintableName(currentDate) + " because:</b></font> " + target.getDesc()); } return false; } if(Compute.d6(2) < target.getValue()) { if(getCampaignOptions().usePlanetAcquisitionVerboseReporting()) { addReport("<font color='red'><b>No contacts available for " + acquisition.getAcquisitionName() + " on " + system.getPrintableName(currentDate) + "</b></font>"); } return false; } else { if(getCampaignOptions().usePlanetAcquisitionVerboseReporting()) { addReport("<font color='green'>Possible contact for " + acquisition.getAcquisitionName() + " on " + system.getPrintableName(currentDate) + "</font>"); } return true; } }
Source:
public NamespaceExtractionCacheManager(final Lifecycle lifecycle, final ServiceEmitter serviceEmitter) { this.scheduledExecutorService = MoreExecutors.listeningDecorator( Executors.newScheduledThreadPool( 1, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("NamespaceExtractionCacheManager-%d") .setPriority(Thread.MIN_PRIORITY) .build() ) ); ExecutorServices.manageLifecycle(lifecycle, scheduledExecutorService); scheduledExecutorService.scheduleAtFixedRate( new Runnable() { @Override public void run() { try { monitor(serviceEmitter); } catch (Exception e) { log.error(e, "Error emitting namespace stats"); if (Thread.currentThread().isInterrupted()) { throw Throwables.propagate(e); } } } }, 1, 10, TimeUnit.MINUTES ); }

Target:
public NamespaceExtractionCacheManager(final Lifecycle lifecycle, final ServiceEmitter serviceEmitter) { this.scheduledExecutorService = new ScheduledThreadPoolExecutor( 1, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("NamespaceExtractionCacheManager-%d") .setPriority(Thread.MIN_PRIORITY) .build() ); ExecutorServices.manageLifecycle(lifecycle, scheduledExecutorService); scheduledExecutorService.scheduleAtFixedRate( new Runnable() { @Override public void run() { try { monitor(serviceEmitter); } catch (Exception e) { log.error(e, "Error emitting namespace stats"); if (Thread.currentThread().isInterrupted()) { throw Throwables.propagate(e); } } } }, 1, 10, TimeUnit.MINUTES ); }
Source:
public void writeUrls(URI baseUri) { super.writeUrls(baseUri); setUrl(UriComponentsBuilder.fromUri(baseUri).path("/rest/sample/tissueprocessing/{id}").buildAndExpand(getId()).toUriString()); }

Target:
public void writeUrls(URI baseUri) { super.writeUrls(baseUri); setUrl(UriComponentsBuilder.fromUri(baseUri).path("/rest/tree/sample/{id}").buildAndExpand(getId()).toUriString()); }
Source:
public Mono<Lease> updateLease(Lease cachedLease, CosmosItem itemLink, CosmosItemRequestOptions requestOptions, Function<Lease, Lease> updateLease) { Lease arrayLease[] = {cachedLease}; arrayLease[0] = updateLease.apply(cachedLease); if (arrayLease[0] == null) { return Mono.empty(); } arrayLease[0].setTimestamp(ZonedDateTime.now(ZoneId.of("UTC"))); return this.tryReplaceLease(arrayLease[0], itemLink) .map(leaseDocument -> { arrayLease[0] = ServiceItemLease.fromDocument(leaseDocument); return arrayLease[0]; }) .hasElement() .flatMap(hasItems -> { if (hasItems) { return Mono.just(arrayLease[0]); } return this.client.readItem(itemLink, requestOptions) .onErrorResume(throwable -> { if (throwable instanceof CosmosClientException) { CosmosClientException ex = (CosmosClientException) throwable; if (ex.statusCode() == HTTP_STATUS_CODE_NOT_FOUND) { throw new LeaseLostException(arrayLease[0]); } } return Mono.error(throwable); }) .map(cosmosItemResponse -> { CosmosItemProperties document = cosmosItemResponse.properties(); ServiceItemLease serverLease = ServiceItemLease.fromDocument(document); logger.info( "Partition update failed because the lease with token '{}' was updated by host '{}' with token '{}'.", arrayLease[0].getLeaseToken(), arrayLease[0].getConcurrencyToken(), serverLease.getOwner(), serverLease.getConcurrencyToken()); arrayLease[0] = serverLease; throw new RuntimeException(""); }); }) .retry(RETRY_COUNT_ON_CONFLICT, throwable -> { if (throwable instanceof RuntimeException) { return throwable instanceof LeaseLostException; } return false; }); }

Target:
public Mono<Lease> updateLease(Lease cachedLease, CosmosItem itemLink, CosmosItemRequestOptions requestOptions, Function<Lease, Lease> updateLease) { Lease arrayLease[] = {cachedLease}; arrayLease[0] = updateLease.apply(cachedLease); if (arrayLease[0] == null) { return Mono.empty(); } arrayLease[0].setTimestamp(ZonedDateTime.now(ZoneId.of("UTC"))); return this.tryReplaceLease(arrayLease[0], itemLink) .map(leaseDocument -> { arrayLease[0] = ServiceItemLease.fromDocument(leaseDocument); return arrayLease[0]; }) .hasElement() .flatMap(hasItems -> { if (hasItems) { return Mono.just(arrayLease[0]); } return this.client.readItem(itemLink, requestOptions) .onErrorResume(throwable -> { if (throwable instanceof CosmosClientException) { CosmosClientException ex = (CosmosClientException) throwable; if (ex.statusCode() == HTTP_STATUS_CODE_NOT_FOUND) { throw new LeaseLostException(arrayLease[0]); } } return Mono.error(throwable); }) .map(cosmosItemResponse -> { CosmosItemProperties document = cosmosItemResponse.properties(); ServiceItemLease serverLease = ServiceItemLease.fromDocument(document); logger.info( "Partition update failed because the lease with token '{}' was updated by host '{}' with token '{}'.", arrayLease[0].getLeaseToken(), arrayLease[0].getConcurrencyToken(), serverLease.getOwner(), serverLease.getConcurrencyToken()); arrayLease[0] = serverLease; throw new RuntimeException("Partition update failed"); }); }) .retry(RETRY_COUNT_ON_CONFLICT, throwable -> { if (throwable instanceof RuntimeException) { return throwable instanceof LeaseLostException; } return false; }); }
Source:
public boolean isComplete() { return length() == Constants.OBJECT_ID_LENGTH * 2; }

Target:
public boolean isComplete() { return length() == Constants.OBJECT_ID_STRING_LENGTH; }
Source:
public static void parseTimePeriod(Map<Integer, Set<Integer>> geoAreaCodesForYears, JSONObject response) { try { JSONArray data = response.getJSONArray(DATA_KEY); for (int i = 0; i < data.length(); i++) { JSONObject o = (JSONObject) data.get(i); Integer year = o.getInt(TIME_PERIOD_START_KEY); Integer geoAreaCode = o.getInt(GEO_AREA_CODE_KEY); if(dataObjectValueTypeIsSupported(o)) { geoAreaCodesForYears.merge(year, new HashSet<Integer>(Arrays.asList(geoAreaCode)), (oldSet,newSet) -> { return Stream.of(oldSet,newSet).flatMap(x -> x.stream()).collect(Collectors.toSet()); }); } } } catch (JSONException e) { LOG.error("Error parsing time period selectors for indicator: " + e.getMessage(), e); } }

Target:
public static void parseTimePeriod(Map<Integer, Set<Integer>> geoAreaCodesForYears, JSONObject response) { try { JSONArray data = response.getJSONArray(DATA_KEY); for (int i = 0; i < data.length(); i++) { JSONObject o = (JSONObject) data.get(i); String valueType = o.optString(VALUE_TYPE_KEY); if(dataObjectValueTypeIsSupported(valueType)) { Integer year = o.getInt(TIME_PERIOD_START_KEY); Integer geoAreaCode = o.getInt(GEO_AREA_CODE_KEY); geoAreaCodesForYears.computeIfAbsent(year, k -> new HashSet<>()).add(geoAreaCode); } else { LOG.error(String.format("Not supported valueType %s received.",valueType)); } } } catch (JSONException e) { LOG.error("Error parsing time period selectors for indicator: " + e.getMessage(), e); } }
Source:
private static Symbol isPlusAssignment(ExpressionStatementTree update) { if (update.expression().is(Kind.PLUS_ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) update.expression(); ExpressionTree lhs = assignment.variable(); ExpressionTree rhs = assignment.expression(); IdentifierTree identifier = (IdentifierTree) lhs; if (isOne(rhs)) { return identifier.symbol(); } } return null; }

Target:
private static Symbol isPlusAssignment(ExpressionStatementTree update) { if (update.expression().is(Kind.PLUS_ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) update.expression(); ExpressionTree lhs = assignment.variable(); ExpressionTree rhs = assignment.expression(); if (lhs.is(Kind.IDENTIFIER)) { IdentifierTree identifier = (IdentifierTree) lhs; if (isOne(rhs)) { return identifier.symbol(); } } } return null; }
Source:
public java.util.Map<K, Collection<V>> toJavaMap() { final java.util.Map<K, Collection<V>> javaMap = new java.util.HashMap<>(); for (Tuple2<K, V> t : this) { javaMap.computeIfAbsent(t._1, k -> { if(emptyContainer.get() instanceof Set) { return new java.util.HashSet<>(); } else if(emptyContainer.get() instanceof SortedSet) { return new java.util.TreeSet<>(); } else { return new java.util.ArrayList<>(); } }).add(t._2); } return javaMap; }

Target:
public java.util.Map<K, Collection<V>> toJavaMap() { final java.util.Map<K, Collection<V>> javaMap = new java.util.HashMap<>(); final Supplier<Collection<V>> javaContainerSupplier; if (containerType == ContainerType.SEQ) { javaContainerSupplier = java.util.ArrayList::new; } else if (containerType == ContainerType.SET) { javaContainerSupplier = java.util.HashSet::new; } else if (containerType == ContainerType.SORTED_SET) { javaContainerSupplier = java.util.TreeSet::new; } else { throw new IllegalStateException("Unknown ContainerType: " + containerType); } for (Tuple2<K, V> t : this) { javaMap.computeIfAbsent(t._1, k -> javaContainerSupplier.get()).add(t._2); } return javaMap; }
Source:
private String getPatternSegmentName(ITmfEvent event) { StringBuilder name = new StringBuilder(PATTERN_SEGMENT_NAME_PREFIX); ITmfXmlStateValue nameStateValue = null; final @NonNull String segmentName = fTypeElement.getAttribute(TmfXmlStrings.SEGMENT_NAME); if (segmentName.isEmpty()) { Element elementSegmentNameStateValue = (Element) fTypeElement.getElementsByTagName(TmfXmlStrings.STATE_VALUE).item(0); if (elementSegmentNameStateValue == null) { throw new IllegalArgumentException("Failed to get the segment name. A state value is needed."); } nameStateValue = fModelFactory.createStateValue(elementSegmentNameStateValue, fContainer, new ArrayList<ITmfXmlStateAttribute>()); getSegmentNameValue(event, name, nameStateValue); } else { name.append(segmentName); } return name.toString(); }

Target:
private String getPatternSegmentName(ITmfEvent event) { return fSegmentType.getName(event); }
Source:
public void setCurrentKey(K currentKey) throws Exception { if (currentKey != null && currentKey.equals(this.currentKey)) { return; } currentWatermark = Long.MAX_VALUE; InternalTimer<K, N> timer; while ((timer = eventTimeTimersQueue.peek()) != null) { eventTimeTimersQueue.poll(); triggerTarget.onEventTime(timer); } while ((timer = processingTimeTimersQueue.peek()) != null) { processingTimeTimersQueue.poll(); triggerTarget.onProcessingTime(timer); } currentWatermark = Long.MIN_VALUE; this.currentKey = currentKey; }

Target:
public void setCurrentKey(K currentKey) throws Exception { if (currentKey != null && currentKey.equals(this.currentKey)) { return; } currentWatermark = Long.MAX_VALUE; InternalTimer<K, N> timer; while ((timer = eventTimeTimersQueue.poll()) != null) { triggerTarget.onEventTime(timer); } while ((timer = processingTimeTimersQueue.poll()) != null) { triggerTarget.onProcessingTime(timer); } currentWatermark = Long.MIN_VALUE; this.currentKey = currentKey; }
Source:
public void onStatusUpdate(ActiveMQStatus oldStatus, ActiveMQStatus newStatus) { if (oldStatus.equals(newStatus)) { return; } Reason reason; if (ActiveMQStatus.CONNECTED.equals(newStatus)) { reason = Reason.ACTIVEMQ_UP; } else if (ActiveMQStatus.DOWN.equals(newStatus)) { reason = Reason.ACTIVEMQ_DOWN; } else { String msg = String.format("Could not transition candlpin mode: Unknown ActiveMQ status: %s", newStatus); throw new IllegalArgumentException(msg); } transitionAppropriately(reason); }

Target:
public void onStatusUpdate(ActiveMQStatus oldStatus, ActiveMQStatus newStatus) { if (oldStatus.equals(newStatus)) { return; } Reason reason; if (ActiveMQStatus.CONNECTED.equals(newStatus)) { reason = Reason.ACTIVEMQ_UP; } else if (ActiveMQStatus.DOWN.equals(newStatus)) { reason = Reason.ACTIVEMQ_DOWN; } else { String msg = String.format("Could not transition candlepin mode: Unknown ActiveMQ status: %s", newStatus); throw new IllegalArgumentException(msg); } transitionAppropriately(reason); }
Source:
public void stopRecording(Client c) { if (recordingStarted.compareAndSet(true, false)) { log.debug("##REC:: recording in room is stopping ::", roomId, recordingId); streamProcessor.getStreamsByRoom(this.getRoomId()).forEach( stream -> stream.stopRecord() ); Recording rec = streamProcessor.getRecordingDao().get(recordingId); rec.setRecordEnd(new Date()); rec = streamProcessor.getRecordingDao().update(rec); recordingUser = new JSONObject(); recordingId = null; streamProcessor.startConvertion(rec); User u; if (c == null) { u = new User(); } else { u = c.getUser(); Optional<StreamDesc> osd = c.getScreenStream(); if (osd.isPresent()) { osd.get().removeActivity(Activity.RECORD); streamProcessor.getClientManager().update(c); streamProcessor.getHandler().sendShareUpdated(osd.get()); } } WebSocketHelper.sendRoom(new RoomMessage(roomId, u, RoomMessage.Type.RECORDING_TOGGLED)); log.debug("##REC:: recording in room is stopped ::", roomId); } }

Target:
public void stopRecording(Client c) { if (recordingStarted.compareAndSet(true, false)) { log.debug("##REC:: recording in room is stopping ::", roomId, recordingId); processor.getByRoom(this.getRoomId()).forEach(KStream::stopRecord); Recording rec = processor.getRecordingDao().get(recordingId); rec.setRecordEnd(new Date()); rec = processor.getRecordingDao().update(rec); recordingUser = new JSONObject(); recordingId = null; processor.startConvertion(rec); User u; if (c == null) { u = new User(); } else { u = c.getUser(); Optional<StreamDesc> osd = c.getScreenStream(); if (osd.isPresent()) { osd.get().removeActivity(Activity.RECORD); processor.getClientManager().update(c); processor.getHandler().sendShareUpdated(osd.get()); } } WebSocketHelper.sendRoom(new RoomMessage(roomId, u, RoomMessage.Type.RECORDING_TOGGLED)); log.debug("##REC:: recording in room is stopped ::", roomId); } }
Source:
public void onTimer(String serverId, String volumeId, String snapshotNamePrefix, String description, boolean force) { final GlusterVolumeEntity volume = getGlusterVolumeDao().getById(new Guid(volumeId)); GlusterVolumeSnapshotEntity snapshot = new GlusterVolumeSnapshotEntity(); snapshot.setClusterId(volume.getClusterId()); snapshot.setVolumeId(new Guid(volumeId)); DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); final String snapshotName = snapshotNamePrefix + "-snap-" + df.format(new Date()); snapshot.setSnapshotName(snapshotName); snapshot.setDescription(description); VdcReturnValueBase returnValue = getBackend().runInternalAction(VdcActionType.CreateGlusterVolumeSnapshot, new CreateGlusterVolumeSnapshotParameters(snapshot, force)); if (!returnValue.getSucceeded()) { log.error("Error while creating snapshot for volume '{}': {}", volume.getName(), returnValue.getExecuteFailedMessages().toString()); log.debug(returnValue.getExecuteFailedMessages().toString()); logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED, new HashMap<String, String>() { { put(GlusterConstants.VOLUME_SNAPSHOT_NAME, snapshotName); put(GlusterConstants.VOLUME_NAME, volume.getName()); } }); } }

Target:
public void onTimer(String serverId, String volumeId, String snapshotNamePrefix, String description, boolean force) { final GlusterVolumeEntity volume = getGlusterVolumeDao().getById(new Guid(volumeId)); if (volume == null) { log.error("Error while creating volume snapshot. Volume is null."); return; } GlusterVolumeSnapshotEntity snapshot = new GlusterVolumeSnapshotEntity(); snapshot.setClusterId(volume.getClusterId()); snapshot.setVolumeId(volume.getId()); DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); final String snapshotName = snapshotNamePrefix + "-snap-" + df.format(new Date()); snapshot.setSnapshotName(snapshotName); snapshot.setDescription(description); VdcReturnValueBase returnValue = getBackend().runInternalAction(VdcActionType.CreateGlusterVolumeSnapshot, new CreateGlusterVolumeSnapshotParameters(snapshot, force)); if (!returnValue.getSucceeded()) { log.error("Error while creating snapshot for volume '{}': {}", volume.getName(), returnValue.getExecuteFailedMessages().toString()); logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED, new HashMap<String, String>() { { put(GlusterConstants.VOLUME_SNAPSHOT_NAME, snapshotName); put(GlusterConstants.VOLUME_NAME, volume.getName()); } }); } }
Source:
public Observable<R> apply(T t) throws Exception { return RxJavaPlugins.onAssembly(new SingleToObservable<R>(mapper.apply(t))); }

Target:
public Observable<R> apply(T t) throws Exception { return RxJavaPlugins.onAssembly(new SingleToObservable<R>( ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null value"))); }
Source:
public static CDOCheckout getCheckout(Object object) { CDOCheckout checkout = null; if (object instanceof CDOView) { CDOView view = (CDOView)object; if (!view.isClosed()) { checkout = (CDOCheckout)view.properties().get(CDOCheckoutImpl.CHECKOUT_KEY); } } if (object instanceof URI) { URI uri = (URI)object; checkout = CDOCheckoutViewProvider.getCheckout(uri); } else if (object instanceof String) { String id = (String)object; checkout = getCheckoutManager().getCheckout(id); } else { checkout = walkUp(object, null); } return checkout; }

Target:
public static CDOCheckout getCheckout(Object object) { if (object instanceof CDOView) { CDOView view = (CDOView)object; if (view.isClosed()) { return null; } return (CDOCheckout)view.properties().get(CDOCheckoutImpl.CHECKOUT_KEY); } if (object instanceof URI) { URI uri = (URI)object; return CDOCheckoutViewProvider.getCheckout(uri); } if (object instanceof String) { String id = (String)object; return getCheckoutManager().getCheckout(id); } return walkUp(object, null); }
Source:
public void execute(CommandLineArgument[] args) { if (arguments[ARG_IMPORT_FILE_IDX].isEnabled()) { List<String> errors = new ArrayList<>(); for (String file : args[ARG_IMPORT_FILE_IDX].getArguments()) { File f = new File(file); if (f.canRead()) { if (arguments[ARG_TARGET_URL_IDX].isEnabled()) { for (String url : arguments[ARG_TARGET_URL_IDX].getArguments()) { try { errors.addAll(this.importOpenApiDefinition(f, new URL(url), false)); } catch (MalformedURLException e) { CommandLine.error("malformed target url: " + url); } } } else { errors.addAll(this.importOpenApiDefinition(f, null, false)); } if (!errors.isEmpty()) { for (String error : errors) { CommandLine.error("Error importing definition: " + error); } } } else { CommandLine.error("Cannot read Open API file: " + f.getAbsolutePath()); } } } if (arguments[ARG_IMPORT_URL_IDX].isEnabled()) { for (String urlstr : args[ARG_IMPORT_URL_IDX].getArguments()) { try { List<String> errors = new ArrayList<>(); URI url = new URI(urlstr, false); if (arguments[ARG_SITE_OVERRIDE_IDX].isEnabled()) { for (String host : arguments[ARG_SITE_OVERRIDE_IDX].getArguments()) { try { new URI("http://" + host, false); errors.addAll(this.importOpenApiDefinition(url, host, false)); } catch (Exception e) { CommandLine.error(e.getMessage(), e); } } } else { errors.addAll(this.importOpenApiDefinition(url, null, false)); } if (!errors.isEmpty()) { for (String error : errors) { CommandLine.error("Error importing definition: " + error); } } } catch (Exception e) { CommandLine.error(e.getMessage(), e); } } } }

Target:
public void execute(CommandLineArgument[] args) { if (arguments[ARG_IMPORT_FILE_IDX].isEnabled()) { for (String file : args[ARG_IMPORT_FILE_IDX].getArguments()) { File f = new File(file); if (f.canRead()) { List<String> errors = new ArrayList<>(); if (arguments[ARG_TARGET_URL_IDX].isEnabled()) { for (String target : arguments[ARG_TARGET_URL_IDX].getArguments()) { try { errors.addAll(this.importOpenApiDefinition(f, target, false)); } catch (InvalidUrlException e) { CommandLine.error(e.getMessage()); } } } else { errors.addAll(this.importOpenApiDefinition(f, null, false)); } if (!errors.isEmpty()) { for (String error : errors) { CommandLine.error("Error importing definition: " + error); } } } else { CommandLine.error("Cannot read Open API file: " + f.getAbsolutePath()); } } } if (arguments[ARG_IMPORT_URL_IDX].isEnabled()) { for (String urlstr : args[ARG_IMPORT_URL_IDX].getArguments()) { try { List<String> errors = new ArrayList<>(); URI url = new URI(urlstr, false); if (arguments[ARG_TARGET_URL_IDX].isEnabled()) { for (String target : arguments[ARG_TARGET_URL_IDX].getArguments()) { try { errors.addAll(this.importOpenApiDefinition(url, target, false)); } catch (InvalidUrlException e) { CommandLine.error(e.getMessage()); } } } else { errors.addAll(this.importOpenApiDefinition(url, null, false)); } if (!errors.isEmpty()) { for (String error : errors) { CommandLine.error("Error importing definition: " + error); } } } catch (Exception e) { CommandLine.error(e.getMessage(), e); } } } }
Source:
public Set<Task> getScheduledTasks() { synchronized (this.taskMap) { return Sets.<Task>newHashSet(this.taskMap.values()); } }

Target:
protected Set<Task> getScheduledTasks() { synchronized (this.taskMap) { return Sets.<Task>newHashSet(this.taskMap.values()); } }
Source:
public int[] executeBatch() throws SQLException { checkExecStatus(); synchronized (getConnectionSynchronization()) { setupContextStack(); int i = 0; clearResultSets(); Vector stmts = batchStatements; batchStatements = null; int size; if (stmts == null) size = 0; else size = stmts.size(); int[] returnUpdateCountForBatch = new int[size]; SQLException sqle; Iterator it = stmts.iterator(); activation.setBatch(it, this); try { activation.nextBatchElement(); returnUpdateCountForBatch = new int[size]; int r = 0; do { if (super.executeStatement(activation, false, true)) throw newSQLException(SQLState.RESULTSET_RETURN_NOT_ALLOWED); for (int j = 0; j < updateCounts.length; ++j) { returnUpdateCountForBatch[r++] = (int) updateCounts[j]; } } while(activation.nextBatchElement()); InterruptStatus.restoreIntrFlagIfSeen(lcc); return returnUpdateCountForBatch; } catch (StandardException se) { sqle = handleException(se); } catch (SQLException sqle2) { sqle = sqle2; } finally { activation.setBatch(null, null); restoreContextStack(); } int successfulUpdateCount[] = new int[i]; System.arraycopy(returnUpdateCountForBatch, 0, successfulUpdateCount, 0, i); SQLException batch = new java.sql.BatchUpdateException(sqle.getMessage(), sqle.getSQLState(), sqle.getErrorCode(), successfulUpdateCount, sqle); batch.setNextException(sqle); throw batch; } }

Target:
public int[] executeBatch() throws SQLException { checkExecStatus(); synchronized (getConnectionSynchronization()) { setupContextStack(); clearResultSets(); Vector stmts = batchStatements; batchStatements = null; int size; if (stmts == null) size = 0; else size = stmts.size(); int[] returnUpdateCountForBatch = new int[size]; SQLException sqle; Iterator it = stmts.iterator(); activation.setBatch(it, this); try { activation.nextBatchElement(); returnUpdateCountForBatch = new int[size]; int r = 0; do { if (super.executeStatement(activation, false, true)) throw newSQLException(SQLState.RESULTSET_RETURN_NOT_ALLOWED); for (int j = 0; j < updateCounts.length; ++j) { returnUpdateCountForBatch[r++] = (int) updateCounts[j]; } } while(activation.nextBatchElement()); InterruptStatus.restoreIntrFlagIfSeen(lcc); return returnUpdateCountForBatch; } catch (StandardException se) { sqle = handleException(se); } catch (SQLException sqle2) { sqle = sqle2; } finally { activation.setBatch(null, null); restoreContextStack(); } int successfulUpdateCount[] = new int[0]; SQLException batch = new java.sql.BatchUpdateException(sqle.getMessage(), sqle.getSQLState(), sqle.getErrorCode(), successfulUpdateCount, sqle); batch.setNextException(sqle); throw batch; } }
Source:
public void testLogFindAuditEvents() { System.out.println("testLogFindAuditEvents"); AuditRepositoryLogger instance = new AuditRepositoryLogger(); FindAuditEventsMessageType message = new FindAuditEventsMessageType(); FindAuditEventsType auditEvent = new FindAuditEventsType(); auditEvent.setPatientId("D12345"); message.setFindAuditEvents(auditEvent); LogEventRequestType result = instance.logFindAuditEvents(message, NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE); assertNotNull(result); assertEquals(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, result.getDirection()); assertNotNull(result.getAuditMessage()); }

Target:
public void testLogFindAuditEvents() { AuditRepositoryLogger instance = new AuditRepositoryLogger(); FindAuditEventsMessageType message = new FindAuditEventsMessageType(); FindAuditEventsType auditEvent = new FindAuditEventsType(); auditEvent.setPatientId("D12345"); message.setFindAuditEvents(auditEvent); LogEventRequestType result = instance.logFindAuditEvents(message, NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE); assertNotNull(result); assertEquals(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, result.getDirection()); assertNotNull(result.getAuditMessage()); }
Source:
public CompletableFuture<SlotProfile> getSlotProfileFuture(ExecutionSlotSharingGroup executionSlotSharingGroup) { ResourceProfile totalSlotResourceProfile = ResourceProfile.ZERO; Collection<AllocationID> priorAllocations = new HashSet<>(); Collection<CompletableFuture<Collection<TaskManagerLocation>>> preferredLocationsPerExecution = new ArrayList<>(); for (ExecutionVertexID execution : executionSlotSharingGroup.getExecutionVertexIds()) { totalSlotResourceProfile = totalSlotResourceProfile.merge(resourceProfileRetriever.apply(execution)); priorAllocations.add(prioAllocationIdRetriever.apply(execution)); preferredLocationsPerExecution.add(preferredLocationsRetriever .getPreferredLocations(execution, producersToIgnore)); } CompletableFuture<Collection<TaskManagerLocation>> preferredLocationsFuture = FutureUtils .combineAll(preferredLocationsPerExecution) .thenApply(executionPreferredLocations -> executionPreferredLocations.stream().flatMap(Collection::stream).collect(Collectors.toSet())); ResourceProfile physicalSlotResourceProfile = totalSlotResourceProfile; return preferredLocationsFuture.thenApply( preferredLocations -> SlotProfile.priorAllocation( physicalSlotResourceProfile, physicalSlotResourceProfile, preferredLocations, priorAllocations, allBulkPriorAllocationIds)); }

Target:
public CompletableFuture<SlotProfile> getSlotProfileFuture(ExecutionSlotSharingGroup executionSlotSharingGroup) { ResourceProfile totalSlotResourceProfile = ResourceProfile.ZERO; Collection<AllocationID> priorAllocations = new HashSet<>(); Collection<CompletableFuture<Collection<TaskManagerLocation>>> preferredLocationsPerExecution = new ArrayList<>(); for (ExecutionVertexID execution : executionSlotSharingGroup.getExecutionVertexIds()) { totalSlotResourceProfile = totalSlotResourceProfile.merge(resourceProfileRetriever.apply(execution)); priorAllocations.add(priorAllocationIdRetriever.apply(execution)); preferredLocationsPerExecution.add(preferredLocationsRetriever .getPreferredLocations(execution, producersToIgnore)); } CompletableFuture<Collection<TaskManagerLocation>> preferredLocationsFuture = FutureUtils .combineAll(preferredLocationsPerExecution) .thenApply(executionPreferredLocations -> executionPreferredLocations.stream().flatMap(Collection::stream).collect(Collectors.toList())); ResourceProfile physicalSlotResourceProfile = totalSlotResourceProfile; return preferredLocationsFuture.thenApply( preferredLocations -> SlotProfile.priorAllocation( physicalSlotResourceProfile, physicalSlotResourceProfile, preferredLocations, priorAllocations, allBulkPriorAllocationIds)); }
Source:
public Reference getReference() throws NamingException { Reference ref = createReference(); StringBuilder serverString = new StringBuilder(); for (String serverName : serverNames) { if (serverString.length() > 0) { serverString.append(","); } serverString.append(serverName); } ref.add(new StringRefAddr("serverName", serverString.toString())); if (portNumbers != null) { StringBuilder portString = new StringBuilder(); for (int i = 0; i < portNumbers.length; i++) { if (i > 0) { portString.append(","); } int p = portNumbers[i]; portString.append(Integer.toString(p)); } ref.add(new StringRefAddr("portNumber", portString.toString())); } ref.add(new StringRefAddr("databaseName", databaseName)); if (user != null) { ref.add(new StringRefAddr("user", user)); } if (password != null) { ref.add(new StringRefAddr("password", password)); } for (PGProperty property : PGProperty.values()) { if (property.isPresent(properties)) { ref.add(new StringRefAddr(property.getName(), property.get(properties))); } } return ref; }

Target:
public Reference getReference() throws NamingException { Reference ref = createReference(); StringBuilder serverString = new StringBuilder(); for (int i = 0; i < serverNames.length; i++) { if (i > 0) { serverString.append(","); } String serverName = serverNames[i]; serverString.append(serverName); } ref.add(new StringRefAddr("serverName", serverString.toString())); StringBuilder portString = new StringBuilder(); for (int i = 0; i < portNumbers.length; i++) { if (i > 0) { portString.append(","); } int p = portNumbers[i]; portString.append(Integer.toString(p)); } ref.add(new StringRefAddr("portNumber", portString.toString())); ref.add(new StringRefAddr("databaseName", databaseName)); if (user != null) { ref.add(new StringRefAddr("user", user)); } if (password != null) { ref.add(new StringRefAddr("password", password)); } for (PGProperty property : PGProperty.values()) { if (property.isPresent(properties)) { ref.add(new StringRefAddr(property.getName(), property.get(properties))); } } return ref; }
Source:
public void setGuestCpuType(String value) { if (!Objects.equals(createdByUser, value)) { guestCpuType = value; onPropertyChanged(new PropertyChangedEventArgs("GuestCpuType")); } }

Target:
public void setGuestCpuType(String value) { if (!Objects.equals(guestCpuType, value)) { guestCpuType = value; onPropertyChanged(new PropertyChangedEventArgs("GuestCpuType")); } }
Source:
public CompletionStage<MetricsQueryResult> executeQuery(final BoundedMetricsQuery query) { return CompletableFuture.completedFuture(query).thenCompose(this::executeQueryInner); }

Target:
public CompletionStage<MetricsQueryResult> executeQuery(final BoundedMetricsQuery query) { try { return executeQueryInner(query); } catch (final Exception e) { final CompletableFuture<MetricsQueryResult> future = new CompletableFuture<>(); future.completeExceptionally(e); return future; } }
Source:
public static DataType<?> ofNameOrNull(String typeName) { return TYPES_BY_NAME_OR_ALIAS.getOrDefault(typeName, null); }

Target:
public static DataType<?> ofNameOrNull(String typeName) { return TYPES_BY_NAME_OR_ALIAS.get(typeName); }
Source:
public void setup() throws SourceUnavailableException, IngestException { when(mockMetacard1.getId()).thenReturn("1"); when(mockMetacard2.getId()).thenReturn("2"); when(mockMetacard1.getTitle()).thenReturn("title1"); when(mockMetacard2.getTitle()).thenReturn("title2"); when(deleteResponse.getDeletedMetacards()).thenReturn(ImmutableList.of(mockMetacard1)); when(catalogFramework.delete(any(DeleteRequest.class))).thenReturn(deleteResponse); when(catalogFramework.delete(any(DeleteRequestImpl.class))).thenReturn(deleteResponse); cmd = new SearchFormsManageCommand() { @Override protected List<Metacard> retrieveSystemMetacards() { return ImmutableList.of(mockMetacard1, mockMetacard2); } }; cmd.catalogFramework = catalogFramework; }

Target:
public void setup() throws SourceUnavailableException, IngestException { when(mockMetacard1.getId()).thenReturn("1"); when(mockMetacard2.getId()).thenReturn("2"); when(mockMetacard1.getTitle()).thenReturn("title1"); when(mockMetacard2.getTitle()).thenReturn("title2"); when(deleteResponse.getDeletedMetacards()).thenReturn(ImmutableList.of(mockMetacard1)); when(catalogFramework.delete(any(DeleteRequest.class))).thenReturn(deleteResponse); when(endpointUtil.getMetacardListByTag(SYSTEM_TEMPLATE)) .thenReturn(ImmutableList.of(mockMetacard1, mockMetacard2)); cmd = new SearchFormsManageCommand(); cmd.setEndpointUtil(endpointUtil); cmd.setCatalogFramework(catalogFramework); }
Source:
private boolean verifyAllHostsMountedDatastore(List<Pair<ManagedObjectReference, String>> lstHosts, DatastoreMO dsMO) throws Exception { int numHostsChecked = 0; for (Pair<ManagedObjectReference, String> host : lstHosts) { ManagedObjectReference morHostToMatch = host.first(); HostMO hostToMatchMO = new HostMO(dsMO.getContext(), morHostToMatch); List<DatastoreHostMount> datastoreHostMounts = dsMO.getHostMounts(); for (DatastoreHostMount datastoreHostMount : datastoreHostMounts) { ManagedObjectReference morHost = datastoreHostMount.getKey(); HostMO hostMO = new HostMO(dsMO.getContext(), morHost); if (hostMO.getHostName().equals(hostToMatchMO.getHostName())) { if (datastoreHostMount.getMountInfo().isMounted() && datastoreHostMount.getMountInfo().isAccessible()) { numHostsChecked++; } else { return false; } } } } return lstHosts.size() == numHostsChecked; }

Target:
private boolean verifyAllHostsMountedDatastore(List<Pair<ManagedObjectReference, String>> lstHosts, DatastoreMO dsMO) throws Exception { List<HostMO> hostMOs = new ArrayList<>(lstHosts.size()); for (Pair<ManagedObjectReference, String> host : lstHosts) { ManagedObjectReference morHostToMatch = host.first(); HostMO hostToMatchMO = new HostMO(dsMO.getContext(), morHostToMatch); hostMOs.add(hostToMatchMO); } return verifyAllHostsMountedDatastore2(hostMOs, dsMO); }
Source:
private static Set<AccountGroup.Id> groupsFor( SchemaFactory<ReviewDb> dbfactory, String[] groupNames) { final Set<AccountGroup.Id> result = new HashSet<AccountGroup.Id>(); ReviewDb db = null; try { db = dbfactory.open(); for (String name : groupNames) { AccountGroup group = db.accountGroups().get(new AccountGroup.NameKey(name)); if (group == null) { log.warn("Group \"" + name + "\" not in database," + " removing from authGroup"); } else { result.add(group.getId()); } } } catch (OrmException e) { log.error("Database error: " + e); } finally { db.close(); } return result; }

Target:
private static Set<AccountGroup.Id> groupsFor( SchemaFactory<ReviewDb> dbfactory, String[] groupNames) { final Set<AccountGroup.Id> result = new HashSet<AccountGroup.Id>(); try { final ReviewDb db = dbfactory.open(); try { for (String name : groupNames) { AccountGroup group = db.accountGroups().get(new AccountGroup.NameKey(name)); if (group == null) { log.warn("Group \"" + name + "\" not in database," + " removing from authGroup"); } else { result.add(group.getId()); } } } finally { db.close(); } } catch (OrmException e) { log.error("Database error: " + e); } return result; }