auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { if (true == ServiceStateHelper.getInstance(mContext).isLoggedIn()) { ConnectivityManager connManager = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) || wifi.isConnected()) { if ((SystemClock.elapsedRealtime() - mLastTxTime >= mTxInterval)) { transmissionService(); } } else { long interval = mTxInterval; SharedPreferences mainPrefs = mContext.getSharedPreferences(SensePrefs.MAIN_PREFS, Context.MODE_PRIVATE); if(mainPrefs.getBoolean(Advanced.MOBILE_INTERNET_ENERGY_SAVING_MODE, true)) interval = ADAPTIVE_TX_INTERVAL; mLastTxBytes = TrafficStats.getMobileTxBytes() - mTxBytes; mTxBytes = TrafficStats.getMobileTxBytes(); if ((SystemClock.elapsedRealtime() - mLastTxTime >= interval)) { transmissionService(); } <START> else if (ADAPTIVE_TX_INTERVAL == interval && (mLastTxBytes >= 500) <END> && (SystemClock.elapsedRealtime() - mLastTxTime >= interval - (long) (interval * 0.2))) { transmissionService(); } else { } } } else { } }</code><technical_language>@tedschmidt head hurts ;-) Clever coding this is prone lead trouble modifies code. Please pref, save a boolean</technical_language>

Target:
public void run() { if (true == ServiceStateHelper.getInstance(mContext).isLoggedIn()) { ConnectivityManager connManager = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) || wifi.isConnected()) { if ((SystemClock.elapsedRealtime() - mLastTxTime >= mTxInterval)) { transmissionService(); } } else { long interval = mTxInterval; SharedPreferences mainPrefs = mContext.getSharedPreferences(SensePrefs.MAIN_PREFS, Context.MODE_PRIVATE); boolean energy_saving = mainPrefs.getBoolean(Advanced.MOBILE_INTERNET_ENERGY_SAVING_MODE, true); if(energy_saving) interval = ADAPTIVE_TX_INTERVAL; mLastTxBytes = TrafficStats.getMobileTxBytes() - mTxBytes; mTxBytes = TrafficStats.getMobileTxBytes(); if ((SystemClock.elapsedRealtime() - mLastTxTime >= interval)) { transmissionService(); } else if (energy_saving && (mLastTxBytes >= 500) && (SystemClock.elapsedRealtime() - mLastTxTime >= ADAPTIVE_TX_INTERVAL - (long) (ADAPTIVE_TX_INTERVAL * 0.2))) { transmissionService(); } else { } } } else { } }
Source:
<code><START> public static void propagateIfFatal(Throwable throwable) { <END> if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException)throwable); }</code><technical_language>this; class Error fatal (e.g. OutOfMemoryError bets off)</technical_language>

Target:
public static void propagateIfFatal(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException)throwable); if (throwable instanceof Error) throw (Error) throwable; }
Source:
<code>private void onCustomPreview() { VM vm = getEntity(); PreviewSnapshotModel previewSnapshotModel = (PreviewSnapshotModel) getWindow(); Snapshot snapshot = previewSnapshotModel.getSnapshotModel().getEntity(); boolean memory = Boolean.TRUE.equals(previewSnapshotModel.getSnapshotModel().getMemory().getEntity()); List<DiskImage> disks = previewSnapshotModel.getSelectedDisks(); Set<Guid> <START> diskImages = <END> disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); runTryBackToAllSnapshotsOfVm(previewSnapshotModel, vm, snapshot, memory, diskImages); }</code><technical_language>disksIds</technical_language>

Target:
private void onCustomPreview() { VM vm = getEntity(); PreviewSnapshotModel previewSnapshotModel = (PreviewSnapshotModel) getWindow(); Snapshot snapshot = previewSnapshotModel.getSnapshotModel().getEntity(); boolean memory = Boolean.TRUE.equals(previewSnapshotModel.getSnapshotModel().getMemory().getEntity()); List<DiskImage> disks = previewSnapshotModel.getSelectedDisks(); Set<Guid> diskIds = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); runTryBackToAllSnapshotsOfVm(previewSnapshotModel, vm, snapshot, memory, diskIds); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpSession session = httpRequest.getSession(); if (!isFilteredRequest(httpRequest)) { chain.doFilter(request, response); return; } synchronized (getSynchronizationObject(session)) { if (isRequestInProcess(session)) { enqueueRequest(httpRequest); if (!waitForRelease(httpRequest)) { return; } } setRequestInProgress(httpRequest); } try { <START> chain.doFilter(request, response); <END> } catch (LazyInitializationException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(Helper.getTranslation("aLazyInitializationErrorOcurred")); } finally { releaseQueuedRequest(httpRequest); } }</code><technical_language>setErrorMessage</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpSession session = httpRequest.getSession(); if (!isFilteredRequest(httpRequest)) { chain.doFilter(request, response); return; } synchronized (getSynchronizationObject(session)) { if (isRequestInProcess(session)) { enqueueRequest(httpRequest); if (!waitForRelease(httpRequest)) { return; } } setRequestInProgress(httpRequest); } try { chain.doFilter(request, response); } catch (LazyInitializationException e) { Helper.setErrorMessage(Helper.getTranslation("aLazyInitializationErrorOcurred"), logger, e); } finally { releaseQueuedRequest(httpRequest); } }
Source:
<code>private static boolean isUsedInLhsOfCompoundAssignment(Tree tree) { CompoundAssignmentStatement compoundAssignmentStatement = ((CompoundAssignmentStatement) TreeUtils.firstAncestorOfKind(tree, COMPOUND_ASSIGNMENT)); <START> if (compoundAssignmentStatement == null) { return false; } return isAccessingExpression(compoundAssignmentStatement.lhsExpression(), tree); <END> }</code><technical_language>Nitpick: I simplify this return compoundAssignmentStatement != null && isAccessingExpression(...)</technical_language>

