auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<SiriusServerPageDto> getPages(ModelingProject modelingProject, Session session) { return WorkflowHelper.on(session).getPageDescriptions().map(page -> { DAnalysis self = <START> ((DAnalysisSessionImpl) session).allAnalyses().stream().findFirst().orElse(null); <END> Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, page.getTitleExpression()); String identifier = page.getName(); String name = result.asString(); return new SiriusServerPageDto(identifier, name); }).collect(Collectors.toList()); }</code><technical_language>is cast API DAnalysisSession ;) idem for other occurrences</technical_language>

Target:
private List<SiriusServerPageDto> getPages(ModelingProject modelingProject, Session session) { return WorkflowHelper.on(session).getPageDescriptions().map(page -> { DAnalysis self = ((DAnalysisSession) session).allAnalyses().stream().findFirst().orElse(null); Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, page.getTitleExpression()); String identifier = page.getName(); String name = result.asString(); return new SiriusServerPageDto(identifier, name); }).collect(Collectors.toList()); }
Source:
<code>private String prepareQuery() { String query; if (ldapProviderType.equals(LdapProviderType.ipa)) { userName = userName.split("@")[0]; query = "(&(objectClass=posixAccount)(objectClass=krbPrincipalAux)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.rhds)) { userName = userName.split("@")[0]; query = "(&(objectClass=person)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.ibm)) { userName = userName.split("@")[0]; <START> query = "(&(objectClass=person)(uid=" + userName + "))"; <END> } else { StringBuilder queryBase = new StringBuilder("(&(sAMAccountType=805306368)("); if (userName.contains("@")) { queryBase.append("userPrincipalName=" + userName); } else { if (userName.length() > 20) { queryBase.append("userPrincipalName=") .append(userName) .append("@") .append(domainName.toUpperCase()); } else { queryBase.append("sAMAccountName=").append(userName); } } query = queryBase.append("))").toString(); } return query; }</code><technical_language>I a formatting problem. Sharad pls project formatter file config/engine-code-format.xml</technical_language>

Target:
private String prepareQuery() { String query; if (ldapProviderType.equals(LdapProviderType.ipa)) { userName = userName.split("@")[0]; query = "(&(objectClass=posixAccount)(objectClass=krbPrincipalAux)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.rhds)) { userName = userName.split("@")[0]; query = "(&(objectClass=person)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.itds)) { userName = userName.split("@")[0]; query = "(&(objectClass=person)(uid=" + userName + "))"; } else { StringBuilder queryBase = new StringBuilder("(&(sAMAccountType=805306368)("); if (userName.contains("@")) { queryBase.append("userPrincipalName=" + userName); } else { if (userName.length() > 20) { queryBase.append("userPrincipalName=") .append(userName) .append("@") .append(domainName.toUpperCase()); } else { queryBase.append("sAMAccountName=").append(userName); } } query = queryBase.append("))").toString(); } return query; }
Source:
<code>public void testCreateAndPublishHttpRedirect() throws Exception { <START> Thread.sleep(3000); END> Job job = api().scheduleCreate(redirect); assertEquals(job.getStatus(), Status.SUCCESS); assertEquals(api.getJob(job.getId()), job); Zone zone = api.getZoneApi().publish(fqdn); checkZone(zone); getAndVerifyRedirect(redirectName, 302, "Y", "<LINK_0>"); }</code><technical_language>curious...what's problem here? Timeouts if add this sleep? chance this delay parameter configurable</technical_language>

Target:
public void testCreateAndPublishHttpRedirect() throws Exception { Thread.sleep(dynectApiDelay); Job job = api().scheduleCreate(redirect); assertEquals(job.getStatus(), Status.SUCCESS); assertEquals(api.getJob(job.getId()), job); Zone zone = api.getZoneApi().publish(fqdn); checkZone(zone); getAndVerifyRedirect(redirectName, 302, "Y", "<LINK_0>"); }
Source:
<code>public void onMapReady(final MapboxMap mapboxMap) { localizationPlugin = new LocalizationPlugin(mapView, mapboxMap); findViewById(R.id.language_one_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.ARABIC); } }); <START> <END> findViewById(R.id.language_two_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.RUSSIAN); } }); findViewById(R.id.language_three_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.SIMPLIFIED_CHINESE); } }); findViewById(R.id.match_map_to_device_language).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, R.string.change_device_language_instruction, Snackbar.LENGTH_LONG).show(); try { localizationPlugin.matchMapLanguageWithDeviceDefault(); CameraPosition position = new CameraPosition.Builder() .target(new LatLng(34.032666, -80.363160)) .zoom(2.038777) .build(); mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(position), 1000); } catch (NullPointerException exception) { Snackbar.make(view, exception.toString(), Snackbar.LENGTH_LONG).show(); } } }); }</code><technical_language>get rid of double spacings click listeners</technical_language>

