auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldAlertWhenLocalFileIncludedInResponse(NanoHTTPD.Response.Status status) throws Exception { String test = "/test"; this.nano.addHandler( new NanoServerHandler(test) { @Override protected NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session) { consumeBody(session); String response = "root:*:0:0:System Administrator:/var/root:/bin/sh"; return newFixedLengthResponse(status, NanoHTTPD.MIME_PLAINTEXT, response); } }); HttpMessage msg = this.getHttpMessage(test); msg.setRequestBody("<?xml version=\"1.0\"?><comment><text>test</text></comment>"); msg.getRequestHeader().setMethod("POST"); msg.getRequestHeader().setHeader("Content-Type", "application/xml"); rule.init(msg, parent); rule.localFileInclusionAttack(msg); assertThat(alertsRaised.size(), equalTo(1)); assertThat(alertsRaised.get(0).getEvidence(), equalTo("root:*:0:0")); assertThat( alertsRaised.get(0).getAttack(), equalTo( MessageFormat.format(XxeScanRule.ATTACK_HEADER, "file:/ + XxeScanRule.ATTACK_BODY)); assertThat(alertsRaised.get(0).getRisk(), equalTo(Alert.RISK_HIGH)); assertThat(alertsRaised.get(0).getConfidence(), equalTo(Alert.CONFIDENCE_MEDIUM)); }

Target:
public void shouldAlertWhenLocalFileIncludedInResponse(NanoHTTPD.Response.Status status) throws HttpMalformedHeaderException { String test = "/test"; String responseBody = "[drivers]\n" + "wave=mmdrv.dll"; this.nano.addHandler(createNanoHandler(test, status, responseBody)); HttpMessage msg = getXmlPostMessage(test); rule.init(msg, parent); rule.setAttackStrength(Plugin.AttackStrength.HIGH); rule.scan(); String localFileInclusionAttackPayload = MessageFormat.format(XxeScanRule.ATTACK_HEADER, "file:/ + XxeScanRule.ATTACK_BODY; List<Alert> alertList = alertsRaised.stream() .filter(alert -> alert.getAttack().equals(localFileInclusionAttackPayload)) .collect(Collectors.toList()); assertThat(alertList.size(), equalTo(1)); Alert alert = alertList.get(0); assertThat(alert.getEvidence(), equalTo("[drivers]")); assertThat(alert.getRisk(), equalTo(Alert.RISK_HIGH)); assertThat(alert.getConfidence(), equalTo(Alert.CONFIDENCE_MEDIUM)); }
Source:
protected void addAttachmentToNote(T document, AccountingXmlDocumentBackupLink backupLink, Note note) { try { Attachment attachment = accountingXmlDocumentDownloadAttachmentService.createAttachmentFromBackupLink(document, backupLink); note.setAttachment(attachment); } catch (IOException e) { LOG.error("addAttachmentToNote, unable to create attachment: " + e.getMessage()); String message = MessageFormat.format( configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_CREATE_ACCOUNTING_DOCUMENT_ATTACHMENT_DOWNLOAD), KFSConstants.BLANK_SPACE + backupLink.getLinkUrl()); throw new ValidationException(message); } }

Target:
protected void addAttachmentToNote(T document, AccountingXmlDocumentBackupLink backupLink, Note note) { try { Attachment attachment = accountingXmlDocumentDownloadAttachmentService.createAttachmentFromBackupLink(document, backupLink); note.setAttachment(attachment); } catch (IOException e) { LOG.error("addAttachmentToNote, unable to create attachment: " + e.getMessage()); String message = MessageFormat.format( configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_CREATE_ACCOUNTING_DOCUMENT_ATTACHMENT_DOWNLOAD), backupLink.getLinkUrl()); throw new ValidationException(message); } }
Source:
public void validate(String description) { if (isNullOrEmpty(description)) return; checkArgument(description.length() <= MAX_DESC_LENGTH, "Description can't be longer than " + MAX_DESC_LENGTH + " characters" + " but was " + description.length()); checkArgument(DESCRIPTION_ACCEPTABLE_RANGE.matchesAllOf(description), "Description should have ASCII values between 32 and 126."); }

Target:
public void validate(String description) { if (isNullOrEmpty(description)) return; checkArgument(description.length() <= MAX_DESC_LENGTH, "Description can't be longer than %d characters but was %d", MAX_DESC_LENGTH, description.length()); checkArgument(DESCRIPTION_ACCEPTABLE_RANGE.matchesAllOf(description), "Description should have ASCII values between 32 and 126."); }
Source:
private String getNewPathFromUri(Uri uri) { String filePath = getContext().getFilesDir().getAbsolutePath() + "/temp/" + FileUtil.getFileName(uri.toString()); File file = new File(filePath); try { InputStream fileStream = getContext().getContentResolver().openInputStream(uri); FileUtil.ensureFilePathExists(file); FileUtil.copyFile(fileStream, file); } catch (IOException e1) { e1.printStackTrace(); Logger.log(LogTypes.TYPE_MAINTENANCE, "Getting new file path from uri failed due to " + e1.getMessage()); Toast.makeText(getActivity(), Localization.get("file.selection.failed"), Toast.LENGTH_LONG).show(); return null; } return filePath; }

Target:
private String getNewPathFromUri(Uri uri) throws IOException { String filePath = getContext().getFilesDir().getAbsolutePath() + "/temp/" + FileUtil.getFileName(uri.toString()); File file = new File(filePath); InputStream fileStream = getContext().getContentResolver().openInputStream(uri); FileUtil.ensureFilePathExists(file); FileUtil.copyFile(fileStream, file); return filePath; }
Source:
public String getLogFileParentDir() { ArrayList<String> elements = new ArrayList<String>(); if (mPrefix != null && mPrefix.length() > 0) { elements.add(mPrefix); } if (mTopic != null && mTopic.length() > 0) { if (getCustomTopicsNames() != null && getCustomTopicsNames().isEmpty() == false && getCustomTopicsNames().get(mTopic) != null && getCustomTopicsNames().get(mTopic).length() > 0) { elements.add(getCustomTopicsNames().get(mTopic)); } else { elements.add(mTopic); } } return StringUtils.join(elements, "/"); }

Target:
public String getLogFileParentDir() { elements = new ArrayList<String>(); if (mPrefix != null && mPrefix.length() > 0) { elements.add(mPrefix); } if (mTopic != null && mTopic.length() > 0) { if (getCustomTopicsNames() != null && !getCustomTopicsNames().isEmpty() && getCustomTopicsNames().get(mTopic) != null && getCustomTopicsNames().get(mTopic).length() > 0) { elements.add(getCustomTopicsNames().get(mTopic)); } else { elements.add(mTopic); } } return StringUtils.join(elements, "/"); }
Source:
private String escapePath(String path) { String esc; if (path.indexOf(":") == 1) { esc = path.replaceFirst(":", "").replace('\\', '/'); } else { esc = path.replace('\\', '/'); } if (!esc.startsWith("/")) { esc = "/" + Character.toLowerCase(esc.charAt(0)) + esc.substring(1); } else { esc = Character.toLowerCase(esc.charAt(0)) + esc.substring(1); } return esc; }

Target:
protected String escapePath(String path) { String esc; if (path.indexOf(":") == 1) { esc = path.replaceFirst(":", "").replace('\\', '/'); esc = Character.toLowerCase(esc.charAt(0)) + esc.substring(1); } else { esc = path.replace('\\', '/'); } if (!esc.startsWith("/")) { esc = "/" + esc; } return esc; }
Source:
public void testHetVsArbitrary(final File metricsFile, final double tolerance, final int sampleSize) throws Exception { final MetricsFile Metrics = new MetricsFile(); Metrics.read(new FileReader(metricsFile)); final List<Histogram<Integer>> histograms = Metrics.getAllHistograms(); final Histogram<Integer> depthHistogram = histograms.get(0); final Histogram<Integer> qualityHistogram = histograms.get(1); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double resultFromTS = TheoreticalSensitivity.theoreticalSensitivity(depthHistogram, qualityHistogram, sampleSize, 3, 0.5); final double resultFromTHS = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, 3); Assert.assertEquals(resultFromTS, resultFromTHS, tolerance); }

Target:
public void testHetVsArbitrary(final File metricsFile, final double tolerance, final int sampleSize) throws Exception { final MetricsFile metrics = new MetricsFile(); try (final FileReader metricsFileReader = new FileReader(metricsFile)) { metrics.read(metricsFileReader); } final List<Histogram<Integer>> histograms = metrics.getAllHistograms(); final Histogram<Integer> depthHistogram = histograms.get(0); final Histogram<Integer> qualityHistogram = histograms.get(1); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double resultFromTS = TheoreticalSensitivity.theoreticalSensitivity(depthHistogram, qualityHistogram, sampleSize, 3, 0.5); final double resultFromTHS = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, 3); Assert.assertEquals(resultFromTS, resultFromTHS, tolerance); }
Source:
public void testLuceneIndexLocking(final String writeLockProvider) throws IOException { BaseLockFactory baseLockFactory = BaseLockFactory.INSTANCE; Lock luceneLockA = baseLockFactory.makeLock(directory1, writeLockProvider); Lock luceneLockB = baseLockFactory.makeLock(directory1, writeLockProvider); Lock anotherLock = baseLockFactory.makeLock(directory3, writeLockProvider); assert luceneLockA.obtain(); assert luceneLockB.isLocked(); assert !anotherLock.isLocked(); assert !luceneLockA.obtain(); assert !luceneLockB.obtain(); luceneLockA.close(); assert !luceneLockB.isLocked(); assert luceneLockB.obtain(); luceneLockA.close(); assert !luceneLockB.isLocked(); }

Target:
public void testLuceneIndexLocking(final String writeLockProvider) throws IOException { BaseLockFactory baseLockFactory = BaseLockFactory.INSTANCE; Lock luceneLockA = baseLockFactory.makeLock(directory1, writeLockProvider); Lock luceneLockB = baseLockFactory.makeLock(directory1, writeLockProvider); Lock anotherLock = baseLockFactory.makeLock(directory3, writeLockProvider); assertTrue(luceneLockA.obtain()); assertTrue(luceneLockB.isLocked()); assertFalse(anotherLock.isLocked()); assertFalse(luceneLockA.obtain()); assertFalse(luceneLockB.obtain()); luceneLockA.close(); assertFalse(luceneLockB.isLocked()); assertTrue(luceneLockB.obtain()); luceneLockA.close(); assertFalse(luceneLockB.isLocked()); }
Source:
public Optional<Object> calculateMappedValue(Mapping inputMapping, DelegateExecution execution, ProcessExtensionModel extensions) { if (inputMapping != null) { if (Mapping.SourceMappingType.VALUE.equals(inputMapping.getType()) || Mapping.SourceMappingType.STATIC_VALUE.equals(inputMapping.getType())) { return Optional.of(inputMapping.getValue()); } if (Mapping.SourceMappingType.VARIABLE.equals(inputMapping.getType())) { String name = inputMapping.getValue().toString(); VariableDefinition processVariableDefinition = extensions.getExtensions().getPropertyByName(name); if (processVariableDefinition != null) { return Optional.of(execution.getVariable(processVariableDefinition.getName())); } } } return Optional.empty(); }

Target:
protected Optional<Object> calculateMappedValue(Mapping inputMapping, DelegateExecution execution, ProcessExtensionModel extensions) { if (inputMapping != null) { if (Mapping.SourceMappingType.VALUE.equals(inputMapping.getType()) || Mapping.SourceMappingType.STATIC_VALUE.equals(inputMapping.getType())) { return Optional.of(inputMapping.getValue()); } if (Mapping.SourceMappingType.VARIABLE.equals(inputMapping.getType())) { String name = inputMapping.getValue().toString(); VariableDefinition processVariableDefinition = extensions.getExtensions().getPropertyByName(name); if (processVariableDefinition != null) { return Optional.of(execution.getVariable(processVariableDefinition.getName())); } } } return Optional.empty(); }
Source:
public void testApplyEmptyOrNull() { Assert.assertEquals(null, loadingLookup.apply(null)); if (NullHandling.sqlCompatible()) { Assert.assertEquals(null, loadingLookup.apply("")); } }

Target:
public void testApplyEmptyOrNull() throws ExecutionException { EasyMock.expect(lookupCache.get(EasyMock.eq(""), EasyMock.anyObject(Callable.class))) .andReturn("empty").atLeastOnce(); EasyMock.replay(lookupCache); Assert.assertEquals("empty", loadingLookup.apply("")); if (!NullHandling.sqlCompatible()) { Assert.assertEquals("empty", loadingLookup.apply(null)); } else { Assert.assertNull(loadingLookup.apply(null)); } EasyMock.verify(lookupCache); }
Source:
public T call() throws Exception { try { Request.setPerThreadRequestData(requestData); UUIDs.setRandom(random); ThreadContext.bind(securityManager); ThreadContext.bind(subject); MDC.setContextMap(mdcContextMap); return delegate.call(); } finally { Request.resetPerThreadRequestData(); UUIDs.setRandom(null); ThreadContext.unbindSecurityManager(); ThreadContext.unbindSubject(); MDC.setContextMap(mdcContextMap); } }

Target:
public T call() throws Exception { try { Request.setPerThreadRequestData(requestData); UUIDs.setRandom(random); ThreadContext.bind(securityManager); ThreadContext.bind(subject); MDC.setContextMap(mdcContextMap); return delegate.call(); } finally { Request.resetPerThreadRequestData(); UUIDs.setRandom(null); ThreadContext.unbindSecurityManager(); ThreadContext.unbindSubject(); MDC.clear(); } }
Source:
public Mongo mongo() { return new Fongo("something").getMongo(); }

Target:
public Mongo mongo() { return new Fongo("defaultInstance").getMongo(); }
Source:
public void run() { logger.debug("{}: running {}", DataList.this, this); try { if (addedData() || checkIfListenersHaveDataToSendOnly()) { future = autoFlushExecutor.submit(this); logger.debug("{}: rescheduled {}", DataList.this, this); } else { synchronized (this) { if (isMoreDataAvailable) { isMoreDataAvailable = false; future = autoFlushExecutor.submit(this); logger.debug("{}: rescheduled {}", DataList.this, this); } else { future = null; } } } } catch (Exception e) { logger.debug("{}: {}", DataList.this, this, e); } finally { logger.debug("{}: finished {}", this); } }

Target:
public void run() { logger.debug("{} entered run", this); try { if (addedData() || checkIfListenersHaveDataToSendOnly()) { future = autoFlushExecutor.submit(this); } else { synchronized (this) { if (isMoreDataAvailable) { isMoreDataAvailable = false; future = autoFlushExecutor.submit(this); } else { future = null; } } } } catch (RuntimeException e) { logger.warn("{}", this, e); } finally { logger.debug("{} exiting run", this); } }
Source:
private Repository getRepository(IFileBuffer buffer) { IPath location = getPath(buffer); if (location != null) { return org.eclipse.egit.core.Activator.getDefault() .getRepositoryCache().getRepository(location); } return null; }

Target:
private Repository getRepository(IFileBuffer buffer) { IPath location = getPath(buffer); if (location != null) { return Activator.getDefault().getRepositoryCache() .getRepository(location); } return null; }
Source:
public void close() throws IOException { httpClient.close(); }

Target:
public void close() throws IOException { if (httpClient != null) { httpClient.close(); } }
Source:
public Supplier<Boolean> getTask(@NotNull Context context) { return () -> { Collect.getInstance().getComponent().inject(this); if (storageMigrationRepository.isMigrationBeingPerformed()) { return true; } NetworkInfo currentNetworkInfo = connectivityProvider.getNetworkInfo(); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) || !(networkTypeMatchesAutoSendSetting(currentNetworkInfo) || atLeastOneFormSpecifiesAutoSend())) { if (!networkTypeMatchesAutoSendSetting(currentNetworkInfo)) { return false; } return true; } return changeLock.withLock(acquiredLock -> { if (acquiredLock) { try { Pair<Boolean, String> results = new InstanceSubmitter(analytics).submitUnsubmittedInstances(); notifier.onSubmission(results.first, results.second); } catch (SubmitException e) { switch (e.getType()) { case GOOGLE_ACCOUNT_NOT_SET: notifier.onSubmission(true, TranslationHandler.getString(Collect.getInstance(), R.string.google_set_account)); break; case GOOGLE_ACCOUNT_NOT_PERMITTED: notifier.onSubmission(true, TranslationHandler.getString(Collect.getInstance(), R.string.odk_permissions_fail)); break; case NOTHING_TO_SUBMIT: break; } } return true; } else { return false; } }); }; }