Target:
private static boolean isUsedInLhsOfCompoundAssignment(Tree tree) { CompoundAssignmentStatement compoundAssignmentStatement = ((CompoundAssignmentStatement) TreeUtils.firstAncestorOfKind(tree, COMPOUND_ASSIGNMENT)); return compoundAssignmentStatement != null && isAccessingExpression(compoundAssignmentStatement.lhsExpression(), tree); }
Source:
<code>public void Execute(Campaign campaign, Unit unit) { if (isGM) { unit.startMothballing(null, true); } else { if (!unit.isSelfCrewed() && (null == techId)) { return; } <START> unit.startMothballing(campaign.getPerson(techId)); <END> } }</code><technical_language>is this Id</technical_language>

Target:
public void Execute(Campaign campaign, Unit unit) { if (isGM) { unit.startMothballing(null, true); } else { if (!unit.isSelfCrewed() && (null == tech)) { return; } unit.startMothballing(tech); } }
Source:
<code><START> public static String grpcAwareErrorMessage(IOException e) { <END> io.grpc.Status errStatus = io.grpc.Status.fromThrowable(e); if (errStatus != null) { return String.format("%s: %s", errStatus.getCode().name(), errStatus.getDescription()); } return e.getMessage(); }</code><technical_language>a simple tests for this method</technical_language>

Target:
public static String grpcAwareErrorMessage(IOException e) { io.grpc.Status errStatus = io.grpc.Status.fromThrowable(e); if (!errStatus.getCode().equals(io.grpc.Status.UNKNOWN.getCode())) { return String.format("%s: %s", errStatus.getCode().name(), errStatus.getDescription()); } return e.getMessage(); }
Source:
<code>public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Resource resource, Group group, boolean withGroupAttributes) throws GroupResourceMismatchException { this.checkGroupIsFromTheSameVoLikeResource(sess, group, resource); List<Attribute> attributes = new ArrayList<>(); <START> attributes.addAll(getAttributesManagerImpl().getRequiredAttributes(sess, services, resource, group)); <END> if (withGroupAttributes) { attributes.addAll(getAttributesManagerImpl().getRequiredAttributes(sess, services, group)); } return attributes; }</code><technical_language>parameterized constructor call instead of addAll()</technical_language>

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Resource resource, Group group, boolean withGroupAttributes) throws GroupResourceMismatchException { this.checkGroupIsFromTheSameVoLikeResource(sess, group, resource); List<Attribute> attributes = getAttributesManagerImpl().getRequiredAttributes(sess, services, resource, group); if (withGroupAttributes) { attributes.addAll(getAttributesManagerImpl().getRequiredAttributes(sess, services, group)); } return attributes; }
Source:
<code>public QueryBuilder fromBranch(String branchGuid) throws OseeCoreException { <START> return fromBranch(TokenFactory.createBranch(branchGuid, "fromQueryFactory")); <END> }</code><technical_language>want consider N/A in addition describing created getClass().getSimpleName() + "fromBranch"</technical_language>

Target:
public QueryBuilder fromBranch(String branchGuid) throws OseeCoreException { return fromBranch(TokenFactory.createBranch(branchGuid, String.format("N/A>%s:%s", getClass().getSimpleName(), "fromBranch"))); }
Source:
<code>public void addTargetExtension(String name, String extension) { <START> targetExtensions.add(Pair.of(name, extension)); <END> }</code><technical_language>Pair.of(name, extension) -> newTargetExtension(name, extension) public static String newTargetExtension(String name, String extension) { return name + ':' + extension; } other place Pair.of</technical_language>

Target:
public void addTargetExtension(String name, String extension) { targetExtensions.add(newTargetExtension(name, extension)); }
Source:
<code>private boolean titlesEqual(String subjectTitle, String candidateTitle) { <START> return false && subjectTitle.equals(candidateTitle); <END> }</code><technical_language>false false</technical_language>

Target:
private boolean titlesEqual(String subjectTitle, String candidateTitle) { return subjectTitle.equals(candidateTitle); }
Source:
<code>protected PairSupplier<Q, E> getPairSupplier(){ <START> if (endpointProvider == null){ <END> throw new NullPointerException("Init endpoint provider!"); } if (pairSupplier == null){ pairSupplier = pairSupplierFactory.create(queryProvider, endpointProvider); } return pairSupplier; }</code><technical_language>check for queryProvider</technical_language>

Target:
protected PairSupplier<Q, E> getPairSupplier(){ if (endpointProvider == null){ throw new NullPointerException("Init endpoint provider!"); } if (queryProvider == null) { logger.warn("Query provider is null!"); } if (pairSupplier == null){ pairSupplier = pairSupplierFactory.create(queryProvider, endpointProvider); } return pairSupplier; }
Source:
<code>public int getNextNewUserBrickId(String text) { int id = 1; boolean newIdFound = false; while (!newIdFound) { newIdFound = true; for (UserBrick userBrick : userBricks) { <START> if (userBrick.getDefinitionBrick().getName().equals(text + id)) { <END> newIdFound = false; id++; break; } } } return id; }</code><technical_language>text + id done for avoid multiple string concatenation. //EDIT: better: userBrickNameExists() defined below? ;)</technical_language>

Target:
public int getNextNewUserBrickId(String text) { int id = 1; boolean newIdFound = false; while (!newIdFound) { newIdFound = true; if (userBrickNameExists(text + id)) { newIdFound = false; id++; } } return id; }
Source:
<code>public void testUploadFindingsPositiveCase() throws Exception { String token = "db975c97-98b1-4988-8d6a-9c3e044dfff3"; String engagementId = "12345"; new MockServerClient("localhost", 1080) .when( request() .withMethod("POST") .withHeader(HttpHeaders.AUTHORIZATION, "Token " + token) .withPath("/defectdojo/api/v2/import-scan") .withBody( params( param("engagement", engagementId) ) ) ) .respond( response() .withStatusCode(201) .withHeader(HttpHeaders.CONTENT_TYPE, "application/json") ); DefectDojoUploader uploader = new DefectDojoUploader(); DefectDojoClient client = new DefectDojoClient(uploader, new URL("https://localhost/defectdojo")); <START> client.uploadDependencyTrackFindings(token, engagementId, new NullInputStream(0)); <END> }</code><technical_language>is assertion done in this test. is response stubbing verify a returned, Verification API MockServer prove expected request made? <LINK_0> e.g. new MockServerClient("localhost", 1080) .verify( request() .withPath("/defectdojo/api/v2/import-scan"), VerificationTimes.atLeast(1) );</technical_language>

