auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void parser(String[] args) { for (int i = 0; i < args.length; i++) { if (args[i].charAt(0) == '-') { switch (args[i].charAt(1)) { case 't': if (args.length == i + 1 || timeZone != null) { uError(); } else { i++; String[] tzNames = TimeZone.getAvailableIDs(); <START> String TZName = args[i]; <END> for (int j = 0; j < tzNames.length; ++j) { if (TZName.equals(tzNames[j])) { timeZone = TimeZone.getTimeZone(TZName); calendar.setTimeZone(timeZone); } } if (timeZone == null) { System.err.println("Incorrect time zone."); System.exit(1); } } break; case 'm': i++; month = Integer.parseInt(args[i]) - 1; if (calendar.getActualMinimum(Calendar.MONTH) > month || calendar.getActualMaximum(Calendar.MONTH) < month) { uError(); } break; case 'y': i++; year = Integer.parseInt(args[i]) - 1; if (calendar.getActualMinimum(Calendar.YEAR) > year || calendar.getActualMaximum(Calendar.YEAR) < year) { uError(); } break; case 'w': weeksNeeded = true; break; default: uError(); } } else { uError(); } } if (month == null) { month = calendar.get(Calendar.MONTH); } if (year == null) { year = calendar.get(Calendar.YEAR); } }</code><technical_language>Code Conventions</technical_language>

Target:
public static void parser(String[] args) { for (int i = 0; i < args.length; i++) { if (args[i].charAt(0) == '-') { switch (args[i].charAt(1)) { case 't': if (args.length == i + 1 || timeZone != null) { uError(); } else { i++; String[] timeZoneNames = TimeZone.getAvailableIDs(); String timeZoneName = args[i]; for (String timeZoneName1 : timeZoneNames) { if (timeZoneName.equals(timeZoneName1)) { timeZone = TimeZone.getTimeZone(timeZoneName); calendar.setTimeZone(timeZone); } } if (timeZone == null) { System.err.println("Incorrect time zone."); System.exit(1); } } break; case 'm': i++; if (args.length <= i || month != null) { uError(); } else { try { month = Integer.parseInt(args[i]) - 1; } catch (NumberFormatException exception) { System.err.println(exception.getMessage()); System.exit(1); } } if (calendar.getActualMinimum(Calendar.MONTH) > month || calendar.getActualMaximum(Calendar.MONTH) < month) { uError(); } break; case 'y': i++; year = Integer.parseInt(args[i]) - 1; if (calendar.getActualMinimum(Calendar.YEAR) > year || calendar.getActualMaximum(Calendar.YEAR) < year) { uError(); } break; case 'w': weeksNeeded = true; break; default: uError(); } } else { uError(); } } if (month == null) { month = calendar.get(Calendar.MONTH); } if (year == null) { year = calendar.get(Calendar.YEAR); } }
Source:
<code>public static void loadTestBook(final Ds3Client client, final String fileName, final String objectName, final String bucketName) throws IOException, URISyntaxException { final Path filePath = ResourceUtils.loadFileResource(RESOURCE_BASE_NAME + fileName); final Ds3Object obj = new Ds3Object(objectName, Files.size(filePath)); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startWriteJob(bucketName, ImmutableList.of(obj)); <START> job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { <END> @Override public SeekableByteChannel buildChannel(final String key) throws IOException { return FileChannel.open(filePath, StandardOpenOption.READ); } }); }</code><technical_language>observation -- this easier read a lamda</technical_language>

Target:
public static void loadTestBook(final Ds3Client client, final String fileName, final String objectName, final String bucketName) throws IOException, URISyntaxException { final Path filePath = ResourceUtils.loadFileResource(RESOURCE_BASE_NAME + fileName); final Ds3Object obj = new Ds3Object(objectName, Files.size(filePath)); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startWriteJob(bucketName, ImmutableList.of(obj)); job.transfer(key -> FileChannel.open(filePath, StandardOpenOption.READ)); }
Source:
<code>private void assertMultiPoint(String expectedWkt, String... pointWkts) { <START> assertFunction(format("ST_MultiPoint(array[%s])", ImmutableList.copyOf(pointWkts).stream() <END> .map(wkt -> wkt.equalsIgnoreCase("null") ? "null" : format("ST_GeometryFromText('%s')", wkt)) .collect(Collectors.joining(","))), GEOMETRY, expectedWkt); }</code><technical_language>formatting is off. hard read figure out lines what</technical_language>

Target:
private void assertMultiPoint(String expectedWkt, String... pointWkts) { assertFunction( format( "ST_MultiPoint(array[%s])", Arrays.stream(pointWkts) .map(wkt -> wkt == null ? "null" : format("ST_GeometryFromText('%s')", wkt)) .collect(Collectors.joining(","))), GEOMETRY, expectedWkt); }
Source:
<code>public Map<String, Object> doLogoutAs(final String principalUserId, final User currentLoginAsUser, final String serverName) throws DotDataException, DotSecurityException { <START> User systemUser = this.userAPI.getSystemUser(); <END> if (!UtilMethods.isSet(principalUserId)) { throw new DotDataException("Current user [" + currentLoginAsUser.getUserId() + "] is not logged in as a different user."); } Host host = null; if (UtilMethods.isSet(serverName)) { host = hostWebAPI.findByName(serverName, systemUser, false); if (host == null) { host = hostWebAPI.findByAlias(serverName, systemUser, false); } if (host == null) { host = hostWebAPI.findDefaultHost(systemUser, false); } } else { host = hostWebAPI.findDefaultHost(systemUser, false); } Map<String, Object> sessionData = map(com.dotmarketing.util.WebKeys.CURRENT_HOST, host); return sessionData; }</code><technical_language>this line move if validation, if is exception is reason get System user before</technical_language>

