auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void loadNextReader() { if (pathIterator.hasNext()) { String path = pathIterator.next(); if (path.startsWith(S3_PREFIX)) { path = path.substring(S3_PREFIX.length()); } int slashIndex = path.indexOf("/"); if ((slashIndex < 0) || (slashIndex == (path.length() - 1))) { loadNextReader(); return; } String bucket = path.substring(0, slashIndex); String key = path.substring(slashIndex + 1); int retry = 2; while (retry > 0) { try { if (key.endsWith("/")) { ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName(bucket).withPrefix(key)); List<String> paths = Lists.newArrayList(); for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { if (!summary.getKey().equals(key) && (summary.getSize() > 0)) { paths.add(summary.getBucketName() + "/" + summary.getKey()); } } currentReader = new PathReader(paths); } else { S3Object object = s3Client.getObject(bucket, key); currentReader = new BufferedReader(new InputStreamReader(object.getObjectContent())); } } catch (AmazonS3Exception e) { LOG.warning(String.format("Exception while trying to read bucket:%s, key:%s. Retrying.", bucket, key)); ensureClient(true); retry--; <START> continue; <END> } break; } } }</code><technical_language>break continue statements omitted a single return statement end of try block</technical_language>

Target:
private void loadNextReader() throws IOException { if (pathIterator.hasNext()) { String path = pathIterator.next(); if (path.startsWith(S3_PREFIX)) { path = path.substring(S3_PREFIX.length()); } int slashIndex = path.indexOf("/"); if ((slashIndex < 0) || (slashIndex == (path.length() - 1))) { loadNextReader(); return; } String bucket = path.substring(0, slashIndex); String key = path.substring(slashIndex + 1); int retry = DEFAULT_RETRY; while (retry > 0) { try { if (key.endsWith("/")) { ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName(bucket).withPrefix(key)); List<String> paths = Lists.newArrayList(); for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { if (!summary.getKey().equals(key) && (summary.getSize() > 0)) { paths.add(summary.getBucketName() + "/" + summary.getKey()); } } currentReader = new PathReader(paths); } else { S3Object object = s3Client.getObject(bucket, key); currentReader = new BufferedReader(new InputStreamReader(object.getObjectContent())); } return; } catch (AmazonS3Exception e) { LOG.warning(String.format("Exception while trying to read bucket:%s, key:%s. Exception code:%s, message:%s. Retrying.", bucket, key, e.getErrorCode(), e.getMessage())); resetS3Client(); retry--; } } throw new IOException(String.format("Exception while trying to read bucket:%s, key:%s", bucket, key)); } }
Source:
<code>public void shouldReduceTwoNonEmptyListsAndReturnConcatenation() { final List<Integer> listOne = Collections.unmodifiableList( <START> IntStream.range(0, 5) <END> .boxed() .collect(Collectors.toList()) ); final List<Integer> listTwo = Collections.unmodifiableList( IntStream.range(5, 10) .boxed() .collect(Collectors.toList()) ); final List<Integer> actual = ListOps.reduce(listTwo, listOne, accumulator, combiner); final List<Integer> expected = IntStream.range(0, 10) .boxed() .collect(Collectors.toList()); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }</code><technical_language>Arrays.asList(...) for short lists</technical_language>

Target:
public void shouldReduceTwoNonEmptyListsAndReturnConcatenation() { final List<Integer> listOne = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3, 4) ); final List<Integer> listTwo = Collections.unmodifiableList( Arrays.asList(5, 6, 7, 8, 9) ); final List<Integer> actual = ListOps.reduce(listTwo, listOne, accumulator, combiner); final List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
<code>public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker arg0) { Intent i = new Intent(MapsActivity.this, MapImage.class); i.putExtra("path", arg0.getTitle()); Log.e("Image", arg0.getTitle()); startActivity(i); return true; } }); ArrayList<String> listOfAllImages = getImagesPath(this); int i; for (i = 0; i < listOfAllImages.size(); i++) { ExifInterface exif = null; try { exif = new ExifInterface(listOfAllImages.get(i)); } catch (IOException e) { e.printStackTrace(); } float[] latLong = new float[2]; boolean hasLatLong = exif.getLatLong(latLong); if (hasLatLong) { System.out.println("Latitude: " + latLong[0]); System.out.println("Longitude: " + latLong[1]); mMap.addMarker(new MarkerOptions() .position(new LatLng(latLong[0], latLong[1])) <START> .title(listOfAllImages.get(i))); <END> mMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(latLong[0], latLong[1]))); } } }</code><technical_language>Add customized info screen InfoWindowAdapter, show image snippet</technical_language>

Target:
public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() { @Override public void onInfoWindowClick(Marker arg0) { Intent i = new Intent(MapsActivity.this, MapImage.class); i.putExtra("path", arg0.getTitle()); Log.e("Image", arg0.getTitle()); startActivity(i); } }); mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { @Override public View getInfoWindow(Marker arg0) { return null; } @Override public View getInfoContents(Marker arg0) { View v = getLayoutInflater().inflate(R.layout.marker_image, null); LatLng latLng = arg0.getPosition(); ImageView markerImage = (ImageView) v.findViewById(R.id.marker_image); final String p = arg0.getTitle(); markerImage.setImageURI(Uri.parse(arg0.getTitle())); return v; } }); mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker arg0) { arg0.showInfoWindow(); return true; } }); ArrayList<String> listOfAllImages = getImagesPath(this); int i; for (i = 0; i < listOfAllImages.size(); i++) { ExifInterface exif = null; try { exif = new ExifInterface(listOfAllImages.get(i)); } catch (IOException e) { e.printStackTrace(); } float[] latLong = new float[2]; boolean hasLatLong = exif.getLatLong(latLong); if (hasLatLong) { System.out.println("Latitude: " + latLong[0]); System.out.println("Longitude: " + latLong[1]); mMap.addMarker(new MarkerOptions() .position(new LatLng(latLong[0], latLong[1])) .title(listOfAllImages.get(i))); mMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(latLong[0], latLong[1]))); } } }
Source:
<code>public void testExpired() throws InterruptedException, IOException { <START> final ExpiringCache<String, String> CACHE = new ExpiringCache<String, String>(CACHE_EXPIRY, <END> new ExpiringCache.LoadAction<String, String>() { @Override public String load(String query) throws IOException { return RandomStringUtils.random(8); } }); String value1 = CACHE.get(TEST_QUERY); Thread.sleep(CACHE_EXPIRY + 100); String value2 = CACHE.get(TEST_QUERY); assertNotEquals(value1, value2); }</code><technical_language>this static, case cache</technical_language>

