auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isDefault() { boolean isDefault = false; <START> if ( mapperToImplement != null ) { <END> isDefault = Executables.isInterfaceDefaultMethod( executable, mapperToImplement.getTypeElement() ); } return isDefault; }</code><technical_language>nan</technical_language>

Target:
public boolean isDefault() { return Executables.isDefaultMethod( executable ); }
Source:
<code>public void nextTuple() { try { if (refreshSubscriptionTimer.isExpiredResetOnTrue()) { kafkaSpoutConfig.getSubscription().refreshAssignment(); } <START> if (commit()) { <END> commitOffsetsForAckedTuples(); } Set<TopicPartition> pollablePartitions = poll(); if (!pollablePartitions.isEmpty()) { try { setWaitingToEmit(pollKafkaBroker(pollablePartitions)); } catch (RetriableException e) { LOG.error("Failed to poll from kafka.", e); } } emitIfWaitingNotEmitted(); } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }</code><technical_language>is this flag longer necessary</technical_language>

Target:
public void nextTuple() { try { if (refreshSubscriptionTimer.isExpiredResetOnTrue()) { kafkaSpoutConfig.getSubscription().refreshAssignment(); } if (shouldCommit()) { commitOffsetsForAckedTuples(kafkaConsumer.assignment()); } PollablePartitionsInfo pollablePartitionsInfo = getPollablePartitionsInfo(); if (pollablePartitionsInfo.shouldPoll()) { try { setWaitingToEmit(pollKafkaBroker(pollablePartitionsInfo)); } catch (RetriableException e) { LOG.error("Failed to poll from kafka.", e); } } emitIfWaitingNotEmitted(); } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }
Source:
<code>private List<BuiltinMacs> checkAndSetGitMacs(String gitSshMacs) { if (gitSshMacs == null || gitSshMacs.isEmpty()) { return managedMACs; } else { List<BuiltinMacs> macs = new ArrayList<>(); List<String> macsInput = Arrays.asList(gitSshMacs.split(",")); for (String macCode : macsInput) { BuiltinMacs mac = BuiltinMacs.fromFactoryName(macCode.trim().toLowerCase()); if (mac != null && managedMACs.contains(mac)) { macs.add(mac); LOG.info("Added MAC to the git ssh configuration. ", mac); }else{ <START> LOG.info("MAC not handled in git ssh configuration. ", mac); <END> } } return macs; } }</code><technical_language>raise this WARN</technical_language>

Target:
private List<BuiltinMacs> checkAndSetGitMacs(String gitSshMacs) { if (gitSshMacs == null || gitSshMacs.isEmpty()) { return managedMACs; } else { List<BuiltinMacs> macs = new ArrayList<>(); List<String> macsInput = Arrays.asList(gitSshMacs.split(",")); for (String macCode : macsInput) { BuiltinMacs mac = BuiltinMacs.fromFactoryName(macCode.trim().toLowerCase()); if (mac != null && managedMACs.contains(mac)) { macs.add(mac); LOG.info("Added MAC to the git ssh configuration. ", mac); } else { LOG.warn("MAC not handled in git ssh configuration. ", mac); } } return macs; } }
Source:
<code>public IpSecTransform.Builder setEncryption( @TransformDirection int direction, IpSecAlgorithm algo) { <START> if (mConfig.getAuthenticatedEncryption(direction) != null) { throw new IllegalArgumentException( "Encryption is unsupported while " + "Authenticated Encryption algorithm is specified"); } <END> mConfig.setEncryption(direction, algo); return this; }</code><technical_language>checks duplicate in IpSecConfig. remove those? IpSecConfig is public, need check there</technical_language>

Target:
public IpSecTransform.Builder setEncryption( @TransformDirection int direction, IpSecAlgorithm algo) { mConfig.setEncryption(direction, algo); return this; }
Source:
<code>public RetryPolicy() { <START> this(new RetryPolicyOptions(new ExponentialBackoff(), RETRY_AFTER_MS_HEADER, ChronoUnit.MILLIS)); <END> }</code><technical_language>I default retry-after-ms for header, I this is AppConfiguration</technical_language>

Target:
public RetryPolicy() { this(new RetryPolicyOptions(new ExponentialBackoff())); }
Source:
<code>public void shouldNotTimeout() { try { WebTestClient.ResponseSpec response = webTestClient.get() .uri("/timeout/{timeout}", 1) .exchange(); response.expectStatus() .isOk() .expectBody(String.class) .isEqualTo("OK"); <START> } catch (ReadTimeoutException e) { <END> Assert.fail(); } }</code><technical_language>I remove this exception fails test, reported hide</technical_language>

Target:
public void shouldNotTimeout() { WebTestClient.ResponseSpec response = webTestClient.get() .uri("/timeout/{timeout}", 1) .exchange(); response.expectStatus() .isOk() .expectBody(String.class) .isEqualTo("OK"); }
Source:
<code>public Object get(String name) { if ( attrs.containsKey(name) ) { return attrs.get(name).get(g); } else if ( g.hasAnyAttribute(name) ) { return g.getAnyAttribute(name); <START> } else if ( g.getFilters().contains(name) ) { <END> return "1"; } else return super.get(name); }</code><technical_language>This is a surprising behavior...is add a function takes a filtername responds 1 0 depending filter is applied genotype</technical_language>

Target:
public Object get(String name) { if ( attributes.containsKey(name) ) { return attributes.get(name).get(g); } else if ( g.hasAnyAttribute(name) ) { return g.getAnyAttribute(name); } else if ( g.getFilters().contains(name) ) { return "1"; } else return super.get(name); }
Source:
<code>@Test public void getWithQueryParamIterable() throws Exception { Request request = new Helper() .setMethod("GET") .setUrl("<LINK_0>") .setPath("/foo/bar/") <START> .addQueryParam("ping", Arrays.asList(new String[]{"pong", "pong-too"})) END> .build(); assertThat(request.getMethod()).isEqualTo("GET"); assertThat(request.getHeaders()).isEmpty(); assertThat(request.getUrl()).isEqualTo("<LINK_0>/foo/bar/?ping=pong&ping=pong-too"); assertThat(request.getBody()).isNull(); }</code><technical_language>need new String[]. do Arrays.asList("pong", "pong-too")</technical_language>

