auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void getHardwareInfo(VDS vds) { Set<Version> hostVersions = null; Version clusterCompatibility = vds.getClusterCompatibilityVersion(); if ( (hostVersions = vds.getSupportedClusterVersionsSet()) != null && hostVersions.contains(clusterCompatibility)) { VDSReturnValue ret = resourceManager.runVdsCommand(VDSCommandType.GetHardwareInfo, new VdsIdAndVdsVDSCommandParametersBase(vds)); if (!ret.getSucceeded()) { AuditLogable logable = createAuditLogableForHost(vds); logable.updateCallStackFromThrowable(ret.getExceptionObject()); auditLogDirector.log(logable, AuditLogType.VDS_FAILED_TO_GET_HOST_HARDWARE_INFO); } } }

Target:
public void getHardwareInfo(VDS vds) { Set<Version> hostVersions = vds.getSupportedClusterVersionsSet(); Version clusterCompatibility = vds.getClusterCompatibilityVersion(); if (hostVersions != null && hostVersions.contains(clusterCompatibility)) { VDSReturnValue ret = resourceManager.runVdsCommand(VDSCommandType.GetHardwareInfo, new VdsIdAndVdsVDSCommandParametersBase(vds)); if (!ret.getSucceeded()) { AuditLogable logable = createAuditLogableForHost(vds); logable.updateCallStackFromThrowable(ret.getExceptionObject()); auditLogDirector.log(logable, AuditLogType.VDS_FAILED_TO_GET_HOST_HARDWARE_INFO); } } }
Source:
private void setAlpha(RoundedImageView view, float alpha) { if (Build.VERSION.SDK_INT < 11) { view.setAlpha((int) (255 * alpha)); } else { view.setAlpha(alpha); } }

Target:
private void setAlpha(RoundedImageView view, float alpha) { if (Build.VERSION.SDK_INT >= 11) { view.setAlpha(alpha); } else { view.setAlpha((int) (255 * alpha)); } }
Source:
public void ensureEncrypted() { this.userName = StringUtils.stripToNull(this.userName); setPasswordIfNotBlank(password); if (encryptedPassword != null) { goCipher.maybeReEncrypt(encryptedPassword, new Consumer<String>() { @Override public void accept(String encryptedPassword) { setEncryptedPassword(encryptedPassword); } }); } }

Target:
public void ensureEncrypted() { this.userName = StringUtils.stripToNull(this.userName); setPasswordIfNotBlank(password); if (encryptedPassword != null) { setEncryptedPassword(goCipher.maybeReEncryptForPostConstructWithoutExceptions(encryptedPassword)); } }
Source:
public void enableGps() throws KuraException { logger.warn("Modem GPS not supported"); }

Target:
public void enableGps() throws KuraException { throw new UnsupportedOperationException("Modem GPS not supported"); }
Source:
public int hashCode() { return this.executionVertexID.hashCode() ^ this.attemptNumber; }

Target:
public int hashCode() { return this.executionVertexId.hashCode() * 31 + this.attemptNumber; }
Source:
private boolean shouldSkip() { if (cache.lastDocId != context.hitContext.docId()) { cache.lastMatched = false; cache.lastDocId = context.hitContext.docId(); } Boolean skipIfLastMatched = (Boolean)getOption("skip_if_last_matched"); if (skipIfLastMatched == null ? false : skipIfLastMatched && cache.lastMatched) { return true; } return false; }

