auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Boolean isVUS(Alteration alteration) { List<Evidence> evidenceList = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); for (Evidence evidence : evidenceList) { <START> if (evidence.getEvidenceType().equals(EvidenceType.VUS)) { <END> return true; } } return false; }</code><technical_language>need check evidence type more</technical_language>

Target:
public static Boolean isVUS(Alteration alteration) { List<Evidence> evidenceList = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); return !(evidenceList == null || evidenceList.isEmpty()); }
Source:
<code>private static String getHost(Configuration configuration, String key, String defaultVal, String type) { String hostName = configuration.get(key, defaultVal); Preconditions.checkArgument( !Strings.isNullOrEmpty(hostName), <START> String.format("%s endpoint host must be supplied via %s", type, key)); <END> LOG.debug("%s endpoint host %s. Using override IP address.", type, hostName); return hostName; }</code><technical_language>Is this possible? if is set default, right? touch defaults here, set in optionsBuilder if is set in configuration, if is set do optionsBuilder pick default</technical_language>

Target:
private static String getHost(Configuration configuration, String key, String defaultVal, String type) { String hostName = configuration.get(key, defaultVal); LOG.debug("%s endpoint host %s.", type, hostName); return hostName; }
Source:
<code>private String getIsoPrefix() { Guid storagePoolId = getParameters().getStoragePoolId(); <START> synchronized(getLockObjForStoragePool(storagePoolId)) { <END> if (!storagePoolId2IsoPrefix.containsKey(storagePoolId)) { try { StoragePoolInfoReturnForXmlRpc returnValue = getBroker().getStoragePoolInfo(storagePoolId.toString()); storagePoolId2IsoPrefix.put(storagePoolId, returnValue.mStoragePoolInfo.containsKey(IrsProperties.isoPrefix) ? returnValue.mStoragePoolInfo.get(IrsProperties.isoPrefix).toString() : StringUtils.EMPTY); } catch (Exception ex) { log.errorFormat("IsoPrefix Failed to get storage pool info (vds {0}).", getParameters().getVdsId()); return StringUtils.EMPTY; } } return storagePoolId2IsoPrefix.get(storagePoolId); } }</code><technical_language>lets avoid context switch locking. 1. totally remove synchronized - VDSM if answer, account a mass run vm result some redundant getIsoPrefix queries 2. synchronised long cache is missed. 3. 1 add eager initialization pool active iso in another patch I vote for 3</technical_language>