Target:
public Map<String, Object> doLogoutAs(final String principalUserId, final User currentLoginAsUser, final String serverName) throws DotDataException, DotSecurityException { if (!UtilMethods.isSet(principalUserId)) { throw new DotDataException("Current user [" + currentLoginAsUser.getUserId() + "] is not logged in as a different user."); } final User systemUser = this.userAPI.getSystemUser(); Host host = null; if (UtilMethods.isSet(serverName)) { host = this.hostWebAPI.findByName(serverName, systemUser, false); if (host == null) { host = this.hostWebAPI.findByAlias(serverName, systemUser, false); } if (host == null) { host = this.hostWebAPI.findDefaultHost(systemUser, false); } } else { host = this.hostWebAPI.findDefaultHost(systemUser, false); } final Map<String, Object> sessionData = map(com.dotmarketing.util.WebKeys.CURRENT_HOST, host); return sessionData; }
Source:
<code>private void addOvfStoreDiskToDomain(DiskImage ovfDisk) { <START> if (ovfDisk != null) { <END> StorageDomainOvfInfo storageDomainOvfInfo = new StorageDomainOvfInfo(getStorageDomainId(), null, ovfDisk.getId(), StorageDomainOvfInfoStatus.OUTDATED, null); getDbFacade().getStorageDomainOvfInfoDao().save(storageDomainOvfInfo); } }</code><technical_language>nan</technical_language>

Target:
private void addOvfStoreDiskToDomain(DiskImage ovfDisk) { StorageDomainOvfInfo storageDomainOvfInfo = new StorageDomainOvfInfo(getStorageDomainId(), null, ovfDisk.getId(), StorageDomainOvfInfoStatus.OUTDATED, null); getDbFacade().getStorageDomainOvfInfoDao().save(storageDomainOvfInfo); }
Source:
<code>public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { AnnotateStatsProcCtx aspCtx = (AnnotateStatsProcCtx) procCtx; FilterOperator fop = (FilterOperator) nd; Operator<? extends OperatorDesc> parent = fop.getParentOperators().get(0); Statistics parentStats = parent.getStatistics(); List<String> neededCols = null; if (parent instanceof TableScanOperator) { TableScanOperator tsop = (TableScanOperator) parent; neededCols = tsop.getNeededColumns(); } if (parentStats != null) { ExprNodeDesc pred = fop.getConf().getPredicate(); final boolean uniformWithinRange = HiveConf.getBoolVar( aspCtx.getConf(), HiveConf.ConfVars.HIVE_STATS_RANGE_SELECTIVITY_UNIFORM_DISTRIBUTION); aspCtx.clearAffectedColumns(); long newNumRows = evaluateExpression(parentStats, pred, aspCtx, <START> neededCols, fop, parentStats.getNumRows(), uniformWithinRange); <END> Statistics st = parentStats.clone(); if (satisfyPrecondition(parentStats)) { if (newNumRows <= parentStats.getNumRows()) { StatsUtils.updateStats(st, newNumRows, true, fop, aspCtx.getAffectedColumns()); } if (LOG.isDebugEnabled()) { LOG.debug("[0] STATS-" + fop.toString() + ": " + st.extendedToString()); } } else { if (newNumRows <= parentStats.getNumRows()) { StatsUtils.updateStats(st, newNumRows, false, fop); } if (LOG.isDebugEnabled()) { LOG.debug("[1] STATS-" + fop.toString() + ": " + st.extendedToString()); } } st = applyRuntimeStats(aspCtx.getParseContext().getContext(), st, fop); fop.setStatistics(st); aspCtx.setAndExprStats(null); } return null; }</code><technical_language>I pass a boolean here; aspCtx is</technical_language>