Target:
public void onMapReady(final MapboxMap mapboxMap) { localizationPlugin = new LocalizationPlugin(mapView, mapboxMap); findViewById(R.id.language_one_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.ARABIC); } }); findViewById(R.id.language_two_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.RUSSIAN); } }); findViewById(R.id.language_three_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.SIMPLIFIED_CHINESE); } }); findViewById(R.id.match_map_to_device_language).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, R.string.change_device_language_instruction, Snackbar.LENGTH_LONG).show(); try { localizationPlugin.matchMapLanguageWithDeviceDefault(); CameraPosition position = new CameraPosition.Builder() .target(new LatLng(34.032666, -80.363160)) .zoom(2.038777) .build(); mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(position), 1000); } catch (RuntimeException exception) { Snackbar.make(view, exception.toString(), Snackbar.LENGTH_LONG).show(); } } }); }
Source:
<code>public String convert(final ThriftType type, final boolean ignored) { final String name = ((IdentifierType) type).getName(); if (name.indexOf('.') == -1) { final String javatypeName = TemplateContextGenerator.mangleJavatypeName(name); final ThriftType thriftType = typedefRegistry.findType(defaultNamespace, javatypeName); <START> if (thriftType == null) { <END> final SwiftJavaType javaType = typeRegistry.findType(defaultNamespace, javatypeName); return (javaType == null) ? null : javaType.getSimpleName(); } else { return convertType(thriftType); } } else { final ThriftType thriftType = typedefRegistry.findType(name); if (thriftType == null) { final SwiftJavaType javaType = typeRegistry.findType(name); return (javaType == null) ? null : javaType.getClassName(); } else { return convertType(thriftType); } } }</code><technical_language>This cleaner if methods returned Optional instead of null</technical_language>

Target:
public String convert(final ThriftType type, final boolean ignored) { final String name = ((IdentifierType) type).getName(); final String names = StringUtils.split(name, '.'); Preconditions.checkState(names.length > 0 && names.length < 3, "only unqualified and thrift-namespace qualified names are allowed!"); String thriftName = names[0]; String thriftNamespace = namespace; if (names.length == 2) { thriftName = names[1]; thriftNamespace = names[0]; } final String javatypeName = thriftNamespace + "." + TemplateContextGenerator.mangleJavatypeName(thriftName); final ThriftType thriftType = typedefRegistry.findType(javatypeName); if (thriftType == null) { final SwiftJavaType javaType = typeRegistry.findType(javatypeName); return (javaType == null) ? null : javaType.getSimpleName(); } else { return convertType(thriftType); } }
Source:
<code>public void testValidateCodeFoundByCodeWithoutUrl() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("code").setValue(new CodeType("8452-5")); try { <START> myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); <END> } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: Either CodeSystem ID or CodeSystem identifier must be provided. Unable to validate.",e.getMessage()); } }</code><technical_language>Suggestion: include a JUnit fail() statement this statement, in case exception is thrown expected</technical_language>

Target:
public void testValidateCodeFoundByCodeWithoutUrl() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("code").setValue(new CodeType("8452-5")); try { myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); fail(); } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: Either CodeSystem ID or CodeSystem identifier must be provided. Unable to validate.",e.getMessage()); } }
Source:
<code><START> private synchronized void processNewPeers() { <END> if (newPeers.isEmpty()) return; List<Channel> processed = new ArrayList<>(); int addCnt = 0; for(Channel peer : newPeers) { logger.debug("Processing new peer: " + peer); if(peer.isProtocolsInitialized()) { logger.debug("Protocols initialized"); if (!activePeers.containsKey(peer.getNodeIdWrapper())) { if (!peer.isActive() && activePeers.size() >= maxActivePeers && !trustedPeers.accept(peer.getNode())) { disconnect(peer, TOO_MANY_PEERS); } else { process(peer); addCnt++; } } else { disconnect(peer, DUPLICATE_PEER); } processed.add(peer); } } if (addCnt > 0) { logger.info("New peers processed: " + processed + ", active peers added: " + addCnt + ", total active peers: " + activePeers.size()); } newPeers.removeAll(processed); }</code><technical_language>channel.disconnect() lock nervous :( I.e. calling method potentially traverse components. This is deadlock prone approach imho</technical_language>

Target:
private void processNewPeers() { List<Runnable> noLockTasks = new ArrayList<>(); synchronized (this) { if (newPeers.isEmpty()) return; List<Channel> processed = new ArrayList<>(); int addCnt = 0; for (Channel peer : newPeers) { logger.debug("Processing new peer: " + peer); if (peer.isProtocolsInitialized()) { logger.debug("Protocols initialized"); if (!activePeers.containsKey(peer.getNodeIdWrapper())) { if (!peer.isActive() && activePeers.size() >= maxActivePeers && !trustedPeers.accept(peer.getNode())) { noLockTasks.add(() -> disconnect(peer, TOO_MANY_PEERS)); } else { process(peer); } } else { noLockTasks.add(() -> disconnect(peer, DUPLICATE_PEER)); } processed.add(peer); } } if (addCnt > 0) { logger.info("New peers processed: " + processed + ", active peers added: " + addCnt + ", total active peers: " + activePeers.size()); } newPeers.removeAll(processed); } noLockTasks.forEach(Runnable::run); }
Source:
<code>private void applyTransactions(Address sender, Collection<TransactionInfo> transactions, int topologyId) { log.debugf("Applying %d transactions for cache %s transferred from node %s", transactions.size(), cacheName, sender); if (isTransactional) { for (TransactionInfo transactionInfo : transactions) { GlobalTransaction gtx = transactionInfo.getGlobalTransaction(); if (rpcManager.getAddress().equals(gtx.getAddress())) { continue; } gtx.setRemote(true); CacheTransaction tx = transactionTable.getLocalTransaction(gtx); if (tx == null) { tx = transactionTable.getRemoteTransaction(gtx); if (tx == null) { try { tx = transactionTable.getOrCreateRemoteTransaction(gtx, transactionInfo.getModifications()); ((RemoteTransaction) tx).setLookedUpEntriesTopology(topologyId - 1); <START> } catch (IllegalStateException e) { <END> if (trace) log.tracef(e, "Failed to create remote transaction %s", gtx); } } } transactionInfo.getLockedKeys().forEach(tx::addBackupLockForKey); } } }</code><technical_language>If this is supposed catch-all-and-ignore clause, so</technical_language>

Target:
private void applyTransactions(Address sender, Collection<TransactionInfo> transactions, int topologyId) { log.debugf("Applying %d transactions for cache %s transferred from node %s", transactions.size(), cacheName, sender); if (isTransactional) { for (TransactionInfo transactionInfo : transactions) { GlobalTransaction gtx = transactionInfo.getGlobalTransaction(); if (rpcManager.getAddress().equals(gtx.getAddress())) { continue; } gtx.setRemote(true); CacheTransaction tx = transactionTable.getLocalTransaction(gtx); if (tx == null) { tx = transactionTable.getRemoteTransaction(gtx); if (tx == null) { try { tx = transactionTable.getOrCreateRemoteTransaction(gtx, transactionInfo.getModifications()); ((RemoteTransaction) tx).setLookedUpEntriesTopology(topologyId - 1); } catch (Throwable t) { if (trace) log.tracef(t, "Failed to create remote transaction %s", gtx); } } } if (tx != null) { transactionInfo.getLockedKeys().forEach(tx::addBackupLockForKey); } } } }
Source:
<code>public void testVoidCenterRetrieval() { ArrayList<CenterDomain> arr = CenterHelper.listCenters(requestSpec, responseSpec); long id = arr.get(arr.size() - 1).getId(); BatchRequest br = new BatchRequest(); br.setRequestId(id); br.setRelativeUrl("centers"); br.setMethod("GET"); br.setBody("{ }"); <START> List<BatchResponse> response = BatchHelper.postWithSingleRequest(requestSpec, responseSpec, br); <END> System.out.print(response.get(0).getBody()); Assert.assertEquals("Verify Status Code 404 for getting a nonexistent center", 404, (long) response.get(0).getStatusCode()); }</code><technical_language>for unclear. Instead of Batch stuff simply create a ResponseSpec expects a 404 instead of 200</technical_language>

Target:
public void testVoidCenterRetrieval() { ArrayList<CenterDomain> arr = CenterHelper.listCenters(requestSpec, responseSpec); int id = arr.get(arr.size() - 1).getId() + 1; ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec); Assert.assertNotNull(center); }
Source:
<code>public ByteAmount plus(ByteAmount other) { Preconditions.checkArgument(Long.MAX_VALUE - asBytes() >= other.asBytes(), String.format( <START> "Subtracting %s from %s would overshoot Long.MIN_LONG", other, this)); <END> return ByteAmount.fromBytes(asBytes() + other.asBytes()); }</code><technical_language>fix error message</technical_language>