Target:
public void testUploadFindingsPositiveCase() throws Exception { String token = "db975c97-98b1-4988-8d6a-9c3e044dfff3"; String engagementId = "12345"; testClient.when( request() .withMethod("POST") .withHeader(HttpHeaders.AUTHORIZATION, "Token " + token) .withPath("/defectdojo/api/v2/import-scan/") ) .respond( response() .withStatusCode(201) .withHeader(HttpHeaders.CONTENT_TYPE, "application/json") ); DefectDojoUploader uploader = new DefectDojoUploader(); DefectDojoClient client = new DefectDojoClient(uploader, new URL("https://localhost/defectdojo")); client.uploadDependencyTrackFindings(token, engagementId, new NullInputStream(0)); testClient.verify( request() .withMethod("POST") .withPath("/defectdojo/api/v2/import-scan/"), VerificationTimes.exactly(1) ); }
Source:
<code>public VcfReader vcfReader(InputParameters parameters) throws IOException { String fileId = parameters.getVcfId(); String studyId = parameters.getStudyId(); File vcfFile = new File(parameters.getVcf()); <START> if (VariantSource.Aggregation.NONE.equals(parameters.getVcfAggregation())) { <END> return new VcfReader(fileId, studyId, vcfFile); } else { return new AggregatedVcfReader(fileId, studyId, parameters.getVcfAggregation(), parameters.getAggregatedMappingFile(), vcfFile); } }</code><technical_language>parameters.getVcfAggregation() is multiple times in this method, extracted variable</technical_language>

Target:
public VcfReader vcfReader(InputParameters parameters) throws IOException { String fileId = parameters.getVcfId(); String studyId = parameters.getStudyId(); File vcfFile = new File(parameters.getVcf()); VariantSource.Aggregation vcfAggregation = parameters.getVcfAggregation(); if (VariantSource.Aggregation.NONE.equals(vcfAggregation)) { return new VcfReader(fileId, studyId, vcfFile); } else { return new AggregatedVcfReader(fileId, studyId, vcfAggregation, parameters.getAggregatedMappingFile(), vcfFile); } }
Source:
<code>private void createStack(AmazonCloudFormation cfn) throws IOException { String stackName = getStackName(); String cfnTemplateUrl = getCfnTemplateUrl(); File cfnTemplateFile = getCfnTemplateFile(); List<Parameter> cfnStackParams = getCfnStackParams(); List<Tag> cfnStackTags = getCfnStackTags(); String cfnStackPolicyUrl = getCfnStackPolicyUrl(); File cfnStackPolicyFile = getCfnStackPolicyFile(); String cfnOnFailure = getCfnOnFailure(); getLogger().info("create stack: {}", stackName); CreateStackRequest req = new CreateStackRequest() .withStackName(stackName) .withParameters(cfnStackParams) .withTags(cfnStackTags) .withOnFailure(cfnOnFailure); if (Strings.isNullOrEmpty(cfnTemplateUrl) == false) { req.setTemplateURL(cfnTemplateUrl); } else { req.setTemplateBody(FileUtils.readFileToString(cfnTemplateFile)); } if (isCapabilityIam()) { Capability selectedCapability = (useCapabilityIam == null) ? Capability.CAPABILITY_IAM : useCapabilityIam; getLogger().info("Using policy: " + selectedCapability); req.setCapabilities(Arrays.asList(selectedCapability.toString())); } <START> if (!Strings.isNullOrEmpty(cfnStackPolicyUrl)) { <END> req.setStackPolicyURL(cfnStackPolicyUrl); } else if (cfnStackPolicyFile != null) { req.setStackPolicyBody( FileUtils.readFileToString(cfnStackPolicyFile)); } CreateStackResult createStackResult = cfn.createStack(req); getLogger().info("create requested: {}", createStackResult.getStackId()); }</code><technical_language>Please leave == false</technical_language>

Target:
private void createStack(AmazonCloudFormation cfn) throws IOException { String stackName = getStackName(); String cfnTemplateUrl = getCfnTemplateUrl(); File cfnTemplateFile = getCfnTemplateFile(); List<Parameter> cfnStackParams = getCfnStackParams(); List<Tag> cfnStackTags = getCfnStackTags(); String cfnStackPolicyUrl = getCfnStackPolicyUrl(); File cfnStackPolicyFile = getCfnStackPolicyFile(); String cfnOnFailure = getCfnOnFailure(); getLogger().info("create stack: {}", stackName); CreateStackRequest req = new CreateStackRequest() .withStackName(stackName) .withParameters(cfnStackParams) .withTags(cfnStackTags) .withOnFailure(cfnOnFailure); if (Strings.isNullOrEmpty(cfnTemplateUrl) == false) { req.setTemplateURL(cfnTemplateUrl); } else { req.setTemplateBody(FileUtils.readFileToString(cfnTemplateFile)); } if (isCapabilityIam()) { Capability selectedCapability = (useCapabilityIam == null) ? Capability.CAPABILITY_IAM : useCapabilityIam; getLogger().info("Using policy: " + selectedCapability); req.setCapabilities(Arrays.asList(selectedCapability.toString())); } if (Strings.isNullOrEmpty(cfnStackPolicyUrl) == false) { req.setStackPolicyURL(cfnStackPolicyUrl); } else if (cfnStackPolicyFile != null) { req.setStackPolicyBody( FileUtils.readFileToString(cfnStackPolicyFile)); } CreateStackResult createStackResult = cfn.createStack(req); getLogger().info("create requested: {}", createStackResult.getStackId()); }
Source:
<code>protected ITabDescriptor[] filterTabDescriptors( ITabDescriptor[] descriptors, IWorkbenchPart part, ISelection selection) { List result = new ArrayList(); for (ITabDescriptor <START> descriptor2 : <END> descriptors) { ITabDescriptor descriptor = adaptDescriptorFor(descriptor2, part, selection); if (!descriptor.getSectionDescriptors().isEmpty()) { result.add(descriptor); } } if (result.size() == 0) { return EMPTY_DESCRIPTOR_ARRAY; } return (ITabDescriptor[]) result.toArray(new ITabDescriptor[result .size()]); }</code><technical_language>rename 'desciptor'</technical_language>