Target:
public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { AnnotateStatsProcCtx aspCtx = (AnnotateStatsProcCtx) procCtx; FilterOperator fop = (FilterOperator) nd; Operator<? extends OperatorDesc> parent = fop.getParentOperators().get(0); Statistics parentStats = parent.getStatistics(); List<String> neededCols = null; if (parent instanceof TableScanOperator) { TableScanOperator tsop = (TableScanOperator) parent; neededCols = tsop.getNeededColumns(); } if (parentStats != null) { ExprNodeDesc pred = fop.getConf().getPredicate(); aspCtx.clearAffectedColumns(); long newNumRows = evaluateExpression(parentStats, pred, aspCtx, neededCols, fop, parentStats.getNumRows()); Statistics st = parentStats.clone(); if (satisfyPrecondition(parentStats)) { if (newNumRows <= parentStats.getNumRows()) { StatsUtils.updateStats(st, newNumRows, true, fop, aspCtx.getAffectedColumns()); } if (LOG.isDebugEnabled()) { LOG.debug("[0] STATS-" + fop.toString() + ": " + st.extendedToString()); } } else { if (newNumRows <= parentStats.getNumRows()) { StatsUtils.updateStats(st, newNumRows, false, fop); } if (LOG.isDebugEnabled()) { LOG.debug("[1] STATS-" + fop.toString() + ": " + st.extendedToString()); } } st = applyRuntimeStats(aspCtx.getParseContext().getContext(), st, fop); fop.setStatistics(st); aspCtx.setAndExprStats(null); } return null; }
Source:
<code>public NetworkRequest listenForNetwork(NetworkCapabilities networkCapabilities, Messenger messenger, IBinder binder) { if (!hasWifiNetworkListenPermission(networkCapabilities)) { enforceAccessPermission(); } NetworkCapabilities nc = new NetworkCapabilities(networkCapabilities); restrictRequestUidsForCaller(nc); restrictBackgroundRequestForCaller(nc); <START> ensureValidNetworkSpecifier(networkCapabilities); <END> NetworkRequest networkRequest = new NetworkRequest(nc, TYPE_NONE, nextNetworkRequestId(), NetworkRequest.Type.LISTEN); NetworkRequestInfo nri = new NetworkRequestInfo(messenger, networkRequest, binder); if (VDBG) log("listenForNetwork for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri)); return networkRequest; }</code><technical_language>Nit: if respin this change, this "nc" instead of "networkCapabilities"</technical_language>

Target:
public NetworkRequest listenForNetwork(NetworkCapabilities networkCapabilities, Messenger messenger, IBinder binder) { if (!hasWifiNetworkListenPermission(networkCapabilities)) { enforceAccessPermission(); } NetworkCapabilities nc = new NetworkCapabilities(networkCapabilities); restrictRequestUidsForCaller(nc); restrictBackgroundRequestForCaller(nc); ensureValidNetworkSpecifier(nc); NetworkRequest networkRequest = new NetworkRequest(nc, TYPE_NONE, nextNetworkRequestId(), NetworkRequest.Type.LISTEN); NetworkRequestInfo nri = new NetworkRequestInfo(messenger, networkRequest, binder); if (VDBG) log("listenForNetwork for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri)); return networkRequest; }
Source:
<code>private Mail() { <START> } <END></code><technical_language>super() for Sonar. is MailToStringTransformer add this Factory</technical_language>

Target:
private Mail() { super(); }
Source:
<code><START> Map<String, Object> getDeviceMetadata() { <END> Map<String, Object> map = new HashMap<>(); map.put("batteryLevel", getBatteryLevel()); map.put("charging", isCharging()); map.put("locationStatus", getLocationStatus()); map.put("networkAccess", getNetworkAccess()); map.put("brand", Build.BRAND); map.put("screenDensity", screenDensity); map.put("dpi", dpi); map.put("emulator", emulator); map.put("screenResolution", screenResolution); return map; }</code><technical_language>Build.BRAND extracted in buildInfo well</technical_language>

Target:
Map<String, Object> getDeviceMetadata() { Map<String, Object> map = new HashMap<>(); map.put("batteryLevel", getBatteryLevel()); map.put("charging", isCharging()); map.put("locationStatus", getLocationStatus()); map.put("networkAccess", getNetworkAccess()); map.put("brand", buildInfo.getBrand()); map.put("screenDensity", screenDensity); map.put("dpi", dpi); map.put("emulator", emulator); map.put("screenResolution", screenResolution); return map; }
Source:
<code>private HttpPost createRequest(URL url, String token) throws URISyntaxException { RequestConfig defaultRequestConfig = RequestConfig.custom() .setConnectTimeout(JMeterUtils.getPropDefault("backend_influxdb.connection_timeout", 1000)) .setSocketTimeout(JMeterUtils.getPropDefault("backend_influxdb.socket_timeout", 3000)) .setConnectionRequestTimeout(JMeterUtils.getPropDefault("backend_influxdb.connection_request_timeout", 100)) .build(); HttpPost currentHttpRequest = new HttpPost(url.toURI()); currentHttpRequest.setConfig(defaultRequestConfig); <START> if (token != null) { <END> currentHttpRequest.setHeader("Authorization", "Token " + token); } log.debug("Created InfluxDBMetricsSender with url: {}", url); return currentHttpRequest; }</code><technical_language>testing for empty string</technical_language>

Target:
private HttpPost createRequest(URL url, String token) throws URISyntaxException { RequestConfig defaultRequestConfig = RequestConfig.custom() .setConnectTimeout(JMeterUtils.getPropDefault("backend_influxdb.connection_timeout", 1000)) .setSocketTimeout(JMeterUtils.getPropDefault("backend_influxdb.socket_timeout", 3000)) .setConnectionRequestTimeout(JMeterUtils.getPropDefault("backend_influxdb.connection_request_timeout", 100)) .build(); HttpPost currentHttpRequest = new HttpPost(url.toURI()); currentHttpRequest.setConfig(defaultRequestConfig); if (StringUtils.isNotBlank(token)) { currentHttpRequest.setHeader(AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE + token); } log.debug("Created InfluxDBMetricsSender with url: {}", url); return currentHttpRequest; }
Source:
<code>private void compareTracedItems(Resource changedResource) { TracePersistenceAdapter persistenceAdapter = ExtensionPointHelper.getTracePersistenceAdapter().get(); ResourceSetImpl newResourceSet = new ResourceSetImpl(); EObject traceModel = persistenceAdapter.getTraceModel(newResourceSet); <START> if (traceModel.eContents().size() > 0) { <END> IPath path = new Path(EcoreUtil.getURI(traceModel).toPlatformString(false)); IFile traceContainer = ResourcesPlugin.getWorkspace().getRoot().getFile(path); TraceMetaModelAdapter traceMetamodelAdapter = ExtensionPointHelper.getTraceMetamodelAdapter().get(); List<Connection> connections = traceMetamodelAdapter .getAllTraceLinks(persistenceAdapter.getTraceModel(new ResourceSetImpl())); if (!connections.isEmpty()) { for (Connection c : connections) { List<EObject> tempList = new ArrayList<>(); tempList.add(c.getOrigin()); tempList.addAll(c.getTargets()); for (EObject tracedItem : tempList) { Resource oldResource = tracedItem.eResource(); if (oldResource == null) oldResource = newResourceSet.getResource(EcoreUtil.getURI(tracedItem).trimFragment(), true); if (oldResource != null) { if (CapraNotificationHelper.getFileUri(oldResource) .equals(CapraNotificationHelper.getFileUri(changedResource))) { IComparisonScope scope = new DefaultComparisonScope(changedResource, oldResource, null); Comparison comparison = EMFCompare.builder().build().compare(scope); for (Match match : comparison.getMatches()) resolveMatch(tracedItem, match, null, traceContainer); } } } } } } }</code><technical_language>want include a null check (just traceModel is initialised eContents is well)</technical_language>

Target:
private void compareTracedItems(Resource changedResource) { TracePersistenceAdapter persistenceAdapter = ExtensionPointHelper.getTracePersistenceAdapter().get(); ResourceSetImpl newResourceSet = new ResourceSetImpl(); EObject traceModel = persistenceAdapter.getTraceModel(newResourceSet); if (traceModel!=null && traceModel.eContents().size() > 0) { IPath path = new Path(EcoreUtil.getURI(traceModel).toPlatformString(false)); IFile traceContainer = ResourcesPlugin.getWorkspace().getRoot().getFile(path); TraceMetaModelAdapter traceMetamodelAdapter = ExtensionPointHelper.getTraceMetamodelAdapter().get(); List<Connection> connections = traceMetamodelAdapter .getAllTraceLinks(persistenceAdapter.getTraceModel(new ResourceSetImpl())); if (!connections.isEmpty()) { for (Connection c : connections) { List<EObject> tempList = new ArrayList<>(); tempList.add(c.getOrigin()); tempList.addAll(c.getTargets()); for (EObject tracedItem : tempList) { Resource oldResource = tracedItem.eResource(); if (oldResource == null) oldResource = newResourceSet.getResource(EcoreUtil.getURI(tracedItem).trimFragment(), true); if (oldResource != null) { if (CapraNotificationHelper.getFileUri(oldResource) .equals(CapraNotificationHelper.getFileUri(changedResource))) { IComparisonScope scope = new DefaultComparisonScope(changedResource, oldResource, null); Comparison comparison = EMFCompare.builder().build().compare(scope); for (Match match : comparison.getMatches()) resolveMatch(tracedItem, match, null, traceContainer); } } } } } } }
Source:
<code>public static void sync(String modid, Config.Type type) { FMLLog.log.debug("Attempting to inject @Config classes into for type {}", modid, type); ClassLoader mcl = Loader.instance().getModClassLoader(); File configDir = Loader.instance().getConfigDir(); Multimap<Config.Type, ASMData> map = asm_data.get(modid); if (map == null) return; for (ASMData targ : map.get(type)) { try { Class<?> cls = Class.forName(targ.getClassName(), true, mcl); Set<Class<?>> modConfigClasses = MOD_CONFIG_CLASSES.computeIfAbsent(modid, k -> Sets.<Class<?>>newHashSet()); modConfigClasses.add(cls); String name = (String)targ.getAnnotationInfo().get("name"); if (name == null) name = modid; String category = (String)targ.getAnnotationInfo().get("category"); if (category == null) category = "general"; File file = new File(configDir, name + ".cfg"); Configuration cfg = CONFIGS.get(file.getAbsolutePath()); if (cfg == null) { cfg = new Configuration(file); cfg.load(); CONFIGS.put(file.getAbsolutePath(), cfg); } <START> sync(cfg, cls, modid, category, !LoaderState.AVAILABLE.equals(Loader.instance().getLoaderState()), null); <END> cfg.save(); } catch (Exception e) { FMLLog.log.error("An error occurred trying to load a config for into {}", targ.getClassName(), e); throw new LoaderException(e); } } }</code><technical_language>Slightly cleaner: suggestion sync(cfg, cls, modid, category, !Loader.instance().hasReachedState(LoaderState.AVAILABLE), null);</technical_language>

Target:
public static void sync(String modid, Config.Type type) { FMLLog.log.debug("Attempting to inject @Config classes into for type {}", modid, type); ClassLoader mcl = Loader.instance().getModClassLoader(); File configDir = Loader.instance().getConfigDir(); Multimap<Config.Type, ASMData> map = asm_data.get(modid); if (map == null) return; for (ASMData targ : map.get(type)) { try { Class<?> cls = Class.forName(targ.getClassName(), true, mcl); Set<Class<?>> modConfigClasses = MOD_CONFIG_CLASSES.computeIfAbsent(modid, k -> Sets.<Class<?>>newHashSet()); modConfigClasses.add(cls); String name = (String)targ.getAnnotationInfo().get("name"); if (name == null) name = modid; String category = (String)targ.getAnnotationInfo().get("category"); if (category == null) category = "general"; File file = new File(configDir, name + ".cfg"); Configuration cfg = CONFIGS.get(file.getAbsolutePath()); if (cfg == null) { cfg = new Configuration(file); cfg.load(); CONFIGS.put(file.getAbsolutePath(), cfg); } sync(cfg, cls, modid, category, !Loader.instance().hasReachedState(LoaderState.AVAILABLE), null); cfg.save(); } catch (Exception e) { FMLLog.log.error("An error occurred trying to load a config for into {}", targ.getClassName(), e); throw new LoaderException(e); } } }
Source:
<code>public Optional<Payload> payloadFrom(String broadcastImi, ItemBroadcastHierarchy broadcastHierarchy) throws PayloadGenerationException { try { JAXBElement<TVAMainType> tvaElem = generator.generateBroadcastTVAFrom(broadcastHierarchy, broadcastImi); if (hasPCrid(broadcastHierarchy.broadcast())) { if (rollingWindowBroadcastEventDeduplicator.shouldUpload(tvaElem)) { rollingWindowBroadcastEventDeduplicator.recordUpload(tvaElem, broadcastHierarchy.broadcast()); } else { <START> log.trace("Not uploading broadcast, since its ProgramURL has already been associated with this service ID and item"); <END> return Optional.absent(); } } return Optional.of(new Payload(converter.convert(tvaElem), clock.now())); } catch (TvaGenerationException e) { throw new PayloadGenerationException(e); } }</code><technical_language>This trace message needs bringing up-to-date. Suggest actual reason is removed this class reason more</technical_language>

Target:
public Optional<Payload> payloadFrom(String broadcastImi, ItemBroadcastHierarchy broadcastHierarchy) throws PayloadGenerationException { try { JAXBElement<TVAMainType> tvaElem = generator.generateBroadcastTVAFrom(broadcastHierarchy, broadcastImi); if (hasPCrid(broadcastHierarchy.broadcast())) { if (broadcastEventDeduplicator.shouldUpload(tvaElem)) { broadcastEventDeduplicator.recordUpload(tvaElem, broadcastHierarchy.broadcast()); } else { return Optional.absent(); } } return Optional.of(new Payload(converter.convert(tvaElem), clock.now())); } catch (TvaGenerationException e) { throw new PayloadGenerationException(e); } }
Source:
<code>public List<E> filterByName(List<E> list, String contains) { return list .stream() <START> .filter(e -> e.getName().toLowerCase().replaceAll("\\s+", "").contains(contains.toLowerCase().replaceAll("\\s+", ""))) <END> .sorted(comparing(E::getName)) .collect(Collectors.toList()); }</code><technical_language>This is precompiled pattern</technical_language>

Target:
public List<E> filterByName(List<E> list, String contains) { return list .stream() .filter(e -> containsIgnoreCaseIgnoreSpaces(e.getName(), contains)) .sorted(comparing(E::getName)) .collect(Collectors.toList()); }
Source:
<code>static URL pathToURL(String path) throws MalformedURLException { <START> if (path.isEmpty()) { <END> throw new MalformedURLException("JENKINS-37599: empty classpath entries not allowed"); } try { return new URL(path); } catch (MalformedURLException x) { File f = new File(path); if (f.isAbsolute()) { return f.toURI().toURL(); } else { throw new MalformedURLException("classpath entries must be URLs or absolute file paths"); } } }</code><technical_language>StringUtils#isBlank()</technical_language>

Target:
static URL pathToURL(String path) throws MalformedURLException { if (path.isEmpty()) { throw new MalformedURLException("JENKINS-37599: empty classpath entries not allowed"); } try { return new URL(path); } catch (MalformedURLException x) { File f = new File(path); if (f.isAbsolute()) { return f.toURI().toURL(); } else { throw new MalformedURLException("Classpath entry ‘" + path + "’ does not look like either a URL or an absolute file path"); } } }
Source:
<code>private static <T> T doAsUser(UserGroupInformation ugi, PrivilegedExceptionAction<T> action) throws IOException { try { return ugi.doAs(action); } catch (InterruptedException ie) { <START> Thread.currentThread().interrupt(); <END> throw new IOException(ie); } }</code><technical_language>L521 -> InterruptedIOException</technical_language>

Target:
private static <T> T doAsUser(UserGroupInformation ugi, PrivilegedExceptionAction<T> action) throws IOException { try { return ugi.doAs(action); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new InterruptedIOException("Action interrupted"); } }
Source:
<code>protected void internalStop(Map<String, String> stopOptions) throws InfrastructureException { <START> if (startSynchronizer.startThread != null) { <END> startSynchronizer.interruptStartThread(); try { startSynchronizer.await(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException("Interrupted while waiting for start task cancellation", ex); } } else { destroyRuntime(stopOptions); } }</code><technical_language>startThread field locked volatile, this check fail of caching of pointer value</technical_language>

Target:
protected void internalStop(Map<String, String> stopOptions) throws InfrastructureException { if (startSynchronizer.interrupt()) { try { startSynchronizer.await(); } catch (RuntimeStartInterruptedException ex) { } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException("Interrupted while waiting for start task cancellation", ex); } } else { destroyRuntime(stopOptions); } }
Source:
<code>AzureFileSystem(AzureFileSystemProvider parentFileSystemProvider, String accountName, Map<String, ?> config) throws IOException { if (Objects.isNull(parentFileSystemProvider)) { throw Utility.logError(logger, new IllegalArgumentException("AzureFileSystem cannot be instantiated" + " without a parent FileSystemProvider")); } this.parentFileSystemProvider = parentFileSystemProvider; try { this.blobServiceClient = this.buildBlobServiceClient(accountName, config); Object blockSize = config.get(AZURE_STORAGE_UPLOAD_BLOCK_SIZE); <START> if (blockSize instanceof Integer) { <END> this.blockSize = Long.valueOf((Integer) blockSize); } else { this.blockSize = (Long) blockSize; } this.downloadResumeRetries = (Integer) config.get(AZURE_STORAGE_DOWNLOAD_RESUME_RETRIES); this.fileStores = this.initializeFileStores(config); } catch (RuntimeException e) { throw Utility.logError(logger, new IllegalArgumentException("There was an error parsing the configurations " + "map. Please ensure all fields are set to a legal value of the correct type.")); } catch (IOException e) { throw Utility.logError(logger, new IOException("Initializing FileStores failed. FileSystem could not be opened.", e)); } this.closed = false; }</code><technical_language>thanks :) expecting update nio</technical_language>

Target:
AzureFileSystem(AzureFileSystemProvider parentFileSystemProvider, String accountName, Map<String, ?> config) throws IOException { if (Objects.isNull(parentFileSystemProvider)) { throw LoggingUtility.logError(logger, new IllegalArgumentException("AzureFileSystem cannot be instantiated" + " without a parent FileSystemProvider")); } this.parentFileSystemProvider = parentFileSystemProvider; try { this.blobServiceClient = this.buildBlobServiceClient(accountName, config); Object blockSize = config.get(AZURE_STORAGE_UPLOAD_BLOCK_SIZE); if (blockSize instanceof Integer) { this.blockSize = Long.valueOf((Integer) blockSize); } else { this.blockSize = (Long) blockSize; } this.downloadResumeRetries = (Integer) config.get(AZURE_STORAGE_DOWNLOAD_RESUME_RETRIES); this.fileStores = this.initializeFileStores(config); } catch (RuntimeException e) { throw LoggingUtility.logError(logger, new IllegalArgumentException("There was an error parsing the " + "configurations map. Please ensure all fields are set to a legal value of the correct type.")); } catch (IOException e) { throw LoggingUtility.logError(logger, new IOException("Initializing FileStores failed. FileSystem could not be opened.", e)); } this.closed = false; }
Source:
<code>public void testCreateRequestMessageBuilderPublishedAtIsAfterCreatedAt() { String bodyText = "body text"; Payload requestPayload = TestUtils.createPayloadWithTextBody(bodyText); Builder requestMessageBuilder = TestUtils.createMessageBuilder(); Message message = messageFactory.createRequestMessage(requestMessageBuilder, requestPayload); <START> assertTrue(message.getMeta().getPublishedAt().isAfter(message.getMeta().getCreatedAt())); <END> }</code><technical_language>long line. split in variables createdAt publishedAt</technical_language>

Target:
public void testCreateRequestMessageBuilderPublishedAtIsAfterCreatedAt() { String bodyText = "body text"; Payload requestPayload = TestUtils.createPayloadWithTextBody(bodyText); Builder requestMessageBuilder = TestUtils.createMessageBuilder(Clock.systemDefaultZone()); Message message = messageFactory.createRequestMessage(requestMessageBuilder, requestPayload); Instant publishedAt = message.getMeta().getPublishedAt(); Instant createdAt = message.getMeta().getCreatedAt(); assertTrue(publishedAt.isAfter(createdAt)); }
Source:
<code>public void checkIn(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); String checkInComment = message.getHeader(PropertyIds.CHECKIN_COMMENT, String.class); String fileName = message.getHeader(PropertyIds.NAME, String.class); String mimeType = getMimeType(message); InputStream inputStream = (InputStream) message.getBody(); <START> byte[] bytes = StreamUtils.copyToByteArray(inputStream); <END> Document document = (Document) getSessionFacade().getObjectById(objectId); Map<String, Object> properties = filterTypeProperties(message.getHeaders()); ContentStream contentStream = getSessionFacade().createContentStream(fileName, bytes, mimeType); document.checkIn(true, properties, contentStream, checkInComment); }</code><technical_language>is type converter for this. do message.getBody(byte[].class) get bytes InputStream</technical_language>

Target:
public void checkIn(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); String checkInComment = message.getHeader(PropertyIds.CHECKIN_COMMENT, String.class); String fileName = message.getHeader(PropertyIds.NAME, String.class); String mimeType = getMimeType(message); InputStream inputStream = (InputStream) message.getBody(); byte[] bytes = message.getBody(byte[].class); Document document = (Document) getSessionFacade().getObjectById(objectId); Map<String, Object> properties = filterTypeProperties(message.getHeaders()); ContentStream contentStream = getSessionFacade().createContentStream(fileName, bytes, mimeType); document.checkIn(true, properties, contentStream, checkInComment); }
Source:
<code><START> private VXQueryIndexingDataSource(int id, String collection, String index, Object[] types, String functionCall) { <END> this.dataSourceId = id; this.collectionName = collection; this.indexName = index; this.function = functionCall; collectionPartitions = collectionName.split(DELIMITER); this.types = types; final IPhysicalPropertiesVector vec = new StructuralPropertiesVector( new RandomPartitioningProperty(new CollectionFileDomain(indexName)), new ArrayList<ILocalStructuralProperty>()); propProvider = new IDataSourcePropertiesProvider() { @Override public IPhysicalPropertiesVector computePropertiesVector(List<LogicalVariable> scanVariables) { return vec; } }; this.tag = null; this.childSeq = new ArrayList<>(); }</code><technical_language>Create AbstractVXQueryDataSouce share information indexing collection. Start clean code</technical_language>

Target:
private VXQueryIndexingDataSource(int id, String collection, String index, Object[] types, String functionCall) { this.dataSourceId = id; this.collectionName = collection; this.elementPath = index; this.function = functionCall; this.collectionPartitions = collectionName.split(DELIMITER); this.types = types; final IPhysicalPropertiesVector vec = new StructuralPropertiesVector( new RandomPartitioningProperty(new CollectionFileDomain(collectionName)), new ArrayList<>()); propProvider = new IDataSourcePropertiesProvider() { @Override public IPhysicalPropertiesVector computePropertiesVector(List<LogicalVariable> scanVariables) { return vec; } }; this.tag = null; this.childSeq = new ArrayList<>(); }
Source:
<code>private static LwM2mNode parseJSON(LwM2mJsonObject jsonObject, LwM2mPath path, LwM2mModel model) throws InvalidValueException { LOG.trace("Parsing JSON content for path {}: {}", path, jsonObject); if (path.isObject()) { <START> throw new InvalidValueException("Not yet implemented: " + " Object Path ", path); <END> } else if (path.isObjectInstance()) { Map<Integer,LwM2mResource> resourceMap = parseJsonPayLoadLwM2mResources(jsonObject, path, model); LwM2mResource[] resources = new LwM2mResource[resourceMap.size()]; int k=0; for (Entry<Integer,LwM2mResource> entry : resourceMap.entrySet()) { LwM2mResource resource = entry.getValue(); resources[k] = resource; k++; } return new LwM2mObjectInstance(path.getObjectInstanceId(), resources); } else { Map<Integer,LwM2mResource> resourceMap = parseJsonPayLoadLwM2mResources(jsonObject, path, model); LwM2mResource resource = resourceMap.get(0); return resource; } }</code><technical_language>throw new InvalidStateException("Not implemented")</technical_language>

Target:
private static LwM2mNode parseJSON(LwM2mJsonObject jsonObject, LwM2mPath path, LwM2mModel model) throws InvalidValueException, IllegalStateException { LOG.trace("Parsing JSON content for path {}: {}", path, jsonObject); if (path.isObject()) { throw new IllegalStateException("Not implemented"); } else if (path.isObjectInstance()) { Map<Integer,LwM2mResource> resourceMap = parseJsonPayLoadLwM2mResources(jsonObject, path, model); LwM2mResource[] resources = new LwM2mResource[resourceMap.size()]; int k=0; for (Entry<Integer,LwM2mResource> entry : resourceMap.entrySet()) { LwM2mResource resource = entry.getValue(); resources[k] = resource; k++; } return new LwM2mObjectInstance(path.getObjectInstanceId(), resources); } else { Map<Integer,LwM2mResource> resourceMap = parseJsonPayLoadLwM2mResources(jsonObject, path, model); LwM2mResource resource = resourceMap.get(0); return resource; } }
Source:
<code>protected Iterable<IAnalysisModule> getDependentAnalyses() { ITmfTrace trace = getTrace(); if (trace != null) { <START> LatencyAnalysis module = checkNotNull(TmfTraceUtils.getAnalysisModuleOfClass(trace, LatencyAnalysis.class, checkNotNull(LatencyAnalysis.ID))); <END> fLatencyModule = module; return checkNotNull(ImmutableList.of((IAnalysisModule) module)); } return super.getDependentAnalyses(); }</code><technical_language>no! TmfTraceUtils.getAnalysisModuleOfClass() is explicitly @Nullable, is guarantee module is in trace. handled a standard null check handles error</technical_language>

Target:
protected Iterable<IAnalysisModule> getDependentAnalyses() { ITmfTrace trace = getTrace(); if (trace != null) { LatencyAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, LatencyAnalysis.class, LatencyAnalysis.ID); if (module == null) { Activator.getDefault().logError("Could not find expected module of class LatencyAnalysis"); throw new IllegalStateException(); } fLatencyModule = module; return checkNotNull(ImmutableList.of(module)); } return super.getDependentAnalyses(); }
Source:
<code>private void checkForDefaultListAndAddIfNeeded(List<ReadingList> lists, SQLiteDatabase db) { if (lists.size() == 0 || !dbHasSavedList(lists)) { createList("", context.getString(R.string.default_list_desc)); <START> try (Cursor cursor = db.query(ReadingListContract.TABLE, null, null, null, null, null, null)) { while (cursor.moveToNext()) { ReadingList list = ReadingList.DATABASE_TABLE.fromCursor(cursor); lists.add(list); } } <END> } }</code><technical_language>..But lists parameter contains lists this method is entered. So, re-querying db populating lists again, duplicating lists stored in lists object. (When I try running this code for time, while existing collection of lists, I lists duplicated.) createList() method returns newly-created list. add return of createList() lists parameter, remove logic re-query db</technical_language>