Target:
public Supplier<Boolean> getTask(@NotNull Context context) { return () -> { Collect.getInstance().getComponent().inject(this); if (storageMigrationRepository.isMigrationBeingPerformed()) { return true; } NetworkInfo currentNetworkInfo = connectivityProvider.getNetworkInfo(); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) || !(networkTypeMatchesAutoSendSetting(currentNetworkInfo) || atLeastOneFormSpecifiesAutoSend())) { if (!networkTypeMatchesAutoSendSetting(currentNetworkInfo)) { return false; } return true; } return changeLock.withLock(acquiredLock -> { if (acquiredLock) { try { Pair<Boolean, String> results = new InstanceSubmitter(analytics, formsRepository, instancesRepository, googleAccountsManager, googleApiProvider).submitUnsubmittedInstances(); notifier.onSubmission(results.first, results.second); } catch (SubmitException e) { switch (e.getType()) { case GOOGLE_ACCOUNT_NOT_SET: notifier.onSubmission(true, context.getString(R.string.google_set_account)); break; case GOOGLE_ACCOUNT_NOT_PERMITTED: notifier.onSubmission(true, context.getString(R.string.odk_permissions_fail)); break; case NOTHING_TO_SUBMIT: break; } } return true; } else { return false; } }); }; }
Source:
public ShadowMapNode(Context context) { worldRenderer = context.get(WorldRenderer.class); renderQueues = context.get(RenderQueuesHelper.class); backdropProvider = context.get(BackdropProvider.class); Config config = context.get(Config.class); RenderableWorld renderableWorld = context.get(RenderableWorld.class); ShadowMapResolutionDependentFBOs shadowMapResolutionDependentFBOs = context.get(ShadowMapResolutionDependentFBOs.class); this.playerCamera = worldRenderer.getActiveCamera(); this.renderingConfig = config.getRendering(); renderableWorld.setShadowMapCamera(shadowMapCamera); requiresFBO(new FBOConfig(SHADOW_MAP_FBO, FBO.Type.NO_COLOR).useDepthBuffer(), shadowMapResolutionDependentFBOs); texelSize = 1.0f / renderingConfig.getShadowMapResolution() * 2.0f; renderingConfig.subscribe(RenderingConfig.SHADOW_MAP_RESOLUTION, this); requiresCondition(() -> renderingConfig.isDynamicShadows()); renderingConfig.subscribe(RenderingConfig.DYNAMIC_SHADOWS, this); addDesiredStateChange(new BindFBO(SHADOW_MAP_FBO, shadowMapResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(SHADOW_MAP_FBO, shadowMapResolutionDependentFBOs)); addDesiredStateChange(new EnableMaterial(SHADOW_MAP_MATERIAL)); }

Target:
public ShadowMapNode(Context context) { super(context); renderQueues = context.get(RenderQueuesHelper.class); backdropProvider = context.get(BackdropProvider.class); worldRenderer = context.get(WorldRenderer.class); this.playerCamera = worldRenderer.getActiveCamera(); this.renderingConfig = context.get(Config.class).getRendering(); context.get(RenderableWorld.class).setShadowMapCamera(shadowMapCamera); texelSize = 1.0f / renderingConfig.getShadowMapResolution() * 2.0f; renderingConfig.subscribe(RenderingConfig.SHADOW_MAP_RESOLUTION, this); requiresCondition(() -> renderingConfig.isDynamicShadows()); renderingConfig.subscribe(RenderingConfig.DYNAMIC_SHADOWS, this); ShadowMapResolutionDependentFBOs shadowMapResolutionDependentFBOs = context.get(ShadowMapResolutionDependentFBOs.class); requiresFBO(new FBOConfig(SHADOW_MAP_FBO, FBO.Type.NO_COLOR).useDepthBuffer(), shadowMapResolutionDependentFBOs); addDesiredStateChange(new BindFBO(SHADOW_MAP_FBO, shadowMapResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(SHADOW_MAP_FBO, shadowMapResolutionDependentFBOs)); addDesiredStateChange(new EnableMaterial(SHADOW_MAP_MATERIAL)); }
Source:
public void onPageStarted(WebView view, String urlClient, Bitmap favicon) { if (progressCircle == null) { progressCircle = new ProgressDialog(view.getContext(), R.style.WebViewLoadingCircle); progressCircle.setCancelable(true); progressCircle.setCanceledOnTouchOutside(false); progressCircle.setProgressStyle(android.R.style.Widget_ProgressBar_Small); try { progressCircle.show(); } catch (Exception e) { Log.e(TAG, "Exception while showing progress circle", e); } } if (callMainMenu && urlClient.equals(Constants.BASE_URL_HTTPS)) { Intent intent = new Intent(getBaseContext(), MainMenuActivity.class); startActivity(intent); } }

Target:
public void onPageStarted(WebView view, String urlClient, Bitmap favicon) { if (callMainMenu && urlClient.equals(Constants.BASE_URL_HTTPS)) { Intent intent = new Intent(getBaseContext(), MainMenuActivity.class); startActivity(intent); } }
Source:
private void checkUsage(IdentifierTree parameterUsage, MethodTree methodTree) { Tree parameterParent = parameterUsage.identifierToken().parent(); while (!parameterParent.equals(methodTree) && !assertReported.contains(parameterParent)) { if (parameterParent.is(Tree.Kind.ASSERT_STATEMENT)) { assertReported.add((AssertStatementTree) parameterParent); reportIssue(parameterParent, "Replace this assert with a proper check."); return; } parameterParent = parameterParent.parent(); } }

Target:
private void checkUsage(IdentifierTree parameterUsage, MethodTree methodTree) { Tree parameterParent = parameterUsage.parent(); while (!parameterParent.equals(methodTree) && !assertReported.contains(parameterParent)) { if (parameterParent.is(Tree.Kind.ASSERT_STATEMENT)) { assertReported.add((AssertStatementTree) parameterParent); reportIssue(parameterParent, "Replace this assert with a proper check."); return; } parameterParent = parameterParent.parent(); } }
Source:
public static void checkBlackPearlForTapeFailure(final Ds3Client client) throws IOException, SignatureException, CommandException { final List<TapeFailure> tapeFailures = client.getTapeFailuresSpectraS3(new GetTapeFailuresSpectraS3Request()).getTapeFailureListResult().getTapeFailure(); if (tapeFailures != null && !Iterables.isEmpty(tapeFailures)) { throw new CommandException(new TapeFailureException(tapeFailures.iterator())); } }

Target:
public static void checkBlackPearlForTapeFailure(final Ds3Client client) throws IOException, SignatureException, CommandException { final List<TapeFailure> tapeFailures = client.getTapeFailuresSpectraS3(new GetTapeFailuresSpectraS3Request()).getTapeFailureListResult().getTapeFailure(); if (Guard.isNotNullAndNotEmpty(tapeFailures)) { throw new CommandException(new TapeFailureException(tapeFailures.iterator())); } }
Source:
private void dumpTable(String dbName, String tblName, Path dbRoot) throws Exception { try { Hive db = getHive(); BaseSemanticAnalyzer.TableSpec ts = new BaseSemanticAnalyzer.TableSpec(db, conf, dbName + "." + tblName, null); TableExport.Paths exportPaths = new TableExport.Paths(work.astRepresentationForErrorMsg, dbRoot, tblName, conf); new TableExport(exportPaths, ts, getNewReplicationSpec(), db, conf, LOG).run(); REPL_STATE_LOG.info( "Repl Dump: Analyzed dump for table/view: {}.{} and dumping metadata and data to path {}", dbName, tblName, exportPaths.exportRootDir.toString()); } catch (InvalidTableException te) { LOG.debug(te.getMessage()); } }

Target:
private void dumpTable(String dbName, String tblName, Path dbRoot) throws Exception { try { Hive db = getHive(); TableSpec ts = new TableSpec(db, conf, dbName + "." + tblName, null); TableExport.Paths exportPaths = new TableExport.Paths(work.astRepresentationForErrorMsg, dbRoot, tblName, conf); new TableExport(exportPaths, ts, getNewReplicationSpec(), db, conf, LOG).run(); REPL_STATE_LOG.info( "Repl Dump: Analyzed dump for table/view: {}.{} and dumping metadata and data to path {}", dbName, tblName, exportPaths.exportRootDir.toString()); } catch (InvalidTableException te) { LOG.debug(te.getMessage()); } }
Source:
public void testRegisteredAdapterFactoryCache() { setUpAdapterFactoryRegistry(createNullContext()); final Collection<String> styledLabelProvider = Lists.newArrayList(ComparePackage.eNS_URI, IItemStyledLabelProvider.class.getName()); TestAdapterFactoryDescriptor rank40 = new TestAdapterFactoryDescriptor("Rank40", 40, null); registry.put(styledLabelProvider, rank40); final ComposedAdapterFactory fAdapterFactory = new EMFCompareComposedAdapterFactory(rankedRegistry); final Collection<?> styledLabelProviderTypes = Lists.newArrayList(ComparePackage.eINSTANCE, IItemStyledLabelProvider.class); AdapterFactory firstFactory = fAdapterFactory.getFactoryForTypes(styledLabelProviderTypes); AdapterFactory secondFactory = fAdapterFactory.getFactoryForTypes(styledLabelProviderTypes); assertNotNull(firstFactory); assertEquals(firstFactory, secondFactory); }

Target:
public void testRegisteredAdapterFactoryCache() { setUpAdapterFactoryRegistry(createNullContext()); final Collection<String> styledLabelProvider = Lists.newArrayList(ComparePackage.eNS_URI, IItemStyledLabelProvider.class.getName()); TestAdapterFactoryDescriptor rank40 = new TestAdapterFactoryDescriptor("Rank40", 40, null); registry.put(styledLabelProvider, rank40); final ComposedAdapterFactory fAdapterFactory = new EMFCompareComposedAdapterFactory(rankedRegistry); final Collection<?> styledLabelProviderTypes = Lists.newArrayList(ComparePackage.eINSTANCE, IItemStyledLabelProvider.class); AdapterFactory firstFactory = fAdapterFactory.getFactoryForTypes(styledLabelProviderTypes); AdapterFactory secondFactory = fAdapterFactory.getFactoryForTypes(styledLabelProviderTypes); assertNotNull(firstFactory); assertSame(firstFactory, secondFactory); }
Source:
public void testCameraBrick() { checkIfBrickAtPositionShowsString(cameraBrickPosition, R.string.brick_video); checkIfSpinnerOnBrickAtPositionShowsString(R.id.brick_video_spinner, cameraBrickPosition, R.string .video_brick_camera_on); checkIfBrickAtPositionShowsString(chooseCameraBrickPosition, R.string.brick_choose_camera); checkIfSpinnerOnBrickAtPositionShowsString(R.id.brick_choose_camera_spinner, chooseCameraBrickPosition, R.string .choose_camera_front); onView(withId(R.id.brick_choose_camera_spinner)).perform(click()); onView(withText(R.string.choose_camera_back)).perform(click()); onView(withText(R.string.choose_camera_back)).check(matches(isDisplayed())); onView(withId(R.id.brick_choose_camera_spinner)).perform(click()); onView(withText(R.string.choose_camera_front)).perform(click()); onView(withText(R.string.choose_camera_front)).check(matches(isDisplayed())); onView(withId(R.id.brick_video_spinner)).perform(click()); onView(withText(R.string.video_brick_camera_on)).perform(click()); onView(withText(R.string.video_brick_camera_on)).check(matches(isDisplayed())); onView(withId(R.id.brick_video_spinner)).perform(click()); onView(withText(R.string.video_brick_camera_off)).perform(click()); onView(withText(R.string.video_brick_camera_off)).check(matches(isDisplayed())); }

Target:
public void testCameraBrick() { checkIfBrickAtPositionShowsString(cameraBrickPosition, R.string.brick_video); checkIfSpinnerOnBrickAtPositionShowsString(R.id.brick_video_spinner, cameraBrickPosition, R.string .video_brick_camera_on); List<Integer> spinnerValues = new ArrayList<>(); spinnerValues.add(R.string.video_brick_camera_on); spinnerValues.add(R.string.video_brick_camera_off); checkIfValuesAvailableInSpinnerOnBrick(spinnerValues, R.id.brick_video_spinner, cameraBrickPosition); }
Source:
protected String doGet(String apiUrl, Map<String,String> data) throws Exception { String fullUrl = BASE_URL + apiUrl; if (data != null) { if (data.size() > 0) { fullUrl += "?"; } for (Map.Entry<String,String> entry : data.entrySet()) { fullUrl += entry.getKey() + "=" + uriEncode(entry.getValue()) + "&"; } } if (_clientId != null) { if (data == null || data.size() == 0) { fullUrl += "?"; } fullUrl += "clientUUID=" + _clientId; } fullUrl += "&profileIdentifier=" + uriEncode(this._profileName); OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder() .url(fullUrl) .build(); Response response = okHttpClient.newCall(request).execute(); return response.body().string(); }

Target:
protected String doGet(String apiUrl, Map<String,String> data) throws Exception { String fullUrl = getRequestUrlFromMap(apiUrl, data); if (_clientId != null) { if (data == null || data.isEmpty()) { fullUrl += "?"; } fullUrl += "clientUUID=" + _clientId; } fullUrl += "&profileIdentifier=" + uriEncode(this._profileName); Request request = new Request.Builder() .url(fullUrl) .build(); Response response = okHttpClient.newCall(request).execute(); return response.body().string(); }
Source:
private Consumer<Traverser<Try<ExcelDescription>>> getExcelDataTraverser( PropertyColumnMetadata propertyColumnMetadata, PropertyData propertyData, Map.Entry<String, LocalProperty> prop) { return x -> { x.get().onSuccess(excelDescription -> { propertyColumnMetadata.addColumnInformation(excelDescription, prop.getKey()); propertyData.putProperty(prop.getKey(), excelDescription); }); x.get().onFailure(e -> { LOG.error("Something went wrong while reading the property '{}' of '{}'", prop.getKey(), type, e); }); }; }

Target:
private Consumer<Traverser<Try<ExcelDescription>>> getExcelDataTraverser( PropertyColumnMetadata propertyColumnMetadata, PropertyData propertyData, Map.Entry<String, LocalProperty> prop) { return tryOfExcelDescription -> { tryOfExcelDescription.get().onSuccess(excelDescription -> { propertyColumnMetadata.addColumnInformation(excelDescription, prop.getKey()); propertyData.putProperty(prop.getKey(), excelDescription); }); tryOfExcelDescription.get().onFailure(e -> { LOG.error("Something went wrong while reading the property '{}' of '{}'", prop.getKey(), type, e); }); }; }
Source:
void doShow() { setVisible(true); GPLogger.log(String.format("Bounds after setVisible: %s", getBounds())); try { Class.forName("java.awt.desktop.AboutHandler"); DesktopIntegration.setup(GanttProject.this); } catch (ClassNotFoundException e) { GPLogger.log(e); } getActiveChart().reset(); getRssFeedChecker().setOptionsVersion(getGanttOptions().getVersion()); getRssFeedChecker().setUpdater(getUpdater()); getRssFeedChecker().run(); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); }

Target:
void doShow() { setVisible(true); GPLogger.log(String.format("Bounds after setVisible: %s", getBounds())); DesktopIntegration.setup(GanttProject.this); getActiveChart().reset(); getRssFeedChecker().setOptionsVersion(getGanttOptions().getVersion()); getRssFeedChecker().setUpdater(getUpdater()); getRssFeedChecker().run(); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); }
Source:
public void animateEvent(ModelEvent event) { if (event.messageType == MessageType.PROCESSING_SIGNAL) { return; } this.register(event); }

