auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private final String addPrimaryDomainIfNotExists(String userName) { if ((userName.indexOf(UserCoreConstants.DOMAIN_SEPARATOR)) < 0 && StringUtils.isNotEmpty(userName)) { StringBuilder builder = new StringBuilder(); builder.append(UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME).append(CarbonConstants.DOMAIN_SEPARATOR) .append(userName); userName = builder.toString(); } return userName; }

Target:
private final String addPrimaryDomainIfNotExists(String userName) { if (StringUtils.isNotEmpty(userName) && (!userName.contains(UserCoreConstants.DOMAIN_SEPARATOR))) { StringBuilder builder = new StringBuilder(); builder.append(UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME).append(CarbonConstants.DOMAIN_SEPARATOR) .append(userName); userName = builder.toString(); } return userName; }
Source:
private void addVmRngDevice() { VmRngDevice rngDev = getParameters().getRngDevice(); if (rngDev != null) { RngDeviceParameters params = new RngDeviceParameters(rngDev, true); VdcReturnValueBase result = getBackend().runInternalAction(VdcActionType.AddRngDevice, params); if (!result.getSucceeded()) { throw new IllegalStateException("Couldn't add RNG device."); } } }

Target:
private void addVmRngDevice() { VmRngDevice rngDev = getParameters().getRngDevice(); if (rngDev != null) { RngDeviceParameters params = new RngDeviceParameters(rngDev, true); VdcReturnValueBase result = getBackend().runInternalAction(VdcActionType.AddRngDevice, params); if (!result.getSucceeded()) { throw new IllegalArgumentException("Couldn't add RNG device."); } } }
Source:
public void testMd5DigestSecretGeneration01() { Map<String, Object> conf = new HashMap<>(); conf.put(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD, "foobar:12345"); conf.put(Config.STORM_ZOOKEEPER_AUTH_SCHEME, "anything"); Map<String, Object> result = StormSubmitter.prepareZookeeperAuthentication(conf); Object actualPayload = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD); Object actualScheme = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_SCHEME); assertThat(actualPayload, is("foobar:12345")); assertThat(actualScheme, is("digest")); }

Target:
public void testMd5DigestSecretGeneration01() { Map<String, Object> conf = new HashMap<>(); conf.put(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD, "foobar:12345"); conf.put(Config.STORM_ZOOKEEPER_AUTH_SCHEME, "anything"); Map<String, Object> result = StormSubmitter.prepareZookeeperAuthentication(conf); Object actualPayload = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD); Object actualScheme = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_SCHEME); assertEquals("foobar:12345", actualPayload); assertEquals("digest", actualScheme); }
Source:
private void doMoves(Enemy enemy, int x, int y) { if (enemy.getRandom() < GameConstants.AI_RANDOMIZER) { if(enemy.getRandom() < (0.03f * GameConstants.AI_RANDOMIZER)) { enemy.jump(); addToLog("[AI]\tAn enemy just did the super rare JUMP SPAM!"); } else if(enemy.getRandom() < (0.50f * GameConstants.AI_RANDOMIZER)) { enemy.goLeft(); } else if(enemy.getRandom() < (1.00f * GameConstants.AI_RANDOMIZER)) { enemy.goRight(); } return; } if(y == 1) { if(enemy.getLastWall()) { enemy.goLeft(); } else { enemy.goRight(); } if(enemy.getLocation().getX() < 3.5) { enemy.setLastWall(false); } else if(enemy.getLocation().getX() > this.level.getCells().getWidth() - 3.5) { enemy.setLastWall(true); } return; } if(x == 1) { enemy.goRight(); } if(x == -1) { enemy.goLeft(); } if(y == -1) { enemy.jump(); } }

Target:
private void doMoves(Enemy enemy, int x, int y) { if (enemy.getRandom() < GameConstants.AI_RANDOMIZER) { doRandomMove(enemy); return; } if(y == 1) { fallOffPlatform(enemy); return; } if(x == 1) { enemy.goRight(); } if(x == -1) { enemy.goLeft(); } if(y == -1) { enemy.jump(); } }
Source:
private void assertFormalParameters(final InformationItem... parameters) { final int parameterCount = parameters.length; assertEquals(parameterCount, function.getFormalParameter().size()); for (int i = 0; i < parameterCount; i++) { assertEquals(parameters[i], function.getFormalParameter().get(i)); } }

Target:
private void assertFormalParameters(final InformationItem... parameters) { assertThat(function.getFormalParameter()).containsExactly(parameters); }
Source:
public TemplateStore getCodeTemplateStore() { if (fCodeTemplateStore == null) { Promise<TemplateStore> p = getPluginInitializer().getTemplateStore(); try { fCodeTemplateStore = p.getValue(); } catch (InvocationTargetException e) { e.printStackTrace(); log(e); } catch (InterruptedException e) { e.printStackTrace(); log(e); } } return fCodeTemplateStore; }

Target:
public TemplateStore getCodeTemplateStore() { if (fCodeTemplateStore == null) { Promise<TemplateStore> p = getTemplateStoreInitializer().getTemplateStore(); try { fCodeTemplateStore = p.getValue(); } catch (InvocationTargetException e) { log(e); } catch (InterruptedException e) { log(e); } } return fCodeTemplateStore; }
Source:
public AccountServiceMetrics(MetricRegistry metricRegistry) { startupTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "startupTimeInMs")); updateAccountTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "updateAccountTimeInMs")); fetchRemoteAccountTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "fetchRemoteAccountTimeInMs")); unRecognizedMessageErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "unRecognizedMessageErrorCount")); notifyAccountDataChangeErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "notifyAccountDataChangeErrorCount")); updateAccountErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "updateAccountErrorCount")); fetchRemoteAccountErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "fetchRemoteAccountErrorCount")); remoteDataCorruptionErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "remoteDataCorruptionErrorCount")); }

