auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testHappyPath() throws Exception { CoordinatorEventBlockingQueue eventBlockingQueue = new CoordinatorEventBlockingQueue(); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(false)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(true)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); }

Target:
public void testHappyPath() throws Exception { CoordinatorEventBlockingQueue eventBlockingQueue = new CoordinatorEventBlockingQueue(); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); Assert.assertEquals(eventBlockingQueue.size(), 5); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(false)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(true)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); }
Source:
public ChangeTable() { keysNavigation.add(new PrevKeyCommand(0, 'k', Util.C.changeTablePrev())); keysNavigation.add(new NextKeyCommand(0, 'j', Util.C.changeTableNext())); keysNavigation.add(new OpenKeyCommand(0, 'o', Util.C.changeTableOpen())); keysNavigation.add(new OpenKeyCommand(0, KeyCodes.KEY_ENTER, Util.C .changeTableOpen())); if (Gerrit.isSignedIn()) { keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar())); } sections = new ArrayList<Section>(); table.setText(0, C_STAR, ""); table.setText(0, C_ID, Util.C.changeTableColumnID()); table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject()); table.setText(0, C_OWNER, Util.C.changeTableColumnOwner()); table.setText(0, C_PROJECT, Util.C.changeTableColumnProject()); table.setText(0, C_BRANCH, "Branch"); table.setText(0, C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate()); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(0, C_STAR, S_ICON_HEADER); fmt.addStyleName(0, C_ID, S_C_ID); for (int i = C_ID; i < COLUMNS; i++) { fmt.addStyleName(0, i, S_DATA_HEADER); } table.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { final Cell cell = table.getCellForEvent(event); if (cell == null) { return; } if (cell.getCellIndex() == C_STAR) { onStarClick(cell.getRowIndex()); } else if (cell.getCellIndex() == C_OWNER) { } else if (getRowItem(cell.getRowIndex()) != null) { movePointerTo(cell.getRowIndex()); } } }); }

Target:
public ChangeTable() { keysNavigation.add(new PrevKeyCommand(0, 'k', Util.C.changeTablePrev())); keysNavigation.add(new NextKeyCommand(0, 'j', Util.C.changeTableNext())); keysNavigation.add(new OpenKeyCommand(0, 'o', Util.C.changeTableOpen())); keysNavigation.add(new OpenKeyCommand(0, KeyCodes.KEY_ENTER, Util.C .changeTableOpen())); if (Gerrit.isSignedIn()) { keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar())); } sections = new ArrayList<Section>(); table.setText(0, C_STAR, ""); table.setText(0, C_ID, Util.C.changeTableColumnID()); table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject()); table.setText(0, C_OWNER, Util.C.changeTableColumnOwner()); table.setText(0, C_PROJECT, Util.C.changeTableColumnProject()); table.setText(0, C_BRANCH, Util.C.changeTableColumnBranch()); table.setText(0, C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate()); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(0, C_STAR, S_ICON_HEADER); fmt.addStyleName(0, C_ID, S_C_ID); for (int i = C_ID; i < COLUMNS; i++) { fmt.addStyleName(0, i, S_DATA_HEADER); } table.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { final Cell cell = table.getCellForEvent(event); if (cell == null) { return; } if (cell.getCellIndex() == C_STAR) { onStarClick(cell.getRowIndex()); } else if (cell.getCellIndex() == C_OWNER) { } else if (getRowItem(cell.getRowIndex()) != null) { movePointerTo(cell.getRowIndex()); } } }); }
Source:
public void test_should_not_analyze_if_project_is_disposed() throws IOException, JDOMException { String projectFilePath = myProject.getProjectFilePath(); PlatformTestUtil.forceCloseProjectWithoutSaving(myProject); assertThat(exclusions.canAnalyze(testFile, getModule()).isExcluded()).isTrue(); myProject = ProjectManager.getInstance().loadAndOpenProject(projectFilePath); }

Target:
public void test_should_not_analyze_if_project_is_disposed() throws IOException, JDOMException { PlatformTestUtil.forceCloseProjectWithoutSaving(myProject); assertThat(exclusions.canAnalyze(testFile, getModule()).isExcluded()).isTrue(); }
Source:
public void once() { CompletableSubject ms = CompletableSubject.create(); TestObserver<Void> to = ms.test(); ms.onComplete(); List<Throwable> errors = TestHelper.trackPluginErrors(); try { ms.onError(new IOException()); TestHelper.assertError(errors, 0, IOException.class); } finally { RxJavaPlugins.reset(); } ms.onComplete(); to.assertResult(); }