Target:
private boolean shouldSkip() { if (cache.lastDocId != context.hitContext.docId()) { cache.lastMatched = false; cache.lastDocId = context.hitContext.docId(); } Boolean skipIfLastMatched = (Boolean)getOption("skip_if_last_matched"); return skipIfLastMatched == null ? false : skipIfLastMatched && cache.lastMatched; }
Source:
public void testConstructorReturnsValue() throws Exception { IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf = new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return System.getAttributes();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot = getASTRoot(cu); ArrayList proposals = collectCorrections(cu, astRoot); assertNumberOfProposals(proposals, 2); assertCorrectLabels(proposals); { ASTRewriteCorrectionProposal proposal = (ASTRewriteCorrectionProposal) proposals.get(0); String preview = getPreviewContent(proposal); buf = new StringBuffer(); buf.append("package test1;\n"); buf.append("\n"); buf.append("import java.util.Properties;\n"); buf.append("\n"); buf.append("public class E {\n"); buf.append(" public Properties E() {\n"); buf.append(" return System.getAttributes();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } { ASTRewriteCorrectionProposal proposal = (ASTRewriteCorrectionProposal) proposals.get(1); String preview = getPreviewContent(proposal); buf = new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } }

Target:
public void testConstructorReturnsValue() throws Exception { IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf = new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return System.getProperties();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot = getASTRoot(cu); ArrayList proposals = collectCorrections(cu, astRoot); assertNumberOfProposals(proposals, 2); assertCorrectLabels(proposals); { ASTRewriteCorrectionProposal proposal = (ASTRewriteCorrectionProposal) proposals.get(0); String preview = getPreviewContent(proposal); buf = new StringBuffer(); buf.append("package test1;\n"); buf.append("\n"); buf.append("import java.util.Properties;\n"); buf.append("\n"); buf.append("public class E {\n"); buf.append(" public Properties E() {\n"); buf.append(" return System.getProperties();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } { ASTRewriteCorrectionProposal proposal = (ASTRewriteCorrectionProposal) proposals.get(1); String preview = getPreviewContent(proposal); buf = new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } }
Source:
public void visitNode(Tree tree) { if (tree.is(Tree.Kind.NEW_CLASS) && UNSAFE_PASSWORD_ENCODERS.anyMatch(((NewClassTree) tree))) { reportIssue(((NewClassTree) tree).identifier(), "Use secure password encoder."); } else if (tree.is(Tree.Kind.METHOD)) { MethodInvocationVisitor visitor = new MethodInvocationVisitor(); tree.accept(visitor); if (visitor.hasAuthentication && !visitor.setsPasswordEncoder) { reportIssue(visitor.tree, "Configure explicit password encoder."); } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } if (tree.is(Tree.Kind.NEW_CLASS) && UNSAFE_PASSWORD_ENCODERS.anyMatch(((NewClassTree) tree))) { reportIssue(((NewClassTree) tree).identifier(), "Use secure password encoder."); } else if (tree.is(Tree.Kind.METHOD)) { MethodInvocationVisitor visitor = new MethodInvocationVisitor(); tree.accept(visitor); if (visitor.hasAuthentication && !visitor.setsPasswordEncoder) { reportIssue(visitor.tree, "Configure explicit password encoder."); } } }
Source:
public static byte[] buildUsermetadata(RestRequest restRequest) { Map<String, List<String>> args = restRequest.getArgs(); Map<String, List<String>> userMetadataMap = new HashMap<String, List<String>>(); int size = 0; size += 4; for (Map.Entry<String, List<String>> entry : args.entrySet()) { String key = entry.getKey(); if (key.startsWith(Headers.UserMetaData_Header_Prefix)) { userMetadataMap.put(key, args.get(key)); size += 4; size += key.getBytes().length; size += 4; for (String value : entry.getValue()) { size += 4; size += value.getBytes().length; } } } ByteBuffer userMetadata = null; if (size == 4) { userMetadata = ByteBuffer.allocate(0); } else { userMetadata = ByteBuffer.allocate(size); userMetadata.putInt(userMetadataMap.size()); for (Map.Entry<String, List<String>> entry : userMetadataMap.entrySet()) { String key = entry.getKey(); Utils.serializeNullableASCIIEncodedString(userMetadata, key); userMetadata.putInt(entry.getValue().size()); for (String value : entry.getValue()) { Utils.serializeNullableASCIIEncodedString(userMetadata, value); } } } return userMetadata.array(); }

Target:
public static byte[] buildUsermetadata(RestRequest restRequest) throws RestServiceException { Map<String, List<String>> args = restRequest.getArgs(); Map<String, String> userMetadataMap = new HashMap<String, String>(); int sizeToAllocate = 0; for (Map.Entry<String, List<String>> entry : args.entrySet()) { String key = entry.getKey(); if (key.startsWith(Headers.UserMetaData_Header_Prefix)) { sizeToAllocate += 4; sizeToAllocate += key.getBytes().length; String value = getHeader(args, key, true); userMetadataMap.put(key, value); sizeToAllocate += 4; sizeToAllocate += value.getBytes().length; } } ByteBuffer userMetadata = null; if (sizeToAllocate == 0) { userMetadata = ByteBuffer.allocate(0); } else { sizeToAllocate += 2; sizeToAllocate += 4; sizeToAllocate += 4; sizeToAllocate += Crc_Size; userMetadata = ByteBuffer.allocate(sizeToAllocate); userMetadata.putShort(UserMetadata_Version_V1); userMetadata.putInt(sizeToAllocate - 6 - Crc_Size); userMetadata.putInt(userMetadataMap.size()); for (Map.Entry<String, String> entry : userMetadataMap.entrySet()) { String key = entry.getKey(); Utils.serializeString(userMetadata, key, StandardCharsets.US_ASCII); Utils.serializeString(userMetadata, entry.getValue(), StandardCharsets.US_ASCII); } Crc32 crc = new Crc32(); crc.update(userMetadata.array(), 0, sizeToAllocate - Crc_Size); userMetadata.putLong(crc.getValue()); } return userMetadata.array(); }
Source:
protected List<LicenseNameWithText> getSortedLicenseNameWithTexts(Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { Set<LicenseNameWithText> licenseNamesWithText = projectLicenseInfoResults.stream() .map(LicenseInfoParsingResult::getLicenseInfo) .filter(Objects::nonNull) .map(LicenseInfo::getLicenseNamesWithTexts) .filter(Objects::nonNull) .reduce(Sets::union) .orElse(Collections.emptySet()); List<LicenseNameWithText> lnwtsList = licenseNamesWithText.stream().filter(licenseNameWithText -> { return !Strings.isNullOrEmpty(licenseNameWithText.getAcknowledgements()) || !Strings.isNullOrEmpty(licenseNameWithText.getLicenseName()) || !Strings.isNullOrEmpty(licenseNameWithText.getLicenseText()); }).collect(Collectors.toList()); lnwtsList.sort(Comparator.comparing(LicenseNameWithText::getLicenseName, String.CASE_INSENSITIVE_ORDER)); return lnwtsList; }

Target:
protected List<LicenseNameWithText> getSortedLicenseNameWithTexts(Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { Set<LicenseNameWithText> licenseNamesWithText = projectLicenseInfoResults.stream() .map(LicenseInfoParsingResult::getLicenseInfo) .filter(Objects::nonNull) .map(LicenseInfo::getLicenseNamesWithTexts) .filter(Objects::nonNull) .reduce(Sets::union) .orElse(Collections.emptySet()); List<LicenseNameWithText> lnwtsList = licenseNamesWithText.stream().filter(licenseNameWithText -> { return !LicenseNameWithTextUtils.isEmpty(licenseNameWithText); }).collect(Collectors.toList()); lnwtsList.sort(Comparator.comparing(LicenseNameWithText::getLicenseName, String.CASE_INSENSITIVE_ORDER)); return lnwtsList; }
Source:
public void deleteColumn(TableName tableName, byte[] columnName) throws IOException { final String columnNameStr = Bytes.toString(columnName); Modification.Builder modification = Modification.newBuilder().setId(columnNameStr) .setDrop(true); modifyColumn(tableName, columnNameStr, "update", modification); }

Target:
public void deleteColumn(TableName tableName, byte[] columnName) throws IOException { final String columnNameStr = Bytes.toString(columnName); Modification.Builder modification = Modification.newBuilder().setId(columnNameStr) .setDrop(true); modifyColumn(tableName, columnNameStr, "delete", modification); }
Source:
public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException { setClassName(typeName + "Bundle"); setTypeOracle(generatorContext.getTypeOracle()); setTreeLogger(treeLogger); setPropertyOracle(generatorContext.getPropertyOracle()); PrintWriter printWriter; printWriter = tryCreatePrintWriter(generatorContext); if (printWriter == null) { return typeName; } ClassSourceFileComposerFactory composer = initComposer(); writePresenterImports(composer, presenters); SourceWriter sourceWriter = composer.createSourceWriter(generatorContext, printWriter); writeStaticFields(sourceWriter, presenters); writeConstructor(sourceWriter, presenters); closeDefinition(treeLogger, sourceWriter); return getPackageName() + "." + getClassName(); }

Target:
public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException { setClassName(typeName + SUFFIX); setTypeOracle(generatorContext.getTypeOracle()); setTreeLogger(treeLogger); setPropertyOracle(generatorContext.getPropertyOracle()); PrintWriter printWriter; printWriter = tryCreatePrintWriter(generatorContext); if (printWriter == null) { return typeName; } ClassSourceFileComposerFactory composer = initComposer(); writePresenterImports(composer, presenters); SourceWriter sourceWriter = composer.createSourceWriter(generatorContext, printWriter); writeStaticFields(sourceWriter, presenters); writeConstructor(sourceWriter, presenters); closeDefinition(sourceWriter); return getPackageName() + "." + getClassName(); }
Source:
protected void executeCommand() { List<VM> vms = runInternalQuery(VdcQueryType.GetVmsByStorageDomain, new IdQueryParameters(getStorageDomain().getId())) .getReturnValue(); Map<Guid, Guid> vmSnapshotIdMap = new HashMap<>(); for (VM vm : vms) { CreateAllSnapshotsFromVmParameters param = new CreateAllSnapshotsFromVmParameters(vm.getId(), vm.getName() + "-TMPDR", false, vm.getDiskList()); Guid createdSnapshotId = runInternalAction(VdcActionType.CreateAllSnapshotsFromVm, param).getActionReturnValue(); vmSnapshotIdMap.put(vm.getId(), createdSnapshotId); } getParameters().setSnapshotIdVmIds(vmSnapshotIdMap); persistCommandIfNeeded(); if (getSession().getStatus() != GeoRepSessionStatus.ACTIVE ) { Future<VdcReturnValueBase> geoRepCmd = CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(getSession().getMasterVolumeId(), getSession().getId()), cloneContext()); VdcReturnValueBase result; try { result = geoRepCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } GlusterVolumeGeoRepSessionConfigParameters configParams = new GlusterVolumeGeoRepSessionConfigParameters(getSession().getMasterVolumeId(), getSession().getId(), "checkpoint", "now"); runInternalAction(VdcActionType.SetGeoRepConfig, configParams); }

Target:
protected void executeCommand() { List<VM> vms = runInternalQuery(VdcQueryType.GetVmsByStorageDomain, new IdQueryParameters(getStorageDomain().getId())) .getReturnValue(); Map<Guid, Guid> vmSnapshotIdMap = new HashMap<>(); for (VM vm : vms) { CreateAllSnapshotsFromVmParameters param = new CreateAllSnapshotsFromVmParameters(vm.getId(), vm.getName() + getStorageDomain().getName() + "-TMPDR", false, vm.getDiskList()); Guid createdSnapshotId = runInternalAction(VdcActionType.CreateAllSnapshotsFromVm, param).getActionReturnValue(); vmSnapshotIdMap.put(vm.getId(), createdSnapshotId); } getParameters().setSnapshotIdVmIds(vmSnapshotIdMap); persistCommandIfNeeded(); if (getSession().getStatus() != GeoRepSessionStatus.ACTIVE ) { Future<VdcReturnValueBase> geoRepCmd = CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(getSession().getMasterVolumeId(), getSession().getId()), cloneContext()); VdcReturnValueBase result; try { result = geoRepCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); setSucceeded(false); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); setSucceeded(false); return; } } GlusterVolumeGeoRepSessionConfigParameters configParams = new GlusterVolumeGeoRepSessionConfigParameters(getSession().getMasterVolumeId(), getSession().getId(), "checkpoint", "now"); VdcReturnValueBase result = runInternalAction(VdcActionType.SetGeoRepConfig, configParams); if (!result.getSucceeded()) { propagateFailure(result); return; } setSucceeded(true); }
Source:
protected void finishModelStage(final OperationContext context, final ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, final Resource model) throws OperationFailedException { if (newValue.isDefined()) { Set<String> subsystems = context.readResourceFromRoot(EMPTY_ADDRESS).getChildrenNames("subsystem"); List<String> exposedSubsystems = new LinkedList<>(); for (ModelNode n: newValue.asList()) { exposedSubsystems.add(n.asString()); } validExposedSubsystems(subsystems, exposedSubsystems); } super.finishModelStage(context, operation, attributeName, newValue, oldValue, model); }

Target:
protected void finishModelStage(final OperationContext context, final ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, final Resource model) throws OperationFailedException { if (newValue.isDefined()) { Set<String> subsystems = context.readResourceFromRoot(PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM)), false).getChildrenNames(SUBSYSTEM); List<String> exposedSubsystems = new LinkedList<>(); for (ModelNode n: newValue.asList()) { exposedSubsystems.add(n.asString()); } validExposedSubsystems(subsystems, exposedSubsystems); } super.finishModelStage(context, operation, attributeName, newValue, oldValue, model); }
Source:
public void byteSizedTieredCache() { CacheConfiguration<Long, String> usesConfiguredInCacheConfig = CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class) .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10, MemoryUnit.KB) .offheap(10, MemoryUnit.MB) .build()) .withSizeOfMaxTraversals(1000) .withSizeOfMaxSize(1000) .build(); CacheConfiguration<Long, String> usesDefaultSizeOfEngineConfig = CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class) .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10, MemoryUnit.KB) .offheap(10, MemoryUnit.MB) .build()) .build(); CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withDefaultSizeOfMaxSize(500) .withDefaultSizeOfMaxTraversals(2000) .withCache("usesConfiguredInCache", usesConfiguredInCacheConfig) .withCache("usesDefaultSizeOfEngine", usesDefaultSizeOfEngineConfig) .build(true); Cache<Long, String> usesConfiguredInCache = cacheManager.getCache("usesConfiguredInCache", Long.class, String.class); usesConfiguredInCache.put(1L, "one"); assertThat(usesConfiguredInCache.get(1L), equalTo("one")); Cache<Long, String> usesDefaultSizeOfEngine = cacheManager.getCache("usesDefaultSizeOfEngine", Long.class, String.class); usesDefaultSizeOfEngine.put(1L, "one"); assertThat(usesDefaultSizeOfEngine.get(1L), equalTo("one")); cacheManager.close(); }