Target:
public ByteAmount plus(ByteAmount other) { Preconditions.checkArgument(Long.MAX_VALUE - asBytes() >= other.asBytes(), String.format( "Adding %s to %s would exceed Long.MAX_LONG", other, this)); return ByteAmount.fromBytes(asBytes() + other.asBytes()); }
Source:
<code>public List<String> allocateMacAddresses(int numberOfAddresses) { log.debug("Allocating mac addresses from {}.", numberOfAddresses, this); List<Long> macs = macsStorage.allocateAvailableMacs(numberOfAddresses); List<String> result = MacAddressRangeUtils.macAddressesToStrings(macs); <START> log.debug("Allocated mac addresses: from {}.", Arrays.toString(result.toArray()), this); Collections.sort(result); END> logWhenMacPoolIsEmpty(); return result; }</code><technical_language>avoid removing this line do enough test coverage for deciding is broken. Anyhoow this related this *logging* patch</technical_language>

Target:
public List<String> allocateMacAddresses(int numberOfAddresses) { log.debug("Allocating mac addresses from {}.", numberOfAddresses, this); List<Long> macs = macsStorage.allocateAvailableMacs(numberOfAddresses); List<String> result = MacAddressRangeUtils.macAddressesToStrings(macs); log.debug("Allocated mac addresses: from {}.", result, this); Collections.sort(result); logWhenMacPoolIsEmpty(); return result; }
Source:
<code>void archiveEntityViaMigration() { ProjectId id = createId(42); TestProcessManager entity = createEntity(id); repository().store(entity); repository().applyMigration(id, new MarkPmArchived<>()); Optional<TestProcessManager> found = repository().find(id); <START> Truth8.assertThat(found).isPresent(); <END> assertThat(found.get() .isArchived()).isTrue(); }</code><technical_language>Please static imports</technical_language>