Target:
@Test public void getWithQueryParamIterable() throws Exception { Request request = new Helper() .setMethod("GET") .setUrl("<LINK_0>") .setPath("/foo/bar/") .addQueryParam("ping", Arrays.asList("pong", "pong-too")) .build(); assertThat(request.getMethod()).isEqualTo("GET"); assertThat(request.getHeaders()).isEmpty(); assertThat(request.getUrl()).isEqualTo("<LINK_0>/foo/bar/?ping=pong&ping=pong-too"); assertThat(request.getBody()).isNull(); }
Source:
<code>public static QuotaModeType fromValue(String value) { try { return valueOf(value.toUpperCase()); } catch (IllegalArgumentException e) { <START> log.error("missing value: " + value, e); <END> return null; } }</code><technical_language>Consider a more informative message in log, "The \"" + + "\" a valid quota mode.". Also, try slf4j mechanism: log.error("The \"{}\" a valid quota mode.", value); log.error("Exception", e); lines is needed version of slf4j currently support a mix of arguments exceptions</technical_language>

Target:
public static QuotaModeType fromValue(String value) { try { return valueOf(value.toUpperCase()); } catch (IllegalArgumentException e) { log.error("The value '{}' isn't a valid quota mode.", value); log.error("Exception", e); return null; } }
Source:
<code>private void doInitialize(final RequestMonitor requestMonitor) { <START> fCommandControl = getServicesTracker().getService(IGDBControl.class); <END> requestMonitor.done(); }</code><technical_language>I register service IGDBMemory name</technical_language>

Target:
private void doInitialize(final RequestMonitor requestMonitor) { fCommandControl = getServicesTracker().getService(IGDBControl.class); getSession().addServiceEventListener(this, null); register( new String[] { IMemory.class.getName(), MIMemory.class.getName(), IGDBMemory.class.getName(), GDBMemory.class.getName(), }, new Hashtable<String, String>()); requestMonitor.done(); }
Source:
<code>private void deleteVolumeCommitToDB(VolumeList newVolumeList, String volume, String owner) throws IOException { <START> try (BatchOperation batch = metadataManager.getStore() <END> .initBatchOperation()) { String dbUserKey = metadataManager.getUserKey(owner); if (newVolumeList.getVolumeNamesList().size() == 0) { metadataManager.getUserTable().deleteWithBatch(batch, dbUserKey); } else { metadataManager.getUserTable().putWithBatch(batch, dbUserKey, newVolumeList); } metadataManager.getVolumeTable().deleteWithBatch(batch, metadataManager.getVolumeKey(volume)); metadataManager.getStore().commitBatchOperation(batch); } catch (IOException ex) { throw ex; } }</code><technical_language>Same. pass userKey start apply</technical_language>

Target:
private void deleteVolumeCommitToDB(VolumeList newVolumeList, String volume, String owner) throws IOException { try (BatchOperation batch = metadataManager.getStore() .initBatchOperation()) { String dbUserKey = metadataManager.getUserKey(owner); if (newVolumeList.getVolumeNamesList().size() == 0) { metadataManager.getUserTable().deleteWithBatch(batch, dbUserKey); } else { metadataManager.getUserTable().putWithBatch(batch, dbUserKey, newVolumeList); } metadataManager.getVolumeTable().deleteWithBatch(batch, metadataManager.getVolumeKey(volume)); metadataManager.getStore().commitBatchOperation(batch); } }
Source:
<code>public void handleData(ITmfEvent data) { <START> if (data != null && !(data instanceof ITmfLostEvent)) { <END> fNbRead++; } }</code><technical_language>want do this. a request a fixed number of events read, lost events counted. checkpoint indexer</technical_language>

Target:
public void handleData(ITmfEvent data) { if (data != null) { fNbRead++; } }
Source:
<code>public NanoWebSocketTestServer(int port) { <START> super(port); <END> connectionsList = new ArrayList<>(); }</code><technical_language>call this(null, port); instead, avoid initialise connectionsList in this constructor</technical_language>

Target:
public NanoWebSocketTestServer(int port){ this(null,port); }
Source:
<code>public void download(String url, String downloadPath) { <START> try { <END> URL downloadUrl = new URL(url); downloadUrl.openConnection(); InputStream reader = downloadUrl.openStream(); FileOutputStream writer = new FileOutputStream(downloadPath); int bufSize = 100000; byte[] buffer = new byte[bufSize]; int bytesRead = 0; while ((bytesRead = reader.read(buffer)) > 0) { writer.write(buffer, 0, bytesRead); buffer = new byte[bufSize]; } writer.close(); reader.close(); } catch (MalformedURLException e) { log.error(e); } catch (IOException e) { log.error(e); } }</code><technical_language>Please FileUtils commons-io</technical_language>

Target:
public boolean download(String url, String downloadPath) { InputStream in = null; try { in = new URL(url).openStream(); FileUtils.writeByteArrayToFile(new File(downloadPath), IOUtils.toByteArray(in)); return true; } catch (IOException e) { log.error(e); return false; } finally { IOUtils.closeQuietly(in); } }
Source:
<code>public ValidationResult isOperationAllowedOnDisk(VdcActionType actionType) { List<DiskContentType> allowedTypes = allowedCommandsOnTypes.get(actionType); if (allowedTypes == null) { throw new <START> IllegalArgumentException(); <END> } if (!allowedTypes.contains(disk.getContentType())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_CONTENT_TYPE_NOT_SUPPORTED_FOR_OPERATION, String.format("$diskContentType %s", disk.getContentType())); } return ValidationResult.VALID; }</code><technical_language>a message telling programmer action type used</technical_language>

Target:
public ValidationResult isOperationAllowedOnDisk(VdcActionType actionType) { List<DiskContentType> allowedTypes = allowedCommandsOnTypes.get(actionType); if (allowedTypes == null) { throw new IllegalArgumentException( String.format("Cannot validate operation on disk for action of type %s as it is not included in the allowed commands.", actionType)); } if (!allowedTypes.contains(disk.getContentType())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_CONTENT_TYPE_NOT_SUPPORTED_FOR_OPERATION, String.format("$diskContentType %s", disk.getContentType())); } return ValidationResult.VALID; }
Source:
<code>private void checkTokenExpiration(String tokenSignature, JWTClaimsSet payload, String tenantDomain) throws APISecurityException { long timestampSkew = OAuthServerConfiguration.getInstance().getTimeStampSkewInSeconds(); Date now = new Date(); Date exp = payload.getExpirationTime(); if (exp != null && !DateUtils.isAfter(exp, now, timestampSkew)) { if (isGatewayTokenCacheEnabled) { getGatewayTokenCache().remove(tokenSignature); getGatewayJWTTokenCache().remove(tokenSignature); getInvalidTokenCache().put(tokenSignature, tenantDomain); } <START> log.error("JWT token is expired"); <END> throw new APISecurityException(APISecurityConstants.API_AUTH_INVALID_CREDENTIALS, APISecurityConstants.API_AUTH_INVALID_CREDENTIALS_MESSAGE); } }</code><technical_language>log woth masked token give more cality</technical_language>