Target:
public void byteSizedTieredCache() { CacheConfiguration<Long, String> usesConfiguredInCacheConfig = CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class) .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10, MemoryUnit.KB) .offheap(10, MemoryUnit.MB) .build()) .withSizeOfMaxObjectGraph(1000) .withSizeOfMaxObjectSize(1000, MemoryUnit.B) .build(); CacheConfiguration<Long, String> usesDefaultSizeOfEngineConfig = CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class) .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10, MemoryUnit.KB) .offheap(10, MemoryUnit.MB) .build()) .build(); CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withDefaultSizeOfMaxObjectSize(500, MemoryUnit.B) .withDefaultSizeOfMaxObjectGraph(2000) .withCache("usesConfiguredInCache", usesConfiguredInCacheConfig) .withCache("usesDefaultSizeOfEngine", usesDefaultSizeOfEngineConfig) .build(true); Cache<Long, String> usesConfiguredInCache = cacheManager.getCache("usesConfiguredInCache", Long.class, String.class); usesConfiguredInCache.put(1L, "one"); assertThat(usesConfiguredInCache.get(1L), equalTo("one")); Cache<Long, String> usesDefaultSizeOfEngine = cacheManager.getCache("usesDefaultSizeOfEngine", Long.class, String.class); usesDefaultSizeOfEngine.put(1L, "one"); assertThat(usesDefaultSizeOfEngine.get(1L), equalTo("one")); cacheManager.close(); }
Source:
public boolean isSameDestinationAs(@Nullable Object obj) { if (this == obj) return true; if (!(obj instanceof RouteInfo)) return false; RouteInfo target = (RouteInfo) obj; if (mDestination == target.getDestination()) { return true; } return false; }