Target:
public AccountServiceMetrics(MetricRegistry metricRegistry) { startupTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "StartupTimeInMs")); updateAccountTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "UpdateAccountTimeInMs")); fetchRemoteAccountTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "FetchRemoteAccountTimeInMs")); unRecognizedMessageErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "UnRecognizedMessageErrorCount")); notifyAccountDataChangeErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "NotifyAccountDataChangeErrorCount")); updateAccountErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "UpdateAccountErrorCount")); fetchRemoteAccountErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "FetchRemoteAccountErrorCount")); remoteDataCorruptionErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "RemoteDataCorruptionErrorCount")); }
Source:
public void testConvertToTask() { UserTaskInstanceDesc userTaskWithSla = new UserTaskInstanceDesc(Long.valueOf(1), "Ready", new Date(), "Task1_name", "Task1_desc", 1, "Task1_Owner", "Task1_Creator", "deployment", "Process", 1L, new Date(), new Date(), 1L, new Date(), ProcessInstance.SLA_PENDING); UserTaskInstanceDesc userTask = new UserTaskInstanceDesc(Long.valueOf(1), "Ready", new Date(), "Task1_name", "Task1_desc", 1, "Task1_Owner", "Task1_Creator", "deployment", "Process", 1L, new Date(), new Date()); verifyTaskInstanceEqualsUserTaskInstance(userTask, ConvertUtils.convertToTask(userTask)); verifyTaskInstanceEqualsUserTaskInstance(userTaskWithSla, ConvertUtils.convertToTask(userTaskWithSla)); }

Target:
public void testConvertToTask() { Date testDate = new Date(); UserTaskInstanceDesc userTaskWithSla = new UserTaskInstanceDesc(Long.valueOf(1), "Ready", testDate, "Task1_name", "Task1_desc", 1, "Task1_Owner", "Task1_Creator", "deployment", "Process", 1L, testDate, testDate, 1L, testDate, ProcessInstance.SLA_PENDING); UserTaskInstanceDesc userTask = new UserTaskInstanceDesc(Long.valueOf(1), "Ready", testDate, "Task1_name", "Task1_desc", 1, "Task1_Owner", "Task1_Creator", "deployment", "Process", 1L, testDate, testDate); verifyTaskInstanceEqualsUserTaskInstance(userTask, ConvertUtils.convertToTask(userTask)); verifyTaskInstanceEqualsUserTaskInstance(userTaskWithSla, ConvertUtils.convertToTask(userTaskWithSla)); }
Source:
public CRC32CDigestManager(long ledgerId, boolean useV2Protocol, ByteBufAllocator allocator) { super(ledgerId, useV2Protocol, allocator); if (!Sse42Crc32C.isSupported()) { log.error("Sse42Crc32C is not supported, will use slower CRC32C implementation."); } }

Target:
public CRC32CDigestManager(long ledgerId, boolean useV2Protocol, ByteBufAllocator allocator) { super(ledgerId, useV2Protocol, allocator); if (!Sse42Crc32C.isSupported()) { log.error("Sse42Crc32C is not supported, will use a slower CRC32C implementation."); } }
Source:
public static Step map(org.ovirt.engine.core.common.job.Step entity, Step step) { Step model = step != null ? step : new Step(); model.setId(entity.getId().toString()); if (entity.getParentStepId() != null) { Step parentStep = new Step(); parentStep.setId(entity.getParentStepId().toString()); model.setParentStep(parentStep); } Job job = new Job(); job.setId(entity.getJobId().toString()); model.setJob(job); StepEnum type = map(entity.getStepType()); model.setType(type == null ? null : type.value()); model.setDescription(entity.getDescription()); model.setNumber(entity.getStepNumber()); model.setStatus(JobMapper.map(entity.getStatus(), null)); model.setStartTime(DateMapper.map(entity.getStartTime(), null)); if (entity.getEndTime() != null) { model.setEndTime(TypeConversionHelper.toXMLGregorianCalendar(entity.getEndTime(), null)); } model.setExternal(entity.isExternal()); if (entity.getExternalSystem() != null && entity.getExternalSystem().getType() != null) { model.setExternalType(entity.getExternalSystem().getType().name()); } return model; }

Target:
public static Step map(org.ovirt.engine.core.common.job.Step entity, Step step) { Step model = step != null ? step : new Step(); model.setId(entity.getId().toString()); if (entity.getParentStepId() != null) { Step parentStep = new Step(); parentStep.setId(entity.getParentStepId().toString()); model.setParentStep(parentStep); } Job job = new Job(); job.setId(entity.getJobId().toString()); model.setJob(job); StepEnum type = map(entity.getStepType()); model.setType(type == null ? null : type.value()); model.setDescription(entity.getDescription()); model.setNumber(entity.getStepNumber()); model.setStatus(JobMapper.map(entity.getStatus(), null)); model.setStartTime(DateMapper.map(entity.getStartTime(), null)); if (entity.getEndTime() != null) { model.setEndTime(TypeConversionHelper.toXMLGregorianCalendar(entity.getEndTime(), null)); } model.setExternal(entity.isExternal()); if (entity.getExternalSystem() != null && entity.getExternalSystem().getType() != null) { model.setExternalType(map(entity.getExternalSystem().getType())); } return model; }
Source:
public AbstractRibbonCommandFactory(Set<ZuulFallbackProvider> fallbackProviders){ this.fallbackProviders = fallbackProviders; this.fallbackProviderCache = new HashMap<String, ZuulFallbackProvider>(); }

Target:
public AbstractRibbonCommandFactory(Set<ZuulFallbackProvider> fallbackProviders){ this.fallbackProviderCache = new HashMap<String, ZuulFallbackProvider>(); for(ZuulFallbackProvider provider : fallbackProviders) { fallbackProviderCache.put(provider.getRoute(), provider); } }
Source:
private ByteBuffer readBlob(ReadableStreamChannel postContent) throws InterruptedException { ByteBuffer blobData = ByteBuffer.allocate((int) postContent.getSize()); ByteBufferSWC channel = new ByteBufferSWC(); postContent.readInto(channel, new CloseWriteChannelCallback(channel)); ByteBuffer chunk = channel.getNextChunk(); BufferOverflowException exception = null; while (chunk != null) { if (chunk.remaining() > blobData.remaining()) { exception = new BufferOverflowException(); } else { blobData.put(chunk); } channel.resolveChunk(chunk, exception); if (exception != null) { channel.close(); throw exception; } else { chunk = channel.getNextChunk(); } } blobData.flip(); return blobData; }