Target:
private void checkTokenExpiration(String tokenSignature, JWTClaimsSet payload, String tenantDomain) throws APISecurityException { long timestampSkew = OAuthServerConfiguration.getInstance().getTimeStampSkewInSeconds(); Date now = new Date(); Date exp = payload.getExpirationTime(); if (exp != null && !DateUtils.isAfter(exp, now, timestampSkew)) { if (isGatewayTokenCacheEnabled) { getGatewayTokenCache().remove(tokenSignature); getGatewayJWTTokenCache().remove(tokenSignature); getInvalidTokenCache().put(tokenSignature, tenantDomain); } log.error("JWT token is expired :" + GatewayUtils.getMaskedToken(tokenSignature)); throw new APISecurityException(APISecurityConstants.API_AUTH_INVALID_CREDENTIALS, APISecurityConstants.API_AUTH_INVALID_CREDENTIALS_MESSAGE); } }
Source:
<code>public long guessTotalNumberOfPages() { <START> final int kWeekdayPages = 40; <END> final int kSundayPages = 240; long result = 0; for (Block block : this) { LocalDate lastAppearance = block.getLastAppearance(); for (LocalDate day = block.getFirstAppearance(); !day.isAfter(lastAppearance); day = day.plusDays(1)) { for (Issue issue : block.getIssues()) { if (issue.isMatch(day)) { result += day.getDayOfWeek() != DateTimeConstants.SUNDAY ? kWeekdayPages : kSundayPages; } } } } return result; }</code><technical_language>mentioned above: do introduce unreadable variable names</technical_language>

Target:
public long guessTotalNumberOfPages() { final int weekdayPages = 40; final int sundayPages = 240; long result = 0; for (Block block : this) { LocalDate lastAppearance = block.getLastAppearance(); for (LocalDate day = block.getFirstAppearance(); !day.isAfter(lastAppearance); day = day.plusDays(1)) { for (Issue issue : block.getIssues()) { if (issue.isMatch(day)) { result += day.getDayOfWeek() != DateTimeConstants.SUNDAY ? weekdayPages : sundayPages; } } } } return result; }
Source:
<code>Point computeSizeInPixels (int wHint, int hHint, boolean changed) { Point size = super.computeSizeInPixels(wHint, hHint, changed); int width; if(OS.GTK3){ width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x; } else{ int x_thickness=OS.gtk_style_get_xthickness (OS.gtk_widget_get_style (handle)); <START> int LABEL_PAD=1; <END> int LABEL_SIDE_PAD=2; width = computeNativeSize (labelHandle, SWT.DEFAULT, SWT.DEFAULT, false).x+2*(LABEL_PAD+LABEL_SIDE_PAD+x_thickness); } size.x = Math.max (size.x, width); return size; }</code><technical_language>GTK constants, I suggest moving OS.java. Name GTK_LABEL_PAD</technical_language>

Target:
Point computeSizeInPixels (int wHint, int hHint, boolean changed) { Point size = super.computeSizeInPixels(wHint, hHint, changed); int width; if(OS.GTK3){ width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x; } else{ int x_thickness=OS.gtk_style_get_xthickness (OS.gtk_widget_get_style (handle)); int minimalSizeAroundLabel=2*(OS.GTK_FRAME_LABEL_PAD+OS.GTK_FRAME_LABEL_SIDE_PAD+x_thickness); width = computeNativeSize (labelHandle, SWT.DEFAULT, SWT.DEFAULT, false).x+minimalSizeAroundLabel; } size.x = Math.max (size.x, width); return size; }
Source:
<code>public Set<String> getFreeVariables() { Set<String> freeVars = new HashSet<>(); <START> freeVars.addAll(getDefinition().getFreeVariables()); <END> return freeVars; }</code><technical_language>instead of addAll(), return free vars definition. in VarDeclaration</technical_language>

Target:
public Set<String> getFreeVariables() { return getDefinition().getFreeVariables(); }
Source:
<code>public void update() throws Exception { DomainNameList domainNames = new DomainNameList(Lists.newArrayList("dName")); List<Network3GPP> networks = Lists.newArrayList(new Network3GPP("name", "123", "445")); List<NAI> naiList = Lists.newArrayList(new NAI("N/A")); Object id = repository.create(new NewServiceProvider("name", "descr", networks, domainNames, naiList)); List<Network3GPP> newNetworks = Lists.newArrayList(new Network3GPP("newName", "321", "555")); DomainNameList newDomainNames = new DomainNameList(Lists.newArrayList("newDomainName")); <START> List<NAI> newNAIList = Lists.newArrayList(new NAI("N/A")); <END> ServiceProvider newService = new ServiceProvider(new ID(id), "name", "newDescr", newNetworks, newDomainNames, newNAIList); repository.update(newService); ServiceProvider result = repository.findById(new ID(id)).get(); assertThat(result, deepEquals(newService)); }</code><technical_language>list is one, created</technical_language>