Target:
public boolean isSameDestinationAs(@Nullable Object obj) { if (this == obj) return true; if (!(obj instanceof RouteInfo)) return false; RouteInfo target = (RouteInfo) obj; if (Objects.equals(mDestination, target.getDestination())) { return true; } return false; }
Source:
public GroupRest getBitstreamReadGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } List<Group> bitstreamGroups = authorizeService .getAuthorizedGroups(context, collection, Constants.DEFAULT_BITSTREAM_READ); Group bitstreamReadGroup = bitstreamGroups.get(0); if (!authorizeService.isAdmin(context) && !authorizeService.authorizeActionBoolean(context, collection, Constants.ADMIN, true)) { throw new AccessDeniedException( "The current user was not allowed to retrieve the bitstreamReadGroup for" + " collection: " + collectionId); } if (bitstreamReadGroup == null) { return null; } return converter.toRest(bitstreamReadGroup, projection); } catch (SQLException e) { throw new RuntimeException(e); } }

Target:
public GroupRest getBitstreamReadGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } try { AuthorizeUtil.authorizeManageDefaultReadGroup(context, collection); } catch (AuthorizeException e) { throw new AccessDeniedException("The current user was not allowed to retrieve the " + "bitstreamReadGroup for collection: " + collectionId); } List<Group> bitstreamGroups = authorizeService .getAuthorizedGroups(context, collection, Constants.DEFAULT_BITSTREAM_READ); Group bitstreamReadGroup = bitstreamGroups.get(0); if (bitstreamReadGroup == null) { return null; } return converter.toRest(bitstreamReadGroup, projection); } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
public void shouldNotDownloadMusicWhenDoesNotExist() { when(dao.load(music)).thenReturn(music); when(musics.getFile(music)).thenReturn(new File("/tmp/uploads/Music_" + music.getId() + ".mp3")); try { controller.download(music); } catch (FileNotFoundException e) { verify(musics).getFile(music); } }

Target:
public void shouldNotDownloadMusicWhenDoesNotExist() { when(dao.load(music)).thenReturn(music); when(musics.getFile(music)).thenReturn(new File("/tmp/uploads/Music_" + music.getId() + ".mp3")); try { controller.download(music); fail("Should throw an exception."); } catch (FileNotFoundException e) { verify(musics).getFile(music); } }
Source:
public void BotHod() { int size = tiles.size(); int mode = (int) Math.sqrt(size); Random rand = new Random(); if (ModeBotOrNot.isBot() == 1) { int l = rand.nextInt(mode) + 0; int z = rand.nextInt(mode) + 0; while (massiveTiles[l][z].isOpen()) { l = rand.nextInt(mode) + 0; z = rand.nextInt(mode) + 0; } firstselected = massiveTiles[l][z]; firstselected.open(() -> { }); l = rand.nextInt(mode) + 0; z = rand.nextInt(mode) + 0; while (massiveTiles[l][z].isOpen() || firstselected.equals(massiveTiles[l][z])) { l = rand.nextInt(mode) + 0; z = rand.nextInt(mode) + 0; } secondselected = massiveTiles[l][z]; secondselected.openBot(() -> { }); if (!firstselected.text.getText().equals(secondselected.text.getText())) { firstselected.waitBeforeClose(); secondselected.waitBeforeClose(); } else { firstselected.setOpen(); secondselected.setOpen(); } ModeBotOrNot.setBot(0); firstselected = null; secondselected = null; } }

