auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void finish(){ String textShell = new DefaultShell().getText(); new PushButton("Finish").click(); <START> new WaitWhile(new ShellIsActive(textShell)); <END> }</code><technical_language>ShellIsAvailable</technical_language>

Target:
public void finish(){ String textShell = new DefaultShell().getText(); new PushButton("Finish").click(); new WaitWhile(new ShellIsAvailable(textShell)); }
Source:
<code>public BasicSymbolProviderPreferencePage(@NonNull BasicSymbolProvider provider) { super(provider); setDescription(MessageFormat.format(Messages.BasicSymbolProviderPrefPage_description, provider.getTrace().getName())); setValid(true); <START> setTitle(MessageFormat.format(Messages.BasicSymbolProviderPrefPage_tabTitle, "GNU nm", provider.getTrace().getName())); END> }</code><technical_language>externalize this</technical_language>

Target:
public BasicSymbolProviderPreferencePage(@NonNull BasicSymbolProvider provider) { super(provider); setDescription(MessageFormat.format(Messages.BasicSymbolProviderPrefPage_description, provider.getTrace().getName())); setValid(true); setTitle(MessageFormat.format(Messages.BasicSymbolProviderPrefPage_tabTitle, provider.getTrace().getName())); }
Source:
<code>private static Set getCryptoImpls(String serviceType) { <START> Set result = new java.util.TreeSet(); <END> Provider[] providers = Security.getProviders(); for (int i = 0; i < providers.length; i++) { Set keys = providers[i].keySet(); for (Iterator it = keys.iterator(); it.hasNext(); ) { String key = (String) it.next(); key = key.split(" ")[0]; if (key.startsWith(serviceType + ".")) { result.add(key.substring(serviceType.length() + 1)); } else if (key.startsWith("Alg.Alias." + serviceType + ".")) { result.add(key.substring(serviceType.length() + 11)); } } } return (result); }</code><technical_language>nit: fully qualified import? conflict something</technical_language>

Target:
private static Set getCryptoImpls(String serviceType) { Set result = new TreeSet(); Provider[] providers = Security.getProviders(); for (int i = 0; i < providers.length; i++) { Set keys = providers[i].keySet(); for (Object okey : providers[i].keySet()) { String key = (String) okey; key = key.split(" ")[0]; if (key.startsWith(serviceType + ".")) { result.add(key.substring(serviceType.length() + 1)); } else if (key.startsWith("Alg.Alias." + serviceType + ".")) { result.add(key.substring(serviceType.length() + 11)); } } } return result; }
Source:
<code>public void hideInformationForStudent() { if (questionDetails instanceof FeedbackMcqQuestionDetails) { <START> ((FeedbackMcqQuestionDetails) questionDetails).setMcqWeights(Collections.emptyList()); <END> } else if (questionDetails instanceof FeedbackMsqQuestionDetails) { ((FeedbackMsqQuestionDetails) questionDetails).setMsqWeights(Collections.emptyList()); } else if (questionDetails instanceof FeedbackRubricQuestionDetails) { ((FeedbackRubricQuestionDetails) questionDetails) .setRubricWeightsForEachCell(Collections.singletonList(Collections.emptyList())); } }</code><technical_language>I MCQ/MSQ other weights need hide</technical_language>

Target:
public void hideInformationForStudent() { if (questionDetails instanceof FeedbackMcqQuestionDetails) { ((FeedbackMcqQuestionDetails) questionDetails).setMcqWeights(Collections.emptyList()); ((FeedbackMcqQuestionDetails) questionDetails).setMcqOtherWeight(0); } else if (questionDetails instanceof FeedbackMsqQuestionDetails) { ((FeedbackMsqQuestionDetails) questionDetails).setMsqWeights(Collections.emptyList()); ((FeedbackMsqQuestionDetails) questionDetails).setMsqOtherWeight(0); } else if (questionDetails instanceof FeedbackRubricQuestionDetails) { ((FeedbackRubricQuestionDetails) questionDetails) .setRubricWeightsForEachCell(Collections.singletonList(Collections.emptyList())); } }
Source:
<code>public void run() { <START> while (!connected) { <END> waitFor(1); } if (!getConfig().isEnableProjectAutoCompletion()) { return; } if (getConfig().getProjectListFetchDelay() == 0) { tryLoadProjectList(); } else { waitFor(getConfig().getProjectListFetchDelay()); tryLoadProjectList(); } if (listenToProjectCreatedEvents()) { logger.info("ProjectCreated events supported by Gerrit Server {}. " + "Will now listen for new projects...", serverName); } else { while (!shutdown) { waitFor(getConfig().getProjectListRefreshInterval()); tryLoadProjectList(); } } }</code><technical_language>safer connected AtomicBoolean</technical_language>

Target:
public void run() { if (!getConfig().isEnableProjectAutoCompletion()) { return; } if (getConfig().getProjectListFetchDelay() == 0) { tryLoadProjectList(); } else { waitFor(getConfig().getProjectListFetchDelay()); tryLoadProjectList(); } if (listenToProjectCreatedEvents()) { logger.info("ProjectCreated events supported by Gerrit Server {}. " + "Will now listen for new projects...", serverName); } else { while (!shutdown) { waitFor(getConfig().getProjectListRefreshInterval()); tryLoadProjectList(); } } }
Source:
<code>private ClockManager(final AggregationMaster aggregationMaster, final ClockMsgCodec codec, @Parameter(Staleness.class) final int staleness) { this.aggregationMaster = aggregationMaster; this.codec = codec; this.staleness = staleness; this.globalMinimumClock = INITIAL_GLOBAL_MINIMIM_CLOCK; workerClockMap = new HashMap<String, Integer>(); <START> minimumClockWorkers = new ArrayList<String>(); <END> }</code><technical_language>Explicit type argument replaced <></technical_language>