Target:
private String getIsoPrefix() { Guid storagePoolId = getParameters().getStoragePoolId(); if (!storagePoolIdToIsoPrefix.containsKey(storagePoolId)) { synchronized(getLockObjForStoragePool(storagePoolId)) { if (!storagePoolIdToIsoPrefix.containsKey(storagePoolId)) { try { StoragePoolInfoReturnForXmlRpc returnValue = getBroker().getStoragePoolInfo(storagePoolId.toString()); storagePoolIdToIsoPrefix.put(storagePoolId, returnValue.mStoragePoolInfo.containsKey(IrsProperties.isoPrefix) ? returnValue.mStoragePoolInfo.get(IrsProperties.isoPrefix).toString() : StringUtils.EMPTY); } catch (Exception ex) { log.errorFormat("IsoPrefix Failed to get storage pool info (vds {0}).", getParameters().getVdsId()); return StringUtils.EMPTY; } } } } return storagePoolIdToIsoPrefix.get(storagePoolId); }
Source:
<code>protected CommunityRest createAndReturn(Context context) throws AuthorizeException { HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); CommunityRest communityRest; try { ServletInputStream input = req.getInputStream(); communityRest = mapper.readValue(input, CommunityRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body: " + e1.toString()); } Community community; try { Community parent = null; if (StringUtils.isNotBlank(req.getParameter("parentCommunity"))) { <START> UUID owningCommunityUuid = UUIDUtils.fromString(req.getParameter("parentCommunity")); <END> if (owningCommunityUuid == null) { throw new BadRequestException("The given owningCommunityUuid was invalid: " + req.getParameter("parentCommunity")); } parent = cs.find(context, owningCommunityUuid); if (parent == null) { throw new ResourceNotFoundException("Parent community for id: " + owningCommunityUuid + " not found"); } } community = cs.create(parent, context); cs.update(context, community); if (communityRest.getMetadata() != null) { for (MetadataEntryRest mer : communityRest.getMetadata()) { String[] metadatakey = mer.getKey().split("\\."); cs.addMetadata(context, community, metadatakey[0], metadatakey[1], metadatakey.length == 3 ? metadatakey[2] : null, mer.getLanguage(), mer.getValue()); } } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } return converter.convert(community); }</code><technical_language>rename variables & error logs here. "owningCommunity" "parentCommunity"</technical_language>

Target:
protected CommunityRest createAndReturn(Context context) throws AuthorizeException { HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); CommunityRest communityRest; try { ServletInputStream input = req.getInputStream(); communityRest = mapper.readValue(input, CommunityRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body: " + e1.toString()); } Community community; try { Community parent = null; String parentCommunityString = req.getParameter("parent"); if (StringUtils.isNotBlank(parentCommunityString)) { UUID parentCommunityUuid = UUIDUtils.fromString(parentCommunityString); if (parentCommunityUuid == null) { throw new BadRequestException("The given parent parameter was invalid: " + parentCommunityString); } parent = cs.find(context, parentCommunityUuid); if (parent == null) { throw new UnprocessableEntityException("Parent community for id: " + parentCommunityUuid + " not found"); } } community = cs.create(parent, context); cs.update(context, community); if (communityRest.getMetadata() != null) { for (MetadataEntryRest mer : communityRest.getMetadata()) { String[] metadatakey = mer.getKey().split("\\."); cs.addMetadata(context, community, metadatakey[0], metadatakey[1], metadatakey.length == 3 ? metadatakey[2] : null, mer.getLanguage(), mer.getValue()); } } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } return converter.convert(community); }
Source:
<code>public boolean removeParent(Set<Context> contexts, Subject parent) { contexts = ImmutableSet.copyOf(contexts); while (true) { <START> Map.Entry<String, String> removeEnt = new AbstractMap.SimpleEntry<String, String>(parent.getContainingCollection().getIdentifier(), parent.getIdentifier()); <END> List<Map.Entry<String, String>> oldParents = parents.get(contexts); List<Map.Entry<String, String>> newParents; if (oldParents == null || !oldParents.contains(removeEnt)) { return false; } newParents = new ArrayList<Map.Entry<String, String>>(oldParents); newParents.remove(removeEnt); if (updateCollection(parents, contexts, oldParents, Collections.unmodifiableList(newParents))) { return true; } } }</code><technical_language>above, line long</technical_language>

Target:
public boolean removeParent(Set<Context> contexts, Subject parent) { contexts = ImmutableSet.copyOf(contexts); while (true) { Map.Entry<String, String> removeEnt = Maps.immutableEntry(parent.getContainingCollection().getIdentifier(), parent.getIdentifier()); List<Map.Entry<String, String>> oldParents = parents.get(contexts); List<Map.Entry<String, String>> newParents; if (oldParents == null || !oldParents.contains(removeEnt)) { return false; } newParents = new ArrayList<Map.Entry<String, String>>(oldParents); newParents.remove(removeEnt); if (updateCollection(parents, contexts, oldParents, Collections.unmodifiableList(newParents))) { return true; } } }
Source:
<code>public void onClose(Client client) { <START> synchronized(clients) { <END> clients.remove(client); } }</code><technical_language>this synchronization unnecessary</technical_language>

Target:
public void onClose(Client client) { clients.remove(client); }
Source:
<code>public static int searchAndReplace(File fDirToLook, File fFileName) throws Throwable { if (fDirToLook == null) { return 0; } if (fDirToLook.isDirectory()) { int iCopies = 0; File[] faFilesInDir = fDirToLook.listFiles(); if (faFilesInDir != null && faFilesInDir.length > 0) { for (File fFile : faFilesInDir) { iCopies += searchAndReplace(fFile, fFileName); } } return iCopies; } else if (fDirToLook.isFile()) { if (fDirToLook.getCanonicalPath().equalsIgnoreCase(fFileName.getCanonicalPath())) { return 0; } else if (fDirToLook.getName().equalsIgnoreCase(fFileName.getName())) { try { boolean bCopied = copy(fFileName, fDirToLook); if (bCopied) { <START> LOG.debug("Replaced file: " + fDirToLook.getCanonicalPath()); <END> return 1; } else { return 0; } } catch (Exception e) { LOG.error("Failed to replace file {}: {}", fDirToLook.getCanonicalPath(), e.getLocalizedMessage(), e); } } } return 0; }</code><technical_language>update logging format</technical_language>

Target:
public static int searchAndReplace(File fDirToLook, File fFileName) throws Throwable { if (fDirToLook == null) { return 0; } if (fDirToLook.isDirectory()) { int iCopies = 0; File[] faFilesInDir = fDirToLook.listFiles(); if (faFilesInDir != null && faFilesInDir.length > 0) { for (File fFile : faFilesInDir) { iCopies += searchAndReplace(fFile, fFileName); } } return iCopies; } else if (fDirToLook.isFile()) { if (fDirToLook.getCanonicalPath().equalsIgnoreCase(fFileName.getCanonicalPath())) { return 0; } else if (fDirToLook.getName().equalsIgnoreCase(fFileName.getName())) { try { boolean bCopied = copy(fFileName, fDirToLook); if (bCopied) { LOG.debug("Replaced file: {}" , fDirToLook.getCanonicalPath()); return 1; } else { return 0; } } catch (Exception e) { LOG.error("Failed to replace file {}: {}", fDirToLook.getCanonicalPath(), e.getLocalizedMessage(), e); } } } return 0; }
Source:
<code>public List<EventTypeSchema> getSchemas(final String name, final int offset, final int limit) { return jdbcTemplate.query( "SELECT ets_schema_object FROM zn_data.event_type_schema " + <START> "WHERE ets_event_type_name = ? ORDER BY ets_schema_object->>'version' DESC LIMIT ? OFFSET ? ", <END> new Object[]{name, limit, offset}, new SchemaRowMapper()); }</code><technical_language>ordering correct? I order wrongly for schemas: "1.0.2" "2.10.3" "10.0.0"</technical_language>

Target:
public List<EventTypeSchema> getSchemas(final String name, final int offset, final int limit) { return jdbcTemplate.query( "SELECT ets_schema_object FROM zn_data.event_type_schema " + "WHERE ets_event_type_name = ? ORDER BY ets_schema_object->>'created_at' DESC LIMIT ? OFFSET ? ", new Object[]{name, limit, offset}, new SchemaRowMapper()); }
Source:
<code>protected Warning createWarning(final Matcher matcher) { Priority priority; if ("Remark".equals(matcher.group(3))) { priority = Priority.LOW; } else if ("Warning".equals(matcher.group(3))) { priority = Priority.NORMAL; } else if ("Error".equals(matcher.group(3))) { priority = Priority.HIGH; } <START> else if ("Fatal Error".equals(matcher.group(3))) { <END> priority = Priority.HIGH; } else { return FALSE_POSITIVE; } String message = normalizeWhitespaceInMessage(matcher.group(5)); return createWarning(matcher.group(1), getLineNumber(matcher.group(2)), matcher.group(4), message, priority); }</code><technical_language>equalsIgnoreCase</technical_language>

Target:
protected Warning createWarning(final Matcher matcher) { Priority priority; priority = determinePriority(matcher.group(GROUP_NUMBER)); return composeWarning(matcher, priority); }
Source:
<code>private void processHandshakeRecord(final Record record, final Connection connection) { LOGGER.debug("Received record from peer [{}]", record.getType(), record.getPeerAddress()); try { if (record.isNewClientHello()) { throw new IllegalArgumentException("new CLIENT_HELLO must be processed by processClientHello!"); } HandshakeMessage handshakeMessage = (HandshakeMessage) record.getFragment(); switch (handshakeMessage.getMessageType()) { case CLIENT_HELLO: <START> if (record.getEpoch() > 0) { <END> LOGGER.debug("Reject re-negociation from peer {}", record.getPeerAddress()); DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, record.getPeerAddress()), session); } else { LOGGER.debug("Discard CLIENT_HELLO for re-negociation from peer {}", record.getPeerAddress()); } break; case HELLO_REQUEST: processHelloRequest(connection); break; default: Handshaker handshaker = connection.getOngoingHandshake(); if (handshaker != null) { handshaker.processMessage(record); } else { LOGGER.debug( "Discarding HANDSHAKE message [epoch={}] from peer [{}], no ongoing handshake!", record.getEpoch(), record.getPeerAddress()); } break; } } catch (HandshakeException e) { handleExceptionDuringHandshake(e, e.getAlert().getLevel(), e.getAlert().getDescription(), connection, record); } }</code><technical_language>OK, I it. Yes, obsolete in meantime</technical_language>

Target:
private void processHandshakeRecord(final Record record, final Connection connection) { LOGGER.debug("Received record from peer [{}]", record.getType(), record.getPeerAddress()); try { if (record.isNewClientHello()) { throw new IllegalArgumentException("new CLIENT_HELLO must be processed by processClientHello!"); } HandshakeMessage handshakeMessage = (HandshakeMessage) record.getFragment(); switch (handshakeMessage.getMessageType()) { case CLIENT_HELLO: LOGGER.debug("Reject re-negociation from peer {}", record.getPeerAddress()); DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, record.getPeerAddress()), session); break; case HELLO_REQUEST: processHelloRequest(connection); break; default: Handshaker handshaker = connection.getOngoingHandshake(); if (handshaker != null) { handshaker.processMessage(record); } else { LOGGER.debug( "Discarding HANDSHAKE message [epoch={}] from peer [{}], no ongoing handshake!", record.getEpoch(), record.getPeerAddress()); } break; } } catch (HandshakeException e) { handleExceptionDuringHandshake(e, e.getAlert().getLevel(), e.getAlert().getDescription(), connection, record); } }
Source:
<code>static Annotation parseAnnotation(JsonParser parser) throws IOException { if (!parser.isExpectedStartObjectToken()) { throw new IOException("Not a valid JSON object, start token: " + parser.currentToken()); } long timestamp = 0; String value = null; while (parser.nextValue() != JsonToken.END_OBJECT) { switch (parser.currentName()) { case "timestamp": timestamp = parser.getLongValue(); break; case "value": value = parser.getValueAsString(); break; default: } } if (timestamp == 0 || value == null) { <START> throw new IllegalStateException("Incomplete annotation at " + parser.currentToken()); <END> } return Annotation.create(timestamp, value); }</code><technical_language>I inconsistent, IllegalArgumentException parsing State is resolve, this won't</technical_language>

