auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String formatRequest(String url, Position position, String alarm) { Uri serverUrl = Uri.parse(url); Uri.Builder builder = serverUrl.buildUpon() .appendQueryParameter("id", position.getDeviceId()) .appendQueryParameter("timestamp", String.valueOf(position.getTime().getTime() / 1000)) .appendQueryParameter("lat", String.valueOf(position.getLatitude())) .appendQueryParameter("lon", String.valueOf(position.getLongitude())) .appendQueryParameter("speed", String.valueOf(position.getSpeed())) .appendQueryParameter("bearing", String.valueOf(position.getCourse())) .appendQueryParameter("altitude", String.valueOf(position.getAltitude())) .appendQueryParameter("accuracy", String.valueOf(position.getAccuracy())) .appendQueryParameter("batt", String.valueOf(position.getBattery())) <START> .appendQueryParameter("mock", String.valueOf(position.getMock())); <END> if (alarm != null) { builder.appendQueryParameter("alarm", alarm); } return builder.build().toString(); }</code><technical_language>unit tests working. Ideally update unit tests well</technical_language>

Target:
public static String formatRequest(String url, Position position, String alarm) { Uri serverUrl = Uri.parse(url); Uri.Builder builder = serverUrl.buildUpon() .appendQueryParameter("id", position.getDeviceId()) .appendQueryParameter("timestamp", String.valueOf(position.getTime().getTime() / 1000)) .appendQueryParameter("lat", String.valueOf(position.getLatitude())) .appendQueryParameter("lon", String.valueOf(position.getLongitude())) .appendQueryParameter("speed", String.valueOf(position.getSpeed())) .appendQueryParameter("bearing", String.valueOf(position.getCourse())) .appendQueryParameter("altitude", String.valueOf(position.getAltitude())) .appendQueryParameter("accuracy", String.valueOf(position.getAccuracy())) .appendQueryParameter("batt", String.valueOf(position.getBattery())); if (position.getMock()) { builder.appendQueryParameter("mock", String.valueOf(position.getMock())); } if (alarm != null) { builder.appendQueryParameter("alarm", alarm); } return builder.build().toString(); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scratch_project_details); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setUpActionBar(); programData = getIntent().getParcelableExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA); Preconditions.checkState(programData != null); if (conversionManager.isJobInProgress(programData.getId())) { onJobInProgress(); } else if (conversionManager.isJobDownloading(programData.getId())) { onJobDownloading(); } else { onJobNotInProgress(); } conversionManager.addJobViewListener(programData.getId(), this); conversionManager.addGlobalDownloadCallback(this); <START> final Activity activity = this; <END> findViewById(R.id.scratch_project_convert_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final int numberOfJobsInProgress = conversionManager.getNumberOfJobsInProgress(); if (numberOfJobsInProgress >= Constants.SCRATCH_CONVERTER_MAX_NUMBER_OF_JOBS_PER_CLIENT) { ToastUtil.showError(activity, getResources().getQuantityString( R.plurals.error_cannot_convert_more_than_x_programs, Constants.SCRATCH_CONVERTER_MAX_NUMBER_OF_JOBS_PER_CLIENT, Constants.SCRATCH_CONVERTER_MAX_NUMBER_OF_JOBS_PER_CLIENT)); return; } onJobInProgress(); Intent intent = new Intent(); intent.putExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA, (Parcelable) programData); setResult(RESULT_OK, intent); finish(); } }); loadAdditionalData(programData); }</code><technical_language>no</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scratch_project_details); setUpActionBar(); programData = getIntent().getParcelableExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA); Preconditions.checkState(programData != null); if (conversionManager.isJobInProgress(programData.getId())) { onJobInProgress(); } else if (conversionManager.isJobDownloading(programData.getId())) { onJobDownloading(); } else { onJobNotInProgress(); } conversionManager.addJobViewListener(programData.getId(), this); conversionManager.addGlobalDownloadCallback(this); findViewById(R.id.scratch_project_convert_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final int numberOfJobsInProgress = conversionManager.getNumberOfJobsInProgress(); if (numberOfJobsInProgress >= Constants.SCRATCH_CONVERTER_MAX_NUMBER_OF_JOBS_PER_CLIENT) { ToastUtil.showError(getContext(), getResources().getQuantityString( R.plurals.error_cannot_convert_more_than_x_programs, Constants.SCRATCH_CONVERTER_MAX_NUMBER_OF_JOBS_PER_CLIENT, Constants.SCRATCH_CONVERTER_MAX_NUMBER_OF_JOBS_PER_CLIENT)); return; } onJobInProgress(); Intent intent = new Intent(); intent.putExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA, (Parcelable) programData); setResult(RESULT_OK, intent); finish(); } }); loadAdditionalData(programData); }
Source:
<code>public void testLombokGeneratedAnnotation() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, <START> Opcodes.ACC_SYNTHETIC, "lambda$1", "()V", null, null); <END> m.visitInsn(Opcodes.NOP); m.visitInsn(Opcodes.RETURN); AnnotationNode a = new AnnotationNode("Llombok/Generated;"); m.invisibleAnnotations = Arrays.asList(a); filter.filter(m, this); assertEquals(m.instructions.getFirst(), fromInclusive); assertEquals(m.instructions.getLast(), toInclusive); }</code><technical_language>@marchof synthetic access flag name of lambda unrelated this test, I for clarity changed. Name changed for example hashCode of examples of methods Lombok generates. changed for test cases</technical_language>

Target:
public void testLombokGeneratedAnnotation() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null); m.visitAnnotation("Llombok/Generated;", false); m.visitInsn(Opcodes.ICONST_0); m.visitInsn(Opcodes.IRETURN); filter.filter(m, this); assertEquals(m.instructions.getFirst(), fromInclusive); assertEquals(m.instructions.getLast(), toInclusive); }
Source:
<code>public static Matcher<Instant> isInstant( <START> final int year, <END> final int month, final int day, final int hour, final int minute, final int second) { Preconditions.checkArgument(month > 0 && month < 13); Preconditions.checkArgument(day > 0 && day < 32); Preconditions.checkArgument(hour >= 0 && hour < 24); Preconditions.checkArgument(minute >= 0 && minute < 60); Preconditions.checkArgument(second >= 0 && second < 60); return is( equalTo( Instant.parse( String.format( "%s-%s-%sT%s:%s:%sZ", StringUtils.leftPad(String.valueOf(year), 4, '0'), StringUtils.leftPad(String.valueOf(month), 2, '0'), StringUtils.leftPad(String.valueOf(day), 2, '0'), StringUtils.leftPad(String.valueOf(hour), 2, '0'), StringUtils.leftPad(String.valueOf(minute), 2, '0'), StringUtils.leftPad(String.valueOf(second), 2, '0'))))); }</code><technical_language>Method isInstant 6 arguments (exceeds 4 allowed). Consider refactoring</technical_language>