Target:
private ClockManager(final AggregationMaster aggregationMaster, final ClockMsgCodec codec, @Parameter(Staleness.class) final int staleness) { this.aggregationMaster = aggregationMaster; this.codec = codec; this.staleness = staleness; this.globalMinimumClock = INITIAL_GLOBAL_MINIMUM_CLOCK; workerClockMap = new HashMap<>(); minimumClockWorkers = new ArrayList<>(); }
Source:
<code>public synchronized void refresh(HelixDataAccessor accessor) { long startTime = System.currentTimeMillis(); Set<HelixConstants.ChangeType> propertyRefreshed = new HashSet<>(); <START> super.refresh(accessor, propertyRefreshed); <END> if (propertyRefreshed.contains(HelixConstants.ChangeType.IDEAL_STATE) || propertyRefreshed.contains(HelixConstants.ChangeType.LIVE_INSTANCE) || propertyRefreshed.contains(HelixConstants.ChangeType.INSTANCE_CONFIG) || propertyRefreshed.contains(HelixConstants.ChangeType.RESOURCE_CONFIG)) { clearCachedResourceAssignments(); } refreshExternalViews(accessor); refreshTargetExternalViews(accessor); LogUtil.logInfo(logger, getClusterEventId(), String.format( "END: ResourceControllerDataProvider.refresh() for cluster %s, started at %d took %d for %s pipeline", getClusterName(), startTime, System.currentTimeMillis() - startTime, getPipelineName())); dumpDebugInfo(); }</code><technical_language>minor: return propertyRefreshed refresh() call? Pass a parameter expect changed in method is a bit not-clear</technical_language>

Target:
public synchronized void refresh(HelixDataAccessor accessor) { long startTime = System.currentTimeMillis(); Set<HelixConstants.ChangeType> propertyRefreshed = super.doRefresh(accessor); if (propertyRefreshed.contains(HelixConstants.ChangeType.IDEAL_STATE) || propertyRefreshed.contains(HelixConstants.ChangeType.LIVE_INSTANCE) || propertyRefreshed.contains(HelixConstants.ChangeType.INSTANCE_CONFIG) || propertyRefreshed.contains(HelixConstants.ChangeType.RESOURCE_CONFIG)) { clearCachedResourceAssignments(); } refreshExternalViews(accessor); refreshTargetExternalViews(accessor); LogUtil.logInfo(logger, getClusterEventId(), String.format( "END: ResourceControllerDataProvider.refresh() for cluster %s, started at %d took %d for %s pipeline", getClusterName(), startTime, System.currentTimeMillis() - startTime, getPipelineName())); dumpDebugInfo(); }
Source:
<code>public static ProcessingStrategyFactory createDefaultProcessingStrategyFactory() { <START> return new TransactionAwareProactorStreamEmitterProcessingStrategyFactory(); <END> }</code><technical_language>is this ok</technical_language>

Target:
public static ProcessingStrategyFactory createDefaultProcessingStrategyFactory() { return new TransactionAwareStreamEmitterProcessingStrategyFactory(); }
Source:
<code>private void initTable(final ApplicationConstants constants, final ApplicationMessages messages) { getTable().addColumn(new TextColumnWithTooltip<QuotaVdsGroup>() { @Override public String getValue(QuotaVdsGroup object) { <START> return object.getVdsGroupName() == null || object.getVdsGroupName().equals("") ? constants.ultQuotaForAllClustersQuotaPopup() <END> : object.getVdsGroupName(); } }, constants.nameCluster()); getTable().addColumn(new TextColumnWithTooltip<QuotaVdsGroup>() { @Override public String getValue(QuotaVdsGroup object) { if (object.getMemSizeMB() == null) { return ""; } else if (object.getMemSizeMB().equals(QuotaVdsGroup.UNLIMITED_MEM)) { return messages.unlimitedMemConsumption(object.getMemSizeMBUsage()); } else { return messages.limitedMemConsumption(object.getMemSizeMBUsage(), object.getMemSizeMB()); } } }, constants.usedMemoryTotalCluster()); getTable().addColumn(new TextColumnWithTooltip<QuotaVdsGroup>() { @Override public String getValue(QuotaVdsGroup object) { if (object.getVirtualCpu() == null) { return ""; } else if (object.getVirtualCpu().equals(QuotaVdsGroup.UNLIMITED_VCPU)) { return messages.unlimitedVcpuConsumption(object.getVirtualCpuUsage()); } else { return messages.limitedVcpuConsumption(object.getVirtualCpuUsage(), object.getVirtualCpu()); } } }, constants.runningCpuTotalCluster()); }</code><technical_language>save null check - "".equals..</technical_language>

Target:
private void initTable(final ApplicationConstants constants, final ApplicationMessages messages) { getTable().addColumn(new TextColumnWithTooltip<QuotaVdsGroup>() { @Override public String getValue(QuotaVdsGroup object) { return "".equals(object.getVdsGroupName()) ? constants.ultQuotaForAllClustersQuotaPopup() : object.getVdsGroupName(); } }, constants.nameCluster()); getTable().addColumn(new TextColumnWithTooltip<QuotaVdsGroup>() { @Override public String getValue(QuotaVdsGroup object) { if (object.getMemSizeMB() == null) { return ""; } else if (object.getMemSizeMB().equals(QuotaVdsGroup.UNLIMITED_MEM)) { return messages.unlimitedMemConsumption(object.getMemSizeMBUsage()); } else { return messages.limitedMemConsumption(object.getMemSizeMBUsage(), object.getMemSizeMB()); } } }, constants.usedMemoryTotalCluster()); getTable().addColumn(new TextColumnWithTooltip<QuotaVdsGroup>() { @Override public String getValue(QuotaVdsGroup object) { if (object.getVirtualCpu() == null) { return ""; } else if (object.getVirtualCpu().equals(QuotaVdsGroup.UNLIMITED_VCPU)) { return messages.unlimitedVcpuConsumption(object.getVirtualCpuUsage()); } else { return messages.limitedVcpuConsumption(object.getVirtualCpuUsage(), object.getVirtualCpu()); } } }, constants.runningCpuTotalCluster()); }
Source:
<code>private void recreateConfigDriveIso(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest) throws ResourceUnavailableException { if (nic.isDefaultNic() && _networkModel.getUserDataUpdateProvider(network).getProvider().equals(Provider.ConfigDrive)) { DiskTO diskToUse = null; for (DiskTO disk : vm.getDisks()) { if (disk.getType() == Volume.Type.ISO && disk.getPath() != null && disk.getPath().contains("configdrive")) { diskToUse = disk; break; } } final UserVmVO userVm = _userVmDao.findById(vm.getId()); final Account caller = CallContext.current().getCallingAccount(); if (userVm != null) { final boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(userVm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); <START> String destHostname = (VirtualMachineManager.AllowExposeHypervisorHostname.value() && VirtualMachineManager.AllowExposeHypervisorHostnameAccountLevel.valueIn(caller.getId())) ? dest.getHost().getName() : null; <END> List<String[]> vmData = _networkModel.generateVmData(userVm.getUserData(), _serviceOfferingDao.findById(userVm.getServiceOfferingId()).getName(), userVm.getDataCenterId(), userVm.getInstanceName(), vm.getHostName(), vm.getId(), vm.getUuid(), nic.getMacAddress(), userVm.getDetail("SSH.PublicKey"), (String) vm.getParameter(VirtualMachineProfile.Param.VmPassword), isWindows, destHostname); vm.setVmData(vmData); vm.setConfigDriveLabel(VirtualMachineManager.VmConfigDriveLabel.value()); createConfigDriveIso(vm, dest, diskToUse); } } }</code><technical_language>triple code ;)</technical_language>