Target:
static Annotation parseAnnotation(JsonParser parser) throws IOException { if (!parser.isExpectedStartObjectToken()) { throw new IllegalArgumentException("Not a valid JSON object, start token: " + parser.currentToken()); } long timestamp = 0; String value = null; while (parser.nextValue() != JsonToken.END_OBJECT) { switch (parser.currentName()) { case "timestamp": timestamp = parser.getLongValue(); break; case "value": value = parser.getValueAsString(); break; default: } } if (timestamp == 0 || value == null) { throw new IllegalArgumentException("Incomplete annotation at " + parser.currentToken()); } return Annotation.create(timestamp, value); }
Source:
<code><START> public ProductDiscountDraftBuilder isActive(final Boolean isActive) { <END> this.isActive = isActive; return this; }</code><technical_language>this method create a method "active" alias this method</technical_language>

Target:
public ProductDiscountDraftBuilder isActive(final Boolean isActive) { this.active = isActive; return this; }
Source:
<code>public SetFactoryBean ldapAuthenticationHandlerSetFactoryBean() { val bean = new SetFactoryBean() { @Override protected void destroyInstance(final Set set) { set.forEach(Unchecked.consumer(handler -> { ((DisposableBean) handler).destroy(); })); } }; <START> bean.setSourceSet(new HashSet()); <END> return bean; }</code><technical_language>suggestion bean.setSourceSet(new HashSet<>());</technical_language>

Target:
public SetFactoryBean ldapAuthenticationHandlerSetFactoryBean() { val bean = new SetFactoryBean() { @Override protected void destroyInstance(final Set set) { set.forEach(Unchecked.consumer(handler -> ((DisposableBean) handler).destroy() )); } }; bean.setSourceSet(new HashSet<>()); return bean; }
Source:
<code>public void value(final int destRow) { if (TupleUtils.tupleEquals(inputTB, keyColIndices, sourceRow, uniqueTuples, destRow)) { found = true; int oldcount = tupleCounts.getInt(0, destRow); if (oldcount < threshold) { <START> tupleCounts.replace(0, destRow, new IntArrayColumn(new int[] { oldcount + 1 }, 1), 0); <END> meet = (oldcount + 1 >= threshold); } } }</code><technical_language>MutableTupleBuffer needs replaceInt() etc., analogous putInt() etc</technical_language>