Target:
public void testExpired() throws InterruptedException { final ExpiringCache<String> single_cache = new ExpiringCache<String>(ExpiringCacheMapTest.CACHE_EXPIRY, ExpiringCacheMapTest.CACHE_ACTION); String value1 = single_cache.getValue(); assertFalse(single_cache.isExpired()); Thread.sleep(ExpiringCacheMapTest.CACHE_EXPIRY + 100); assertTrue(single_cache.isExpired()); String value2 = single_cache.getValue(); assertFalse(single_cache.isExpired()); assertNotEquals(value1, value2); }
Source:
<code><START> default NothingHappened nothing() { <END> return NothingHappened.getDefaultInstance(); }</code><technical_language>NothingHappened is long. brainstorm in person</technical_language>

Target:
default Nothing nothing() { return Nothing.getDefaultInstance(); }
Source:
<code>protected void doSetUserAttributesWithID(String userID, Map<String, List<String>> claimAttributesToAdd, Map<String, List<String>> claimAttributesToDelete, Map<String, List<String>> claimAttributesToReplace, String profileName) throws UserStoreException, NotImplementedException { if (log.isDebugEnabled()) { log.debug("doSetUserAttributesWithID operation is not implemented in: " + this.getClass()); } throw new NotImplementedException("doSetUserAttributesWithID operation is not implemented in: " <START> + this.getClass()); <END> }</code><technical_language>In opinion, do need this log. WDYT</technical_language>

Target:
protected void doSetUserAttributesWithID(String userID, Map<String, List<String>> claimAttributesToAdd, Map<String, List<String>> claimAttributesToDelete, Map<String, List<String>> claimAttributesToReplace, String profileName) throws UserStoreException, NotImplementedException { throw new NotImplementedException("doSetUserAttributesWithID operation is not implemented in: " + this.getClass()); }
Source:
<code>protected void setup(Context context) throws IOException, InterruptedException { config = HadoopDruidIndexerConfig.fromConfiguration(context.getConfiguration()); parser = config.getParser(); granularitySpec = config.getGranularitySpec(); reportParseExceptions = !config.isIgnoreInvalidRows(); <START> if (config.getPathSpec() instanceof PartitionPathSpec) { <END> PartitionPathSpec partitionPathSpec = (PartitionPathSpec)config.getPathSpec(); InputSplit split = context.getInputSplit(); Class<? extends InputSplit> splitClass = split.getClass(); FileSplit fileSplit = null; if (splitClass.equals(FileSplit.class)) { fileSplit = (FileSplit) split; } else if (splitClass.getName().equals("org.apache.hadoop.mapreduce.lib.input.TaggedInputSplit")) { try { Method getInputSplitMethod = splitClass .getDeclaredMethod("getInputSplit"); getInputSplitMethod.setAccessible(true); fileSplit = (FileSplit) getInputSplitMethod.invoke(split); } catch (Exception e) { throw new IOException(e); } } Path filePath = fileSplit.getPath(); partitionDimValues = partitionPathSpec.getPartitionValues(filePath); if (partitionDimValues.size() == 0) { partitionDimValues = null; } else { partitionDims = partitionDimValues.keySet(); } } }</code><technical_language>instead of this instance of check, a new method pathSpec interface is setupMapper() contains this logic. For other path specs is empty method</technical_language>

Target:
protected void setup(Context context) throws IOException, InterruptedException { config = HadoopDruidIndexerConfig.fromConfiguration(context.getConfiguration()); parser = config.getParser(); granularitySpec = config.getGranularitySpec(); reportParseExceptions = !config.isIgnoreInvalidRows(); dimsMerger = new AdditionalDimsMergerFactory().create(config.getPathSpec().additionalDimValues(context)); }
Source:
<code>public void waitsUntilQueueSizeLowerThanThreshold() throws InterruptedException, ExecutionException { assertTimeout(ofMillis(10000), () -> { q.put(100); q.put(200); q.put(300); Callable<Integer> tester = new Callable<Integer>() { @Override public Integer call() throws Exception { <START> q.waitUntilQueueSizeLowerThanThreshold(new DateTime().plusMinutes(1)); <END> return q.size(); } }; Future<Integer> result = newSingleThreadExecutor().submit(tester); sleep(1000); assertThat(result.isDone(), is(false)); q.poll(); sleep(1000); assertThat(result.isDone(), is(false)); q.poll(); sleep(1000); assertThat(result.isDone(), is(true)); assertThat(result.get(), is(1)); }); }</code><technical_language>suggestion q.waitUntilQueueSizeLowerThanThreshold(DateTime.now().plusMinutes(1));</technical_language>