Target:
public void animateEvent(ModelEvent event) { if (event.messageType != MessageType.PROCESSING_SIGNAL) { register(event); } }
Source:
@Override public Vector apply(K k, V v) { Vector res = basePreprocessor.apply(k, v); assert res.size() == min.length; assert res.size() == max.length; for (int i = 0; i < res.size(); i++) { double scaled = (res.get(i) - min[i]) / (max[i] - min[i]); if (Double.isNaN(scaled)) res.set(i, 0); else res.set(i, scaled); } return res; }

Target:
@Override public Vector apply(K k, V v) { Vector res = basePreprocessor.apply(k, v); assert res.size() == min.length; assert res.size() == max.length; for (int i = 0; i < res.size(); i++) { double num = res.get(i) - min[i]; double denom = max[i] - min[i]; double scaled = num / denom; if (Double.isNaN(scaled)) res.set(i, num); else res.set(i, scaled); } return res; }
Source:
public ParameterDialog(Shell parentShell, String dialogTitle, String dialogMessage, String baseCommand, IInputValidator validator) { super(parentShell); this.title = dialogTitle; message = dialogMessage; value = ""; this.validator = validator; this.baseCommand = baseCommand; }

Target:
public ParameterDialog(Shell parentShell, String dialogTitle, String dialogMessage, String baseCommand, IInputValidator validator) { super(parentShell); fTitle = dialogTitle; fMessage = dialogMessage; fValue = ""; fValidator = validator; fBaseCommand = baseCommand; }
Source:
public void setOwner(String owner) { this.owner = owner; }

