auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void executeCommand() { VmDevice graphicsDev = getParameters().getDev(); if (graphicsDev.getDeviceId() == null) { graphicsDev.setDeviceId(Guid.newGuid()); } vmDeviceDao.save(graphicsDev); if (isCompensationEnabled()) { getCompensationContext().snapshotNewEntity(graphicsDev); getCompensationContext().stateChanged(); <START> } <END> setSucceeded(true); setActionReturnValue(graphicsDev.getId().getDeviceId()); }</code><technical_language>consider introducing another common parent device CRUD commands? I if introducing a common parent move this repeated code abstract classes simplify it, do think</technical_language>

Target:
protected void executeCommand() { VmDevice graphicsDev = getParameters().getDev(); if (graphicsDev.getDeviceId() == null) { graphicsDev.setDeviceId(Guid.newGuid()); } CompensationUtils.saveEntity(graphicsDev, vmDeviceDao, getCompensationContextIfEnabled()); if (isCompensationEnabled()) { getCompensationContext().stateChanged(); } setSucceeded(true); setActionReturnValue(graphicsDev.getId().getDeviceId()); }
Source:
<code>public int getTopologyId(byte[] cacheName) { return topologyInfo.getTopologyId(cacheName); <START> } <END></code><technical_language>this method createTopologyId interact topologyInfo a lock, a race condition</technical_language>

Target:
public int getTopologyId(byte[] cacheName) { synchronized (lock) { return topologyInfo.getTopologyId(cacheName); } }
Source:
<code>public int getNumberOfUghElements(Process myProcess, CountType inType) { int rueckgabe = 0; FileformatInterface gdzfile; try { gdzfile = serviceManager.getProcessService().readMetadataFile(myProcess); } catch (Exception e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung("xml error", e.getMessage()); return -1; } DigitalDocumentInterface document; try { document = gdzfile.getDigitalDocument(); DocStructInterface logicalTopstruct = document.getLogicalDocStruct(); rueckgabe += getNumberOfUghElements(logicalTopstruct, inType); } catch (PreferencesException e) { Helper.setFehlerMeldung("[" + myProcess.getId() + "] Can not get DigitalDocument: ", e.getMessage()); logger.error(e.getMessage(), e); rueckgabe = 0; } myProcess.setSortHelperArticles(rueckgabe); try { serviceManager.getProcessService().save(myProcess); } catch (DataException e) { logger.error(e.getMessage(), e); } return rueckgabe; }</code><technical_language>setErrorMessage</technical_language>

Target:
public int getNumberOfUghElements(Process myProcess, CountType inType) { int rueckgabe = 0; FileformatInterface gdzfile; try { gdzfile = serviceManager.getProcessService().readMetadataFile(myProcess); } catch (PreferencesException | IOException | ReadException | RuntimeException e) { Helper.setErrorMessage("xml error", logger, e); return -1; } DigitalDocumentInterface document; try { document = gdzfile.getDigitalDocument(); DocStructInterface logicalTopstruct = document.getLogicalDocStruct(); rueckgabe += getNumberOfUghElements(logicalTopstruct, inType); } catch (PreferencesException e) { Helper.setErrorMessage("[" + myProcess.getId() + "] " + Helper.getTranslation("cannotGetDigitalDocument") + ": " + e.getMessage(), logger, e); rueckgabe = 0; } myProcess.setSortHelperArticles(rueckgabe); try { serviceManager.getProcessService().save(myProcess); } catch (DataException e) { logger.error(e.getMessage(), e); } return rueckgabe; }
Source:
<code>public void after() { try { txSupport.rollbackTx(); } catch (Throwable t){ } try { txSupport.getTransactionInfo(); Assert.fail("Failed to rollback the transaction."); <START> } catch (Throwable e) { <END> } }</code><technical_language>a specific HTTP status code asserting</technical_language>

Target:
public void after() { try { txSupport.rollbackTx(); } catch (Throwable t){ } try { txSupport.getTransactionInfo(); Assert.fail("Failed to rollback the transaction."); } catch (HttpResponseException e) { } catch (IllegalStateException e) { } catch (Throwable t) { throw new RuntimeException(t); } }
Source:
<code><START> public Response send(final Request req, final String home, <END> final String method, final Collection<Map.Entry<String, String>> headers, final InputStream content, final int connect, final int read) throws IOException { final Response rsp; if (method.equals(Request.GET)) { rsp = this.lookInCache( req, home, method, headers, content, connect, read ); } else { rsp = this.origin.send( req, home, method, headers, content, connect, read ); } return rsp; }</code><technical_language>if original incoming request If-Modified-Since header? bypass cache</technical_language>