Target:
public void once() { CompletableSubject cs = CompletableSubject.create(); TestObserver<Void> to = cs.test(); cs.onComplete(); List<Throwable> errors = TestHelper.trackPluginErrors(); try { cs.onError(new IOException()); TestHelper.assertError(errors, 0, IOException.class); } finally { RxJavaPlugins.reset(); } cs.onComplete(); to.assertResult(); }
Source:
protected Builder() { super(NeutronApi.class); id("openstack-neutron") .name("OpenStack Neutron API") .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") .credentialName("${password}") .endpointName("KeyStone base url ending in /v2.0/") .documentation(URI.create("<LINK_0>")) .version("2.0") .defaultEndpoint("http://localhost:5000/v2.0/") .defaultProperties(NeutronApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.<Class<? extends Module>>builder() .add(AuthenticationApiModule.class) .add(KeystoneAuthenticationModule.class) .add(ZoneModule.class) .add(NeutronHttpApiModule.class).build()); }

Target:
protected Builder() { super(NeutronApi.class); id("openstack-neutron") .name("OpenStack Neutron API") .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") .credentialName("${password}") .endpointName("Neutron base url ending in /v2.0/") .documentation(URI.create("<LINK_0>")) .version("2.0") .defaultEndpoint("http://localhost:5000/v2.0/") .defaultProperties(NeutronApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.<Class<? extends Module>>builder() .add(AuthenticationApiModule.class) .add(KeystoneAuthenticationModule.class) .add(ZoneModule.class) .add(NeutronHttpApiModule.class).build()); }
Source:
private static void appendBodyColorsRule(StringBuilder buffer, RGB fgRGB, RGB bgRGB) { StringBuilder fg= new StringBuilder(); appendColor(fg, fgRGB); StringBuilder bg= new StringBuilder(); appendColor(bg, bgRGB); buffer.append("body {color:"); appendColor(buffer, fgRGB); buffer.append("; background-color:"); appendColor(buffer, bgRGB); buffer.append(";}"); }

Target:
private static void appendBodyColorsRule(StringBuilder buffer, RGB fgRGB, RGB bgRGB) { buffer.append("body {color:"); appendColor(buffer, fgRGB); buffer.append("; background-color:"); appendColor(buffer, bgRGB); buffer.append(";}"); }
Source:
public void execute(JobExecutionContext context) throws JobExecutionException { try { MDC.put("requestType", "job"); MDC.put("requestUuid", context.getJobDetail().getKey().getName()); } catch (NullPointerException npe) { } boolean startedUow = startUnitOfWork(); try { toExecute(context); } catch (PersistenceException e) { int maxRefires = getMaxRetries(); boolean refire = maxRefires < 0 || context.getRefireCount() < maxRefires; log.error("Persistence exception caught running pinsetter task. Refire: " + refire, e); throw new JobExecutionException(e, refire); } finally { if (startedUow) { endUnitOfWork(); } } }

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { try { MDC.put("requestType", "job"); MDC.put("requestUuid", context.getJobDetail().getKey().getName()); } catch (NullPointerException npe) { } boolean startedUow = startUnitOfWork(); try { toExecute(context); } catch (PersistenceException e) { int maxRefires = getMaxRetries(); boolean refire = maxRefires < 0 || context.getRefireCount() < maxRefires; log.error("Persistence exception caught running pinsetter task. Attempt: " + context.getRefireCount() + ", Refire: " + refire, e); throw new JobExecutionException(e, refire); } finally { if (startedUow) { endUnitOfWork(); } } }
Source:
public Set<Rule> parse(InputStreamReader reader) throws ParsingException { JsonReader jr = new JsonReader(reader); try { Set<Rule> rules = new HashSet<>(); if (jr.hasNext()) { JsonToken token = jr.peek(); if (JsonToken.BEGIN_ARRAY.equals(token)) { Rule[] parsedRules = gson.fromJson(jr, Rule[].class); rules.addAll(Arrays.asList(parsedRules)); } else { Rule rule = gson.fromJson(jr, Rule.class); rules.add(rule); } return rules; } } catch (Exception e) { e.printStackTrace(); throw new ParsingException(new ParsingNestedException(ParsingNestedException.RULE, null, e)); } finally { try { jr.close(); } catch (IOException e) { } } return Collections.emptySet(); }

Target:
public Set<Rule> parse(InputStreamReader reader) throws ParsingException { JsonReader jr = new JsonReader(reader); try { Set<Rule> rules = new HashSet<>(); if (jr.hasNext()) { JsonToken token = jr.peek(); if (JsonToken.BEGIN_ARRAY.equals(token)) { rules.addAll(gson.fromJson(jr, new TypeToken<List<Rule>>() { }.getType())); } else { Rule rule = gson.fromJson(jr, Rule.class); rules.add(rule); } return rules; } } catch (Exception e) { throw new ParsingException(new ParsingNestedException(ParsingNestedException.RULE, null, e)); } finally { try { jr.close(); } catch (IOException e) { } } return Collections.emptySet(); }
Source:
public void testCompleteMapping() { final ActivityCalendar activityCalendar = new ActivityCalendarBuilder().withCosemDateTime(this.cosemDateTime) .withFilledList().build(); final ActivityCalendarDto activityCalendarDto = this.configurationMapper.map(activityCalendar, ActivityCalendarDto.class); assertNotNull(activityCalendar); assertNotNull(activityCalendarDto); assertNotNull(activityCalendarDto.getActivatePassiveCalendarTime()); assertNotNull(activityCalendarDto.getSeasonProfileList()); assertEquals(activityCalendar.getCalendarName(), activityCalendarDto.getCalendarName()); this.checkListMapping(activityCalendar.getSeasonProfileList(), activityCalendarDto.getSeasonProfileList()); this.checkCosemDateTimeMapping(activityCalendar.getActivatePassiveCalendarTime(), activityCalendarDto.getActivatePassiveCalendarTime()); }

Target:
public void testCompleteMapping() { final ActivityCalendar activityCalendar = new ActivityCalendarBuilder().withCosemDateTime(this.cosemDateTime) .withFilledList().build(); final ActivityCalendarDto activityCalendarDto = this.configurationMapper.map(activityCalendar, ActivityCalendarDto.class); assertNotNull(activityCalendarDto); assertNotNull(activityCalendarDto.getActivatePassiveCalendarTime()); assertNotNull(activityCalendarDto.getSeasonProfileList()); assertEquals(activityCalendar.getCalendarName(), activityCalendarDto.getCalendarName()); this.checkListMapping(activityCalendar.getSeasonProfileList(), activityCalendarDto.getSeasonProfileList()); this.checkCosemDateTimeMapping(activityCalendar.getActivatePassiveCalendarTime(), activityCalendarDto.getActivatePassiveCalendarTime()); }
Source:
public Group groupDifference(PerunSession sess, Group resultGroup, Group operandGroup) throws InternalErrorException, GroupNotExistsException, PrivilegeException, WrongReferenceAttributeValueException, NotGroupMemberException, AlreadyMemberException, NotMemberOfParentGroupException, WrongAttributeValueException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, resultGroup); getGroupsManagerBl().checkGroupExists(sess, operandGroup); if ( (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, resultGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, resultGroup)) || (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, operandGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, operandGroup)) ) { throw new PrivilegeException(sess, "groupDifference"); } Group result = getGroupsManagerBl().groupDifference(sess, resultGroup, operandGroup); return result; }