Target:
private void recreateConfigDriveIso(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest) throws ResourceUnavailableException { if (nic.isDefaultNic() && _networkModel.getUserDataUpdateProvider(network).getProvider().equals(Provider.ConfigDrive)) { DiskTO diskToUse = null; for (DiskTO disk : vm.getDisks()) { if (disk.getType() == Volume.Type.ISO && disk.getPath() != null && disk.getPath().contains("configdrive")) { diskToUse = disk; break; } } final UserVmVO userVm = _userVmDao.findById(vm.getId()); if (userVm != null) { final boolean isWindows = isWindows(userVm.getGuestOSId()); List<String[]> vmData = _networkModel.generateVmData(userVm.getUserData(), _serviceOfferingDao.findById(userVm.getServiceOfferingId()).getName(), userVm.getDataCenterId(), userVm.getInstanceName(), vm.getHostName(), vm.getId(), vm.getUuid(), nic.getMacAddress(), userVm.getDetail("SSH.PublicKey"), (String) vm.getParameter(VirtualMachineProfile.Param.VmPassword), isWindows, VirtualMachineManager.getHypervisorHostname(dest.getHost().getName())); vm.setVmData(vmData); vm.setConfigDriveLabel(VirtualMachineManager.VmConfigDriveLabel.value()); createConfigDriveIso(vm, dest, diskToUse); if (vm.getHypervisorType().equals(Hypervisor.HypervisorType.KVM)) { if (!VirtualMachineManager.VmConfigDriveOnPrimaryPool.value()) { detachAndAttachDiskForKvm(vm, dest, diskToUse); } } else { detachAndAttachDiskForOtherHypervisors(vm, dest, diskToUse); } } } }
Source:
<code>Sample to(SampleDto sampleDto) throws IOException { authorizationManager.throwIfUnauthenticated(); Sample sample = Dtos.to(sampleDto); sample.setProject(sqlProjectDAO.get(sampleDto.getProjectId())); if (sampleDto.getParentId() != null) { sample.setParent(sampleDao.getSample(sampleDto.getParentId())); } if (sampleDto.getSampleIdentityDto() != null) { sample.setIdentity(identityService.to(sampleDto.getSampleIdentityDto())); } if (sampleDto.getSampleAnalyte() != null) { <START> sample.setSampleAnalyte(sampleAnalyteService.to(sampleDto.getSampleAnalyte())); <END> } if (sampleDto.getSampleAdditionalInfo() != null) { sample.setSampleAdditionalInfo(sampleAdditionalInfoService.to(sampleDto.getSampleAdditionalInfo())); } return sample; }</code><technical_language>Do structure in place add a condition for if (sampleDto.getSampleTissue() != null)</technical_language>

Target:
Sample to(SampleDto sampleDto) throws IOException { authorizationManager.throwIfUnauthenticated(); checkArgument(sampleDto.getProjectId() != null, "A Project id must be provided to construct Sample."); Sample sample = Dtos.to(sampleDto); Project project = sqlProjectDAO.get(sampleDto.getProjectId()); ServiceUtils.throwIfNull(project, "projectId", sampleDto.getProjectId()); sample.setProject(project); if (sampleDto.getParentId() != null) { Sample parent = sampleDao.getSample(sampleDto.getParentId()); ServiceUtils.throwIfNull(parent, "parentId", sampleDto.getParentId()); sample.setParent(parent); } if (sampleDto.getSampleIdentity() != null) { sample.setIdentity(identityService.to(sampleDto.getSampleIdentity())); } if (sampleDto.getSampleAnalyte() != null) { sample.setSampleAnalyte(sampleAnalyteService.to(sampleDto.getSampleAnalyte())); } if (sampleDto.getSampleAdditionalInfo() != null) { sample.setSampleAdditionalInfo(sampleAdditionalInfoService.to(sampleDto.getSampleAdditionalInfo())); } if (sampleDto.getSampleTissue() != null) { sample.setSampleTissue(sampleTissueService.to(sampleDto.getSampleTissue())); } return sample; }
Source:
<code>public void put(NamedKey key, byte[] value) { final byte[] hash = computeKeyHash(prefix, key); final byte[] serialized; try { serialized = serialize(key, value); } catch (NullPointerException ex) { throw Throwables.propagate(ex); } try (final Jedis client = pool.getResource()) { <START> client.psetex(hash, expiration, serialized); <END> } catch (JedisConnectionException ex) { Throwables.propagate(ex); } catch (JedisException ex) { errorCount.incrementAndGet(); log.warn(ex, "Error putting cache item"); } }</code><technical_language>ideally put operations done asynchronously wait for happen, ok if jedis support that, do in asynchronous manner in druid</technical_language>