Target:
public void value(final int destRow) { if (TupleUtils.tupleEquals(inputTB, keyColIndices, sourceRow, uniqueTuples, destRow)) { found = true; int newcount = tupleCounts.getInt(0, destRow) + 1; if (newcount <= threshold) { tupleCounts.replaceInt(0, destRow, newcount); } meet = (newcount >= threshold); } }
Source:
<code>URL setUpBoolShapefile() throws Exception { File d = File.createTempFile("ogrgeojson_8b0dc300", "shp", new File("target")); d.delete(); d.mkdirs(); String[] exts = new String[]{"shp", "shx", "dbf", "prj"}; for (String ext : exts) { if("prj".equals(ext)) { String wkt = CRS.decode("EPSG:4326", true).toWKT(); <START> FileUtils.writeStringToFile(new File(d, "ogrgeojson_8b0dc300.prj"), wkt); <END> } else { FileUtils.copyURLToFile(TestData.url("shapes/ogrgeojson_8b0dc300." + ext), new File(d, "ogrgeojson_8b0dc300." + ext)); } } return URLs.fileToUrl(new File(d, "ogrgeojson_8b0dc300.shp")); }</code><technical_language>a bunch of unneccessary manual work (Decoding WKT, creating projection file, etc.) here. copy test data temp folder</technical_language>

Target:
URL setUpBoolShapefile() throws Exception { File d = File.createTempFile("BooleanTest", "shp", new File("target")); d.delete(); d.mkdirs(); String[] exts = new String[]{"shp", "shx", "dbf", "prj"}; for (String ext : exts) { if("prj".equals(ext)) { String wkt = CRS.decode("EPSG:4326", true).toWKT(); FileUtils.writeStringToFile(new File(d, "BooleanTest.prj"), wkt); } else { FileUtils.copyURLToFile(TestData.url("shapes/BooleanTest." + ext), new File(d, "BooleanTest." + ext)); } } return URLs.fileToUrl(new File(d, "BooleanTest.shp")); }
Source:
<code>private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<HashMap<Guid, GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { HashMap<Guid, GeoRepSessionStatus> subVolumeStatusMap = new HashMap<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); <START> subVolumeStatusMap.put(brickId, getStatusForBrickFromSession(session, brickId)); <END> j++; } list.add(subVolumeStatusMap); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (HashMap<Guid, GeoRepSessionStatus> subVolumeStatusMap : list) { if (subVolumeStatusMap.containsValue(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusMap.containsValue(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } HashSet<GeoRepSessionStatus> statusValues = new HashSet<GeoRepSessionStatus>(subVolumeStatusMap.values()); if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (statusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) statusValues.toArray()[0]); } else { log.info("Multiple status values found in volume: {}", session.getMasterVolumeName()); } } } }</code><technical_language>I this brickId below. "HashSet<GeoRepSessionStatus> statusValues" formed itself</technical_language>