Target:
public void update() throws Exception { DomainNameList names = new DomainNameList(Lists.newArrayList("dName")); List<Network3GPP> networks = Lists.newArrayList(new Network3GPP("name", "123", "445")); List<RoamingConsortium> list = Lists.newArrayList(new RoamingConsortium("name", "0xAAFFAA")); List<NAI> naiList = Lists.newArrayList(new NAI("N/A")); Object id = repository.create(new NewServiceProvider("name", "descr", networks, names, list, naiList)); List<Network3GPP> newNetworks = Lists.newArrayList(new Network3GPP("newName", "321", "555")); DomainNameList newNames = new DomainNameList(Lists.newArrayList("newDomainName")); List<RoamingConsortium> newList = Lists.newArrayList(new RoamingConsortium("newName", "0xAAAAAA")); List<NAI> newNAIList = Lists.newArrayList(new NAI("EAP-SIM")); ServiceProvider newService = new ServiceProvider(new ID(id), "name", "newDescr", newNetworks, newNames, newList, newNAIList); repository.update(newService); ServiceProvider result = repository.findById(new ID(id)).get(); assertThat(result, deepEquals(newService)); }
Source:
<code>public boolean equals(final Object obj) { if (!(obj instanceof URIish)) return false; final URIish b = (URIish) obj; if (!eq(getScheme(), b.getScheme())) return false; if (!eq(getUser(), b.getUser())) return false; if (!eq(getPass(), b.getPass())) return false; if (!eq(getHost(), b.getHost())) return false; <START> if (!Objects.equals(port, b.port)) <END> return false; if (!eq(getPath(), b.getPath())) return false; return true; }</code><technical_language>Strange URIs unequal if port, created a string a "naked" colon</technical_language>

Target:
public boolean equals(final Object obj) { if (!(obj instanceof URIish)) return false; final URIish b = (URIish) obj; if (!eq(getScheme(), b.getScheme())) return false; if (!eq(getUser(), b.getUser())) return false; if (!eq(getPass(), b.getPass())) return false; if (!eq(getHost(), b.getHost())) return false; if (getPort() != b.getPort()) return false; if (!eq(getPath(), b.getPath())) return false; return true; }
Source:
<code>protected void innerClose() { executor.executeOutgoing((new Runnable() { @Override public void run() { serverSideConnection.close(null, null); } @Override public String toString() { return "Client Closed EOF. " + MockedClientConnection.this; } })); executor.shutdownIncoming(); <START> System.out.println(">>>> >>>>>"); <END> }</code><technical_language>Leftover</technical_language>

Target:
protected void innerClose() { executor.executeOutgoing((new Runnable() { @Override public void run() { serverSideConnection.close(null, null); } @Override public String toString() { return "Client Closed EOF. " + MockedClientConnection.this; } })); executor.shutdownIncoming(); }
Source:
<code>public static IBinding resolveUnknown(ICPPUnknownBinding unknown, InstantiationContext context) throws DOMException { if (unknown instanceof ICPPDeferredClassInstance) { return resolveDeferredClassInstance((ICPPDeferredClassInstance) unknown, context); } if (unknown instanceof ICPPUnknownMember) { return resolveUnknownMember((ICPPUnknownMember) unknown, context); } if (unknown instanceof ICPPTemplateParameter && unknown instanceof IType) { IType type= resolveTemplateTypeParameter((ICPPTemplateParameter) <START> unknown, context.withoutContextTypeSpecialization()); <END> if (type instanceof IBinding) return (IBinding) type; } if (unknown instanceof TypeOfDependentExpression) { IType type= instantiateType((IType) unknown, context); if (type instanceof IBinding) return (IBinding) type; } return unknown; }</code><technical_language>resolveTemplateTypeParameter() contextTypeSpecialization, pass in 'context' unchanged</technical_language>

Target:
public static IBinding resolveUnknown(ICPPUnknownBinding unknown, InstantiationContext context) throws DOMException { if (unknown instanceof ICPPDeferredClassInstance) { return resolveDeferredClassInstance((ICPPDeferredClassInstance) unknown, context); } if (unknown instanceof ICPPUnknownMember) { return resolveUnknownMember((ICPPUnknownMember) unknown, context); } if (unknown instanceof ICPPTemplateParameter && unknown instanceof IType) { IType type= resolveTemplateTypeParameter((ICPPTemplateParameter) unknown, context); if (type instanceof IBinding) return (IBinding) type; } if (unknown instanceof TypeOfDependentExpression) { IType type= instantiateType((IType) unknown, context); if (type instanceof IBinding) return (IBinding) type; } return unknown; }
Source:
<code>public void testCreateTableWithDefaultExpressionLiteral() { CreateTableAnalyzedStatement analysis = e.analyze( "create table foo (name text default 'bar')"); <START> Map<String, Object> mappingProperties = analysis.mappingProperties(); <END> Map<String, Object> aMapping = (Map<String, Object>) mappingProperties.get("name"); assertThat(aMapping.get("default_expr"), is("'bar'")); }</code><technical_language>mapToSortedString in other tests? tests a bit more readable</technical_language>

Target:
public void testCreateTableWithDefaultExpressionLiteral() { CreateTableAnalyzedStatement analysis = e.analyze( "create table foo (name text default 'bar')"); Map<String, Object> mappingProperties = analysis.mappingProperties(); assertThat(mapToSortedString(mappingProperties), is("name={default_expr='bar', position=1, type=keyword}")); }
Source:
<code>static void checkColumnName(String columnName) { <START> checkNotEmptyOrBlank(columnName); <END> }</code><technical_language>Entity column name empty blank</technical_language>

Target:
static void checkColumnName(String columnName) { checkNotEmptyOrBlank(columnName, "Entity column name must not be empty or blank."); }
Source:
<code>public void requestResetPasswordWithPhone() throws Exception { when(service.createTimeLimitedToken()).thenReturn("ABC"); when(mockAccountDao.getAccount(ACCOUNT_ID_WITH_PHONE)).thenReturn(mockAccount); when(mockStudyService.getStudy(TEST_STUDY)).thenReturn(study); when(mockAccount.getPhone()).thenReturn(TestConstants.PHONE); when(mockAccount.getPhoneVerified()).thenReturn(Boolean.TRUE); when(mockAccount.getStudyIdentifier()).thenReturn(TEST_STUDY); service.requestResetPassword(study, ACCOUNT_ID_WITH_PHONE); verify(mockCacheProvider).setString(eq("ABC:phone:api"), stringCaptor.capture(), eq(60*60*2)); <START> Phone captured = BridgeObjectMapper.get().readValue(stringCaptor.getValue(), Phone.class); <END> assertEquals(TestConstants.PHONE, captured); verify(mockNotificationsService).sendSMSMessage(eq(TEST_STUDY), eq(TestConstants.PHONE), stringCaptor.capture()); String message = stringCaptor.getValue(); assertTrue(message.contains("Reset ShortName password: ")); assertTrue(message.contains("/mobile/resetPassword.html?study=api&sptoken=ABC")); }</code><technical_language>stringCaptor is here, validate written mockCacheProvider</technical_language>