Target:
public void put(NamedKey key, byte[] value) { final byte[] serialized = serialize(key, value); try (ResourceHolder<ShardedJedis> clientHolder = supplier.get()) { final ShardedJedis jedis = clientHolder.get(); final byte[] itemKey = CacheImplUtils.computeKeyHash(prefix, key).getBytes(); Jedis shard = jedis.getShard(itemKey); if (expiration > 0) { shard.psetex(itemKey, expiration, serialized); } else { shard.set(itemKey, serialized); } final byte[] setKey = CacheImplUtils.computeNamespaceHash(prefix, key.namespace).getBytes(); shard = jedis.getShard(setKey); shard.sadd(setKey, key.key); } catch (IOException | JedisException ex) { this.countException(ex); log.warn(ex, "Error putting cache item"); } }
Source:
<code>protected void doGet(HttpServletRequest req, HttpServletResponse rsp) throws IOException { AvatarProvider avatarProvider = avatarProviderItem.get(); if (avatarProvider == null) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String user = req.getPathInfo(); if (user == null) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } user = user.substring(1); final Account account; try { account = accountResolver.find(user); <START> } catch (OrmException e1) { <END> rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String size = req.getParameter("size"); int imageSize = 0; if (size != null) { try { imageSize = Integer.parseInt(size); } catch (NumberFormatException e) { } } final String url = avatarProvider.getUrl(account, imageSize); rsp.sendRedirect(rsp.encodeRedirectURL(url)); }</code><technical_language>log this</technical_language>

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse rsp) throws IOException { AvatarProvider avatarProvider = avatarProviderItem.get(); if (avatarProvider == null) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String user = req.getPathInfo(); if (user == null) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } user = user.substring(1); final Account account; try { account = accountResolver.find(user); } catch (OrmException e1) { log.error("Exception while looking up avatar for user: " + user, e1); rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if (account == null) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String size = req.getParameter("size"); int imageSize = 0; if (size != null) { try { imageSize = Integer.parseInt(size); } catch (NumberFormatException e) { } } final String url = avatarProvider.getUrl(account, imageSize); if (url == null) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { rsp.sendRedirect(rsp.encodeRedirectURL(url)); } }
Source:
<code>public void testHasPermissionForPermissionOnGroupNonExistentUserTest() throws Exception { setEnvForPermissionOnGroupTests(true); Long nonExistentId = -1L; <START> user.setId(nonExistentId); <END> user.setGroups(Collections.<Group>emptyList()); Assert.assertFalse(evaluator.hasPermission(authentication, nonExistentId, targetType, permission)); Assert.assertFalse(evaluator.hasPermission(authentication, nonExistentId, targetType, "GeneralPermission.READ")); }</code><technical_language>Long()</technical_language>

Target:
public void testHasPermissionForPermissionOnGroupNonExistentUserTest() throws Exception { setEnvForPermissionOnGroupTests(true); long nonExistentId = -1L; user.setId(nonExistentId); user.setGroups(Collections.<Group>emptyList()); when(securityService.getFullUserInfoFrom(any(Authentication.class))).thenReturn(user); Assert.assertFalse(evaluator.hasPermission(authentication, nonExistentId, targetType, permission)); Assert.assertFalse(evaluator.hasPermission(authentication, nonExistentId, targetType, "GeneralPermission.READ")); }
Source:
<code>public void insertString(String str, SimpleAttributeSet attributes) throws BadLocationException { <START> Matcher m = Pattern.compile("([^\r\n]*)([\r\n]*\n)?(\r+)?").matcher(str); <END> while (m.find()) { String content = m.group(1); String newlines = m.group(2); String crs = m.group(3); int replaceLength = Math.min(content.length(), document.getLength() - insertPosition); document.replace(insertPosition, replaceLength, content, attributes); insertPosition += content.length(); if (newlines != null) { document.insertString(document.getLength(), newlines, attributes); insertPosition = document.getLength(); startOfLine = insertPosition; } if (crs != null) { insertPosition = startOfLine; } } }</code><technical_language>Knowing this called for line printed console, I if sense move time consuming pattern compilation a static variable top of file: private static Pattern newLinePattern = Pattern.compile("([^\r\n]*)([\r\n]*\n)?(\r+)?"); in insertString method, call Matcher m = newLinePattern.matcher(str); premature optimization is root of evil, repeatedly compiling Pattern expensive... 2 cents</technical_language>

Target:
public void insertString(String str, SimpleAttributeSet attributes) throws BadLocationException { Matcher m = newLinePattern.matcher(str); while (m.find()) { String content = m.group(1); String newlines = m.group(2); String crs = m.group(3); int replaceLength = Math.min(content.length(), document.getLength() - insertPosition); document.replace(insertPosition, replaceLength, content, attributes); insertPosition += content.length(); if (newlines != null) { document.insertString(document.getLength(), newlines, attributes); insertPosition = document.getLength(); startOfLine = insertPosition; } if (crs != null) { insertPosition = startOfLine; } } }
Source:
<code>public void testElementOfJsonPathResults(){ <START> JsonFixture cont = new JsonFixture(); <END> cont.load(JSON); Object result = cont.elementOfJsonPath(0,jsonPathWithResults); assertEquals(expectedResult,result); }</code><technical_language>fixture</technical_language>

Target:
public void testElementOfJsonPathResults() { fixture.load(JSON); Object result = fixture.elementOfJsonPath(0, "$.store.book[?(@.category==\"fiction\")].author"); assertEquals("Evelyn Waugh", result); }
Source:
<code>public ProcMeminfoParser(String fileName) throws IOException { List<String> lines = Files.readLines(new File(fileName), Charset.defaultCharset()); ImmutableMap.Builder<String, Long> builder = ImmutableMap.builder(); Map<String, Long> newMemInfo = new HashMap<>(); for (String line : lines) { int colon = line.indexOf(':'); if (colon == -1) { continue; } String keyword = line.substring(0, colon); String valString = line.substring(colon + 1); try { long val = Long.parseLong(CharMatcher.inRange('0', '9').retainFrom(valString)); if (!newMemInfo.containsKey(keyword)) { newMemInfo.put(keyword, val); } } catch (NumberFormatException e) { } } <START> builder.putAll(newMemInfo); <END> memInfo = builder.build(); }</code><technical_language>change this memInfo = ImmutableMap.copyOf(newMemInfo);, drop builder variable above. need create maps if enough</technical_language>