Target:
private ByteBuffer readBlob(ReadableStreamChannel postContent) throws InterruptedException { ByteBuffer blobData = ByteBuffer.allocate((int) postContent.getSize()); ByteBufferAWC channel = new ByteBufferAWC(); postContent.readInto(channel, new CloseWriteChannelCallback(channel)); ByteBuffer chunk = channel.getNextChunk(); IllegalStateException exception = null; while (chunk != null) { if (chunk.remaining() > blobData.remaining()) { exception = new IllegalStateException("Data size advertized does not match actual size of data"); } else { blobData.put(chunk); } channel.resolveChunk(chunk, exception); if (exception != null) { channel.close(); throw exception; } else { chunk = channel.getNextChunk(); } } blobData.flip(); return blobData; }
Source:
public final <A, B> Effect1<B> comap(Effect1<A> e1, final F<B, A> f) { return b -> { e1.f(f.f(b)); }; }

Target:
public final <A, B> Effect1<B> comap(Effect1<A> e1, final F<B, A> f) { return b -> e1.f(f.f(b)); }
Source:
private static void checkSequenceName(final String name) { ValidationUtils.nonNull(name ,"Sequence name should not be null"); ValidationUtils.nonEmpty(name,"Sequence name should not be empty"); for (int i = 0; i < name.length(); i++) { final char ch = name.charAt(i); if (Character.isWhitespace(ch)) { throw new IllegalArgumentException("the input name contains blank characters: '" + name + "'"); } else if (Character.isISOControl(ch)) { throw new IllegalArgumentException("the input name contains control characters: '" + name + "'"); } } }

Target:
private static void checkSequenceName(final String name) { ValidationUtils.nonEmpty(name, "Sequence name"); for (int i = 0; i < name.length(); i++) { final char ch = name.charAt(i); if (Character.isWhitespace(ch)) { throw new IllegalArgumentException("the input name contains blank characters: '" + name + "'"); } else if (Character.isISOControl(ch)) { throw new IllegalArgumentException("the input name contains control characters: '" + name + "'"); } } }
Source:
public void resolveComponentTypes() { componentBuildingDefinitionRegistry.ifPresent(buildingDefinitionRegistry -> { executeOnEveryComponentTree(componentModel -> { Optional<ComponentBuildingDefinition<?>> buildingDefinition = buildingDefinitionRegistry.getBuildingDefinition(componentModel.getIdentifier()); buildingDefinition.map(definition -> { ObjectTypeVisitor typeDefinitionVisitor = new ObjectTypeVisitor(componentModel); definition.getTypeDefinition().visit(typeDefinitionVisitor); componentModel.setType(typeDefinitionVisitor.getType()); return definition; }).orElseGet(() -> { String classParameter = componentModel.getRawParameters().get(CLASS_ATTRIBUTE); if (classParameter != null) { try { componentModel.setType(ClassUtils.loadClass(classParameter, currentThread().getContextClassLoader())); } catch (ClassNotFoundException e) { throw new RuntimeConfigurationException(createStaticMessage(e.getMessage()), e); } } return null; }); }); }); ReflectionCache reflectionCache = new ReflectionCache(); Map<ComponentIdentifier, MetadataTypeModelAdapter> registry = new HashMap(); extensionModelHelper.getExtensionsModels().stream().forEach(extensionModel -> extensionModel.getTypes().stream() .filter(p -> IntrospectionUtils.isInstantiable(p, reflectionCache)) .forEach(parameterType -> { registerTopLevelParameter(parameterType, reflectionCache, registry, extensionModel); })); executeOnEveryComponentTree(componentModel -> { if (registry.containsKey(componentModel.getIdentifier())) { componentModel.setMetadataTypeModelAdapter(registry.get(componentModel.getIdentifier())); } }); }

Target:
public void resolveComponentTypes() { componentBuildingDefinitionRegistry.ifPresent(buildingDefinitionRegistry -> { executeOnEveryComponentTree(componentModel -> { Optional<ComponentBuildingDefinition<?>> buildingDefinition = buildingDefinitionRegistry.getBuildingDefinition(componentModel.getIdentifier()); buildingDefinition.map(definition -> { ObjectTypeVisitor typeDefinitionVisitor = new ObjectTypeVisitor(componentModel); definition.getTypeDefinition().visit(typeDefinitionVisitor); componentModel.setType(typeDefinitionVisitor.getType()); return definition; }).orElseGet(() -> { String classParameter = componentModel.getRawParameters().get(CLASS_ATTRIBUTE); if (classParameter != null) { try { componentModel.setType(ClassUtils.loadClass(classParameter, currentThread().getContextClassLoader())); } catch (ClassNotFoundException e) { throw new RuntimeConfigurationException(createStaticMessage(e.getMessage()), e); } } return null; }); }); }); ReflectionCache reflectionCache = new ReflectionCache(); Map<ComponentIdentifier, MetadataTypeModelAdapter> registry = new HashMap(); extensionModelHelper.getExtensionsModels().stream().forEach(extensionModel -> extensionModel.getTypes().stream() .filter(p -> isInstantiable(p, reflectionCache)) .forEach(parameterType -> registerTopLevelParameter(parameterType, reflectionCache, registry, extensionModel))); executeOnEveryComponentTree(componentModel -> { if (registry.containsKey(componentModel.getIdentifier())) { componentModel.setMetadataTypeModelAdapter(registry.get(componentModel.getIdentifier())); } }); }
Source:
public void testDelete() throws InterruptedException { server.enqueue( new MockResponse().setBody("") ); snapshotApi().deleteSnapshot("some-id"); assertEquals(server.getRequestCount(), 1); assertSent(server, "DELETE", "/snapshots/some-id"); }

Target:
public void testDelete() throws InterruptedException { server.enqueue(response204()); snapshotApi().delete("some-id"); assertEquals(server.getRequestCount(), 1); assertSent(server, "DELETE", "/snapshots/some-id"); }
Source:
void syncConfig() { for(Options configOption:Options.values()) { configOption.value=configuration.getInt(configOption.name(), Configuration.CATEGORY_GENERAL, configOption.defaultValue, configOption.minValue, configOption.maxValue, configOption.description); } if (configuration.hasChanged()) { configuration.save(); } }