Target:
public void setOwner(String owner) { this.owner = Util.fixEmpty(owner); }
Source:
public void canAccessHeadersCaseInsensitively() { List<String> valueList = Collections.singletonList("application/json"); Response response = Response.builder() .status(200) .reason(null) .headers(Collections.singletonMap("Content-Type", valueList)) .body(new byte[0]) .build(); assertThat(response.headers().get("content-type")).isEqualTo(valueList); assertThat(response.headers().get("Content-Type")).isEqualTo(valueList); }

Target:
public void canAccessHeadersCaseInsensitively() { Map<String, Collection<String>> headersMap = new LinkedHashMap(); List<String> valueList = Collections.singletonList("application/json"); headersMap.put("Content-Type", valueList); Response response = Response.builder() .status(200) .headers(headersMap) .body(new byte[0]) .build(); assertThat(response.headers().get("content-type")).isEqualTo(valueList); assertThat(response.headers().get("Content-Type")).isEqualTo(valueList); }
Source:
private void printAgentDescription(TaskListener listener) { if (pod != null && showRawYaml) { listener.getLogger().println(Serialization.asYaml(pod)); } }

Target:
private void printAgentDescription(TaskListener listener) { if (pod != null) { listener.getLogger().println(Serialization.asYaml(pod)); } }
Source:
public Block getLoadedBlock() { Block loadedValueBlock = value.getLoadedBlock(); if (loadedValueBlock == value) { return this; } else { throw new IllegalArgumentException("Value block is not loaded"); } }