Target:
public void waitsUntilQueueSizeLowerThanThreshold() { assertTimeout(ofMillis(10000), () -> { q.put(100); q.put(200); q.put(300); Callable<Integer> tester = new Callable<Integer>() { @Override public Integer call() throws Exception { q.waitUntilQueueSizeLowerThanThreshold(DateTime.now().plusMinutes(1)); return q.size(); } }; Future<Integer> result = newSingleThreadExecutor().submit(tester); sleep(1000); assertThat(result.isDone(), is(false)); q.poll(); sleep(1000); assertThat(result.isDone(), is(false)); q.poll(); sleep(1000); assertThat(result.isDone(), is(true)); assertThat(result.get(), is(1)); }); }
Source:
<code>private boolean commitPromotionMigrations(PartitionReplica destination, Collection<MigrationInfo> migrations) { internalMigrationListener.onPromotionStart(MigrationParticipant.MASTER, migrations); boolean success = commitPromotionsToDestination(destination, migrations); <START> boolean local = node.getThisAddress().equals(destination.address()); <END> if (!local) { processPromotionCommitResult(destination, migrations, success); } internalMigrationListener.onPromotionComplete(MigrationParticipant.MASTER, migrations, success); partitionService.syncPartitionRuntimeState(); return success; }</code><technical_language>this destination.isIdentical(node.getLocalMember()) instead</technical_language>

Target:
private boolean commitPromotionMigrations(PartitionReplica destination, Collection<MigrationInfo> migrations) { internalMigrationListener.onPromotionStart(MigrationParticipant.MASTER, migrations); boolean success = commitPromotionsToDestination(destination, migrations); boolean local = destination.isIdentical(node.getLocalMember()); if (!local) { processPromotionCommitResult(destination, migrations, success); } internalMigrationListener.onPromotionComplete(MigrationParticipant.MASTER, migrations, success); partitionService.syncPartitionRuntimeState(); return success; }
Source:
<code>private IFileRevision getFileRevision(String revision) { if (entries != null) { for (IFileRevision <START> entrie : <END> entries) { if (entrie.getContentIdentifier().equals(revision)) { return entrie; } } } else if (cvsFileHistory != null) { return cvsFileHistory.getFileRevision(revision); } return null; }</code><technical_language>entry</technical_language>

Target:
private IFileRevision getFileRevision(String revision) { if (entries != null) { for (IFileRevision entry : entries) { if (entry.getContentIdentifier().equals(revision)) { return entry; } } } else if (cvsFileHistory != null) { return cvsFileHistory.getFileRevision(revision); } return null; }
Source:
<code>byte[] byteArrayFromInt(int val) { byte[] b = new byte[4]; b[3] = (byte) (val); b[2] = (byte) (val >>> 8); b[1] = (byte) (val >>> 16); b[0] = (byte) (val >>> 24); <START> return b; <END> }</code><technical_language>matter, be: java return new byte[] { (byte) (val >>> 24), (byte) (val >>> 16), (byte) (val >>> 8), (byte) val };</technical_language>

Target:
byte[] byteArrayFromInt(int val) { return new byte[] { (byte) (val >>> 24), (byte) (val >>> 16), (byte) (val >>> 8), (byte) (val) }; }
Source:
<code>public static Obs generateOpenMRSObs(Observation observation, List<String> errors) { Obs obs = new Obs(); obs.setComment(observation.getComments()); if (observation.getSubject() != null) { ResourceReferenceDt subjectref = observation.getSubject(); IdDt id = subjectref.getReference(); String uri = id.getValue(); <START> String[] paths = uri.split("/"); <END> String patientUuid = paths[1]; obs.setPerson(Context.getPersonService().getPersonByUuid(patientUuid)); } else { errors.add("Subject cannot be null"); } DateTimeDt dateApplies = (DateTimeDt) observation.getApplies(); obs.setObsDatetime(dateApplies.getValue()); Date instant = observation.getIssued(); obs.setDateCreated(instant); CodeableConceptDt dt = observation.getCode(); List<CodingDt> dts = dt.getCoding(); CodingDt coding = dts.get(0); String conceptUuid = coding.getCode(); Concept concept = Context.getConceptService().getConceptByUuid(conceptUuid); obs.setConcept(concept); if (concept.isNumeric()) { QuantityDt quantity = (QuantityDt) observation.getValue(); BigDecimal bd = quantity.getValue(); double doubleValue = bd.doubleValue(); obs.setValueNumeric(doubleValue); } if (observation.getEncounter() != null) { ResourceReferenceDt encounter = observation.getEncounter(); IdDt ref = encounter.getReference(); String reference = ref.getValue(); String[] encpaths = reference.split("/"); String encounterUuid = encpaths[1]; obs.setEncounter(Context.getEncounterService().getEncounterByUuid(encounterUuid)); } return obs; }</code><technical_language>do need split. I method get uuid of method a method? If this is fine</technical_language>

Target:
public static Obs generateOpenMRSObs(Observation observation, List<String> errors) { Obs obs = new Obs(); obs.setComment(observation.getComments()); if (observation.getSubject() != null) { ResourceReferenceDt subjectref = observation.getSubject(); IdDt id = subjectref.getReference(); String patientUuid = id.getIdPart(); obs.setPerson(Context.getPersonService().getPersonByUuid(patientUuid)); } else { errors.add("Subject cannot be null"); } DateTimeDt dateApplies = (DateTimeDt) observation.getApplies(); obs.setObsDatetime(dateApplies.getValue()); Date instant = observation.getIssued(); obs.setDateCreated(instant); String conceptUuid = null; try { CodeableConceptDt dt = observation.getCode(); List<CodingDt> dts = dt.getCoding(); CodingDt coding = dts.get(0); conceptUuid = coding.getCode(); } catch (NullPointerException e) { errors.add("Code cannot be empty"); } Concept concept = Context.getConceptService().getConceptByUuid(conceptUuid); obs.setConcept(concept); if (concept != null) { if (concept.isNumeric()) { QuantityDt quantity = (QuantityDt) observation.getValue(); BigDecimal bd = quantity.getValue(); double doubleValue = bd.doubleValue(); obs.setValueNumeric(doubleValue); } } else { errors.add("Couldn't find a concept for the given uuid"); } if (observation.getEncounter() != null) { ResourceReferenceDt encounter = observation.getEncounter(); IdDt ref = encounter.getReference(); String encounterUuid = ref.getIdPart(); obs.setEncounter(Context.getEncounterService().getEncounterByUuid(encounterUuid)); } return obs; }
Source:
<code>private void addMetaData(Object object, String version) { HashMapDataStore hashMapDataStore = hashMapDataStores.computeIfAbsent(version, ERROR_OUT); EntityDictionary dictionary = hashMapDataStore.getDictionary(); <START> Map<Class<?>, Map<String, Object>> dataStore = hashMapDataStore.getStorage(); <END> Class<?> cls = dictionary.lookupBoundClass(object.getClass()); String id = dictionary.getId(object); if (dataStore.get(cls).containsKey(id)) { if (!dataStore.get(cls).get(id).equals(object)) { throw new DuplicateMappingException("Duplicated " + cls.getSimpleName() + " metadata " + id); } } else { dataStore.get(cls).put(id, object); } }</code><technical_language>Instead of exposing data storage, I if cleaner add a method add storage</technical_language>