Target:
private void checkForDefaultListAndAddIfNeeded(List<ReadingList> lists, SQLiteDatabase db) { if (lists.size() == 0 || !listCollectionContainsDefault(lists)) { createList("", context.getString(R.string.default_list_desc)); try (Cursor cursor = db.query(ReadingListContract.TABLE, null, null, null, null, null, null)) { while (cursor.moveToNext()) { ReadingList list = ReadingList.DATABASE_TABLE.fromCursor(cursor); lists.add(list); } } } }
Source:
<code>void refreshTopicPartitions() throws InterruptedException, ExecutionException { knownSourceTopicPartitions = findSourceTopicPartitions(); knownTargetTopicPartitions = findExistingTargetTopicPartitions(); <START> List<TopicPartition> targetTopicPartitionsUpstream = knownTargetTopicPartitions.stream() <END> .map(x -> new TopicPartition(replicationPolicy.upstreamTopic(x.topic()), x.partition())) .collect(Collectors.toList()); Set<TopicPartition> newTopicPartitions = new HashSet<>(); newTopicPartitions.addAll(knownSourceTopicPartitions); newTopicPartitions.removeAll(targetTopicPartitionsUpstream); Set<TopicPartition> deadTopicPartitions = new HashSet<>(); deadTopicPartitions.addAll(targetTopicPartitionsUpstream); deadTopicPartitions.removeAll(knownSourceTopicPartitions); if (!newTopicPartitions.isEmpty() || !deadTopicPartitions.isEmpty()) { log.info("Found topic-partitions on {}. are new. were removed. Previously had {}.", knownSourceTopicPartitions.size(), sourceAndTarget.source(), newTopicPartitions.size(), deadTopicPartitions.size(), knownSourceTopicPartitions.size()); log.trace("Found new topic-partitions: {}", newTopicPartitions); computeAndCreateTopicPartitions(); context.requestTaskReconfiguration(); } }</code><technical_language>I a suggestion, targetTopicPartitionsUpstream is a kinda confusing name</technical_language>