Target:
public void BotHod() { int size = tiles.size(); int mode = (int) Math.sqrt(size); Random rand = new Random(); if (BotMode.getBotMode() == 1) { int l = rand.nextInt(mode) + 0; int z = rand.nextInt(mode) + 0; while (massiveTiles[l][z].isOpen()) { l = rand.nextInt(mode) + 0; z = rand.nextInt(mode) + 0; } firstselected = massiveTiles[l][z]; firstselected.open(() -> { }); l = rand.nextInt(mode) + 0; z = rand.nextInt(mode) + 0; while (massiveTiles[l][z].isOpen() || firstselected.equals(massiveTiles[l][z])) { l = rand.nextInt(mode) + 0; z = rand.nextInt(mode) + 0; } secondselected = massiveTiles[l][z]; secondselected.openBot(() -> { }); if (!firstselected.text.getText().equals(secondselected.text.getText())) { firstselected.waitBeforeClose(); secondselected.waitBeforeClose(); } else { firstselected.setOpen(); secondselected.setOpen(); } BotMode.setBotMode(0); firstselected = null; secondselected = null; } }
Source:
private Long convertListOfStringToTime(List<String> serverTimeInformation) { return convertListOfStringToMicros(serverTimeInformation) / 1000; }

Target:
private Long convertListOfStringToTime(List<String> serverTimeInformation) { return TimeUnit.MICROSECONDS.toMillis(convertListOfStringToMicros(serverTimeInformation)); }
Source:
public Map<String, String> getCustomValues() { Map<String, String> map = new HashMap<>(); map.put(GlusterConstants.VOLUME_SNAPSHOT_NAME, getParameters().getSnapshotName()); return map; }

Target:
public Map<String, String> getCustomValues() { addCustomValue(GlusterConstants.VOLUME_SNAPSHOT_NAME, getParameters().getSnapshotName()); return super.getCustomValues(); }
Source:
private SystemStreamMetadata constructSystemStreamMetadata( String streamName, Map<SystemStreamPartition, List<IncomingMessageEnvelope>> sspToMessagesForSystem) { Map<Partition, SystemStreamMetadata.SystemStreamPartitionMetadata> partitionMetadata = sspToMessagesForSystem .entrySet() .stream() .collect(Collectors.toMap(entry -> entry.getKey().getPartition(), entry -> { List<IncomingMessageEnvelope> messages = entry.getValue(); Integer oldestOffset = null; Integer newestOffset = null; int upcomingOffset = 0; if (!messages.isEmpty() && !messages.get(messages.size() - 1).isEndOfStream()) { oldestOffset = 0; newestOffset = messages.size() - 1; upcomingOffset = messages.size(); } else if (messages.size() > 1 && messages.get(messages.size() - 1).isEndOfStream()) { oldestOffset = 0; newestOffset = messages.size() - 2; upcomingOffset = messages.size() - 1; } return new SystemStreamMetadata.SystemStreamPartitionMetadata( oldestOffset == null ? null : oldestOffset.toString(), newestOffset == null ? null : newestOffset.toString(), Integer.toString(upcomingOffset)); })); return new SystemStreamMetadata(streamName, partitionMetadata); }

Target:
private SystemStreamMetadata constructSystemStreamMetadata( String streamName, Map<SystemStreamPartition, List<IncomingMessageEnvelope>> sspToMessagesForSystem) { Map<Partition, SystemStreamMetadata.SystemStreamPartitionMetadata> partitionMetadata = sspToMessagesForSystem .entrySet() .stream() .collect(Collectors.toMap(entry -> entry.getKey().getPartition(), entry -> { List<IncomingMessageEnvelope> messages = entry.getValue(); Integer oldestOffset; Integer newestOffset; int upcomingOffset; if (messages.isEmpty()) { oldestOffset = null; newestOffset = null; upcomingOffset = 0; } else if (messages.get(messages.size() - 1).isEndOfStream()) { if (messages.size() > 1) { oldestOffset = 0; newestOffset = messages.size() - 2; upcomingOffset = messages.size() - 1; } else { oldestOffset = null; newestOffset = null; upcomingOffset = 0; } } else { oldestOffset = 0; newestOffset = messages.size() - 1; upcomingOffset = messages.size(); } return new SystemStreamMetadata.SystemStreamPartitionMetadata( oldestOffset == null ? null : oldestOffset.toString(), newestOffset == null ? null : newestOffset.toString(), Integer.toString(upcomingOffset)); })); return new SystemStreamMetadata(streamName, partitionMetadata); }
Source:
private List<CertificationResultTestProcedureEntity> getTestProcedureEntitiesForListing(Long listingId) { String hql = "SELECT tp " + "FROM CertificationResultTestProcedureEntity tp " + "LEFT OUTER JOIN FETCH tp.testProcedure " + "WHERE (NOT tp.deleted = true) " + "AND tp.certificationResultId IN " + "(SELECT cr.id " + "FROM CertificationResultEntity cr " + "WHERE cr.certifiedProductId = :listingId)"; return entityManager.createQuery(hql, CertificationResultTestProcedureEntity.class) .setParameter("listingId", listingId) .getResultList(); }

Target:
private List<CertificationResultTestProcedureEntity> getTestProcedureEntitiesForListing(Long listingId) { String hql = "SELECT tp " + "FROM CertificationResultTestProcedureEntity tp " + "LEFT OUTER JOIN FETCH tp.testProcedure " + "WHERE (NOT tp.deleted = true) " + "AND tp.certificationResultId IN " + "(SELECT cr.id " + "FROM CertificationResultEntity cr " + "WHERE cr.certifiedProductId = :listingId " + "AND cr.deleted = false)"; return entityManager.createQuery(hql, CertificationResultTestProcedureEntity.class) .setParameter("listingId", listingId) .getResultList(); }
Source:
private static HttpRequest convertLanguageParsingRequestToHttpRequest(LanguageParsingRequest languageParsingRequest) throws JsonProcessingException { ObjectMapper objectMapper = new ObjectMapper(); String requestBody = objectMapper.writeValueAsString(languageParsingRequest); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.ofString(requestBody); return HttpRequest.newBuilder().uri(URI.create("http://localhost:3000/parse")).POST(bodyPublisher).build(); }