Target:
public void requestResetPasswordWithPhone() throws Exception { when(service.createTimeLimitedToken()).thenReturn("ABC"); when(mockAccountDao.getAccount(ACCOUNT_ID_WITH_PHONE)).thenReturn(mockAccount); when(mockStudyService.getStudy(TEST_STUDY)).thenReturn(study); when(mockAccount.getPhone()).thenReturn(TestConstants.PHONE); when(mockAccount.getPhoneVerified()).thenReturn(Boolean.TRUE); when(mockAccount.getStudyIdentifier()).thenReturn(TEST_STUDY); service.requestResetPassword(study, ACCOUNT_ID_WITH_PHONE); verify(mockCacheProvider).setString(eq("ABC:phone:api"), stringCaptor.capture(), eq(60*60*2)); verify(mockNotificationsService).sendSMSMessage(eq(TEST_STUDY), eq(TestConstants.PHONE), secondStringCaptor.capture()); Phone captured = BridgeObjectMapper.get().readValue(stringCaptor.getValue(), Phone.class); assertEquals(TestConstants.PHONE, captured); String message = secondStringCaptor.getValue(); assertTrue(message.contains("Reset ShortName password: ")); assertTrue(message.contains("/mobile/resetPassword.html?study=api&sptoken=ABC")); }
Source:
<code>public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .peek( dependency -> { if (!ImmutableSet.of(JAR, AAR).contains(dependency.getPackaging())) { throw new IllegalStateException("Dependency not a valid prebuilt: " + dependency); } }) .sorted( (o1, o2) -> ComparisonChain.start() .compare(o1.getPackaging(), o2.getPackaging()) .compare(o1.getTargetName(), o2.getTargetName()) .result()) .map( dependency -> { Prebuilt rule = new Prebuilt() .mavenCoords(dependency.getMavenCoords()) .sha256(DependencyUtils.sha256(dependency.getRealDependencyFile())); if (dependency.hasSourceFile()) { rule.sourcesMavenCoords(dependency.getSourceMavenCoords()) .sourcesSha256(DependencyUtils.sha256(dependency.getRealSourceFile())); } rule.name(dependency.getTargetName()); <START> return ImmutableList.of(rule); <END> }) .flatMap(Collection::stream) .collect(Collectors.toList()); }</code><technical_language>is point of creating a list element, flatten of in order a single list rules, instead of returning rule removing line 53</technical_language>

Target:
public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .peek( dependency -> { if (!ImmutableSet.of(JAR, AAR).contains(dependency.getPackaging())) { throw new IllegalStateException("Dependency not a valid prebuilt: " + dependency); } }) .sorted(ExternalDependency.compareByName) .map( dependency -> { Prebuilt rule = new Prebuilt() .mavenCoords(dependency.getMavenCoords()) .enableJetifier(dependency.enableJetifier()) .sha256(DependencyUtils.shaSum256(dependency.getRealDependencyFile())); if (dependency.hasSourceFile()) { rule.sourcesSha256(DependencyUtils.shaSum256(dependency.getRealSourceFile())); } rule.name(dependency.getTargetName()); rule.ruleType(RuleType.PREBUILT.getBuckName()); return rule; }) .collect(Collectors.toList()); }
Source:
<code>public Float getRetentionTime() { <START> for (MzMLCVParam param : cvParams) { <END> String accession = param.getAccession(); String unitAccession = param.getUnitAccession(); String value = param.getValue(); if ((accession == null) || (value == null)) continue; if (accession.equals(MzMLCV.cvScanStartTime)) { try { float retentionTime; if ((unitAccession == null) || (unitAccession.equals(MzMLCV.cvUnitsMin1)) || unitAccession.equals(MzMLCV.cvUnitsMin2)) { retentionTime = Float.parseFloat(value) * 60f; } else { retentionTime = Float.parseFloat(value); } return retentionTime; } catch (Exception e) { e.printStackTrace(); } } } return null; }</code><technical_language>save retention time a variable is parsed</technical_language>

Target:
public Float getRetentionTime() { float retentionTime = 0; if (retentionTime == 0) { for (MzMLCVParam param : cvParams) { String accession = param.getAccession(); String unitAccession = param.getUnitAccession(); String value = param.getValue(); if ((accession == null) || (value == null)) continue; if (accession.equals(MzMLCV.cvScanStartTime)) { try { if ((unitAccession == null) || (unitAccession.equals(MzMLCV.cvUnitsMin1)) || unitAccession.equals(MzMLCV.cvUnitsMin2)) { retentionTime = Float.parseFloat(value) * 60f; } else { retentionTime = Float.parseFloat(value); } return retentionTime; } catch (Exception e) { e.printStackTrace(); } } } return null; } return retentionTime; }
Source:
<code>public static ObjectNode getElementsById(Collection<String> elementIds, Project project, ProgressStatus progressStatus) throws IOException, ServerException, URISyntaxException { if (elementIds == null || elementIds.isEmpty()) { return null; } final ObjectNode requests = JacksonUtils.getObjectMapper().createObjectNode(); ArrayNode idsArrayNode = requests.putArray("elements"); for (String id : elementIds) { ObjectNode element = JacksonUtils.getObjectMapper().createObjectNode(); element.put(MDKConstants.SYSML_ID_KEY, id); idsArrayNode.add(element); } URIBuilder requestUri = MMSUtils.getServiceProjectsRefsElementsUri(project); if (requestUri == null) { return null; } <START> Utils.guilog("[INFO] Searching for " + elementIds.size() + " elements from server..."); <END> if (progressStatus != null) { return MMSUtils.sendCancellableMMSRequest(MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET, requestUri, requests), progressStatus); } return MMSUtils.sendMMSRequest(MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET, requestUri, requests)); }</code><technical_language>Single period for consistency</technical_language>