Target:
void refreshTopicPartitions() throws InterruptedException, ExecutionException { knownSourceTopicPartitions = findSourceTopicPartitions(); knownTargetTopicPartitions = findTargetTopicPartitions(); List<TopicPartition> upstreamTargetTopicPartitions = knownTargetTopicPartitions.stream() .map(x -> new TopicPartition(replicationPolicy.upstreamTopic(x.topic()), x.partition())) .collect(Collectors.toList()); Set<TopicPartition> newTopicPartitions = new HashSet<>(); newTopicPartitions.addAll(knownSourceTopicPartitions); newTopicPartitions.removeAll(upstreamTargetTopicPartitions); Set<TopicPartition> deadTopicPartitions = new HashSet<>(); deadTopicPartitions.addAll(upstreamTargetTopicPartitions); deadTopicPartitions.removeAll(knownSourceTopicPartitions); if (!newTopicPartitions.isEmpty() || !deadTopicPartitions.isEmpty()) { log.info("Found topic-partitions on {}. are new. were removed. Previously had {}.", knownSourceTopicPartitions.size(), sourceAndTarget.source(), newTopicPartitions.size(), deadTopicPartitions.size(), knownSourceTopicPartitions.size()); log.trace("Found new topic-partitions: {}", newTopicPartitions); computeAndCreateTopicPartitions(); context.requestTaskReconfiguration(); } }
Source:
<code>private void setCacheSize(Preference preference) { <START> long bytes = getCacheSize(Glide.getPhotoCacheDir(getActivity())); <END> preference.setSummary(FileUtils.byteCountToDisplaySize(bytes)); }</code><technical_language>calculate cache size asynchronously</technical_language>