Target:
private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<HashSet<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { HashSet<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (HashSet<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }
Source:
<code>private void updateEnqueuedWrites(long writes, long timestamp) { enqueuedWrites.accumulateValue(writes); <START> lastWrittenTs = timestamp; <END> }</code><technical_language>If wrong is a race condition here, multiple concurrently committing threads hit this time. If so, underestimate written timestamp, technically for this 0 in a non-0 case (worst case a bunch of concurrent writes dump loads of data in timestamps T1 ... Tn, T1 wins write here, immutable/unreadable timestamp stuck T1 T2 for some reason). A simple fix AtomicLong (you want accumulate max). This is non-blocking though</technical_language>

Target:
private void updateEnqueuedWrites(long writes, long timestamp) { enqueuedWrites.accumulateValue(writes); lastWrittenTs.accumulateAndGet(timestamp, Long::max); }
Source:
<code>public void start(@Nullable BundleContext context) throws Exception { super.start(context); plugin = this; try { <START> Class.forName("org.eclipse.tracecompass.tracing.rcp.ui.cli.CliParserExtension"); <END> } catch (ClassNotFoundException e) { return; } }</code><technical_language>class exist</technical_language>

Target:
public void start(@Nullable BundleContext context) throws Exception { super.start(context); plugin = this; }
Source:
<code>public SelectorFilter( String dimension, String value, ExtractionFn extractionFn ) { this.dimension = dimension; <START> this.value = Strings.nullToEmpty(value);; <END> this.extractionFn = extractionFn; }</code><technical_language>double ;;</technical_language>

Target:
public SelectorFilter( String dimension, String value, ExtractionFn extractionFn ) { this.dimension = dimension; this.value = Strings.nullToEmpty(value); this.extractionFn = extractionFn; }
Source:
<code>public static String get_software_version(){ <START> String release_name = "-rc.5"; <END> return BuildConfig.VERSION_NAME + release_name + "+" +BuildConfig.VERSION_CODE; }</code><technical_language>put this in a place defines</technical_language>

Target:
public static String get_software_version(){ return BuildConfig.VERSION_NAME + "+" + BuildConfig.VERSION_CODE; }
Source:
<code>public void registerDefaults() { <START> types.put("NORMAL", new SpongeZombieType("NORMAL")); <END> types.put("VILLAGER", new SpongeZombieType("VILLAGER")); types.put("HUSK", new SpongeZombieType("HUSK")); }</code><technical_language>this</technical_language>

Target:
public void registerDefaults() { this.types.put("normal", new SpongeZombieType("minecraft:normal")); this.types.put("villager", new SpongeZombieType("minecraft:villager")); this.types.put("husk", new SpongeZombieType("minecraft:husk")); }
Source:
<code>private static MemoryHistory getHistory() { String prestoCliHistoryFilePath = System.getenv("PRESTO_CLI_HISTORY_FILE"); File historyFile; <START> if (Strings.isNullOrEmpty(prestoCliHistoryFilePath)) { <END> historyFile = new File(getUserHome(), ".presto_history"); } else { historyFile = new File(prestoCliHistoryFilePath); } return getHistory(historyFile); }</code><technical_language>Static import</technical_language>

Target:
private static MemoryHistory getHistory() { return getHistory(new File(getUserHome(), ".presto_history")); }
Source:
<code>public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { MongoCursor<Document> cursor = null; try { MongoCollection<Document> collection = database.getCollection(table); Document scanRange = new Document("$gte", startkey); Document query = new Document("_id", scanRange); Document sort = new Document("_id", INCLUDE); FindIterable<Document> findIterable = collection.find(query).sort(sort).limit(recordcount); if (fields != null) { Document projection = new Document(); for (String fieldName : fields) { projection.put(fieldName, INCLUDE); } findIterable.projection(projection); } cursor = findIterable.iterator(); if (!cursor.hasNext()) { System.err.println("Nothing found in scan for key " + startkey); <START> return StatusCode.ERROR; <END> } result.ensureCapacity(recordcount); while (cursor.hasNext()) { HashMap<String, ByteIterator> resultMap = new HashMap<String, ByteIterator>(); Document obj = cursor.next(); fillMap(resultMap, obj); result.add(resultMap); } return StatusCode.OK; } catch (Exception e) { System.err.println(e.toString()); return StatusCode.ERROR; } finally { if (cursor != null) { cursor.close(); } } }</code><technical_language>ERROR->NOT_FOUND</technical_language>

Target:
public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { MongoCursor<Document> cursor = null; try { MongoCollection<Document> collection = database.getCollection(table); Document scanRange = new Document("$gte", startkey); Document query = new Document("_id", scanRange); Document sort = new Document("_id", INCLUDE); FindIterable<Document> findIterable = collection.find(query).sort(sort).limit(recordcount); if (fields != null) { Document projection = new Document(); for (String fieldName : fields) { projection.put(fieldName, INCLUDE); } findIterable.projection(projection); } cursor = findIterable.iterator(); if (!cursor.hasNext()) { System.err.println("Nothing found in scan for key " + startkey); return Status.ERROR; } result.ensureCapacity(recordcount); while (cursor.hasNext()) { HashMap<String, ByteIterator> resultMap = new HashMap<String, ByteIterator>(); Document obj = cursor.next(); fillMap(resultMap, obj); result.add(resultMap); } return Status.OK; } catch (Exception e) { System.err.println(e.toString()); return Status.ERROR; } finally { if (cursor != null) { cursor.close(); } } }
Source:
<code>public Ordering<Row> getRowOrdering(final boolean granular) { final boolean pushDownSort = getContextBoolean(GroupByQueryConfig.CTX_KEY_PUSH_DOWN_LIMIT, false); if (pushDownSort && !DefaultLimitSpec.sortingOrderHasNonGroupingFields(limitSpec, dimensions)) { return getRowOrderingForPushDown(granular, (DefaultLimitSpec) limitSpec, aggregatorSpecs); <START> } <END> final boolean sortByDimsFirst = getContextSortByDimsFirst(); final Comparator<Row> timeComparator = getTimeComparator(granular); if (timeComparator == null) { return Ordering.from( new Comparator<Row>() { @Override public int compare(Row lhs, Row rhs) { return compareDims(dimensions, lhs, rhs); } } ); } else if (sortByDimsFirst) { return Ordering.from( new Comparator<Row>() { @Override public int compare(Row lhs, Row rhs) { final int cmp = compareDims(dimensions, lhs, rhs); if (cmp != 0) { return cmp; } return timeComparator.compare(lhs, rhs); } } ); } else { return Ordering.from( new Comparator<Row>() { @Override public int compare(Row lhs, Row rhs) { final int timeCompare = timeComparator.compare(lhs, rhs); if (timeCompare != 0) { return timeCompare; } return compareDims(dimensions, lhs, rhs); } } ); } }</code><technical_language>, is expected limits pushed pushDownSort is explicitly set user in request.. while in RowBasedGrouperHelper happen automatically if limit non-negative ordering columns subset of dimensions, this produce wrong results if user enable pushDown automatic.... i missing something? also, "whether limit is pushed not" code refactored a common place is RowBasedGrouperHelper disparity happen</technical_language>

Target:
public Ordering<Row> getRowOrdering(final boolean granular) { if (applyLimitPushDown) { if (!DefaultLimitSpec.sortingOrderHasNonGroupingFields((DefaultLimitSpec) limitSpec, dimensions)) { return getRowOrderingForPushDown(granular, (DefaultLimitSpec) limitSpec); } } final boolean sortByDimsFirst = getContextSortByDimsFirst(); final Comparator<Row> timeComparator = getTimeComparator(granular); if (timeComparator == null) { return Ordering.from((lhs, rhs) -> compareDims(dimensions, lhs, rhs)); } else if (sortByDimsFirst) { return Ordering.from( (lhs, rhs) -> { final int cmp = compareDims(dimensions, lhs, rhs); if (cmp != 0) { return cmp; } return timeComparator.compare(lhs, rhs); } ); } else { return Ordering.from( (lhs, rhs) -> { final int timeCompare = timeComparator.compare(lhs, rhs); if (timeCompare != 0) { return timeCompare; } return compareDims(dimensions, lhs, rhs); } ); } }
Source:
<code>public Response start(Action action) { return doAction(VdcActionType.StartGlusterVolume, new GlusterVolumeActionParameters(guid, <START> action.isForce() == null ? false : action.isForce()), action); <END> }</code><technical_language>isSetX() jaxb generated properties (which is equal action.isForce() != null )</technical_language>

Target:
public Response start(Action action) { return doAction(VdcActionType.StartGlusterVolume, new GlusterVolumeActionParameters(guid, action.isSetForce() ? action.isForce() : false), action); }
Source:
<code>public RaptorCachingHdfsConfiguration( @ForCachingFileSystem RaptorHdfsConfiguration hiveHdfsConfiguration, CacheConfig cacheConfig, CacheManager cacheManager) { this.hiveHdfsConfiguration = requireNonNull(hiveHdfsConfiguration, "hiveHdfsConfiguration is null"); this.cacheManager = requireNonNull(cacheManager, "CacheManager is null"); <START> cacheConfig = requireNonNull(cacheConfig, "cacheConfig is null"); <END> this.cacheValidationEnabled = cacheConfig.isValidationEnabled(); }</code><technical_language>nit: this.cacheValidationEnabled = requireNonNull(cacheConfig, "cacheConfig is null").isValidationEnabled();</technical_language>

Target:
public RaptorCachingHdfsConfiguration( @ForCachingFileSystem RaptorHdfsConfiguration hiveHdfsConfiguration, CacheConfig cacheConfig, CacheManager cacheManager) { this.hiveHdfsConfiguration = requireNonNull(hiveHdfsConfiguration, "hiveHdfsConfiguration is null"); this.cacheManager = requireNonNull(cacheManager, "CacheManager is null"); this.cacheValidationEnabled = requireNonNull(cacheConfig, "cacheConfig is null").isValidationEnabled(); }
Source:
<code>protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { <START> resp.setContentType("text.plain"); <END> int count = 0; Object sessionValue = req.getSession().getAttribute("count"); if (sessionValue != null) { count = (int)sessionValue; count++; resp.getWriter().println("Session parameter: " + count); } else { resp.getWriter().println("No session parameter found, reload the page"); } req.getSession().setAttribute("count", count); }</code><technical_language>text/plain</technical_language>

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/plain"); int count = 0; Object sessionValue = req.getSession().getAttribute("count"); if (sessionValue != null) { count = (int)sessionValue; count++; resp.getWriter().println("Session parameter: " + count); } else { resp.getWriter().println("No session parameter found, reload the page"); } req.getSession().setAttribute("count", count); }
Source:
<code>private static int findBucket( final ByteBuffer tableBuffer, final int buckets, final int bucketSize, final boolean allowNewBucket, final ByteBuffer keyBuffer, final int keySize, final int keyHash ) { Preconditions.checkArgument( keySize == keyBuffer.remaining(), "keyBuffer.remaining[%s] != keySize[%s]", keyBuffer.remaining(), keySize ); final int startBucket = Math.abs(keyHash % buckets); int bucket = startBucket; outer: while (true) { final int bucketOffset = bucket * bucketSize; if ((tableBuffer.get(bucketOffset) & 0x80) == 0) { return allowNewBucket ? bucket : -1; } for (int i = bucketOffset + HASH_SIZE, j = keyBuffer.position(); j < keyBuffer.position() + keySize; i++, j++) { if (tableBuffer.get(i) != keyBuffer.get(j)) { bucket += 1; if (bucket == buckets) { bucket = 0; } if (bucket == startBucket) { return -1; } <START> continue outer; <END> } } return bucket; } }</code><technical_language>do a "break" instead of label</technical_language>

Target:
private static int findBucket( final ByteBuffer tableBuffer, final int buckets, final int bucketSize, final boolean allowNewBucket, final ByteBuffer keyBuffer, final int keySize, final int keyHash ) { final int startBucket = keyHash % buckets; int bucket = startBucket; outer: while (true) { final int bucketOffset = bucket * bucketSize; if ((tableBuffer.get(bucketOffset) & 0x80) == 0) { return allowNewBucket ? bucket : -1; } for (int i = bucketOffset + HASH_SIZE, j = keyBuffer.position(); j < keyBuffer.position() + keySize; i++, j++) { if (tableBuffer.get(i) != keyBuffer.get(j)) { bucket += 1; if (bucket == buckets) { bucket = 0; } if (bucket == startBucket) { return -1; } continue outer; } } return bucket; } }
Source:
<code>private void loginOnBehalf(String externalId, String authzName, String namespace) { try { <START> AuthenticationProfile profile = getProfileByAuthzName(authzName); <END> DirectoryUser pR = DirectoryUtils.findDirectoryUserById( profile.getAuthz(), namespace, externalId, true, true); Collection<ExtMap> principalRecords = AuthzUtils.findPrincipalsByIds( profile.getAuthz(), namespace, Arrays.asList(externalId), true, true); if (!principalRecords.isEmpty()) { ExtMap principalRecord = principalRecords.iterator().next(); DirectoryUtils.flatGroups(principalRecord); attachUserToSession(profile, principalRecord); } } catch (Exception ex) { log.debug("Exception", ex); } }</code><technical_language>check if null if raising exception</technical_language>

Target:
private void loginOnBehalf(String externalId, String authzName, String namespace) { try { AuthenticationProfile profile = getProfileByAuthzName(authzName); Collection<ExtMap> principalRecords = AuthzUtils.findPrincipalsByIds( profile.getAuthz(), namespace, Arrays.asList(externalId), true, true); if (!principalRecords.isEmpty()) { ExtMap principalRecord = principalRecords.iterator().next(); DirectoryUtils.flatGroups(principalRecord); attachUserToSession(profile, principalRecord); } } catch (Exception ex) { log.debug("Exception", ex); } }
Source:
<code>public void handlePullRequestEvent(PullRequestEvent pullRequestEvent) throws IOException { <START> Set<PullRequestEvent.Action> openActions = Sets.newHashSet(PullRequestEvent.Action.opened, PullRequestEvent.Action.reopened); <END> GitInfo gitInfo = branchService.upsert(gitInfo(pullRequestEvent, openActions.contains(pullRequestEvent.getAction()))); if (pullRequestEvent.getAction().equals(PullRequestEvent.Action.opened) || pullRequestEvent.getAction().equals(PullRequestEvent.Action.reopened)) { Set<Module> modules = moduleService.getByBranch(gitInfo.getId().get()); triggerBuilds(gitInfo, modules); recordEvents(modules, pullRequestEvent.getPullRequestOrBuilder().getUser().getUsername()); } else if (pullRequestEvent.getAction().equals(PullRequestEvent.Action.closed)) { branchService.delete(gitInfo); } else { LOG.info("Pull request action has no impact on builds, not doing anything", pullRequestEvent.getAction()); } }</code><technical_language>nit: EnumSet.of</technical_language>

Target:
public void handlePullRequestEvent(PullRequestEvent pullRequestEvent) throws IOException { Set<PullRequestEvent.Action> openActions = EnumSet.of(PullRequestEvent.Action.opened, PullRequestEvent.Action.reopened); GitInfo gitInfo = branchService.upsert(gitInfo(pullRequestEvent, openActions.contains(pullRequestEvent.getAction()))); if (pullRequestEvent.getAction().equals(PullRequestEvent.Action.opened) || pullRequestEvent.getAction().equals(PullRequestEvent.Action.reopened)) { Set<Module> modules = moduleService.getByBranch(gitInfo.getId().get()); triggerBuilds(gitInfo, modules); recordEvents(modules, pullRequestEvent.getPullRequestOrBuilder().getUser().getUsername()); } else if (pullRequestEvent.getAction().equals(PullRequestEvent.Action.closed)) { branchService.delete(gitInfo); } else { LOG.info("Pull request action has no impact on builds, not doing anything", pullRequestEvent.getAction()); } }
Source:
<code>public CompletionStageAssert<V> isCancelled() { assertThat(actual.toCompletableFuture().isCancelled()) .overridingErrorMessage("Expected completion stage to be cancelled") <START> .isTrue(); <END> return this; }</code><technical_language>good a small delay in here, similar assertions fail in CI of timing issues (see 82d0d280078cb10ec043c544c9cd7e3d8dea6b02)</technical_language>

Target:
public CompletionStageAssert<V> isCancelled() { boolean cancelled = false; try { actual.toCompletableFuture().get(2, TimeUnit.SECONDS); } catch (CancellationException e) { cancelled = true; } catch (Exception ignored) { } if (!cancelled) { fail("Expected completion stage to be cancelled"); } return this; }
Source:
<code>public void run() { try { this.departureHandlers.add(this.teleportationEngine); this.activityHandlers.add( this.activityEngine ) ; prepareSim(); this.listenerManager.fireQueueSimulationInitializedEvent(); for (MobsimAgent agent : new ArrayList<>(this.agents.values())) { arrangeNextAgentAction(agent); } boolean doContinue = true; while (doContinue) { doContinue = doSimStep(); } } finally { try { cleanupSim(); } catch(Exception e) { <START> log.warn("exception in finally block - this may be a follow-up exception of an exception thrown in the try block."); <END> e.printStackTrace(); } } }</code><technical_language>Instead of a separate e.printStackTrace(), I add exception logging statement, one: suggestion log.warn("exception in finally block - this a follow-up exception of exception thrown in try block.", e); Then, get rid of line below</technical_language>

Target:
public void run() { try { this.departureHandlers.add(this.teleportationEngine); this.activityHandlers.add( this.activityEngine ) ; prepareSim(); this.listenerManager.fireQueueSimulationInitializedEvent(); for (MobsimAgent agent : new ArrayList<>(this.agents.values())) { arrangeNextAgentAction(agent); } boolean doContinue = true; while (doContinue) { doContinue = doSimStep(); } } finally { try { cleanupSim(); } catch(Exception e) { log.warn( "exception in finally block - " + "this may be a follow-up exception of an exception thrown in the try block.", e); } } }
Source:
<code>private IBundleProvider performSearch(String theCriteria) { IFhirResourceDao<?> subscriptionDao = myDaoRegistry.getSubscriptionDao(); RuntimeResourceDefinition responseResourceDef = subscriptionDao.validateCriteriaAndReturnResourceDefinition(theCriteria); SearchParameterMap responseCriteriaUrl = myMatchUrlService.translateMatchUrl(theCriteria, responseResourceDef); IFhirResourceDao<? extends IBaseResource> responseDao = myDaoRegistry.getResourceDao(responseResourceDef.getImplementingClass()); responseCriteriaUrl.setLoadSynchronousUpTo(1); <START> if (ourForceDelayBeforeMatching) { <END> try { Thread.sleep(2000); } catch (InterruptedException theE) { theE.printStackTrace(); } } TransactionTemplate txTemplate = new TransactionTemplate(myTxManager); txTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); return txTemplate.execute(t -> responseDao.search(responseCriteriaUrl)); }</code><technical_language>I this. a resolve this issue</technical_language>