Target:
public ProcMeminfoParser(String fileName) throws IOException { List<String> lines = Files.readLines(new File(fileName), Charset.defaultCharset()); Map<String, Long> newMemInfo = new HashMap<>(); for (String line : lines) { int colon = line.indexOf(':'); if (colon == -1) { continue; } String keyword = line.substring(0, colon); String valString = line.substring(colon + 1); try { long val = Long.parseLong(CharMatcher.inRange('0', '9').retainFrom(valString)); if (!newMemInfo.containsKey(keyword)) { newMemInfo.put(keyword, val); } } catch (NumberFormatException e) { } } memInfo = ImmutableMap.copyOf(newMemInfo); }
Source:
<code>public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThroughNormalized(playerCamera)); initSkysphere(playerCamera.getzFar() < RADIUS ? playerCamera.getzFar() : RADIUS); wireframeStateChange = new SetWireframe(true); RenderingDebugConfig renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); <START> addDesiredStateChange(new SetRenderBufferMask(READONLY_GBUFFER, displayResolutionDependentFBOs, true, false, false)); <END> update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial("engine:prog.sky")); addDesiredStateChange(new DisableDepthWriting()); addDesiredStateChange(new EnableFaceCulling()); addDesiredStateChange(new SetFacesToCull(GL_FRONT)); }</code><technical_language>change signature mask (true, false false) is in arguments of constructor? wondering if rename SetRenderBufferMask SetFboWriteMask instead</technical_language>

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThroughNormalized(playerCamera)); initSkysphere(playerCamera.getzFar() < RADIUS ? playerCamera.getzFar() : RADIUS); wireframeStateChange = new SetWireframe(true); RenderingDebugConfig renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); addDesiredStateChange(new SetFboWriteMask(true, false, false, READONLY_GBUFFER, displayResolutionDependentFBOs)); addDesiredStateChange(new EnableMaterial("engine:prog.sky")); addDesiredStateChange(new DisableDepthWriting()); addDesiredStateChange(new EnableFaceCulling()); addDesiredStateChange(new SetFacesToCull(GL_FRONT)); }
Source:
<code>public static void writeToKryo(Kryo kryo, Output output, RyaStatement object) { output.writeString(object.getSubject().getData()); output.writeString(object.getPredicate().getData()); output.writeString(object.getObject().getDataType().toString()); output.writeString(object.getObject().getData()); <START> boolean hasContext = object.getContext() != null; <END> output.writeBoolean(hasContext); if(hasContext){ output.writeString(object.getContext().getData()); } boolean shouldWrite = object.getColumnVisibility() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeInt(object.getColumnVisibility().length); output.writeBytes(object.getColumnVisibility()); } shouldWrite = object.getQualifer() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeString(object.getQualifer()); } shouldWrite = object.getTimestamp() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeLong(object.getTimestamp()); } shouldWrite = object.getValue() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeBytes(object.getValue()); } }</code><technical_language>Needs docs</technical_language>

Target:
public static void writeToKryo(Kryo kryo, Output output, RyaStatement object) { Preconditions.checkNotNull(kryo); Preconditions.checkNotNull(output); Preconditions.checkNotNull(object); output.writeString(object.getSubject().getData()); output.writeString(object.getPredicate().getData()); output.writeString(object.getObject().getDataType().toString()); output.writeString(object.getObject().getData()); boolean hasContext = object.getContext() != null; output.writeBoolean(hasContext); if(hasContext){ output.writeString(object.getContext().getData()); } boolean shouldWrite = object.getColumnVisibility() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeInt(object.getColumnVisibility().length); output.writeBytes(object.getColumnVisibility()); } shouldWrite = object.getQualifer() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeString(object.getQualifer()); } shouldWrite = object.getTimestamp() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeLong(object.getTimestamp()); } shouldWrite = object.getValue() != null; output.writeBoolean(shouldWrite); if(shouldWrite){ output.writeBytes(object.getValue()); } }
Source:
<code><START> public ExternalServerIngressBuilder withLabels(Map<String, String> labels) { <END> if (this.labels == null) { this.labels = new HashMap<>(); } this.labels.putAll(labels); return this; }</code><technical_language>withLabels name, I assume labels. However, this adds labels existing ones. is similar method withAnnotations behaves differently. do rename this somethink addLabels? is a reason putAll instead of replace everything</technical_language>

Target:
public ExternalServerIngressBuilder withLabels(Map<String, String> labels) { this.labels = labels; return this; }
Source:
<code>public String getLabel() { <START> return "Drop Association as ClearAssociationAction"; <END> }</code><technical_language>Missing NLS</technical_language>

Target:
public String getLabel() { return Messages.AssociationToClearAssociationActionDropStrategy_Label; }
Source:
<code>private static boolean parseAllowAlias(List<Option> options) { Option option = Option.findByName(options, "allow_alias"); if (option != null) { Object value = option.getValue(); <START> return value instanceof Boolean ? (Boolean) value : "true".equals(value); <END> } return false; }</code><technical_language>is actual runtime type for value? This overly defensive - I expect a string a Boolean, randomly changing run run</technical_language>

Target:
private static boolean parseAllowAlias(List<Option> options) { Option option = Option.findByName(options, "allow_alias"); if (option != null) { Object value = option.getValue(); return value instanceof Boolean && (Boolean) value; } return false; }
Source:
<code>public void testUtf8FrameEncoding() { StompFrame frame = new DefaultStompFrame(StompCommand.SEND, Unpooled.wrappedBuffer("body".getBytes(CharsetUtil.UTF_8))); StompHeaders incoming = frame.headers(); incoming.set(StompHeaders.DESTINATION, "/queue/№11±♛нетти♕"); incoming.set(StompHeaders.CONTENT_TYPE, AsciiString.of("text/plain")); channel.writeOutbound(frame); ByteBuf headers = channel.readOutbound(); ByteBuf content = channel.readOutbound(); ByteBuf fullFrame = new CompositeByteBuf(ByteBufAllocator.DEFAULT, false, 2) <START> .addComponent(true, headers).addComponent(true, content); <END> assertEquals(SEND_FRAME_UTF8, fullFrame.toString(CharsetUtil.UTF_8)); assertTrue(fullFrame.release()); }</code><technical_language>nit: Unpooled.wrappedBuffer(...)</technical_language>