Target:
private void setCacheSize(Preference preference) { subscriptions.add(Single.<Long>create(subscriber -> { File dir = Glide.getPhotoCacheDir(getActivity()); subscriber.onSuccess(getCacheSize(dir)); }).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(bytes -> { String humanReadableSize = FileUtils.byteCountToDisplaySize(bytes); preference.setSummary(humanReadableSize); })); }
Source:
<code>private CompletableFuture<Boolean> openRepository(String repoId, Optional<FilterPanel> panel) { assert Utility.isWellFormedRepoId(repoId); boolean isPrimaryRepository = !panel.isPresent(); if (isPrimaryRepository) prefs.setLastViewedRepository(repoId); if (isAlreadyOpen(repoId) || models.isRepositoryPending(repoId)) { if (isPrimaryRepository) { refreshUI(); } else { Platform.runLater(() -> UI.events.triggerEvent(new AppliedFilterEvent(panel.get()))); } return Futures.unit(false); } models.queuePendingRepository(repoId); return isRepositoryValid(repoId).thenCompose(valid -> { if (!valid) { return Futures.unit(false); } logger.info("Opening " + repoId); UI.status.displayMessage("Opening " + repoId); notifyRepoOpening(isPrimaryRepository); return repoOpControl.openRepository(repoId) .thenApply(models::addPending) .thenRun(this::refreshUI) .thenRun(() -> notifyRepoOpened(panel)) .thenCompose(n -> getRateLimitResetTime()) .thenAccept(this::updateApiQuotaInfoInGui) <START> .thenApply(rateLimits -> true) <END> .exceptionally(withResult(false)); }); }</code><technical_language>thenAccept instead of thenApply, this lambda's input parameter is longer rateLimits (it's Void). convention for this case is call input parameter n, in thenCompose call above</technical_language>