Target:
public Group groupDifference(PerunSession sess, Group resultGroup, Group operandGroup) throws InternalErrorException, GroupNotExistsException, PrivilegeException, GroupOperationsException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, resultGroup); getGroupsManagerBl().checkGroupExists(sess, operandGroup); if ( (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, resultGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, resultGroup)) || (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, operandGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, operandGroup)) ) { throw new PrivilegeException(sess, "groupDifference"); } return getGroupsManagerBl().groupDifference(sess, resultGroup, operandGroup); }
Source:
private boolean isAcceptableType(JavaType arg, JavaType formal, boolean autoboxing) { if(formal.isTagged(JavaType.TYPEVAR) && !arg.isTagged(JavaType.TYPEVAR)) { return subtypeOfTypeVar(arg, ((JavaType.TypeVariableJavaType) formal)); } if (isParametrizedType(arg) || isParametrizedType(formal) || isWilcardType(arg) || isWilcardType(formal)) { return types.isSubtype(arg, formal) || isAcceptableByAutoboxing(arg, formal.erasure()); } return types.isSubtype(arg.erasure(), formal.erasure()) || (autoboxing && isAcceptableByAutoboxing(arg, formal.erasure())); }

Target:
private boolean isAcceptableType(JavaType arg, JavaType formal, boolean autoboxing) { if(formal.isTagged(JavaType.TYPEVAR) && !arg.isTagged(JavaType.TYPEVAR)) { return subtypeOfTypeVar(arg, (JavaType.TypeVariableJavaType) formal); } if (isParametrizedType(arg) || isParametrizedType(formal) || isWilcardType(arg) || isWilcardType(formal)) { return types.isSubtype(arg, formal) || isAcceptableByAutoboxing(arg, formal.erasure()); } return types.isSubtype(arg.erasure(), formal.erasure()) || (autoboxing && isAcceptableByAutoboxing(arg, formal.erasure())); }
Source:
private void handleColorTemperatureCommand(Command command) { if (command instanceof PercentType) { PercentType newValue = (PercentType) command; if (!state.getColorTemperature().equals(newValue)) { setColorTemperature(newValue); } else { logger.debug("Skipping setting the same value for ColorTemperature: {}", newValue.toBigDecimal()); } } else if (command instanceof IncreaseDecreaseType) { if (state != null && state.getColorTemperature() != null) { int current = state.getColorTemperature().intValue(); if (IncreaseDecreaseType.INCREASE.equals(command)) { setColorTemperature(new PercentType(Math.min(current + STEP, PercentType.HUNDRED.intValue()))); } else { setColorTemperature(new PercentType(Math.max(current - STEP, PercentType.ZERO.intValue()))); } } else { logger.debug("Cannot handle inc/dec as current state is not known."); } } else { logger.debug("Can't handle command on channel {}", command, CHANNEL_COLOR_TEMPERATURE); } }

Target:
private void handleColorTemperatureCommand(Command command) { if (command instanceof PercentType) { setColorTemperature((PercentType) command); } else if (command instanceof IncreaseDecreaseType) { if (state != null && state.getColorTemperature() != null) { int current = state.getColorTemperature().intValue(); if (IncreaseDecreaseType.INCREASE.equals(command)) { setColorTemperature(new PercentType(Math.min(current + STEP, PercentType.HUNDRED.intValue()))); } else { setColorTemperature(new PercentType(Math.max(current - STEP, PercentType.ZERO.intValue()))); } } else { logger.debug("Cannot handle inc/dec as current state is not known."); } } else { logger.debug("Can't handle command on channel {}", command, CHANNEL_COLOR_TEMPERATURE); } }
Source:
public String toString() { if (buffer == null) { return typeIndex + " " + supertypeIndex; } StringBuilder result = new StringBuilder(); result.append(buffer.typeNames().get(typeIndex)); if (supertypeIndex != NO_INDEX) { result.append(" extends ").append(buffer.typeNames().get(supertypeIndex)); } return result.toString(); }

Target:
public String toString() { if (buffer == null) { return typeIndex + " " + supertypeIndex; } StringBuilder result = new StringBuilder(); result.append(getTypeName()); if (supertypeIndex != NO_INDEX) { result.append(" extends ").append(buffer.typeNames().get(supertypeIndex)); } return result.toString(); }
Source:
public IStatus addComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = RIGHT_SIDE; String id = item.getId(); if (id.startsWith("base-")) { id = id.substring(5); side = LEFT_SIDE; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; SaveDraftRequest request = new SaveDraftRequest(key, lineLocation.getRangeMin(), side); request.setMessage(comment.getDescription()); if (comment.getId() != null && comment.getId().compareTo("") != 0) { request.setUuid(comment.getId()); } request.setParentUuid(comment.getParentId()); GerritOperation<PatchLineComment> operation = getOperationFactory().createSaveDraftOperation(getTask(), request); IStatus status = operation.run(monitor); PatchLineComment plc = operation.getOperationResult(); comment.setId(plc.getKey().get()); return status; } } throw new RuntimeException(Messages.GerritReviewBehavior_Internal_Exception + comment.getId()); }

Target:
public IStatus addComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = RIGHT_SIDE; String id = item.getId(); if (id.startsWith(BASE)) { id = id.substring(BASE.length()); side = LEFT_SIDE; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; SaveDraftRequest request = new SaveDraftRequest(key, lineLocation.getRangeMin(), side); request.setMessage(comment.getDescription()); if (comment.getId() != null && !(comment.getId().isEmpty())) { request.setUuid(comment.getId()); } request.setParentUuid(comment.getParentId()); GerritOperation<PatchLineComment> operation = getOperationFactory().createSaveDraftOperation(getTask(), request); IStatus status = operation.run(monitor); PatchLineComment plc = operation.getOperationResult(); comment.setId(plc.getKey().get()); return status; } } throw new RuntimeException(Messages.GerritReviewBehavior_Internal_Exception + comment.getId()); }
Source:
public final NativeRequest.Builder readNativeRequest(JsonParser par) throws IOException { if (emptyToNull(par)) { return null; } NativeRequest.Builder req = NativeRequest.newBuilder(); boolean rootNativeField = false; boolean firstField = true; for (startObject(par); endObject(par); par.nextToken()) { String fieldName = getCurrentName(par); if (par.nextToken() != JsonToken.VALUE_NULL) { if (firstField) { firstField = false; if ((rootNativeField = "native".equals(fieldName)) == true) { startObject(par); fieldName = getCurrentName(par); par.nextToken(); } } if (par.getCurrentToken() != JsonToken.VALUE_NULL) { readNativeRequestField(par, req, fieldName); } } } if (rootNativeField && par.getCurrentToken() == JsonToken.END_OBJECT) { par.nextToken(); } return req; }

