auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onActivityResumed(Activity activity) { installConnectionSensor(activity); mEditState.add(activity); mCurrentActivity = activity; ConnectivityIndicator.show(activity); }

Target:
public void onActivityResumed(Activity activity) { installConnectionSensor(activity); mEditState.add(activity); mCurrentActivity = new WeakReference<>(activity); if (ViewCrawler.mMixpanelInEditMode) { ConnectivityIndicator.show(activity, mContext); } }
Source:
public MediaBrowserServiceCompat.BrowserRoot onGetRoot(@NonNull String clientPackageName, int clientUid, @Nullable Bundle rootHints) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(radioDroidApp.getApplicationContext().getApplicationContext()); showIconsInBrowser = sharedPref.getBoolean("show_station_icons_in_hud_browser", false); Bundle extras = new Bundle(); extras.putInt(CONTENT_STYLE_BROWSABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); if (showIconsInBrowser) { Log.d(TAG, "Settimg grid style for playables"); extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_GRID_ITEM_HINT_VALUE); } else { Log.d(TAG, "Settimg list style for playables"); extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); } extras.putBoolean(CONTENT_STYLE_SUPPORTED, true); return new MediaBrowserServiceCompat.BrowserRoot(MEDIA_ID_ROOT, extras); }

Target:
public MediaBrowserServiceCompat.BrowserRoot onGetRoot(@NonNull String clientPackageName, int clientUid, @Nullable Bundle rootHints) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(radioDroidApp.getApplicationContext().getApplicationContext()); showIconsInBrowser = sharedPref.getBoolean("show_station_icons_in_hud_browser", false); Bundle extras = new Bundle(); extras.putInt(CONTENT_STYLE_BROWSABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); if (showIconsInBrowser && sharedPref.getBoolean("settings_grid_style_hud_icon_display", false)) { Log.d(TAG, "Setting grid style for playables"); extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_GRID_ITEM_HINT_VALUE); } else { Log.d(TAG, "Setting list style for playables"); extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); } extras.putBoolean(CONTENT_STYLE_SUPPORTED, true); return new MediaBrowserServiceCompat.BrowserRoot(MEDIA_ID_ROOT, extras); }
Source:
public void pruneParentDirectoryOne() throws IOException { final String parentDir = createRandomDirectory(testPathPrefix, 1); final String childDir = createRandomDirectory(parentDir, 3); LOG.info("CHILD DIR : " + childDir); LOG.info("Parent DIR : " + parentDir); mantaClient.delete(childDir, null, 1); MantaAssert.assertResponseFailureStatusCode(404, RESOURCE_NOT_FOUND_ERROR, (MantaFunction<Object>) () -> mantaClient.get(childDir)); Assert.assertTrue(mantaClient.existsAndIsAccessible(parentDir)); }

Target:
public void pruneParentDirectoryOne() throws IOException { final String parentDir = createRandomDirectory(testPathPrefix, 1); final String childDir = createRandomDirectory(parentDir, 3); LOG.info("CHILD DIR : " + childDir); LOG.info("Parent DIR : " + parentDir); mantaClient.delete(childDir, null, 1); Assert.assertFalse(mantaClient.existsAndIsAccessible(childDir)); Assert.assertTrue(mantaClient.existsAndIsAccessible(parentDir)); }
Source:
public void testLhsOrder() { final SpreadsheetCompiler converter = new SpreadsheetCompiler(); String drl = converter.compile( "/data/LhsOrder.xls", InputType.XLS); System.out.println(drl); assertNotNull( drl ); int firstLine = drl.indexOf( "accumulate(Person(name == \"John\", $a : age); $max:max($a))" ); int secondLine = drl.indexOf( "$p:Person(name == \"John\", age == $max)" ); assertTrue( firstLine > -1 ); assertTrue( secondLine > -1 ); assertTrue( "Lhs order is wrong. firstLineIndex = " + firstLine + ", secondLineIndex = " + secondLine , firstLine < secondLine ); }

Target:
public void testLhsOrder() { final SpreadsheetCompiler converter = new SpreadsheetCompiler(); String drl = converter.compile("/data/LhsOrder.xls", InputType.XLS); Assertions.assertThat(drl.split("\n")) .as("Lhs order is wrong") .containsSequence("accumulate(Person(name == \"John\", $a : age); $max:max($a))", "$p:Person(name == \"John\", age == $max)"); }
Source:
public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) { if (isSimple) { try { emitter.emit(StructuredRecordStringConverter.fromJsonString((String) input.get(config.field), outSchema)); } catch (IOException e) { emitter.emitError(new InvalidEntry<>(31, e.getStackTrace()[0].toString() + " : " + e.getMessage(), input)); } return; } Object document = Configuration.defaultConfiguration().jsonProvider().parse((String) input.get(config.field)); StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); for (Schema.Field field : fields) { String name = field.getName(); if (mapping.containsKey(name)) { String path = mapping.get(name); try { Object value = JsonPath.read(document, path); builder.set(field.getName(), value); } catch (PathNotFoundException e) { LOG.error("Json path '" + path + "' specified for the field '" + name + "' doesn't exist. " + "Fix the issue before proceeding further with processing."); emitter.emitError(new InvalidEntry<>(31, e.getStackTrace()[0].toString() + " : " + e.getMessage(), input)); throw e; } } else { Object value = input.get(name); if (value != null) { builder.set(name, value); } } } emitter.emit(builder.build()); }