Target:
public static ObjectNode getElementsById(Collection<String> elementIds, Project project, ProgressStatus progressStatus) throws IOException, ServerException, URISyntaxException { if (elementIds == null || elementIds.isEmpty()) { return null; } final ObjectNode requests = JacksonUtils.getObjectMapper().createObjectNode(); ArrayNode idsArrayNode = requests.putArray("elements"); for (String id : elementIds) { ObjectNode element = JacksonUtils.getObjectMapper().createObjectNode(); element.put(MDKConstants.SYSML_ID_KEY, id); idsArrayNode.add(element); } URIBuilder requestUri = MMSUtils.getServiceProjectsRefsElementsUri(project); if (requestUri == null) { return null; } Utils.guilog("[INFO] Searching for " + elementIds.size() + " elements from server."); if (progressStatus != null) { return MMSUtils.sendCancellableMMSRequest(MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET, requestUri, requests), progressStatus); } return MMSUtils.sendMMSRequest(MMSUtils.buildRequest(MMSUtils.HttpRequestType.GET, requestUri, requests)); }
Source:
<code>void setUp() { underTest = new AttemptAuditEventResultToGrpcAttemptAuditEventResultConverter(new LinkedHashMap<>()); mockAuditEventDataUtilizer = mock(AuditEventDataUtilizer.class); <START> } <END></code><technical_language>I prefer declarative @Mock taste</technical_language>

Target:
void setUp() { builderProvider = mock(AttemptAuditEventResultBuilderProvider.class); mockBuilder = mock(AuditProto.AttemptAuditEventResult.Builder.class); result = mock(AuditProto.AttemptAuditEventResult.class); when(mockBuilder.build()).thenReturn(result); when(builderProvider.getNewAttemptAuditEventResultBuilder()).thenReturn(mockBuilder); when(mockBuilder.setId(any())).thenReturn(mockBuilder); when(mockBuilder.setResultCode(any())).thenReturn(mockBuilder); underTest = new AttemptAuditEventResultToGrpcAttemptAuditEventResultConverter(new LinkedHashMap<>(), builderProvider); mockAttemptAuditEventResultBuilderUpdater = mock(AttemptAuditEventResultBuilderUpdater.class); }
Source:
<code>public void update(RuleBaseElementId name, String newCode) throws RuleBaseException { RuleBaseElement newBean = new RuleBaseElement(name, newCode); Map<String, String> metaData = newBean.toMetadata(); <START> RuleBaseConfiguration conf = new RuleBaseConfiguration(metaData, newBean); <END> try { rulePersistence.persist(conf); } catch (PersistenceException e) { throw new RuleBaseException(e); } builder.reloadPackage(name.getPackageName()); }</code><technical_language>Constructor pass RuleBaseElement</technical_language>

Target:
public void update(RuleBaseElementId name, String newCode) throws RuleBaseException { RuleBaseElement newBean = new RuleBaseElement(name, newCode); RuleBaseConfiguration conf = new RuleBaseConfiguration(newBean); try { rulePersistence.persist(conf); } catch (PersistenceException e) { throw new RuleBaseException(e); } builder.reloadPackage(name.getPackageName()); }
Source:
<code>public boolean isType(TileEntity tile, EnumFacing dir) { if (tile instanceof IGridHost && tile.hasCapability(LPStorageMonitorableAccessor.STORAGE_MONITORABLE_ACCESSOR_CAPABILITY, dir)) { <START> IGridNode tempNode = ((IGridHost) tile).getGridNode(AEPartLocation.fromFacing(dir)); END> if (tempNode == null) return false; return true; } return false; }</code><technical_language>replace return ((IGridHost) tile).getGridNode(AEPartLocation.fromFacing(dir)) != null;</technical_language>

Target:
public boolean isType(TileEntity tile, EnumFacing dir) { if (tile instanceof IGridHost && tile.hasCapability(LPStorageMonitorableAccessor.STORAGE_MONITORABLE_ACCESSOR_CAPABILITY, dir)) { return ((IGridHost) tile).getGridNode(AEPartLocation.fromFacing(dir)) != null; } return false; }
Source:
<code><START> private List<String> objIdsAsStrings(Collection<ObjectId> objIds) { <END> List<String> result = new ArrayList<>(objIds.size()); for (ObjectId oid: objIds) { result.add(oid.name()); } return result; }</code><technical_language>Likewise: this static? said, I simpler do inline call site: objIds.stream().map(ObjectId::name).collect(toList()); a custom matcher, hasObjectIds("4624442d68ee402a94364191085b77137618633e", "f900c8326a43303685c46b279b9f70411bff1a4b")</technical_language>

Target:
private static List<String> objIdsAsStrings(Collection<ObjectId> objIds) { return objIds.stream().map(ObjectId::name).collect(Collectors.toList()); }
Source:
<code>public String toString() { return Objects.toStringHelper(this) <START> .add("tags", tags) <END> .add("id", symbolicName) .add("version", version) .add("deprecated", deprecated) .toString(); }</code><technical_language>Unsure this addition is useful</technical_language>

Target:
public String toString() { return Objects.toStringHelper(this) .add("id", symbolicName) .add("version", version) .add("deprecated", deprecated) .toString(); }
Source:
<code>public final B filterByIds(Collection<String> ids) { <START> this.ids = ImmutableSet.copyOf(ids); <END> return getSelf(); }</code><technical_language>putting this filter optionsBuilder immediately (just do for other enum-based filters)</technical_language>

Target:
public final B filterByIds(Collection<String> ids) { for (final String id : ids) { if (Strings.isNullOrEmpty(id)) { throw new BadRequestException("ID filter cannot contain empty values"); } } addOption(OptionKey.COMPONENT_IDS, ImmutableSet.copyOf(ids)); return getSelf(); }
Source:
<code>ProjectionRepository<I, P, S> mockRepository() { TestProjectionRepository mockedRepo = mock(TestProjectionRepository.class); when(mockedRepo.lifecycleOf(any())).thenCallRealMethod(); <START> when(mockedRepo.getEntityStateType()).thenReturn(TypeUrl.of(Any.class)); <END> return mockedRepo; }</code><technical_language>ask for Class<S> entityStateClass in parameters return a real here</technical_language>

Target:
ProjectionRepository<I, P, S> mockRepository() { TestProjectionRepository mockedRepo = mock(TestProjectionRepository.class); when(mockedRepo.lifecycleOf(any())).thenCallRealMethod(); return mockedRepo; }
Source:
<code>private boolean hasAllele(final Allele allele, final boolean ignoreRefState, final boolean considerRefAllele) { if ( (considerRefAllele && allele == REF) || allele == ALT ) return true; <START> final List<Allele> allelesToConsider = considerRefAllele ? getAlleles() : getAlternateAlleles(); <END> for ( int i = 0; i < allelesToConsider.size(); i++) { if ( allelesToConsider.get(i).equals(allele, ignoreRefState) ) return true; } return false; }</code><technical_language>This block replaced a call allelesToConsider.contains() instead fast gross</technical_language>