Target:
public final NativeRequest.Builder readNativeRequest(JsonParser par) throws IOException { if (emptyToNull(par)) { return null; } NativeRequest.Builder req = NativeRequest.newBuilder(); boolean rootNativeField = false; boolean firstField = true; for (startObject(par); endObject(par); par.nextToken()) { String fieldName = getCurrentName(par); if (par.nextToken() != JsonToken.VALUE_NULL) { if (firstField) { firstField = false; if ((rootNativeField = "native".equals(fieldName)) == true) { startObject(par); fieldName = getCurrentName(par); par.nextToken(); } } if (par.getCurrentToken() != JsonToken.VALUE_NULL) { readNativeRequestField(par, req, fieldName); } } } if (rootNativeField && !endObject(par)) { par.nextToken(); } return req; }
Source:
private String getAdditionalFailureInfo(long allocated, long delta) { Map<String, Long> queryAllocations = memoryPool.getTaggedMemoryAllocations().get(queryId); String additionalInfo = format("Allocated: %s, Delta: %s", succinctBytes(allocated), succinctBytes(delta)); if (queryAllocations == null) { return additionalInfo; } String topConsumers = queryAllocations.entrySet().stream() .filter(entry -> !entry.getKey().equals(FORCE_FREE_TAG)) .sorted(comparingByValue(Comparator.reverseOrder())) .limit(3) .collect(toImmutableMap(Entry::getKey, e -> succinctBytes(e.getValue()))) .toString(); return format("%s, Top Consumers: %s", additionalInfo, topConsumers); }

Target:
private String getAdditionalFailureInfo(long allocated, long delta) { Map<String, Long> queryAllocations = memoryPool.getTaggedMemoryAllocations(queryId); String additionalInfo = format("Allocated: %s, Delta: %s", succinctBytes(allocated), succinctBytes(delta)); if (queryAllocations == null) { return additionalInfo; } String topConsumers = queryAllocations.entrySet().stream() .sorted(comparingByValue(Comparator.reverseOrder())) .limit(3) .collect(toImmutableMap(Entry::getKey, e -> succinctBytes(e.getValue()))) .toString(); return format("%s, Top Consumers: %s", additionalInfo, topConsumers); }
Source:
private void initialize() { if(Config.<Boolean>getValue(ConfigValues.PMHealthCheckEnabled)) { log.info("Start initializing {}", getClass().getSimpleName()); Integer pmHealthCheckInterval = Config.<Integer> getValue(ConfigValues.PMHealthCheckIntervalInSec); Injector.get(SchedulerUtilQuartzImpl.class).scheduleAFixedDelayJob(this, "pmHealthCheck", new Class[] {}, new Object[] {}, pmHealthCheckInterval, pmHealthCheckInterval, TimeUnit.SECONDS); } recover(vdsDao.getAll()); log.info("Finished initializing {}", getClass().getSimpleName()); lock = new ReentrantLock(); }

Target:
private void initialize() { if(Config.<Boolean>getValue(ConfigValues.PMHealthCheckEnabled)) { log.info("Start initializing {}", getClass().getSimpleName()); Integer pmHealthCheckInterval = Config.<Integer> getValue(ConfigValues.PMHealthCheckIntervalInSec); Injector.get(SchedulerUtilQuartzImpl.class).scheduleAFixedDelayJob(this, "pmHealthCheck", new Class[] {}, new Object[] {}, pmHealthCheckInterval, pmHealthCheckInterval, TimeUnit.SECONDS); } recover(vdsDao.getAll()); log.info("Finished initializing {}", getClass().getSimpleName()); }
Source:
public void initialize(Map<String, Param> params) throws TikaConfigException { try { TrainedModelHelper helper; switch (modelType) { case "VGG16NOTOP": throw new TikaConfigException("VGG16NOTOP is not supported right now"); case "VGG16": helper = new TrainedModelHelper(TrainedModels.VGG16); modelFile = new File(MODEL_DIR_PREPROCESSED + File.separator + "vgg16.zip"); locationToSave = new File(MODEL_DIR + File.separator + "tikaPreprocessed" + File.separator + "vgg16.zip"); break; default: throw new TikaConfigException("Unknown or unsupported model"); } if (serialize.trim().toLowerCase(Locale.ROOT).equals("yes")) { if (!modelFile.exists()) { LOG.warn("Preprocessed Model doesn't exist at {}", modelFile); modelFile.getParentFile().mkdirs(); model = helper.loadModel(); LOG.info("Saving the Loaded model for future use. Saved models are more optimised to consume less resources."); ModelSerializer.writeModel(model, locationToSave, true); available = true; } else { model = ModelSerializer.restoreComputationGraph(locationToSave); LOG.info("Preprocessed Model Loaded from {}", locationToSave); available = true; } } else if (serialize.trim().toLowerCase(Locale.ROOT).equals("no")) { LOG.info("Weight graph model loaded via dl4j Helper functions"); model = helper.loadModel(); available = true; } else { throw new TikaConfigException("Configuration Error. serialization can be either yes or no."); } if (!available) { return; } HashMap<Pattern, String> patterns = new HashMap<>(); patterns.put(Pattern.compile(outPattern), null); setMetadataExtractionPatterns(patterns); setIgnoredLineConsumer(IGNORED_LINE_LOGGER); } catch (Exception e) { LOG.warn("exception occured"); throw new TikaConfigException(e.getMessage(), e); } }