Target:
public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) throws Exception { if (isSimple) { emitter.emit(StructuredRecordStringConverter.fromJsonString((String) input.get(config.field), outSchema)); return; } Object document = Configuration.defaultConfiguration().jsonProvider().parse((String) input.get(config.field)); StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); for (Schema.Field field : fields) { String name = field.getName(); if (mapping.containsKey(name)) { String path = mapping.get(name); try { Object value = JsonPath.read(document, path); builder.set(field.getName(), value); } catch (PathNotFoundException e) { if (field.getSchema().isNullable()) { builder.set(field.getName(), null); } else { LOG.error("Json path '" + path + "' specified for the field '" + name + "' doesn't exist. " + "Dropping the error record: " + StructuredRecordStringConverter.toJsonString(input)); return; } } } else { Object value = input.get(name); if (value != null) { builder.set(name, value); } } } emitter.emit(builder.build()); }
Source:
private void addListeners() { final UIManager uiManager = getMapperManager().getUiManager(); addOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().addOutput(); } }); removeOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().removeSelectedOutput(); } }); guessItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { List<DataMapTableView> outputsTablesView = getMapperManager().getUiManager().getOutputsTablesView(); for (DataMapTableView dataMapTableView : outputsTablesView) { dataMapTableView.notifyFocusLost(); } IPreferenceStore weightStore = CoreUIPlugin.getDefault().getPreferenceStore(); getMapperManager().mapAutomaticallly(weightStore.getInt(ITalendCorePrefConstants.LEVENSHTEIN_WEIGHT), weightStore.getInt(ITalendCorePrefConstants.JACCARD_WEIGHT)); } }); }

Target:
private void addListeners() { final UIManager uiManager = getMapperManager().getUiManager(); addOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().addOutput(); } }); removeOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().removeSelectedOutput(); } }); guessItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { List<DataMapTableView> outputsTablesView = getMapperManager().getUiManager().getOutputsTablesView(); for (DataMapTableView dataMapTableView : outputsTablesView) { dataMapTableView.notifyFocusLost(); } getMapperManager().mapAutomaticallly(); } }); }
Source:
public static Map<String, Class<?>> findMostSpecificTypesFromData(CsvReader csvReader, String[] headers) throws IOException { Map<String, Class<?>> result = new HashMap<String, Class<?>>(); for (String header : headers) { result.put(header, Integer.class); } while (csvReader.readRecord()) { String[] record = csvReader.getValues(); List<String> values = Arrays.asList(record); if (record.length >= headers.length) { values = values.subList(0, headers.length); } int i = 0; for (String value : values) { String header = headers[i]; Class<?> type = result.get(header); if (type == Integer.class) { try { Integer.parseInt(value); } catch (NumberFormatException e) { try { Double.parseDouble(value); type = Double.class; } catch (NumberFormatException ex) { type = String.class; } } } else if (type == Double.class) { try { Double.parseDouble(value); } catch (NumberFormatException e) { type = String.class; } } else { type = String.class; } result.put(header, type); i++; } } return result; }

Target:
protected static Map<String, Class<?>> findMostSpecificTypesFromData(CsvReader csvReader, String[] headers) throws IOException { Map<String, Class<?>> result = new HashMap<String, Class<?>>(); for (String header : headers) { result.put(header, Integer.class); } while (csvReader.readRecord()) { String[] record = csvReader.getValues(); List<String> values = Arrays.asList(record); if (record.length >= headers.length) { values = values.subList(0, headers.length); } int i = 0; for (String value : values) { String header = headers[i]; Class<?> type = result.get(header); if (type == Integer.class) { try { Integer.parseInt(value); } catch (NumberFormatException e) { try { Double.parseDouble(value); type = Double.class; } catch (NumberFormatException ex) { type = String.class; } } } else if (type == Double.class) { try { Double.parseDouble(value); } catch (NumberFormatException e) { type = String.class; } } else { type = String.class; } result.put(header, type); i++; } } return result; }
Source:
private Object[][] containerStateTestCases() { final ReferenceContext mappedReferenceContext = new ReferenceContext(5); final int slice1AlignmentStart = 10; final int slice1AlignmentSpan = 15; final Slice slice1 = new Slice(mappedReferenceContext); slice1.alignmentStart = slice1AlignmentStart; slice1.alignmentSpan = slice1AlignmentSpan; final int slice2AlignmentStart = 20; final int slice2AlignmentSpan = 20; final Slice slice2 = new Slice(mappedReferenceContext); slice2.alignmentStart = slice2AlignmentStart; slice2.alignmentSpan = slice2AlignmentSpan; final int expectedSpan = slice2AlignmentStart + slice2AlignmentSpan - slice1AlignmentStart; return new Object[][] { { Arrays.asList(slice1), mappedReferenceContext, slice1AlignmentStart, slice1AlignmentSpan }, { Arrays.asList(slice1, slice2), mappedReferenceContext, slice1AlignmentStart, expectedSpan }, { Arrays.asList(new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT), new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT)), ReferenceContext.MULTIPLE_REFERENCE_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, { Arrays.asList(new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT), new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT)), ReferenceContext.UNMAPPED_UNPLACED_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, }; }