Target:
public Block getLoadedBlock() { Block loadedValueBlock = value.getLoadedBlock(); if (loadedValueBlock == value) { return this; } return new RunLengthEncodedBlock(loadedValueBlock, positionCount); }
Source:
private void deployNodeSourceOrFail(String nodeSourceName, NodeSourceDescriptor nodeSourceDescriptor) { try { NodeSource nodeSourceToDeploy = this.createNodeSourceInstance(nodeSourceDescriptor); NodeSourcePolicy nodeSourcePolicyStub = this.createNodeSourcePolicyActivity(nodeSourceDescriptor, nodeSourceToDeploy); NodeSource nodeSourceStub = this.createNodeSourceActivity(nodeSourceName, nodeSourceToDeploy); this.configureDeployedNodeSource(nodeSourceName, nodeSourceDescriptor, nodeSourceStub, nodeSourcePolicyStub); this.deployedNodeSources.put(nodeSourceName, nodeSourceStub); this.emitNodeSourceEvent(nodeSourceStub, RMEventType.NODESOURCE_CREATED); logger.info(NODE_SOURCE_STRING + nodeSourceName + " has been successfully deployed"); } catch (RuntimeException e) { this.updateNodeSourceDescriptorWithStatusAndPersist(nodeSourceDescriptor, NodeSourceStatus.NODES_UNDEPLOYED); logger.error(NODE_SOURCE_STRING + nodeSourceName + " failed to be deployed", e); throw e; } }