Target:
public static Matcher<Instant> isInstant( final int year, final int month, final int day, final int hour, final int minute, final int second) { return is( equalTo( LocalDateTime.of(year, month, day, hour, minute, second).toInstant(ZoneOffset.UTC))); }
Source:
<code>public void setUp() throws IOException { <START> serverSocket = new ServerSocket(8030); <END> }</code><technical_language>Define a constant variable it</technical_language>

Target:
public void setUp() throws IOException { serverSocket = new ServerSocket(port); }
Source:
<code>public Void perform(Task task, TaskActionToolbox toolbox) throws IOException { <START> TaskActionPreconditions.checkTaskLocks(task, toolbox.getTaskLockbox(), segments); <END> toolbox.getIndexerMetadataStorageCoordinator().deleteSegments(segments); final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder() .setDimension(DruidMetrics.DATASOURCE, task.getDataSource()) .setDimension(DruidMetrics.TASK_TYPE, task.getType()); for (DataSegment segment : segments) { metricBuilder.setDimension(DruidMetrics.INTERVAL, segment.getInterval().toString()); toolbox.getEmitter().emit(metricBuilder.build("segment/nuked/bytes", segment.getSize())); } return null; }</code><technical_language>segment delete need upgraded locks</technical_language>

Target:
public Void perform(Task task, TaskActionToolbox toolbox) throws IOException { TaskActionPreconditions.checkLockCoversSegments(task, toolbox.getTaskLockbox(), segments); final List<Interval> intervals = segments.stream().map(DataSegment::getInterval).collect(Collectors.toList()); try { toolbox.getTaskLockbox().doInCriticalSection( task, intervals, CriticalAction.builder() .onValidLocks( () -> { toolbox.getIndexerMetadataStorageCoordinator().deleteSegments(segments); return null; } ) .onInvalidLocks( () -> { throw new ISE("Some locks for task[%s] are already revoked", task.getId()); } ) .build() ); } catch (Exception e) { throw new RuntimeException(e); } final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder() .setDimension(DruidMetrics.DATASOURCE, task.getDataSource()) .setDimension(DruidMetrics.TASK_TYPE, task.getType()); for (DataSegment segment : segments) { metricBuilder.setDimension(DruidMetrics.INTERVAL, segment.getInterval().toString()); toolbox.getEmitter().emit(metricBuilder.build("segment/nuked/bytes", segment.getSize())); } return null; }
Source:
<code>private Block[] getBlocksForType(Type type, int positionCount) throws IOException { RowType rowType = (RowType) type; Block[] blocks = new Block[rowType.getFields().size()]; for (int i = 0; i < rowType.getFields().size(); i++) { Optional<String> fieldName = rowType.getFields().get(i).getName(); <START> Type fieldType = rowType.getFields().get(i).getType(); <END> if (fieldName.isPresent() && structFields.containsKey(fieldName.get())) { StreamReader streamReader = structFields.get(fieldName.get()); streamReader.prepareNextRead(positionCount); blocks[i] = streamReader.readBlock(fieldType); } else { blocks[i] = getNullBlock(fieldType, positionCount); } } return blocks; }</code><technical_language>IIRC some issue case sensitivity added this feature Parquet reader. I issue Presto cases field names in type, case building structFields map in constructor. cc @nezihyigitbasi @zhenxiao for context Parquet</technical_language>

Target:
private Block[] getBlocksForType(Type type, int positionCount) throws IOException { RowType rowType = (RowType) type; Block[] blocks = new Block[rowType.getFields().size()]; for (int i = 0; i < rowType.getFields().size(); i++) { Optional<String> fieldName = rowType.getFields().get(i).getName(); Type fieldType = rowType.getFields().get(i).getType(); if (!fieldName.isPresent()) { throw new IllegalArgumentException("Missing struct field name in type " + rowType); } String lowerCaseFieldName = fieldName.get().toLowerCase(Locale.ENGLISH); StreamReader streamReader = structFields.get(lowerCaseFieldName); if (streamReader != null) { streamReader.prepareNextRead(positionCount); blocks[i] = streamReader.readBlock(fieldType); } else { blocks[i] = getNullBlock(fieldType, positionCount); } } return blocks; }
Source:
<code><START> private boolean processFetchResponse(FetchResponse fetchResponse, long tempTime) { <END> try { ByteBufferMessageSet messageBuffer = fetchResponse.messageSet(kafkaRequest.getTopic(), kafkaRequest.getPartition()); lastFetchTime = (System.currentTimeMillis() - tempTime); log.debug("Time taken to fetch : " + (lastFetchTime / 1000) + " seconds"); log.debug("The size of the ByteBufferMessageSet returned is : " + messageBuffer.sizeInBytes()); int skipped = 0; totalFetchTime += lastFetchTime; messageIter = messageBuffer.iterator(); Iterator<MessageAndOffset> messageIter2 = messageBuffer.iterator(); MessageAndOffset message = null; while (messageIter2.hasNext()) { message = messageIter2.next(); if (message.offset() < currentOffset) { skipped++; } else { log.debug("Skipped offsets till : " + message.offset()); break; } } log.debug("Number of offsets to be skipped: " + skipped); while (skipped != 0) { MessageAndOffset skippedMessage = messageIter.next(); log.debug("Skipping offset : " + skippedMessage.offset()); skipped--; } if (!messageIter.hasNext()) { System.out.println("No more data left to process. Returning false"); messageIter = null; return false; } return true; } catch (Exception e) { log.info("Exception generated during processing fetchResponse"); e.printStackTrace(); return false; } }</code><technical_language>Is this code? more lines</technical_language>