Target:
private CompletableFuture<Boolean> openRepository(String repoId, Optional<FilterPanel> panel) { assert Utility.isWellFormedRepoId(repoId); boolean isPrimaryRepository = !panel.isPresent(); if (isPrimaryRepository) prefs.setLastViewedRepository(repoId); if (isAlreadyOpen(repoId) || models.isRepositoryPending(repoId)) { if (isPrimaryRepository) { refreshUI(); } else { Platform.runLater(() -> UI.events.triggerEvent(new AppliedFilterEvent(panel.get()))); } return Futures.unit(false); } models.queuePendingRepository(repoId); return isRepositoryValid(repoId).thenCompose(valid -> { if (!valid) { return Futures.unit(false); } logger.info("Opening " + repoId); UI.status.displayMessage("Opening " + repoId); notifyRepoOpening(isPrimaryRepository); return repoOpControl.openRepository(repoId) .thenApply(models::addPending) .thenRun(this::refreshUI) .thenRun(() -> notifyRepoOpened(panel)) .thenCompose(n -> getRateLimitResetTime()) .thenAccept(this::updateApiQuotaInfoInGui) .thenApply(Void -> true) .exceptionally(withResult(false)); }); }
Source:
<code>void invalid() { try { int prolongations = 0; int camelCase = this.field; int it = this.field; <START> final int number1 = ++prolongations; <END> final int ex = ++camelCase; final int a = 0; } catch (final ArithmeticException ae) { throw ae; } catch (final IllegalArgumentException e) { throw e; } }</code><technical_language>@jrdalpra need testcase for final int id</technical_language>