Target:
public void testUtf8FrameEncoding() { StompFrame frame = new DefaultStompFrame(StompCommand.SEND, Unpooled.wrappedBuffer("body".getBytes(CharsetUtil.UTF_8))); StompHeaders incoming = frame.headers(); incoming.set(StompHeaders.DESTINATION, "/queue/№11±♛нетти♕"); incoming.set(StompHeaders.CONTENT_TYPE, AsciiString.of("text/plain")); channel.writeOutbound(frame); ByteBuf headers = channel.readOutbound(); ByteBuf content = channel.readOutbound(); ByteBuf fullFrame = Unpooled.wrappedBuffer(headers, content); assertEquals(SEND_FRAME_UTF8, fullFrame.toString(CharsetUtil.UTF_8)); assertTrue(fullFrame.release()); }
Source:
<code>public void upgradeOutcomeTableRevision1To2(SQLiteDatabase db) { <START> String commonColumns = "_id,session,notification_ids,name,timestamp"; <END> try { db.execSQL("BEGIN TRANSACTION;"); db.execSQL("CREATE TEMPORARY TABLE outcome_backup(" + commonColumns + ");"); db.execSQL("INSERT INTO outcome_backup SELECT " + commonColumns + " FROM outcome;"); db.execSQL("DROP TABLE outcome;"); db.execSQL(SQL_CREATE_OUTCOME_ENTRIES_V2); db.execSQL("INSERT INTO outcome (" + commonColumns + ", weight) SELECT " + commonColumns + ", 0 FROM outcome_backup;"); db.execSQL("DROP TABLE outcome_backup;"); db.execSQL("COMMIT;"); } catch (SQLiteException e) { e.printStackTrace(); } }</code><technical_language>do commonColumns in upgradeOutcomeTableRevision2To3 for consistency? a big deal other match</technical_language>

Target:
public void upgradeOutcomeTableRevision1To2(SQLiteDatabase db) { String commonColumns = OutcomeEventsTable._ID + "," + OutcomeEventsTable.COLUMN_NAME_SESSION+ "," + OutcomeEventsTable.COLUMN_NAME_NOTIFICATION_IDS + "," + OutcomeEventsTable.COLUMN_NAME_NAME + "," + OutcomeEventsTable.COLUMN_NAME_TIMESTAMP; try { db.execSQL("BEGIN TRANSACTION;"); db.execSQL("CREATE TEMPORARY TABLE outcome_backup(" + commonColumns + ");"); db.execSQL("INSERT INTO outcome_backup SELECT " + commonColumns + " FROM outcome;"); db.execSQL("DROP TABLE outcome;"); db.execSQL(SQL_CREATE_OUTCOME_ENTRIES_V2); db.execSQL("INSERT INTO outcome (" + commonColumns + ", weight) SELECT " + commonColumns + ", 0 FROM outcome_backup;"); db.execSQL("DROP TABLE outcome_backup;"); } catch (SQLiteException e) { e.printStackTrace(); } finally { db.execSQL("COMMIT;"); } }
Source:
<code>public Firehose connect(StringInputRowParser firehoseParser) throws IOException { if (baseDir == null) { throw new IAE("baseDir is null"); } log.info("Searching for all [%s] in and beneath [%s]", filter, baseDir.getAbsoluteFile()); Collection<File> foundFiles = FileUtils.listFiles( baseDir.getAbsoluteFile(), new WildcardFileFilter(filter), TrueFileFilter.INSTANCE); if (foundFiles == null || foundFiles.isEmpty()) { throw new ISE("Found no files to ingest! Check your schema."); } log.info("Found files: " + foundFiles); final LinkedList<File> files = Lists.newLinkedList( foundFiles); return new FileIteratingFirehose( new Iterator<LineIterator>() { @Override public boolean hasNext() { return !files.isEmpty(); } @Override public LineIterator next() { final File f = files.poll(); try { InputStream innerInputStream = new FileInputStream(f); <START> final InputStream outerInputStream = f.getName().endsWith(".gz") <END> ? CompressionUtils.gzipInputStream(innerInputStream) : innerInputStream; return IOUtils.lineIterator( new BufferedReader( new InputStreamReader(outerInputStream, Charsets.UTF_8))); } catch (Exception e) { throw Throwables.propagate(e); } } @Override public void remove() { throw new UnsupportedOperationException(); } }, firehoseParser); }</code><technical_language>proposing InputStream inputStream = new FileInputStream(f); if(CompressionUtils.isGz(f.getName())) { inputStream = CompressionUtils.gzipInputStream(inputStream) }</technical_language>

Target:
public Firehose connect(StringInputRowParser firehoseParser) throws IOException { if (baseDir == null) { throw new IAE("baseDir is null"); } log.info("Searching for all [%s] in and beneath [%s]", filter, baseDir.getAbsoluteFile()); Collection<File> foundFiles = FileUtils.listFiles( baseDir.getAbsoluteFile(), new WildcardFileFilter(filter), TrueFileFilter.INSTANCE); if (foundFiles == null || foundFiles.isEmpty()) { throw new ISE("Found no files to ingest! Check your schema."); } log.info("Found files: " + foundFiles); final LinkedList<File> files = Lists.newLinkedList( foundFiles); return new FileIteratingFirehose( new Iterator<LineIterator>() { @Override public boolean hasNext() { return !files.isEmpty(); } @Override public LineIterator next() { final File f = files.poll(); InputStream rawInputStream = null; try { rawInputStream = new FileInputStream(f); final InputStream inputStream; String logMessage; if (CompressionUtils.isGz(f.getName())) { logMessage = "Reading gzipped file [%s]"; inputStream = CompressionUtils.gzipInputStream(rawInputStream); } else { logMessage = "Reading file [%s]"; inputStream = rawInputStream; } log.info(logMessage, f.getName()); return IOUtils.lineIterator( new BufferedReader( new InputStreamReader(inputStream, Charsets.UTF_8))); } catch (Exception e) { log.warn(e, "Failed to read file [%s]", f.getName()); if (rawInputStream != null) { try { rawInputStream.close(); } catch (IOException ioe) { Throwables.propagate(ioe); } } throw Throwables.propagate(e); } } @Override public void remove() { throw new UnsupportedOperationException(); } }, firehoseParser); }
Source:
<code>public List<Ref> getAdditionalRefs() throws IOException { <START> return null; <END> }</code><technical_language>this method is @NonNull, throw UnsupportedOperationException implement this</technical_language>