Target:
private boolean hasAllele(final Allele allele, final boolean ignoreRefState, final boolean considerRefAllele) { if ( (considerRefAllele && allele == REF) || allele == ALT ) return true; final List<Allele> allelesToConsider = considerRefAllele ? getAlleles() : getAlternateAlleles(); for (int i = 0, allelesToConsiderSize = allelesToConsider.size(); i < allelesToConsiderSize; i++) { Allele anAllelesToConsider = allelesToConsider.get(i); if (anAllelesToConsider.equals(allele, ignoreRefState)) return true; } return false; }
Source:
<code>public static Optional<File> savePersonnel(JFrame frame, Campaign campaign, FileType format) { String fileName = String.format( "%s%s_ExportedPersonnel." + format.getRecommendedExtension(), campaign.getName(), <START> campaign.getShortDateAsString() ); <END> return GUI.fileDialogSave( frame, "Save Personnel", new File(".", fileName), format ); }</code><technical_language>me, mixing String.format() concatenation IMHO code crystal-clear :-) String fileName = String.format( "%s%s_ExportedPersonnel.%s", //$NON-NLS-1$ campaign.getName(), campaign.getShortDateAsString(), format.getRecommendedExtension() ); String fileName = campaign.getName() + campaign.getShortDateAsString() + "_ExportedPersonnel." //$NON-NLS-1$ + format.getRecommendedExtension();</technical_language>

Target:
public static Optional<File> savePersonnel(JFrame frame, Campaign campaign, FileType format) { String fileName = campaign.getName() + campaign.getShortDateAsString() + "_ExportedPersonnel." + format.getRecommendedExtension(); return GUI.fileDialogSave( frame, "Save Personnel", new File(".", fileName), format ); }
Source:
<code>public void testContributions() throws Exception { deployContrib("org.nuxeo.runtime.test.tests", "MyComp1.xml"); deployContrib("org.nuxeo.runtime.test.tests", "MyComp2.xml"); applyInlineDeployments(); try { RuntimeService runtime = Framework.getRuntime(); ComponentManager mgr = runtime.getComponentManager(); assertTrue(mgr.size() > 0); ComponentInstance co = runtime.getComponentInstance("service:my.comp1"); assertNotNull(co); assertEquals(co.getName(), new ComponentName("service:my.comp1")); co = runtime.getComponentInstance("service:my.comp2"); assertNotNull(co); assertEquals(co.getName(), new ComponentName("service:my.comp2")); mgr.unregister(new ComponentName("service:my.comp2")); mgr.unstash(); co = runtime.getComponentInstance("service:my.comp2"); assertNull(co); co = runtime.getComponentInstance("service:my.comp1"); <START> assertNotNull(co); <END> } finally { undeployContrib("org.nuxeo.runtime.test.tests", "MyComp2.xml"); undeployContrib("org.nuxeo.runtime.test.tests", "MyComp1.xml"); removeInlineDeployments(); } }</code><technical_language>wrong format + changed unnecessary lines</technical_language>

Target:
public void testContributions() throws Exception { pushInlineDeployments("org.nuxeo.runtime.test.tests:MyComp1.xml", "org.nuxeo.runtime.test.tests:MyComp2.xml"); try { RuntimeService runtime = Framework.getRuntime(); ComponentManager mgr = runtime.getComponentManager(); assertTrue(mgr.size() > 0); ComponentInstance co = runtime.getComponentInstance("service:my.comp1"); assertNotNull(co); assertEquals(co.getName(), new ComponentName("service:my.comp1")); co = runtime.getComponentInstance("service:my.comp2"); assertNotNull(co); assertEquals(co.getName(), new ComponentName("service:my.comp2")); mgr.unregister(new ComponentName("service:my.comp2")); mgr.unstash(); co = runtime.getComponentInstance("service:my.comp2"); assertNull(co); co = runtime.getComponentInstance("service:my.comp1"); assertNotNull(co); } finally { undeployContrib("org.nuxeo.runtime.test.tests", "MyComp2.xml"); undeployContrib("org.nuxeo.runtime.test.tests", "MyComp1.xml"); removeInlineDeployments(); } }
Source:
<code>String generate() { Collections.sort(this, (o1, o2) -> o1.model.getElement().getSimpleName().toString().compareTo( o2.model.getElement().getSimpleName().toString())); int index = 0; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < size(); i++) { ModelProcessing processing = get(i); Map<String, Object> vars = new HashMap<>(); vars.putAll(TypeNameTranslator.vars(processing.generator.name)); if (processing.generator.incremental) { vars.put("incrementalIndex", index++); vars.put("incrementalSize", size()); vars.put("session", session); } try { String part = processing.generator.template.render(processing.model, vars); if (part != null) { buffer.append(part); } } catch (GenException e) { throw e; } catch (Exception e) { <START> e.printStackTrace(); <END> throw new GenException(processing.model.getElement(), e.getMessage()); } } return buffer.toString(); }</code><technical_language>adding a constructor GenException a parameter for</technical_language>

Target:
String generate() { Collections.sort(this, (o1, o2) -> o1.model.getElement().getSimpleName().toString().compareTo( o2.model.getElement().getSimpleName().toString())); int index = 0; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < size(); i++) { ModelProcessing processing = get(i); Map<String, Object> vars = new HashMap<>(); vars.putAll(TypeNameTranslator.vars(processing.generator.name)); if (processing.generator.incremental) { vars.put("incrementalIndex", index++); vars.put("incrementalSize", size()); vars.put("session", session); } try { String part = processing.generator.template.render(processing.model, vars); if (part != null) { buffer.append(part); } } catch (GenException e) { throw e; } catch (Exception e) { throw new GenException(processing.model.getElement(), e.getMessage()); } } return buffer.toString(); }
Source:
<code>public void cleanupSnapshotsByVolume(Long volumeId) { List<SnapshotVO> volSnapShots = _snapshotDao.listByVolumeId(volumeId); for(SnapshotVO snapshot: volSnapShots) { SnapshotInfo info = snapshotFactory.getSnapshot(snapshot.getId(), DataStoreRole.Primary); try { snapshotSrv.deleteSnapshot(info); } catch(CloudRuntimeException e) { <START> String msg = "Cleanup of Snapshot with uuid " + snapshot.getUuid() + " in primary storage is failed. Ignoring"; <END> s_logger.warn(msg); } } }</code><technical_language>This local variable is once. Please consider collapsing lint 1122. Also, please add message exception message provide greater detail for debugging efforts</technical_language>