Target:
private static HttpRequest convertLanguageParsingRequestToHttpRequest(LanguageParsingRequest languageParsingRequest) throws JsonProcessingException { ObjectMapper objectMapper = new ObjectMapper(); String requestBody = objectMapper.writeValueAsString(languageParsingRequest); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.ofString(requestBody); return HttpRequest.newBuilder().uri(URI.create(LANGUAGE_PARSER_ENDPOINT)).POST(bodyPublisher).build(); }
Source:
public TransferResult<CFValue, CFStore> visitMethodInvocation( final MethodInvocationNode node, final TransferInput<CFValue, CFStore> input) { TransferResult<CFValue, CFStore> result = super.visitMethodInvocation(node, input); String methodName = node.getTarget().getMethod().getSimpleName().toString(); methodName = atypeFactory.adjustMethodNameUsingValueChecker(methodName, node.getTree()); Node receiver = node.getTarget().getReceiver(); if (!"<init>".equals(methodName) && receiver != null) { accumulate(receiver, result, methodName); } return result; }

Target:
public TransferResult<CFValue, CFStore> visitMethodInvocation( final MethodInvocationNode node, final TransferInput<CFValue, CFStore> input) { TransferResult<CFValue, CFStore> result = super.visitMethodInvocation(node, input); Node receiver = node.getTarget().getReceiver(); if (receiver != null) { String methodName = node.getTarget().getMethod().getSimpleName().toString(); methodName = atypeFactory.adjustMethodNameUsingValueChecker(methodName, node.getTree()); accumulate(receiver, result, methodName); } return result; }
Source:
public boolean requireReauthentication(UserSessionModel userSession, AuthenticationSessionModel authSession) { String requireReauthentication = authSession.getAuthNote(SamlProtocol.SAML_LOGIN_REQUEST_FORCEAUTHN); if (requireReauthentication == null || requireReauthentication.isEmpty()) return false; return requireReauthentication.equals(SamlProtocol.SAML_FORCEAUTHN_REQUIREMENT); }

Target:
public boolean requireReauthentication(UserSessionModel userSession, AuthenticationSessionModel authSession) { String requireReauthentication = authSession.getAuthNote(SamlProtocol.SAML_LOGIN_REQUEST_FORCEAUTHN); return Objects.equals(SamlProtocol.SAML_FORCEAUTHN_REQUIREMENT, requireReauthentication); }
Source:
public static String sha1(String value) { return Hashing.sha1().hashString(value, Charsets.UTF_8).toString().substring(0, 7); }

Target:
public static String sha1(String value) { return Hashing.sha1().hashString(value, Charsets.UTF_8).toString(); }
Source:
public void close() { if (sequenceReader!=null) { try { sequenceReader.close(); } catch (IOException e) { log.error("error occurred when closing sequence reader", e); } } }

Target:
public void close() throws IOException { if (sequenceReader != null) { sequenceReader.close(); } }
Source:
private void scheduleImmediateDelivery() { cancelDelayedDelivery(); while (state == State.RUNNING) { DeliveryAttempt previous = immediateDelivery.get(); if (previous != null && !previous.isDone()) previous.cancel(); DeliveryAttempt current = new DeliveryAttempt(); if (immediateDelivery.compareAndSet(previous, current)) { current.executeNow(); return; } } }

Target:
private void scheduleImmediateDelivery() { cancelDelayedDelivery(); while (state == State.RUNNING) { DeliveryAttempt previous = immediateDelivery.get(); if (previous != null) previous.cancel(); DeliveryAttempt current = new DeliveryAttempt(); if (immediateDelivery.compareAndSet(previous, current)) { current.executeNow(); return; } } }
Source:
private SortedSet<LocalizedMessage> getFilteredMessages(String fileName, FileContents fileContents) { final SortedSet<LocalizedMessage> result = new TreeSet<>(messages); for (final LocalizedMessage element : messages) { final TreeWalkerAuditEvent event = new TreeWalkerAuditEvent(fileContents, fileName, element); for (final TreeWalkerFilter filter : filters) { if (!filter.accept(event)) { result.remove(element); break; } } } return result; }

Target:
private SortedSet<LocalizedMessage> getFilteredMessages(String fileName, FileContents fileContents) { final SortedSet<LocalizedMessage> result = new TreeSet<>(messages); for (LocalizedMessage element : messages) { final TreeWalkerAuditEvent event = new TreeWalkerAuditEvent(fileContents, fileName, element); for (TreeWalkerFilter filter : filters) { if (!filter.accept(event)) { result.remove(element); break; } } } return result; }
Source:
public static boolean allowReplacement(String currReplState, String replacementReplState){ if ((currReplState == null) || (currReplState.isEmpty())) { return true; } if ((replacementReplState == null) || (replacementReplState.isEmpty())) { return false; } long currReplStateLong = Long.parseLong(currReplState.replaceAll("\\D","")); long replacementReplStateLong = Long.parseLong(replacementReplState.replaceAll("\\D","")); if ((currReplStateLong != 0) || (replacementReplStateLong != 0)){ return ((currReplStateLong - replacementReplStateLong) < 0); } return (collator.compare(currReplState.toLowerCase(), replacementReplState.toLowerCase()) < 0); }