Target:
public List<Ref> getAdditionalRefs() throws IOException { throw new UnsupportedOperationException(); }
Source:
<code>private IterableStream<MinedOpinions> toMinedOpinionList( com.azure.ai.textanalytics.implementation.models.SentenceSentiment sentenceSentiment, List<DocumentSentiment> documentSentimentList) { final List<SentenceAspect> sentenceAspects = sentenceSentiment.getAspects(); <START> if (sentenceAspects == null) { <END> return null; } final List<MinedOpinions> minedOpinions = new ArrayList<>(); sentenceAspects.forEach(sentenceAspect -> { final List<OpinionSentiment> opinionSentiments = new ArrayList<>(); sentenceAspect.getRelations().forEach(aspectRelation -> { final AspectRelationType aspectRelationType = aspectRelation.getRelationType(); final String opinionPointer = aspectRelation.getRef(); if (AspectRelationType.OPINION == aspectRelationType) { opinionSentiments.add(toOpinionSentiment( findSentimentOpinion(opinionPointer, documentSentimentList))); } }); minedOpinions.add(new MinedOpinions( new AspectSentiment(sentenceAspect.getText(), TextSentiment.fromString(sentenceAspect.getSentiment().toString()), sentenceAspect.getOffset(), sentenceAspect.getLength(), toSentimentConfidenceScores(sentenceAspect.getConfidenceScores())), new IterableStream<>(opinionSentiments))); }); return new IterableStream<>(minedOpinions); }</code><technical_language>is this a common pattern in Java? in .NET, return empty list instead of null (applies other libraries too)</technical_language>

Target:
private IterableStream<MinedOpinion> toMinedOpinionList( com.azure.ai.textanalytics.implementation.models.SentenceSentiment sentenceSentiment, List<DocumentSentiment> documentSentimentList) { final List<SentenceAspect> sentenceAspects = sentenceSentiment.getAspects(); if (sentenceAspects == null) { return null; } final List<MinedOpinion> minedOpinions = new ArrayList<>(); sentenceAspects.forEach(sentenceAspect -> { final List<OpinionSentiment> opinionSentiments = new ArrayList<>(); sentenceAspect.getRelations().forEach(aspectRelation -> { final AspectRelationType aspectRelationType = aspectRelation.getRelationType(); final String opinionPointer = aspectRelation.getRef(); if (AspectRelationType.OPINION == aspectRelationType) { opinionSentiments.add(toOpinionSentiment( findSentimentOpinion(opinionPointer, documentSentimentList))); } }); minedOpinions.add(new MinedOpinion( new AspectSentiment(sentenceAspect.getText(), TextSentiment.fromString(sentenceAspect.getSentiment().toString()), sentenceAspect.getOffset(), sentenceAspect.getLength(), toSentimentConfidenceScores(sentenceAspect.getConfidenceScores())), new IterableStream<>(opinionSentiments))); }); return new IterableStream<>(minedOpinions); }
Source:
<code>private ByteBuffer getContent(Queue<HttpObject> contents, long expectedContentLength) { ByteBuffer buffer = ByteBuffer.allocate((int) expectedContentLength); boolean endMarkerFound = false; for (HttpObject object : contents) { assertFalse("There should have been no more data after the end marker was found", endMarkerFound); HttpContent content = (HttpContent) object; buffer.put(content.content().nioBuffer()); endMarkerFound = object instanceof LastHttpContent; ReferenceCountUtil.release(content); } <START> Assert.assertEquals("Content length did not match expected", expectedContentLength, buffer.position()); <END> return buffer; }</code><technical_language>add assertTrue("End marker found", endMarkerFound); here</technical_language>

Target:
private ByteBuffer getContent(Queue<HttpObject> contents, long expectedContentLength) { ByteBuffer buffer = ByteBuffer.allocate((int) expectedContentLength); boolean endMarkerFound = false; for (HttpObject object : contents) { assertFalse("There should have been no more data after the end marker was found", endMarkerFound); HttpContent content = (HttpContent) object; buffer.put(content.content().nioBuffer()); endMarkerFound = object instanceof LastHttpContent; ReferenceCountUtil.release(content); } assertEquals("Content length did not match expected", expectedContentLength, buffer.position()); assertTrue("End marker was not found", endMarkerFound); return buffer; }
Source:
<code>public void logPattern() throws Exception { TaskId taskId = TaskIdImpl.createTaskId(new JobIdImpl(1000, "job"), "task", 42L); taskLogger = new TaskLogger(taskId, "myhost"); assertEquals("", taskLogger.getLogs().getAllLogs(false)); taskLogger.getOutputSink().println("hello"); String quotedStringTaskId = Pattern.quote(taskId.toString()); assertTrue(taskLogger.getLogs() .getAllLogs(true) .matches("\\[" + quotedStringTaskId + <START> "@myhost;[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\\] hello\n? *\n+")); <END> taskLogger.getErrorSink().println("error"); assertTrue(taskLogger.getLogs() .getStderrLogs(true) .matches("\\[" + quotedStringTaskId + "@myhost;[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\\] error\n? *\n+")); }</code><technical_language>I need handle windows new lines</technical_language>