Target:
private boolean processFetchResponse(FetchResponse fetchResponse, long tempTime) { try { ByteBufferMessageSet messageBuffer = fetchResponse.messageSet(kafkaRequest.getTopic(), kafkaRequest.getPartition()); lastFetchTime = (System.currentTimeMillis() - tempTime); log.debug("Time taken to fetch : " + (lastFetchTime / 1000) + " seconds"); log.debug("The size of the ByteBufferMessageSet returned is : " + messageBuffer.sizeInBytes()); int skipped = 0; totalFetchTime += lastFetchTime; messageIter = messageBuffer.iterator(); Iterator<MessageAndOffset> messageIter2 = messageBuffer.iterator(); MessageAndOffset message = null; while (messageIter2.hasNext()) { message = messageIter2.next(); if (message.offset() < currentOffset) { skipped++; } else { log.debug("Skipped offsets till : " + message.offset()); break; } } log.debug("Number of offsets to be skipped: " + skipped); while (skipped != 0) { MessageAndOffset skippedMessage = messageIter.next(); log.debug("Skipping offset : " + skippedMessage.offset()); skipped--; } if (!messageIter.hasNext()) { System.out.println("No more data left to process. Returning false"); messageIter = null; return false; } return true; } catch (Exception e) { log.info("Exception generated during processing fetchResponse"); return false; } }
Source:
<code>public static void main(String[] args) { try { CommandLine cl = parseCommandLine(args); Jpg2Dcm jpg2Dcm = new Jpg2Dcm(); jpg2Dcm.keys = configureKeys(jpg2Dcm, cl); LOG.info("added keys for coercion: \n" + jpg2Dcm.keys.toString()); jpg2Dcm.metadataFile = cl.getOptionValue("f"); if (cl.getArgs().length < 2) throw new MissingArgumentException("Either input pixel data file or output binary file is missing. See example in jpg2dcm help."); jpg2Dcm.pixelDataFile = new File(cl.getArgs()[0]); Extension ext = getExt(jpg2Dcm.pixelDataFile.getName()); jpg2Dcm.noAPPn = Boolean.valueOf(cl.getOptionValue("na")); Attributes metadata = getMetadata(jpg2Dcm, ext); @SuppressWarnings("rawtypes") File dcmFile = new File(cl.getArgs()[1]); long start = System.currentTimeMillis(); jpg2Dcm.convert(metadata, jpg2Dcm, dcmFile); long fin = System.currentTimeMillis(); LOG.info("Encapsulated " + jpg2Dcm.pixelDataFile + " to " + dcmFile.getPath() + " in " + (fin - start) + "ms."); <START> } catch (Exception e) { <END> LOG.error("Error: \n", e); e.printStackTrace(); } }</code><technical_language>if a ParseException is thrown output "usage" message e.g. storescu tool does: System.err.println("jpg2dcm: " + e.getMessage()); System.err.println(rb.getString("usage")); System.exit(2);</technical_language>