Target:
void invalid() { try { int prolongations = 0; int very_long_variable_id = 0; int camelCase = this.field; int it = 0; final int number1 = ++prolongations; final int ex = ++camelCase; final int a = ++it + ++very_long_variable_id; } catch (final ArithmeticException ae) { throw ae; } catch (final IllegalArgumentException e) { throw e; } }
Source:
<code>public static int getIntegerValueFromDatabase(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { int value = -1; try (PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)){ if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try(ResultSet rs = prepStmt.executeQuery()) { if (rs.next()) { value = rs.getInt(1); } return value; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); }finally { <START> close(dbConnection); <END> } }</code><technical_language>connection passed a parameter this method, close connection this method. Need close connection in original place originally (create )close dbConnection</technical_language>

Target:
public static int getIntegerValueFromDatabase(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { int value = -1; try (PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)){ if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try(ResultSet rs = prepStmt.executeQuery()) { if (rs.next()) { value = rs.getInt(1); } return value; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }
Source:
<code>public void sendString(HttpResponseStatus status, String data, HttpHeaders headers) { if (data == null) { sendStatus(status, headers); return; } <START> ByteBuf buffer = Unpooled.wrappedBuffer(Charset.forName("UTF-8").encode(data)); <END> sendContent(status, buffer, addContentTypeIfMissing(new DefaultHttpHeaders().add(headers), "text/plain; charset=utf-8")); }</code><technical_language>suggestion: create a static final UTF_8 here. closest current code</technical_language>

Target:
public void sendString(HttpResponseStatus status, String data, HttpHeaders headers) { if (data == null) { sendStatus(status, headers); return; } ByteBuf buffer = Unpooled.wrappedBuffer(InternalUtil.UTF_8.encode(data)); sendContent(status, buffer, addContentTypeIfMissing(new DefaultHttpHeaders().add(headers), "text/plain; charset=utf-8")); }
Source:
<code>private Attribute(String key, State state, String value) { <START> this.key = key; <END> this.state = state != null ? state : State.CUSTOM; this.value = value; }</code><technical_language>Done. I a != null Assert.isNotNull is this plugin</technical_language>

Target:
private Attribute(String key, State state, String value) { if (key == null) throw new NullPointerException( "The key of an attribute should not be null"); this.key = key; this.state = state != null ? state : State.CUSTOM; this.value = value; }
Source:
<code>public String showAccount(Model model, @RequestParam(defaultValue = "false") boolean showCodes) { String twoFactorAuthenticationApp = appSettings.getTwoFactorAuthentication(); <START> boolean twoFactorAuthenticationUser = userAccountService.getCurrentUser().getTwoFactorAuthentication(); <END> model.addAttribute("user", userAccountService.getCurrentUser()); model.addAttribute("countries", CountryCodes.get()); model.addAttribute("groups", Lists.newArrayList(userAccountService.getCurrentUserGroups())); model.addAttribute("min_password_length", MIN_PASSWORD_LENGTH); model.addAttribute("two_factor_authentication_app", twoFactorAuthenticationApp); model.addAttribute("two_factor_authentication_user", twoFactorAuthenticationUser); model.addAttribute("show_recovery_codes", showCodes); return "view-useraccount"; }</code><technical_language>getTwoFactorAuthentication --> isTwoFactorAuthenticationEnabled</technical_language>

Target:
public String showAccount(Model model, @RequestParam(defaultValue = "false") boolean showCodes) { String twoFactorAuthenticationApp = appSettings.getTwoFactorAuthentication(); boolean isTwoFactorAuthenticationEnableForUser = userAccountService.getCurrentUser() .isTwoFactorAuthentication(); model.addAttribute("user", userAccountService.getCurrentUser()); model.addAttribute("countries", CountryCodes.get()); model.addAttribute("groups", Lists.newArrayList(userAccountService.getCurrentUserGroups())); model.addAttribute("min_password_length", MIN_PASSWORD_LENGTH); model.addAttribute("two_factor_authentication_app_option", twoFactorAuthenticationApp); model.addAttribute("two_factor_authentication_user_enabled", isTwoFactorAuthenticationEnableForUser); model.addAttribute("show_recovery_codes", showCodes); return "view-useraccount"; }