Target:
void archiveEntityViaMigration() { ProjectId id = createId(42); TestProcessManager entity = createEntity(id); repository().store(entity); repository().applyMigration(id, new MarkPmArchived<>()); Optional<TestProcessManager> found = repository().find(id); assertThat(found).isPresent(); assertThat(found.get() .isArchived()).isTrue(); }
Source:
<code>public CompletableFuture<ClientResponse> run(byte[] catalogJarBytes, String deploymentString) { if (!allowPausedModeWork(isRestoring(), isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } if ((catalogJarBytes != null) && (catalogJarBytes.length == 0)) { catalogJarBytes = null; } boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema() && !isRestoring(); if (catalogJarBytes != null && useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use AdHoc DDL to change application schema. " + "Use of @UpdateApplicationCatalog is forbidden."); } logCatalogUpdateInvocation("@UpdateApplicationCatalog"); return updateApplication("@UpdateApplicationCatalog", catalogJarBytes, deploymentString, <START> new String[0], new ArrayList<>(), <END> null, false, useDDLSchema); }</code><technical_language>Collections.emptyList() argument formatting is inconsistent</technical_language>

Target:
public CompletableFuture<ClientResponse> run(byte[] catalogJarBytes, String deploymentString) { if (!allowPausedModeWork(isRestoring(), isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } if ((catalogJarBytes != null) && (catalogJarBytes.length == 0)) { catalogJarBytes = null; } boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema() && !isRestoring(); if (catalogJarBytes != null && useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use AdHoc DDL to change application schema. " + "Use of @UpdateApplicationCatalog is forbidden."); } logCatalogUpdateInvocation("@UpdateApplicationCatalog"); return updateApplication("@UpdateApplicationCatalog", catalogJarBytes, deploymentString, new String[0], Collections.emptyList(), null, false, useDDLSchema); }
Source:
<code>@Provides @Singleton @Readonly ManagedDataSource readonlyDataSource(Environment environment, KeywhizConfig config) { DataSourceFactory dataSourceFactory = config.getDataSourceFactory(); <START> ManagedDataSource dataSource = dataSourceFactory.build(environment.metrics(), "postgres-readonly"); <END> return dataSource; }</code><technical_language>return instead of making a local variable (IntelliJ warning)</technical_language>

Target:
@Provides @Singleton @Readonly ManagedDataSource readonlyDataSource(Environment environment, KeywhizConfig config) { DataSourceFactory dataSourceFactory = config.getDataSourceFactory(); return dataSourceFactory.build(environment.metrics(), "postgres-readonly"); }
Source:
<code>public static Set<String> getSwiftSourceFiles() throws IOException { <START> Set<String> filenames = new TreeSet<>(); <END> for (String pathName : pathNames) { File file = new File(pathName); if (file.isDirectory()) { Files.walk(Paths.get(pathName)) .filter(path -> path.toFile().isFile()) .filter(path -> path.toString().endsWith(".swift")) .forEach(path -> filenames.add(path.toString())); } else if (file.isFile() && pathName.endsWith(".swift") && file.canRead()) { filenames.add(pathName); } else { throw new IOException("Cannot read " + pathName); } } return filenames; }</code><technical_language>stars: for a TreeSet for automatic ordering</technical_language>

Target:
public static Set<String> getSwiftSourceFiles() throws IOException { Set<String> filenames = new TreeSet<>(); for (String pathName : pathNames) { File file = new File(pathName); if (file.isDirectory()) { Files.walk(Paths.get(pathName)) .filter(path -> path.toString().endsWith(".swift")) .filter(path -> { File tempFile = path.toFile(); return tempFile.isFile() && tempFile.canRead(); }) .forEach(path -> filenames.add(path.toString())); } else if (file.isFile() && pathName.endsWith(".swift") && file.canRead()) { filenames.add(pathName); } else { throw new IOException("Cannot read " + pathName); } } return filenames; }
Source:
<code>protected void getExternalAppProperties() { M_log.debug("getExternalAppProperties(): called"); if(appExtSecurePropertiesFile!=null) { <START> isTestUrlEnabled = Boolean.parseBoolean(appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_USE_TEST_URL,FALSE)); <END> providerURL=appExtSecurePropertiesFile.getProperty(PROPERTY_LDAP_SERVER_URL); mcommunityGroup=appExtSecurePropertiesFile.getProperty(PROPERTY_AUTH_GROUP); }else { M_log.error("Failed to load secure application properties from sectionsToolPropsSecure.properties for SectionsTool"); } }</code><technical_language>Is a jira standardize names new name</technical_language>

Target:
protected void getExternalAppProperties() { M_log.debug("getExternalAppProperties(): called"); if(appExtSecureProperties!=null) { isTestUrlEnabled = Boolean.parseBoolean(appExtSecureProperties.getProperty(SectionUtilityToolFilter.PROPERTY_USE_TEST_URL,FALSE)); providerURL=appExtSecureProperties.getProperty(PROPERTY_LDAP_SERVER_URL); mcommunityGroup=appExtSecureProperties.getProperty(PROPERTY_AUTH_GROUP); }else { M_log.error("Failed to load secure application properties from sectionsToolPropsSecure.properties for SectionsTool"); } }
Source:
<code>public void serDeTest() { <START> doSerDeTest(Collections.emptyList()); <END> doSerDeTest(Arrays.asList("a", "b", "/signedId/abcdef")); }</code><technical_language>do need a null case</technical_language>

Target:
public void serDeTest() { doSerDeTest(null); doSerDeTest(Collections.emptyList()); doSerDeTest(Arrays.asList("a", "b", "/signedId/abcdef")); }
Source:
<code>public void readFields( final DataInput input ) throws IOException { final int rasterTileSize = input.readInt(); final byte[] rasterTileBinary = new byte[rasterTileSize]; input.readFully(rasterTileBinary); rasterTile = new RasterTile(); rasterTile.fromBinary(rasterTileBinary); minX = input.readDouble(); maxX = input.readDouble(); minY = input.readDouble(); maxY = input.readDouble(); int crsStrSize = input.readInt(); if (crsStrSize > 0) { byte[] crsStrBytes = new byte[crsStrSize]; input.readFully(crsStrBytes); String crsStr = StringUtils.stringFromBinary(crsStrBytes); try { crs = CRS.decode(crsStr); } catch (FactoryException e) { <START> e.printStackTrace(); <END> } } else { crs = GeometryUtils.DEFAULT_CRS; } }</code><technical_language>this logged, remove TODO</technical_language>

Target:
public void readFields( final DataInput input ) throws IOException { final int rasterTileSize = input.readInt(); final byte[] rasterTileBinary = new byte[rasterTileSize]; input.readFully(rasterTileBinary); rasterTile = new RasterTile(); rasterTile.fromBinary(rasterTileBinary); minX = input.readDouble(); maxX = input.readDouble(); minY = input.readDouble(); maxY = input.readDouble(); int crsStrSize = input.readInt(); if (crsStrSize > 0) { byte[] crsStrBytes = new byte[crsStrSize]; input.readFully(crsStrBytes); String crsStr = StringUtils.stringFromBinary(crsStrBytes); try { crs = CRS.decode(crsStr); } catch (FactoryException e) { LOGGER.error( "Unable to decode " + crsStr + " CRS", e); throw new RuntimeException( "Unable to decode " + crsStr + " CRS", e); } } else { crs = GeometryUtils.DEFAULT_CRS; } }
Source:
<code>public RsFlash(final String msg, final Level level, final String cookie) { super( new RsWithCookie( cookie, DatatypeConverter.printBase64Binary( new StringBuilder(level.getName()) .append('/') .append(msg) .toString() <START> .getBytes(Charset.defaultCharset()) <END> ), "Path=/", String.format( "Expires=%1$ta, %1$td %1$tb %1$tY %1$tT GMT", new Date( System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1L) ) ) ) ); }</code><technical_language>@dmzaytsev defaultcharset platform dependent? is fo, end encodings depending platform. I suggest fix this utf-8</technical_language>

Target:
public RsFlash(final String msg, final Level level, final String cookie) throws IOException { super( new RsWithCookie( cookie, String.format( "%s/%s", URLEncoder.encode(msg, Charset.defaultCharset().name()), level.getName() ), "Path=/", String.format( Locale.ENGLISH, "Expires=%1$ta, %1$td %1$tb %1$tY %1$tT GMT", new Date( System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1L) ) ) ) ); }
Source:
<code>public InnerStateRuntime clone(String key) { StreamInnerStateRuntime streamInnerStateRuntime = new StreamInnerStateRuntime(stateType); for (SingleStreamRuntime singleStreamRuntime : singleStreamRuntimeList) { streamInnerStateRuntime.singleStreamRuntimeList.add((SingleStreamRuntime) <START> singleStreamRuntime.clone(null, key)); <END> } Processor processor = streamInnerStateRuntime.singleStreamRuntimeList.get(0).getProcessorChain(); streamInnerStateRuntime.firstProcessor = (StreamPreStateProcessor) processor; while (processor != null) { if (processor instanceof StreamPostStateProcessor) { streamInnerStateRuntime.lastProcessor = (StreamPostStateProcessor) processor; break; } else { processor = processor.getNextProcessor(); } } ((StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor).setThisStatePreProcessor( (StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisStatePostProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisLastProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); return streamInnerStateRuntime; }</code><technical_language>supposed a query name here</technical_language>

Target:
public InnerStateRuntime clone(String key) { StreamInnerStateRuntime streamInnerStateRuntime = new StreamInnerStateRuntime(stateType); for (SingleStreamRuntime singleStreamRuntime : singleStreamRuntimeList) { streamInnerStateRuntime.singleStreamRuntimeList.add((SingleStreamRuntime) singleStreamRuntime.clone(key)); } Processor processor = streamInnerStateRuntime.singleStreamRuntimeList.get(0).getProcessorChain(); streamInnerStateRuntime.firstProcessor = (StreamPreStateProcessor) processor; while (processor != null) { if (processor instanceof StreamPostStateProcessor) { streamInnerStateRuntime.lastProcessor = (StreamPostStateProcessor) processor; break; } else { processor = processor.getNextProcessor(); } } ((StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor).setThisStatePreProcessor( (StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisStatePostProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisLastProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); return streamInnerStateRuntime; }
Source:
<code><START> public EventQueue getEventQueue() { <END> return eventQueue; }</code><technical_language>change protected</technical_language>

Target:
protected EventQueue getEventQueue() { return eventQueue; }
Source:
<code><START> private String getHttpMessageAsString(HttpMessage msg) { <END> return msg.getResponseHeader().toString() + msg.getResponseBody().toString(); }</code><technical_language>static</technical_language>

Target:
private static String getHttpMessageAsString(HttpMessage msg) { return msg.getResponseHeader().toString() + msg.getResponseBody().toString(); }
Source:
<code>protected void getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig, List<Project> result) throws GerritException { <START> ConfigInfo configInfo = retrieveProjectConfigs(gerritConfig.getWildProject().get(), monitor); <END> List<ProjectDetailX> projectDetails = adaptProjectDetails(gerritConfig, configInfo, monitor ); for (ProjectDetailX projectDetail : projectDetails) { if (!GerritUtil.isPermissionOnlyProject(projectDetail, gerritConfig)) { result.add(projectDetail.project); } } }</code><technical_language>I check version call super.getProjectDetails if is</technical_language>

Target:
protected List<ProjectDetailX> getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig, List<Project> result) throws GerritException { if (!GerritVersion.isVersion2120OrLater(getVersion())) { return super.getProjectDetails(monitor, gerritConfig, result); } ConfigInfo configInfo = retrieveProjectConfigs(gerritConfig.getWildProject().get(), monitor); List<ProjectDetailX> projectDetails = adaptProjectDetails(gerritConfig, configInfo, monitor ); return projectDetails; }
Source:
<code>private ImmutableList<Host> parseWSResponse(final WSResponse response) { try { if (response.getStatus() / 100 != 2) { <START> throw new IOException("Non-200 response from Consul"); <END> } else { return OBJECT_MAPPER.readValue( response.getBody(), HOST_LIST_RESPONSE_TYPE_REFERENCE); } } catch (final IOException e) { throw Throwables.propagate(e); } }</code><technical_language>nice response code is</technical_language>

Target:
private ImmutableList<Host> parseWSResponse(final WSResponse response) { try { if (response.getStatus() / 100 != 2) { throw new IOException( String.format( "Non-200 response %d from Consul", response.getStatus())); } else { return OBJECT_MAPPER.readValue( response.getBody(), HOST_LIST_RESPONSE_TYPE_REFERENCE); } } catch (final IOException e) { throw Throwables.propagate(e); } }
Source:
<code>public void generateECL() throws SQLException { int sqlReqType = sqlParser.getSqlType(); eclCode = new StringBuilder(""); hpccRequestUrl = null; switch (sqlReqType) { case SQLParser.SQL_TYPE_SELECT: { generateSelectECL(); generateSelectURL(); break; } case SQLParser.SQL_TYPE_SELECTCONST: { generateConstSelectECL(); generateConstSelectURL(); break; } case SQLParser.SQL_TYPE_CALL: { hpccPublishedQuery = dbMetadata.getHpccQuery(HPCCJDBCUtils.handleQuotedString(sqlParser.getStoredProcName())); if (hpccPublishedQuery != null) { storeProcInParams = hpccPublishedQuery.getAllInFields(); procInParamValues = sqlParser.getStoredProcInParamVals(); expectedretcolumns = hpccPublishedQuery.getAllNonInFields(); expectedDSName = hpccPublishedQuery.getDefaultTableName(); int inParamValuesCount = procInParamValues == null ? 0 : procInParamValues.length; if (inParamValuesCount != storeProcInParams.size()) throw new SQLException(hpccPublishedQuery.getName() + " expects "+ storeProcInParams.size() + " input parameters, " + " received " + inParamValuesCount); generateCallURL(); } else <START> throw new SQLException("Invalid store procedure found, verify name and QuerySet: " + sqlParser.getStoredProcName()); <END> break; } default: throw new SQLException("Invalid SQL type detected!"); } }</code><technical_language>store stored</technical_language>

Target:
public void generateECL() throws SQLException { int sqlReqType = sqlParser.getSqlType(); eclCode = new StringBuilder(""); hpccRequestUrl = null; switch (sqlReqType) { case SQLParser.SQL_TYPE_SELECT: { generateSelectECL(); generateSelectURL(); break; } case SQLParser.SQL_TYPE_SELECTCONST: { generateConstSelectECL(); generateConstSelectURL(); break; } case SQLParser.SQL_TYPE_CALL: { hpccPublishedQuery = dbMetadata.getHpccQuery(HPCCJDBCUtils.handleQuotedString(sqlParser.getStoredProcName())); if (hpccPublishedQuery != null) { storeProcInParams = hpccPublishedQuery.getAllInFields(); procInParamValues = sqlParser.getStoredProcInParamVals(); expectedretcolumns = hpccPublishedQuery.getAllNonInFields(); expectedDSName = hpccPublishedQuery.getDefaultTableName(); int inParamValuesCount = procInParamValues == null ? 0 : procInParamValues.length; if (inParamValuesCount != storeProcInParams.size()) throw new SQLException(hpccPublishedQuery.getName() + " expects "+ storeProcInParams.size() + " input parameters, " + " received " + inParamValuesCount); generateCallURL(); } else throw new SQLException("Invalid Stored Procedure found, verify name and QuerySet: " + sqlParser.getStoredProcName()); break; } default: throw new SQLException("Invalid SQL type detected!"); } }
Source:
<code>public void validate(String name) { if (name == null || name.length() < minLength || name.length() > maxLength) throw exception(name, "Can't be null or empty. Length must be " + minLength + " to " + maxLength + " symbols"); if (!CharMatcher.JAVA_LETTER_OR_DIGIT.matches(name.charAt(0))) throw exception(name, "Should start with letter/number"); CharMatcher range = getAcceptableRange(); if (!range.matchesAllOf(name)) throw exception(name, <START> "Should have lowercase or uppercase ASCII letters, numbers, dashes, underscores and " + "periods"); <END> }</code><technical_language>need break string, generates unnecessary StringBuilder object</technical_language>

Target:
public void validate(String name) { if (name == null || name.length() < minLength || name.length() > maxLength) throw exception(name, "Can't be null or empty. Length must be " + minLength + " to " + maxLength + " symbols"); if (!CharMatcher.JAVA_LETTER_OR_DIGIT.matches(name.charAt(0))) throw exception(name, "Should start with letter/number"); CharMatcher range = getAcceptableRange(); if (!range.matchesAllOf(name)) throw exception(name, "Should have lowercase or uppercase ASCII letters, numbers, dashes, underscores and periods"); }
Source:
<code>protected void editorActivated(IEditorPart editor) { IEditorInput editorInput = editor.getEditorInput(); IFile file = <START> ResourceUtil.getFile(editorInput); <END> if (file != null) { setSelection(new StructuredSelection(file)); } }</code><technical_language>In SelectionUtils, getResource..</technical_language>

Target:
protected void editorActivated(IEditorPart editor) { IEditorInput editorInput = editor.getEditorInput(); IResource resource = ResourceUtil.getResource(editorInput); if (resource != null) { setSelection(new StructuredSelection(resource)); } }
Source:
<code>public String getColumnText(Object element, int columnIndex) { IRemoteConnection connection = getOriginalIfClean((IRemoteConnection) element); switch (columnIndex) { case 0: return connection.isOpen() ? Messages.ConnectionsPreferencePage_open : Messages.ConnectionsPreferencePage_closed; case 1: return connection.getName(); case 2: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getHostname(); <START> } <END> case 3: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getUsername(); } } return null; }</code><technical_language>Please add a break this line</technical_language>

Target:
public String getColumnText(Object element, int columnIndex) { IRemoteConnection connection = getOriginalIfClean((IRemoteConnection) element); switch (columnIndex) { case 0: return connection.isOpen() ? Messages.ConnectionsPreferencePage_open : Messages.ConnectionsPreferencePage_closed; case 1: return connection.getName(); case 2: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getHostname(); } break; case 3: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getUsername(); } break; } return null; }
Source:
<code>public String getHelpNote(ConfigKey key) { <START> return getHelpNoteByType(key, "numercial"); <END> }</code><technical_language>s/numercial/numerical "numeric?"</technical_language>

Target:
public String getHelpNote(ConfigKey key) { return getHelpNoteByType(key, "numeric"); }
Source:
<code>public static Map<String, Object> readCommandLineOpts() { Map<String, Object> ret = new HashMap<>(); String commandOptions = System.getProperty("storm.options"); if (commandOptions != null) { String[] configs = commandOptions.split(",(?![^\\[\\]{}]*(]|}))"); for (String config : configs) { try { <START> config = URLDecoder.decode(config, StandardCharsets.UTF_8.name()); <END> } catch (UnsupportedEncodingException e) { throw Utils.wrapInRuntime(e); } String[] options = config.split("=", 2); if (options.length == 2) { Object val = options[1]; try { val = JSONValue.parseWithException(options[1]); } catch (ParseException ignored) { } ret.put(options[0], val); } } } return ret; }</code><technical_language>add this util class need StandardCharsets.UTF_8.name() time? versions throwing original UnsupportedEncodingException RuntimeException wrapping UnsupportedEncodingException</technical_language>

Target:
public static Map<String, Object> readCommandLineOpts() { Map<String, Object> ret = new HashMap<>(); String commandOptions = System.getProperty("storm.options"); if (commandOptions != null) { String[] configs = commandOptions.split(",(?![^\\[\\]{}]*(]|}))"); for (String config : configs) { config = urlDecodeUtf8(config); String[] options = config.split("=", 2); if (options.length == 2) { Object val = options[1]; try { val = JSONValue.parseWithException(options[1]); } catch (ParseException ignored) { } ret.put(options[0], val); } } } return ret; }
Source:
<code><START> protected void showError(String message) { mAnalyticsListener.trackFailure(message); finishFlow(); mGoogleListener.onGoogleSignupError(message); } <END></code><technical_language>I initially confused this handled onGoogleSignupError callback UnifiedLoginTracker.trackFailure() assuming preserve current flow step. If case, I need a communicate this behavior more clearly. UnifiedLoginTracker is currently a part of login library, other library clients able LoginAnalyticsListener.trackFailure() get more context this is supposed work, obvious. think</technical_language>

Target:
protected void showError(String message) { finishFlow(); mGoogleListener.onGoogleSignupError(message); }
Source:
<code>public static void applyPartitioner() { if (conf.partitioner == null) { throw new ConfigurationException("Missing directive: partitioner", false); } String partitionerName = conf.partitioner; try { partitionerName = System.getProperty(Config.PROPERTY_PREFIX + "partitioner", conf.partitioner); partitioner = FBUtilities.newPartitioner(partitionerName); } catch (Exception e) { <START> throw new ConfigurationException("Invalid partitioner class " + partitionerName, e); <END> } paritionerName = partitioner.getClass().getCanonicalName(); }</code><technical_language>change allows 1. Set correct partitionerName in exception message. Previously, message include partitioner set in conf wrong system property is present. 2. Add stack trace exception enable logging</technical_language>

Target:
public static void applyPartitioner() { applyPartitioner(conf); }
Source:
<code>public RepoObjectOutput(RepoObject repoObject) { this.key = repoObject.getKey(); this.checksum = repoObject.getChecksum(); this.timestamp = TimestampFormatter.getFormattedTimestamp(repoObject.getTimestamp()); this.downloadName = repoObject.getDownloadName(); this.contentType = repoObject.getContentType(); this.size = repoObject.getSize(); this.tag = repoObject.getTag(); this.versionNumber = repoObject.getVersionNumber(); this.status = repoObject.getStatus(); this.creationDate = TimestampFormatter.getFormattedTimestamp(repoObject.getCreationDate()); this.versionChecksum = repoObject.getVersionChecksum(); URL[] urls = repoObject.getReproxyURL(); <START> if (urls != null) { <END> reproxyURL = Arrays.asList(urls); } }</code><technical_language>a reason removed urls.length check</technical_language>

Target:
public RepoObjectOutput(RepoObject repoObject) { this.key = repoObject.getKey(); this.checksum = repoObject.getChecksum(); this.timestamp = TimestampFormatter.getFormattedTimestamp(repoObject.getTimestamp()); this.downloadName = repoObject.getDownloadName(); this.contentType = repoObject.getContentType(); this.size = repoObject.getSize(); this.tag = repoObject.getTag(); this.versionNumber = repoObject.getVersionNumber(); this.status = repoObject.getStatus(); this.creationDate = TimestampFormatter.getFormattedTimestamp(repoObject.getCreationDate()); this.versionChecksum = repoObject.getVersionChecksum(); this.userMetadata = repoObject.getUserMetadata(); URL[] urls = repoObject.getReproxyURL(); if (urls != null) { reproxyURL = Arrays.asList(urls); } }
Source:
<code>public void initialize() { config = createHomematicConfig(); registerDeviceDiscoveryService(); final HomematicBridgeHandler instance = this; scheduler.execute(() -> { try { String id = getThing().getUID().getId(); gateway = HomematicGatewayFactory.createGateway(id, config, instance, httpClient); configureThingProperties(); gateway.initialize(); discoveryService.startScan(null); discoveryService.waitForScanFinishing(); updateStatus(ThingStatus.ONLINE); if (!config.getGatewayInfo().isHomegear()) { try { gateway.loadRssiValues(); } catch (IOException ex) { logger.warn("Unable to load RSSI values from bridge '{}'", getThing().getUID().getId()); logger.error("{}", ex.getMessage(), ex); } } gateway.startWatchdogs(); } catch (IOException ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, ex.getMessage()); <START> logger.error("Homematic bridge was set to OFFLINE-COMMUNICATION_ERROR due to the following exception: {}", <END> ex.getMessage(), ex); dispose(); scheduleReinitialize(); } }); }</code><technical_language>this DEBUG</technical_language>