Target:
public static void main(String[] args) { try { CommandLine cl = parseCommandLine(args); Jpg2Dcm jpg2Dcm = new Jpg2Dcm(); jpg2Dcm.keys = configureKeys(jpg2Dcm, cl); LOG.info("added keys for coercion: \n" + jpg2Dcm.keys.toString()); jpg2Dcm.metadataFile = cl.getOptionValue("f"); if (cl.getArgs().length < 2) throw new MissingArgumentException("Either input pixel data file or output binary file is missing. See example in jpg2dcm help."); jpg2Dcm.pixelDataFile = new File(cl.getArgs()[0]); Extension ext = getExt(jpg2Dcm.pixelDataFile.getName()); jpg2Dcm.noAPPn = Boolean.valueOf(cl.getOptionValue("na")); Attributes metadata = getMetadata(jpg2Dcm, ext); @SuppressWarnings("rawtypes") File dcmFile = new File(cl.getArgs()[1]); long start = System.currentTimeMillis(); jpg2Dcm.convert(metadata, jpg2Dcm, dcmFile); long fin = System.currentTimeMillis(); LOG.info("Encapsulated " + jpg2Dcm.pixelDataFile + " to " + dcmFile.getPath() + " in " + (fin - start) + "ms."); } catch (ParseException e) { System.err.println("jpg2dcm: " + e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { LOG.error("Error: \n", e); e.printStackTrace(); System.exit(2); } }
Source:
<code>private FastForwardMode getFastForwardMode() { Config config = repo.getConfig(); Merge ffMode = config.getEnum(Merge.values(), ConfigConstants.CONFIG_PULL_SECTION, null, ConfigConstants.CONFIG_KEY_FF, null); if (ffMode == null) { ffMode = config.getEnum(Merge.values(), ConfigConstants.CONFIG_MERGE_SECTION, null, <START> ConfigConstants.CONFIG_KEY_FF, null); <END> } return ffMode != null ? FastForwardMode.valueOf(ffMode) : null; }</code><technical_language>Do need this? MergeCommand fall config... if checking for pull.ff sufficient here</technical_language>

Target:
private FastForwardMode getFastForwardMode() { Config config = repo.getConfig(); Merge ffMode = config.getEnum(Merge.values(), ConfigConstants.CONFIG_PULL_SECTION, null, ConfigConstants.CONFIG_KEY_FF, null); return ffMode != null ? FastForwardMode.valueOf(ffMode) : null; }
Source:
<code>static ChecksumType.Type toBlobChecksumType(final String checksumType) { if (Guard.isStringNullOrEmpty(checksumType)) { return ChecksumType.Type.NONE; } switch (checksumType) { case "CRC_32": <START> return ChecksumType.Type.CRC_32; <END> case "CRC_32C": return ChecksumType.Type.CRC_32C; case "MD5": return ChecksumType.Type.MD5; case "SHA_256": return ChecksumType.Type.SHA_256; case "SHA_512": return ChecksumType.Type.SHA_512; case "": return ChecksumType.Type.NONE; default: throw new IllegalArgumentException(String.format("Unknown value for header '%s': '%s'", BLOB_CHECKSUM_TYPE_HEADER, checksumType)); } }</code><technical_language>able built in ChecksumType.Type.valueOf(checksumType) method do this logic</technical_language>

Target:
static ChecksumType.Type toBlobChecksumType(final String checksumType) { if (Guard.isStringNullOrEmpty(checksumType)) { return ChecksumType.Type.NONE; } return ChecksumType.Type.valueOf(checksumType); }
Source:
<code>public void actionPerformed(ActionEvent event) { try { getOAuthClientFacade().requestAccessToken(target); } catch (InvalidOAuthParametersException e) { <START> UISupport.showErrorMessage("Invalid OAuth 2 parameters: " + e.getMessage()); <END> } catch (Exception e) { SoapUI.logError(e, "Error retrieving OAuth 2 access token"); UISupport.showErrorMessage("Could not retrieve access token. Check the SoapUI log for details"); } }</code><technical_language>Move bundle</technical_language>

Target:
public void actionPerformed(ActionEvent event) { try { getOAuthClientFacade().requestAccessToken(target); } catch (InvalidOAuthParametersException e) { UISupport.showErrorMessage(messages.get("GetOAuthAccessTokenAction.Error.InvalidParameters", e.getMessage())); } catch (Exception e) { SoapUI.logError(e, messages.get("GetOAuthAccessTokenAction.Error.RetrievingFailLog")); UISupport.showErrorMessage(messages.get("GetOAuthAccessTokenAction.Error.RetrievingFailMessage")); } }
Source:
<code>private DataSource loadDataSource(String dataSourceName) { DataSourceProvider dataSourceProvider = serviceLoaderInstance.get().onlyOne(DataSourceProvider.class); if(dataSourceProvider != null) { return dataSourceProvider.lookupDataSource(dataSourceName); } <START> return serviceLoaderInstance.get().onlyOne(DefaultDataSourceProvider.class).lookupDataSource(dataSourceName); <END> }</code><technical_language>drop DefaultDataSourceProvider Service interface simply replace serviceLoader.onlyOne(DataSourceProvider.class, JndiDataSourceProvider.class). JndiDataSourceProvider if other DataSourceProvider is</technical_language>

Target:
private DataSource loadDataSource(String dataSourceName) { DataSourceProvider dataSourceProvider = serviceLoaderInstance.get() .onlyOne(DataSourceProvider.class, JndiDataSourceProvider.class); return dataSourceProvider.lookupDataSource(dataSourceName); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector()); mMapView.setMap(map); mShapefileFeatureTable = new ShapefileFeatureTable( getExternalFilesDir(null) + getString(R.string.shapefile_path)); mShapefileFeatureTable.loadAsync(); mShapefileFeatureTable.addDoneLoadingListener(() -> { if (mShapefileFeatureTable.getLoadStatus() == LoadStatus.LOADED) { <START> FeatureLayer shapefileFeatureLayer = new FeatureLayer(mShapefileFeatureTable); <END> mMapView.getMap().getOperationalLayers().add(shapefileFeatureLayer); mMapView.setViewpointAsync(new Viewpoint(shapefileFeatureLayer.getFullExtent())); } else { String error = "Shapefile feature table failed to load: " + mShapefileFeatureTable.getLoadError().toString(); Toast.makeText(MainActivity.this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); }</code><technical_language>I move this out of done loading listener, table in scope</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector()); mMapView.setMap(map); ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable( getExternalFilesDir(null) + getString(R.string.shapefile_path)); FeatureLayer shapefileFeatureLayer = new FeatureLayer(shapefileFeatureTable); mMapView.getMap().getOperationalLayers().add(shapefileFeatureLayer); shapefileFeatureTable.addDoneLoadingListener(() -> { if (shapefileFeatureTable.getLoadStatus() == LoadStatus.LOADED) { mMapView.setViewpointAsync(new Viewpoint(shapefileFeatureLayer.getFullExtent())); } else { String error = "Shapefile feature table failed to load: " + shapefileFeatureTable.getLoadError().toString(); Toast.makeText(MainActivity.this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); }
Source:
<code>public void rebaseEdit() throws Exception { assertEquals(RefUpdate.Result.NEW, modifier.createEdit( change, ps)); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( editUtil.byChange(change).get(), FILE_NAME, CONTENT_NEW)); ChangeEdit edit = editUtil.byChange(change).get(); PatchSet current = getCurrentPatchSet(changeId); assertEquals(current.getPatchSetId() - 1, edit.getBasePatchSet().getPatchSetId()); Date beforeRebase = edit.getEditCommit().getCommitterIdent().getWhen(); <START> Thread.sleep(1000L); <END> modifier.rebaseEdit(edit, current); edit = editUtil.byChange(change).get(); assertArrayEquals(CONTENT_NEW, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME))); assertArrayEquals(CONTENT_NEW2, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME2))); assertEquals(current.getPatchSetId(), edit.getBasePatchSet().getPatchSetId()); Date afterRebase = edit.getEditCommit().getCommitterIdent().getWhen(); assertFalse(beforeRebase.equals(afterRebase)); }</code><technical_language>Please please do this. needs read timestamp TimeUtil. ChangeNotesTest#setTimeForTesting() for stub this out in a test</technical_language>

Target:
public void rebaseEdit() throws Exception { assertEquals(RefUpdate.Result.NEW, modifier.createEdit( change, ps)); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( editUtil.byChange(change).get(), FILE_NAME, CONTENT_NEW)); ChangeEdit edit = editUtil.byChange(change).get(); PatchSet current = getCurrentPatchSet(changeId); assertEquals(current.getPatchSetId() - 1, edit.getBasePatchSet().getPatchSetId()); Date beforeRebase = edit.getEditCommit().getCommitterIdent().getWhen(); modifier.rebaseEdit(edit, current); edit = editUtil.byChange(change).get(); assertArrayEquals(CONTENT_NEW, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME))); assertArrayEquals(CONTENT_NEW2, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME2))); assertEquals(current.getPatchSetId(), edit.getBasePatchSet().getPatchSetId()); Date afterRebase = edit.getEditCommit().getCommitterIdent().getWhen(); assertFalse(beforeRebase.equals(afterRebase)); }
Source:
<code>private void logAuditMessages(List<GlusterBrickEntity> bricks) { GlusterAuditLogUtil logUtil = GlusterAuditLogUtil.getInstance(); <START> for (final GlusterBrickEntity brick : bricks) { <END> logUtil.logAuditMessage(null, null, null, AuditLogType.GLUSTER_VOLUME_BRICK_ADDED, new HashMap<String, String>() { { put(GlusterConstants.BRICK_PATH, brick.getBrickDirectory()); put(GlusterConstants.SERVERE_NAME, brick.getServerName()); put(GlusterConstants.VOLUME_NAME, getGlusterVolumeName()); } }); } }</code><technical_language>long brick list? if server crashes in middle? a partial list in db. done in single transaction</technical_language>