Target:
private void addMetaData(Object object, String version) { HashMapDataStore hashMapDataStore = hashMapDataStores.computeIfAbsent(version, SERVER_ERROR); EntityDictionary dictionary = hashMapDataStore.getDictionary(); Class<?> cls = dictionary.lookupBoundClass(object.getClass()); String id = dictionary.getId(object); if (hashMapDataStore.get(cls).containsKey(id)) { if (!hashMapDataStore.get(cls).get(id).equals(object)) { throw new DuplicateMappingException("Duplicated " + cls.getSimpleName() + " metadata " + id); } } else { hashMapDataStore.get(cls).put(id, object); } }
Source:
<code>public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { <START> if (ThingStatus.ONLINE.equals(bridgeStatusInfo.getStatus()) <END> && ThingStatusDetail.BRIDGE_OFFLINE.equals(getThing().getStatusInfo().getStatusDetail())) { updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); } }</code><technical_language>Hm, understanding base implementation like: Java if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); }</technical_language>

Target:
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); } }
Source:
<code>public void updateUnits() { this.prefs.setUnits(xunit, yunit); <START> fire(currentSed, VisualizerCommand.RESET); <END> }</code><technical_language>some weird behavior here, coming SedPreferences reset() method. Segments added suffix (e.g. 1) keeping name end plotted I apply a units change</technical_language>

Target:
public void updateUnits() { plotter.getVisualizerPreferences().getSedPreferences(plotter.getSed()).setUnits(xunit, yunit); fire(plotter.getSed(), VisualizerCommand.RESET); }
Source:
<code>public static List<EStructuralFeature> getFeaturesToCopy(EClass eClass) { List<EStructuralFeature> featuresToCopy = new ArrayList<>(); eClass.getEAllStructuralFeatures().stream().filter(EReference.class::isInstance).map(EReference.class::cast).forEach(eReference -> { EClass featureType = eReference.getEReferenceType(); if <START> (isWidgetAction(featureType) || isToolbarAction(featureType) || isStyle(featureType) || isInitialOperation(featureType)) { <END> featuresToCopy.add(eReference); } }); return featuresToCopy; }</code><technical_language>need change this a method shouldCopy(featureType) methods a bit verbose. I modify this file for reason previous one</technical_language>

Target:
public static List<EStructuralFeature> getFeaturesToCopy(EClass eClass) { List<EStructuralFeature> featuresToCopy = new ArrayList<>(); eClass.getEAllStructuralFeatures().stream().filter(EReference.class::isInstance).map(EReference.class::cast).forEach(eReference -> { EClass featureType = eReference.getEReferenceType(); if (shouldCopy(featureType)) { featuresToCopy.add(eReference); } }); return featuresToCopy; }
Source:
<code>public void onSegmentEnd(ILiveStreamRecord liveStreamRecord) { logger.info("Stream [" + stream.getName() + "] segment number [" + this.getSegmentNumber() + "] duration [" + this.getCurrentDuration() + "]"); if (this.getCurrentDuration() == 0) { logger.warn("Stream [" + stream.getName() + "] include duration [" + this.getCurrentDuration() + "]"); return; } AppendRecordingTimerTask appendRecording = new AppendRecordingTimerTask(file.getAbsolutePath(), isLastChunk, (double) this.getCurrentDuration() / 1000) { @Override public void run() { KalturaLiveEntry updatedEntry; logger.debug("Running appendRecording task"); if (serverConfiguration.containsKey(Constants.COPY_SEGMENT_TO_LOCATION_FIELD_NAME)) { copySegmentToLocationFieldsName(filePath); } logger.info("Stream [" + stream.getName() + "] file [" + filePath + "] changing group name to [" + group.getName() + "]"); if (group != null) { setGroupPermision(filePath); } <START> if (!KalturaAPI.getKalturaAPI().isNewRecordingEnabled(liveEntry)) { <END> updatedEntry = appendRecording(liveEntry, liveAsset.id, index, filePath, appendTime, lastChunkFlag); if (updatedEntry != null){ liveEntry = updatedEntry; } } } }; Timer appendRecordingTimer = new Timer("appendRecording-"+liveEntry.id+"-"+liveAsset.id, true); appendRecordingTimer.schedule(appendRecording, 1); this.isLastChunk = false; }</code><technical_language>bad practive todo API call answer..</technical_language>

Target:
public void onSegmentEnd(ILiveStreamRecord liveStreamRecord) { logger.info("Stream [" + stream.getName() + "] segment number [" + this.getSegmentNumber() + "] duration [" + this.getCurrentDuration() + "]"); if (this.getCurrentDuration() == 0) { logger.warn("Stream [" + stream.getName() + "] include duration [" + this.getCurrentDuration() + "]"); return; } AppendRecordingTimerTask appendRecording = new AppendRecordingTimerTask(file.getAbsolutePath(), isLastChunk, (double) this.getCurrentDuration() / 1000) { @Override public void run() { KalturaLiveEntry updatedEntry; logger.debug("Running appendRecording task"); if (serverConfiguration.containsKey(Constants.COPY_SEGMENT_TO_LOCATION_FIELD_NAME)) { copySegmentToLocationFieldsName(filePath); } logger.info("Stream [" + stream.getName() + "] file [" + filePath + "] changing group name to [" + group.getName() + "]"); if (group != null) { setGroupPermision(filePath); } if (!isNewLiveRecordingEnabled) { updatedEntry = appendRecording(liveEntry, liveAsset.id, index, filePath, appendTime, lastChunkFlag); if (updatedEntry != null){ liveEntry = updatedEntry; } } } }; Timer appendRecordingTimer = new Timer("appendRecording-"+liveEntry.id+"-"+liveAsset.id, true); appendRecordingTimer.schedule(appendRecording, 1); this.isLastChunk = false; }
Source:
<code><START> public synchronized ServerTemplateKey getTemplateKey(String id) { <END> return templateKeyMap.get(id); }</code><technical_language>is this synchronized? read map</technical_language>