Target:
private Object[][] containerStateTestCases() { final ReferenceContext mappedReferenceContext = new ReferenceContext(5); final int slice1AlignmentStart = 10; final int slice1AlignmentSpan = 15; final Slice mappedSlice1 = new Slice(mappedReferenceContext); mappedSlice1.alignmentStart = slice1AlignmentStart; mappedSlice1.alignmentSpan = slice1AlignmentSpan; final int slice2AlignmentStart = 20; final int slice2AlignmentSpan = 20; final Slice mappedSlice2 = new Slice(mappedReferenceContext); mappedSlice2.alignmentStart = slice2AlignmentStart; mappedSlice2.alignmentSpan = slice2AlignmentSpan; final int expectedSpan = slice2AlignmentStart + slice2AlignmentSpan - slice1AlignmentStart; return new Object[][] { { Arrays.asList(mappedSlice1), mappedReferenceContext, slice1AlignmentStart, slice1AlignmentSpan }, { Arrays.asList(mappedSlice1, mappedSlice2), mappedReferenceContext, slice1AlignmentStart, expectedSpan }, { Arrays.asList(new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT), new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT)), ReferenceContext.MULTIPLE_REFERENCE_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, { Arrays.asList(new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT), new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT)), ReferenceContext.UNMAPPED_UNPLACED_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, }; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message); YieldsApplication.setApplicationContext(getApplicationContext()); YieldsApplication.setResources(getResources()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mUser = YieldsApplication.getUser(); mGroup = YieldsApplication.getGroup(); mMessages = new ArrayList<>(); mImage = null; mSendImage = false; mAdapter = new ListAdapterMessages(YieldsApplication.getApplicationContext(), R.layout.messagelayout, mMessages); mMessageScrollLayout = (ListView) findViewById(R.id.messageScrollLayout); mMessageScrollLayout.setAdapter(mAdapter); mInputField = (EditText) findViewById(R.id.inputMessageField); if(mUser == null || mGroup == null) { showErrorToast("Couldn't get group information."); mActionBar.setTitle("Unknown group"); } else { setHeaderBar(); try { retrieveGroupMessages(); } catch (IOException e) { showErrorToast("Couldn't load messages"); } } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message); YieldsApplication.setApplicationContext(getApplicationContext()); YieldsApplication.setResources(getResources()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mUser = YieldsApplication.getUser(); mGroup = YieldsApplication.getGroup(); mMessages = new ArrayList<>(); mImage = null; mSendImage = false; mAdapter = new ListAdapterMessages(YieldsApplication.getApplicationContext(), R.layout.messagelayout, mMessages); mMessageScrollLayout = (ListView) findViewById(R.id.messageScrollLayout); mMessageScrollLayout.setAdapter(mAdapter); mInputField = (EditText) findViewById(R.id.inputMessageField); if(mUser == null || mGroup == null) { String message = "Couldn't get group information."; YieldsApplication.showToast(getApplicationContext(), message); mActionBar.setTitle("Unknown group"); } else { setHeaderBar(); try { retrieveGroupMessages(); } catch (IOException e) { String message = "Couldn't load messages"; YieldsApplication.showToast(getApplicationContext(), message); } } }
Source:
private void updateMenuItem() { MenuItem item = (MenuItem) widget; String text = model.getLocalizedLabel(); ParameterizedCommand parmCmd = model.getWbCommand(); String keyBindingText = null; if (parmCmd != null) { if (text == null || text.isEmpty()) { text = model.getCommand().getLocalizedCommandName(); } if (bindingService != null) { TriggerSequence binding = bindingService .getBestSequenceFor(parmCmd); if (binding != null) keyBindingText = binding.format(); } } if (text != null) { if (model instanceof MMenuElement) { String mnemonics = ((MMenuElement) model).getMnemonics(); if (mnemonics != null && !mnemonics.isEmpty()) { int idx = text.indexOf(mnemonics); if (idx != -1) { text = text.substring(0, idx) + '&' + text.substring(idx); } } } if (keyBindingText == null) item.setText(text); else item.setText(text + '\t' + keyBindingText); } else { item.setText(""); } final String tooltip = getToolTipText(); item.setToolTipText(tooltip); item.setSelection(model.isSelected()); item.setEnabled(model.isEnabled()); }

Target:
protected void updateMenuItem() { MenuItem item = (MenuItem) widget; String text = getModel().getLocalizedLabel(); ParameterizedCommand parmCmd = getModel().getWbCommand(); String keyBindingText = null; if (parmCmd != null) { if (text == null || text.isEmpty()) { text = getModel().getCommand().getLocalizedCommandName(); } if (bindingService != null) { TriggerSequence binding = bindingService.getBestSequenceFor(parmCmd); if (binding != null) keyBindingText = binding.format(); } } if (text != null) { if (getModel() instanceof MMenuElement) { String mnemonics = ((MMenuElement) getModel()).getMnemonics(); if (mnemonics != null && !mnemonics.isEmpty()) { int idx = text.indexOf(mnemonics); if (idx != -1) { text = text.substring(0, idx) + '&' + text.substring(idx); } } } if (keyBindingText == null) item.setText(text); else item.setText(text + '\t' + keyBindingText); } else { item.setText(""); } final String tooltip = getToolTipText(false); item.setToolTipText(tooltip); item.setSelection(getModel().isSelected()); item.setEnabled(getModel().isEnabled()); }
Source:
public void testSetupChildInvalidProperty() throws Exception { final Checker checker = new Checker(); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); checker.setModuleFactory(factory); final DefaultConfiguration checkConfig = createModuleConfig(HiddenFieldCheck.class); checkConfig.addAttribute("$$No such property", null); checker.finishLocalSetup(); try { checker.setupChild(checkConfig); fail("Exception is expected"); } catch (CheckstyleException ex) { assertEquals("Error message is not expected", "cannot initialize module " + checkConfig.getName() + " - Property '$$No such property' in module " + checkConfig.getName() + " does not exist, please check the documentation", ex.getMessage()); } }