Target:
public void initialize(Map<String, Param> params) throws TikaConfigException { try { if (serialize) { if (locationToSave.exists()) { model = ModelSerializer.restoreComputationGraph(locationToSave); LOG.info("Preprocessed Model Loaded from {}", locationToSave); } else { LOG.warn("Preprocessed Model doesn't exist at {}", locationToSave); locationToSave.getParentFile().mkdirs(); model = MODEL_HELPER.loadModel(); LOG.info("Saving the Loaded model for future use. Saved models are more optimised to consume less resources."); ModelSerializer.writeModel(model, locationToSave, true); } } else { LOG.info("Weight graph model loaded via dl4j Helper functions"); model = MODEL_HELPER.loadModel(); } available = true; } catch (Exception e) { available = false; LOG.warn(e.getMessage(), e); throw new TikaConfigException(e.getMessage(), e); } }
Source:
private Change createChange(CreateChangeOperation operation, boolean updateStatus, IRunnableContext context){ InvocationTargetException exception= null; try { context.run((context == PlatformUI.getWorkbench().getActiveWorkbenchWindow()), fIsChangeCreationCancelable, new WorkbenchRunnableAdapter( operation, ResourcesPlugin.getWorkspace().getRoot())); } catch (InterruptedException e) { setConditionCheckingStatus(null); return null; } catch (InvocationTargetException e) { exception= e; } if (updateStatus) { RefactoringStatus status= null; if (exception != null) { status= new RefactoringStatus(); String msg= exception.getMessage(); if (msg != null) { status.addFatalError(Messages.format(RefactoringUIMessages.RefactoringWizard_see_log, msg)); } else { status.addFatalError(RefactoringUIMessages.RefactoringWizard_Internal_error); } RefactoringUIPlugin.log(exception); } else { status= operation.getConditionCheckingStatus(); } setConditionCheckingStatus(status, operation.getConditionCheckingStyle()); } else { if (exception != null) ExceptionHandler.handle(exception, getContainer().getShell(), RefactoringUIMessages.RefactoringWizard_refactoring, RefactoringUIMessages.RefactoringWizard_unexpected_exception); } Change change= operation.getChange(); return change; }