Target:
public void logPattern() throws Exception { TaskId taskId = TaskIdImpl.createTaskId(new JobIdImpl(1000, "job"), "task", 42L); taskLogger = new TaskLogger(taskId, "myhost"); assertEquals("", taskLogger.getLogs().getAllLogs(false)); taskLogger.getOutputSink().println("hello"); String quotedStringTaskId = Pattern.quote(taskId.toString()); assertTrue(taskLogger.getLogs() .getAllLogs(true) .matches("\\[" + quotedStringTaskId + "@myhost;[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\\] hello\r?\n? *\r?\n+")); taskLogger.getErrorSink().println("error"); assertTrue(taskLogger.getLogs() .getStderrLogs(true) .matches("\\[" + quotedStringTaskId + "@myhost;[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\\] error\r?\n? *\r?\n+")); }
Source:
<code>public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { GetLightPowerRequest powerPacket = new GetLightPowerRequest(); GetRequest colorPacket = new GetRequest(); try { switch (channelUID.getId()) { case CHANNEL_COLOR: case CHANNEL_BRIGHTNESS: sendPacket(powerPacket); sendPacket(colorPacket); break; case CHANNEL_TEMPERATURE: sendPacket(colorPacket); break; default: break; } } catch (Exception ex) { logger.error("Error while refreshing a chanel for the bulb: {}", ex.getMessage(), ex); } <START> <END> } else { try { switch (channelUID.getId()) { case CHANNEL_COLOR: if (command instanceof HSBType) { handleHSBCommand((HSBType) command); return; } break; case CHANNEL_BRIGHTNESS: if (command instanceof PercentType) { handlePercentCommand((PercentType) command); } else if (command instanceof OnOffType) { handleOnOffCommand((OnOffType) command); } else if (command instanceof IncreaseDecreaseType) { handleIncreaseDecreaseCommand((IncreaseDecreaseType) command); } break; case CHANNEL_TEMPERATURE: if (command instanceof PercentType) { handleTemperatureCommand((PercentType) command); } else if (command instanceof IncreaseDecreaseType) { handleIncreaseDecreaseTemperatureCommand((IncreaseDecreaseType) command); } break; default: break; } } catch (Exception ex) { logger.error("Error while updating bulb: {}", ex.getMessage(), ex); } } }</code><technical_language>remove 2 empty lines else</technical_language>

Target:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { GetLightPowerRequest powerPacket = new GetLightPowerRequest(); GetRequest colorPacket = new GetRequest(); try { switch (channelUID.getId()) { case CHANNEL_COLOR: case CHANNEL_BRIGHTNESS: sendPacket(powerPacket); sendPacket(colorPacket); break; case CHANNEL_TEMPERATURE: sendPacket(colorPacket); break; default: break; } } catch (Exception ex) { logger.error("Error while refreshing a channel for the bulb: {}", ex.getMessage(), ex); } } else { try { switch (channelUID.getId()) { case CHANNEL_COLOR: if (command instanceof HSBType) { handleHSBCommand((HSBType) command); return; } break; case CHANNEL_BRIGHTNESS: if (command instanceof PercentType) { handlePercentCommand((PercentType) command); } else if (command instanceof OnOffType) { handleOnOffCommand((OnOffType) command); } else if (command instanceof IncreaseDecreaseType) { handleIncreaseDecreaseCommand((IncreaseDecreaseType) command); } break; case CHANNEL_TEMPERATURE: if (command instanceof PercentType) { handleTemperatureCommand((PercentType) command); } else if (command instanceof IncreaseDecreaseType) { handleIncreaseDecreaseTemperatureCommand((IncreaseDecreaseType) command); } break; default: break; } } catch (Exception ex) { logger.error("Error while updating bulb: {}", ex.getMessage(), ex); } } }
Source:
<code>public boolean isEmpty() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Closed"); } assertions(); <START> for (PBDSegment s : m_segments.values()) { <END> final boolean wasClosed = s.isClosed(); try { if (!s.isOpenForReading(m_cursorId)) { s.openForRead(m_cursorId); } if (s.hasMoreEntries(m_cursorId)) return false; } finally { if (wasClosed) { s.close(); } } } return true; } }</code><technical_language>loop range changed m_segments.tailMap(m_segmentId).values(), segment numbered m_segmentId is currently read this cursor, segments read hasMoreEntries(m_cursorId) return false for segments</technical_language>

Target:
public boolean isEmpty() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Closed"); } assertions(); moveToValidSegment(); boolean inclusive = true; if (m_segment.isOpenForReading(m_cursorId)) { if (m_segment.getReader(m_cursorId).hasMoreEntries()) return false; inclusive = false; } for (PBDSegment currSegment : m_segments.tailMap(m_segment.segmentId(), inclusive).values()) { if (currSegment.getNumEntries() > 0) return false; } return true; } }
Source:
<code>private List<ServiceReference<?>> asList(ServiceReference<?>[] refs) { if (refs == null) <START> return Collections.EMPTY_LIST; <END> return Arrays.asList(refs); }</code><technical_language>Please Collections.emptyList() gradle build emits warnings. I fix issue this in this project</technical_language>

Target:
private List<ServiceReference<?>> asList(ServiceReference<?>[] refs) { if (refs == null) return Collections.emptyList(); return Arrays.asList(refs); }
Source:
<code>String gtk_rgba_to_css_string (GdkRGBA rgba) { String color; <START> if (rgba != null) { <END> color = "rgba(" + (int)(rgba.red * 255) + "," + (int)(rgba.green * 255) + "," + (int)(rgba.blue * 255) + "," + (int)(rgba.alpha * 255) + ")"; } else { GdkColor defaultGdkColor = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).handle; GdkRGBA defaultRGBA = new GdkRGBA (); defaultRGBA.alpha = 1.0; defaultRGBA.red = (defaultGdkColor.red & 0xFFFF) / (float)0xFFFF; defaultRGBA.green = (defaultGdkColor.green & 0xFFFF) / (float)0xFFFF; defaultRGBA.blue = (defaultGdkColor.blue & 0xFFFF) / (float)0xFFFF; color = "rgba(" + (int)(defaultRGBA.red * 255) + "," + (int)(defaultRGBA.green * 255) + "," + (int)(defaultRGBA.blue * 255) + ",1.0)"; } return color; }</code><technical_language>This block return set color default background conversion out of if block returned</technical_language>

Target:
String gtk_rgba_to_css_string (GdkRGBA rgba) { GdkRGBA toConvert; if (rgba != null) { toConvert = rgba; } else { GdkColor defaultGdkColor = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).handle; toConvert = new GdkRGBA (); toConvert.alpha = 1.0; toConvert.red = (defaultGdkColor.red & 0xFFFF) / (float)0xFFFF; toConvert.green = (defaultGdkColor.green & 0xFFFF) / (float)0xFFFF; toConvert.blue = (defaultGdkColor.blue & 0xFFFF) / (float)0xFFFF; } long str = OS.gdk_rgba_to_string (toConvert); int length = OS.strlen (str); byte buffer = new byte [length]; OS.memmove (buffer, str, length); return new String (Converter.mbcsToWcs (null, buffer)); }