Target:
private void deployNodeSourceOrFail(String nodeSourceName, NodeSourceDescriptor nodeSourceDescriptor) { try { NodeSource nodeSourceToDeploy = this.createNodeSourceInstance(nodeSourceDescriptor); NodeSourcePolicy nodeSourcePolicyStub = this.createNodeSourcePolicyActivity(nodeSourceDescriptor, nodeSourceToDeploy); NodeSource nodeSourceStub = this.createNodeSourceActivity(nodeSourceName, nodeSourceToDeploy); this.configureDeployedNodeSource(nodeSourceName, nodeSourceDescriptor, nodeSourceStub, nodeSourcePolicyStub); this.deployedNodeSources.put(nodeSourceName, nodeSourceStub); this.emitNodeSourceEvent(nodeSourceStub, RMEventType.NODESOURCE_CREATED); logger.info(NODE_SOURCE_STRING + nodeSourceName + " has been successfully deployed"); } catch (Exception e) { this.updateNodeSourceDescriptorWithStatusAndPersist(nodeSourceDescriptor, NodeSourceStatus.NODES_UNDEPLOYED); logger.error(NODE_SOURCE_STRING + nodeSourceName + " failed to be deployed", e); throw e; } }
Source:
public ExtractionFn getExtractionFn() { final LookupExtractor lookupExtractor = Strings.isNullOrEmpty(name) ? this.lookup : Preconditions.checkNotNull( Preconditions.checkNotNull( this.lookupReferencesManager, "can not find lookup manager" ).get(name).get(), "can not find lookup with name [%s]", name ); return new DimExtractionFn() { @Override public byte[] getCacheKey() { return lookupExtractor.getCacheKey(); } @Override public String apply(String value) { final String retVal = Strings.emptyToNull(lookupExtractor.apply(value)); if (retainMissingValues) { return retVal == null ? Strings.emptyToNull(value) : retVal; } else { return retVal == null ? replaceMissingWith : retVal; } } @Override public boolean preservesOrdering() { return false; } @Override public ExtractionType getExtractionType() { return lookupExtractor.isOneToOne() ? ExtractionType.ONE_TO_ONE : ExtractionType.MANY_TO_ONE; } }; }