Target:
private void logAuditMessages(List<GlusterBrickEntity> bricks) { GlusterAuditLogUtil logUtil = GlusterAuditLogUtil.getInstance(); for (final GlusterBrickEntity brick : bricks) { logUtil.logAuditMessage(null, null, null, AuditLogType.GLUSTER_VOLUME_BRICK_ADDED, new HashMap<String, String>() { { put(GlusterConstants.BRICK_PATH, brick.getBrickDirectory()); put(GlusterConstants.SERVER_NAME, brick.getServerName()); put(GlusterConstants.VOLUME_NAME, getGlusterVolumeName()); } }); } }
Source:
<code>public LogCommand log() { <START> return (new LogCommand(this)); <END> }</code><technical_language>style: extra parentheses</technical_language>

Target:
public LogCommand log() { return new LogCommand(this); }
Source:
<code>public void findByUndefinedSchema() throws Exception { <START> context.turnOffAuthorisationSystem(); <END> getClient().perform(get("/api/core/metadatafields/search/bySchema") .param("schema", "undefined")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", is(0))); }</code><technical_language>I Auth system remain in this method</technical_language>

Target:
public void findByUndefinedSchema() throws Exception { getClient().perform(get("/api/core/metadatafields/search/bySchema") .param("schema", "undefined")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", is(0))); }
Source:
<code>public void run(int count, int warmupCount) throws Exception { List<Tuple<String, double[]>> benchmarksResults = new ArrayList<Tuple<String, double[]>>(benchmarkableList.size()); <START> for (Benchmarkable benchmark : benchmarkableList) { <END> double[] durations = new double[count]; for (int i = 0; i < count + warmupCount; i++) { if (i >= warmupCount) { System.gc(); } long currentTimeNanos = System.nanoTime(); benchmark.run(); if (i >= warmupCount) { durations[i - warmupCount] = (System.nanoTime() - currentTimeNanos) / 1000000.0; } } benchmarksResults.add(new Tuple<String, double[]>(benchmark.label, durations)); } for (Tuple<String, double[]> benchmarkResult : benchmarksResults) { printStat(benchmarkResult.first, benchmarkResult.second); } }</code><technical_language>order of running programs affects performance results in JVM. Simply running System.gc() warmup is sufficient</technical_language>

Target:
public void run(int count, int warmupCount) throws Exception { List<Tuple<String, double[]>> benchmarksResults = new ArrayList<Tuple<String, double[]>>(benchmarkableList.size()); for (Benchmarkable benchmark : benchmarkableList) { benchmarksResults.add(new Tuple<String, double[]>(benchmark.label, new double[count])); } for (int i = 0; i < count + warmupCount; i++) { for (int bi = 0; bi < benchmarkableList.size(); bi++) { Benchmarkable benchmark = benchmarkableList.get(bi); long currentTimeNanos = System.nanoTime(); benchmark.run(); if (i >= warmupCount) { benchmarksResults.get(bi).second[i - warmupCount] = (System.nanoTime() - currentTimeNanos) / 1000000.0; } } } for (Tuple<String, double[]> benchmarkResult : benchmarksResults) { printStat(benchmarkResult.first, benchmarkResult.second); } }
Source:
<code>private Collection<CommandImpl> resolve(ChePlugin chePlugin) { List<CheContainer> containers = chePlugin.getContainers(); String pluginRef = chePlugin.getId() + ":" + chePlugin.getVersion(); Collection<CommandImpl> pluginsCommands = pluginRefToCommand.removeAll(pluginRef); if (pluginsCommands.isEmpty()) { return emptyList(); } if (containers.isEmpty()) { k8sEnvironment .getWarnings() .add( new WarningImpl( 44012, format( "There are configured commands for plugin '%s' that doesn't have any containers", pluginRef))); return emptyList(); } if (containers.size() > 1) { k8sEnvironment .getWarnings() .add( new WarningImpl( <START> 44013, <END> format( "There are configured commands for plugin '%s' that has multiply containers. Commands will be configured to be run in first container", pluginRef))); } return pluginsCommands; }</code><technical_language>elaborate choose magic numbers for error codes></technical_language>

Target:
private Collection<CommandImpl> resolve(ChePlugin chePlugin) { List<CheContainer> containers = chePlugin.getContainers(); String pluginRef = chePlugin.getId() + ":" + chePlugin.getVersion(); Collection<CommandImpl> pluginsCommands = pluginRefToCommand.removeAll(pluginRef); if (pluginsCommands.isEmpty()) { return emptyList(); } if (containers.isEmpty()) { k8sEnvironment .getWarnings() .add( new WarningImpl( Warnings.COMMAND_IS_CONFIGURED_IN_PLUGIN_WITHOUT_CONTAINERS_WARNING_CODE, format( Warnings .COMMAND_IS_CONFIGURED_IN_PLUGIN_WITHOUT_CONTAINERS_WARNING_MESSAGE_FMT, pluginRef))); return emptyList(); } if (containers.size() > 1) { k8sEnvironment .getWarnings() .add( new WarningImpl( Warnings.COMMAND_IS_CONFIGURED_IN_PLUGIN_WITH_MULTIPLY_CONTAINERS_WARNING_CODE, format( Warnings .COMMAND_IS_CONFIGURED_IN_PLUGIN_WITH_MULTIPLY_CONTAINERS_WARNING_MESSAGE_FMT, pluginRef))); } return pluginsCommands; }
Source:
<code>public PsiElement setName(@NotNull String name) throws IncorrectOperationException { checkSetName(name); final PsiElement oldName = getNameIdentifier(); <START> assert oldName != null; <END> PsiElement newName = GLSLPsiElementFactory.createLeafElement(getProject(), name); getNode().replaceChild(oldName.getNode(), newName.getNode()); return null; }</code><technical_language>Please replace this assert more graceful, return null, return null, matter seems. log though, if curious explode</technical_language>

Target:
public PsiElement setName(@NotNull String name) throws IncorrectOperationException { checkSetName(name); final PsiElement oldName = getNameIdentifier(); assert oldName != null; PsiElement newName = GLSLPsiElementFactory.createLeafElement(getProject(), name); getNode().replaceChild(oldName.getNode(), newName.getNode()); return this; }
Source:
<code><START> public void testUnaryFunctionsParsingUnsuccessful() throws Exception { <END> for (String function : unaryFunctions) { testFunctionParsingUnsuccessful(function, failingUnaryFunctionExpressions); } }</code><technical_language>Exception is thrown in method</technical_language>

Target:
public void testUnaryFunctionsParsingUnsuccessful() { for (String function : unaryFunctions) { testFunctionParsingUnsuccessful(function, failingUnaryFunctionExpressions); } }
Source:
<code><START> void destroyDOMElementResources() { <END> for (GridColumn<?> column : model.getColumns()) { if (column.getColumnRenderer() instanceof HasDOMElementResources) { ((HasDOMElementResources) column.getColumnRenderer()).destroyResources(); } } }</code><technical_language>Is this package private intentional? I tests</technical_language>

Target:
private void destroyDOMElementResources() { for (GridColumn<?> column : model.getColumns()) { if (column.getColumnRenderer() instanceof HasDOMElementResources) { ((HasDOMElementResources) column.getColumnRenderer()).destroyResources(); } } }
Source:
<code>public void testPrepareStepExecutionTableWithoutExitDescription() { final JobExecution jobExecution = new JobExecution(1L, null, "hello"); jobExecution.getJobConfigurationName(); final StepExecution stepExecution = new StepExecution("coolStep", jobExecution, 333L); final Date startTime = new DateTime(2014, 05, 01, 15, 0).toDate(); final Date endTime = new DateTime(2014, 05, 01, 15, 1).toDate(); final Date lastUpdated = new DateTime(2014, 05, 05, 1, 0).toDate(); stepExecution.setStartTime(startTime); stepExecution.setEndTime(endTime); stepExecution.setLastUpdated(lastUpdated); stepExecution.setStatus(BatchStatus.COMPLETED); stepExecution.setExitStatus(ExitStatus.COMPLETED); final StepExecutionInfoResource stepExecutionInfoResource = new StepExecutionInfoResource(444L, stepExecution); final Table table = JobCommandsUtils.prepareStepExecutionTable(stepExecutionInfoResource); <START> assertEquals("Exit Description", table.getRows().get(18).getValue(1)); <END> assertEquals("N/A", table.getRows().get(18).getValue(2)); }</code><technical_language>anal, want check values</technical_language>

Target:
public void testPrepareStepExecutionTableWithoutExitDescription() { final JobExecution jobExecution = new JobExecution(1L, null, "hello"); jobExecution.getJobConfigurationName(); final StepExecution stepExecution = new StepExecution("coolStep", jobExecution, 333L); final Date startTime = new DateTime(2014, 05, 01, 15, 0).toDate(); final Date endTime = new DateTime(2014, 05, 01, 15, 1).toDate(); final Date lastUpdated = new DateTime(2014, 05, 05, 1, 0).toDate(); stepExecution.setStartTime(startTime); stepExecution.setEndTime(endTime); stepExecution.setLastUpdated(lastUpdated); stepExecution.setStatus(BatchStatus.COMPLETED); stepExecution.setExitStatus(ExitStatus.COMPLETED); final StepExecutionInfoResource stepExecutionInfoResource = new StepExecutionInfoResource(444L, stepExecution); final Table table = JobCommandsUtils.prepareStepExecutionTable(stepExecutionInfoResource); assertEquals("Exit Description", table.getRows().get(17).getValue(1)); assertEquals("N/A", table.getRows().get(17).getValue(2)); }
Source:
<code>public String toString() { String lower = this.lowerBound.getValue().map(Object::toString).map(it -> { <START> if (this.lowerBound.isInclusive()) { <END> return "[".concat(it); } return "(".concat(it); }).orElse("unbounded"); String upper = this.upperBound.getValue().map(Object::toString).map(it -> { if (this.upperBound.isInclusive()) { return it.concat("]"); } return it.concat(")"); }).orElse("unbounded"); return String.format("%s-%s", lower, upper); }</code><technical_language>Ternary if? this a package protected getPrefix()/getSuffix() method Bound</technical_language>

Target:
public String toString() { return String.format("%s-%s", lowerBound.toPrefixString(), upperBound.toSuffixString()); }
Source:
<code>protected Runnable getSessionTask() { <START> return new Runnable() { <END> @Override public void run() { sessions.pulse(); } }; }</code><technical_language>earlier. Also, I code in a private class purpose. exceptions thrown, easier pick out named classes anonymous class names autogenerated</technical_language>

Target:
protected Runnable getSessionTask() { return sesionTask; }
Source:
<code>private Optional<Response> checkProducerSequence( final HttpServletRequest req, final String responseContentType, final ObjectMapper responseMapper ) { final String producerId = req.getHeader("X-Firehose-Producer-Id"); if (producerId == null) { return Optional.empty(); } final String sequenceValue = req.getHeader("X-Firehose-Producer-Seq"); if (sequenceValue == null) { return Optional.of( Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", "Producer sequence value is missing")) .build() ); } Long producerSequence = producerSequences.computeIfAbsent(producerId, key -> Long.MIN_VALUE); try { Long newSequence = Long.parseLong(sequenceValue); if (newSequence <= producerSequence) { return Optional.of( Response.ok( responseMapper.writeValueAsString( ImmutableMap.of("eventCount", 0, "skipped", true) ), responseContentType ).build() ); } <START> producerSequences.put(producerId, newSequence); <END> } catch (JsonProcessingException ex) { throw Throwables.propagate(ex); } catch (NumberFormatException ex) { return Optional.of( Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", "Producer sequence must be a number")) .build() ); } return Optional.empty(); }</code><technical_language>typically in this kind of design, I expect sequence numbers sequential i.e. incrementing is possibility of missing a batch either</technical_language>

Target:
private Optional<Response> checkProducerSequence( final HttpServletRequest req, final String responseContentType, final ObjectMapper responseMapper ) { final String producerId = req.getHeader("X-Firehose-Producer-Id"); if (producerId == null) { return Optional.empty(); } final String sequenceValue = req.getHeader("X-Firehose-Producer-Seq"); if (sequenceValue == null) { return Optional.of( Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", "Producer sequence value is missing")) .build() ); } Long producerSequence = producerSequences.computeIfAbsent(producerId, key -> Long.MIN_VALUE); if (producerSequences.size() >= MAX_FIREHOSE_PRODUCERS) { return Optional.of( Response.status(Response.Status.FORBIDDEN) .entity( ImmutableMap.<String, Object>of( "error", "Too many individual producer IDs for this firehose. Max is " + MAX_FIREHOSE_PRODUCERS ) ) .build() ); } try { Long newSequence = Long.parseLong(sequenceValue); if (newSequence <= producerSequence) { return Optional.of( Response.ok( responseMapper.writeValueAsString( ImmutableMap.of("eventCount", 0, "skipped", true) ), responseContentType ).build() ); } producerSequences.put(producerId, newSequence); } catch (JsonProcessingException ex) { throw Throwables.propagate(ex); } catch (NumberFormatException ex) { return Optional.of( Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", "Producer sequence must be a number")) .build() ); } return Optional.empty(); }
Source:
<code>protected void mapAndProcess(Object eventObject, InputEventHandler inputEventHandler) throws InterruptedException { <START> synchronized (this) { <END> Object convertedEvent; convertedEvent = convertToEvent(eventObject); if (convertedEvent != null) { if (convertedEvent instanceof Event[]) { inputEventHandler.sendEvents((Event[]) convertedEvent); } else { inputEventHandler.sendEvent((Event) convertedEvent); } } } }</code><technical_language>synchonize</technical_language>