Target:
protected ITabDescriptor[] filterTabDescriptors( ITabDescriptor[] descriptors, IWorkbenchPart part, ISelection selection) { List result = new ArrayList(); for (ITabDescriptor descriptor : descriptors) { ITabDescriptor filteredDescriptor = adaptDescriptorFor(descriptor, part, selection); if (!filteredDescriptor.getSectionDescriptors().isEmpty()) { result.add(filteredDescriptor); } } if (result.size() == 0) { return EMPTY_DESCRIPTOR_ARRAY; } return (ITabDescriptor[]) result.toArray(new ITabDescriptor[result .size()]); }
Source:
<code>public ChannelFuture register(final Channel channel, final ChannelPromise promise) { ObjectUtil.checkNotNull(promise, "promise"); ObjectUtil.checkNotNull(channel, "channel"). unsafe(). <START> register(this, promise); <END> return promise; }</code><technical_language>consider merging some lines... formatting strange</technical_language>

Target:
public ChannelFuture register(final Channel channel, final ChannelPromise promise) { ObjectUtil.checkNotNull(promise, "promise"); ObjectUtil.checkNotNull(channel, "channel"); channel.unsafe().register(this, promise); return promise; }
Source:
<code><START> public void prepareRun(StageSubmitterContext context) throws Exception { <END> super.prepareRun(context); context.record( TransformLineageRecorderUtils.oneToOneIn(new ArrayList<>(encryptFields), "encrypt", "Encrypt specified fields using given algorithm.")); }</code><technical_language>This is similar Decryptor</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); encryptFields = conf.getEncryptFields(); if (context.getInputSchema() == null || context.getInputSchema().getFields() == null) { return; } List<String> encryptedFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()).stream() .filter(encryptFields::contains) .collect(Collectors.toList()); List<String> identityFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()); identityFields.removeAll(encryptedFields); List<FieldOperation> output = new ArrayList<>(); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(encryptedFields, "encrypt", "Encrypted the requested fields.")); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(identityFields, "identity", TransformLineageRecorderUtils.IDENTITY_TRANSFORM_DESCRIPTION)); context.record(output); }
Source:
<code>public void validate(Object obj, Errors errors){ ValidationUtils.invokeValidator(validator, obj, errors); <START> ComponentTypeBackingForm form = (ComponentTypeBackingForm) obj; <END> ValidationUtils.rejectIfEmpty(errors, "productType.productTypeName", "productTypeName.empty", "The productTypeName is required"); ValidationUtils.rejectIfEmpty(errors, "productType.productTypeNameShort", "productTypeNameShort.empty", "The productTypeNameShort is required"); ValidationUtils.rejectIfEmpty(errors, "productType.expiresAfter", "expiresAfter.empty", "The expiresAfter value is required"); ValidationUtils.rejectIfEmpty(errors, "productType.expiresAfterUnits", "expiresAfterUnits.empty", "The expiresAfterUnits value is required"); ValidationUtils.rejectIfEmpty(errors, "productType.description", "description.empty", "The description is required"); }</code><technical_language>form is unused</technical_language>

Target:
public void validate(Object obj, Errors errors) { ValidationUtils.rejectIfEmpty(errors, "componentType.componentTypeName", "componentTypeName.empty", "The componentTypeName is required"); ValidationUtils.rejectIfEmpty(errors, "componentType.componentTypeNameShort", "componentTypeNameShort.empty", "The componentTypeNameShort is required"); ValidationUtils.rejectIfEmpty(errors, "componentType.expiresAfter", "expiresAfter.empty", "The expiresAfter value is required"); ValidationUtils.rejectIfEmpty(errors, "componentType.expiresAfterUnits", "expiresAfterUnits.empty", "The expiresAfterUnits value is required"); ValidationUtils.rejectIfEmpty(errors, "componentType.description", "description.empty", "The description is required"); ValidationUtils.rejectIfEmpty(errors, "componentType.hasBloodGroup", "hasBloodGroup.empty", "The Has Blood Group is required"); ValidationUtils.rejectIfEmpty(errors, "componentType.producedComponentTypeCombinations", "producedComponentTypeCombinations.empty", "The Produced Component Type Combinations is required"); }
Source:
<code>public void testSetToNullWhenNVPMSSetToNull() { User target = new User(); target.setAddress( "address" ); target.setEmail( "email" ); target.setName( "name" ); target.setPhone( 12345 ); target.setSettings( new String[]{ "test" } ); UserDTO source = new UserDTO(); source.setContactDataDTO( new ContactDataDTO() ); source.getContactDataDTO().setAddress( "newAddress" ); source.getContactDataDTO().setEmail( null ); source.getContactDataDTO().setPhone( null ); source.setName( null ); UserMapper.INSTANCE.updateUserFromUserDTO( source, target ); assertThat( target.getAddress() ).isEqualTo( "newAddress" ); assertThat( target.getEmail() ).isNull(); assertThat( target.getPhone() ).isNull(); assertThat( target.getName() ).isNull(); <START> assertThat( target.getPreferences() ).isEmpty(); <END> assertThat( target.getSettings() ).isNull(); }</code><technical_language>more sense add preferences validate cleared after</technical_language>