Target:
private IBundleProvider performSearch(String theCriteria) { IFhirResourceDao<?> subscriptionDao = myDaoRegistry.getSubscriptionDao(); RuntimeResourceDefinition responseResourceDef = subscriptionDao.validateCriteriaAndReturnResourceDefinition(theCriteria); SearchParameterMap responseCriteriaUrl = myMatchUrlService.translateMatchUrl(theCriteria, responseResourceDef); IFhirResourceDao<? extends IBaseResource> responseDao = myDaoRegistry.getResourceDao(responseResourceDef.getImplementingClass()); responseCriteriaUrl.setLoadSynchronousUpTo(1); TransactionTemplate txTemplate = new TransactionTemplate(myTxManager); txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); return txTemplate.execute(t -> responseDao.search(responseCriteriaUrl)); }
Source:
<code>public void hangup(GsmCdmaCall call) throws CallStateException { if (call.getConnections().size() == 0) { throw new CallStateException("no connections in call"); } if (call == mRingingCall) { if (Phone.DEBUG_PHONE) log("(ringing) hangup waiting or background"); logHangupEvent(call); mCi.hangupWaitingOrBackground(obtainCompleteMessage()); } else if (call == mForegroundCall) { if (call.isDialingOrAlerting()) { if (Phone.DEBUG_PHONE) { log("(foregnd) hangup dialing or alerting..."); } hangup((GsmCdmaConnection)(call.getConnections().get(0))); } else if (isPhoneTypeGsm() && mRingingCall.isRinging()) { log("hangup all conns in active/background call, without affecting ringing call"); hangupAllConnections(call); } <START> else if (mBackgroundCall.mConnections.size() == 0) { log("hangup the foreground call"); hangupWaitingOrBackground(); <END> } else { logHangupEvent(call); hangupForegroundResumeBackground(); } } else if (call == mBackgroundCall) { if (mRingingCall.isRinging()) { if (Phone.DEBUG_PHONE) { log("hangup all conns in background call"); } hangupAllConnections(call); } else { hangupWaitingOrBackground(); } } else { throw new RuntimeException ("GsmCdmaCall " + call + "does not belong to GsmCdmaCallTracker " + this); } call.onHangupLocal(); mPhone.notifyPreciseCallStateChanged(); }</code><technical_language>case is a single call is active this hangup method is called? In this case, call hangupForegroundResumeBackground instead of hangupForegroundResumeBackground. In fact, a call is hung is hung hangup(Connection), hangup(Call) (a confusing)</technical_language>