Target:
protected void mapAndProcess(Object eventObject, InputEventHandler inputEventHandler) throws InterruptedException { Object convertedEvent; convertedEvent = convertToEvent(eventObject); if (convertedEvent != null) { if (convertedEvent instanceof Event[]) { inputEventHandler.sendEvents((Event[]) convertedEvent); } else { inputEventHandler.sendEvent((Event) convertedEvent); } } }
Source:
<code>private static List<Rule> getRules(VElement renderable) { <START> final HashMap<Class<? extends Rule>, Rule> rules = new HashMap<Class<? extends Rule>, Rule>(); <END> for (final VAttachment attachment : renderable.getAttachments()) { if (Rule.class.isInstance(attachment)) { final Rule rule = (Rule) attachment; if (!rules.containsKey(rule.getClass())) { rules.put(rule.getClass(), rule); } } } return new ArrayList<Rule>(rules.values()); }</code><technical_language>Map interface instead</technical_language>

Target:
private static Collection<Rule> getRules(VElement renderable) { final Map<Class<? extends Rule>, Rule> rules = new HashMap<Class<? extends Rule>, Rule>(); for (final VAttachment attachment : renderable.getAttachments()) { if (Rule.class.isInstance(attachment)) { final Rule rule = (Rule) attachment; if (!rules.containsKey(rule.getClass())) { rules.put(rule.getClass(), rule); } } } return rules.values(); }
Source:
<code>private Map<String, String> extractMetadata(File src) { Reader reader = null; InputStream in = null; BufferedReader buf = null; StringBuffer log = null; Process proc = null; Map<String, String> metadata = new HashMap<String, String>(); try { List<String> cmd = new ArrayList<>(); cmd.add( command ); <START> if (src.length() > MAX_FILESIZE) { <END> cmd.add( "-api" ); cmd.add( "largefilesupport=1" ); } cmd.add( src.getAbsolutePath()); log = new StringBuffer(); ProcessBuilder pb = new ProcessBuilder(cmd); pb.redirectErrorStream(true); proc = pb.start(); in = proc.getInputStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ) { String[] pair = line.split("\\:", 2); String v = ""; if (pair.length == 2) v = StringUtils.isBlank(pair[1]) ? "" : pair[1].trim(); addMetadata(metadata, pair[0].trim(), v); } int status = proc.waitFor(); if ( status != 0 ) { in = proc.getErrorStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ) log.append( line + "\n" ); addMetadata(metadata, ERROR, log.toString()); } } catch ( Exception ex ) { ex.printStackTrace(); addMetadata(metadata, ERROR, ex.getMessage()); } finally { DAMSClient.close(in); DAMSClient.close(reader); DAMSClient.close(buf); if(proc != null) { proc.destroy(); proc = null; } } return metadata; }</code><technical_language>Is reason enable large file support? a simpler enable it, AFAIK, downside</technical_language>