Target:
public void testSetToNullWhenNVPMSSetToNull() { User target = new User(); target.setAddress( "address" ); target.setEmail( "email" ); target.setName( "name" ); target.setPhone( 12345 ); target.addPreference( "preference" ); target.setSettings( new String[]{ "test" } ); UserDTO source = new UserDTO(); source.setContactDataDTO( new ContactDataDTO() ); source.getContactDataDTO().setAddress( "newAddress" ); source.getContactDataDTO().setEmail( null ); source.getContactDataDTO().setPhone( null ); source.setName( null ); UserMapper.INSTANCE.updateUserFromUserDTO( source, target ); assertThat( target.getAddress() ).isEqualTo( "newAddress" ); assertThat( target.getEmail() ).isNull(); assertThat( target.getPhone() ).isNull(); assertThat( target.getName() ).isNull(); assertThat( target.getPreferences() ).containsOnly( "preference" ); assertThat( target.getSettings() ).isNull(); }
Source:
<code>public static void logStringToSign(ClientLogger logger, String stringToSign, Context context) { if (context != null && Boolean.TRUE.equals(context.getData(Constants.STORAGE_LOG_STRING_TO_SIGN).orElse(false))) { logger.info("The string to sign computed by the SDK is: {}{}", stringToSign, <START> System.getProperty("line.separator")); <END> logger.warning("Please remember to disable '{}' before going to production as this " + "string can potentially contain PII.", Constants.STORAGE_LOG_STRING_TO_SIGN); } }</code><technical_language>System.lineSeparator() instead is a convenience wrapper for this</technical_language>

Target:
public static void logStringToSign(ClientLogger logger, String stringToSign, Context context) { if (context != null && Boolean.TRUE.equals(context.getData(Constants.STORAGE_LOG_STRING_TO_SIGN).orElse(false))) { logger.info(STRING_TO_SIGN_LOG_INFO_MESSAGE, stringToSign, System.lineSeparator()); logger.warning(STRING_TO_SIGN_LOG_WARNING_MESSAGE, Constants.STORAGE_LOG_STRING_TO_SIGN); } }
Source:
<code><START> public Long create(String type, long entityId, ChangeLog changeLog) { <END> ChangeLogType changeLogType = ChangeLogType.get(type); ChangeLog result = changeLogType.create(); result.setColumnsChanged(changeLog.getColumnsChanged()); result.setId(changeLog.getId()); result.setSummary(changeLog.getSummary()); result.setTime(new Date()); result.setUser(changeLog.getUser()); return (Long) currentSession().save(result); }</code><technical_language>If changelogs created triggers, do need a DAO method for creating them</technical_language>

Target:
public Long create(String type, long entityId, ChangeLog changeLog) { ChangeLogType changeLogType = ChangeLogType.get(type); ChangeLog result = changeLogType.create(); result.setColumnsChanged(changeLog.getColumnsChanged()); result.setId(entityId); result.setSummary(changeLog.getSummary()); result.setTime(new Date()); result.setUser(changeLog.getUser()); return (Long) currentSession().save(result); }
Source:
<code>public ResourceWithType waitForResourceContaining(String feed, String rType, String containing, long sleep, int attempts) throws Throwable { for (int i = 0; i < attempts; i++) { Optional<ResourceWithType> resource = getResourceByType(feed, rType, 0) .stream() .filter(e -> containing == null <START> || e.getId().contains(containing)) END> .findFirst(); if (resource.isPresent()) { return resource.get(); } Thread.sleep(sleep); } throw new AssertionError("Resource [type=" + rType + ", containing=" + containing + "] not found after " + attempts + " attempts."); }</code><technical_language>name I</technical_language>

Target:
public ResourceWithType waitForResourceContaining(String feed, String rType, String containing, long sleep, int attempts) throws Throwable { for (int i = 0; i < attempts; i++) { Optional<ResourceWithType> resource = getResourceByType(feed, rType, 0) .stream() .filter(e -> containing == null || e.getName().contains(containing)) .findFirst(); if (resource.isPresent()) { return resource.get(); } Thread.sleep(sleep); } throw new AssertionError("Resource [type=" + rType + ", containing=" + containing + "] not found after " + attempts + " attempts."); }
Source:
<code>public static boolean zipDirectory(String inputDirectory, String absoluteFileName) throws FileNotFoundException, IOException { FileOutputStream outputStream = null; ZipOutputStream zipOutputStream = null; try { <START> outputStream = new FileOutputStream(absoluteFileName); <END> zipOutputStream = new ZipOutputStream(outputStream); Iterator<File> directoryContentsItr = FileUtils.iterateFiles(new File(inputDirectory), null, false); while(directoryContentsItr.hasNext()) { File file = directoryContentsItr.next(); if (!file.isDirectory()) { FileInputStream inputStream = null; boolean written = false; try { inputStream = new FileInputStream(file); ZipEntry zipEntry = new ZipEntry(file.getName()); zipOutputStream.putNextEntry(zipEntry); byte[] bytes = new byte[1024]; int length; while ((length = inputStream.read(bytes)) >= 0) { zipOutputStream.write(bytes, 0, length); } written = true; } finally { if(written) { zipOutputStream.closeEntry(); } if(inputStream != null) { inputStream.close(); } } } } } finally { if(zipOutputStream != null) { zipOutputStream.close(); } if(outputStream != null) { outputStream.close(); } } return true; }</code><technical_language>started a liking Java 7 try-with-resources pattern for stuff this. cleans separate declaration finally. at</technical_language>

Target:
public static boolean zipDirectory(String inputDirectory, String absoluteFileName) throws FileNotFoundException, IOException { try(FileOutputStream outputStream = new FileOutputStream(absoluteFileName); ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) { Iterator<File> directoryContentsItr = FileUtils.iterateFiles(new File(inputDirectory), null, false); while(directoryContentsItr.hasNext()) { File file = directoryContentsItr.next(); if (!file.isDirectory()) { FileInputStream inputStream = null; boolean written = false; try { inputStream = new FileInputStream(file); ZipEntry zipEntry = new ZipEntry(file.getName()); zipOutputStream.putNextEntry(zipEntry); IOUtils.copy(inputStream, zipOutputStream); written = true; } finally { if(written) { zipOutputStream.finish(); zipOutputStream.flush(); } if(inputStream != null) { inputStream.close(); } } } } } return true; }
Source:
<code>public boolean containsAll(IntSet set) { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>containsAll(IntSet) containsAll(Collection) supported :)</technical_language>