Target:
public void hangup(GsmCdmaCall call) throws CallStateException { if (call.getConnections().size() == 0) { throw new CallStateException("no connections in call"); } if (call == mRingingCall) { if (Phone.DEBUG_PHONE) log("(ringing) hangup waiting or background"); logHangupEvent(call); mCi.hangupWaitingOrBackground(obtainCompleteMessage()); } else if (call == mForegroundCall) { if (call.isDialingOrAlerting()) { if (Phone.DEBUG_PHONE) { log("(foregnd) hangup dialing or alerting..."); } hangup((GsmCdmaConnection)(call.getConnections().get(0))); } else if (isPhoneTypeGsm() && mRingingCall.isRinging()) { log("hangup all conns in active/background call, without affecting ringing call"); hangupAllConnections(call); } else if (call.mHoldingRequestState.isStarted()) { log("hangup waiting or background call"); logHangupEvent(call); hangupWaitingOrBackground(); } else { logHangupEvent(call); hangupForegroundResumeBackground(); } } else if (call == mBackgroundCall) { if (mRingingCall.isRinging()) { if (Phone.DEBUG_PHONE) { log("hangup all conns in background call"); } hangupAllConnections(call); } else { hangupWaitingOrBackground(); } } else { throw new RuntimeException ("GsmCdmaCall " + call + "does not belong to GsmCdmaCallTracker " + this); } call.onHangupLocal(); mPhone.notifyPreciseCallStateChanged(); }
Source:
<code>private DbUser getDbUserForPrincipalName(String principalName, String authzName) { ExtMap principalRecord = AuthzUtils.fetchPrincipalRecord( EngineExtensionsManager.getInstance().getExtensionByName(authzName), principalName, false, false); if (principalRecord == null) { <START> throw new RuntimeException(String.format("Unable to find principal %s in domain '%s'", <END> principalName, authzName)); } DbUser user = new DbUser(DirectoryUtils.mapPrincipalRecordToDirectoryUser(authzName, principalRecord)); user.setId(Guid.newGuid()); return user; }</code><technical_language>create EngineError (and high > 5000) for exception want throw in a command, throw EngineException this key this translate erros commands error handling 'infra'</technical_language>