Target:
void syncConfig() { for (Options configOption : Options.values()) { configOption.value = configuration.getInt(configOption.getNicelyFormattedName(), Configuration.CATEGORY_GENERAL, configOption.defaultValue, configOption.minValue, configOption.maxValue, configOption.description); } if (configuration.hasChanged()) { configuration.save(); } }
Source:
public Observable<GitHubRepository> getRepository() { return repository; }

Target:
public Observable<GitHubRepository> getRepository() { return repository.hide(); }
Source:
public static void processEntitySpawnsFromEvent(PhaseContext<?> context, SpawnEntityEvent destruct) { for (org.spongepowered.api.entity.Entity entity : destruct.getEntities()) { final Entity minecraftEntity = toNative(entity); if (minecraftEntity instanceof EntityItem) { final ItemStack item = ((EntityItem) minecraftEntity).getItem(); if (!item.isEmpty()) { final Optional<Entity> customEntityItem = ((IMixinItem) item.getItem()).getCustomEntityItem(minecraftEntity.getEntityWorld(), minecraftEntity, item); if (customEntityItem.isPresent()) { context.getCapturedEntities().add(fromNative(customEntityItem.get())); continue; } } } getMixinWorld(entity).forceSpawnEntity(entity); } }

Target:
public static boolean processEntitySpawnsFromEvent(PhaseContext<?> context, SpawnEntityEvent destruct) { final User creator = context.getNotifier().orElse(context.getOwner().orElse(null)); return processEntitySpawnsFromEvent(destruct, ENTITY_CREATOR_FUNCTION.apply(context)); }
Source:
private static int covnertIpToInt(String ipAdd) { String[] subAdd = ipAdd.split("\\."); int output = 0; int temp; for (int index = 3; index > -1; index--) { temp = Integer.parseInt(subAdd[3 - index]); temp <<= (index * 8); output |= temp; } return output; }

Target:
private static long covnertIpToInt(String ipAdd) { String[] subAdd = ipAdd.split("\\."); long output = 0; long temp; for (int index = 3; index > -1; index--) { temp = Integer.parseInt(subAdd[3 - index]); temp <<= (index * 8); output |= temp; } return output; }
Source:
public Map<String, MetricPlotDTO> createTaskPlots() { String sessionId = getSessionIdProvider().getSessionId(); List<MetricDetails> metricDetails= getHibernateTemplate().find( "select m from MetricDetails m where m.taskData.sessionId=? and m.metric=?", sessionId, metricName); Map<String, List<MetricDetails>> aggregatedByTasks = Maps.newLinkedHashMap(); for (MetricDetails detail : metricDetails) { List<MetricDetails> taskData = aggregatedByTasks.get(detail.getTaskData().getTaskId()); if (taskData == null) { taskData = new LinkedList<MetricDetails>(); aggregatedByTasks.put(detail.getTaskData().getTaskId(),taskData); } taskData.add(detail); } Map<String, MetricPlotDTO> taskPlots = Maps.newHashMap(); for (String taskId : aggregatedByTasks.keySet()) { MetricPlotDTO taskPlot = new MetricPlotDTO(); List<MetricDetails> taskStats = aggregatedByTasks.get(taskId); XYSeries plotEntry = new XYSeries(metricName); String taskName = null; for (MetricDetails stat : taskStats) { if (taskName == null) { taskName = stat.getTaskData().getTaskName(); } plotEntry.add(stat.getTime(), stat.getValue()); } XYSeriesCollection plotCollection = new XYSeriesCollection(); plotCollection.addSeries(plotEntry); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(plotCollection, null); plotCollection = pair.getSecond(); JFreeChart chartMetric = ChartHelper.createXYChart(null, plotCollection, "Time (" + pair.getFirst() + ")", metricName, 2, 2, ChartHelper.ColorTheme.LIGHT); taskPlot.setPlot(new JCommonDrawableRenderer(chartMetric)); taskPlots.put(taskId, taskPlot); } return taskPlots; }

Target:
public Map<String, MetricPlotDTO> createTaskPlots() { String sessionId = getSessionIdProvider().getSessionId(); List<MetricDetails> metricDetails= getHibernateTemplate().find( "select m from MetricDetails m where m.taskData.sessionId=? and m.metric=?", sessionId, metricName); Map<String, List<MetricDetails>> aggregatedByTasks = Maps.newLinkedHashMap(); for (MetricDetails detail : metricDetails) { List<MetricDetails> taskData = aggregatedByTasks.get(detail.getTaskData().getTaskId()); if (taskData == null) { taskData = new LinkedList<MetricDetails>(); aggregatedByTasks.put(detail.getTaskData().getTaskId(),taskData); } taskData.add(detail); } Map<String, MetricPlotDTO> taskPlots = Maps.newHashMap(); for (String taskId : aggregatedByTasks.keySet()) { MetricPlotDTO taskPlot = new MetricPlotDTO(); List<MetricDetails> taskStats = aggregatedByTasks.get(taskId); XYSeries plotEntry = new XYSeries(metricName); for (MetricDetails stat : taskStats) { plotEntry.add(stat.getTime(), stat.getValue()); } XYSeriesCollection plotCollection = new XYSeriesCollection(); plotCollection.addSeries(plotEntry); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(plotCollection, null); plotCollection = pair.getSecond(); JFreeChart chartMetric = ChartHelper.createXYChart(null, plotCollection, "Time (" + pair.getFirst() + ")", metricName, 2, 2, ChartHelper.ColorTheme.LIGHT); taskPlot.setPlot(new JCommonDrawableRenderer(chartMetric)); taskPlots.put(taskId, taskPlot); } return taskPlots; }
Source:
public ListFactoryBean pooledLdapConnectionFactoryHealthIndicatorListFactoryBean() { val list = new ListFactoryBean() { @Override protected void destroyInstance(final List list) { list.forEach(connectionFactory -> { ((ConnectionFactory) connectionFactory).close(); }); } }; list.setSourceList(new ArrayList()); return list; }