Target:
public Response send(final Request req, final String home, final String method, final Collection<Map.Entry<String, String>> headers, final InputStream content, final int connect, final int read) throws IOException { final Response rsp; if (method.equals(Request.GET)) { rsp = this.consultCache( req, home, method, headers, content, connect, read ); } else { rsp = this.origin.send( req, home, method, headers, content, connect, read ); } return rsp; }
Source:
<code>private Profile fetch(final XML xml) throws IOException { final Profile profile; final List<String> type = xml.xpath(" if (type.isEmpty() || !Profiles.MERGE.equals(type.get(0))) { profile = new GithubProfile( new TalkIssues(Profiles.github(), xml).get().repo() ); } else { final Profile master = new GithubProfile( new TalkIssues(Profiles.github(), xml).get().repo() ); profile = this.merged( <START> master, <END> xml.xpath(" xml.xpath( " ).get(0) ); } return profile; }</code><technical_language>@xupyprmv variable master is redundant here, please inline this real quick :)</technical_language>

Target:
private Profile fetch(final XML xml) throws IOException { final Profile profile; final List<String> type = xml.xpath(" if (type.isEmpty() || !Profiles.MERGE.equals(type.get(0))) { profile = new GithubProfile( new TalkIssues(Profiles.github(), xml).get().repo() ); } else { profile = this.merged( new GithubProfile( new TalkIssues(Profiles.github(), xml).get().repo() ), xml.xpath(" xml.xpath( " ).get(0) ); } return profile; }
Source:
<code>public String exportVm(VM vm, FullEntityOvfData fullEntityOvfData, Version version) { updateBootOrderOnDevices(vm.getStaticData(), false); final OvfVmWriter vmWriter; if (vm.isHostedEngine()) { Cluster cluster = clusterDao.get(vm.getClusterId()); String cpuId = cpuFlagsManagerHandler.getCpuId(cluster.getCpuName(), cluster.getCompatibilityVersion()); String engineXml = null; if <START> (Version.v4_2.lessOrEquals(cluster.getCompatibilityVersion())) { <END> engineXml = generateEngineXml(vm, cpuId, cluster.getEmulatedMachine()); } vmWriter = new HostedEngineOvfWriter(vm, fullEntityOvfData, version, cluster.getEmulatedMachine(), cpuId, osRepository, engineXml); } else { vmWriter = new OvfVmWriter(vm, fullEntityOvfData, version, osRepository, getMemoryDiskForSnapshots(vm)); } return vmWriter.build().getStringRepresentation(); }</code><technical_language>check FeatureSupported.isDomainXMLSupported instead</technical_language>

Target:
public String exportVm(VM vm, FullEntityOvfData fullEntityOvfData, Version version) { updateBootOrderOnDevices(vm.getStaticData(), false); final OvfVmWriter vmWriter; if (vm.isHostedEngine()) { Cluster cluster = clusterDao.get(vm.getClusterId()); String cpuId = cpuFlagsManagerHandler.getCpuId(cluster.getCpuName(), cluster.getCompatibilityVersion()); String engineXml = null; if (FeatureSupported.isDomainXMLSupported(cluster.getCompatibilityVersion())) { engineXml = generateEngineXml(vm, cpuId, cluster.getEmulatedMachine()); } vmWriter = new HostedEngineOvfWriter(vm, fullEntityOvfData, version, cluster.getEmulatedMachine(), cpuId, osRepository, engineXml); } else { vmWriter = new OvfVmWriter(vm, fullEntityOvfData, version, osRepository, getMemoryDiskForSnapshots(vm)); } return vmWriter.build().getStringRepresentation(); }
Source:
<code>private static BinaryResult stackBase64(HttpServletResponse res, final BinaryResult src) throws IOException { BinaryResult b64; long len = src.getContentLength(); if (0 <= len && len <= (7 << 20)) { b64 = base64(src); } else { b64 = new BinaryResult() { @Override public void writeTo(OutputStream out) throws IOException { try (OutputStream e = BaseEncoding.base64().encodingStream( <START> new OutputStreamWriter(out, ISO_8859_1))) { <END> src.writeTo(e); e.flush(); } } }; } res.setHeader("X-FYI-Content-Encoding", "base64"); res.setHeader("X-FYI-Content-Type", src.getContentType()); return b64.setContentType("text/plain").setCharacterEncoding("ISO-8859-1"); }</code><technical_language>This work. compiler auto-close writer assigned a variable</technical_language>

Target:
private static BinaryResult stackBase64(HttpServletResponse res, final BinaryResult src) throws IOException { BinaryResult b64; long len = src.getContentLength(); if (0 <= len && len <= (7 << 20)) { b64 = base64(src); } else { b64 = new BinaryResult() { @Override public void writeTo(OutputStream out) throws IOException { try (OutputStreamWriter w = new OutputStreamWriter(out, ISO_8859_1); OutputStream e = BaseEncoding.base64().encodingStream(w)) { src.writeTo(e); e.flush(); } } }; } res.setHeader("X-FYI-Content-Encoding", "base64"); res.setHeader("X-FYI-Content-Type", src.getContentType()); return b64.setContentType("text/plain").setCharacterEncoding("ISO-8859-1"); }
Source:
<code>private static Details getDetailsForOthers(DetailAST ast) { DetailAST rcurly = null; final DetailAST lcurly; final int tokenType = ast.getType(); if (isDefinitionToken(tokenType)) { <START> final DetailAST child = ast.getLastChild(); <END> lcurly = child.getFirstChild(); rcurly = child.getLastChild(); } else { lcurly = ast.findFirstToken(TokenTypes.SLIST); if (lcurly != null) { rcurly = lcurly.getLastChild(); } } return new Details(lcurly, rcurly, getNextToken(ast), true); }</code><technical_language>DEF_TOKENS a Set, this DEF_TOKENS.contains(tokenType) (or binarySearch) Code readability is more important nano optimizations</technical_language>

Target:
private static Details getDetailsForOthers(DetailAST ast) { DetailAST rcurly = null; final DetailAST lcurly; final int tokenType = ast.getType(); if (isTokenWithNoChildSlist(tokenType)) { final DetailAST child = ast.getLastChild(); lcurly = child.getFirstChild(); rcurly = child.getLastChild(); } else { lcurly = ast.findFirstToken(TokenTypes.SLIST); if (lcurly != null) { rcurly = lcurly.getLastChild(); } } return new Details(lcurly, rcurly, getNextToken(ast), true); }
Source:
<code>protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select " + getTypeString() + ":"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL | extraListOptions); String[] names; if (includeCurrent) { names = ConfigInfo.names(available).toArray(new String[0]); } else { names = ConfigInfo.namesWithoutCurrent(available).toArray(new String[0]); } Arrays.sort(names, String.CASE_INSENSITIVE_ORDER); setItems(names, compOrConfigNamesWithFlags); Boolean hasProtectedConfigs = ConfigInfo.hasProtectedConfigs(available); if (hasProtectedConfigs) <START> { <END> Group group = new Group(container, SWT.SHADOW_IN); group.setLayout(new RowLayout(SWT.HORIZONTAL)); Label messageImageLabel = new Label(group, SWT.NONE); messageImageLabel.setImage(JFaceResources. getImage(DLG_IMG_MESSAGE_WARNING)); Label messageLabel = new Label(group, SWT.NONE); messageLabel.setFont(JFaceResources.getDialogFont()); messageLabel.setText("Represents Protected " + getTypeString()); } }</code><technical_language>Checkstyle complain if { is line if a space { )</technical_language>

Target:
protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select " + getTypeString() + ":"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL | extraListOptions); String[] names; if (includeCurrent) { names = ConfigInfo.names(available).toArray(new String[0]); } else { names = ConfigInfo.namesWithoutCurrent(available).toArray(new String[0]); } Arrays.sort(names, String.CASE_INSENSITIVE_ORDER); setItems(names, compOrConfigNamesWithFlags); Boolean hasProtectedConfigs = ConfigInfo.hasProtectedElement(available); if (hasProtectedConfigs) { Group group = new Group(container, SWT.SHADOW_IN); group.setLayout(new RowLayout(SWT.HORIZONTAL)); Label messageImageLabel = new Label(group, SWT.NONE); messageImageLabel.setImage(JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING)); Label messageLabel = new Label(group, SWT.NONE); messageLabel.setFont(JFaceResources.getDialogFont()); messageLabel.setText("Represents Protected " + getTypeString()); } }
Source:
<code>ProjectCreatorGroupsProvider(@GerritServerConfig final Config config, SchemaFactory<ReviewDb> db, final SystemConfig systemConfig) { String[] createGroupNames = config.getStringList("repository", "*", "createGroup"); Set<AccountGroup.Id> createGroups = ConfigUtil.groupsFor(db, createGroupNames, log); <START> if (createGroups.isEmpty()){ <END> groupIds = Collections.singleton(systemConfig.adminGroupId); }else{ groupIds = createGroups; } }</code><technical_language>Style-nit: Space {</technical_language>

Target:
ProjectCreatorGroupsProvider(@GerritServerConfig final Config config, SchemaFactory<ReviewDb> db, final SystemConfig systemConfig) { String[] names = config.getStringList("repository", "*", "createGroup"); Set<AccountGroup.Id> createGroups = ConfigUtil.groupsFor(db, names, log); if (createGroups.isEmpty()) { groupIds = Collections.singleton(systemConfig.adminGroupId); } else { groupIds = createGroups; } }
Source:
<code>public Boolean hasDiagnosis(Diagnosis diagnosis) { <START> for (Diagnosis diagnosisFound : getDiagnoses()) { <END> if (diagnosis.equals(diagnosisFound)) { return true; } } return false; }</code><technical_language>Instead of diagnosisFound, i rename diagnosis is</technical_language>

Target:
public Boolean hasDiagnosis(Diagnosis diagnosis) { for (Diagnosis diagnosis1 : getDiagnoses()) { if (diagnosis.equals(diagnosis1)) { return true; } } return false; }
Source:
<code>public String getUrl(int requestId, CheckerInfo checkerInfo) { <START> return String.format(URL, checkerInfo.getCurrencyBase(), checkerInfo.getCurrencyCounter()); <END> }</code><technical_language>I pairId remove arguments URL</technical_language>

Target:
public String getUrl(int requestId, CheckerInfo checkerInfo) { return String.format(URL, checkerInfo.getCurrencyPairId()); }
Source:
<code>public void testDeleteFiltering() throws Exception { String tableName = "TestDeleteFiltering"; byte[] familyBytes = Bytes.toBytes("f"); byte[] columnBytes = Bytes.toBytes("c"); HRegion region = createRegion(tableName, familyBytes, 0); try { region.initialize(); TransactionStateCache cache = new TransactionStateCacheSupplier(conf).get(); LOG.info("Coprocessor is using transaction state: " + cache.getLatestState()); byte[] row = Bytes.toBytes(1); for (int i = 4; i < V.length; i++) { if (i != 5) { Put p = new Put(row); p.add(familyBytes, columnBytes, V[i], Bytes.toBytes(V[i])); region.put(p); } } <START> long deleteTs = V[5] + 1; <END> Delete d = new Delete(row, deleteTs); LOG.info("Issuing delete at timestamp " + deleteTs); d.deleteColumns(familyBytes, columnBytes, deleteTs); region.delete(d); List<Cell> results = Lists.newArrayList(); LOG.info("Flushing region " + region.getRegionNameAsString()); region.flushcache(); Scan scan = new Scan(); scan.setMaxVersions(10); RegionScanner regionScanner = region.getScanner(scan); assertFalse(regionScanner.next(results)); assertKeyValueMatches(results, 1, new long[]{V[8], V[6], deleteTs}, new byte[][]{Bytes.toBytes(V[8]), Bytes.toBytes(V[6]), new byte[0]}); } finally { region.close(); } }</code><technical_language>in puts specifically skips putting V[5], write delete it, no</technical_language>

Target:
public void testDeleteFiltering() throws Exception { String tableName = "TestDeleteFiltering"; byte[] familyBytes = Bytes.toBytes("f"); byte[] columnBytes = Bytes.toBytes("c"); HRegion region = createRegion(tableName, familyBytes, 0); try { region.initialize(); TransactionStateCache cache = new TransactionStateCacheSupplier(conf).get(); LOG.info("Coprocessor is using transaction state: " + cache.getLatestState()); byte[] row = Bytes.toBytes(1); for (int i = 4; i < V.length; i++) { Put p = new Put(row); p.add(familyBytes, columnBytes, V[i], Bytes.toBytes(V[i])); region.put(p); } long deleteTs = V[5] + 1; Delete d = new Delete(row, deleteTs); LOG.info("Issuing delete at timestamp " + deleteTs); d.deleteColumns(familyBytes, columnBytes, deleteTs); region.delete(d); List<Cell> results = Lists.newArrayList(); LOG.info("Flushing region " + region.getRegionNameAsString()); region.flushcache(); Scan scan = new Scan(); scan.setMaxVersions(10); RegionScanner regionScanner = region.getScanner(scan); assertFalse(regionScanner.next(results)); assertKeyValueMatches(results, 1, new long[]{V[8], V[6], deleteTs}, new byte[][]{Bytes.toBytes(V[8]), Bytes.toBytes(V[6]), new byte[0]}); } finally { region.close(); } }
Source:
<code>public void run() { while (running.get()) { try { final DelayedWithTimeout task = DelayedUtil.takeWithoutInterrupt(queue); if (task == null || task == DelayedUtil.DELAYED_POISON) { continue; } if (task instanceof DelayedTask) { threadPool.execute(((DelayedTask) task).getObject()); } else { ((BufferNode) task).dispatch(); } } catch (Throwable e) { LOG.error("Caught error", e); <START> if (timeoutExecutorError != null) { <END> timeoutExecutorError.exe(e); } } } }</code><technical_language>abort for exception for OOM</technical_language>

Target:
public void run() { while (running.get()) { final DelayedWithTimeout task = DelayedUtil.takeWithoutInterrupt(queue); if (task == null || task == DelayedUtil.DELAYED_POISON) { continue; } if (task instanceof DelayedTask) { threadPool.execute(((DelayedTask) task).getObject()); } else { ((BufferNode) task).dispatch(); } } }
Source:
<code>FactoryDescriptor(String name, String extendingType, ImmutableSet<String> implementingTypes, ImmutableSet<FactoryMethodDescriptor> methodDescriptors) { this.name = checkNotNull(name); this.extendingType = checkNotNull(extendingType); this.implementingTypes = checkNotNull(implementingTypes); this.methodDescriptors = checkNotNull(methodDescriptors); <START> ImmutableSetMultimap.Builder<Key, String> builder = ImmutableSetMultimap.builder(); <END> for (FactoryMethodDescriptor descriptor : methodDescriptors) { for (Parameter parameter : descriptor.providedParameters()) { builder.putAll(parameter.asKey(), parameter.name()); } } ImmutableMap.Builder<Key, String> providersBuilder = ImmutableMap.builder(); for (Entry<Key, Collection<String>> entry : builder.build().asMap().entrySet()) { Key key = entry.getKey(); switch (entry.getValue().size()) { case 0: throw new AssertionError(); case 1: providersBuilder.put(key, Iterables.getOnlyElement(entry.getValue()) + "Provider"); break; default: providersBuilder.put(key, identifierMatcher.replaceFrom(key.toString(), '_') + "Provider"); break; } } this.providerNames = providersBuilder.build(); }</code><technical_language>Multiple builders on, this default returning from. please name more descriptively</technical_language>

Target:
FactoryDescriptor(String name, String extendingType, ImmutableSet<String> implementingTypes, ImmutableSet<FactoryMethodDescriptor> methodDescriptors) { this.name = checkNotNull(name); this.extendingType = checkNotNull(extendingType); this.implementingTypes = checkNotNull(implementingTypes); this.methodDescriptors = checkNotNull(methodDescriptors); ImmutableSetMultimap.Builder<Key, String> providerNamesBuilder = ImmutableSetMultimap.builder(); for (FactoryMethodDescriptor descriptor : methodDescriptors) { for (Parameter parameter : descriptor.providedParameters()) { providerNamesBuilder.putAll(parameter.asKey(), parameter.name()); } } ImmutableMap.Builder<Key, String> providersBuilder = ImmutableMap.builder(); for (Entry<Key, Collection<String>> entry : providerNamesBuilder.build().asMap().entrySet()) { Key key = entry.getKey(); switch (entry.getValue().size()) { case 0: throw new AssertionError(); case 1: providersBuilder.put(key, Iterables.getOnlyElement(entry.getValue()) + "Provider"); break; default: providersBuilder.put(key, identifierMatcher.replaceFrom(key.toString(), '_') + "Provider"); break; } } this.providerNames = providersBuilder.build(); }
Source:
<code>private CliProcessWrapper getTestCliProcessWrapper(boolean connectToAlias) { CliProcessWrapper cli = new CliProcessWrapper() <START> .addCliArgument("-Djboss.cli.config=" + TMP_JBOSS_CLI_FILE.toPath()) <END> .addCliArgument("--connect") .addCliArgument("--echo-command") .addCliArgument("--command=:read-attribute(name=server-state)"); if (connectToAlias) { cli.addCliArgument("--controller=" + CONTROLLER_ALIAS_NAME); } return cli; }</code><technical_language>getAbsolutePath(), implicit getPath() ==> toString()</technical_language>

Target:
private CliProcessWrapper getTestCliProcessWrapper(boolean connectToAlias) { CliProcessWrapper cli = new CliProcessWrapper() .addCliArgument("-Djboss.cli.config=" + tempJbossConfigFile.getAbsolutePath()) .addCliArgument("--echo-command"); if (connectToAlias) { cli.addCliArgument("--controller=" + CONTROLLER_ALIAS_NAME); } return cli; }
Source:
<code>public static int parseInteger(String value, int defaultValue) { if (isNullOrEmpty(value)) { return defaultValue; } try { return Integer.parseInt(value); } catch (NumberFormatException e) { <START> return defaultValue; <END> } }</code><technical_language>worth logging if is invalid silently ignoring input value</technical_language>

Target:
public static int parseInteger(String value, int defaultValue) { if (isNullOrEmpty(value)) { return defaultValue; } return Integer.parseInt(value); }
Source:
<code>public Query(String cypherQuery, String countQuery, Map<String, Object> parameters) { <START> Assert.notNull(cypherQuery, "Query must not be null."); <END> Assert.notNull(parameters, "Parameters must not be null."); this.cypherQuery = sanitize(cypherQuery); this.countQuery = sanitize(countQuery); this.parameters = parameters; }</code><technical_language>This countQuery required break exiting users. is required? check for notNull, pass sanitize, do a null check</technical_language>

Target:
public Query(String cypherQuery, String countQuery, Map<String, Object> parameters) { Assert.notNull(cypherQuery, "Query must not be null."); Assert.notNull(countQuery, "Count query must not be null."); Assert.notNull(parameters, "Parameters must not be null."); this.cypherQuery = sanitize(cypherQuery); this.countQuery = sanitize(countQuery); this.parameters = parameters; }
Source:
<code>protected Builder() { id("azurecompute") .name("Microsoft Azure Service Management Service API") .version("2014-10-01") .identityName("Path to Management Certificate .p12 file, or PEM string") .credentialName("Password to Management Certificate") <START> .defaultEndpoint("<LINK_1>${" + SUBSCRIPTION_ID + "}") <END> .endpointName("Service Management Endpoint ending in your Subscription Id") .documentation(URI.create("<LINK_0>")) .defaultProperties(AzureManagementApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) .defaultModules(ImmutableSet.<Class<? extends Module>>builder() .add(AzureComputeServiceContextModule.class) .add(AzureComputeHttpApiModule.class).build()); }</code><technical_language>Endpoints meant usable _without_ user modification. If is endpoint hardcoded, remove it</technical_language>

Target:
protected Builder() { id("azurecompute") .name("Microsoft Azure Service Management Service API") .version("2014-10-01") .identityName("Path to Management Certificate .p12 file, or PEM string") .credentialName("Password to Management Certificate") .endpointName("Service Management Endpoint ending in your Subscription Id") .documentation(URI.create("<LINK_0>")) .defaultProperties(AzureManagementApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) .defaultModules(ImmutableSet.<Class<? extends Module>>builder() .add(AzureComputeServiceContextModule.class) .add(AzureComputeHttpApiModule.class).build()); }
Source:
<code>void setCurrentPacket(StreamInputPacketIndexEntry currentPacket) throws CTFReaderException { StreamInputPacketIndexEntry prevPacket = null; fCurrentPacket = currentPacket; if (fCurrentPacket != null) { ByteBuffer bb = null; try { bb = getByteBufferAt( <START> fCurrentPacket.getOffsetBits(), <END> (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE); } catch (IOException e) { throw new CTFReaderException(e.getMessage(), e); } BitBuffer bitBuffer = new BitBuffer(bb); fBitBuffer = bitBuffer; if (fTracePacketHeaderDecl != null) { fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer); } if (fStreamPacketContextDecl != null) { fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer); if (getCurrentPacket().getTarget() != null) { fCurrentCpu = (int) getCurrentPacket().getTargetId(); } fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents(); if (fLostEventsInThisPacket != 0) { fHasLost = true; long lostEventsStartTime; int index = fStreamInputReader.getStreamInput().getIndex().indexOf(currentPacket); if (index == 0) { lostEventsStartTime = currentPacket.getTimestampBegin() + 1; } else { prevPacket = fStreamInputReader.getStreamInput().getIndex().getElement(index - 1); lostEventsStartTime = prevPacket.getTimestampEnd(); } fLostEventsDuration = Math.abs(lostEventsStartTime - currentPacket.getTimestampBegin()); } } fLastTimestamp = currentPacket.getTimestampBegin(); } else { fBitBuffer = null; fLastTimestamp = 0; } }</code><technical_language>position is bytes, it? divide 8 here</technical_language>

Target:
void setCurrentPacket(StreamInputPacketIndexEntry currentPacket) throws CTFReaderException { StreamInputPacketIndexEntry prevPacket = null; fCurrentPacket = currentPacket; if (fCurrentPacket != null) { ByteBuffer bb = null; try { bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE); } catch (IOException e) { throw new CTFReaderException(e.getMessage(), e); } BitBuffer bitBuffer = new BitBuffer(bb); fBitBuffer = bitBuffer; if (fTracePacketHeaderDecl != null) { fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer); } if (fStreamPacketContextDecl != null) { fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer); if (getCurrentPacket().getTarget() != null) { fCurrentCpu = (int) getCurrentPacket().getTargetId(); } fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents(); if (fLostEventsInThisPacket != 0) { fHasLost = true; long lostEventsStartTime; int index = fStreamInputReader.getStreamInput().getIndex().indexOf(currentPacket); if (index == 0) { lostEventsStartTime = currentPacket.getTimestampBegin() + 1; } else { prevPacket = fStreamInputReader.getStreamInput().getIndex().getElement(index - 1); lostEventsStartTime = prevPacket.getTimestampEnd(); } fLostEventsDuration = Math.abs(lostEventsStartTime - currentPacket.getTimestampBegin()); } } fLastTimestamp = currentPacket.getTimestampBegin(); } else { fBitBuffer = null; fLastTimestamp = 0; } }
Source:
<code>protected void executeQueryCommand() { Map<String, Object> response = SSOOAuthServiceUtils.getAvailableNamespaces( <START> getSessionDataContainer().getSsoAccessToken(getParameters().getSessionId())); <END> Map<String, List<String>> namespacesMap = new HashMap<>(); for (ExtensionProxy authz: EngineExtensionsManager.getInstance().getExtensionsByService(Authz.class.getName())) { for (String namespace : authz.getContext().<Collection<String>>get(Authz.ContextKeys.AVAILABLE_NAMESPACES, Collections.<String>emptyList())) { MultiValueMapUtils.addToMap(AuthzUtils.getName(authz), namespace, namespacesMap); } } if (response.containsKey("result")) { namespacesMap = (Map<String, List<String>>) response.get("result"); } for (List<String> entry : namespacesMap.values()) { Collections.sort(entry); } setReturnValue(namespacesMap); }</code><technical_language>Is a situation getAvailableNamespaces return result, required traverse authz extensions here</technical_language>

Target:
protected void executeQueryCommand() { Map<String, Object> response = SSOOAuthServiceUtils.getAvailableNamespaces( getSessionDataContainer().getSsoAccessToken(getParameters().getSessionId())); Map<String, List<String>> namespacesMap = new HashMap<>(); if (response.containsKey("result")) { namespacesMap = (Map<String, List<String>>) response.get("result"); } for (List<String> entry : namespacesMap.values()) { Collections.sort(entry); } setReturnValue(namespacesMap); }
Source:
<code>public void init() throws APIManagerIntegrationTestException { String warFileName = "jaxrs_basic"; String warFileLocation = System.getProperty("user.dir") + File.separator+ "src/test/resources" + File.separator + warFileName + ".war"; createUsers(); apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login(apiProvider, "wso2123$"); apiStore = new APIStoreRestClient(storeURL); apiStore.login("APIConsumer", "wso2123$"); try { WebAppDeployUtils.deployWebApp(serviceEndpoint, admin, admin, warFileLocation, warFileName); boolean isWebAppDeployed = WebAppDeployUtils.isWebApplicationDeployed(serviceEndpoint, admin, admin, warFileName); assertTrue(isWebAppDeployed, warFileName + " is not deployed" ); log.info("WebApp deployed successfully"); } catch (RemoteException | MalformedURLException e) { <START> log.error("Error when deploying webApp", e); <END> } }</code><technical_language>print failing web app name in log</technical_language>

Target:
public void init() throws APIManagerIntegrationTestException { String warFileName = "jaxrs_basic"; String warFileLocation = System.getProperty("user.dir") + File.separator+ "src/test/resources" + File.separator + warFileName + ".war"; createUsers(); apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login(apiProvider, "wso2123$"); apiStore = new APIStoreRestClient(storeURL); apiStore.login("APIConsumer", "wso2123$"); try { WebAppDeployUtils.deployWebApp(serviceEndpoint, admin, admin, warFileLocation, warFileName); boolean isWebAppDeployed = isWebApplicationDeployed(serviceEndpoint, admin, admin, warFileName); assertTrue(isWebAppDeployed, warFileName + " is not deployed" ); log.info("WebApp deployed successfully"); } catch (RemoteException | MalformedURLException e) { log.error("Error when deploying webApp - " + warFileName + ".war", e); } }
Source:
<code>public void processRecord(ComputationContext context, String inputStreamName, Record record) { context.askForCheckpoint(); Work work = WorkComputation.deserialize(record.getData()); <START> log.warn("Trying to run Work from DLQ: " + work.getCategory() + ":" + work.getId()); <END> try { work.setWorkInstanceState(Work.State.UNKNOWN); new WorkHolder(work).run(); cleanup(work, null); log.warn(work.getId() + ": Success."); countSuccess++; } catch (Exception e) { cleanup(work, e); log.warn(work.getId() + ": Failure, skipping."); } countTotal++; }</code><technical_language>WARN? INFO enough I think</technical_language>

Target:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { context.askForCheckpoint(); Work work = WorkComputation.deserialize(record.getData()); log.info("Trying to run Work from DLQ: " + work.getCategory() + ":" + work.getId()); try { work.setWorkInstanceState(Work.State.UNKNOWN); new WorkHolder(work).run(); cleanup(work, null); log.info(work.getId() + ": Success."); countSuccess++; } catch (Exception e) { cleanup(work, e); log.error(work.getId() + ": Failure, skipping.", e); } countTotal++; }
Source:
<code>public void addPages() { if (getModel().originatedFromDockerExplorer()) { <START> addPage(new ConnectionWizardPage(this, new IConnectionAware<IConnection>() { <END> @Override public IConnection getConnection() { return getModel().getConnection(); } @Override public boolean hasConnection() { return getModel().hasConnection(); } @Override public void setConnection(IConnection connection) { getModel().setConnection((Connection) connection); } @Override public Object getContext() { return getModel().getContext(); } })); } addPage(new DeployImagePage(this, getModel())); addPage(new DeploymentConfigPage(this, getModel())); addPage(new ServicesAndRoutingPage(this, getModel())); addPage(new ResourceLabelsPage(this, getModel())); }</code><technical_language>In this snippet cast a compilation error: void test1() { class A {}; class B extends A {}; class C<T extends A> {}; C<A> c = new C<A>(); C<B> cb = new C<B>(); c = (C<A>)cb; } This is correct: void test2() { class A {}; class B extends A {}; class C<T extends A> {}; C<? extends A> c = new C<A>(); C<B> cb = new C<B>(); c = cb; } is annoying, for example, if I want store operate a List&lt;MyImpl> return List&lt;MyInterface> (MyImpl implements MyInterface), I return list is, cast. Still, is a sense in it. ConnectionWizardPage mind accepting implementation of IConnection, unambiguously stated <? extends IConnection> (or a type parameter)</technical_language>

Target:
public void addPages() { if (getModel().originatedFromDockerExplorer()) { addPage(new ConnectionWizardPage(this, getModel())); } addPage(new DeployImagePage(this, getModel())); addPage(new DeploymentConfigPage(this, getModel())); addPage(new ServicesAndRoutingPage(this, getModel())); addPage(new ResourceLabelsPage(this, getModel())); }
Source:
<code><START> public Set<DocumentFlag> flags() { <END> return documentFlags; }</code><technical_language>EnumSet instead of Set (ReplicationFilter interface EnumSet)? do some research Set EnumSet</technical_language>

Target:
public EnumSet<DocumentFlag> flags() { return documentFlags; }
Source:
<code>public StatsSnapshot(StatsSnapshot original) { this.value = original.value; if (original.subMap != null) { this.subMap = new HashMap<>(original.subMap.size()); <START> original.subMap.forEach((k, v) -> { <END> this.subMap.put(k, new StatsSnapshot(v)); }); } }</code><technical_language>minor: simplified original.subMap.forEach((k, v) -> this.subMap.put(k, new StatsSnapshot(v)));</technical_language>

Target:
public StatsSnapshot(StatsSnapshot original) { this.value = original.value; if (original.subMap != null) { this.subMap = new HashMap<>(original.subMap.size()); original.subMap.forEach((k, v) -> this.subMap.put(k, new StatsSnapshot(v))); } }
Source:
<code>private void isKeyFound(int bruteForceKey) { if (bruteForceKey == HistogramController.this.getView().getSecretKey()) { HistogramController.this.bruteForceKeyFound = true; HistogramController.this.getView().getKeyControl() .setBorder(BorderFactory.createLineBorder(Color.green, 5)); HistogramController.this .getView() .getAnnouncement() .setText( HistogramController.this.wrapHtml( HistogramController.this.getModel() .genRandomGrats() + HistogramController.i18n <START> .tr(" You found the secret key and are now able to read the secret message. The Key is") <END> + " " + bruteForceKey + ". " + HistogramController.i18n .tr("Now only the histogram technique left."), 500)); HistogramController.this .getView() .getExplanations() .setText( HistogramController.i18n.tr("The Key was") + " " + bruteForceKey + ". " + HistogramController.i18n .tr("Congratulations! Yeay! Now lets try to break it with histograms. ")); } else { HistogramController.this .getView() .getAnnouncement() .setText( HistogramController.this.getModel() .genRandomBlamings()); HistogramController.this.getView().getKeyControl() .setBorder(BorderFactory.createLineBorder(Color.blue, 2)); } }</code><technical_language>Remove leading space</technical_language>

Target:
private void isKeyFound(int bruteForceKey) { if (bruteForceKey == HistogramController.this.getView().getSecretKey()) { HistogramController.this.bruteForceKeyFound = true; HistogramController.this.getView().getKeyControl() .setBorder(BorderFactory.createLineBorder(Color.green, 5)); HistogramController.this .getView() .getAnnouncement() .setText( HistogramController.this.wrapHtml( HistogramController.this.getModel() .genRandomGrats() + " " + HistogramController.i18n .tr("You found the secret key and are now able to read the secret message. The Key is") + " " + bruteForceKey + ". " + HistogramController.i18n .tr("Now only the histogram technique left."), 500)); HistogramController.this .getView() .getExplanations() .setText( HistogramController.i18n.tr("The Key was") + " " + bruteForceKey + ". " + HistogramController.i18n .tr("Congratulations! Yeay! Now lets try to break it with histograms.")); } else { HistogramController.this .getView() .getAnnouncement() .setText( HistogramController.this.getModel() .genRandomBlamings()); HistogramController.this.getView().getKeyControl() .setBorder(BorderFactory.createLineBorder(Color.blue, 2)); } }
Source:
<code>public static ArrayList<String> readListFromFile(File file, boolean keepExtension) throws IOException { ArrayList<String> list = new ArrayList<String>(120); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); String line = null; while ((line = in.readLine()) != null) { <START> if (keepExtension) { <END> line = Lib.removeExtension(line); } if (Strings.isValid(line)) { list.add(line); } } } finally { Lib.close(in); } return list; }</code><technical_language>this backwards. If (!keepExtensions)</technical_language>

Target:
public static ArrayList<String> readListFromFile(File file, boolean keepExtension) throws IOException { ArrayList<String> list = new ArrayList<String>(120); BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); String line = null; while ((line = in.readLine()) != null) { if (!keepExtension) { line = Lib.removeExtension(line); } if (Strings.isValid(line)) { list.add(line); } } } finally { Lib.close(in); } return list; }
Source:
<code>public TablesSharedKeyCredential(String accountName, String accountKey) { <START> Objects.requireNonNull(accountName, "'accountName' cannot be null."); <END> Objects.requireNonNull(accountKey, "'accountKey' cannot be null."); this.accountName = accountName; this.accountKey = accountKey; }</code><technical_language>This simplified to. line below. java this.accountName = Objects.requireNonNull(accountName, "'accountName' null.");</technical_language>