Target:
public void cleanupSnapshotsByVolume(Long volumeId) { List<SnapshotInfo> infos = snapshotFactory.getSnapshots(volumeId, DataStoreRole.Primary); for(SnapshotInfo info: infos) { try { if(info != null) { snapshotSrv.deleteSnapshot(info); } } catch(CloudRuntimeException e) { String msg = "Cleanup of Snapshot with uuid " + info.getUuid() + " in primary storage is failed. Ignoring"; s_logger.warn(msg); } } }
Source:
<code>public boolean isInitiator() { <START> return isActive(); <END> }</code><technical_language>Is right delegate isActive() here? a difference in practice, confusing. returning true better</technical_language>

Target:
public boolean isInitiator() { return true; }
Source:
<code>public Response remove() { get(); return performAction(VdcActionType.RemoveVmTemplate, new <START> VmTemplateParametersBase(asGuid(id))); <END> }</code><technical_language>Consider "guid"</technical_language>

Target:
public Response remove() { get(); return performAction(VdcActionType.RemoveVmTemplate, new VmTemplateParametersBase(guid)); }
Source:
<code>public Reply getReply(Long replyId) { Reply result = null; <START> for (Reply reply : replies) { <END> if (reply.id == replyId) { result = reply; return result; } } return result; }</code><technical_language>Please a hash map for this</technical_language>

Target:
public Reply getReply(Long replyId) { return replyStore.get(replyId); }
Source:
<code>private ByteBuf decodeLine(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { final int eol = findEndOfLine(buffer); if (!discarding) { if (eol >= 0) { final int length = eol - buffer.readerIndex(); final int delimLength = buffer.getByte(eol) == '\r'? 2 : 1; if (length > V1_MAX_LENGTH) { buffer.readerIndex(eol + delimLength); failOverLimit(ctx, length); return null; } ByteBuf frame = buffer.readSlice(length); buffer.skipBytes(delimLength); return frame; } else { final int length = buffer.readableBytes(); if (length > V1_MAX_LENGTH) { discardedBytes = length; buffer.skipBytes(length); discarding = true; failOverLimit(ctx, "over " + discardedBytes); } return null; } } else { if (eol >= 0) { final int delimLength = buffer.getByte(eol) == '\r' ? 2 : 1; buffer.readerIndex(eol + delimLength); discardedBytes = 0; discarding = false; } else { discardedBytes += buffer.readableBytes(); <START> buffer.skipBytes(discardedBytes); <END> } return null; } }</code><technical_language>I need. change this buffer.skipBytes(buffer.readableBytes()) produce IndexOutOfBoundsException</technical_language>

Target:
private ByteBuf decodeLine(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { if (headerExtractor == null) { headerExtractor = new LineHeaderExtractor(V1_MAX_LENGTH); } return headerExtractor.extract(ctx, buffer); }
Source:
<code>public void inflatedisbusmentDate() { mfDatePicker = MFDatePicker.newInsance(this); tvDisbursementonDate.setText(MFDatePicker.getDatePickedAsString()); <START> tvDisbursementonDate.setOnClickListener(new View.OnClickListener() { <END> @Override public void onClick(View view) { isdisbursementDate = true; mfDatePicker.show(getActivity().getSupportFragmentManager(), FragmentConstants .DFRAG_DATE_PICKER); } }); }</code><technical_language>ButterKnife @onClick Annotation instead of implementing OnClickListener</technical_language>

Target:
public void inflatedisbusmentDate() { mfDatePicker = MFDatePicker.newInsance(this); tvDisbursementonDate.setText(MFDatePicker.getDatePickedAsString()); }
Source:
<code>public void run(TableReference tableRef, Set<Cell> cells) { <START> follower.run(txManager, tableRef, cells, Transaction.TransactionType.HARD_DELETE); <END> }</code><technical_language>background this transaction type</technical_language>

Target:
public void run(TableReference tableRef, Set<Cell> cells) { followers.forEach(flwr -> flwr.run(txManager, tableRef, cells, Transaction.TransactionType.HARD_DELETE)); }
Source:
<code>private static String unixNormalizeObjectName(final String objectName) { final String path; if (objectName.startsWith("/")) { path = objectName.substring(1); } else if (objectName.startsWith("./")) { path = objectName.substring(2); } else if (objectName.startsWith("../")) { path = objectName.substring(3); } else { path = objectName; <START> } <END> return path; }</code><technical_language>this wrapped in some sort of a loop, breaks path == objectName? thinking of ../../somethingSomething case</technical_language>

Target:
protected static String unixNormalizeObjectName(final String objectName) { final String path; if (objectName.startsWith("/")) { path = objectName.substring(1); } else if (objectName.startsWith("./")) { path = objectName.substring(2); } else if (objectName.startsWith("../")) { path = removePrefixRecursively(objectName, "../"); } else { path = objectName; } return path; }
Source:
<code>public void shouldThrowException() throws Exception { <START> expectedException.expect(FilterFactory.FilterNotCreatedException.class); <END> CategoryFilterFactory categoryFilterFactory = new CategoryFilterFactoryStub(); Filter filter = categoryFilterFactory.createFilter("NonExistentFilter"); assertThat(filter, is((Filter) null)); }</code><technical_language>call this right line expect throw exception, code line</technical_language>

Target:
public void shouldThrowException() throws Exception { FilterFactoryParams params = new FilterFactoryParams( "NonExistentFilter"); expectedException.expect(FilterFactory.FilterNotCreatedException.class); categoryFilterFactory.createFilter(params); }
Source:
<code>protected boolean canDoAction() { if <START> (getParameters().getPubKeys().size() <END> == 0 || getParameters().getId() == null) { return false; } return super.canDoAction(); }</code><technical_language>isEmpty</technical_language>

Target:
protected boolean canDoAction() { if (getParameters().getPubKeys().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_NO_PUB_KEYS_PASSED); } if (getParameters().getId() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); } return super.canDoAction(); }