Target:
public ListFactoryBean pooledLdapConnectionFactoryHealthIndicatorListFactoryBean() { val list = new ListFactoryBean() { @Override protected void destroyInstance(final List list) { list.forEach(connectionFactory -> ((ConnectionFactory) connectionFactory).close() ); } }; list.setSourceList(new ArrayList<>()); return list; }
Source:
public RealtimeTableDataManager(Semaphore segmentBuildSemaphore) { _segmentBuildSemaphore = segmentBuildSemaphore; _upsertMetadataTableManager = new UpsertMetadataTableManager(); }

Target:
public RealtimeTableDataManager(Semaphore segmentBuildSemaphore) { _segmentBuildSemaphore = segmentBuildSemaphore; }
Source:
public boolean belowMemThreshold() { if (mDatabaseFile.exists()) { return Math.min(mDatabaseFile.getUsableSpace(), 20 * 1024 * 1024) >= mDatabaseFile.length(); } return true; }

Target:
public boolean belowMemThreshold() { if (mDatabaseFile.exists()) { return Math.max(mDatabaseFile.getUsableSpace(), mConfig.getMinimumDatabaseLimit()) >= mDatabaseFile.length(); } return true; }
Source:
public void testMapFunctionWithNumberItemAndCountFunction() { NumberItem item1 = new NumberItem("item1"); GroupFunctionDTO gFuncDTO = new GroupFunctionDTO(); gFuncDTO.name = "COUNT"; gFuncDTO.params = new String[] { ".*hello.*" }; GroupFunction gFunc = ItemDTOMapper.mapFunction(item1, gFuncDTO); assertThat(gFunc, instanceOf(ArithmeticGroupFunction.Count.class)); }

Target:
public void testMapFunctionWithNumberItemAndCountFunction() { NumberItem item1 = new NumberItem("item1"); GroupFunctionDTO gFuncDTO = new GroupFunctionDTO(); gFuncDTO.name = "COUNT"; gFuncDTO.params = new String[] { ".*hello.*" }; GroupFunction gFunc = ItemDTOMapper.mapFunction(item1, gFuncDTO); assertThat(gFunc, instanceOf(ArithmeticGroupFunction.Count.class)); assertThat(gFunc.getParameters().length, is(1)); assertThat(gFunc.getParameters()[0], instanceOf(StringType.class)); }
Source:
void onBind(DriveListItem item) { String dateModified = null; if (item.getDate() != null) { try { dateModified = new SimpleDateFormat(getContext().getString( R.string.modified_on_date_at_time), Locale.getDefault()) .format(new Date(item.getDate().getValue())); } catch (IllegalArgumentException e) { Timber.e(e); } } if (item.getType() == DriveListItem.FILE) { Drawable d = ContextCompat.getDrawable(getContext(), R.drawable.form_state_blank); imageView.setImageDrawable(d); checkBox.setVisibility(View.VISIBLE); if (isNewVersion(item)) { formUpdateAlert.setVisibility(View.VISIBLE); } else { formUpdateAlert.setVisibility(View.GONE); } } else { Drawable d = ContextCompat.getDrawable(getContext(), R.drawable.ic_folder); imageView.setImageDrawable(d); checkBox.setVisibility(View.GONE); formUpdateAlert.setVisibility(View.GONE); } formTitle.setText(item.getName()); formSubtitle.setText(dateModified); checkBox.setChecked(item.isSelected()); }

Target:
void onBind(DriveListItem item) { String dateModified = null; if (item.getDate() != null) { try { dateModified = new SimpleDateFormat(getContext().getString( R.string.modified_on_date_at_time), Locale.getDefault()) .format(new Date(item.getDate().getValue())); } catch (IllegalArgumentException e) { Timber.e(e); } } if (item.getType() == DriveListItem.FILE) { Drawable d = ContextCompat.getDrawable(getContext(), R.drawable.form_state_blank); imageView.setImageDrawable(d); checkBox.setVisibility(View.VISIBLE); formUpdateAlert.setVisibility(item.isNewerVersion() ? View.VISIBLE : View.GONE); } else { Drawable d = ContextCompat.getDrawable(getContext(), R.drawable.ic_folder); imageView.setImageDrawable(d); checkBox.setVisibility(View.GONE); formUpdateAlert.setVisibility(View.GONE); } formTitle.setText(item.getName()); formSubtitle.setText(dateModified); checkBox.setChecked(item.isSelected()); }
Source:
public static Double lineLocatePoint(@SqlType(GEOMETRY_TYPE_NAME) Slice lineSlice, @SqlType(GEOMETRY_TYPE_NAME) Slice pointSlice) { Geometry line = JtsGeometrySerde.deserialize(lineSlice); Geometry point = JtsGeometrySerde.deserialize(pointSlice); if (line.isEmpty() || point.isEmpty()) { return null; } GeometrySerializationType lineType = getForJtsGeometryType(line.getGeometryType()); if (lineType != LINE_STRING && lineType != MULTI_LINE_STRING) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("First argument to line_locate_point must be a LineString or a MultiLineString. Got: %s", line.getGeometryType())); } GeometrySerializationType pointType = getForJtsGeometryType(point.getGeometryType()); if (pointType != POINT) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Second argument to line_locate_point must be a Point. Got: %s", point.getGeometryType())); } return new LengthIndexedLine(line).indexOf(point.getCoordinate()); }