Target:
public boolean containsAll(IntSet set) { return this.set.containsAll(set); }
Source:
<code>public static Uri getOptimizedMedia(Activity activity, SiteModel siteModel, String path, boolean isVideo) { if (isVideo) { return null; } SiteSettingsInterface siteSettings = SiteSettingsInterface.getInterface(activity, siteModel, null); if (siteSettings != null && siteSettings.init(false).getOptimizedImage()) { <START> int resizeWidth = MediaUtils.getImageWidthSettingFromString(siteSettings.getMaxImageWidth()); <END> int quality = siteSettings.getImageQuality(); if (resizeWidth == Integer.MAX_VALUE && quality == 100) { return null; } String optimizedPath = ImageUtils.optimizeImage(activity, path, resizeWidth, quality); if (optimizedPath == null) { AppLog.e(AppLog.T.EDITOR, "Optimized picture was null!"); AnalyticsTracker.track(AnalyticsTracker.Stat.MEDIA_PHOTO_OPTIMIZE_ERROR); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.MEDIA_PHOTO_OPTIMIZED); return Uri.parse(optimizedPath); } } return null; }</code><technical_language>resize width stored int a String? simply -1 o 0 for original size</technical_language>

Target:
public static Uri getOptimizedMedia(Activity activity, SiteModel siteModel, String path, boolean isVideo) { if (isVideo) { return null; } SiteSettingsInterface siteSettings = SiteSettingsInterface.getInterface(activity, siteModel, null); if (siteSettings != null && siteSettings.init(false).getOptimizedImage()) { int resizeWidth = siteSettings.getMaxImageWidth() > 0 ? siteSettings.getMaxImageWidth() : Integer.MAX_VALUE; int quality = siteSettings.getImageQuality(); if (resizeWidth == Integer.MAX_VALUE && quality == 100) { return null; } String optimizedPath = ImageUtils.optimizeImage(activity, path, resizeWidth, quality); if (optimizedPath == null) { AppLog.e(AppLog.T.EDITOR, "Optimized picture was null!"); AnalyticsTracker.track(AnalyticsTracker.Stat.MEDIA_PHOTO_OPTIMIZE_ERROR); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.MEDIA_PHOTO_OPTIMIZED); return Uri.parse(optimizedPath); } } return null; }
Source:
<code>public ISectionDescriptorProvider getSectionDescriptorProvider(String contributorId) { ISectionDescriptorProvider legacyPropertySectionDescriptorProvider = null; Collection<IItemDescriptor> values = this.id2descriptors.values(); for (IItemDescriptor itemDescriptor : values) { if (itemDescriptor instanceof LegacyPropertyContributorItemDescriptor) { if (contributorId != null && contributorId.equals(itemDescriptor.getId())) { <START> legacyPropertySectionDescriptorProvider = ((LegacyPropertyContributorItemDescriptor) itemDescriptor) .getSectionDescriptorProvider(); <END> } } } return legacyPropertySectionDescriptorProvider; }</code><technical_language>question above</technical_language>

Target:
public ISectionDescriptorProvider getSectionDescriptorProvider(String contributorId) { Collection<IItemDescriptor> values = this.id2descriptors.values(); for (IItemDescriptor itemDescriptor : values) { if (itemDescriptor instanceof LegacyPropertyContributorItemDescriptor) { if (contributorId != null && contributorId.equals(itemDescriptor.getId())) { return ((LegacyPropertyContributorItemDescriptor) itemDescriptor).getSectionDescriptorProvider(); } } } return null; }
Source:
<code>public boolean run(CommandSender sender, Command cmd, String commandLabel, String[] args) { TFM_Util.adminAction(sender.getName() + "Requesting help"); <START> if (TFM_AdminList.isSuperAdmin()) <END> { player.sendMessage(sender.getName() + " has requested help."); } sender.sendMessage(ChatColor.RED + "You have requested help, a staff member will be with your shortly"); return true; }</code><technical_language>java if (TFM_AdminList.isSuperAdmin(player.getName())) Correct if i wrong</technical_language>

Target:
public boolean run(CommandSender sender, Command cmd, String commandLabel, String[] args) { TFM_Util.adminAction(sender.getName() + "Requesting help"); if (TFM_AdminList.isSuperAdmin(player)) { player.sendMessage(sender.getName() + ChatColor.RED + " has requested help."); } sender.sendMessage(ChatColor.RED + "You have requested help, a staff member will be with your shortly"); return true; }
Source:
<code>public String getJoinClassName(String modelName) { <START> return ElideDynamicEntityCompiler.getStaticModelClassName(modelName, EMPTY_STRING, <END> capitalizeFirstLetter(modelName)); }</code><technical_language>is a NO_VERSION constant here. here</technical_language>

Target:
public String getJoinClassName(String modelName) { return ElideDynamicEntityCompiler.getStaticModelClassName(modelName, NO_VERSION, capitalizeFirstLetter(modelName)); }
Source:
<code><START> public void onConfigurationChanged(Configuration newConfig) { <END> leadImagesHandler.beginLayout(new LeadImagesHandler.OnLeadImageLayoutListener() { @Override public void onLayoutComplete() { searchBarHideHandler.setFadeEnabled(leadImagesHandler.isLeadImageEnabled()); } }); }</code><technical_language>call super</technical_language>

Target:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); leadImagesHandler.beginLayout(new LeadImagesHandler.OnLeadImageLayoutListener() { @Override public void onLayoutComplete() { searchBarHideHandler.setFadeEnabled(leadImagesHandler.isLeadImageEnabled()); } }); }
Source:
<code>public ColumnCombinationBitset invert(int size) { <START> return new ColumnCombinationBitset(getClearedBits(size)); <END> }</code><technical_language>I faster a bitset operation (not) invert call constructor OpenBitSet</technical_language>