Target:
public ServerTemplateKey getTemplateKey(String id) { return templateKeyMap.get(id); }
Source:
<code>public void save(File file) { try { PropertiesConfiguration pconf = newPropertiesConfiguration(); pconf.append(internalConfig); <START> new FileHandler(pconf).save(file); <END> } catch (ConfigurationException e) { throw new FluoException(e); } }</code><technical_language>Instead of FileHandler, PropertyConfigurationLayout save a FileWriter</technical_language>

Target:
public void save(File file) { try (Writer writer = Files.newBufferedWriter(file.toPath())) { PropertiesConfiguration pconf = new PropertiesConfiguration(); pconf.append(internalConfig); pconf.getLayout().save(pconf, writer); } catch (ConfigurationException | IOException e) { throw new FluoException(e); } }
Source:
<code>public static String toProtobufFormat(String value) { return value.replaceAll("\\.", "__") .replaceAll("/", "__") .replaceAll(":", "__") .replaceAll("\\[", "__") <START> .replaceAll("]", <END> "__") .replaceAll("-", "_"); }</code><technical_language>Is this expected single udnerscore? Bbecause other chars replaced double underscore.</technical_language>

Target:
public static String toProtobufFormat(String value) { return INVALID_CHAR.matcher(value).replaceAll("__") .replaceAll("-", "_"); }
Source:
<code>protected void run() throws Exception { <START> CommitCommand commitCmd=new Git(db).commit(); <END> if (author!=null) commitCmd.setAuthor(new PersonIdent(author)); if (message!=null) commitCmd.setMessage(message); commitCmd.call(); }</code><technical_language>Style-nit: Spaces operators (=, !=, etc.)</technical_language>

Target:
protected void run() throws NoHeadException, NoMessageException, ConcurrentRefUpdateException, JGitInternalException, Exception { CommitCommand commitCmd = new Git(db).commit(); if (author != null) commitCmd.setAuthor(new PersonIdent(author)); if (message != null) commitCmd.setMessage(message); Ref head = db.getRef(Constants.HEAD); RevCommit commit = commitCmd.call(); String branchName; if (!head.isSymbolic()) branchName="detached HEAD"; else { branchName = head.getTarget().getName(); if (branchName.startsWith(Constants.R_HEADS)) branchName = branchName.substring(Constants.R_HEADS.length()); } out.println("[" + branchName + " " + commit.name() + "] " + commit.getShortMessage()); }
Source:
<code>public void afterFromProto(Message proto) { Topology.Rule rule = (Topology.Rule)proto; UUID id = UUIDUtil.fromProto(rule.getId()); if (!rule.hasAction()) { throw new ZoomConvert.ConvertException( "Rule " + id + " has no action set (" + rule + ")"); } switch (rule.getType()) { case JUMP_RULE: if (rule.getAction() != Topology.Rule.Action.JUMP) throw new ZoomConvert.ConvertException( "Rule " + id + " is a JUMP rule but does not have its " + "action set to JUMP (" + rule + ")"); break; case NAT_RULE: if <START> (!rule.getNatRuleData().getReverse() <END> && rule.getNatRuleData().getNatTargetsCount() == 0) { throw new ZoomConvert.ConvertException( "Rule " + id + " is a forward NAT rule but has no " + "targets set (" + rule + ")"); } break; case TRACE_RULE: if (rule.getAction() != Topology.Rule.Action.CONTINUE) throw new ZoomConvert.ConvertException( "Rule " + id + " is a TRACE rule but its action is not " + " set to CONTINUE (" + rule + ")"); break; } condition = ZoomConvert.fromProto(proto, Condition.class); }</code><technical_language>check rule nat rule data first</technical_language>

Target:
public void afterFromProto(Message proto) { Topology.Rule rule = (Topology.Rule)proto; UUID id = UUIDUtil.fromProto(rule.getId()); if (!rule.hasAction()) { throw new ZoomConvert.ConvertException( "Rule " + id + " has no action set (" + rule + ")"); } switch (rule.getType()) { case JUMP_RULE: if (!rule.hasJumpRuleData()) { throw new ZoomConvert.ConvertException( "Rule " + id + " is a JUMP rule but does not have its " + "JUMP data set (" + rule + ")"); } if (rule.getAction() != Topology.Rule.Action.JUMP) throw new ZoomConvert.ConvertException( "Rule " + id + " is a JUMP rule but does not have its " + "action set to JUMP (" + rule + ")"); break; case NAT_RULE: if (!rule.hasNatRuleData()) { throw new ZoomConvert.ConvertException( "Rule " + id + " is a NAT rule but does not have its " + "NAT data set (" + rule + ")"); } if (!rule.getNatRuleData().getReverse() && rule.getNatRuleData().getNatTargetsCount() == 0) { throw new ZoomConvert.ConvertException( "Rule " + id + " is a forward NAT rule but has no " + "targets set (" + rule + ")"); } break; case TRACE_RULE: if (rule.getAction() != Topology.Rule.Action.CONTINUE) throw new ZoomConvert.ConvertException( "Rule " + id + " is a TRACE rule but its action is not " + " set to CONTINUE (" + rule + ")"); break; } condition = ZoomConvert.fromProto(proto, Condition.class); }
Source:
<code>private List<QueryStateInfo> getAllAggregatedRunningQueriesInfo() { synchronized (root) { InternalResourceGroup resourceGroup = this; <START> List<QueryStateInfo> result = new ArrayList<>(resourceGroup.getAggregatedRunningQueriesInfo()); <END> while (resourceGroup.getPrev().isPresent()) { resourceGroup = resourceGroup.getPrev().get(); result.addAll(resourceGroup.getAggregatedRunningQueriesInfo()); } return ImmutableList.copyOf(result); } }</code><technical_language>suggestion ImmutableList.Builder<QueryStateInfo> result = ImmutableList.builder().addAll(resourceGroup.getAggregatedRunningQueriesInfo());</technical_language>