Target:
public static Double lineLocatePoint(@SqlType(GEOMETRY_TYPE_NAME) Slice lineSlice, @SqlType(GEOMETRY_TYPE_NAME) Slice pointSlice) { Geometry line = JtsGeometrySerde.deserialize(lineSlice); Geometry point = JtsGeometrySerde.deserialize(pointSlice); if (line.isEmpty() || point.isEmpty()) { return null; } GeometryType lineType = GeometryType.getForJtsGeometryType(line.getGeometryType()); if (lineType != GeometryType.LINE_STRING && lineType != GeometryType.MULTI_LINE_STRING) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("First argument to line_locate_point must be a LineString or a MultiLineString. Got: %s", line.getGeometryType())); } GeometryType pointType = GeometryType.getForJtsGeometryType(point.getGeometryType()); if (pointType != GeometryType.POINT) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Second argument to line_locate_point must be a Point. Got: %s", point.getGeometryType())); } return new LengthIndexedLine(line).indexOf(point.getCoordinate()); }
Source:
public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) { super.handleColumnMultiEdit(treeColumn, treeItems); String colName = treeColumn.getText(); if (EXTRA_COLUMNS.contains(colName)) { AWorkbench.popup("ERROR", "Can't change the field " + colName); } try { IAttributeType attributeType = null; try { attributeType = AttributeTypeManager.getType(colName); } catch (OseeTypeDoesNotExist ex) { } if (attributeType != null) { Set<Artifact> artifacts = new HashSet<>(); for (TreeItem item : treeItems) { artifacts.add((Artifact) item.getData()); } if (ArtifactPromptChange.promptChangeAttribute(attributeType, artifacts, false)) { refresh(); editor.onDirtied(); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }

Target:
public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) { super.handleColumnMultiEdit(treeColumn, treeItems); String colName = treeColumn.getText(); if (EXTRA_COLUMNS.contains(colName)) { AWorkbench.popup("ERROR", "Can't change the field " + colName); } try { if (AttributeTypeManager.typeExists(colName)) { IAttributeType attributeType = AttributeTypeManager.getType(colName); Set<Artifact> artifacts = new HashSet<>(); for (TreeItem item : treeItems) { artifacts.add((Artifact) item.getData()); } if (ArtifactPromptChange.promptChangeAttribute(attributeType, artifacts, false)) { refresh(); editor.onDirtied(); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
Source:
public List<StoredWorkflowDefinition> insertWorkflowDefinitions( StoredRevision revision, List<WorkflowDefinition> defs, SchedulerManager srm, Instant currentTime) throws ResourceConflictException { List<StoredWorkflowDefinition> list = insertWorkflowDefinitionsWithoutSchedules(revision, defs); updateSchedules(revision, list, srm, currentTime); validateSla(defs); return list; }

Target:
public List<StoredWorkflowDefinition> insertWorkflowDefinitions( StoredRevision revision, List<WorkflowDefinition> defs, SchedulerManager srm, Instant currentTime) throws ResourceConflictException { validateSla(defs); List<StoredWorkflowDefinition> list = insertWorkflowDefinitionsWithoutSchedules(revision, defs); updateSchedules(revision, list, srm, currentTime); return list; }
Source:
static LabelTypes getLegacyTypes(ReviewDb db) throws SQLException { List<LabelType> types = Lists.newArrayListWithCapacity(2); Statement catStmt = null; PreparedStatement valStmt = null; ResultSet catRs = null; try { catStmt = ((JdbcSchema) db).getConnection().createStatement(); catRs = catStmt.executeQuery( "SELECT category_id, name, abbreviated_name, function_name, " + " copy_min_score" + " FROM approval_categories" + " ORDER BY position, name"); valStmt = ((JdbcSchema) db).getConnection().prepareStatement( "SELECT name, value" + " FROM approval_category_values" + " WHERE category_id = ?"); while (catRs.next()) { String id = catRs.getString("category_id"); valStmt.setString(1, id); List<LabelValue> values = Lists.newArrayListWithCapacity(5); ResultSet valRs = valStmt.executeQuery(); try { while (valRs.next()) { values.add(new LabelValue( valRs.getShort("value"), valRs.getString("name"))); } } finally { valRs.close(); } LabelType type = new LabelType(getLabelName(catRs.getString("name")), values); type.setId(id); type.setAbbreviatedName(catRs.getString("abbreviated_name")); type.setFunctionName(catRs.getString("function_name")); type.setCopyMinScore(catRs.getBoolean("copy_min_score")); types.add(type); } } finally { if (valStmt != null) { valStmt.close(); } if (catRs != null) { catRs.close(); } if (catStmt != null) { catStmt.close(); } } return new LabelTypes(types); }

Target:
static LabelTypes getLegacyTypes(ReviewDb db) throws SQLException { List<LabelType> types = Lists.newArrayListWithCapacity(2); Statement catStmt = null; PreparedStatement valStmt = null; ResultSet catRs = null; try { catStmt = ((JdbcSchema) db).getConnection().createStatement(); catRs = catStmt.executeQuery( "SELECT category_id, name, abbreviated_name, function_name, " + " copy_min_score" + " FROM approval_categories" + " ORDER BY position, name"); valStmt = ((JdbcSchema) db).getConnection().prepareStatement( "SELECT value, name" + " FROM approval_category_values" + " WHERE category_id = ?"); while (catRs.next()) { String id = catRs.getString("category_id"); valStmt.setString(1, id); List<LabelValue> values = Lists.newArrayListWithCapacity(5); ResultSet valRs = valStmt.executeQuery(); try { while (valRs.next()) { values.add(new LabelValue( valRs.getShort("value"), valRs.getString("name"))); } } finally { valRs.close(); } LabelType type = new LabelType(getLabelName(catRs.getString("name")), values); type.setId(id); type.setAbbreviatedName(catRs.getString("abbreviated_name")); type.setFunctionName(catRs.getString("function_name")); type.setCopyMinScore("Y".equals(catRs.getString("copy_min_score"))); types.add(type); } } finally { if (valStmt != null) { valStmt.close(); } if (catRs != null) { catRs.close(); } if (catStmt != null) { catStmt.close(); } } return new LabelTypes(types); }
Source:
public Response ticket(Action action) { GraphicsType graphicsType = deriveGraphicsType(); if (graphicsType == null) { Fault fault = new Fault(); fault.setReason("Operation Failed"); fault.setDetail(localize(Messages.CANNOT_GET_TICKET_FOR_DOWN_VM)); return Response.status(Response.Status.CONFLICT).entity(fault).build(); } String consoleId = BackendGraphicsConsoleHelper.asConsoleId(graphicsType); return getGraphicsConsolesResource().getConsoleResource(consoleId).ticket(action); }

Target:
public Response ticket(Action action) { return getTicketer(action).setTicket(deriveGraphicsType()); }
Source:
public void testComputeConcurrencyFactor() { int maxConccurrentRangeRequest = 32; int cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 30, maxConccurrentRangeRequest, 500, 0); assertEquals(maxConccurrentRangeRequest, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 80, maxConccurrentRangeRequest, 500, 0); assertEquals(20, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 60, maxConccurrentRangeRequest, 480, 240); assertEquals(maxConccurrentRangeRequest, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 30, maxConccurrentRangeRequest, 480, 240); assertEquals(30, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 1, maxConccurrentRangeRequest, 480, 479); assertEquals(1, cf); }

Target:
public void testComputeConcurrencyFactor() { int maxConcurrentRangeRequest = 32; int cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 30, maxConcurrentRangeRequest, 500, 0); assertEquals(maxConcurrentRangeRequest, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 80, maxConcurrentRangeRequest, 500, 0); assertEquals(20, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 60, maxConcurrentRangeRequest, 480, 240); assertEquals(maxConcurrentRangeRequest, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 30, maxConcurrentRangeRequest, 480, 240); assertEquals(30, cf); cf = StorageProxy.RangeCommandIterator.computeConcurrencyFactor(100, 1, maxConcurrentRangeRequest, 480, 479); assertEquals(1, cf); }
Source:
private boolean addPriorityBuffer(SequenceBuffer sequenceBuffer) throws IOException { receivedBuffers.addPriorityElement(sequenceBuffer); if (channelStatePersister.checkForBarrier(sequenceBuffer.buffer)) { lastOvertakenSequenceNumber = sequenceBuffer.sequenceNumber; } return receivedBuffers.getNumPriorityElements() == 1; }

Target:
private boolean addPriorityBuffer(SequenceBuffer sequenceBuffer) throws IOException { receivedBuffers.addPriorityElement(sequenceBuffer); channelStatePersister .checkForBarrier(sequenceBuffer.buffer) .filter(id -> id > lastBarrierId) .ifPresent(id -> { lastBarrierId = id; lastBarrierSequenceNumber = sequenceBuffer.sequenceNumber; }); return receivedBuffers.getNumPriorityElements() == 1; }
Source:
public void run() { MessageWrapper messageWrap; WebSocketPassiveScannerPlugin currentPassiveScanner; WebSocketMessageDTO currentMessage; Iterator<WebSocketPassiveScanner> iterator; while (isPassiveScannerActive){ if (messagesBuffer.isEmpty() || tableWebSocket == null) { try { Thread.sleep(SLEEP_TIME); } catch (InterruptedException e) { LOGGER.info("Sleeping was interrupted",e); } if (!isPassiveScannerActive) { break; } }else{ messageWrap = messagesBuffer.poll(); try { currentMessage = tableWebSocket.getMessage(messageWrap.messageId, messageWrap.channelId); iterator = passiveScannerManager.getIterator(); while (iterator.hasNext()) { currentPassiveScanner = (WebSocketPassiveScannerPlugin) iterator.next(); if (currentPassiveScanner.isEnabled()) { currentPassiveScanner.scanMessage(this, currentMessage); } } } catch (DatabaseException e) { LOGGER.warn("Could not get messages from database", e); } } } }

Target:
public void run() { MessageWrapper messageWrap; WebSocketPassiveScannerDecorator currentPassiveScanner; WebSocketMessageDTO currentMessage; Iterator<WebSocketPassiveScannerDecorator> iterator; WebSocketScanHelperImpl helper = new WebSocketScanHelperImpl(this); while (isActive) { if (messagesBuffer.isEmpty() || tableWebSocket == null) { try { Thread.sleep(SLEEP_TIME); } catch (InterruptedException e) { LOGGER.info("Sleeping was interrupted", e); } if (!isActive) { break; } } else { messageWrap = messagesBuffer.poll(); try { currentMessage = tableWebSocket.getMessage(messageWrap.messageId, messageWrap.channelId); iterator = passiveScannerManager.getIterator(); while (iterator.hasNext()) { if ((currentPassiveScanner = iterator.next()).isEnabled()) { currentPassiveScanner.scanMessage( helper.getWebSocketScanHelper( currentPassiveScanner.getId(), currentMessage), currentMessage); } } } catch (DatabaseException e) { LOGGER.warn("Could not get messages from database", e); } } } }
Source:
private void writeNamedFactory(Transport transport, String factoryName, byte[][] params) { if (factoryName.isEmpty()) { transport.writeByte((short) 0); } else { transport.writeString(factoryName); if (params != null) { transport.writeByte((short) params.length); for (byte[] param : params) transport.writeArray(param); } else { transport.writeByte((short) 0); } } }

Target:
private void writeNamedFactory(Transport transport, String factoryName, byte[][] params) { transport.writeString(factoryName); if (!factoryName.isEmpty()) { if (params != null) { transport.writeByte((short) params.length); for (byte[] param : params) transport.writeArray(param); } else { transport.writeByte((short) 0); } } }
Source:
public void startTimer() throws ExchangeSchedulerException { m_bRunnable = true; try { getInstance().initialize(); getInstance().setName("ExchangeScheduler Thread"); getInstance().setDaemon(true); getInstance().start(); } catch (Exception e) { String sErrorMessage = "Failed to start the Exchange Scheduler. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); throw new ExchangeSchedulerException(sErrorMessage, e); } LOG.info("ExchangeScheduler has just been started now."); }

Target:
public void startTimer() throws ExchangeSchedulerException { m_bRunnable = true; try { getInstance().initialize(); getInstance().setName("ExchangeScheduler Thread"); getInstance().setDaemon(true); getInstance().start(); } catch (Exception e) { throw new ExchangeSchedulerException("Failed to start the Exchange Scheduler: " + e.getLocalizedMessage(), e); } LOG.info("ExchangeScheduler has just been started now."); }
Source:
public DataContainer toContainer() { return new MemoryDataContainer().set(Keys.STATISTICS.getQuery(), this.getValue()); }

Target:
public DataContainer toContainer() { return super.toContainer().set(Keys.STATISTICS.getQuery(), this.getValue()); }
Source:
public WhereHaving visitNotExpression(NotFilterExpression expression) { FilterExpression normalized = getNormalizationVisitor().visitNotExpression(expression); if (normalized instanceof AndFilterExpression) { return visitAndExpression((AndFilterExpression) normalized); } else if (normalized instanceof OrFilterExpression) { return visitOrExpression((OrFilterExpression) normalized); } else if (normalized instanceof NotFilterExpression) { normalized = ((NotFilterExpression) normalized).getNegated(); return visitNotExpression((NotFilterExpression) normalized); } else { return visitPredicate((FilterPredicate) normalized); } }

Target:
public FilterConstraints visitNotExpression(NotFilterExpression expression) { FilterExpression normalized = getNormalizationVisitor().visitNotExpression(expression); if (normalized instanceof AndFilterExpression) { return visitAndExpression((AndFilterExpression) normalized); } else if (normalized instanceof OrFilterExpression) { return visitOrExpression((OrFilterExpression) normalized); } else if (normalized instanceof NotFilterExpression) { FilterConstraints negatedConstraint = visitNotExpression((NotFilterExpression) normalized); if (negatedConstraint.isPureWhere()) { return FilterConstraints.pureWhere(new NotFilterExpression(negatedConstraint.getWhereExpression())); } else { return FilterConstraints.pureHaving(new NotFilterExpression(negatedConstraint.getHavingExpression())); } } else { return visitPredicate((FilterPredicate) normalized); } }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_web_dialog); final ProgressBar progress = (ProgressBar) findViewById(R.id.loading_indicator); progress.setVisibility(View.GONE); webView = (WebView) findViewById(R.id.eula_webView); final URLInterceptorWebViewClient client = new URLInterceptorWebViewClient(this, webView); client.setPageStatusListener(new URLInterceptorWebViewClient.IPageStatusListener() { @Override public void onPageStarted() { progress.setVisibility(View.VISIBLE); } @Override public void onPageFinished() { progress.setVisibility(View.GONE); } @Override public void onPageLoadError() { progress.setVisibility(View.GONE); } @Override public void onPagePartiallyLoaded() { progress.setVisibility(View.GONE); } }); webView.loadUrl(getIntent().getStringExtra(ARG_URL)); final String title = getIntent().getStringExtra(ARG_TITLE); if (!TextUtils.isEmpty(title)) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(title); } else { getSupportActionBar().hide(); } }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_webview); final ProgressBar progress = (ProgressBar) findViewById(R.id.loading_indicator); progress.setVisibility(View.GONE); webView = (WebView) findViewById(R.id.eula_webView); final URLInterceptorWebViewClient client = new URLInterceptorWebViewClient(this, webView); client.setPageStatusListener(new URLInterceptorWebViewClient.IPageStatusListener() { @Override public void onPageStarted() { progress.setVisibility(View.VISIBLE); } @Override public void onPageFinished() { progress.setVisibility(View.GONE); } @Override public void onPageLoadError() { progress.setVisibility(View.GONE); } @Override public void onPagePartiallyLoaded() { progress.setVisibility(View.GONE); } }); webView.loadUrl(getIntent().getStringExtra(ARG_URL)); final String title = getIntent().getStringExtra(ARG_TITLE); if (!TextUtils.isEmpty(title)) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(title); } }
Source:
public boolean update(final String key, final String rangeKey,final Map<String,byte[]> payloadByColumn) { final Map<String, AttributeValueUpdate> itemsToUpdate = new HashMap<>(); for (final String payloadColumnName : payloadByColumn.keySet()) { itemsToUpdate.put(payloadColumnName, new AttributeValueUpdate() .withValue(new AttributeValue().withB(ByteBuffer.wrap(payloadByColumn.get(payloadColumnName)))) .withAction(AttributeAction.PUT) ); } final Map<String, AttributeValue> keys = Maps.newHashMap(); keys.put(hashKeyColumnName, new AttributeValue(key)); if (rangeKeyColumnName.isPresent()) { keys.put(rangeKeyColumnName.get(),new AttributeValue(rangeKey)); } final UpdateItemRequest request = new UpdateItemRequest() .withTableName(this.tableName) .withKey(keys) .withAttributeUpdates(itemsToUpdate); try { final UpdateItemResult result = this.dynamoDBClient.updateItem(request); } catch (AmazonServiceException awsException) { logger.error("Server exception result for key {}, rangekey {}", awsException.getMessage(), key, rangeKey); return false; } catch (AmazonClientException acExp) { logger.error("AmazonClientException exception result for key {}, rangekey {}", acExp.getMessage(), key, rangeKey); return false; } return true; }