Target:
public ColumnCombinationBitset invert(int size) { OpenBitSet invertedBitset = this.bitset.clone(); invertedBitset.flip(0, size); return new ColumnCombinationBitset().setColumns(invertedBitset); }
Source:
<code>public boolean isCopyEmailPopoverVisible() { <START> String xpath = " END> return isElementVisible(By.xpath(xpath)); }</code><technical_language>class selectors instead of xpath xpath is brittler in selenium</technical_language>

Target:
public boolean isCopyEmailPopoverVisible() { String selector = "#copy-email-button + div.popover"; return isElementVisible(By.cssSelector(selector)); }
Source:
<code>private void splitHostPort(String value, String defaultHost, int defaultPort) { String hostPortValue = value.trim(); if (hostPortValue.charAt(0) == '[') { extractIPv6(hostPortValue); return; } int portSeparator = hostPortValue.lastIndexOf(':'); if (portSeparator < 0) { throw new IllegalArgumentException("Invalid HOST:PORT value: " + value); } String hostValue = hostPortValue.substring(0, portSeparator).trim(); host = hostValue.length() > 0 ? hostValue : defaultHost; String portString = hostPortValue.substring(portSeparator + 1).trim(); if (portString.length() > 0) { port = Integer.parseInt(portString); if (port <= PORT_MIN || port > PORT_MAX) { <START> throw new IllegalArgumentException("Invalid port value: " + value); <END> } } else { port = defaultPort; } }</code><technical_language>suggestion throw new IllegalArgumentException("Port " + + " out of valid range [" + PORT_MIN + ", " + PORT_MAX + ")"); perhaps</technical_language>

Target:
private void splitHostPort(String value, String defaultHost, int defaultPort) { String hostPortValue = value.trim(); if (hostPortValue.charAt(0) == '[') { extractIPv6(hostPortValue); return; } int portSeparator = hostPortValue.lastIndexOf(':'); if (portSeparator < 0) { throw new IllegalArgumentException("Invalid HOST:PORT value: " + value); } String hostValue = hostPortValue.substring(0, portSeparator).trim(); host = hostValue.length() > 0 ? hostValue : defaultHost; String portString = hostPortValue.substring(portSeparator + 1).trim(); if (portString.length() > 0) { port = Integer.parseInt(portString); if (port <= PORT_MIN || port > PORT_MAX) { throw new IllegalArgumentException("Port " + value + " out of valid range [" + PORT_MIN + ", " + PORT_MAX + ")"); } } else { port = defaultPort; } }
Source:
<code>public Response shutdown( @QueryParam("shutoffTime") final String shutoffTimeMillis, @Context final HttpServletRequest req ) { Access accessResult = AuthorizationUtils.authorizeResourceAction( req, new ResourceAction( new Resource("STATE", ResourceType.STATE), Action.WRITE ), authorizerMapper ); if (!accessResult.isAllowed()) { return Response.status(403).build(); } try { DateTime shutoffAt = shutoffTimeMillis == null ? DateTimes.nowUtc() : DateTimes.of(shutoffTimeMillis); log.info("Setting Firehose shutoffTime to %s", shutoffTimeMillis); long shutoffTimeoutMillis = Math.max(shutoffAt.getMillis() - System.currentTimeMillis(), 0); requestedShutdownTimeNsHolder.set(System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(shutoffTimeoutMillis)); Thread delayedCloseExecutor = this.delayedCloseExecutor; boolean needToInterruptDelayedCloseExecutor = true; <START> if (delayedCloseExecutor == null) { <END> synchronized (this) { delayedCloseExecutor = this.delayedCloseExecutor; if (delayedCloseExecutor == null) { delayedCloseExecutor = createDelayedCloseExecutor(); needToInterruptDelayedCloseExecutor = false; } } } if (needToInterruptDelayedCloseExecutor) { delayedCloseExecutor.interrupt(); } return Response.ok().build(); } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", e.getMessage())) .build(); } }</code><technical_language>shutdown is a rare call, do synchronized double-check pattern</technical_language>

Target:
public Response shutdown( @QueryParam("shutoffTime") final String shutoffTimeMillis, @Context final HttpServletRequest req ) { Access accessResult = AuthorizationUtils.authorizeResourceAction( req, new ResourceAction( new Resource("STATE", ResourceType.STATE), Action.WRITE ), authorizerMapper ); if (!accessResult.isAllowed()) { return Response.status(403).build(); } try { DateTime shutoffAt = shutoffTimeMillis == null ? DateTimes.nowUtc() : DateTimes.of(shutoffTimeMillis); log.info("Setting Firehose shutoffTime to %s", shutoffTimeMillis); long shutoffTimeoutMillis = Math.max(shutoffAt.getMillis() - System.currentTimeMillis(), 0); requestedShutdownTimeNs = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(shutoffTimeoutMillis); Thread delayedCloseExecutor; boolean needToInterruptDelayedCloseExecutor = true; synchronized (this) { delayedCloseExecutor = this.delayedCloseExecutor; if (delayedCloseExecutor == null) { delayedCloseExecutor = createDelayedCloseExecutor(); needToInterruptDelayedCloseExecutor = false; } } if (needToInterruptDelayedCloseExecutor) { delayedCloseExecutor.interrupt(); } return Response.ok().build(); } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", e.getMessage())) .build(); } }
Source:
<code>private List<RemoteReplicaInfo> getRemoteStandbyReplicasTimedOutOnNoProgress( List<RemoteReplicaInfo> remoteReplicaInfos) { List<RemoteReplicaInfo> remoteReplicasTimedOut = new ArrayList<>(); <START> if (replicatingFromRemoteColo && leaderBasedReplicationAdmin != null <END> && replicationConfig.replicationStandbyWaitTimeoutToTriggerCrossColoFetchSeconds != -1) { for (RemoteReplicaInfo remoteReplicaInfo : remoteReplicaInfos) { ExchangeMetadataResponse exchangeMetadataResponse = remoteReplicaInfo.getExchangeMetadataResponse(); if (exchangeMetadataResponse.hasMissingStoreMessages() && (time.seconds() - exchangeMetadataResponse.metadataReceivedTimeSec) > replicationConfig.replicationStandbyWaitTimeoutToTriggerCrossColoFetchSeconds) { remoteReplicasTimedOut.add(remoteReplicaInfo); } } } return remoteReplicasTimedOut; }</code><technical_language>nit: repilcatingFromRemoteColo leaderBaseReplicationAdmin check unnecessary, for this method true</technical_language>

Target:
List<RemoteReplicaInfo> getRemoteStandbyReplicasTimedOutOnNoProgress(List<RemoteReplicaInfo> remoteReplicaInfos) { List<RemoteReplicaInfo> remoteReplicasTimedOut = new ArrayList<>(); if (replicationConfig.replicationStandbyWaitTimeoutToTriggerCrossColoFetchSeconds != -1) { for (RemoteReplicaInfo remoteReplicaInfo : remoteReplicaInfos) { ReplicaId localReplica = remoteReplicaInfo.getLocalReplicaId(); ReplicaId remoteReplica = remoteReplicaInfo.getReplicaId(); ExchangeMetadataResponse exchangeMetadataResponse = remoteReplicaInfo.getExchangeMetadataResponse(); if (!leaderBasedReplicationAdmin.isLeaderPair(localReplica, remoteReplica) && exchangeMetadataResponse.hasMissingStoreMessages() && (time.seconds() - exchangeMetadataResponse.lastMissingMessageReceivedTimeSec) > replicationConfig.replicationStandbyWaitTimeoutToTriggerCrossColoFetchSeconds) { remoteReplicasTimedOut.add(remoteReplicaInfo); } } } return remoteReplicasTimedOut; }
Source:
<code>public void emit(T tuple) { if (verifySameThread()) { <START> getSink().put(tuple); <END> } }</code><technical_language>sink->getSink()</technical_language>

Target:
public void emit(T tuple) { verifyOperatorThread(); sink.put(tuple); }
Source:
<code>public static void closeAll(AutoCloseable... closeables) throws Exception { if (closeables == null) { return; <START> } <END> Exception rootCause = null; for (AutoCloseable closeable : closeables) { try { if (closeable != null) { closeable.close(); } } catch (Exception e) { if (rootCause == null) { rootCause = e; } else if (rootCause != e) { rootCause.addSuppressed(e); } } catch (Throwable e) { if (rootCause == null) { rootCause = new Exception(e); } else if (rootCause != e) { rootCause.addSuppressed(e); } } } if (rootCause != null) { throw rootCause; } }</code><technical_language>ignore InterruptedException</technical_language>

Target:
public static void closeAll(AutoCloseable... closeables) throws Exception { if (closeables == null) { return; } ImmutableList.Builder<Throwable> exceptions = ImmutableList.builder(); for (AutoCloseable closeable : closeables) { try { if (closeable != null) { closeable.close(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); exceptions.add(e); } catch (Exception e) { exceptions.add(e); } catch (Throwable e) { exceptions.add(e); } } rethrow(exceptions.build()); }
Source:
<code>private Request.Options createRequestOptions() { return new Request.Options( <START> (int) config.connectTimeout().toMillis(), <END> (int) config.readTimeout().toMillis()); }</code><technical_language>thoughts making checkedCasts</technical_language>

Target:
private Request.Options createRequestOptions() { return new Request.Options( Math.toIntExact(config.connectTimeout().toMillis()), Math.toIntExact(config.readTimeout().toMillis())); }
Source:
<code>public Object get(Object object) { try { if (method != null) { if (getter == null) { String methodName; if(Boolean.class.getSimpleName().toLowerCase().equals(getType().getName())){ methodName = "is" + method.getName().substring(3); } else { <START> methodName = "g" + method.getName().substring(1); <END> } getter = object.getClass() .getMethod(methodName); } return getter.invoke(object); } else { return field.get(object); } } catch (SecurityException | IllegalArgumentException | InvocationTargetException | IllegalAccessException e) { throw new ParameterException(e); } catch (NoSuchMethodException e) { String name = method.getName(); String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4); Object result = null; try { Field field = method.getDeclaringClass().getDeclaredField(fieldName); if (field != null) { setFieldAccessible(field); result = field.get(object); } } catch(NoSuchFieldException | IllegalAccessException ex) { } return result; } }</code><technical_language>support boolean methods start get, valid well</technical_language>

Target:
public Object get(Object object) { try { if (method != null) { if (getter == null) { setGetter(object); } return getter.invoke(object); } else { return field.get(object); } } catch (SecurityException | IllegalArgumentException | InvocationTargetException | IllegalAccessException e) { throw new ParameterException(e); } catch (NoSuchMethodException e) { String name = method.getName(); String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4); Object result = null; try { Field field = method.getDeclaringClass().getDeclaredField(fieldName); if (field != null) { setFieldAccessible(field); result = field.get(object); } } catch(NoSuchFieldException | IllegalAccessException ex) { } return result; } }
Source:
<code>public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); Matcher matcher; try { response = urlopen.open(accountUrl); matcher = reAccounts.matcher(response); while (matcher.find()) { Account account = new Account(Html.fromHtml(matcher.group(1)).toString(), Helpers.parseBalance(matcher.group(4)), matcher.group(2), Long.parseLong(matcher.group(3))); balance = balance.add(Helpers.parseBalance(matcher.group(4))); accounts.add(account); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } <START> } finally { <END> super.updateComplete(); } }</code><technical_language>remove finally {</technical_language>

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); response = urlopen.open(accountUrl); Matcher matcher = reAccounts.matcher(response); while (matcher.find()) { Account account = new Account(Html.fromHtml(matcher.group(1)).toString(), Helpers.parseBalance(matcher.group(4)), matcher.group(2), Long.parseLong(matcher.group(3))); balance = balance.add(Helpers.parseBalance(matcher.group(4))); accounts.add(account); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }