auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark) throws TimeRangeException, AttributeNotFoundException, StateValueTypeException { if (value == null) { throw new IllegalArgumentException(); } try { transState.processStateChange(t, value, attributeQuark); } catch (TimeRangeException e) { throw new TimeRangeException(getSSID() + ' ' + e.getMessage(), e); } catch (AttributeNotFoundException e) { throw new AttributeNotFoundException(getSSID() + ' ' + e.getMessage(), e); } catch (StateValueTypeException e) { <START> throw new StateValueTypeException(getSSID() + ' ' + e.getMessage(), e); <END> } }</code><technical_language>redundant catch exceptions rethrow-them append a message. methods, especially modifyAttribute(), critical path, adding a try{} insertion costly. Especially if calling method try{} this method throws exceptions. decide move handling of exceptions here, extra messages. method need throw exceptions. a bad thing: simply fail insert a state change, stop program. get exception in console/error log explaining happened</technical_language>

Target:
public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark) throws TimeRangeException, AttributeNotFoundException, StateValueTypeException { if (value == null) { throw new IllegalArgumentException(); } transState.processStateChange(t, value, attributeQuark); }
Source:
<code><START> static ItemStack empty() { return builder().itemType(ItemTypes.AIR).build(); } <END></code><technical_language>method body extra line</technical_language>

Target:
static ItemStack empty() { return builder().itemType(ItemTypes.NONE).build(); }
Source:
<code>public void testTLVEncodeProxy() { HAProxyMessageEncoder encoder = new HAProxyMessageEncoder(); EmbeddedChannel ch = new EmbeddedChannel(encoder); List<HAProxyTLV> tlvs = new ArrayList<HAProxyTLV>(); ByteBuf helloWorld = Unpooled.copiedBuffer("hello world", CharsetUtil.US_ASCII); HAProxyTLV alpnTlv = new HAProxyTLV(Type.PP2_TYPE_ALPN, (byte) 0x01, helloWorld.copy()); tlvs.add(alpnTlv); ByteBuf arbitrary = Unpooled.copiedBuffer("an arbitrary string", CharsetUtil.US_ASCII); HAProxyTLV authorityTlv = new HAProxyTLV(Type.PP2_TYPE_AUTHORITY, (byte) 0x01, arbitrary.copy()); tlvs.add(authorityTlv); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443, tlvs); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); assertEquals(byteBuf.getUnsignedShort(14), byteBuf.readableBytes() - V2_HEADER_BYTES_LENGTH); ByteBuf tlv = byteBuf.skipBytes(V2_HEADER_BYTES_LENGTH + IPv4_ADDRESS_BYTES_LENGTH); assertEquals(alpnTlv.typeByteValue(), tlv.readByte()); short bufLength = tlv.readShort(); assertEquals(helloWorld.array().length, bufLength); assertEquals(helloWorld, tlv.readBytes(bufLength)); assertEquals(authorityTlv.typeByteValue(), tlv.readByte()); bufLength = tlv.readShort(); assertEquals(arbitrary.array().length, bufLength); <START> assertEquals(arbitrary, tlv.readBytes(bufLength)); <END> }</code><technical_language>call byteBuf.release() add assertFalse(ch.finish());</technical_language>

Target:
public void testTLVEncodeProxy() { EmbeddedChannel ch = new EmbeddedChannel(INSTANCE); List<HAProxyTLV> tlvs = new ArrayList<HAProxyTLV>(); ByteBuf helloWorld = Unpooled.copiedBuffer("hello world", CharsetUtil.US_ASCII); HAProxyTLV alpnTlv = new HAProxyTLV(Type.PP2_TYPE_ALPN, (byte) 0x01, helloWorld.copy()); tlvs.add(alpnTlv); ByteBuf arbitrary = Unpooled.copiedBuffer("an arbitrary string", CharsetUtil.US_ASCII); HAProxyTLV authorityTlv = new HAProxyTLV(Type.PP2_TYPE_AUTHORITY, (byte) 0x01, arbitrary.copy()); tlvs.add(authorityTlv); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443, tlvs); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); assertEquals(byteBuf.getUnsignedShort(14), byteBuf.readableBytes() - V2_HEADER_BYTES_LENGTH); ByteBuf tlv = byteBuf.skipBytes(V2_HEADER_BYTES_LENGTH + IPv4_ADDRESS_BYTES_LENGTH); assertEquals(alpnTlv.typeByteValue(), tlv.readByte()); short bufLength = tlv.readShort(); assertEquals(helloWorld.array().length, bufLength); assertEquals(helloWorld, tlv.readBytes(bufLength)); assertEquals(authorityTlv.typeByteValue(), tlv.readByte()); bufLength = tlv.readShort(); assertEquals(arbitrary.array().length, bufLength); assertEquals(arbitrary, tlv.readBytes(bufLength)); byteBuf.release(); assertFalse(ch.finish()); }
Source:
<code>private void updateDiskSize(DiskImage diskImage) { try { <START> long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); <END> if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } } catch (NumberFormatException ignored) { } }</code><technical_language>Suggest surround this parsing try-catch. This is is line a potential throw</technical_language>

Target:
private void updateDiskSize(DiskImage diskImage) { long sizeToAddInGigabytes; try { sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); } catch (NumberFormatException ignored) { return; } if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } }
Source:
<code>public void tearDown() { storageFactory.tearDown(); boundedContext.getEventBus().unregister(eventLogger); <START> boundedContext.stop(); <END> }</code><technical_language>I rename stop tearDown something</technical_language>

Target:
public void tearDown() { storageFactory.tearDown(); boundedContext.getEventBus().unregister(eventLogger); boundedContext.close(); }
Source:
<code>void connectionChanged(Connection connection) { discoveryExecutor.execute( () -> { if (connection == null) { discoveryManager = null; return; } discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); presenceSarosSupport = new HashMap<>(); <START> }); <END> }</code><technical_language>this CTOR</technical_language>

Target:
void connectionChanged(Connection connection) { discoveryExecutor.execute( () -> { if (connection == null) { discoveryManager = null; return; } discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); resourcesSarosSupport = new HashMap<>(); }); }
Source:
<code>private void submitShutdownTask() { synchronized (this) { if (executor.isShutdown()) { return; } executor.submit(new Runnable() { public void run() { synchronized (Auditor.this) { <START> LOG.error("Shutting down Auditor's Executor"); <END> executor.shutdown(); } } }); } }</code><technical_language>Error</technical_language>

Target:
private void submitShutdownTask() { synchronized (this) { LOG.info("Executing submitShutdownTask"); if (executor.isShutdown()) { LOG.info("executor is already shutdown"); return; } executor.submit(new Runnable() { public void run() { synchronized (Auditor.this) { LOG.info("Shutting down Auditor's Executor"); executor.shutdown(); } } }); } }
Source:
<code>private Map<String, Object> downloadFilesInFolder(String path) throws DropboxException { try { DbxEntry.WithChildren listing = client.getMetadataWithChildren(path); if (listing == null) { return Collections.emptyMap(); } else if (listing.children == null) { <START> LOG.info("downloading a single file..."); <END> Map.Entry<String, Object> entry = downloadSingleFile(path); return Collections.singletonMap(entry.getKey(), entry.getValue()); } Map<String, Object> result = new HashMap<>(); for (DbxEntry entry : listing.children) { if (entry.isFile()) { try { Map.Entry<String, Object> singleFile = downloadSingleFile(entry.path); result.put(singleFile.getKey(), singleFile.getValue()); } catch (DropboxException e) { LOG.warn("can't download from " + entry.path); } } else { Map<String, Object> filesInFolder = downloadFilesInFolder(entry.path); result.putAll(filesInFolder); } } return result; } catch (DbxException e) { throw new DropboxException(e); } }</code><technical_language>This DEBUG logging level reduce logging noise</technical_language>

Target:
private Map<String, Object> downloadFilesInFolder(String path) throws DropboxException { try { DbxEntry.WithChildren listing = client.getMetadataWithChildren(path); if (listing == null) { return Collections.emptyMap(); } else if (listing.children == null) { LOG.debug("downloading a single file..."); Map.Entry<String, Object> entry = downloadSingleFile(path); return Collections.singletonMap(entry.getKey(), entry.getValue()); } Map<String, Object> result = new HashMap<>(); for (DbxEntry entry : listing.children) { if (entry.isFile()) { try { Map.Entry<String, Object> singleFile = downloadSingleFile(entry.path); result.put(singleFile.getKey(), singleFile.getValue()); } catch (DropboxException e) { LOG.warn("Cannot download from path={}, reason={}. This exception is ignored.", entry.path, e.getMessage()); } } else { Map<String, Object> filesInFolder = downloadFilesInFolder(entry.path); result.putAll(filesInFolder); } } return result; } catch (DbxException e) { throw new DropboxException(e); } }
Source:
<code>public void filterWorksCorrectly() throws LPFilterException { String filename = "src/test/resources/ppm/00_BH1.512.seed"; DataModule dm = new DataModule(); File dataToFilter = new File(filename); dm.loadAndParseDataForTesting(dataToFilter); FilterLP defaultLPFilter = new FilterLP(); PlotDataProvider pdp = dm.getAllChannels().get(0); defaultLPFilter.init(pdp); int sampleCount = pdp.getRawData().get(0).getSampleCount(); double[] initData = new double[sampleCount]; for (int i = 0; i < initData.length; ++i) { initData[i] = pdp.getRawData().get(0).getData().data[i]; } double[] filteredCalculated = defaultLPFilter.filter(initData, sampleCount); double[] filteredExpected = new double[]{ 0.000000, 0.000000, 0.000001, 0.000000, 0.000023, 0.000046, 0.000083, 0.000137 }; for (int i = 0; i < filteredExpected.length; ++i) { assertEquals(filteredExpected[i], filteredCalculated[i], 1E-5); } <START> System.out.println(Arrays.toString(Arrays.copyOfRange(filteredExpected, 0, 100))); <END> }</code><technical_language>Please remove debug statement. Thanks</technical_language>

Target:
public void filterWorksCorrectly() throws LPFilterException { String filename = "src/test/resources/ppm/00_BH1.512.seed"; DataModule dm = new DataModule(); File dataToFilter = new File(filename); dm.loadAndParseDataForTesting(dataToFilter); FilterLP defaultLPFilter = new FilterLP(); PlotDataProvider pdp = dm.getAllChannels().get(0); defaultLPFilter.init(pdp); int sampleCount = pdp.getRawData().get(0).getSampleCount(); double[] initData = new double[sampleCount]; for (int i = 0; i < initData.length; ++i) { initData[i] = pdp.getRawData().get(0).getData().data[i]; } double[] filteredCalculated = defaultLPFilter.filter(initData, sampleCount); double[] filteredExpected = new double[]{ 0.000000, 0.000000, 0.000001, 0.000000, 0.000023, 0.000046, 0.000083, 0.000137 }; for (int i = 0; i < filteredExpected.length; ++i) { assertEquals(filteredExpected[i], filteredCalculated[i], 1E-5); } }
Source:
<code>private Map<String, ContextSensitiveTokenType> createContextSensitiveTokenMap( ICPPParserExtensionConfiguration config) { Map<String, ContextSensitiveTokenType> result = new HashMap<String, ContextSensitiveTokenType>(); <START> result.put(new String(Keywords.cOVERRIDE), ContextSensitiveTokenType.OVERRIDE); <END> result.put(new String(Keywords.cFINAL), ContextSensitiveTokenType.FINAL); result.putAll(config.getAdditionalContextSensitiveKeywords()); return result; }</code><technical_language>sense add a string constant Keywords. for FINAL</technical_language>

Target:
private Map<String, ContextSensitiveTokenType> createContextSensitiveTokenMap( ICPPParserExtensionConfiguration config) { Map<String, ContextSensitiveTokenType> result = new HashMap<String, ContextSensitiveTokenType>(); result.put(Keywords.OVERRIDE, ContextSensitiveTokenType.OVERRIDE); result.put(Keywords.FINAL, ContextSensitiveTokenType.FINAL); result.putAll(config.getAdditionalContextSensitiveKeywords()); return result; }
Source:
<code>private static JCQueue createQueue(String name, int queueSize) { <START> return new JCQueue(name, null, queueSize, 0, 1, new WaitStrategyPark(0), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry()); <END> }</code><technical_language>is name instead of null</technical_language>

Target:
private static JCQueue createQueue(String name, int queueSize) { return new JCQueue(name, name, queueSize, 0, 1, new WaitStrategyPark(0), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry()); }
Source:
<code>private MbusChannelElementsDto makeMbusChannelElementsDto(final SmartMeter mbusDevice) { final String mbusDeviceIdentification = mbusDevice.getDeviceIdentification(); final String mbusIdentificationNumber; if (mbusDevice.getMbusIdentificationNumber() == null) { mbusIdentificationNumber = null; } else { mbusIdentificationNumber = String.format("%08d", mbusDevice.getMbusIdentificationNumber()); } final String mbusManufacturerIdentification = mbusDevice.getMbusManufacturerIdentification(); final Short mbusVersion = mbusDevice.getMbusVersion(); final Short mbusDeviceTypeIdentification = mbusDevice.getMbusDeviceTypeIdentification(); <START> final Short channel = mbusDevice.getChannel(); <END> Short primaryAddress = null; if (mbusDevice.getMbusPrimaryAddress() != null) { primaryAddress = mbusDevice.getMbusPrimaryAddress(); } return new MbusChannelElementsDto(channel, primaryAddress, mbusDeviceIdentification, mbusIdentificationNumber, mbusManufacturerIdentification, mbusVersion, mbusDeviceTypeIdentification); }</code><technical_language>I sending of channel is unnecessary. for free channel if unbound / uncoupled device</technical_language>

Target:
private MbusChannelElementsDto makeMbusChannelElementsDto(final SmartMeter mbusDevice) { final String mbusDeviceIdentification = mbusDevice.getDeviceIdentification(); final String mbusIdentificationNumber; if (mbusDevice.getMbusIdentificationNumber() == null) { mbusIdentificationNumber = null; } else { mbusIdentificationNumber = String.format("%08d", mbusDevice.getMbusIdentificationNumber()); } final String mbusManufacturerIdentification = mbusDevice.getMbusManufacturerIdentification(); final Short mbusVersion = mbusDevice.getMbusVersion(); final Short mbusDeviceTypeIdentification = mbusDevice.getMbusDeviceTypeIdentification(); Short primaryAddress = null; if (mbusDevice.getMbusPrimaryAddress() != null) { primaryAddress = mbusDevice.getMbusPrimaryAddress(); } return new MbusChannelElementsDto(primaryAddress, mbusDeviceIdentification, mbusIdentificationNumber, mbusManufacturerIdentification, mbusVersion, mbusDeviceTypeIdentification); }
Source:
<code>public static String getGitProp(String propertyToGet) { String propertyValue = null; try { Properties gitProps = new Properties(); InputStream is = ModuleBuilder.class.getResourceAsStream("git.properties"); gitProps.load(is); is.close(); propertyValue = gitProps.getProperty(propertyToGet); } catch (Exception e) { <START> showError("Error while retrieving version information", e.getMessage()); <END> } return propertyValue; }</code><technical_language>showError prints error, exit. I do else stop execution</technical_language>

Target:
public static String getGitProp(String propertyToGet) { String propertyValue = null; Properties gitProps = new Properties(); try { InputStream is = ModuleBuilder.class.getResourceAsStream("git.properties"); gitProps.load(is); is.close(); propertyValue = gitProps.getProperty(propertyToGet); } catch (Exception e) { showError("Error while retrieving version information from git.properties file: ", e.getMessage()); System.exit(1); } return propertyValue; }
Source:
<code>private void handleExchangeFoodAction(ActionEvent e) { Shop shop = mule.getGameManager().getShop(); Player player = mule.getGameManager().getCurrentPlayer(); <START> if (buyNotSell) { <END> if (shop.stockOf(ResourceType.FOOD) > 0) { if (player.getMoney() >= shop.priceOf(ResourceType.FOOD)) { shop.buy(player, ResourceType.FOOD); System.out.println(player.getMoney()); } else { System.out.println("Player does not have enough money"); } } else { System.out.println("Shop is out of food"); } } else { if (player.stockOf(ResourceType.FOOD) > 0) { shop.sell(player, ResourceType.FOOD); System.out.println(player.getMoney()); } else { System.out.println("You are out of food"); } } mule.getGameManager().setLabels(); }</code><technical_language>This logic is duplicated 3 times, move a private method move this logic out of this controller</technical_language>

Target:
private void handleExchangeFoodAction(ActionEvent e) { shop = mule.getGameManager().getShop(); player = mule.getGameManager().getCurrentPlayer(); if (buyNotSell) { shop.buy(player, ResourceType.FOOD); } else { shop.sell(player, ResourceType.FOOD); } mule.getGameManager().setLabels(); }
Source:
<code>private void alterGcAndTombstoneInternal( String keyspace, TableReference tableRef, int gcGraceSeconds, float tombstoneThresholdRatio) { try { clientPool.runWithRetry((FunctionCheckedException<Client, Void, Exception>) client -> { KsDef ks = client.describe_keyspace(keyspace); List<CfDef> cfs = ks.getCf_defs(); for (CfDef cf : cfs) { if (cf.getName().equalsIgnoreCase(internalTableName(tableRef))) { cf.setGc_grace_seconds(gcGraceSeconds); cf.setCompaction_strategy_options(ImmutableMap.of( "tombstone_threshold", String.valueOf(tombstoneThresholdRatio))); client.system_update_column_family(cf); CassandraKeyValueServices.waitForSchemaVersions( client, tableRef.getQualifiedName(), configManager.getConfig().schemaMutationTimeoutMillis()); log.trace("gc_grace_seconds is set to for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef)); log.trace("tombstone_threshold_ratio is set to for {}.{}", SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), SafeArg.of("table", tableRef)); } } return null; }); } catch (Exception e) { log.error("Exception encountered while setting gc_grace_seconds:{} and tombstone_threshold:{} for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef), <START> e); <END> } }</code><technical_language>Do mark Exceptions safe/unsafe is this done automatically</technical_language>

Target:
private void alterGcAndTombstoneInternal( String keyspace, TableReference tableRef, int gcGraceSeconds, float tombstoneThresholdRatio) { try { clientPool.runWithRetry((FunctionCheckedException<Client, Void, Exception>) client -> { KsDef ks = client.describe_keyspace(keyspace); List<CfDef> cfs = ks.getCf_defs(); for (CfDef cf : cfs) { if (cf.getName().equalsIgnoreCase(internalTableName(tableRef))) { cf.setGc_grace_seconds(gcGraceSeconds); cf.setCompaction_strategy_options(ImmutableMap.of( "tombstone_threshold", String.valueOf(tombstoneThresholdRatio))); client.system_update_column_family(cf); CassandraKeyValueServices.waitForSchemaVersions( client, tableRef.getQualifiedName(), configManager.getConfig().schemaMutationTimeoutMillis()); log.trace("gc_grace_seconds is set to for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef)); log.trace("tombstone_threshold_ratio is set to for {}.{}", SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef)); } } return null; }); } catch (Exception e) { log.error("Exception encountered while setting gc_grace_seconds:{} and tombstone_threshold:{} for {}.{}", SafeArg.of("gcGraceSeconds", gcGraceSeconds), SafeArg.of("tombstoneThresholdRatio", tombstoneThresholdRatio), UnsafeArg.of("keyspace", keyspace), UnsafeArg.of("table", tableRef), e); } }
Source:
<code>private Diagram getGMFDiagram(Notification notification) { Diagram gmfDiagram = null; DDiagram dDiagram = null; Object notifier = notification.getNotifier(); if (notifier instanceof DDiagram) { dDiagram = (DDiagram) notifier; } else if <START> (notifier instanceof EObject && <END> ((EObject) notifier).eContainer() != null && notifier instanceof DDiagramElement) { dDiagram = ((DDiagramElement) notifier).getParentDiagram(); } else if (notification.getOldValue() instanceof DDiagramElement) { DDiagramElement oldValue = (DDiagramElement) notification.getOldValue(); dDiagram = DDiagramElementSpecOperations.getParentDiagram(oldValue); } if (dDiagram != null) { DiagramCreationUtil diagramCreationUtil = new DiagramCreationUtil(dDiagram); if (diagramCreationUtil.findAssociatedGMFDiagram()) { gmfDiagram = diagramCreationUtil.getAssociatedGMFDiagram(); } else { Resource diagramResource = dDiagram.eResource(); for (final EObject object : diagramResource.getContents()) { if (object instanceof Diagram) { Diagram diagram = (Diagram) object; if (dDiagram.equals(diagram.getElement())) { gmfDiagram = diagram; break; } } } } } return gmfDiagram; }</code><technical_language>"notifier instanceof EObject" "notifier instanceof DDiagramElement" doublons. "notifier instanceof DDiagramElement" is sufficient</technical_language>

Target:
private Diagram getGMFDiagram(Notification notification) { Diagram gmfDiagram = null; DDiagram dDiagram = null; Object notifier = notification.getNotifier(); if (notifier instanceof DDiagram) { dDiagram = (DDiagram) notifier; } else if (notifier instanceof DDiagramElement && ((EObject) notifier).eContainer() != null) { dDiagram = ((DDiagramElement) notifier).getParentDiagram(); } else if (notification.getOldValue() instanceof DDiagramElement) { DDiagramElement oldValue = (DDiagramElement) notification.getOldValue(); dDiagram = DDiagramElementSpecOperations.getParentDiagram(oldValue); } if (dDiagram != null) { DiagramCreationUtil diagramCreationUtil = new DiagramCreationUtil(dDiagram); if (diagramCreationUtil.findAssociatedGMFDiagram()) { gmfDiagram = diagramCreationUtil.getAssociatedGMFDiagram(); } else { Resource diagramResource = dDiagram.eResource(); for (final EObject object : diagramResource.getContents()) { if (object instanceof Diagram) { Diagram diagram = (Diagram) object; if (dDiagram.equals(diagram.getElement())) { gmfDiagram = diagram; break; } } } } } return gmfDiagram; }
Source:
<code>public UiContextResponse getContext() throws IOException { User user = userAccountService.getCurrentUser(); String selectedTheme = "/css/bootstrap-4/" + appSettings.getBootstrapTheme(); <START> String themeFingerPrint = themeFingerprintRegistry.getFingerprint(selectedTheme); <END> String themeUri = selectedTheme + "?" + themeFingerPrint; return UiContextResponse.builder() .setMenu(menuReaderService.getMenu().orElse(null)) .setSelectedTheme(themeUri) .setCssHref(appSettings.getCssHref()) .setNavBarLogo(appSettings.getLogoNavBarHref()) .setLogoTop(appSettings.getLogoTopHref()) .setLogoTopMaxHeight(appSettings.getLogoTopMaxHeight()) .setLoginHref(LOGIN_HREF) .setHelpLink(ImmutableMap.of("label", "Help", "href", HELP_HREF)) .setShowCookieWall(cookieWallService.showCookieWall()) .setAuthenticated(currentUserIsAuthenticated()) .setUsername(user.getUsername()) .setEmail(user.getEmail()) .setRoles(getCurrentUserRoles()) .setAdditionalMessage(appSettings.getFooter()) .setVersion(this.molgenisVersion) .setBuildDate(this.molgenisBuildDate) .build(); }</code><technical_language>If this fails, catch exception return theme fingerprint</technical_language>

Target:
public UiContextResponse getContext() { User user = userAccountService.getCurrentUser(); return UiContextResponse.builder() .setMenu(menuReaderService.getMenu().orElse(null)) .setSelectedTheme(buildSelectedThemeURL()) .setCssHref(appSettings.getCssHref()) .setNavBarLogo(appSettings.getLogoNavBarHref()) .setLogoTop(appSettings.getLogoTopHref()) .setLogoTopMaxHeight(appSettings.getLogoTopMaxHeight()) .setLoginHref(LOGIN_HREF) .setHelpLink(ImmutableMap.of("label", "Help", "href", HELP_HREF)) .setShowCookieWall(cookieWallService.showCookieWall()) .setAuthenticated(currentUserIsAuthenticated()) .setUsername(user.getUsername()) .setEmail(user.getEmail()) .setRoles(getCurrentUserRoles()) .setAdditionalMessage(appSettings.getFooter()) .setVersion(this.molgenisVersion) .setBuildDate(this.molgenisBuildDate) .build(); }
Source:
<code>public void launch(Instance machine, Agent agent) throws MachineException { final HttpJsonRequest wsAgentPingRequest; try { wsAgentPingRequest = createPingRequest(machine); } catch (ServerException e) { throw new MachineException(e.getServiceError()); } String script = agent.getScript() + "\n" + (Strings.isNullOrEmpty(wsAgentRunCommand) ? DEFAULT_WS_AGENT_RUN_COMMAND <START> : wsAgentRunCommand); <END> final String wsAgentPingUrl = wsAgentPingRequest.getUrl(); try { machineProcessManagerProvider.get().exec(machine.getWorkspaceId(), machine.getId(), new CommandImpl(getAgentName(), script, "Arbitrary"), getWsAgentProcessOutputChannel(machine.getWorkspaceId())); final long pingStartTimestamp = System.currentTimeMillis(); LOG.debug("Starts pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl, pingStartTimestamp); while (System.currentTimeMillis() - pingStartTimestamp < wsAgentMaxStartTimeMs) { if (pingWsAgent(wsAgentPingRequest)) { return; } else { Thread.sleep(wsAgentPingDelayMs); } } } catch (BadRequestException | ServerException | NotFoundException wsAgentLaunchingExc) { throw new MachineException(wsAgentLaunchingExc.getLocalizedMessage(), wsAgentLaunchingExc); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MachineException("Ws agent pinging is interrupted"); } LOG.error("Fail pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl); throw new MachineException(pingTimedOutErrorMessage); }</code><technical_language>firstNotNull</technical_language>

Target:
public void launch(Instance machine, Agent agent) throws ServerException { final HttpJsonRequest wsAgentPingRequest; try { wsAgentPingRequest = createPingRequest(machine); } catch (ServerException e) { throw new MachineException(e.getServiceError()); } String script = agent.getScript() + "\n" + firstNonNull(wsAgentRunCommand, DEFAULT_WS_AGENT_RUN_COMMAND); final String wsAgentPingUrl = wsAgentPingRequest.getUrl(); try { CommandImpl command = new CommandImpl(getAgentName(), script, WS_AGENT_PROCESS_NAME); machineProcessManagerProvider.get().exec(machine.getWorkspaceId(), machine.getId(), command, getWsAgentProcessOutputChannel(machine.getWorkspaceId())); final long pingStartTimestamp = System.currentTimeMillis(); LOG.debug("Starts pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl, pingStartTimestamp); while (System.currentTimeMillis() - pingStartTimestamp < wsAgentMaxStartTimeMs) { if (pingWsAgent(wsAgentPingRequest)) { return; } else { Thread.sleep(wsAgentPingDelayMs); } } } catch (BadRequestException | ServerException | NotFoundException e) { throw new ServerException(e.getServiceError()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ServerException("Ws agent pinging is interrupted"); } LOG.error("Fail pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl); throw new ServerException(pingTimedOutErrorMessage); }
Source:
<code>public Set<Endpoint> getEndpoints(Resolver.CoordinateDataFilter filter) throws CloudnameException, InterruptedException { <START> Set<Endpoint> endpointsIncluded = new HashSet<Endpoint>(); <END> String cellPath = ZkCoordinatePath.getCloudnameRoot(); try { List<String> cells = zk.getChildren(cellPath, false); for (String cell : cells) { if (! filter.includeCell(cell)) { continue; } String userPath = cellPath + "/" + cell; List<String> users = zk.getChildren(userPath, false); for (String user : users) { if (! filter.includeUser(user)) { continue; } String servicePath = userPath + "/" + user; List<String> services = zk.getChildren(servicePath, false); for (String service : services) { if (! filter.includeService(service)) { continue; } String instancePath = servicePath + "/" + service; List<String> instances = zk.getChildren(instancePath, false); for (String instance : instances) { String statusPath = ZkCoordinatePath.getStatusPath( cell, user, service, Integer.parseInt(instance)); ZkCoordinateData zkCoordinateData = ZkCoordinateData.loadCoordianteData( statusPath, getZooKeeper(), null); Set<Endpoint> endpoints = zkCoordinateData.snapshot().getEndpoints(); for (Endpoint endpoint : endpoints) { if (filter.includeEndpointname(endpoint.getName())) { if (filter.includeServiceState( zkCoordinateData.snapshot().getServiceStatus().getState())) { endpointsIncluded.add(endpoint); } } } } } } } } catch (KeeperException e) { throw new CloudnameException(e); } return endpointsIncluded; }</code><technical_language>final intend mutate</technical_language>

Target:
public Set<Endpoint> getEndpoints(Resolver.CoordinateDataFilter filter) throws CloudnameException, InterruptedException { final Set<Endpoint> endpointsIncluded = new HashSet<Endpoint>(); String cellPath = ZkCoordinatePath.getCloudnameRoot(); try { List<String> cells = zk.getChildren(cellPath, false); for (String cell : cells) { if (! filter.includeCell(cell)) { continue; } String userPath = cellPath + "/" + cell; List<String> users = zk.getChildren(userPath, false); for (String user : users) { if (! filter.includeUser(user)) { continue; } String servicePath = userPath + "/" + user; List<String> services = zk.getChildren(servicePath, false); for (String service : services) { if (! filter.includeService(service)) { continue; } String instancePath = servicePath + "/" + service; List<String> instances = zk.getChildren(instancePath, false); for (String instance : instances) { String statusPath = ZkCoordinatePath.getStatusPath( cell, user, service, Integer.parseInt(instance)); ZkCoordinateData zkCoordinateData = ZkCoordinateData.loadCoordinateData( statusPath, getZooKeeper(), null); Set<Endpoint> endpoints = zkCoordinateData.snapshot().getEndpoints(); for (Endpoint endpoint : endpoints) { if (filter.includeEndpointname(endpoint.getName())) { if (filter.includeServiceState( zkCoordinateData.snapshot().getServiceStatus().getState())) { endpointsIncluded.add(endpoint); } } } } } } } } catch (KeeperException e) { throw new CloudnameException(e); } return endpointsIncluded; }
Source:
<code>static public void write(InputStream in, OutputStream outStream) throws IOException { try { byte[] byteArray = new byte[BUFFER_SIZE * 2]; <START> while (in.read(byteArray) != -1) { <END> outStream.write(byteArray); } } finally { in.close(); } }</code><technical_language>a byte[] buffer, I need capture returned byte count full array read. in: int byteCount = 0; while ((byteCount = in.read(byteArray)) != -1) { out.write(byteArray, 0, byteCount); }</technical_language>

Target:
static public void write(InputStream in, OutputStream outStream) throws IOException { if(in == null || outStream == null) return; try { byte[] byteArray = new byte[BUFFER_SIZE * 2]; int byteCount = 0; while ((byteCount = in.read(byteArray)) != -1) { outStream.write(byteArray, 0, byteCount); } } finally { in.close(); } }
Source:
<code>protected void saveUserProfile(CommonProfile profile, final ActionContext actionContext) { if (isStateless(actionContext)) { <START> actionContext.ctx.args.put(HttpConstants.USER_PROFILE, profile); <END> } else { StorageHelper.saveProfile(actionContext.sessionId, profile); } }</code><technical_language>I I actionContext.ctx.args.put..</technical_language>

Target:
protected void saveUserProfile(CommonProfile profile, final ActionContext actionContext) { if (isStateless(actionContext)) { actionContext.getCtx().args.put(Pac4jConstants.USER_PROFILE, profile); } else { StorageHelper.saveProfile(actionContext.getSessionId(), profile); } }
Source:
<code>public DatastreamEventProducerImpl(List<DatastreamTask> tasks, TransportProvider transportProvider, CheckpointProvider checkpointProvider, CheckpointPolicy checkpointPolicy, VerifiableProperties config) { Objects.requireNonNull(tasks, "null tasks"); Objects.requireNonNull(transportProvider, "null transport provider"); Objects.requireNonNull(checkpointProvider, "null checkpoint provider"); Objects.requireNonNull(config, "null config"); if (tasks.size() == 0) { throw new IllegalArgumentException("empty task list."); } _destToTaskMap = new HashMap<>(); DatastreamTask task0 = tasks.get(0); for (DatastreamTask task: tasks) { <START> DatastreamVerifier.checkExisting(task.getDatastream()); <END> if (!task.getDatastream().equals(task0.getDatastream())) { throw new IllegalArgumentException("All tasks must belong to the Datastream."); } } _tasks = tasks; _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = checkpointPolicy; _checkpointHandler = new CheckpointHandler(task0.getDatastream().getMetadata()); if (_checkpointPolicy == CheckpointPolicy.DATASTREAM) { _safeCheckpoints = _checkpointProvider.getCommitted(_tasks); } if (_safeCheckpoints == null) { _safeCheckpoints = new HashMap<>(); } _latestCheckpoints = new HashMap<>(_safeCheckpoints); }</code><technical_language>is task.getDatastream() anymore. sync code update PR</technical_language>

Target:
public DatastreamEventProducerImpl(List<DatastreamTask> tasks, TransportProvider transportProvider, CheckpointProvider checkpointProvider, CheckpointPolicy checkpointPolicy, VerifiableProperties config) { Validate.notNull(tasks, "null tasks"); Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); Validate.notEmpty(tasks, "empty task list"); DatastreamTask task0 = tasks.get(0); for (DatastreamTask task: tasks) { task.getDatastreamDestination().equals(task0.getDatastreamSource()); } _tasks = tasks; _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = checkpointPolicy; _checkpointHandler = new CheckpointHandler(config); if (_checkpointPolicy == CheckpointPolicy.DATASTREAM) { _safeCheckpoints = _checkpointProvider.getCommitted(_tasks); } if (_safeCheckpoints == null) { _safeCheckpoints = new HashMap<>(); } _latestCheckpoints = new HashMap<>(); }
Source:
<code>public static void generateLttngTrace(File file) { final int cpus = 25; <START> LttngTraceGenerator gt = new LttngTraceGenerator(134217728, 15625, cpus); <END> gt.writeTrace(file); }</code><technical_language>some numbers (but smaller original)</technical_language>

Target:
public static void generateLttngTrace(File file) { final int cpus = 25; LttngTraceGenerator gt = new LttngTraceGenerator(Integer.MAX_VALUE/8L, 250000/16L, cpus); gt.writeTrace(file); }
Source:
<code><START> protected TraceeMessagePropertiesConverter(TraceeBackend backend, HttpHeaderTransport transportSerialization, String profile) { <END> this.backend = backend; this.transportSerialization = transportSerialization; this.profile = profile; }</code><technical_language>This constructor moved package-scope. able insert mocked TraceeBackend in test-cases -- spy backend-calls SimpleTraceeBackend.createNonLoggingAllPermittingBackend()instead of ThreadLocalBackend</technical_language>

Target:
TraceeMessagePropertiesConverter(TraceeBackend backend, HttpHeaderTransport transportSerialization, String profile) { this.backend = backend; this.transportSerialization = transportSerialization; this.profile = profile; }
Source:
<code>public static void updateLabels(Result result){ <START> int teamID = GameController.getGame().getTurnKeeper().getActiveTeamId() - 1; <END> int otherTeamID = (teamID + 1) % GameController.getGame().getTeams().length; if(result == Result.CHECK){ mTeamLabels[otherTeamID].setBackground(Color.RED); mTeamLabels[otherTeamID].setForeground(Color.WHITE); } else { mTeamLabels[(teamID + 1) % GameController.getGame().getTeams().length].setBackground(Color.CYAN); } mTeamLabels[teamID].setBackground(Color.WHITE); mTeamLabels[teamID].setForeground(Color.BLACK); }</code><technical_language>if team ids 8 & 9 instead of 1 & 2? need able support that. need able support arbitrary number of teams, UI need worry right</technical_language>

Target:
public static void updateLabels(Result result){ int teamID = GameController.getGame().getTurnKeeper().getActiveTeamId(); if(result == Result.CHECK){ mTeamLabels.get(teamID).setBackground(Color.RED); mTeamLabels.get(teamID).setForeground(Color.WHITE); } else { mTeamLabels.get(teamID).setBackground(Color.CYAN); } for(Map.Entry<Integer, JLabel> otherTeamLabel : mTeamLabels.entrySet()) { if(otherTeamLabel.getKey() != teamID) { otherTeamLabel.getValue().setBackground(Color.WHITE); otherTeamLabel.getValue().setForeground(Color.BLACK); } } }
Source:
<code>public void testOpenPortForwardingAndAdvertise() throws Exception { final AttributeSensor<Integer> TARGET_PORT = new BasicAttributeSensor<>(Integer.class, "target.port"); <START> final AttributeSensor<String> PUBLIC_ENDPOINT = new BasicAttributeSensor<>(String.class, "endpoint"); <END> subnetTier = app.createAndManageChild(EntitySpec.create(SubnetTier.class) .configure(SubnetTier.PORT_FORWARDING_MANAGER, portForwardManager) .configure(SubnetTier.PORT_FORWARDER, portForwarder) .configure(SubnetTier.SUBNET_CIDR, Cidr.UNIVERSAL)); app.start(ImmutableList.of(targetMachine)); app.sensors().set(TARGET_PORT, 22); final String privateEndpoint = targetMachine.getAddress().getHostAddress() + ":22"; subnetTier.openPortForwardingAndAdvertise( new EntityAndAttribute<>(app, TARGET_PORT), Optional.<Integer>absent(), Protocol.TCP, Cidr.UNIVERSAL, Optional.of(new EntityAndAttribute<>(app, PUBLIC_ENDPOINT)), Optional.<EntityAndAttribute<String>>absent()); Asserts.succeedsEventually(new Runnable() { public void run() { String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); assertEquals(publicEndpoint, privateEndpoint); }}); String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); Iterable<String> endpointParts = Splitter.on(":").split(publicEndpoint); assertEquals(Iterables.size(endpointParts), 2, "endpoint="+publicEndpoint); HostAndPort endpointHostAndPort = HostAndPort.fromParts(Iterables.get(endpointParts, 0), Integer.parseInt(Iterables.get(endpointParts, 1))); assertTargetReachableVia(endpointHostAndPort); }</code><technical_language>lost test for previous behaviour. re-write test (e.g. a delegate method, is best) test mapped.target.port behaviour</technical_language>

Target:
public void testOpenPortForwardingAndAdvertise() throws Exception { final AttributeSensor<Integer> TARGET_PORT = new BasicAttributeSensor<>(Integer.class, "target.port"); final AttributeSensor<String> PUBLIC_ENDPOINT = new BasicAttributeSensor<>(String.class, "endpoint"); subnetTier = app.createAndManageChild(EntitySpec.create(SubnetTier.class) .configure(SubnetTier.PORT_FORWARDING_MANAGER, portForwardManager) .configure(SubnetTier.PORT_FORWARDER, portForwarder) .configure(SubnetTier.SUBNET_CIDR, Cidr.UNIVERSAL)); app.start(ImmutableList.of(targetMachine)); app.sensors().set(TARGET_PORT, 22); final String privateEndpoint = targetMachine.getAddress().getHostAddress() + ":22"; subnetTier.openPortForwardingAndAdvertise( new EntityAndAttribute<>(app, TARGET_PORT), Optional.<Integer>absent(), Protocol.TCP, Cidr.UNIVERSAL, new EntityAndAttribute<>(app, PUBLIC_ENDPOINT)); Asserts.succeedsEventually(new Runnable() { public void run() { String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); assertEquals(publicEndpoint, privateEndpoint); }}); String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); Iterable<String> endpointParts = Splitter.on(":").split(publicEndpoint); assertEquals(Iterables.size(endpointParts), 2, "endpoint="+publicEndpoint); HostAndPort endpointHostAndPort = HostAndPort.fromParts(Iterables.get(endpointParts, 0), Integer.parseInt(Iterables.get(endpointParts, 1))); assertTargetReachableVia(endpointHostAndPort); }
Source:
<code>TopologyService(FiringService firingService, PlatformConfiguration platformConfiguration) { topologyService = platformConfiguration.getExtendedConfiguration(org.terracotta.dynamic_config.api.service.TopologyService.class).iterator().next(); this.firingService = Objects.requireNonNull(firingService); this.platformConfiguration = platformConfiguration; this.cluster = Cluster.create(); this.cluster.addStripe(stripe = Stripe.create(topologyService.getRuntimeNodeContext().getStripe().getName())); Collection<DynamicConfigEventService> extendedConfiguration = platformConfiguration.getExtendedConfiguration(DynamicConfigEventService.class); if (!extendedConfiguration.isEmpty()) { extendedConfiguration.iterator().next() .register(new DynamicConfigListener() { @Override public void onNewConfigurationSaved(NodeContext nodeContext, Long version) { for (Node node : nodeContext.getStripe().getNodes()) { <START> stripe.getServerByName(node.getName()).ifPresent(server -> addDynamicConfigAttributes(server, node)); <END> } } }); } }</code><technical_language>need: DynamicConfigEventService (thing is wired startup)</technical_language>

Target:
TopologyService(FiringService firingService, PlatformConfiguration platformConfiguration) { topologyService = platformConfiguration.getExtendedConfiguration(org.terracotta.dynamic_config.api.service.TopologyService.class).iterator().next(); this.firingService = Objects.requireNonNull(firingService); this.platformConfiguration = platformConfiguration; this.cluster = Cluster.create(); this.cluster.addStripe(stripe = Stripe.create(topologyService.getRuntimeNodeContext().getStripe().getName())); platformConfiguration.getExtendedConfiguration(DynamicConfigEventService.class).iterator().next() .register(new DynamicConfigListener() { @Override public void onNewConfigurationSaved(NodeContext nodeContext, Long version) { for (Node node : nodeContext.getStripe().getNodes()) { stripe.getServerByName(node.getName()).ifPresent(server -> addServerDynamicConfigAttributes(server, node)); } } }); parameterSubstitutor = platformConfiguration.getExtendedConfiguration(IParameterSubstitutor.class).iterator().next(); pathResolver = platformConfiguration.getExtendedConfiguration(PathResolver.class).iterator().next(); }
Source:
<code><START> protected List<MetricFamilySamples> familySamplesList(Collector.Type type, List<MetricFamilySamples.Sample> samples) { <END> MetricFamilySamples mfs = new MetricFamilySamples(fullname, type, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(1); mfsList.add(mfs); return mfsList; }</code><technical_language>This package protected</technical_language>

Target:
List<MetricFamilySamples> familySamplesList(Collector.Type type, List<MetricFamilySamples.Sample> samples) { MetricFamilySamples mfs = new MetricFamilySamples(fullname, type, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(1); mfsList.add(mfs); return mfsList; }
Source:
<code><START> public void getHome(){ <END> driver.get(URL_TABLET); }</code><technical_language>"{" a space</technical_language>

Target:
public void getHome(){ driver.get(URL_TABLET_HOME); }
Source:
<code>private Exception createTimeoutException(Thread thread) { StackTraceElement[] stackTrace = thread.getStackTrace(); <START> final Thread stuckThread = getStuckThread (thread); <END> Exception exception = new Exception(String.format( "test timed out after %d %s", fTimeout, fTimeUnit.name().toLowerCase())); if (stuckThread != null) { Exception stuckThreadException = new Exception ("Appears to be stuck in thread " + stuckThread.getName()); StackTraceElement[] threadStack; try { threadStack = stuckThread.getStackTrace(); } catch (SecurityException e) { threadStack = new StackTraceElement[0]; } stuckThreadException.setStackTrace (threadStack); exception = new MultipleFailureException (Arrays.<Throwable>asList (exception, stuckThreadException)); } if (stackTrace != null) { exception.setStackTrace(stackTrace); thread.interrupt(); } return exception; }</code><technical_language>Please adjust style match surrounding code (in this case, spaces parens</technical_language>

Target:
private Exception createTimeoutException(Thread thread) { StackTraceElement[] stackTrace = thread.getStackTrace(); final Thread stuckThread = fLookForStuckThread ? getStuckThread(thread) : null; Exception currThreadException = new Exception(String.format( "test timed out after %d %s", fTimeout, fTimeUnit.name().toLowerCase())); if (stackTrace != null) { currThreadException.setStackTrace(stackTrace); thread.interrupt(); } if (stuckThread != null) { Exception stuckThreadException = new Exception ("Appears to be stuck in thread " + stuckThread.getName()); stuckThreadException.setStackTrace(getStackTrace(stuckThread)); return new MultipleFailureException (Arrays.<Throwable>asList(currThreadException, stuckThreadException)); } else { return currThreadException; } }
Source:
<code>public String handleUserUpdate( @Valid @ModelAttribute(MODEL) UpdateUserCommand command, BindingResult bindingResult) { final RedirectBuilder redirect = new RedirectBuilder() .setPath(CONTROLLER_PATH) .addParameter(REQUEST_PARAMETER_ID, command.getId()); try { if(!bindingResult.hasErrors()){ User user = userService.getUser(command.getId()); command.setUser(user); userService.replaceUser(command.getId(), command.getAsUser()); redirect.addParameter("saveSuccess", true); redirect.setPath(UserViewController.CONTROLLER_PATH); return redirect.build(); } } catch(SCIMDataValidationException e) { LOG.warn("Could not update user.", e); } storeInSession(SESSION_KEY_COMMAND, command); storeBindingResultIntoSession(bindingResult, MODEL); <START> redirect.addParameter(REQUEST_PARAMETER_ERROR, "validation"); <END> return redirect.build(); }</code><technical_language>refactor code. hard this is error case in catch clause error is logged user</technical_language>

Target:
public String handleUserUpdate( @Valid @ModelAttribute(MODEL) UpdateUserCommand command, BindingResult bindingResult) { final RedirectBuilder redirect = new RedirectBuilder() .setPath(CONTROLLER_PATH) .addParameter(REQUEST_PARAMETER_ID, command.getId()); try { if(!bindingResult.hasErrors()){ User user = userService.getUser(command.getId()); command.setUser(user); userService.replaceUser(command.getId(), command.getAsUser()); redirect.addParameter("saveSuccess", true); redirect.setPath(UserViewController.CONTROLLER_PATH); return redirect.build(); } } catch(SCIMDataValidationException e) { LOG.warn("Validation failed. Unable to update user.", e); } storeInSession(SESSION_KEY_COMMAND, command); storeBindingResultIntoSession(bindingResult, MODEL); redirect.addParameter(REQUEST_PARAMETER_ERROR, "validation"); return redirect.build(); }