auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldCreateRepartitionTopicIfKeyChangingOperationWasNotPerformed() throws ExecutionException, InterruptedException { final String repartitionName = "dummy"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .repartition(Repartitioned.as(repartitionName)) .to(outputTopic); startStreams(builder); validateReceivedMessages( new IntegerDeserializer(), new StringDeserializer(), Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final String topology = builder.build().describe().toString(); assertTrue(topicExists(toRepartitionTopicName(repartitionName))); assertEquals(1, countOccurrencesInTopology(topology, "Sink: .*dummy-repartition.*")); }

Target:
public void shouldCreateRepartitionTopicIfKeyChangingOperationWasNotPerformed() throws Exception { final String repartitionName = "dummy"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .repartition(Repartitioned.as(repartitionName)) .to(outputTopic); startStreams(builder); validateReceivedMessages( new IntegerDeserializer(), new StringDeserializer(), Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final String topology = builder.build().describe().toString(); assertTrue(topicExists(toRepartitionTopicName(repartitionName))); assertEquals(1, countOccurrencesInTopology(topology, "Sink: .*dummy-repartition.*")); }
Source:
public Pair<List<LongRange>, Map<String, List<LongRange>>> route(final LongRange dataKeyRange) { List<LongRange> localKeyRanges = Collections.EMPTY_LIST; final Map<String, List<LongRange>> remoteKeyRanges = new HashMap<>(); final Map<Integer, SortedSet<Long>> partitionedKeysMap = new HashMap<>(); for (long dataKey = dataKeyRange.getMinimumLong(); dataKey <= dataKeyRange.getMaximumLong(); dataKey++) { final int partitionId = partitionFunc.getPartitionId(dataKey); if (!partitionedKeysMap.containsKey(partitionId)) { partitionedKeysMap.put(partitionId, new TreeSet<Long>()); } final SortedSet<Long> dataKeys = partitionedKeysMap.get(partitionId); dataKeys.add(dataKey); } for (final Map.Entry<Integer, SortedSet<Long>> partitionedKeysEntry : partitionedKeysMap.entrySet()) { final List<LongRange> rangeList = new ArrayList<>(LongRangeUtils.generateDenseLongRanges(partitionedKeysEntry.getValue())); final int partitionId = partitionedKeysEntry.getKey(); final int targetEvalId = partitionIdToEvalId[partitionId]; if (targetEvalId == memoryStoreId) { localKeyRanges = rangeList; } else { remoteKeyRanges.put(evalPrefix + '-' + targetEvalId, rangeList); } } return new Pair<>(localKeyRanges, remoteKeyRanges); }

Target:
public Pair<List<LongRange>, Map<String, List<LongRange>>> route(final LongRange dataKeyRange) { List<LongRange> localKeyRanges = Collections.EMPTY_LIST; final Map<String, List<LongRange>> remoteKeyRanges = new HashMap<>(); final Map<Integer, SortedSet<Long>> partitionedKeysMap = new HashMap<>(); for (long dataKey = dataKeyRange.getMinimumLong(); dataKey <= dataKeyRange.getMaximumLong(); dataKey++) { final int partitionId = partitionFunc.getPartitionId(dataKey); if (!partitionedKeysMap.containsKey(partitionId)) { partitionedKeysMap.put(partitionId, new TreeSet<Long>()); } final SortedSet<Long> dataKeys = partitionedKeysMap.get(partitionId); dataKeys.add(dataKey); } for (final Map.Entry<Integer, SortedSet<Long>> partitionedKeysEntry : partitionedKeysMap.entrySet()) { final List<LongRange> rangeList = new ArrayList<>(LongRangeUtils.generateDenseLongRanges(partitionedKeysEntry.getValue())); final int partitionId = partitionedKeysEntry.getKey(); final int memoryStoreId = pIdToMemoryStoreId[partitionId]; if (memoryStoreId == localMemoryStoreId) { localKeyRanges = rangeList; } else { remoteKeyRanges.put(getEvalId(memoryStoreId), rangeList); } } return new Pair<>(localKeyRanges, remoteKeyRanges); }
Source:
private void updateQuota() { Account account = AccountUtils.getCurrentOwnCloudAccount(this); if (account == null) return; UserProfile.UserQuota userQuota = UserProfilesRepository.getUserProfilesRepository().getQuota(account.name); if (userQuota == null) return; ProgressBar accountQuotaBar = findViewById(R.id.account_quota_bar); TextView accountQuotaText = findViewById(R.id.account_quota_text); if (accountQuotaBar!= null && accountQuotaText != null) { if(userQuota.getFree() >= 0) { accountQuotaBar.setProgress((int) Math.ceil(userQuota.getRelative())); accountQuotaText.setText( String.format(getString(R.string.drawer_quota), DisplayUtils.bytesToHumanReadable(userQuota.getUsed(), this), DisplayUtils.bytesToHumanReadable(userQuota.getTotal(), this) ) ); } else { accountQuotaBar.setProgress(0); accountQuotaText.setText( String.format(getString(R.string.drawer_quota), DisplayUtils.bytesToHumanReadable(userQuota.getUsed(), this), getQuotaTotalMsg((int) userQuota.getFree()) ) ); } } }

Target:
private void updateQuota() { Account account = AccountUtils.getCurrentOwnCloudAccount(this); if (account == null) return; UserProfile.UserQuota userQuota = UserProfilesRepository.getUserProfilesRepository().getQuota(account.name); if (userQuota == null) return; ProgressBar accountQuotaBar = findViewById(R.id.account_quota_bar); TextView accountQuotaText = findViewById(R.id.account_quota_text); if (accountQuotaBar!= null && accountQuotaText != null) { if (userQuota.getFree() < 0) { accountQuotaBar.setVisibility(View.VISIBLE); accountQuotaBar.setProgress(0); accountQuotaText.setText( String.format(getString(R.string.drawer_unavailable_free_storage), DisplayUtils.bytesToHumanReadable(userQuota.getUsed(),this)) ); } else if (userQuota.getFree() == 0) { accountQuotaBar.setVisibility(View.GONE); accountQuotaText.setText(getString(R.string.drawer_unavailable_used_storage)); } else { accountQuotaBar.setVisibility(View.VISIBLE); accountQuotaBar.setProgress((int) Math.ceil(userQuota.getRelative())); accountQuotaText.setText( String.format(getString(R.string.drawer_quota), DisplayUtils.bytesToHumanReadable(userQuota.getUsed(), this), DisplayUtils.bytesToHumanReadable(userQuota.getTotal(), this), userQuota.getRelative() ) ); } } }
Source:
public void pictureConversionsAlwaysHaveExtensions() throws IOException { DocumentModel picture = session.createDocumentModel("/", "picture", "Picture"); Blob blob = Blobs.createBlob(FileUtils.getResourceFileFromContext("images/cat.gif")); blob.setFilename("Cat.gif"); blob.setMimeType("image/gif"); picture.setPropertyValue("file:content", (Serializable) blob); picture = session.createDocument(picture); txFeature.nextTransaction(); eventService.waitForAsyncCompletion(); MultiviewPicture multiviewPicture = picture.getAdapter(MultiviewPicture.class); for (PictureView pictureView : multiviewPicture.getViews()) { assertEquals("jpg", FilenameUtils.getExtension(pictureView.getFilename())); assertTrue(StringUtils.containsIgnoreCase(pictureView.getFilename(), "cat")); } }

Target:
public void pictureConversionsAlwaysHaveExtensions() throws IOException { DocumentModel picture = session.createDocumentModel("/", "picture", "Picture"); Blob blob = Blobs.createBlob(FileUtils.getResourceFileFromContext("images/cat.gif")); blob.setFilename("Cat.gif"); blob.setMimeType("image/gif"); picture.setPropertyValue("file:content", (Serializable) blob); picture = session.createDocument(picture); txFeature.nextTransaction(); eventService.waitForAsyncCompletion(); MultiviewPicture multiviewPicture = picture.getAdapter(MultiviewPicture.class); assertEquals(5, multiviewPicture.getViews().length); for (PictureView pictureView : multiviewPicture.getViews()) { assertEquals("jpg", FilenameUtils.getExtension(pictureView.getFilename())); assertTrue(StringUtils.containsIgnoreCase(pictureView.getFilename(), "cat")); } }
Source:
public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world) { ItemStack result; boolean isCreative = player.capabilities.isCreativeMode; TileEntity te = null; if (target.typeOfHit == RayTraceResult.Type.BLOCK) { IBlockState state = world.getBlockState(target.getBlockPos()); if (state.getBlock().isAir(state, world, target.getBlockPos())) { return false; } if (isCreative && GuiScreen.isCtrlKeyDown() && state.getBlock().hasTileEntity(state)) te = world.getTileEntity(target.getBlockPos()); result = state.getBlock().getPickBlock(state, target, world, target.getBlockPos(), player); } else { if (target.typeOfHit != RayTraceResult.Type.ENTITY || target.entityHit == null || !isCreative) { return false; } result = target.entityHit.getPickedResult(target); } PlayerInteractEvent.Pick pickEvent = new PlayerInteractEvent.Pick(player, target, result); MinecraftForge.EVENT_BUS.post(pickEvent); if(pickEvent.isCanceled()) { return false; } result = pickEvent.getCurrentResult(); if (result.isEmpty()) { return false; } if (te != null) { Minecraft.getMinecraft().storeTEInStack(result, te); } if (isCreative) { player.inventory.setPickedItemStack(result); Minecraft.getMinecraft().playerController.sendSlotPacket(player.getHeldItem(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem); return true; } int slot = player.inventory.getSlotFor(result); if (slot != -1) { if (InventoryPlayer.isHotbar(slot)) player.inventory.currentItem = slot; else Minecraft.getMinecraft().playerController.pickItem(slot); return true; } return false; }

Target:
public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world) { ItemStack result; boolean isCreative = player.capabilities.isCreativeMode; TileEntity te = null; if (target.typeOfHit == RayTraceResult.Type.BLOCK) { IBlockState state = world.getBlockState(target.getBlockPos()); if (state.getBlock().isAir(state, world, target.getBlockPos())) { return false; } if (isCreative && GuiScreen.isCtrlKeyDown() && state.getBlock().hasTileEntity(state)) te = world.getTileEntity(target.getBlockPos()); result = state.getBlock().getPickBlock(state, target, world, target.getBlockPos(), player); } else { if (target.typeOfHit != RayTraceResult.Type.ENTITY || target.entityHit == null || !isCreative) { return false; } result = target.entityHit.getPickedResult(target); } PlayerInteractEvent.Pick pickEvent = new PlayerInteractEvent.Pick(player, target, result); MinecraftForge.EVENT_BUS.post(pickEvent); result = pickEvent.isCanceled() ? ItemStack.EMPTY : pickEvent.getResultStack(); if (result.isEmpty()) { return false; } if (te != null) { Minecraft.getMinecraft().storeTEInStack(result, te); } if (isCreative) { player.inventory.setPickedItemStack(result); Minecraft.getMinecraft().playerController.sendSlotPacket(player.getHeldItem(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem); return true; } int slot = player.inventory.getSlotFor(result); if (slot != -1) { if (InventoryPlayer.isHotbar(slot)) player.inventory.currentItem = slot; else Minecraft.getMinecraft().playerController.pickItem(slot); return true; } return false; }
Source:
protected Integer getGlobalDefaultNfsVersion(){ ConfigurationVO globalNfsVersion = configurationDao.findByName(CapacityManager.ImageStoreNFSVersion.key()); String value = globalNfsVersion.getValue(); return (value != null ? Integer.valueOf(value) : null); }

Target:
protected Integer getGlobalDefaultNfsVersion(){ ConfigurationVO globalNfsVersion = configurationDao.findByName(CapacityManager.ImageStoreNFSVersion.key()); Preconditions.checkState(globalNfsVersion != null, "Unable to find global NFS version for version key " + CapacityManager.ImageStoreNFSVersion.key()); String value = globalNfsVersion.getValue(); return (value != null ? Integer.valueOf(value) : null); }
Source:
protected String getVirtioIsoPath() { String virtioIsoName = getParameters().getVirtioIsoName(); if (virtioIsoName != null) { DiskImage diskImage; if (!virtioIsoName.contains(".iso") && virtioIsoName.split("-").length == 5 && (diskImage = diskImageDao.getDiskImageByDiskId(Guid.createGuidFromString(virtioIsoName))) != null && diskImage.getContentType() == DiskContentType.ISO) { return vmInfoBuildUtils.getFullyQualifiedPathToImage(diskImage); } else { return new File(getIsoPrefix(getStoragePoolId(), getVdsId()), virtioIsoName).getPath(); } } return null; }

Target:
protected String getVirtioIsoPath() { String virtioIsoName = getParameters().getVirtioIsoName(); if (virtioIsoName != null) { DiskImage diskImage; if (vmInfoBuildUtils.isValidUUID(virtioIsoName) && (diskImage = diskImageDao.getDiskImageByDiskId(Guid.createGuidFromString(virtioIsoName))) != null && diskImage.getContentType() == DiskContentType.ISO) { return vmInfoBuildUtils.getFullyQualifiedPathToImage(diskImage); } else { return new File(getIsoPrefix(getStoragePoolId(), getVdsId()), virtioIsoName).getPath(); } } return null; }
Source:
private List<UserRepresentation> searchForUser(Map<String, String> attributes, RealmModel realm, UserPermissionEvaluator usersEvaluator, Boolean briefRepresentation, Integer firstResult, Integer maxResults, Boolean includeServiceAccounts) { session.setAttribute(UserModel.INCLUDE_SERVICE_ACCOUNT, includeServiceAccounts); if (!auth.users().canView()) { Set<String> groupModels = auth.groups().getGroupsWithViewPermission(); if (!groupModels.isEmpty()) { try { session.setAttribute(UserModel.GROUPS, JsonSerialization.writeValueAsPrettyString(groupModels)); } catch (IOException cause) { throw new RuntimeException("Failed to create groups filter", cause); } } } List<UserModel> userModels = session.users().searchForUser(attributes, realm, firstResult, maxResults); return toRepresentation(realm, usersEvaluator, briefRepresentation, userModels); }

Target:
private List<UserRepresentation> searchForUser(Map<String, String> attributes, RealmModel realm, UserPermissionEvaluator usersEvaluator, Boolean briefRepresentation, Integer firstResult, Integer maxResults, Boolean includeServiceAccounts) { session.setAttribute(UserModel.INCLUDE_SERVICE_ACCOUNT, includeServiceAccounts); if (!auth.users().canView()) { Set<String> groupModels = auth.groups().getGroupsWithViewPermission(); if (!groupModels.isEmpty()) { session.setAttribute(UserModel.GROUPS, groupModels); } } List<UserModel> userModels = session.users().searchForUser(attributes, realm, firstResult, maxResults); return toRepresentation(realm, usersEvaluator, briefRepresentation, userModels); }
Source:
void onPrev(ClickEvent event) { GQuery.console.info("prev"); prev(); }

Target:
void onPrev(ClickEvent event) { prev(); }
Source:
public boolean hasPushTask() { taskLock.lock(); try { if (totalPushCount == 0) { return false; } } finally { taskLock.unlock(); } return true; }

Target:
public boolean hasPushTask() { return totalPushCount != 0; }
Source:
public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException { Image image = (Image) w; String snippet = (image.getChildren().size() > 0) ? getSnippet("image_link") : getSnippet("image"); if (image.getRefresh() > 0) { snippet = StringUtils.replace(snippet, "%update_interval%", Integer.toString(image.getRefresh())); } else { snippet = StringUtils.replace(snippet, "%update_interval%", "0"); } String widgetId = itemUIRegistry.getWidgetId(w); snippet = StringUtils.replace(snippet, "%id%", widgetId); snippet = preprocessSnippet(snippet, w); String sitemap = w.eResource().getURI().path(); State state = itemUIRegistry.getState(w); String url = (state instanceof RawType) ? state.toFullString() : ("../proxy?sitemap=" + sitemap + "&amp;widgetId=" + widgetId + "&amp;t=" + (new Date()).getTime()); snippet = StringUtils.replace(snippet, "%url%", url); sb.append(snippet); return null; }

Target:
public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException { Image image = (Image) w; String snippet = (image.getChildren().size() > 0) ? getSnippet("image_link") : getSnippet("image"); if (image.getRefresh() > 0) { snippet = StringUtils.replace(snippet, "%update_interval%", Integer.toString(image.getRefresh())); } else { snippet = StringUtils.replace(snippet, "%update_interval%", "0"); } String widgetId = itemUIRegistry.getWidgetId(w); snippet = StringUtils.replace(snippet, "%id%", widgetId); snippet = preprocessSnippet(snippet, w); String sitemap = null; if (w.eResource() != null) { sitemap = w.eResource().getURI().path(); } boolean validUrl = false; if (image.getUrl() != null && !image.getUrl().isEmpty()) { try { URI.create(image.getUrl()); validUrl = true; } catch (IllegalArgumentException ex) { } } String proxiedUrl = "../proxy?sitemap=" + sitemap + "&amp;widgetId=" + widgetId; State state = itemUIRegistry.getState(w); String url; if (state instanceof RawType) { url = state.toFullString(); } else if ((sitemap != null) && ((state instanceof StringType) || validUrl)) { url = proxiedUrl + "&amp;t=" + (new Date()).getTime(); } else { url = "images/none.png"; } snippet = StringUtils.replace(snippet, "%valid_url%", validUrl ? "true" : "false"); snippet = StringUtils.replace(snippet, "%proxied_url%", proxiedUrl); snippet = StringUtils.replace(snippet, "%url%", url); sb.append(snippet); return null; }
Source:
public long takeSnapshot() throws IOException { TermIndex ti = getLastAppliedTermIndex(); long startTime = Time.monotonicNow(); SingleFileSnapshotInfo lastSnapshot = storage.findLatestSnapshot(); if (ti != null && ti.getIndex() != RaftLog.INVALID_LOG_INDEX) { final File snapshotFile = storage.getSnapshotFile(ti.getTerm(), ti.getIndex()); LOG.info("{}: Taking a snapshot at:{} file {}", gid, ti, snapshotFile); try (FileOutputStream fos = new FileOutputStream(snapshotFile)) { persistContainerSet(fos); fos.flush(); fos.getFD().sync(); if (lastSnapshot != null && lastSnapshot.getFile() != null) { Path lastSnapshotFile = lastSnapshot.getFile().getPath(); LOG.info("Deleting last snapshot at ", lastSnapshotFile.toString()); FileUtils.deleteQuietly(lastSnapshotFile.toFile()); } } catch (IOException ioe) { LOG.info("{}: Failed to write snapshot at:{} file {}", gid, ti, snapshotFile); throw ioe; } LOG.info("{}: Finished taking a snapshot at:{} file:{} time:{}", gid, ti, snapshotFile, (Time.monotonicNow() - startTime)); return ti.getIndex(); } return -1; }

Target:
public long takeSnapshot() throws IOException { TermIndex ti = getLastAppliedTermIndex(); long startTime = Time.monotonicNow(); if (!isStateMachineHealthy.get()) { String msg = "Failed to take snapshot " + " for " + gid + " as the stateMachine" + " is unhealthy. The last applied index is at " + ti; StateMachineException sme = new StateMachineException(msg); LOG.error(msg); throw sme; } if (ti != null && ti.getIndex() != RaftLog.INVALID_LOG_INDEX) { final File snapshotFile = storage.getSnapshotFile(ti.getTerm(), ti.getIndex()); LOG.info("{}: Taking a snapshot at:{} file {}", gid, ti, snapshotFile); try (FileOutputStream fos = new FileOutputStream(snapshotFile)) { persistContainerSet(fos); fos.flush(); fos.getFD().sync(); } catch (IOException ioe) { LOG.error("{}: Failed to write snapshot at:{} file {}", gid, ti, snapshotFile); throw ioe; } LOG.info("{}: Finished taking a snapshot at:{} file:{} time:{}", gid, ti, snapshotFile, (Time.monotonicNow() - startTime)); return ti.getIndex(); } return -1; }
Source:
public RebaseOperation(Repository repository, Operation operation) { Assert.isTrue(operation != Operation.BEGIN); this.repository = repository; this.operation = operation; this.ref = null; }

Target:
public RebaseOperation(Repository repository, Operation operation) { this.repository = repository; this.operation = operation; this.ref = null; }
Source:
public String getOptionsString() { StringBuilder command = new StringBuilder(); command.append("-a ").append(host); if (logPath != null) { command.append(" -l ").append(logPath); } else { command.append(" -m"); } if (single) { command.append(" -s"); } if (logSizeQuota != null) { command.append(" --log-size-quota-percentage ").append(logSizeQuota); } if (tlsEnabled) { command.append(" -e"); if (keyStore != null) { command.append(" -u ").append(keyStore); } if (keyStorePassword != null) { command.append(" -f ").append(keyStorePassword); } if (trustStore != null) { command.append(" -r ").append(trustStore); } if (trustStorePassword != null) { command.append(" -w ").append(trustStorePassword); } } command.append(" -d ").append(logLevel).append(" ") .append(port); return command.toString(); }

Target:
public String getOptionsString() { StringBuilder command = new StringBuilder(); command.append("-a ").append(host); if (logPath != null) { command.append(" -l ").append(logPath); } else { command.append(" -m"); } if (single) { command.append(" -s"); } if (logSizeLimitPercentage != null) { command.append(" --log-size-quota-percentage ").append(logSizeLimitPercentage); } if (tlsEnabled) { command.append(" -e"); if (keyStore != null) { command.append(" -u ").append(keyStore); } if (keyStorePassword != null) { command.append(" -f ").append(keyStorePassword); } if (trustStore != null) { command.append(" -r ").append(trustStore); } if (trustStorePassword != null) { command.append(" -w ").append(trustStorePassword); } } command.append(" -d ").append(logLevel).append(" ") .append(port); return command.toString(); }
Source:
public void backfillEvent(EmittedEventEntity event) { try { Optional<ChargeEntity> charge = Optional.empty(); if (ResourceType.valueOf(event.getResourceType().toUpperCase()).equals(ResourceType.PAYMENT)) { charge = Optional.of(chargeService.findChargeByExternalId(event.getResourceExternalId())); } else { Optional<RefundEntity> refundEntity = refundDao.findByExternalId(event.getResourceExternalId()) .stream() .findFirst(); if (refundEntity.isPresent()) { charge = Optional.ofNullable(chargeService.findChargeByExternalId(refundEntity.get().getChargeExternalId())); } } charge.ifPresent(c -> MDC.put("chargeId", c.getExternalId())); charge.ifPresent(historicalEventEmitter::processPaymentAndRefundEvents); event.setEmittedDate(now(ZoneId.of("UTC"))); } catch (Exception e) { logger.error( "Failed to process backfill for event due to [externalId={}] [event_type={}] [event_date={}]", event.getId(), e.getMessage(), event.getResourceExternalId(), event.getEventType(), event.getEventDate() ); } finally { MDC.remove("chargeId"); } }

Target:
public void backfillEvent(EmittedEventEntity event) { try { Optional<ChargeEntity> charge = Optional.empty(); if (ResourceType.valueOf(event.getResourceType().toUpperCase()).equals(ResourceType.PAYMENT)) { charge = Optional.of(chargeService.findChargeByExternalId(event.getResourceExternalId())); } else { Optional<RefundEntity> refundEntity = refundDao.findByExternalId(event.getResourceExternalId()) .stream() .findFirst(); if (refundEntity.isPresent()) { charge = Optional.ofNullable(chargeService.findChargeByExternalId(refundEntity.get().getChargeExternalId())); } } charge.ifPresent(c -> MDC.put("chargeId", c.getExternalId())); charge.ifPresent(historicalEventEmitter::processPaymentAndRefundEvents); event.setEmittedDate(now(ZoneId.of("UTC"))); } catch (Exception e) { logger.error( "Failed to process backfill for event due to [externalId={}] [event_type={}] [event_date={}]", event.getId(), e.getMessage(), event.getResourceExternalId(), event.getEventType(), event.getEventDate() ); throw e; } finally { MDC.remove("chargeId"); } }
Source:
public ParserProperties withUsageWidth(int usageWidth) { if (usageWidth < 0) throw new IllegalArgumentException("Usage width is negative"); if (this.usageWidth == usageWidth) return this; return new ParserProperties(usageWidth, this.shouldSortOptions); }

Target:
public ParserProperties withUsageWidth(int usageWidth) { if (usageWidth < 0) throw new IllegalArgumentException("Usage width is negative"); this.usageWidth = usageWidth; return this; }
Source:
static Text decode(String s) { Text t = new Text(); byte[] sb = s.getBytes(UTF_8); for (int i = 0; i < sb.length; i++) { if (sb[i] != '%') { t.append(new byte[] {sb[i]}, 0, 1); } else { i++; if (i < sb.length) { byte hex[] = {sb[i], sb[i]}; String hs = new String(hex, UTF_8); int b = Integer.parseInt(hs, 16); t.append(new byte[]{(byte) b}, 0, 1); } } } return t; }

Target:
static Text decode(String s) { Text t = new Text(); byte[] sb = s.getBytes(UTF_8); for (int i = 0; i < sb.length; i++) { if (sb[i] != '%') { t.append(new byte[] {sb[i]}, 0, 1); } else { int x = ++i; int y = ++i; if (y < sb.length) { byte[] hex = {sb[x], sb[y]}; String hs = new String(hex, UTF_8); int b = Integer.parseInt(hs, 16); t.append(new byte[] {(byte) b}, 0, 1); } else { throw new IllegalArgumentException("Invalid characters in encoded string (" + s + ")." + " Expected two characters after '%'"); } } } return t; }
Source:
public static void main(String[] args) { Unit unit = new SoldierUnit("SoldierUnit1"); Unit unit1 = new SergeantUnit("SergeantUnit1"); Unit unit2 = new CommanderUnit("CommanderUnit1"); checkExtensionsForUnit(unit); checkExtensionsForUnit(unit1); checkExtensionsForUnit(unit2); }

Target:
public static void main(String[] args) { Unit soldierUnit = new SoldierUnit("SoldierUnit1"); Unit sergeantUnit = new SergeantUnit("SergeantUnit1"); Unit commanderUnit = new CommanderUnit("CommanderUnit1"); checkExtensionsForUnit(soldierUnit); checkExtensionsForUnit(sergeantUnit); checkExtensionsForUnit(commanderUnit); }
Source:
public IndexedInts getBitmapIndex(String dimension, int dictId) { final Column column = input.getColumn(dimension); if (column == null) { return new EmptyIndexedInts(); } final BitmapIndex bitmaps = column.getBitmapIndex(); if (bitmaps == null) { return new EmptyIndexedInts(); } if (dictId >= 0) { return new BitmapCompressedIndexedInts(bitmaps.getBitmap(dictId)); } else { return new EmptyIndexedInts(); } }

Target:
public IndexedInts getBitmapIndex(String dimension, int dictId) { final Column column = input.getColumn(dimension); if (column == null) { return EmptyIndexedInts.EMPTY_INDEXED_INTS; } final BitmapIndex bitmaps = column.getBitmapIndex(); if (bitmaps == null) { return EmptyIndexedInts.EMPTY_INDEXED_INTS; } if (dictId >= 0) { return new BitmapCompressedIndexedInts(bitmaps.getBitmap(dictId)); } else { return EmptyIndexedInts.EMPTY_INDEXED_INTS; } }
Source:
public static String getHostName() throws IOException { Process p = Runtime.getRuntime().exec("hostname"); try { BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); return reader.readLine(); } finally { try { int result = p.waitFor(); if (result != 0) throw new IOException("Non-zero return from hostname process: " + result); } catch (InterruptedException e) { throw new IOException(e); } } }

Target:
public static String getHostName() throws IOException { Process p = Runtime.getRuntime().exec("hostname"); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String result = reader.readLine(); try { int exitCode = p.waitFor(); if (exitCode != 0) { throw new IOException("Non-zero return from hostname process: " + result); } } catch (InterruptedException e) { throw new IOException(e); } return result; }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setOnItemLongClickListener( new LongClickDeleteListener(activity, new LongClickDeleteListener.OnDeleteListener() { @Override public void onDelete(int position) { if (getListView().getItemAtPosition(position) == null) { return; } } @Override public boolean shouldDelete(int position) { return false; }})); }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setOnItemLongClickListener(new LongClickDeleteListener(activity, new LongClickDeleteListener.OnDeleteListener() { @Override public void onDelete(int position) { showDeleteAlertDialog(position); } @Override public boolean shouldDelete(int position) { return true; } })); }
Source:
private boolean pageDenotesContentConsumption(WebrequestData data){ boolean contentConsumption = true; if (data.getRawXAnalyticsHeader().isEmpty()) return contentConsumption; String special = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "special").trim(); String preview = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "preview").trim(); if (preview.isEmpty() && special.isEmpty()){ return contentConsumption; } Set<String> specialPagesAccepted = new HashSet<String>(); specialPagesAccepted.add("Search") ; specialPagesAccepted.add("RecentChanges"); specialPagesAccepted.add("Version"); if (preview.equalsIgnoreCase("1")) contentConsumption = false; if ( !special.isEmpty() ) { contentConsumption = false; Iterator it = specialPagesAccepted.iterator(); while (it.hasNext()) { String item = (String) it.next(); if (special.equalsIgnoreCase(item)){ contentConsumption = true; break; } } } return contentConsumption; }

Target:
private boolean pageDenotesContentConsumption(WebrequestData data){ if (data.getRawXAnalyticsHeader().isEmpty()) return true; String special = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "special").trim(); String preview = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "preview").trim(); if (preview.isEmpty() && special.isEmpty()){ return true; } else if (preview.equalsIgnoreCase("1")) { return false; } if ( !special.isEmpty() ) { Iterator it = SPECIAL_PAGES_ACCEPTED.iterator(); while (it.hasNext()) { String item = (String) it.next(); if (item.equals(special.toLowerCase())){ return true; } } } return false; }
Source:
private void adjustStreamStoreScores(TableReference valueTable, @Output Map<TableReference, Double> scores, Map<TableReference, SweepPriority> tableToSweepPriority) { TableReference indexTable = StreamTableType.getIndexTableFromValueTable(valueTable); if (!scores.containsKey(indexTable)) { return; } long lastSweptTimeOfValueTable = getLastSweptTime(valueTable, tableToSweepPriority); long lastSweptTimeOfIndexTable = getLastSweptTime(indexTable, tableToSweepPriority); if (lastSweptTimeOfValueTable >= lastSweptTimeOfIndexTable) { bumpIndexTableAndIgnoreValueTable(valueTable, indexTable, scores); } else if (System.currentTimeMillis() - lastSweptTimeOfIndexTable <= INDEX_TO_VALUE_TABLE_SLEEP_TIME) { doNotSweepTable(valueTable, scores); doNotSweepTable(indexTable, scores); } else { } }