Target:
public TablesSharedKeyCredential(String accountName, String accountKey) { this.accountName = Objects.requireNonNull(accountName, "'accountName' cannot be null."); this.accountKey = Objects.requireNonNull(accountKey, "'accountKey' cannot be null."); }
Source:
<code>public final void run() { Cluster result = updateTopology(); new ClusterValidator(result).validate(); if (logger.isDebugEnabled()) { try { logger.debug("Updated topology:{}{}.", lineSeparator(), objectMapperFactory.create().writerWithDefaultPrettyPrinter().writeValueAsString(result)); } catch (JsonProcessingException e) { throw new UncheckedIOException(e); } } if (destinationClusterActivated) { TopologyNomadChange nomadChange = buildNomadChange(result); licenseValidation(destination, nomadChange.getCluster()); onNomadChangeReady(nomadChange); logger.info("Sending the topology change"); try { <START> Cluster clusterForTopologyChange = nomadChange instanceof StripeRemovalNomadChange ? result : destinationCluster; <END> runTopologyChange(clusterForTopologyChange, destinationOnlineNodes, nomadChange); } catch (RuntimeException e) { onNomadChangeFailure(nomadChange, e); } onNomadChangeSuccess(nomadChange); } else { logger.info("Sending the topology change"); Collection<InetSocketAddress> allOnlineSourceNodes = getAllOnlineSourceNodes(); if (!allOnlineSourceNodes.isEmpty()) { setUpcomingCluster(allOnlineSourceNodes, result); } setUpcomingCluster(destinationOnlineNodes.keySet(), result); } logger.info("Command successful!" + lineSeparator()); }</code><technical_language>operationType instead</technical_language>