Target:
public boolean update(final String key, final String rangeKey,final Map<String,byte[]> payloadByColumn) { final Map<String, AttributeValueUpdate> itemsToUpdate = new HashMap<>(); for (final String payloadColumnName : payloadByColumn.keySet()) { itemsToUpdate.put(payloadColumnName, new AttributeValueUpdate() .withValue(new AttributeValue().withB(ByteBuffer.wrap(payloadByColumn.get(payloadColumnName)))) .withAction(AttributeAction.PUT) ); } final Map<String, AttributeValue> keys = Maps.newHashMap(); keys.put(hashKeyColumnName, new AttributeValue(key)); if (rangeKeyColumnName.isPresent()) { keys.put(rangeKeyColumnName.get(),new AttributeValue(rangeKey)); } final UpdateItemRequest request = new UpdateItemRequest() .withTableName(this.tableName) .withKey(keys) .withAttributeUpdates(itemsToUpdate); try { final UpdateItemResult result = this.dynamoDBClient.updateItem(request); return true; } catch (AmazonServiceException awsException) { logger.error("Server exception result for key {}, rangekey {}", awsException.getMessage(), key, rangeKey); } catch (AmazonClientException acExp) { logger.error("AmazonClientException exception result for key {}, rangekey {}", acExp.getMessage(), key, rangeKey); } return false; }
Source:
public void canRemoveAllBricksFromSubVolume() { GlusterVolumeEntity volumeEntity = getDistributedReplacatedVolume(volumeId1, 9, 3); List<GlusterBrickEntity> bricksToRemove = new ArrayList<GlusterBrickEntity>(); bricksToRemove.add(volumeEntity.getBricks().get(6)); bricksToRemove.add(volumeEntity.getBricks().get(7)); bricksToRemove.add(volumeEntity.getBricks().get(8)); ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 3, false); assertTrue(validationResult.isValid()); }

Target:
public void canRemoveAllBricksFromSubVolume() { GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 9, 3); List<GlusterBrickEntity> bricksToRemove = new ArrayList<GlusterBrickEntity>(); bricksToRemove.add(volumeEntity.getBricks().get(6)); bricksToRemove.add(volumeEntity.getBricks().get(7)); bricksToRemove.add(volumeEntity.getBricks().get(8)); ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 3, false); assertTrue(validationResult.isValid()); }