Target:
private void adjustStreamStoreScores(TableReference valueTable, @Output Map<TableReference, Double> scores, Map<TableReference, SweepPriority> tableToSweepPriority) { TableReference indexTable = StreamTableType.getIndexTableFromValueTable(valueTable); if (!scores.containsKey(indexTable)) { return; } long lastSweptTimeOfValueTable = getLastSweptTime(valueTable, tableToSweepPriority); long lastSweptTimeOfIndexTable = getLastSweptTime(indexTable, tableToSweepPriority); if (lastSweptTimeOfValueTable >= lastSweptTimeOfIndexTable) { scores.put(indexTable, scores.get(valueTable)); doNotSweepTable(valueTable, scores); } else if (System.currentTimeMillis() - lastSweptTimeOfIndexTable <= INDEX_TO_VALUE_TABLE_SLEEP_TIME) { doNotSweepTable(valueTable, scores); doNotSweepTable(indexTable, scores); } else { } }
Source:
public FeatureSelectionDialog(Shell shell, AboutInfo[] features, String primaryFeatureId, String shellTitle, String shellMessage, String helpContextId) { super(shell); if (features == null || features.length == 0) { throw new IllegalArgumentException(); } this.features = features; this.helpContextId = helpContextId; setTitle(shellTitle); setMessage(shellMessage); Arrays.sort(features, new Comparator<AboutInfo>() { Collator coll = Collator.getInstance(Locale.getDefault()); @Override public int compare(AboutInfo i1, AboutInfo i2) { String name1, name2; name1 = i1.getFeatureLabel(); name2 = i2.getFeatureLabel(); if (name1 == null) { name1 = ""; } if (name2 == null) { name2 = ""; } return coll.compare(name1, name2); } }); for (AboutInfo feature : features) { if (feature.getFeatureId().equals(primaryFeatureId)) { setInitialSelection(feature); return; } } setInitialSelection(Collections.emptyList()); }