Target:
private Change createChange(CreateChangeOperation operation, boolean updateStatus, IRunnableContext context){ InvocationTargetException exception= null; try { context.run(true, fIsChangeCreationCancelable, new WorkbenchRunnableAdapter( operation, ResourcesPlugin.getWorkspace().getRoot())); } catch (InterruptedException e) { setConditionCheckingStatus(null); return null; } catch (InvocationTargetException e) { exception= e; } if (updateStatus) { RefactoringStatus status= null; if (exception != null) { status= new RefactoringStatus(); String msg= exception.getMessage(); if (msg != null) { status.addFatalError(Messages.format(RefactoringUIMessages.RefactoringWizard_see_log, msg)); } else { status.addFatalError(RefactoringUIMessages.RefactoringWizard_Internal_error); } RefactoringUIPlugin.log(exception); } else { status= operation.getConditionCheckingStatus(); } setConditionCheckingStatus(status, operation.getConditionCheckingStyle()); } else { if (exception != null) ExceptionHandler.handle(exception, getContainer().getShell(), RefactoringUIMessages.RefactoringWizard_refactoring, RefactoringUIMessages.RefactoringWizard_unexpected_exception); } Change change= operation.getChange(); return change; }
Source:
public void testDecalin() throws Exception { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C1CCC2CCCCC2C1"); DescriptorValue value = descriptor.calculate(mol); Assert.assertEquals(0, ((IntegerResult) value.getValue()).intValue()); Assert.assertEquals(1, value.getNames().length); Assert.assertEquals("nSpiroAtoms", value.getNames()[0]); Assert.assertEquals(descriptor.getDescriptorNames()[0], value.getNames()[0]); }

Target:
public void testDecalin() throws Exception { IAtomContainer mol = sp.parseSmiles("C1CCC2CCCCC2C1"); DescriptorValue value = descriptor.calculate(mol); Assert.assertEquals(0, ((IntegerResult) value.getValue()).intValue()); Assert.assertEquals(1, value.getNames().length); Assert.assertEquals("nSpiroAtoms", value.getNames()[0]); Assert.assertEquals(descriptor.getDescriptorNames()[0], value.getNames()[0]); }
Source:
public static OzoneObjInfo fromProtobuf(OzoneManagerProtocolProtos.OzoneObj proto) { Builder builder = new Builder() .setResType(ResourceType.valueOf(proto.getResType().name())) .setStoreType(StoreType.valueOf(proto.getStoreType().name())); StringTokenizer tokenizer = new StringTokenizer(proto.getPath(), OzoneConsts.OZONE_URI_DELIMITER); if (tokenizer.hasMoreTokens()) { builder.setVolumeName(tokenizer.nextToken()); } if (tokenizer.hasMoreTokens()) { builder.setBucketName(tokenizer.nextToken()); } StringBuffer sb = new StringBuffer(); while (tokenizer.hasMoreTokens()) { sb.append(OzoneConsts.OZONE_URI_DELIMITER); sb.append(tokenizer.nextToken()); sb.append(OzoneConsts.OZONE_URI_DELIMITER); } builder.setKeyName(sb.toString()); return builder.build(); }

Target:
public static OzoneObjInfo fromProtobuf(OzoneManagerProtocolProtos.OzoneObj proto) { Builder builder = new Builder() .setResType(ResourceType.valueOf(proto.getResType().name())) .setStoreType(StoreType.valueOf(proto.getStoreType().name())); StringTokenizer tokenizer = new StringTokenizer(proto.getPath(), OzoneConsts.OZONE_URI_DELIMITER); if (tokenizer.hasMoreTokens()) { builder.setVolumeName(tokenizer.nextToken()); } if (tokenizer.hasMoreTokens()) { builder.setBucketName(tokenizer.nextToken()); } if (tokenizer.hasMoreTokens()) { StringBuffer sb = new StringBuffer(); while (tokenizer.hasMoreTokens()) { sb.append(OzoneConsts.OZONE_URI_DELIMITER); sb.append(tokenizer.nextToken()); sb.append(OzoneConsts.OZONE_URI_DELIMITER); } builder.setKeyName(sb.toString()); } return builder.build(); }
Source:
GPUDriver(Configuration config) throws Exception { final String discoveryScriptPath = config.getString(DISCOVERY_SCRIPT_PATH); if (StringUtils.isNullOrWhitespaceOnly(discoveryScriptPath)) { throw new FlinkException("Could not find config of the path of gpu discovery script."); } discoveryScript = new File(System.getenv().getOrDefault(ConfigConstants.ENV_FLINK_HOME_DIR, ".") + "/" + discoveryScriptPath); if (!discoveryScript.exists()) { throw new FlinkException("The gpu discovery script does not exist in path " + discoveryScript.getAbsolutePath()); } args = config.getString(DISCOVERY_SCRIPT_ARG); }

Target:
GPUDriver(Configuration config) throws Exception { final String discoveryScriptPathStr = config.getString(DISCOVERY_SCRIPT_PATH); if (StringUtils.isNullOrWhitespaceOnly(discoveryScriptPathStr)) { throw new IllegalConfigurationException( String.format("GPU discovery script ('%s') is not configured.", ExternalResourceOptions.genericKeyWithSuffix(DISCOVERY_SCRIPT_PATH.key()))); } Path discoveryScriptPath = Paths.get(discoveryScriptPathStr); if (!discoveryScriptPath.isAbsolute()) { discoveryScriptPath = Paths.get(System.getenv().getOrDefault(ConfigConstants.ENV_FLINK_HOME_DIR, "."), discoveryScriptPathStr); } discoveryScriptFile = discoveryScriptPath.toFile(); if (!discoveryScriptFile.exists()) { throw new FileNotFoundException(String.format("The gpu discovery script does not exist in path %s.", discoveryScriptFile.getAbsolutePath())); } if (!discoveryScriptFile.canExecute()) { throw new FlinkException(String.format("The discovery script %s is not executable.", discoveryScriptFile.getAbsolutePath())); } args = config.getString(DISCOVERY_SCRIPT_ARG); }
Source:
Mono<Response<ConfigurationSetting>> addSetting(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.setKey(serviceEndpoint, setting.getKey(), setting.getLabel(), setting, null, getETagValue(ETAG_ANY), context) .onErrorResume((Function<Throwable, Mono<Response<ConfigurationSetting>>>) throwable -> { if (throwable instanceof HttpResponseException) { final HttpResponseException e = (HttpResponseException) throwable; final HttpResponse httpResponse = e.getResponse(); if (httpResponse.getStatusCode() == 412) { return Mono.error(new ResourceExistsException("Setting was already present.", httpResponse, throwable)); } } return Mono.error(throwable); }) .doOnSubscribe(ignoredValue -> logger.info("Adding ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Added ConfigurationSetting - {}", response.getValue())) .onErrorMap(ConfigurationAsyncClient::addSettingExceptionMapper) .doOnError(error -> logger.warning("Failed to add ConfigurationSetting - {}", setting, error)); }

Target:
Mono<Response<ConfigurationSetting>> addSetting(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.setKey(serviceEndpoint, setting.getKey(), setting.getLabel(), setting, null, getETagValue(ETAG_ANY), context) .onErrorResume(HttpResponseException.class, (Function<Throwable, Mono<Response<ConfigurationSetting>>>) throwable -> { final HttpResponseException e = (HttpResponseException) throwable; final HttpResponse httpResponse = e.getResponse(); if (httpResponse.getStatusCode() == 412) { return Mono.error(new ResourceExistsException("Setting was already present.", httpResponse, throwable)); } return Mono.error(throwable); }) .doOnSubscribe(ignoredValue -> logger.info("Adding ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Added ConfigurationSetting - {}", response.getValue())) .onErrorMap(ConfigurationAsyncClient::addSettingExceptionMapper) .doOnError(error -> logger.warning("Failed to add ConfigurationSetting - {}", setting, error)); }
Source:
protected VDSReturnValue getStatsForDomain() { VDS spmVds = LinqUtils.first(getAllRunningVdssInPool()); return runVdsCommand(VDSCommandType.GetStorageDomainStats, new GetStorageDomainStatsVDSCommandParameters(spmVds.getId(), getParameters().getStorageDomainId())); }

Target:
protected VDSReturnValue getStatsForDomain() { VDS vds = LinqUtils.first(getAllRunningVdssInPool()); return runVdsCommand(VDSCommandType.GetStorageDomainStats, new GetStorageDomainStatsVDSCommandParameters(vds.getId(), getParameters().getStorageDomainId())); }
Source:
public String getLine(int lineIndex) { try { final IRegion lineRegion = getLineInformation(lineIndex); return document.get(lineRegion.getOffset(), lineRegion.getLength()); } catch (BadLocationException e) { ConsolePlugin.log(e); return null; } }

Target:
public String getLine(int lineIndex) { try { final IRegion lineRegion = getLineInformation(lineIndex); return document.get(lineRegion.getOffset(), lineRegion.getLength()); } catch (BadLocationException e) { ConsolePlugin.log(e); return ""; } }
Source:
private <A> boolean all(List<A> list, Function<A, Boolean> predicate) { for (A a : list) if (!predicate.apply(a)) return false; return true; }

Target:
private static <A> boolean all(List<A> list, Function<A, Boolean> predicate) { for (A a : list) if (!predicate.apply(a)) return false; return true; }
Source:
protected void postProcessReplyProducer(AbstractReplyProducingMessageHandler handler) { if (this.sendTimeout != null) { handler.setSendTimeout(sendTimeout); } if (this.requiresReply != null) { handler.setRequiresReply(requiresReply); } if (!(handler instanceof AbstractMessageSplitter)) { Assert.isNull(this.applySequence, "Cannot set applySequence if the referenced bean is " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); Assert.isNull(this.delimiters, "Cannot set delimiters if the referenced bean is not an " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); } else { AbstractMessageSplitter splitter = (AbstractMessageSplitter) handler; if (this.delimiters != null) { Assert.isTrue(splitter instanceof DefaultMessageSplitter, "The 'delimiters' property is only available" + " for a Splitter definition where no 'ref', 'expression', or inner bean has been provided."); ((DefaultMessageSplitter) splitter).setDelimiters(this.delimiters); } if (this.applySequence != null) { splitter.setApplySequence(applySequence); } else { splitter.setApplySequence(true); } } }

Target:
protected void postProcessReplyProducer(AbstractReplyProducingMessageHandler handler) { if (this.sendTimeout != null) { handler.setSendTimeout(sendTimeout); } if (this.requiresReply != null) { handler.setRequiresReply(requiresReply); } if (!(handler instanceof AbstractMessageSplitter)) { Assert.isNull(this.applySequence, "Cannot set applySequence if the referenced bean is " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); Assert.isNull(this.delimiters, "Cannot set delimiters if the referenced bean is not an " + "an AbstractReplyProducingMessageHandler, but not an AbstractMessageSplitter"); } else { AbstractMessageSplitter splitter = (AbstractMessageSplitter) handler; if (this.delimiters != null) { Assert.isTrue(splitter instanceof DefaultMessageSplitter, "The 'delimiters' property is only available" + " for a Splitter definition where no 'ref', 'expression', or inner bean has been provided."); ((DefaultMessageSplitter) splitter).setDelimiters(this.delimiters); } if (this.applySequence != null) { splitter.setApplySequence(applySequence); } } }
Source:
public void printK(K result, KRunOptions options, CompiledDefinition compiledDef) { Set<String> patternVariables = new HashSet<>(); StringBuilder sb = new StringBuilder(); if (options.pattern != null) { new VisitK() { @Override public void apply(KVariable k) { patternVariables.add(k.name()); super.apply(k); } }.apply(parsePattern(files, kem, options.pattern, compiledDef, Source.apply("<command line: --pattern>")).body()); } if (result instanceof KApply && ((KApply) result).klabel().equals(KLabel(KLabels.OR))) { Some<Tuple2<KLabel, scala.collection.immutable.List<K>>> searchResults = KApply$.MODULE$.unapply((KApply) result); scala.collection.Seq<K> seq = Assoc.flatten(KORE.KLabel(KLabels.OR), searchResults.get()._2(), KORE.KLabel(KLabels.ML_FALSE)); List<K> resultList = mutable(seq).stream().filter(x -> !x.getClass().toString().contains("BoolToken")).collect(Collectors.toList()); resultList.sort(Comparator.comparing(K::toString)); Set<String> observedResults = new HashSet<>(); if (resultList.size() == 0) { sb.append("No Search Results\n"); } else { int index = 1; for (int i = 0; i < resultList.size(); ++i) { String conjunctString = filterAnonVarsAndPrint(resultList.get(i), patternVariables, compiledDef, options).toString(); if (!(conjunctString.trim().isEmpty()) && !observedResults.contains(conjunctString)) { sb.append("Solution " + index++ + "\n"); sb.append(conjunctString); observedResults.add(conjunctString); } } if (index == 1) { sb.append("No Search Results\n"); } } outputFile(sb.toString(), options); return; } else if (result.getClass().toString().contains("BoolToken")) { outputFile("No Search Results\n", options); return; } outputFile(filterAnonVarsAndPrint(result, patternVariables, compiledDef, options).toString(), options); }

Target:
public void printK(K result, KRunOptions options, CompiledDefinition compiledDef) { Set<String> patternVariables = getPatternVariableNames(options, compiledDef); StringBuilder sb = new StringBuilder(); if (result instanceof KApply && ((KApply) result).klabel().equals(KLabel(KLabels.ML_OR))) { List<K> resultList = Assoc.flatten(KLabel(KLabels.ML_OR), ((KApply) result).items(), KLabel(KLabels.ML_FALSE)) .stream().sorted(Comparator.comparing(K::toString)).collect(Collectors.toList()); Set<String> observedResults = new HashSet<>(); if (resultList.size() == 0) { sb.append("No Search Results\n"); } else { int index = 1; for (int i = 0; i < resultList.size(); ++i) { String conjunctString = filterAnonVarsAndPrint(resultList.get(i), patternVariables, compiledDef, options).toString(); if (!(conjunctString.trim().isEmpty()) && !observedResults.contains(conjunctString)) { sb.append("Solution " + index++ + "\n"); sb.append(conjunctString); observedResults.add(conjunctString); } } if (index == 1) { sb.append("No Search Results\n"); } } outputFile(sb.toString(), options); return; } if (result instanceof KApply && ((KApply) result).klabel().name().equals(KLabels.ML_FALSE)) { outputFile("No Search Results\n", options); return; } outputFile(filterAnonVarsAndPrint(result, patternVariables, compiledDef, options).toString(), options); }
Source:
public List<HostAndPort> getAddresses() { return Collections.singletonList(HostAndPort.fromHost("localhost")); }

Target:
public List<HostAndPort> getAddresses() { return ImmutableList.of(HostAndPort.fromHost("localhost")); }
Source:
protected boolean isAcpOrIacpExists(final CallbackProperties properties) { final List accessConstentValues = properties.getEvidenceAccessConstent(); final List evidenceInstanceAccessConsentValues = properties.getEvidenceInstantAccessConsent(); if(CollectionUtils.isEmpty(accessConstentValues) && CollectionUtils.isEmpty(evidenceInstanceAccessConsentValues)){ return Boolean.FALSE; } return Boolean.TRUE; }

Target:
protected boolean isAcpOrIacpExists(final CallbackProperties properties) { return CollectionUtils.isNotEmpty(properties.getEvidenceAccessConstent()) && CollectionUtils.isNotEmpty(properties.getEvidenceInstantAccessConsent()); }
Source:
public AddVmTemplateCommand(T parameters) { super(parameters); super.setVmId(parameters.getMasterVm().getId()); super.setVmTemplateName(parameters.getName()); setVdsGroupId(parameters.getMasterVm().getvds_group_id()); if (getVm() != null) { VmHandler.updateDisksFromDb(getVm()); setStoragePoolId(getVm().getstorage_pool_id()); } imageToDestinationDomainMap = parameters.getImageToDestinationDomainMap(); setQuotaId(getVmTemplate().getQuotaId()); }

Target:
public AddVmTemplateCommand(T parameters) { super(parameters); super.setVmId(parameters.getMasterVm().getId()); super.setVmTemplateName(parameters.getName()); setVdsGroupId(parameters.getMasterVm().getvds_group_id()); if (getVm() != null) { VmHandler.updateDisksFromDb(getVm()); setStoragePoolId(getVm().getstorage_pool_id()); } imageToDestinationDomainMap = parameters.getImageToDestinationDomainMap(); setQuotaId(getVm().getQuotaId()); }
Source:
public int[] getAcceptableTokens() { return new int[] { TokenTypes.COMMA, TokenTypes.SEMI, TokenTypes.TYPECAST, TokenTypes.LITERAL_IF, TokenTypes.LITERAL_ELSE, TokenTypes.LITERAL_WHILE, TokenTypes.LITERAL_DO, TokenTypes.LITERAL_FOR, }; }

Target:
public int[] getAcceptableTokens() { return new int[] { TokenTypes.COMMA, TokenTypes.SEMI, TokenTypes.TYPECAST, TokenTypes.LITERAL_IF, TokenTypes.LITERAL_ELSE, TokenTypes.LITERAL_WHILE, TokenTypes.LITERAL_DO, TokenTypes.LITERAL_FOR, TokenTypes.DO_WHILE, }; }
Source:
private List<LUNs> getLunsFromVgInfo() { GetVGInfoVDSCommandParameters params = new GetVGInfoVDSCommandParameters( Optional.ofNullable(getVds()).map(VDS::getId).orElse(null), getStorageDomain().getStorage()); if (getVds() == null) { return (List<LUNs>) VdsCommandsHelper.runVdsCommandWithoutFailover( VDSCommandType.GetVGInfo, params, getStoragePoolId(), this).getReturnValue(); } return (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, params).getReturnValue(); }

Target:
private List<LUNs> getLunsFromVgInfo() { GetVGInfoVDSCommandParameters params = new GetVGInfoVDSCommandParameters( getVdsId(), getStorageDomain().getStorage()); if (getVdsId() == null) { return (List<LUNs>) VdsCommandsHelper.runVdsCommandWithoutFailover( VDSCommandType.GetVGInfo, params, getStoragePoolId(), null).getReturnValue(); } return (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, params).getReturnValue(); }
Source:
public List<GeoFence> getTrafficAlerts() throws GeoLocationBasedServiceException { Registry registry = getGovernanceRegistry(); String registryPath = GeoServices.REGISTRY_PATH_FOR_ALERTS + GeoServices.ALERT_TYPE_STATIONARY + "/"; Resource resource; try { resource = registry.get(registryPath); } catch (RegistryException e) { log.error("Error while reading the registry path: " + registryPath); return null; } try { List<GeoFence> fences = new ArrayList<>(); if (resource != null) { Object contentObj = resource.getContent(); if (contentObj instanceof String[]) { String[] content = (String[]) contentObj; for (String res : content) { Resource childRes = registry.get(res); Properties props = childRes.getProperties(); GeoFence geoFence = new GeoFence(); InputStream inputStream = childRes.getContentStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer, "UTF-8"); geoFence.setGeoJson(writer.toString()); List queryNameObj = (List) props.get(GeoServices.QUERY_NAME); geoFence.setQueryName(queryNameObj != null ? queryNameObj.get(0).toString() : null); List sNameObj = (List) props.get(GeoServices.STATIONARY_NAME); geoFence.setAreaName(sNameObj != null ? sNameObj.get(0).toString() : null); geoFence.setCreatedTime(childRes.getCreatedTime().getTime()); fences.add(geoFence); } } } return fences; } catch (RegistryException | IOException e) { throw new GeoLocationBasedServiceException( "Error occurred while getting the geo alerts", e); } }