Target:
public void testSetupChildInvalidProperty() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HiddenFieldCheck.class); checkConfig.addAttribute("$$No such property", null); try { createChecker(checkConfig); fail("Exception is expected"); } catch (CheckstyleException ex) { assertEquals("Error message is not expected", "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker" + " - Property '$$No such property' in module " + checkConfig.getName() + " does not exist, please check the documentation", ex.getMessage()); } }
Source:
public void onStart() { super.onStart(); if (isSignedIn()) { attachRecyclerViewAdapter(); } else { signInAnonymously(); } }

Target:
public void onStart() { super.onStart(); if (!isSignedIn()) { signInAnonymously(); } else { attachRecyclerViewAdapter(); } }
Source:
ValidationResult validateBondOptionsForNewAttachement(NetworkAttachment attachment) { Bond newOrEditedBondInterfaceForAttachement = bondsMap.get(attachment.getNicName()); if(newOrEditedBondInterfaceForAttachement != null){ return validateNewOrModifiedBondOptionsForNewAttachement(attachment.getNetworkName(), newOrEditedBondInterfaceForAttachement); } return validateExistingBondOptionsForNewAttachement(attachment); }

Target:
ValidationResult validateBondOptionsForNewAttachement(NetworkAttachment attachment) { VdsNetworkInterface existingNetworkInterfaceForAttachement = existingInterfacesMap.get(attachment.getNicName()); if(existingNetworkInterfaceForAttachement != null && existingNetworkInterfaceForAttachement.isBond()){ String bondMode = BondMode.getBondMode((Bond) existingNetworkInterfaceForAttachement); if ( !BondMode.isBondModeValidForVmNetwork(bondMode) && networkBusinessEntityMap.get(attachment.getNetworkId(), attachment.getNetworkName()).isVmNetwork()){ return new ValidationResult(EngineMessage.INVALID_BOND_MODE_FOR_BOND_WITH_VM_NETWORK, ReplacementUtils.createSetVariableString(VAR_BOND_NAME, attachment.getNicName()), ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, attachment.getNetworkName())); } } return ValidationResult.VALID; }
Source:
private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescriptor, NodeExecutionAdvisor advisor) { Set<ExclusiveResource> exclusiveResources = getExclusiveResources(testDescriptor); if (exclusiveResources.isEmpty()) { advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(singleton(GLOBAL_READ))); testDescriptor.getChildren().forEach(child -> walk(globalLockDescriptor, child, advisor)); } else { Set<ExclusiveResource> allResources = new HashSet<>(exclusiveResources); advisor.forceDescendantExecutionMode(testDescriptor, SAME_THREAD); doForChildrenRecursively(testDescriptor, child -> { allResources.addAll(getExclusiveResources(child)); advisor.forceDescendantExecutionMode(child, SAME_THREAD); }); if (!globalLockDescriptor.equals(testDescriptor) && allResources.contains(GLOBAL_READ_WRITE)) { advisor.forceDescendantExecutionMode(globalLockDescriptor, SAME_THREAD); doForChildrenRecursively(globalLockDescriptor, child -> advisor.forceDescendantExecutionMode(child, SAME_THREAD)); advisor.useResourceLock(globalLockDescriptor, lockManager.getLockForResources(singleton(GLOBAL_READ_WRITE))); } advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(allResources)); } }

Target:
private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescriptor, NodeExecutionAdvisor advisor) { Set<ExclusiveResource> exclusiveResources = getExclusiveResources(testDescriptor); if (exclusiveResources.isEmpty()) { advisor.useResourceLock(testDescriptor, globalReadLock); testDescriptor.getChildren().forEach(child -> walk(globalLockDescriptor, child, advisor)); } else { Set<ExclusiveResource> allResources = new HashSet<>(exclusiveResources); advisor.forceDescendantExecutionMode(testDescriptor, SAME_THREAD); doForChildrenRecursively(testDescriptor, child -> { allResources.addAll(getExclusiveResources(child)); advisor.forceDescendantExecutionMode(child, SAME_THREAD); }); if (!globalLockDescriptor.equals(testDescriptor) && allResources.contains(GLOBAL_READ_WRITE)) { advisor.forceDescendantExecutionMode(globalLockDescriptor, SAME_THREAD); doForChildrenRecursively(globalLockDescriptor, child -> advisor.forceDescendantExecutionMode(child, SAME_THREAD)); advisor.useResourceLock(globalLockDescriptor, globalReadWriteLock); } advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(allResources)); } }
Source:
public void cleanUpArtifacts() throws Exception { restAPIStore.removeApplicationById(applicationID); restAPIPublisher.deleteAPIByID(apiID); }

Target:
public void cleanUpArtifacts() throws Exception { restAPIStore.removeApplicationById(applicationID); restAPIPublisher.deleteAPIByID(apiID); super.cleanUp(); }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (servletRequest instanceof HttpServletRequest) { HttpServletRequest httpServletRequest = (HttpServletRequest)servletRequest; HttpServletResponse httpServletResponse = (HttpServletResponse)servletResponse; String path = httpServletRequest.getPathInfo(); if (ResourceDomainConfiguration.isResourceRequest(httpServletRequest) && !path.startsWith("/static-files/") && !path.equals("/static-files")) { LOGGER.log(Level.FINE, "Rejecting request to " + httpServletRequest.getRequestURL() + " from " + httpServletRequest.getRemoteAddr() + " on resource domain"); httpServletResponse.sendError(404, "Jenkins serves only static files on this domain."); return; } } filterChain.doFilter(servletRequest, servletResponse); }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (servletRequest instanceof HttpServletRequest) { HttpServletRequest httpServletRequest = (HttpServletRequest)servletRequest; HttpServletResponse httpServletResponse = (HttpServletResponse)servletResponse; if (ResourceDomainConfiguration.isResourceRequest(httpServletRequest)) { String path = httpServletRequest.getPathInfo(); if (!path.startsWith("/" + ResourceDomainRootAction.URL + "/") && !ALLOWED_PATHS.contains(path)) { LOGGER.fine(() -> "Rejecting request to " + httpServletRequest.getRequestURL() + " from " + httpServletRequest.getRemoteAddr() + " on resource domain"); httpServletResponse.sendError(404, ERROR_RESPONSE); return; } LOGGER.finer(() -> "Accepting request to " + httpServletRequest.getRequestURL() + " from " + httpServletRequest.getRemoteAddr() + " on resource domain"); } } filterChain.doFilter(servletRequest, servletResponse); }
Source:
public void create_default_instance_according_to_place() { final int currentOffset = timeZone.getRawOffset()/(int)MILLIS_PER_SECOND; final String zoneId = timeZone.getID(); assertEquals(currentOffset, ZoneOffsets.getDefault().getAmountSeconds()); assertEquals(zoneId, ZoneOffsets.getDefault().getId()); }