Target:
public FeatureSelectionDialog(Shell shell, AboutInfo[] features, String primaryFeatureId, String shellTitle, String shellMessage, String helpContextId) { super(shell); if (features == null || features.length == 0) { throw new IllegalArgumentException(); } this.features = features; this.helpContextId = helpContextId; setTitle(shellTitle); setMessage(shellMessage); Arrays.sort(features, new Comparator<AboutInfo>() { Collator coll = Collator.getInstance(Locale.getDefault()); @Override public int compare(AboutInfo i1, AboutInfo i2) { String name1, name2; name1 = i1.getFeatureLabel(); name2 = i2.getFeatureLabel(); if (name1 == null) { name1 = ""; } if (name2 == null) { name2 = ""; } return coll.compare(name1, name2); } }); for (AboutInfo feature : features) { if (feature.getFeatureId().equals(primaryFeatureId)) { setInitialSelection(feature); return; } } }
Source:
public void testMalformedTopicString () { assertNull(registry.getSchemaNameFromTopic("badTopicName")); }

Target:
public void testMalformedTopicString () { assertNull(registry.getSchemaNameFromTopic("badTopicName")); registry.getLatestSchemaByTopic("badTopicName"); }
Source:
private void replaceContextParameters(Properties properties) { InterpreterContext interpreterContext = InterpreterContext.get(); if (interpreterContext != null) { String markerTemplate = "#\\{%s\\}"; List<String> skipFields = Arrays.asList("paragraphTitle", "paragraphId", "paragraphText"); List typesToProcess = Arrays.asList(String.class, Double.class, Float.class, Short.class, Byte.class, Character.class, Boolean.class, Integer.class, Long.class); for (String key : properties.stringPropertyNames()) { String p = properties.getProperty(key); if (StringUtils.isNotEmpty(p)) { for (Field field : InterpreterContext.class.getDeclaredFields()) { Class clazz = field.getType(); if (!skipFields.contains(field.getName()) && (typesToProcess.contains(clazz) || clazz.isPrimitive())) { try { Object value = FieldUtils.readField(field, interpreterContext, true); p = p.replaceAll(String.format(markerTemplate, field.getName()), value != null ? value.toString() : StringUtils.EMPTY); } catch (Exception e) { logger.error("Cannot replace context parameter", e); } } } p = p.replaceAll(String.format(markerTemplate, "user"), StringUtils.defaultString(userName, StringUtils.EMPTY)); properties.setProperty(key, p); } } } }