Target:
private Map<String, String> extractMetadata(File src) { Reader reader = null; InputStream in = null; BufferedReader buf = null; StringBuffer log = null; Process proc = null; Map<String, String> metadata = new HashMap<String, String>(); try { List<String> cmd = new ArrayList<>(); cmd.add( command ); cmd.add( "-api" ); cmd.add( "largefilesupport=1" ); cmd.add( src.getAbsolutePath()); log = new StringBuffer(); ProcessBuilder pb = new ProcessBuilder(cmd); pb.redirectErrorStream(true); proc = pb.start(); in = proc.getInputStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ) { String[] pair = line.split("\\:", 2); String v = ""; if (pair.length == 2) v = StringUtils.isBlank(pair[1]) ? "" : pair[1].trim(); addMetadata(metadata, pair[0].trim(), v); } int status = proc.waitFor(); if ( status != 0 ) { in = proc.getErrorStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ) log.append( line + "\n" ); addMetadata(metadata, ERROR, log.toString()); } } catch ( Exception ex ) { ex.printStackTrace(); addMetadata(metadata, ERROR, ex.getMessage()); } finally { DAMSClient.close(in); DAMSClient.close(reader); DAMSClient.close(buf); if(proc != null) { proc.destroy(); proc = null; } } return metadata; }
Source:
<code>public void scaleForErrorMarginDoesNotReduceAlreadySmallTimeouts() { assertThat(BlockingTimeouts.scaleForErrorMargin(FIVE, TEST_ERROR_MARGIN)) <START> .isGreaterThan(0) <END> .isEqualTo(FIVE); }</code><technical_language>do need this</technical_language>