Target:
public void create_default_instance_according_to_place() { final int currentOffset = getOffsetInSeconds(timeZone); final String zoneId = timeZone.getID(); assertEquals(currentOffset, toZoneOffset(timeZone).getAmountSeconds()); assertEquals(zoneId, toZoneOffset(timeZone).getId()); }
Source:
public void onJointAngles(Map<String, Double> angleMap) { for (String name : angleMap.keySet()) { ServiceInterface si = Runtime.getService(name); if (si instanceof Servo) { ((Servo) si).moveTo(angleMap.get(name)); } } }

Target:
public void onJointAngles(Map<String, Double> angleMap) { for (String name : angleMap.keySet()) { ServiceInterface si = Runtime.getService(name); if (si instanceof ServoControl) { ((ServoControl) si).moveTo(angleMap.get(name)); } } }
Source:
public Map<String, String> getJobMessageProperties() { DiskImage diskImage = diskImageDao.getSnapshotById(getParameters().getSubchainInfo().getTopImageId()); DiskImage destDiskImage = diskImageDao.getSnapshotById(getParameters().getSubchainInfo().getBaseImageId()); if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.Disk.name().toLowerCase(), diskImage.getDiskAlias()); jobProperties.put("sourcesnapshot", Optional.ofNullable(snapshotDao.get(diskImage.getVmSnapshotId()).getDescription()).orElse("")); jobProperties.put("destinationsnapshot", Optional.ofNullable(snapshotDao.get(destDiskImage.getVmSnapshotId()).getDescription()).orElse("")); } return jobProperties; }

Target:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { DiskImage diskImage = diskImageDao.getSnapshotById(getParameters().getSubchainInfo().getTopImageId()); DiskImage destDiskImage = diskImageDao.getSnapshotById(getParameters().getSubchainInfo().getBaseImageId()); jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.Disk.name().toLowerCase(), diskImage.getDiskAlias()); jobProperties.put("sourcesnapshot", Optional.ofNullable(snapshotDao.get(diskImage.getVmSnapshotId()).getDescription()).orElse("")); jobProperties.put("destinationsnapshot", Optional.ofNullable(snapshotDao.get(destDiskImage.getVmSnapshotId()).getDescription()).orElse("")); } return jobProperties; }
Source:
private String getRequestCharset() { String charset = request.getHeader("Accept-Charset"); if(charset != null) { charset = charset.split(",")[0]; } return charset; }

Target:
private String getRequestCharset() { String charset = Objects.firstNonNull(request.getHeader("Accept-Charset"), "UTF-8"); return charset.split(",")[0]; }
Source:
public WizardCustomizeJenkins doInstallSuggested() { By suggestedButtonLocator = By.partialLinkText("Install suggested plugins"); waitFor(suggestedButtonLocator, 30); Control installSuggested = control(suggestedButtonLocator); installSuggested.click(); return this; }

Target:
public WizardCustomizeJenkins doInstallSuggested() { By suggestedButtonLocator = by.partialLinkText("Install suggested plugins"); waitFor(suggestedButtonLocator, 30); Control installSuggested = control(suggestedButtonLocator); installSuggested.click(); return this; }
Source:
private String getParserType(URL url) { String fileName = url.getPath(); int fileExtesionStartIndex = fileName.lastIndexOf(".") + 1; if (fileExtesionStartIndex == -1) { return Parser.FORMAT_JSON; } String fileExtesion = fileName.substring(fileExtesionStartIndex); if (fileExtesion.equals("txt")) { return Parser.FORMAT_JSON; } return fileExtesion; }