Target:
private void replaceContextParameters(Properties properties) { InterpreterContext interpreterContext = InterpreterContext.get(); if (interpreterContext != null) { String markerTemplate = "#\\{%s\\}"; List<String> skipFields = Arrays.asList("paragraphTitle", "paragraphId", "paragraphText"); List typesToProcess = Arrays.asList(String.class, Double.class, Float.class, Short.class, Byte.class, Character.class, Boolean.class, Integer.class, Long.class); for (String key : properties.stringPropertyNames()) { String p = properties.getProperty(key); if (StringUtils.isNotEmpty(p)) { for (Field field : InterpreterContext.class.getDeclaredFields()) { Class clazz = field.getType(); if (!skipFields.contains(field.getName()) && (typesToProcess.contains(clazz) || clazz.isPrimitive())) { Object value = null; try { value = FieldUtils.readField(field, interpreterContext, true); } catch (Exception e) { logger.error("Cannot read value of field {0}", field.getName()); } p = p.replaceAll(String.format(markerTemplate, field.getName()), value != null ? value.toString() : StringUtils.EMPTY); } } p = p.replaceAll(String.format(markerTemplate, "user"), StringUtils.defaultString(userName, StringUtils.EMPTY)); properties.setProperty(key, p); } } } }
Source:
public void testBinaryFunctionsParsingUnsuccessful() throws Exception { for (String function : binaryFunctions) { testFunctionParsingUnsuccessful(function, failingBinaryFunctionExpressions); } }