Target:
public List<GeoFence> getTrafficAlerts() throws GeoLocationBasedServiceException { Registry registry = getGovernanceRegistry(); String registryPath = GeoServices.REGISTRY_PATH_FOR_ALERTS + GeoServices.ALERT_TYPE_STATIONARY + "/"; Resource resource; try { resource = registry.get(registryPath); } catch (RegistryException e) { log.error("Error while reading the registry path: " + registryPath); return Collections.emptyList(); } try { List<GeoFence> fences = new ArrayList<>(); if (resource != null) { Object contentObj = resource.getContent(); if (contentObj instanceof String[]) { String[] content = (String[]) contentObj; for (String res : content) { Resource childRes = registry.get(res); Properties props = childRes.getProperties(); GeoFence geoFence = new GeoFence(); InputStream inputStream = childRes.getContentStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer, "UTF-8"); geoFence.setGeoJson(writer.toString()); List queryNameObj = (List) props.get(GeoServices.QUERY_NAME); geoFence.setQueryName(queryNameObj != null ? queryNameObj.get(0).toString() : null); List sNameObj = (List) props.get(GeoServices.STATIONARY_NAME); geoFence.setAreaName(sNameObj != null ? sNameObj.get(0).toString() : null); geoFence.setCreatedTime(childRes.getCreatedTime().getTime()); fences.add(geoFence); } } } return fences; } catch (RegistryException | IOException e) { throw new GeoLocationBasedServiceException( "Error occurred while getting the geo alerts", e); } }