Target:
private String getParserType(URL url) { String fileName = url.getPath(); if (fileName.lastIndexOf(".") == -1) { return Parser.FORMAT_JSON; } String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); if (fileExtension.equals("txt")) { return Parser.FORMAT_JSON; } return fileExtension; }
Source:
private Properties buildProperties() { Properties props = System.getProperties(); final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; props.setProperty("mail.smtp.host", "smtp.gmail.com"); props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY); props.setProperty("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.port", "465"); props.setProperty("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); return props; }

Target:
private Properties buildProperties() { Properties props = System.getProperties(); props.setProperty("mail.smtp.host", "smtp.gmail.com"); props.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.setProperty("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.port", "465"); props.setProperty("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); return props; }
Source:
void setStudyDataManager(final StudyDataManager studyDataManager) { this.studyDataManager = studyDataManager; }

Target:
public void setStudyDataManager(final StudyDataManager studyDataManager) { this.studyDataManager = studyDataManager; }
Source:
public void onFriendJoinedGame(FriendJoinedGameEvent event) { Player player = event.getPlayer(); Game game = event.getGame(); audioService.playFriendJoinsGameSound(); if (preferencesService.getPreferences().getNotification().isFriendJoinsGameToastEnabled() && !eventList.contains(event)) { eventList.add(event); notificationService.addNotification(new TransientNotification( i18n.get("friend.joinedGameNotification.title", player.getUsername(), game.getTitle()), i18n.get("friend.joinedGameNotification.action"), IdenticonUtil.createIdenticon(player.getId()), event1 -> joinGameHelper.join(player.getGame()) )); } }

Target:
public void onFriendJoinedGame(FriendJoinedGameEvent event) { Player player = event.getPlayer(); Game game = event.getGame(); audioService.playFriendJoinsGameSound(); if (preferencesService.getPreferences().getNotification().isFriendJoinsGameToastEnabled()) { notificationService.addNotification(new TransientNotification( i18n.get("friend.joinedGameNotification.title", player.getUsername(), game.getTitle()), i18n.get("friend.joinedGameNotification.action"), IdenticonUtil.createIdenticon(player.getId()), event1 -> joinGameHelper.join(player.getGame()) )); } }
Source:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = AudioWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); if (prompt.isReadOnly()) { binding.captureButton.widgetButton.setVisibility(View.GONE); binding.chooseButton.widgetButton.setVisibility(View.GONE); } else { binding.captureButton.widgetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.chooseButton.widgetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.captureButton.widgetButton.setText(getContext().getString(R.string.capture_audio)); binding.chooseButton.widgetButton.setText(getContext().getString(R.string.choose_sound)); binding.captureButton.widgetButton.setOnClickListener(v -> onCaptureAudioButtonClicked()); binding.chooseButton.widgetButton.setOnClickListener(v -> chooseSound()); } return binding.getRoot(); }

Target:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = AudioWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); audioController = new AudioControllerView(context); binding.getRoot().addView(audioController); if (prompt.isReadOnly()) { binding.captureButton.setVisibility(View.GONE); binding.chooseButton.setVisibility(View.GONE); } else { binding.captureButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.chooseButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.captureButton.setOnClickListener(v -> onCaptureAudioButtonClicked()); binding.chooseButton.setOnClickListener(v -> chooseSound()); } return binding.getRoot(); }
Source:
public void clickDisplayedToStudentCheckBox(int instrNum) { this.getDisplayedToStudentCheckBox(instrNum).click(); }