Target:
public final void run() { Cluster result = updateTopology(); new ClusterValidator(result).validate(); if (logger.isDebugEnabled()) { try { logger.debug("Updated topology:{}{}.", lineSeparator(), objectMapperFactory.create().writerWithDefaultPrettyPrinter().writeValueAsString(result)); } catch (JsonProcessingException e) { throw new UncheckedIOException(e); } } if (destinationClusterActivated) { TopologyNomadChange nomadChange = buildNomadChange(result); licenseValidation(destination, nomadChange.getCluster()); onNomadChangeReady(nomadChange); logger.info("Sending the topology change"); try { runTopologyChange(destinationCluster, destinationOnlineNodes, nomadChange); } catch (RuntimeException e) { onNomadChangeFailure(nomadChange, e); } onNomadChangeSuccess(nomadChange); } else { logger.info("Sending the topology change"); Collection<InetSocketAddress> allOnlineSourceNodes = getAllOnlineSourceNodes(); if (!allOnlineSourceNodes.isEmpty()) { setUpcomingCluster(allOnlineSourceNodes, result); } setUpcomingCluster(destinationOnlineNodes.keySet(), result); } logger.info("Command successful!" + lineSeparator()); }
Source:
<code>private void testGeneralQuestionOperations() throws Exception { testCancelNewOrEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testResponseRateBeforeEditingQuestion(); testEditQuestionLink(); testEditQuestionAction(); <START> testResponseRateAfterEditingQuestion(); <END> testGetQuestionLink(); testCopyQuestion(); testChangeFeedbackRecipient(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testDeleteQuestionAction(1); testEditNonExistentQuestion(); }</code><technical_language>test this way. Instead, include tests for response rate in <code>testEditQuestionAction</code>, new function? coupling 3 functions hard remember in future</technical_language>

Target:
private void testGeneralQuestionOperations() throws Exception { testCancelNewOrEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testEditQuestionLink(); testEditQuestionAction(); testGetQuestionLink(); testCopyQuestion(); testChangeFeedbackRecipient(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testDeleteQuestionAction(1); testEditNonExistentQuestion(); testResponseRate(); }
Source:
<code>public void givenIdenticalSimpleObjects_whenCompared_thenEqual() { JsonParser parser = new JsonParser(); String string1 = "{\"customer\": {\"id\": \"44521\",\"fullName\": \"Emily Jenkins\", \"age\": 27 }}"; String string2 = "{\"customer\": {\"id\": \"44521\", \"fullName\": \"Emily Jenkins\",\"age\": 27}}"; Assert.assertTrue(parser.parse(string1) .isJsonObject()); <START> Assert.assertEquals(parser.parse(string1), parser.parse(string2)); <END> }</code><technical_language>static import assertions org.junit.Assert need prefix Assert</technical_language>

Target:
public void givenIdenticalSimpleObjects_whenCompared_thenEqual() { JsonParser parser = new JsonParser(); String string1 = "{\"customer\": {\"id\": \"44521\",\"fullName\": \"Emily Jenkins\", \"age\": 27 }}"; String string2 = "{\"customer\": {\"id\": \"44521\", \"fullName\": \"Emily Jenkins\",\"age\": 27}}"; assertTrue(parser.parse(string1) .isJsonObject()); assertEquals(parser.parse(string1), parser.parse(string2)); }
Source:
<code>public CompletionStage<Void> prepareAllTxStores(Transaction transaction, BatchModification batchModification, Predicate<? super StoreConfiguration> predicate) throws PersistenceException { return Completable.using( this::acquireReadLock, ignore -> { checkStoreAvailability(); if (trace) { log.tracef("Preparing batch for store: %s on transaction %s", batchModification, transaction); } return Flowable.fromIterable(stores.entrySet()) .filter(entry -> !entry.getValue().characteristics.contains(Characteristic.READ_ONLY) <START> && predicate.test(entry.getValue().config)) <END> .flatMapCompletable(entry -> Completable.fromCompletionStage(entry.getKey().prepareWithModifications(transaction, batchModification))); }, this::releaseReadLock ).toCompletionStage(null); }</code><technical_language>testing shouldWrite here? ignoreCommandWithFlags for transactions? If so, commitAllTxStores rollbackAllTxStores needs updating</technical_language>

Target:
public CompletionStage<Void> prepareAllTxStores(Transaction transaction, BatchModification batchModification, Predicate<? super StoreConfiguration> predicate) throws PersistenceException { return Completable.using( this::acquireReadLock, ignore -> { checkStoreAvailability(); if (trace) { log.tracef("Preparing batch for store: %s on transaction %s", batchModification, transaction); } return Flowable.fromIterable(stores) .filter(storeStatus -> !storeStatus.characteristics.contains(Characteristic.READ_ONLY) && predicate.test(storeStatus.config)) .flatMapCompletable(storeStatus -> Completable.fromCompletionStage(storeStatus.store.prepareWithModifications(transaction, batchModification))); }, this::releaseReadLock ).toCompletionStage(null); }
Source:
<code>private IHyperlink[] createTypeLink(IJavaElement element, IJavaElement type, IRegion wordRegion, boolean isFrameworkResource) { String typeName = type.getElementName(); if (isFrameworkResource) { <START> typeName = "android:" + typeName; END> } String elementName = element.getElementName(); String url = '@' + typeName + '/' + elementName; return new IHyperlink[] { new DeferredResolutionLink(url, null, wordRegion) }; }</code><technical_language>a constant for this (or one)</technical_language>

Target:
private IHyperlink[] createTypeLink(IJavaElement element, IJavaElement type, IRegion wordRegion, boolean isFrameworkResource) { String typeName = type.getElementName(); if (isFrameworkResource) { typeName = ANDROID_PKG + ':' + typeName; } String elementName = element.getElementName(); String url = '@' + typeName + '/' + elementName; return new IHyperlink[] { new DeferredResolutionLink(url, null, wordRegion) }; }
Source:
<code><START> private String getPropertySortOrder(Sort.Order order) { <END> StringBuilder sb = new StringBuilder(); if(order.isIgnoreCase()){ sb.append("toLower(").append(order.getProperty()).append(")"); } else { sb.append(order.getProperty()); } sb.append(" ").append(order.getDirection()); return sb.toString(); }</code><technical_language>suggestion private static String getPropertySortOrder(Sort.Order order) {</technical_language>

Target:
private static String getPropertySortOrder(Sort.Order order) { StringBuilder sb = new StringBuilder(); if(order.isIgnoreCase()){ sb.append("toLower(").append(order.getProperty()).append(")"); } else { sb.append(order.getProperty()); } sb.append(" ").append(order.getDirection()); return sb.toString(); }
Source:
<code>public String toString() { return urlString; <START> } <END></code><technical_language>I propose accessors getBaseUrl() getRelativeUrl getAbsoluteUrl(). toString() call getAbsoluteUrl is complete representation of object</technical_language>

Target:
public String toString() { return relativeUrl + query; }