Target:
public static boolean allowReplacement(String currReplState, String replacementReplState){ if ((currReplState == null) || (currReplState.isEmpty())) { return true; } if ((replacementReplState == null) || (replacementReplState.isEmpty())) { return false; } long currReplStateLong = Long.parseLong(currReplState.replaceAll("\\D","")); long replacementReplStateLong = Long.parseLong(replacementReplState.replaceAll("\\D","")); return ((currReplStateLong - replacementReplStateLong) < 0); }
Source:
public void destroy(String name) throws CachePersistenceException { while (true) { if (entity == null) { try { entity = entityFactory.retrieve(entityIdentifier, serviceConfiguration.getServerConfiguration()); } catch (EntityNotFoundException e) { break; } catch (TimeoutException e) { throw new CachePersistenceException("Could not connect to the cluster tier manager '" + entityIdentifier + "'; retrieve operation timed out", e); } catch (DestroyInProgressException e) { try { silentDestroy(); break; } catch (ConnectionClosedException | ConnectionShutdownException e1) { reconnect(); } } catch (ConnectionClosedException | ConnectionShutdownException e) { reconnect(); } } try { if (entity != null) { entityFactory.destroyClusteredStoreEntity(entityIdentifier, name); break; } } catch (EntityNotFoundException e) { LOGGER.debug("Destruction of cluster tier failed as it does not exist", name); break; } catch (ConnectionClosedException | ConnectionShutdownException e) { handleConnectionClosedException(); } } }

Target:
public void destroy(String name) throws CachePersistenceException { while (true) { if (entity == null) { try { entity = entityFactory.retrieve(entityIdentifier, serviceConfiguration.getServerConfiguration()); } catch (EntityNotFoundException e) { break; } catch (TimeoutException e) { throw new CachePersistenceException("Could not connect to the cluster tier manager '" + entityIdentifier + "'; retrieve operation timed out", e); } catch (DestroyInProgressException e) { if (silentDestroyUtil()) { break; } } catch (ConnectionClosedException | ConnectionShutdownException e) { reconnect(); } } try { if (entity != null) { entityFactory.destroyClusteredStoreEntity(entityIdentifier, name); break; } } catch (EntityNotFoundException e) { LOGGER.debug("Destruction of cluster tier failed as it does not exist", name); break; } catch (ConnectionClosedException | ConnectionShutdownException e) { handleConnectionClosedException(); } } }
Source:
protected void save() { final Command continueSaveOnceValid = () -> super.save(); sessionValidateCommand .execute(new ClientSessionCommand.Callback<Collection<DiagramElementViolation<RuleViolation>>>() { @Override public void onSuccess() { if (hasUnsavedChanges()) { continueSaveOnceValid.execute(); } else { errorPopupPresenter.showMessage("You have no unsaved changes."); } } @Override public void onError(final Collection<DiagramElementViolation<RuleViolation>> violations) { final Violation.Type maxSeverity = ValidationUtils.getMaxSeverity(violations); if (maxSeverity.equals(Violation.Type.ERROR)) { onValidationFailed(violations); } else { if (hasUnsavedChanges()) { continueSaveOnceValid.execute(); } else { errorPopupPresenter.showMessage("You have no unsaved changes."); } } } }); }

Target:
protected void save() { final Command continueSaveOnceValid = () -> super.save(); sessionValidateCommand .execute(new ClientSessionCommand.Callback<Collection<DiagramElementViolation<RuleViolation>>>() { @Override public void onSuccess() { continueSaveOnceValid.execute(); } @Override public void onError(final Collection<DiagramElementViolation<RuleViolation>> violations) { final Violation.Type maxSeverity = ValidationUtils.getMaxSeverity(violations); if (maxSeverity.equals(Violation.Type.ERROR)) { onValidationFailed(violations); } else { continueSaveOnceValid.execute(); } } }); }
Source:
public void addQueueAndAssignPermission(String queueName, QueueRolePermission[] queueRolePermissions) throws QueueManagerException { String tenantBasedQueueName = Utils.getTenantBasedQueueName(queueName); if (!QueueManagementBeans.queueExists(tenantBasedQueueName)) { createQueue(tenantBasedQueueName); updatePermission(tenantBasedQueueName, queueRolePermissions); } else { throw new QueueManagerException("Queue with the name: " + queueName + " already exists!", new RuntimeException("Queue with the name: " + queueName + " already exists!")); } }

Target:
public void addQueueAndAssignPermission(String queueName, QueueRolePermission[] queueRolePermissions) throws QueueManagerException { String tenantBasedQueueName = Utils.getTenantBasedQueueName(queueName); if (!QueueManagementBeans.queueExists(tenantBasedQueueName)) { createQueue(tenantBasedQueueName); updatePermission(tenantBasedQueueName, queueRolePermissions); } else { throw new QueueManagerException("Queue with the name: " + queueName + " already exists!"); } }
Source:
Connection start() { log.info("Starting PubSub connection"); ProjectSubscriptionName subscriptionName = ProjectSubscriptionName .of(projectId, subscriptionId); FlowControlSettings flowControlSettings = FlowControlSettings.newBuilder() .setMaxOutstandingElementCount(maxOutstandingElementCount) .setMaxOutstandingRequestBytes(maxOutstandingRequestBytes) .build(); ExecutorProvider executorProvider = InstantiatingExecutorProvider.newBuilder().setExecutorThreadCount(threads).build(); log.info("Subscribing to {}", subscriptionName); final Receiver receiver = new Receiver(consumer, reporter, errors, consumed); subscriber = Subscriber .newBuilder(subscriptionName, receiver) .setFlowControlSettings(flowControlSettings) .setParallelPullCount(threads) .setExecutorProvider(executorProvider) .setChannelProvider(channelProvider) .setCredentialsProvider(credentialsProvider) .build(); subscriber.addListener( new Subscriber.Listener() { @Override public void failed(Subscriber.State from, Throwable failure) { log.error( "An error on subscriber happened (from state: " + from.name() + ")", failure); }}, MoreExecutors.directExecutor()); subscriber.startAsync().awaitRunning(); log.info("PubSub connection started"); return this; }