Target:
private List<QueryStateInfo> getAllAggregatedRunningQueriesInfo() { synchronized (root) { InternalResourceGroup resourceGroup = this; ImmutableList.Builder<QueryStateInfo> result = ImmutableList.builder(); result.addAll(resourceGroup.getAggregatedRunningQueriesInfo()); while (resourceGroup.getPrev().isPresent()) { resourceGroup = resourceGroup.getPrev().get(); result.addAll(resourceGroup.getAggregatedRunningQueriesInfo()); } return result.build(); } }
Source:
<code>private static String parseElementName(XMLStreamReader reader) throws XMLStreamException { int event = reader.getEventType(); while (event != XMLStreamConstants.START_ELEMENT) { event = reader.next(); } String prefix = reader.getPrefix(); <START> if (prefix.length() == 0) { <END> return reader.getLocalName(); } return prefix + ':' + reader.getLocalName(); }</code><technical_language>getPrefix returns null if is prefix this throw NPE</technical_language>

Target:
private static String parseElementName(XMLStreamReader reader) throws XMLStreamException { int event = reader.getEventType(); while (event != XMLStreamConstants.START_ELEMENT) { event = reader.next(); } String prefix = reader.getPrefix(); if (prefix == null || prefix.isEmpty()) { return reader.getLocalName(); } return prefix + ':' + reader.getLocalName(); }
Source:
<code>private void showNearbyPages(NearbyResult result) { getActivity().invalidateOptionsMenu(); if (currentLocation != null) { sortByDistance(result.getList()); } adapter.clear(); addResultsToAdapter(result.getList()); compassViews.clear(); mMarkerList.clear(); mapView.clear(); <START> if (adapter.getCount() == 0) { <END> nearbyListContainer.setVisibility(View.GONE); } else { nearbyListContainer.setVisibility(View.VISIBLE); } for (int i = 0; i < adapter.getCount(); i++) { NearbyPage item = adapter.getItem(i); Location location = item.getLocation(); Marker marker = new CustomMarker(mapView, item.getTitle(), item.getDescription(), new LatLng(location.getLatitude(), location.getLongitude())); marker.setIcon(mMarkerIconPassive); marker.setRelatedObject(item); marker.setHotspot(Marker.HotspotPlace.CENTER); mMarkerList.add(marker); } mapView.addMarkers(mMarkerList); }</code><technical_language>a ternary emphasize logic stays data is different: nearbyListContainer.setVisibility(adapter.getCount() ? View.VISIBLE : View.GONE);</technical_language>

Target:
private void showNearbyPages(NearbyResult result) { getActivity().invalidateOptionsMenu(); if (currentLocation != null) { sortByDistance(result.getList()); } adapter.clear(); addResultsToAdapter(result.getList()); compassViews.clear(); mMarkerList.clear(); mapView.clear(); nearbyListContainer.setVisibility(adapter.getCount() == 0 ? View.GONE : View.VISIBLE); for (int i = 0; i < adapter.getCount(); i++) { NearbyPage item = adapter.getItem(i); Location location = item.getLocation(); Marker marker = new CustomMarker(mapView, item.getTitle(), item.getDescription(), new LatLng(location.getLatitude(), location.getLongitude())); marker.setIcon(mMarkerIconPassive); marker.setRelatedObject(item); marker.setHotspot(Marker.HotspotPlace.BOTTOM_CENTER); mMarkerList.add(marker); } mapView.addMarkers(mMarkerList); }
Source:
<code>private Object findFilterTarget(String filterTargetName, EvaluationContext ctx, MethodInvocation mi) { Object filterTarget = null; if (filterTargetName.length() > 0) { filterTarget = ctx.lookupVariable(filterTargetName); if (filterTarget == null) { throw new IllegalArgumentException( "Filter target was null, or no argument with name " + filterTargetName + " found in method"); } } else if (mi.getArguments().length == 1) { Object arg = mi.getArguments()[0]; if (arg.getClass().isArray() || arg instanceof Collection<?>) { filterTarget = arg; } if (filterTarget == null) { throw new IllegalArgumentException( "A PreFilter expression was set but the method argument type" + arg.getClass() + " is not filterable"); } } else if (mi.getArguments().length > 1) { throw new IllegalArgumentException( <START> "Unable to define the method argument for filtering. Specify the filter target."); <END> } if (filterTarget.getClass().isArray()) { throw new IllegalArgumentException( "Pre-filtering on array types is not supported. " + "Using a Collection will solve this problem"); } return filterTarget; }</code><technical_language>I error message a word "define" imply else. instead do "decide", "determine", "locate"? suggestion "Unable determine method argument for filtering. filter target.");</technical_language>