Target:
public void testBinaryFunctionsParsingUnsuccessful() { for (String function : binaryFunctions) { testFunctionParsingUnsuccessful(function, failingBinaryFunctionExpressions); } }
Source:
private void updateFormRelevancies(){ saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); if(!(mCurrentView instanceof ODKView)){ throw new RuntimeException("Tried to update form relevancy not on compound view"); } ODKView oldODKV = (ODKView)mCurrentView; ArrayList<QuestionWidget> oldWidgets = oldODKV.getWidgets(); ArrayList<Vector<SelectChoice>> oldSelectChoices = getOldSelectChoicesForEachWidget(oldWidgets); ArrayList<String> oldQuestionTexts = getOldQuestionTextsForEachWidget(oldWidgets); FormEntryPrompt[] newValidPrompts = mFormController.getQuestionPrompts(); Set<FormEntryPrompt> leftInOldList = new HashSet<>(); ArrayList<Integer> removeList = new ArrayList<>(); for (int i = 0; i < oldWidgets.size(); i++){ FormEntryPrompt oldPrompt = oldWidgets.get(i).getPrompt(); String priorQuestionTextForThisWidget = oldQuestionTexts.get(i); Vector<SelectChoice> priorSelectChoicesForThisWidget = oldSelectChoices.get(i); boolean stillRelevant = false; for (FormEntryPrompt newPrompt : newValidPrompts) { if (newPrompt.getIndex().equals(oldPrompt.getIndex()) && newPrompt.hasSameDisplayContent(priorQuestionTextForThisWidget, priorSelectChoicesForThisWidget)) { stillRelevant = true; leftInOldList.add(newPrompt); break; } } if (!stillRelevant) { removeList.add(i); } } oldODKV.removeQuestionsFromIndex(removeList); for (int i = 0; i < newValidPrompts.length; ++i) { FormEntryPrompt prompt = newValidPrompts[i]; if (!leftInOldList.contains(prompt)) { oldODKV.addQuestionToIndex(prompt, mFormController.getWidgetFactory(), i); } } }