Target:
public ExtractionFn getExtractionFn() { final LookupExtractor lookupExtractor = Strings.isNullOrEmpty(name) ? this.lookup : Preconditions.checkNotNull( this.lookupReferencesManager.get(name).get(), "can not find lookup with name [%s]", name ); return new LookupExtractionFn( lookupExtractor, retainMissingValue, replaceMissingValueWith, lookupExtractor.isOneToOne(), optimize ); }
Source:
public ZooKeeper( String connectString, int sessionTimeout, Watcher watcher, long sessionId, byte[] sessionPasswd, boolean canBeReadOnly, HostProvider aHostProvider, ZKClientConfig clientConfig) throws IOException { LOG.info( "Initiating client connection, connectString={} sessionTimeout={} watcher={} sessionId={} sessionPasswd={}", connectString, sessionTimeout, watcher, Long.toHexString(sessionId), (sessionPasswd == null ? "<null>" : "<hidden>")); if (clientConfig == null) { clientConfig = new ZKClientConfig(); } this.clientConfig = clientConfig; watchManager = defaultWatchManager(); watchManager.defaultWatcher = watcher; ConnectStringParser connectStringParser = new ConnectStringParser(connectString); hostProvider = aHostProvider; cnxn = new ClientCnxn( connectStringParser.getChrootPath(), hostProvider, sessionTimeout, this, watchManager, getClientCnxnSocket(), sessionId, sessionPasswd, canBeReadOnly); cnxn.seenRwServerBefore = true; cnxn.start(); }

Target:
public ZooKeeper( String connectString, int sessionTimeout, Watcher watcher, long sessionId, byte[] sessionPasswd, boolean canBeReadOnly, HostProvider aHostProvider, ZKClientConfig clientConfig) throws IOException { LOG.info( "Initiating client connection, connectString={} " + "sessionTimeout={} watcher={} sessionId=0x{} sessionPasswd={}", connectString, sessionTimeout, watcher, Long.toHexString(sessionId), (sessionPasswd == null ? "<null>" : "<hidden>")); if (clientConfig == null) { clientConfig = new ZKClientConfig(); } this.clientConfig = clientConfig; watchManager = defaultWatchManager(); watchManager.defaultWatcher = watcher; ConnectStringParser connectStringParser = new ConnectStringParser(connectString); hostProvider = aHostProvider; cnxn = new ClientCnxn( connectStringParser.getChrootPath(), hostProvider, sessionTimeout, this, watchManager, getClientCnxnSocket(), sessionId, sessionPasswd, canBeReadOnly); cnxn.seenRwServerBefore = true; cnxn.start(); }
Source:
public void cleanupLiveInstanceOwners() throws InterruptedException { String testClassName = this.getShortClassName(); System.out.println("AfterClass:" + testClassName + " afterclass of ZkTestBase called!"); for (String cluster : _liveInstanceOwners.keySet()) { Map<String, HelixZkClient> clientMap = _liveInstanceOwners.get(cluster); for (HelixZkClient client : clientMap.values()) { client.close(); } clientMap.clear(); } _liveInstanceOwners.clear(); boolean status = false; try { status = ThreadLeakageChecker.afterClassCheck(testClassName); } catch (Exception e) { System.out.println("ThreadLeakageChecker exception:" + e.getStackTrace()); } if (!status) { System.out.println("---------- Test Class " + testClassName + " thread leakage detected! ---------------"); } }