Target:
public void initialize() { config = createHomematicConfig(); registerDeviceDiscoveryService(); final HomematicBridgeHandler instance = this; scheduler.execute(() -> { try { String id = getThing().getUID().getId(); gateway = HomematicGatewayFactory.createGateway(id, config, instance, httpClient); configureThingProperties(); gateway.initialize(); discoveryService.startScan(null); discoveryService.waitForScanFinishing(); updateStatus(ThingStatus.ONLINE); if (!config.getGatewayInfo().isHomegear()) { try { gateway.loadRssiValues(); } catch (IOException ex) { logger.warn("Unable to load RSSI values from bridge '{}'", getThing().getUID().getId()); logger.error("{}", ex.getMessage(), ex); } } gateway.startWatchdogs(); } catch (IOException ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, ex.getMessage()); logger.debug( "Homematic bridge was set to OFFLINE-COMMUNICATION_ERROR due to the following exception: {}", ex.getMessage(), ex); dispose(); scheduleReinitialize(); } }); }
Source:
<code>private boolean runVmAsStateless(VM vmToRunAsStateless) { log.infoFormat("Running Vm {0} as stateless", vmToRunAsStateless); RunVmParams runVmParams = new RunVmParams(vmToRunAsStateless.getId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToRunAsStateless.getId())); runVmParams.setRunAsStateless(true); VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RunVm, runVmParams, ExecutionHandler.createInternalJobContext()); boolean prestartingVmSucceeded = vdcReturnValue.getSucceeded(); if (!prestartingVmSucceeded) { AuditLogableBase log = new AuditLogableBase(); <START> log.setVmId(vmToRunAsStateless.getId()); <END> log.addCustomValue("VmPoolName", vmToRunAsStateless.getVmPoolName()); AuditLogDirector.log(log, AuditLogType.VM_FAILED_TO_PRESTART_IN_POOL); } log.infoFormat("Running Vm {0} as stateless {1}", vmToRunAsStateless, prestartingVmSucceeded ? "succeeded" : "failed"); return prestartingVmSucceeded; }</code><technical_language>i vmId removed also, message vm</technical_language>