Target:
private void updateFormRelevancies(){ saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); if(!(mCurrentView instanceof ODKView)){ throw new RuntimeException("Tried to update form relevancy not on compound view"); } ODKView odkView = (ODKView)mCurrentView; ArrayList<QuestionWidget> oldWidgets = odkView.getWidgets(); ArrayList<Vector<SelectChoice>> oldSelectChoices = getOldSelectChoicesForEachWidget(oldWidgets); ArrayList<String> oldQuestionTexts = getOldQuestionTextsForEachWidget(oldWidgets); FormEntryPrompt[] newValidPrompts = mFormController.getQuestionPrompts(); Set<FormEntryPrompt> promptsLeftInView = new HashSet<>(); ArrayList<Integer> shouldRemoveFromView = new ArrayList<>(); for (int i = 0; i < oldWidgets.size(); i++){ FormEntryPrompt oldPrompt = oldWidgets.get(i).getPrompt(); String priorQuestionTextForThisWidget = oldQuestionTexts.get(i); Vector<SelectChoice> priorSelectChoicesForThisWidget = oldSelectChoices.get(i); FormEntryPrompt equivalentNewPrompt = getEquivalentPromptInNewList(newValidPrompts, oldPrompt, priorQuestionTextForThisWidget, priorSelectChoicesForThisWidget); if (equivalentNewPrompt != null) { promptsLeftInView.add(equivalentNewPrompt); } else { shouldRemoveFromView.add(i); } } odkView.removeQuestionsFromIndex(shouldRemoveFromView); for (int i = 0; i < newValidPrompts.length; ++i) { FormEntryPrompt prompt = newValidPrompts[i]; if (!promptsLeftInView.contains(prompt)) { odkView.addQuestionToIndex(prompt, mFormController.getWidgetFactory(), i); } } }
Source:
protected String getOwnerEmail(InstanceGroup group) { String propEmailGlobalReceiver = String.format("simianarmy.chaos.notification.global.receiverEmail"); if (cfg.getStr(propEmailGlobalReceiver) != null) { return cfg.getStr(propEmailGlobalReceiver); } String prop = String.format("simianarmy.chaos.%s.%s.ownerEmail", group.type(), group.name()); String ownerEmail = cfg.getStr(prop); if (ownerEmail == null) { LOGGER.info(String.format("Property %s is not set, use the default email address %s as" + " the owner email of group %s of type %s", prop, defaultEmail, group.name(), group.type())); return defaultEmail; } else { return ownerEmail; } }

Target:
protected String getOwnerEmail(InstanceGroup group) { String prop = String.format("simianarmy.chaos.%s.%s.ownerEmail", group.type(), group.name()); String ownerEmail = cfg.getStr(prop); if (ownerEmail == null) { LOGGER.info(String.format("Property %s is not set, use the default email address %s as" + " the owner email of group %s of type %s", prop, defaultEmail, group.name(), group.type())); return defaultEmail; } else { return ownerEmail; } }
Source:
private String encode(final String value) throws Exception { return URLEncoder.encode(value, "UTF-8"); }