Target:
private DbUser getDbUserForPrincipalName(String principalName, String authzName) { ExtMap principalRecord = AuthzUtils.fetchPrincipalRecord( EngineExtensionsManager.getInstance().getExtensionByName(authzName), principalName, false, false); if (principalRecord == null) { throw new EngineException(EngineError.PRINCIPAL_NOT_FOUND, String.format("%s in domain '%s", principalName, authzName)); } DbUser user = new DbUser(DirectoryUtils.mapPrincipalRecordToDirectoryUser(authzName, principalRecord)); user.setId(Guid.newGuid()); return user; }
Source:
<code>public void selectTab(Tab tabName){ <START> WebElement tab = waitForElementByCss("a[rel='"+tabName.toString()+"Tab']"); <END> scrollAndClick(tab); waitForElementByCss("li.selected a[rel='"+tabName.toString()+"Tab']"); PageObjectLogging.log("submitSelection", "selection of new skin saved", true); }</code><technical_language>beginning of class: String tabSelector = "a[rel=%tabName%Tab']"; in selectTab method: WebElement tab = waitForElementByCss(tabSelector.replace("%tabName%", tabName.toString()));</technical_language>

Target:
public void selectTab(Tab tabName){ WebElement tab = waitForElementByCss(tabSelector.replace("%tabName%", tabName.toString())); scrollAndClick(tab); waitForElementByCss(selectedTabSelector.replace("%tabName%", tabName.toString())); PageObjectLogging.log("selectTab", tabName.toString()+" tab has been selected", true); }