Target:
private boolean runVmAsStateless(VM vmToRunAsStateless) { log.infoFormat("Running Vm {0} as stateless", vmToRunAsStateless); RunVmParams runVmParams = new RunVmParams(vmToRunAsStateless.getId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToRunAsStateless.getId())); runVmParams.setRunAsStateless(true); VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RunVm, runVmParams, ExecutionHandler.createInternalJobContext()); boolean prestartingVmSucceeded = vdcReturnValue.getSucceeded(); if (!prestartingVmSucceeded) { AuditLogableBase log = new AuditLogableBase(); log.addCustomValue("VmPoolName", vmToRunAsStateless.getVmPoolName()); AuditLogDirector.log(log, AuditLogType.VM_FAILED_TO_PRESTART_IN_POOL); } log.infoFormat("Running Vm {0} as stateless {1}", vmToRunAsStateless, prestartingVmSucceeded ? "succeeded" : "failed"); return prestartingVmSucceeded; }
Source:
<code>public BatchRefUpdate newBatchUpdate() { return new BatchRefUpdate(this) { @Override public void execute(RevWalk walk, ProgressMonitor monitor) throws IOException { if (performsAtomicTransactions() && isAtomic()) { try { lock.writeLock().lock(); <START> List<ReceiveCommand> cmds = getCommands(); batch(cmds); for (ReceiveCommand cmd : cmds) { if (cmd.getResult() == ReceiveCommand.Result.OK) { objdb.markDirty(); break; } } <END> } finally { lock.writeLock().unlock(); } } else { super.execute(walk, monitor); } } }; }</code><technical_language>compareAndPut I need mark dirty if successfully wrote a ref. object in order do command</technical_language>

Target:
public BatchRefUpdate newBatchUpdate() { return new BatchRefUpdate(this) { @Override public void execute(RevWalk walk, ProgressMonitor monitor) throws IOException { if (performsAtomicTransactions() && isAtomic()) { try { lock.writeLock().lock(); batch(getCommands()); } finally { lock.writeLock().unlock(); } } else { super.execute(walk, monitor); } } }; }