Target:
public void scaleForErrorMarginDoesNotReduceAlreadySmallTimeouts() { assertThat(BlockingTimeouts.scaleForErrorMargin(FIVE, TEST_ERROR_MARGIN)) .isEqualTo(FIVE); }
Source:
<code>public void prepare(String name) { String testDir = CommonsTestingUtil.tmpDirectory(name); Util.recursiveFileRemove(testDir); rootDir = new File(testDir); confDir = new File(rootDir, Server.DEFAULT_SERVER_CONFIG); if (!confDir.mkdirs()) { throw new RuntimeException("Failed to create server configuration directory " + confDir); } URL configurationFileURL; <START> if (DEFAULT_INFINISPAN_CONFIG_FILES.contains(configuration.configurationFile())) { <END> configurationFileURL = getClass().getClassLoader().getResource(configuration.configurationFile()); } else if (new File(configuration.configurationFile()).isAbsolute()) { configurationFileURL = Exceptions.unchecked(() -> new File(configuration.configurationFile()).toURI().toURL()); } else { configurationFileURL = getClass().getClassLoader().getResource(configuration.configurationFile()); } if (configurationFileURL == null) { throw new RuntimeException("Cannot find test configuration file: " + configuration.configurationFile()); } try { if (DEFAULT_INFINISPAN_CONFIG_FILES.contains(configuration.configurationFile())) { InputStream resourceAsStream = getClass().getClassLoader() .getResourceAsStream(configuration.configurationFile()); Path target = Paths.get(confDir.getAbsolutePath(), configuration.configurationFile()); Files.copy(resourceAsStream, target); } else { Path configurationFilePath = Paths.get(configurationFileURL.toURI()); Util.recursiveDirectoryCopy(configurationFilePath.getParent(), confDir.toPath()); } } catch (Exception e) { throw new RuntimeException(e); } createUserFile("default"); createKeyStores(); }</code><technical_language>Is this change necessary? "infinispan.xml" is absolute path, else branch, same</technical_language>

Target:
public void prepare(String name) { String testDir = CommonsTestingUtil.tmpDirectory(name); Util.recursiveFileRemove(testDir); rootDir = new File(testDir); confDir = new File(rootDir, Server.DEFAULT_SERVER_CONFIG); if (!confDir.mkdirs()) { throw new RuntimeException("Failed to create server configuration directory " + confDir); } if(!configuration.isDefaultFile()) { copyProvidedServerConfigurationFile(); } createUserFile("default"); createKeyStores(); }
Source:
<code>public static Geopoint createGeopoint(final String latDir, final String latDeg, final String latDegFrac, final String lonDir, final String lonDeg, final String lonDegFrac) { double lat = Double.parseDouble(latDeg + "." + addZeros(Integer.parseInt(latDegFrac), 5)); double lon = Double.parseDouble(lonDeg + "." + addZeros(Integer.parseInt(lonDegFrac), 5)); lat *= "S".equalsIgnoreCase(latDir) ? -1 : 1; lon *= "W".equalsIgnoreCase(lonDir) ? -1 : 1; <START> return new Geopoint(lat, lon); <END> }</code><technical_language>introduce a handling for NumberFormatException, removed calling site. deliberate if, why</technical_language>

Target:
public static Geopoint createGeopoint(final String latDir, final String latDeg, final String latDegFrac, final String lonDir, final String lonDeg, final String lonDegFrac) { double lat = 0.0d; double lon = 0.0d; try { lat = Double.parseDouble(latDeg + "." + addZeros(Integer.parseInt(latDegFrac), 5)); lon = Double.parseDouble(lonDeg + "." + addZeros(Integer.parseInt(lonDegFrac), 5)); } catch (NumberFormatException e) { } lat *= "S".equalsIgnoreCase(latDir) ? -1 : 1; lon *= "W".equalsIgnoreCase(lonDir) ? -1 : 1; return new Geopoint(lat, lon); }
Source:
<code>private void setMeasurementDataAsOutOfSync( final Map<Integer, List<Integer>> targetsByInput, final Set<Phenotype> inputPhenotypes) { if (!targetsByInput.isEmpty()) { final Set<Integer> observationUnitIdOutOfSync = new HashSet<>(); final Set<Integer> targetVariableIdOutOfSync = new HashSet<>(); for (final Phenotype phenotype : inputPhenotypes) { if (phenotype.isChanged()) { observationUnitIdOutOfSync.add(phenotype.getExperiment().getNdExperimentId()); final List<Integer> targetsOutOfSync = targetsByInput.get(phenotype.getObservableId()); if (targetsOutOfSync != null) { targetVariableIdOutOfSync.addAll(targetsOutOfSync); } } } <START> this.updatePhenotypesStatus(targetVariableIdOutOfSync, observationUnitIdOutOfSync); <END> } }</code><technical_language>I logic there, looping datasetPhenotypes. This is a nice improvement :+1:</technical_language>

Target:
private void setMeasurementDataAsOutOfSync( final Map<Integer, List<Integer>> targetsByInput, final Set<Phenotype> inputPhenotypes) { if (!targetsByInput.isEmpty()) { final Set<Integer> observationUnitIdOutOfSync = new HashSet<>(); final Set<Integer> targetVariableIdOutOfSync = new HashSet<>(); for (final Phenotype phenotype : inputPhenotypes) { if (phenotype.isChanged()) { observationUnitIdOutOfSync.add(phenotype.getExperiment().getNdExperimentId()); final List<Integer> targetsOutOfSync = targetsByInput.get(phenotype.getObservableId()); if (targetsOutOfSync != null) { targetVariableIdOutOfSync.addAll(targetsOutOfSync); } } } this.updateOutOfSyncPhenotypes(targetVariableIdOutOfSync, observationUnitIdOutOfSync); } }