Target:
private Object findFilterTarget(String filterTargetName, EvaluationContext ctx, MethodInvocation mi) { Object filterTarget = null; if (filterTargetName.length() > 0) { filterTarget = ctx.lookupVariable(filterTargetName); if (filterTarget == null) { throw new IllegalArgumentException( "Filter target was null, or no argument with name " + filterTargetName + " found in method"); } } else if (mi.getArguments().length == 1) { Object arg = mi.getArguments()[0]; if (arg.getClass().isArray() || arg instanceof Collection<?>) { filterTarget = arg; } if (filterTarget == null) { throw new IllegalArgumentException( "A PreFilter expression was set but the method argument type" + arg.getClass() + " is not filterable"); } } else if (mi.getArguments().length > 1) { throw new IllegalArgumentException( "Unable to determine the method argument for filtering. Specify the filter target."); } if (filterTarget.getClass().isArray()) { throw new IllegalArgumentException( "Pre-filtering on array types is not supported. " + "Using a Collection will solve this problem"); } return filterTarget; }
Source:
<code><START> public String getConstraintName() { <END> return constraintName != null ? constraintName.getSimple() : null; }</code><technical_language>return Optional<String> avoid nullable result</technical_language>

Target:
public Optional<String> getConstraintName() { String ret = constraintName != null ? constraintName.getSimple() : null; return Optional.ofNullable(ret); }
Source:
<code>public void saveConfiguration(CronTaskConfigurationDto configuration) throws Exception { logger.debug("CronTaskConfigurationService.saveConfiguration()"); Class c = Class.forName(configuration.getProperty("jobClass")); Object classInstance = c.newInstance(); logger.debug("> " + c.getSuperclass().getCanonicalName()); if (!(classInstance instanceof AbstractCronJob)) { throw new CronTaskException(c + " does not extend " + AbstractCronJob.class); } if (!configuration.isOneTimeExecution()) { cronTaskDataService.save(configuration); } cronJobSchedulerService.scheduleJob(configuration); if (configuration.isOneTimeExecution() || configuration.shouldExecuteImmediately()) { <START> cronJobSchedulerService.executeJob(configuration); <END> } cronTaskEventListenerRegistry.dispatchCronTaskCreatedEvent(configuration.getName()); }</code><technical_language>above, isOneTimeExecution executed right away</technical_language>

Target:
public void saveConfiguration(CronTaskConfigurationDto configuration) throws Exception { logger.debug("CronTaskConfigurationService.saveConfiguration()"); cronTaskDataService.save(configuration); if (configuration.contains("jobClass")) { cronJobSchedulerService.scheduleJob(configuration); } cronTaskEventListenerRegistry.dispatchCronTaskCreatedEvent(configuration.getName()); }
Source:
<code>void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item) { holder.value.setText(Formatter.formatShortFileSize(context, item.totalDownloadSize) <START> + "/" <END> + String.format(Locale.getDefault(), "%d%s", item.episodesDownloadCount, context.getString(R.string.episodes_suffix))); }</code><technical_language>please replace this middle dot space characters, eg.</technical_language>

Target:
void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item) { holder.value.setText(Formatter.formatShortFileSize(context, item.totalDownloadSize) + " • " + String.format(Locale.getDefault(), "%d%s", item.episodesDownloadCount, context.getString(R.string.episodes_suffix))); }
Source:
<code>void onConferenceCallInvited(Call incomingCall) { if (destination == null) { sipCall.setConference(incomingCall.getConference()); boolean useTranslator = incomingCall.getProtocolProvider() .getAccountID().getAccountPropertyBoolean( ProtocolProviderFactory.USE_TRANSLATOR_IN_CONFERENCE, false); CallPeer peer = incomingCall.getCallPeers().next(); if (useTranslator && !addSsrcRewriter(peer)) { peer.addCallPeerListener(new CallPeerAdapter() { @Override public void peerStateChanged(CallPeerChangeEvent evt) { CallPeer peer = evt.getSourceCallPeer(); CallPeerState peerState = peer.getState(); if (CallPeerState.CONNECTED.equals(peerState)) { peer.removeCallPeerListener(this); addSsrcRewriter(peer); } } }); } } <START> logger.info("JVB conference call IN_PROGRESS " <END> + callContext.getRoomName()); Exception error = this.onConferenceCallStarted(incomingCall); if (error != null) { logger.error(error, error); } }</code><technical_language>I understand this means, source code. IN_PROGRESS refer a CallState, is this necessarily state of call? Please, improve log message</technical_language>

Target:
void onConferenceCallInvited(Call incomingCall) { if (destination == null) { incomingCall.setConference(sipCall.getConference()); boolean useTranslator = incomingCall.getProtocolProvider() .getAccountID().getAccountPropertyBoolean( ProtocolProviderFactory.USE_TRANSLATOR_IN_CONFERENCE, false); CallPeer peer = incomingCall.getCallPeers().next(); if (useTranslator && !addSsrcRewriter(peer)) { peer.addCallPeerListener(new CallPeerAdapter() { @Override public void peerStateChanged(CallPeerChangeEvent evt) { CallPeer peer = evt.getSourceCallPeer(); CallPeerState peerState = peer.getState(); if (CallPeerState.CONNECTED.equals(peerState)) { peer.removeCallPeerListener(this); addSsrcRewriter(peer); } } }); } } Exception error = this.onConferenceCallStarted(incomingCall); if (error != null) { logger.error(error, error); } }
Source:
<code>public boolean equals(Object obj) { <START> return (obj instanceof DisableDepthWriting) && this.enabled == ((DisableDepthWriting) obj).enabled; <END> }</code><technical_language>This is example of changes kind of track. I appreciate want change right away. a structuring-the-PR point of view a commit focused a goal note unnecessary changes for a commit</technical_language>

Target:
public boolean equals(Object obj) { return (obj instanceof DisableDepthWriting); }
Source:
<code>public void labelClicked(LabelEntity label) { if (label == quitButton) { System.exit(0); } if (label == loadGameButton) { Optional<GameInformation> gi = GameInformation.load(); if (gi.isPresent()) { Engine engine = Engine.getInstance(); engine.setScene(new StoreScene(scene, gi.get())); <START> } <END> } if (label == startButton) { Engine engine = Engine.getInstance(); engine.setScene(new PlayScene(engine.getScene().scene)); } }</code><technical_language>do if load fails? display screen</technical_language>