Target:
public void clickDisplayedToStudentCheckBox(int instrNum) { getDisplayedToStudentCheckBox(instrNum).click(); }
Source:
public synchronized void notify(RecordsDeliveryAck recordsDeliveryAck) { final RecordsRetrieved recordsToCheck = peekNextResult(); if (recordsToCheck != null && recordsToCheck.batchUniqueIdentifier() .equals(recordsDeliveryAck.batchUniqueIdentifier())) { evictNextResult(); if(getRecordsResultQueue.isEmpty()) { log.debug("{} : Publisher thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnAck.set(false); } else { drainQueueForRequests(); } } else { final BatchUniqueIdentifier peekedBatchUniqueIdentifier = recordsToCheck == null ? null : recordsToCheck.batchUniqueIdentifier(); log.info("{} : Received a stale notification with id instead of expected id at {}. Will ignore.", shardId, recordsDeliveryAck.batchUniqueIdentifier(), peekedBatchUniqueIdentifier, Instant.now()); } takeDelayedDeliveryActionIfRequired(shardId, lastEventDeliveryTime, log); }

Target:
public synchronized void notify(RecordsDeliveryAck recordsDeliveryAck) { final RecordsRetrieved recordsToCheck = peekNextResult(); if (recordsToCheck != null && recordsToCheck.batchUniqueIdentifier() .equals(recordsDeliveryAck.batchUniqueIdentifier())) { pollNextResultAndUpdatePrefetchCounters(); if (getRecordsResultQueue.isEmpty()) { log.debug("{} : Publisher thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnlyOnAck.set(false); } else { drainQueueForRequests(); } } else { final BatchUniqueIdentifier peekedBatchUniqueIdentifier = recordsToCheck == null ? null : recordsToCheck.batchUniqueIdentifier(); log.info("{} : Received a stale notification with id instead of expected id at {}. Will ignore.", shardId, recordsDeliveryAck.batchUniqueIdentifier(), peekedBatchUniqueIdentifier, Instant.now()); } takeDelayedDeliveryActionIfRequired(shardId, lastEventDeliveryTime, log); }
Source:
public Optional<TableLayoutResult> getLayout(Session session, TableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { if (constraint.getSummary().isNone()) { return Optional.empty(); } ConnectorId connectorId = table.getConnectorId(); ConnectorTableHandle connectorTable = table.getConnectorHandle(); CatalogMetadata catalogMetadata = getCatalogMetadata(session, connectorId); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(connectorSession, connectorTable, constraint, desiredColumns); if (layouts.isEmpty()) { return Optional.empty(); } if (layouts.size() > 1) { throw new PrestoException(NOT_SUPPORTED, format("Connector returned multiple layouts for table %s", table)); } return Optional.of(new TableLayoutResult(fromConnectorLayout(connectorId, transaction, layouts.get(0).getTableLayout()), layouts.get(0).getUnenforcedConstraint())); }

Target:
public TableLayoutResult getLayout(Session session, TableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { checkArgument(!constraint.getSummary().isNone(), "Cannot get Layout if constraint is none"); ConnectorId connectorId = table.getConnectorId(); ConnectorTableHandle connectorTable = table.getConnectorHandle(); CatalogMetadata catalogMetadata = getCatalogMetadata(session, connectorId); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(connectorSession, connectorTable, constraint, desiredColumns); if (layouts.size() != 1) { throw new PrestoException(NOT_SUPPORTED, "Connector returned multiple layouts for table " + table); } return new TableLayoutResult(fromConnectorLayout(connectorId, table.getConnectorHandle(), table.getTransaction(), layouts.get(0).getTableLayout()), layouts.get(0).getUnenforcedConstraint()); }
Source:
public Item fetch(String uri) { try { YouTubeVideoEntry videoEntry = gdataClient.get(uri); String itemUri = YoutubeUriCanonicaliser.canonicalUriFor(YoutubeUriCanonicaliser.videoIdFrom(uri)); return contentExtractor.extract(new YouTubeSource(videoEntry, itemUri)); } catch (HttpStatusCodeException e) { return null; } catch (Exception e) { throw new FetchException("Failed to fetch: " + uri, e); } }

Target:
public Item fetch(String uri) { try { YouTubeVideoEntry videoEntry = gdataClient.get(uri); String itemUri = YoutubeUriCanonicaliser.canonicalUriFor(YoutubeUriCanonicaliser.videoIdFrom(uri)); return contentExtractor.extract(new YouTubeSource(videoEntry, itemUri)); } catch (HttpStatusCodeException e) { log.error("HTTP Error Status code:", e); return null; } catch (Exception e) { throw new FetchException("Failed to fetch: " + uri, e); } }
Source:
public boolean canMine(Material type) { return type.name().endsWith("_ORE") || (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16) && type == Material.ANCIENT_DEBRIS && canMineAncientDebris.getValue()); }

Target:
public boolean canMine(Material type) { if (type.name().endsWith("_ORE")) { return true; } else if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { return type == Material.ANCIENT_DEBRIS && canMineAncientDebris.getValue(); } else { return false; } }
Source:
public FontMetrics getLineMetrics (int lineIndex) { checkLayout(); computeRuns(null); if (!(0 <= lineIndex && lineIndex < runs.length)) SWT.error(SWT.ERROR_INVALID_RANGE); long hDC = device.internal_new_GC(null); long srcHdc = OS.CreateCompatibleDC(hDC); TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.SelectObject(srcHdc, font != null ? font.handle : device.systemFont.handle); OS.GetTextMetrics(srcHdc, lptm); OS.DeleteDC(srcHdc); device.internal_dispose_GC(hDC, null); int ascent = Math.max(DPIUtil.autoScaleDown(lptm.tmAscent), this.ascent); int descent = Math.max(DPIUtil.autoScaleDown(lptm.tmDescent), this.descent); int leading = DPIUtil.autoScaleDown(lptm.tmInternalLeading); if (text.length() != 0) { StyleItem[] lineRuns = runs[lineIndex]; for (int i = 0; i<lineRuns.length; i++) { StyleItem run = lineRuns[i]; if (run.ascent > ascent) { ascent = run.ascent; leading = run.leading; } descent = Math.max(descent, run.descent); } } lptm.tmAscent = DPIUtil.autoScaleUp(ascent); lptm.tmDescent = DPIUtil.autoScaleUp(descent); lptm.tmHeight = DPIUtil.autoScaleUp(ascent + descent); lptm.tmInternalLeading = DPIUtil.autoScaleUp(leading); lptm.tmAveCharWidth = 0; return FontMetrics.win32_new(lptm); }

Target:
public FontMetrics getLineMetrics (int lineIndex) { checkLayout(); computeRuns(null); if (!(0 <= lineIndex && lineIndex < runs.length)) SWT.error(SWT.ERROR_INVALID_RANGE); long hDC = device.internal_new_GC(null); long srcHdc = OS.CreateCompatibleDC(hDC); TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.SelectObject(srcHdc, font != null ? font.handle : device.systemFont.handle); OS.GetTextMetrics(srcHdc, lptm); OS.DeleteDC(srcHdc); device.internal_dispose_GC(hDC, null); int ascentInPoints = DPIUtil.autoScaleDown(Math.max(lptm.tmAscent, this.ascentInPixels)); int descentInPoints = DPIUtil.autoScaleDown(Math.max(lptm.tmDescent, this.descentInPixels)); int leadingInPoints = DPIUtil.autoScaleDown(lptm.tmInternalLeading); if (text.length() != 0) { StyleItem[] lineRuns = runs[lineIndex]; for (int i = 0; i<lineRuns.length; i++) { StyleItem run = lineRuns[i]; if (run.ascentInPoints > ascentInPoints) { ascentInPoints = run.ascentInPoints; leadingInPoints = run.leadingInPoints; } descentInPoints = Math.max(descentInPoints, run.descentInPoints); } } lptm.tmAscent = DPIUtil.autoScaleUp(ascentInPoints); lptm.tmDescent = DPIUtil.autoScaleUp(descentInPoints); lptm.tmHeight = DPIUtil.autoScaleUp(ascentInPoints + descentInPoints); lptm.tmInternalLeading = DPIUtil.autoScaleUp(leadingInPoints); lptm.tmAveCharWidth = 0; return FontMetrics.win32_new(lptm); }
Source:
public boolean validateIntervals() { boolean repsOK = true, intervalOK = true; if (this.getReps() > 1) { if (this.getReps() > 6) { logger.info("Reps specified exceed the maximum allowed."); logger.info("Use --help for allowed values."); repsOK = false; } if (this.getInterval() < 10) { logger.info("Interval specificed is lower than the minium allowed."); logger.info("Use --help for allowed values."); intervalOK = false; } } return (repsOK && intervalOK); }

Target:
public boolean validateIntervals() { boolean repsOK = true, intervalOK = true; if (this.getReps() > 1) { if (this.getReps() > 6) { logger.info("'--reps' specified exceed the maximum allowed [6].", this.getReps()); logger.info("Use --help for allowed values."); repsOK = false; } if (this.getInterval() < 10) { logger.info("Interval specificed is lower than the minium allowed."); logger.info("Use --help for allowed values."); intervalOK = false; } } return (repsOK && intervalOK); }
Source:
public DataWord(byte[] data) { if (data == null) this.data = ByteUtil.EMPTY_BYTE_ARRAY; else if (data.length == 32) this.data = data; else if (data.length <= 32) { byte[] bytes = ZERO.getData(); System.arraycopy(data, 0, bytes, 32 - data.length, data.length); this.data = bytes; } else throw new RuntimeException(String.format("Data word can't exceed 32 bytes: 0x%s", ByteUtil.toHexString(data))); }

Target:
private DataWord(byte[] data) { if (data == null || data.length != 32) throw new RuntimeException("Input byte array should have 32 bytes in it!"); this.data = data; }
Source:
public void doRun(IProgressMonitor monitor, String projectID) throws CoreException { Object[] selection = getCheckedElements(); int totalSelected = selection.length; if (totalSelected > 0) { if (monitor == null) { monitor = new NullProgressMonitor(); } SubMonitor submonitor = SubMonitor.convert(monitor, 1); submonitor.subTask(CUIPlugin.getResourceString(KEY_TITLE)); convertProjects(selection, submonitor.split(1), projectID); } }

Target:
public void doRun(IProgressMonitor monitor, String projectID) throws CoreException { Object[] selection = getCheckedElements(); int totalSelected = selection.length; if (totalSelected > 0) { SubMonitor submonitor = SubMonitor.convert(monitor, CUIPlugin.getResourceString(KEY_TITLE), 1); convertProjects(selection, submonitor.split(1), projectID); } }
Source:
public EntityType(Type type) { this(type, new LinkedHashSet<Supertype>(), new DefaultVariableNameFunction()); }

Target:
public EntityType(Type type) { this(type, new LinkedHashSet<Supertype>(), DefaultVariableNameFunction.INSTANCE); }
Source:
private URI moveSegmentToOutputPinotFS(Map<String, String> taskConfigs, File localSegmentTarFile) throws Exception { URI outputSegmentDirURI = URI.create(taskConfigs.get(BatchConfigProperties.OUTPUT_SEGMENT_DIR_URI)); PinotFS outputFileFS = getPinotFS(outputSegmentDirURI); URI outputSegmentTarURI = URI.create(outputSegmentDirURI + localSegmentTarFile.getName()); if (!Boolean.parseBoolean(taskConfigs.get(BatchConfigProperties.OVERWRITE_OUTPUT)) && outputFileFS .exists(outputSegmentDirURI)) { LOGGER.warn("Not overwrite existing output segment tar file: {}", outputFileFS.exists(outputSegmentDirURI)); } else { outputFileFS.copyFromLocalFile(localSegmentTarFile, outputSegmentTarURI); } return outputSegmentTarURI; }

Target:
private URI moveSegmentToOutputPinotFS(Map<String, String> taskConfigs, File localSegmentTarFile) throws Exception { if (!taskConfigs.containsKey(BatchConfigProperties.OUTPUT_SEGMENT_DIR_URI)) { return localSegmentTarFile.toURI(); } URI outputSegmentDirURI = URI.create(taskConfigs.get(BatchConfigProperties.OUTPUT_SEGMENT_DIR_URI)); PinotFS outputFileFS = getOutputPinotFS(taskConfigs, outputSegmentDirURI); URI outputSegmentTarURI = URI.create(outputSegmentDirURI + localSegmentTarFile.getName()); if (!Boolean.parseBoolean(taskConfigs.get(BatchConfigProperties.OVERWRITE_OUTPUT)) && outputFileFS .exists(outputSegmentDirURI)) { LOGGER.warn("Not overwrite existing output segment tar file: {}", outputFileFS.exists(outputSegmentDirURI)); } else { outputFileFS.copyFromLocalFile(localSegmentTarFile, outputSegmentTarURI); } return outputSegmentTarURI; }
Source:
public void shouldReadAllLines() throws Exception { ExecutionContext executionContext = MetaDataInstanceFactory.createStepExecution().getExecutionContext(); final String inputFilePath = "/aggregated.vcf.gz"; String input = AggregatedVcfReaderTest.class.getResource(inputFilePath).getFile(); String fileId = "5"; String studyId = "7"; String studyName = "study name"; VcfHeaderReader headerReader = new VcfHeaderReader(new File(input), fileId, studyId, studyName, VariantStudy.StudyType.COLLECTION, VariantSource.Aggregation.NONE); VariantSource source = headerReader.read(); AggregatedVcfReader vcfReader = new AggregatedVcfReader(source, input); vcfReader.setSaveState(false); vcfReader.open(executionContext); consumeReader(input, vcfReader); }

Target:
public void shouldReadAllLines() throws Exception { ExecutionContext executionContext = MetaDataInstanceFactory.createStepExecution().getExecutionContext(); File input = TestFileUtils.getResource(INPUT_FILE_PATH); VcfHeaderReader headerReader = new VcfHeaderReader(input, FILE_ID, STUDY_ID, STUDY_NAME, VariantStudy.StudyType.COLLECTION, VariantSource.Aggregation.NONE); VariantSource source = headerReader.read(); AggregatedVcfReader vcfReader = new AggregatedVcfReader(source, input); vcfReader.setSaveState(false); vcfReader.open(executionContext); consumeReader(input, vcfReader); }