Target:
Connection start() { log.info("Starting PubSub connection"); ProjectSubscriptionName subscriptionName = ProjectSubscriptionName .of(projectId, subscriptionId); FlowControlSettings flowControlSettings = FlowControlSettings.newBuilder() .setMaxOutstandingElementCount(maxOutstandingElementCount) .setMaxOutstandingRequestBytes(maxOutstandingRequestBytes) .build(); ExecutorProvider executorProvider = InstantiatingExecutorProvider.newBuilder().setExecutorThreadCount(threads).build(); log.info("Subscribing to {}", subscriptionName); final Receiver receiver = new Receiver(consumer, reporter, errors, consumed); subscriber = Subscriber .newBuilder(subscriptionName, receiver) .setFlowControlSettings(flowControlSettings) .setParallelPullCount(threads) .setExecutorProvider(executorProvider) .setChannelProvider(channelProvider) .setCredentialsProvider(credentialsProvider) .build(); subscriber.addListener( new Subscriber.Listener() { @Override public void failed(Subscriber.State from, Throwable failure) { log.error( "An error on subscriber happened (from state: " + from.name() + ")", failure); System.exit(1); } }, MoreExecutors.directExecutor()); subscriber.startAsync().awaitRunning(); log.info("PubSub connection started"); return this; }
Source:
public void handleMessage(Message msg) { switch (msg.arg2) { case COMMAND_START_REPLICATION: startReplications(); notifyTestOperationComplete(); break; case COMMAND_STOP_REPLICATION: stopReplications(); notifyTestOperationComplete(); break; } Intent intent = msg.getData().getParcelable(EXTRA_INTENT); WakefulBroadcastReceiver.completeWakefulIntent(intent); }

Target:
public void handleMessage(Message msg) { try { switch (msg.arg2) { case COMMAND_START_REPLICATION: startReplications(); notifyTestOperationComplete(); break; case COMMAND_STOP_REPLICATION: stopReplications(); notifyTestOperationComplete(); break; } } finally { Intent intent = msg.getData().getParcelable(EXTRA_INTENT); WakefulBroadcastReceiver.completeWakefulIntent(intent); } }
Source:
public AnalyzedAlterTableDropCheckConstraint analyze(Table<?> table, String name, CoordinatorTxnCtx txnCtx) { DocTableInfo tableInfo = (DocTableInfo) schemas.resolveTableInfo( table.getName(), Operation.ALTER, txnCtx.sessionContext().user(), txnCtx.sessionContext().searchPath()); List<CheckConstraint<Symbol>> checkConstraints = tableInfo.checkConstraints(); for (int i = 0; i < checkConstraints.size(); i++) { if (name.equals(checkConstraints.get(i).name())) { return new AnalyzedAlterTableDropCheckConstraint(tableInfo, name); } } throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Cannot find a CHECK CONSTRAINT named [%s], available constraints are: %s", name, Lists2.map(checkConstraints, CheckConstraint::name))); }

Target:
public AnalyzedAlterTableDropCheckConstraint analyze(Table<?> table, String name, CoordinatorTxnCtx txnCtx) { DocTableInfo tableInfo = (DocTableInfo) schemas.resolveTableInfo( table.getName(), Operation.ALTER, txnCtx.sessionContext().user(), txnCtx.sessionContext().searchPath()); List<CheckConstraint<Symbol>> checkConstraints = tableInfo.checkConstraints(); for (var checkConstraint : checkConstraints) { if (name.equals(checkConstraint.name())) { return new AnalyzedAlterTableDropCheckConstraint(tableInfo, name); } } throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Cannot find a CHECK CONSTRAINT named [%s], available constraints are: %s", name, Lists2.map(checkConstraints, CheckConstraint::name))); }
Source:
protected void computeLocations() { boolean hasLocations = !Strings.isBlank(locations); if (app != null) { if (hasLocations && isYamlApp()) { log.warn("YAML app combined with command line locations; command line locations will take precedence"); } else if (!hasLocations && isYamlApp()) { log.info("No locations supplied; defaulting to locations defined in YAML (if any)"); } else if (!hasLocations) { log.info("No locations supplied; starting with no locations"); } } else if (hasLocations) { log.error("Locations specified without any applications; ignoring locations"); } }

Target:
protected void computeLocations() { boolean hasLocations = !Strings.isBlank(locations); if (app != null) { if (hasLocations && isYamlApp()) { log.info("YAML app combined with command line locations; YAML locations will take precedence"); } else if (!hasLocations && isYamlApp()) { log.info("No locations supplied; defaulting to locations defined in YAML (if any)"); } else if (!hasLocations) { log.info("No locations supplied; starting with no locations"); } } else if (hasLocations) { log.error("Locations specified without any applications; ignoring locations"); } }
Source:
public void removeTube() { if (removeTubeButton.getAttribute("disabled") == null) { removeTubeButton.click(); } else { log.error("* * * * * * * * * Error: removeTubeButton is not clickable * * * * * * * * * "); } confirmAndWaitForRefresh(); }

Target:
public void removeTube() { if (removeTubeButton.isEnabled()) { removeTubeButton.click(); } else { throw new IllegalStateException("Error: removeTubeButton is not clickable"); } confirmAndWaitForRefresh(); }
Source:
public void onLoadFinished(Loader<Cursor> cursorLoaderLoader, Cursor cursorLoader) { adapter.swapCursor(cursorLoader); boolean visible = recentSearchesList.getCount() > 0; deleteButton.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); if (!isAdded()) { return; } getActivity().supportInvalidateOptionsMenu(); }

Target:
public void onLoadFinished(Loader<Cursor> cursorLoaderLoader, Cursor cursorLoader) { if (!isAdded()) { return; } adapter.swapCursor(cursorLoader); boolean visible = recentSearchesList.getCount() > 0; deleteButton.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); getActivity().supportInvalidateOptionsMenu(); }
Source:
public final String getErrorMessageTitle() { try { return errorMessage.split("[\\r\\n]+")[0]; } catch(ArrayIndexOutOfBoundsException e) { return ""; } }

Target:
public final String getErrorMessageTitle() { return errorMessage.split("[\\r?\\n]+", -1)[0]; }