Target:
public void labelClicked(LabelEntity label) { if (label == quitButton) { System.exit(0); } if (label == loadGameButton) { Optional<GameInformation> gi = GameInformation.load(); if (gi.isPresent()) { Engine engine = Engine.getInstance(); engine.setScene(new StoreScene(scene, gi.get())); } else { loadGameButton.setText("LOAD GAME (failed)"); } } if (label == startButton) { Engine engine = Engine.getInstance(); engine.setScene(new PlayScene(engine.getScene().scene)); } }
Source:
<code>public NullnessStubfileTest(List<File> testFiles) { super( testFiles, org.checkerframework.checker.nullness.NullnessChecker.class, "nullness", "-Anomsgtext", "-AstubWarnIfNotFound", "-Astubs=" + "tests/nullness-stubfile/stubfile1.astub:" <START> + "tests/nullness-stubfile/stubfile2.astub:"); <END> }</code><technical_language>trailing colon necessary longer</technical_language>

Target:
public NullnessStubfileTest(List<File> testFiles) { super( testFiles, org.checkerframework.checker.nullness.NullnessChecker.class, "nullness", "-Anomsgtext", "-AstubWarnIfNotFound", "-Astubs=" + "tests/nullness-stubfile/stubfile1.astub:" + "tests/nullness-stubfile/stubfile2.astub"); }
Source:
<code>private void putDepositionOnZenodo(DepositsApi depositApi, DepositMetadata depositMetadata, int depositionID) { NestedDepositMetadata nestedDepositMetadata = new NestedDepositMetadata(); nestedDepositMetadata.setMetadata(depositMetadata); try { depositApi.putDeposit(depositionID, nestedDepositMetadata); } catch (ApiException e) { <START> LOG.error("Could not put deposition metadata on Zenodo. Error is " + e.getMessage()); <END> throw new CustomWebApplicationException("Could not put deposition metadata on Zenodo." + " Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } }</code><technical_language>Please log exception a parameter</technical_language>

Target:
private void putDepositionOnZenodo(DepositsApi depositApi, DepositMetadata depositMetadata, int depositionID) { NestedDepositMetadata nestedDepositMetadata = new NestedDepositMetadata(); nestedDepositMetadata.setMetadata(depositMetadata); try { depositApi.putDeposit(depositionID, nestedDepositMetadata); } catch (ApiException e) { LOG.error("Could not put deposition metadata on Zenodo. Error is " + e.getMessage(), e); throw new CustomWebApplicationException("Could not put deposition metadata on Zenodo." + " Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } }
Source:
<code>protected boolean shouldSkip() { String scheme = new AlluxioURI(InstancedConfiguration.defaults() <START> .get(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS)).getScheme(); <END> if (scheme == null || !scheme.startsWith("hdfs")) { System.out.format("Root underFS is not HDFS. Skipping validation for HDFS properties.%n"); return true; } return false; }</code><technical_language>InstancedConfiguration.defaults() expensive. I recommend creating configuration object JVM startup passing this function</technical_language>

Target:
protected boolean shouldSkip() { String scheme = new AlluxioURI(mConf.get(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS)) .getScheme(); if (scheme == null || !scheme.startsWith("hdfs")) { System.out.format("Root underFS is not HDFS. Skipping validation for HDFS properties.%n"); return true; } return false; }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { <START> File file = new File(tempDir.getAbsoluteFile() + File.separator + "zzz"); <END> if (!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } File zipFile = new File(tempDir.getAbsolutePath() + File.separator + "bak.zip"); FileUtil.zipDir(file.getAbsolutePath(), zipFile.getAbsolutePath()); response.setHeader("Content-Type", "application/zip"); response.setHeader("Content-Length", String.valueOf(zipFile.length())); response.setHeader("Content-disposition", "attachment;filename=\"bak.zip\""); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(zipFile)); BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); IoUtil.write(bis, bos); bos.flush(); bos.close(); bis.close(); }</code><technical_language>good add (e.g., time-related) temporary file eliminate chances clash if 2+ separate users instigated a backup overlapping times. a normal file in a temporary directory, a formal temporary file (the guaranteed clash)</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String fname = request.getParameter("file"); String qs = request.getQueryString(); logger.debug("--------- Query string=" + qs); File file = new File(tempDir.getAbsoluteFile() + File.separator + fname); if (!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } File zipFile = new File(tempDir.getAbsolutePath() + File.separator + "bak.zip"); FileUtil.zipDir(file.getAbsolutePath(), zipFile.getAbsolutePath()); response.setHeader("Content-Type", "application/zip"); response.setHeader("Content-Length", String.valueOf(zipFile.length())); response.setHeader("Content-disposition", "attachment;filename=\"bak.zip\""); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(zipFile)); BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); IoUtil.write(bis, bos); bos.flush(); bos.close(); bis.close(); }
Source:
<code>public static boolean isEventApplier(Method method) { final boolean isAnnotated = method.isAnnotationPresent(Apply.class); if (!isAnnotated) { return false; } final Class<?>[] parameterTypes = method.getParameterTypes(); <START> final boolean hasOneParam = parameterTypes.length == NUMBER_OF_PARAMS; <END> if (!hasOneParam) { return false; } final boolean firstParamIsMessage = Message.class.isAssignableFrom(parameterTypes[EVENT_PARAM_INDEX]); final boolean returnsNothing = Void.TYPE.equals(method.getReturnType()); return firstParamIsMessage && returnsNothing; }</code><technical_language>great rename variable isParamCountValid</technical_language>

Target:
public static boolean isEventApplier(Method method) { final boolean isAnnotated = method.isAnnotationPresent(Apply.class); if (!isAnnotated) { return false; } final Class<?>[] parameterTypes = method.getParameterTypes(); final boolean paramCountValid = parameterTypes.length == NUMBER_OF_PARAMS; if (!paramCountValid) { return false; } final boolean firstParamIsMessage = Message.class.isAssignableFrom(parameterTypes[EVENT_PARAM_INDEX]); final boolean returnsNothing = Void.TYPE.equals(method.getReturnType()); return firstParamIsMessage && returnsNothing; }