Target:
public void cleanupLiveInstanceOwners() throws InterruptedException { String testClassName = this.getShortClassName(); for (String cluster : _liveInstanceOwners.keySet()) { Map<String, HelixZkClient> clientMap = _liveInstanceOwners.get(cluster); for (HelixZkClient client : clientMap.values()) { client.close(); } clientMap.clear(); } _liveInstanceOwners.clear(); boolean status = false; try { status = ThreadLeakageChecker.afterClassCheck(testClassName); } catch (Exception e) { LOG.error("ThreadLeakageChecker exception:", e); } if (!status) { System.out.println("---------- Test Class " + testClassName + " thread leakage detected! ---------------"); } }
Source:
private static int getRowCountForEmptyColValue(Connection conn, String tableName, byte[] valueBytes) throws IOException, SQLException { PTable table = PhoenixRuntime.getTable(conn, tableName); byte[] emptyCF = SchemaUtil.getEmptyColumnFamily(table); byte[] emptyCQ = EncodedColumnsUtil.getEmptyKeyValueInfo(table).getFirst(); HTable htable = (HTable) conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(table.getPhysicalName().getBytes()); Scan scan = new Scan(); scan.addColumn(emptyCF, emptyCQ); ResultScanner resultScanner = htable.getScanner(scan); int count = 0; for (Result result = resultScanner.next(); result != null; result = resultScanner.next()) { if (Bytes.compareTo(result.getValue(emptyCF, emptyCQ), 0, valueBytes.length, valueBytes, 0, valueBytes.length) == 0) { ++count; } } return count; }

Target:
private static int getRowCountForEmptyColValue(Connection conn, String tableName, byte[] valueBytes) throws IOException, SQLException { PTable table = PhoenixRuntime.getTable(conn, tableName); byte[] emptyCF = SchemaUtil.getEmptyColumnFamily(table); byte[] emptyCQ = EncodedColumnsUtil.getEmptyKeyValueInfo(table).getFirst(); ConnectionQueryServices queryServices = conn.unwrap(PhoenixConnection.class).getQueryServices(); HTable htable = (HTable) queryServices.getTable(table.getPhysicalName().getBytes()); Scan scan = new Scan(); scan.addColumn(emptyCF, emptyCQ); ResultScanner resultScanner = htable.getScanner(scan); int count = 0; for (Result result = resultScanner.next(); result != null; result = resultScanner.next()) { if (Bytes.compareTo(result.getValue(emptyCF, emptyCQ), 0, valueBytes.length, valueBytes, 0, valueBytes.length) == 0) { ++count; } } return count; }
Source:
public void update(long nowMs) { synchronized (SendSideBandwidthEstimation.this) { long time_since_packet_report_ms = nowMs - last_packet_report_ms_; boolean currentStateHasTimedOut = time_since_packet_report_ms < 1.2 * kFeedbackIntervalMs; update(nowMs, currentStateHasTimedOut, null); } }

Target:
public void update(long nowMs) { synchronized (SendSideBandwidthEstimation.this) { long time_since_packet_report_ms = nowMs - last_packet_report_ms_; boolean currentStateHasTimedOut = time_since_packet_report_ms < kPacketReportTimeoutIntervals * kFeedbackIntervalMs; update(nowMs, currentStateHasTimedOut, null); } }
Source:
public int getHeadwayForStopByRoute (String stop_id, String route_id, LocalDate date, LocalTime from, LocalTime to) { List<Trip> tripsForStop = feed.getStopTimesForStop(stop_id).stream() .filter(t -> feed.trips.get(t.a).route_id.equals(route_id)) .map(t -> feed.trips.get(t.b.a)) .filter(trip -> feed.services.get(trip.service_id).activeOn(date)) .collect(Collectors.toList()); return getStopHeadwayForTrips(stop_id, tripsForStop, from, to); }

Target:
public int getHeadwayForStopByRoute (String stop_id, String route_id, LocalDate date, LocalTime from, LocalTime to) { List<Trip> tripsForStop = feed.getDistinctTripsForStop(stop_id).stream() .filter(trip -> feed.trips.get(trip.trip_id).route_id.equals(route_id)) .filter(trip -> feed.services.get(trip.service_id).activeOn(date)) .collect(Collectors.toList()); return getStopHeadwayForTrips(stop_id, tripsForStop, from, to); }
Source:
private void createTabletDirectories(VolumeManager fs, SortedSet<Text> dirInfo) throws IOException { for (Text info : dirInfo) { if (fs.exists(new Path(info.toString()))) throw new IllegalStateException("Dir exists when it should not: " + info); if (!fs.mkdirs(new Path(info.toString()))) throw new IOException("Failed to create tablet directory: " + info); } }

Target:
private void createTabletDirectories(VolumeManager fs, SortedSet<Text> dirInfo) throws IOException { for (Text dir : dirInfo) { if (!fs.mkdirs(new Path(dir.toString()))) throw new IOException("Failed to create tablet directory: " + dir); } }
Source:
private QueryTraversal(GraphQLSchema schema, Document document, String operation, Map<String, Object> variables) { assertNotNull(document, "document can't be null"); NodeUtil.GetOperationResult getOperationResult = NodeUtil.getOperation(document, operation); this.schema = assertNotNull(schema, "schema can't be null"); this.variables = assertNotNull(variables, "variables can't be null"); this.fragmentsByName = getOperationResult.fragmentsByName; this.roots = Collections.singletonList(getOperationResult.operationDefinition); this.rootParentType = getRootTypeFromOperation(getOperationResult.operationDefinition); }

Target:
private QueryTraversal(GraphQLSchema schema, Document document, String operation, Map<String, Object> variables) { assertNotNull(document, "document can't be null"); NodeUtil.GetOperationResult getOperationResult = NodeUtil.getOperation(document, operation); this.schema = assertNotNull(schema, "schema can't be null"); this.variables = assertNotNull(variables, "variables can't be null"); this.fragmentsByName = getOperationResult.fragmentsByName; this.roots = singletonList(getOperationResult.operationDefinition); this.rootParentType = getRootTypeFromOperation(getOperationResult.operationDefinition); }
Source:
void openFragmentAddDiet () { Log.i("INFO", "Début de onClick sur fab de FragmentDiets"); Fragment fragment = new EditDietFragment(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container, fragment ); transaction.addToBackStack(null); transaction.commit(); }

Target:
void openFragmentAddDiet () { Log.i("INFO", "Starting onClick on fab from FragmentDiets"); Fragment fragment = new EditDietFragment(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container, fragment ); transaction.addToBackStack(null); transaction.commit(); }