Target:
private String encode(final String value) throws Exception { return URLEncoder.encode(value, StandardCharsets.UTF_8); }
Source:
protected void implementNetworkElements(final DeployDestination dest, final ReservationContext context, final Network network, final NetworkOffering offering, final List<Provider> providersToImplement) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { for (NetworkElement element : networkElements) { if (providersToImplement.contains(element.getProvider())) { if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) { throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId()); } if (s_logger.isDebugEnabled()) { s_logger.debug("Asking " + element.getName() + " to implemenet " + network); } if (!element.implement(network, offering, dest, context)) { CloudRuntimeException ex = new CloudRuntimeException("Failed to implement provider " + element.getProvider().getName() + " for network with specified id"); ex.addProxyObject(network.getUuid(), "networkId"); throw ex; } } } }

Target:
private void implementNetworkElements(final DeployDestination dest, final ReservationContext context, final Network network, final NetworkOffering offering, final List<Provider> providersToImplement) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { for (NetworkElement element : networkElements) { if (providersToImplement.contains(element.getProvider())) { if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) { throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId()); } if (s_logger.isDebugEnabled()) { s_logger.debug("Asking " + element.getName() + " to implemenet " + network); } if (!element.implement(network, offering, dest, context)) { CloudRuntimeException ex = new CloudRuntimeException("Failed to implement provider " + element.getProvider().getName() + " for network with specified id"); ex.addProxyObject(network.getUuid(), "networkId"); throw ex; } } } }
Source:
public List<TypeDeclaration> parentTypes() { List<TypeDeclaration> nodes = new ArrayList<>(); Set<String> parentNames = new HashSet<>(); Node parents = resolvedType.getTypeDeclarationNode().get("type"); if ( parents == null) { return nodes; } List<Node> parentTypeNodes = parents.getChildren(); for (Node parentTypeNode : parentTypeNodes) { NamedTypeExpressionNode parent = (NamedTypeExpressionNode) parentTypeNode; parentNames.add(parent.getValue()); } Node nn = node.getRootNode().get("types"); if ( nn == null ) { return nodes; } TypeDeclarationModelFactory factory = new TypeDeclarationModelFactory(); List<TypeDeclarationNode> typeDeclarationNodes = nn.findDescendantsWith(TypeDeclarationNode.class); for (TypeDeclarationNode declarationNode : typeDeclarationNodes) { if ( parentNames.contains(declarationNode.getTypeName()) ) { TypeDeclaration decl = factory.create(declarationNode); nodes.add(decl); } } return nodes; }

Target:
public List<TypeDeclaration<?>> parentTypes() { List<TypeDeclaration<?>> result = new ArrayList<>(); Node typeNode = getTypeNode(); if (typeNode instanceof ArrayNode) { List<Node> children = typeNode.getChildren(); for (Node child : children) { result.add(toTypeDeclaration(((NamedTypeExpressionNode) child).getRefNode())); } } else { if (typeNode instanceof NamedTypeExpressionNode) { result.add(toTypeDeclaration(((NamedTypeExpressionNode) typeNode).getRefNode())); } } return result; }
Source:
private CommandLineCompleter getCompleter(final Map<String, CommandLineCompleterFactory> globalOpProps, final Property prop, CommandContext ctx, String operationName, OperationRequestAddress address) throws IllegalArgumentException { CommandLineCompleter propCompleter = null; final CommandLineCompleterFactory factory = globalOpProps == null ? null : globalOpProps.get(prop.getName()); if (factory != null) { final String propName = ctx.getParsedCommandLine().getPropertyValue(Util.NAME); if (Util.WRITE_ATTRIBUTE.equals(operationName) && propName != null) { return getFilenameCompleter(ctx, address, propName); } if (propCompleter == null) { propCompleter = factory.createCompleter(address); } } if (propCompleter == null) { final ModelNode typeNode = prop.getValue().get(Util.TYPE); if (typeNode.isDefined() && ModelType.BOOLEAN.equals(typeNode.asType())) { return SimpleTabCompleter.BOOLEAN; } if (prop.getValue().get(Util.FILESYSTEM_PATH).asBoolean()) { return Util.isWindows() ? new WindowsFilenameTabCompleter(ctx) : new DefaultFilenameTabCompleter(ctx); } if (prop.getValue().has(Util.VALUE_TYPE)) { final ModelNode valueTypeNode = prop.getValue().get(Util.VALUE_TYPE); try { valueTypeNode.asType(); if (prop.getValue().has(Util.ALLOWED)) { return getAllowedCompleter(prop); } } catch (IllegalArgumentException e) { return new ValueTypeCompleter(prop.getValue()); } } if (prop.getValue().has(Util.ALLOWED)) { return getAllowedCompleter(prop); } } return propCompleter; }

Target:
private CommandLineCompleter getCompleter(final Map<String, CommandLineCompleterFactory> globalOpProps, final Property prop, CommandContext ctx, String operationName, OperationRequestAddress address) throws IllegalArgumentException { CommandLineCompleter propCompleter = null; final CommandLineCompleterFactory factory = globalOpProps == null ? null : globalOpProps.get(prop.getName()); if (factory != null) { propCompleter = factory.createCompleter(ctx, address); } if (propCompleter == null) { final ModelNode typeNode = prop.getValue().get(Util.TYPE); if (typeNode.isDefined() && ModelType.BOOLEAN.equals(typeNode.asType())) { return SimpleTabCompleter.BOOLEAN; } if (prop.getValue().get(Util.FILESYSTEM_PATH).asBoolean()) { return Util.isWindows() ? new WindowsFilenameTabCompleter(ctx) : new DefaultFilenameTabCompleter(ctx); } if (prop.getValue().has(Util.VALUE_TYPE)) { final ModelNode valueTypeNode = prop.getValue().get(Util.VALUE_TYPE); try { valueTypeNode.asType(); if (prop.getValue().has(Util.ALLOWED)) { return getAllowedCompleter(prop); } } catch (IllegalArgumentException e) { return new ValueTypeCompleter(prop.getValue()); } } if (prop.getValue().has(Util.ALLOWED)) { return getAllowedCompleter(prop); } } return propCompleter; }