auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public <T> T serviceProxy(String name, Class<? super T> svcItf, long timeout) { A.notNullOrEmpty(name, "name"); A.notNull(svcItf, "svcItf"); <START> Collection<UUID> nodeIds = grp.nodeIds(); <END> if (nodeIds != null && nodeIds.isEmpty()) throw new ClientException("Cluster group is empty."); return (T)Proxy.newProxyInstance(svcItf.getClassLoader(), new Class[] {svcItf}, new ServiceInvocationHandler<>(name, timeout, nodeIds)); }</code><technical_language>This locks resulting proxy cluster group state moment. this is right. pass cluster group proxy instead call nodeIds invocation</technical_language>

Target:
@Override public <T> T serviceProxy(String name, Class<? super T> svcItf, long timeout) { A.notNullOrEmpty(name, "name"); A.notNull(svcItf, "svcItf"); return (T)Proxy.newProxyInstance(svcItf.getClassLoader(), new Class[] {svcItf}, new ServiceInvocationHandler<>(name, timeout, grp)); }
Source:
<code>public void insert(List<Sample> samples) { if (!m_ringBuffer.tryPublishEvent(TRANSLATOR, samples)) { String uniqueResourceIds = samples.stream() <START> .map(s -> s.getResource().getId()) <END> .distinct() .collect(Collectors.joining(", ")); RATE_LIMITED_LOGGER.error("The ring buffer is full. samples associated with resource ids will be dropped.", samples.size(), uniqueResourceIds); m_droppedSamples.mark(samples.size()); return; } m_numEntriesOnRingBuffer.incrementAndGet(); }</code><technical_language>This stream() call is called failure enqueue ring buffer. ratelimitedlogger docs, if wrap in object toString() returned value, call avoided ratelimitedlogger decides print message. save a lot of overhead ring buffer is full</technical_language>

Target:
public void insert(List<Sample> samples) { pushToRingBuffer(samples, TRANSLATOR); }
Source:
<code>@Test public void testExhaustionClosesSourceIterator() { <START> iterator.setCallback(new Callback() <END> { @Override public void call() { } }); Context context = new Context() ; ExecutionContext ec = new ExecutionContext(context, (Graph) null, (DatasetGraph) null, (OpExecutorFactory) null); QueryIterSort qis = new QueryIterSort(iterator, comparator, ec); while (qis.hasNext()) qis.next(); assertTrue("source iterator should have been closed", iterator.isClosed()); }</code><technical_language>This written iterator.setCallback(()->{});</technical_language>

Target:
public void testExhaustionClosesSourceIterator() { iterator.setCallback(() -> {}); Context context = new Context() ; ExecutionContext ec = new ExecutionContext(context, (Graph) null, (DatasetGraph) null, (OpExecutorFactory) null); QueryIterSort qis = new QueryIterSort(iterator, comparator, ec); while (qis.hasNext()) qis.next(); assertTrue("source iterator should have been closed", iterator.isClosed()); }
Source:
<code>public void persistState(String checkpointId) { if (!isTopologyStateful) { throw new RuntimeException("Could not save a non-stateful topology's state"); } if (bolt instanceof IStatefulComponent) { ((IStatefulComponent) bolt).preSave(checkpointId); } else { <START> LOG.info("Trying to checkpoint a non stateful component. Send empty state"); <END> } collector.sendOutState(instanceState, checkpointId); }</code><technical_language>Do need LOG.info(...) here</technical_language>

Target:
public void persistState(String checkpointId) { LOG.info("Persisting state for checkpoint: " + checkpointId); if (!isTopologyStateful) { throw new RuntimeException("Could not save a non-stateful topology's state"); } if (bolt instanceof IStatefulComponent) { ((IStatefulComponent) bolt).preSave(checkpointId); } collector.sendOutState(instanceState, checkpointId); }
Source:
<code>private void reportClusterError() { <START> log.error("AddVdsCommand: No default or valid cluster was found, host registration failed."); <END> AuditLogableBase logableBase = new AuditLogableBase(); AuditLogDirector.log(logableBase, AuditLogType.HOST_FAILED_REGISTRATION_INVALID_CLUSTER); }</code><technical_language>need for 'AddVdsCommand' in error message: 1. this is right class command name 2. class name is printed part of slf4j configuration</technical_language>

Target:
private void reportClusterError() { log.error("No default or valid cluster was found, host registration failed."); AuditLogableBase logableBase = new AuditLogableBase(); logableBase.setVdsId(getParameters().getVdsId()); AuditLogDirector.log(logableBase, AuditLogType.HOST_REGISTRATION_FAILED_INVALID_CLUSTER); }
Source:
<code>private void resetPlot(ExtSed sed, boolean fixed, boolean dataMayChange) { PlaneAspect existingAspect = null; if (display != null) { display.removeAll(); remove(display); <START> if (this.preferences.getSedPreferences(currentSed) != null) { <END> this.preferences.getSedPreferences(currentSed).getPlotPreferences().setAspect(display.getAspect()); existingAspect = this.preferences.getSedPreferences(currentSed).getPlotPreferences().getAspect(); if (existingAspect == null) existingAspect = display.getAspect(); } else { existingAspect = display.getAspect(); } } if (sed == null) { sed = sedManager.getSelected(); } this.currentSed = sed; boolean cached = !dataMayChange; display = createPlotComponent(currentSed, cached); if (fixed) { if (this.preferences.getSedPreferences(currentSed) != null) { existingAspect = this.preferences.getSedPreferences(currentSed).getPlotPreferences().getAspect(); display.setAspect(existingAspect); } else { display.setAspect(existingAspect); } } add(display, BorderLayout.CENTER); display.revalidate(); display.repaint(); }</code><technical_language>I need this anymore, calling getPlotPreferences() ensure current plotpreferences is null, call getPlotPreferences().setAspect(display.getAspect()); display is null? save existing aspect in current SED's plot preferences time reset plot is called</technical_language>

Target:
private void resetPlot(ExtSed sed, boolean fixed, boolean dataMayChange) { setupForPlotDisplayChange(); if (sed == null) { sed = sedManager.getSelected(); } this.currentSed = sed; boolean cached = !dataMayChange; display = createPlotComponent(currentSed, cached); if (fixed) { PlaneAspect existingAspect = this.getPlotPreferences().getAspect(); display.setAspect(existingAspect); } updatePlotDisplay(); }
Source:
<code>public String getQueryString() { String jsonQueryString = null; try { jsonQueryString = getJSONParameters().toString(4).replace("\\/", "/"); } catch (JSONException e) { <START> e.printStackTrace(); <END> } return jsonQueryString; }</code><technical_language>a logger please</technical_language>

Target:
public String getQueryString() { String jsonQueryString = null; try { jsonQueryString = getJSONParameters().toString(4).replace("\\/", "/"); } catch (JSONException e) { log.error("Error parsing query string.", e); } return jsonQueryString; }
Source:
<code>public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { final Set<EObject> detachedObjects = getChangedEObjectsAndChildren(Iterables.filter(notifications, IS_DETACHMENT), null, false); <START> Iterator<EObject> iterator = detachedObjects.iterator(); <END> while (iterator.hasNext()) { EObject detachedEObject = iterator.next(); if (detachedEObject.eContainer() != null) { iterator.remove(); } } if (detachedObjects.size() > 0) { DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); if (!detachedObjects.isEmpty()) { EReferencePredicate refToIgnore = new EReferencePredicate() { @Override public boolean apply(EReference ref) { return DSEMANTICDECORATOR_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || NOTATION_VIEW_ELEMENT_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || EPACKAGE_EFACTORYINSTANCE_REFERENCE_TO_IGNORE_PREDICATE.apply(ref); } }; Command removeDangling = new RemoveDanglingReferencesCommand(domain, accessor, xRef, detachedObjects, refToIgnore); DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); return Options.newSome(removeDangling); } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); } return Options.newNone(); }</code><technical_language>This set aimed reference effectively detached object contents. analyze attached object some elements re-attached new containers</technical_language>

Target:
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { final Set<EObject> allDetachedObjects = getChangedEObjectsAndChildren(Iterables.filter(notifications, IS_DETACHMENT), null); if (allDetachedObjects.size() > 0) { DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); Predicate<EObject> ignoreNotifierInDetachedObjects = Predicates.in(allDetachedObjects); final Set<EObject> allAttachedObjects = getChangedEObjectsAndChildren(Iterables.filter(notifications, IS_ATTACHMENT), ignoreNotifierInDetachedObjects); final Set<EObject> toRemoveXRefFrom = Sets.difference(allDetachedObjects, allAttachedObjects); if (toRemoveXRefFrom.size() > 0) { EReferencePredicate refToIgnore = new EReferencePredicate() { @Override public boolean apply(EReference ref) { return DSEMANTICDECORATOR_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || NOTATION_VIEW_ELEMENT_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || EPACKAGE_EFACTORYINSTANCE_REFERENCE_TO_IGNORE_PREDICATE.apply(ref); } }; Command removeDangling = new RemoveDanglingReferencesCommand(domain, accessor, xRef, toRemoveXRefFrom, refToIgnore); DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); return Options.newSome(removeDangling); } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); } return Options.newNone(); }
Source:
<code>public static void assertSwappedIngredientsMatch(ObjectInstance ing, State s, List<String> ings) { Set<String> swappedIngredients = IngredientFactory.getRecursiveContentsAndSwapped(s, ing); Boolean match = true; <START> assertEquals(swappedIngredients.size(), ings.size()); <END> for (String i : ings) { if (!swappedIngredients.contains(i)) { match = false; break; } } assertTrue(match); }</code><technical_language>class name included this method is called from</technical_language>

Target:
public static void assertSwappedIngredientsMatch(ObjectInstance ing, State s, List<String> ings) { Set<String> swappedIngredients = IngredientFactory.getRecursiveContentsAndSwapped(s, ing); Boolean match = true; Assert.assertEquals(swappedIngredients.size(), ings.size()); for (String i : ings) { if (!swappedIngredients.contains(i)) { match = false; break; } } Assert.assertTrue(match); }
Source:
<code>public String getDocType() { if (Objects.isNull(docType)) { List<SelectItem> allDocTypes = getAllDoctypes(); for (SelectItem item : allDocTypes) { <START> if ("Monograph".equals(item.getValue())) { <END> setDocType((String) item.getValue()); return docType; } } setDocType((String) allDocTypes.get(0).getValue()); } return docType; }</code><technical_language>No, a feature requested far. current state is division type of root element. discussed add a possibility types restricted. In context, implement selection of a standard type</technical_language>

Target:
public String getDocType() { if (Objects.isNull(docType) && !allDocTypes.isEmpty()) { setDocType((String) allDocTypes.get(0).getValue()); } return docType; }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Comment)) <START> return false; <END> Comment comment = (Comment) o; return getId().equals(comment.getId()); }</code><technical_language>I appreciate this is generated code. Please for if statements</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Comment)) { return false; } Comment comment = (Comment) o; return getId().equals(comment.getId()); }
Source:
<code>public DotTempFile createTempFileFromUrl(final String incomingFileName, final HttpServletRequest request, final URL url, final int timeoutSeconds, final long maxLength) throws DotSecurityException, IOException { if (!validUrl(url)) { <START> throw new BadRequestException("Invalid url attempted for tempFile : " + url); <END> } final String fileName = resolveFileName(incomingFileName, url); final DotTempFile dotTempFile = createEmptyTempFile(fileName, request); final File tempFile = dotTempFile.file; final OutputStream out = new BoundedOutputStream(maxFileSize(request), new FileOutputStream(tempFile)); final CircuitBreakerUrl urlGetter = CircuitBreakerUrl.builder().setMethod(Method.GET).setUrl(url.toString()) .setTimeout(timeoutSeconds * 1000).build(); urlGetter.doOut(out); return dotTempFile; }</code><technical_language>is ok throw this exception this level</technical_language>

Target:
public DotTempFile createTempFileFromUrl(final String incomingFileName, final HttpServletRequest request, final URL url, final int timeoutSeconds, final long maxLength) throws DotSecurityException, IOException { final String fileName = resolveFileName(incomingFileName, url); final DotTempFile dotTempFile = createEmptyTempFile(fileName, request); final File tempFile = dotTempFile.file; final OutputStream out = new BoundedOutputStream(maxFileSize(request), new FileOutputStream(tempFile)); final CircuitBreakerUrl urlGetter = CircuitBreakerUrl.builder().setMethod(Method.GET).setUrl(url.toString()) .setTimeout(timeoutSeconds * 1000).build(); urlGetter.doOut(out); return dotTempFile; }
Source:
<code><START> public static <T,TT extends Iterable<T>> Predicate<TT> all(Predicate<T> attributeSatisfies) { <END> return new QuorumSatisfies<T, TT>(QuorumChecks.all(), attributeSatisfies); }</code><technical_language>I expect a method named CollectionFunctionals.all(Predicate) QuorumChecks code</technical_language>

Target:
public static <T,TT extends Iterable<T>> Predicate<TT> all(Predicate<T> attributeSatisfies) { return quorum(QuorumChecks.all(), attributeSatisfies); }
Source:
<code>public String generateToken(JwtPayload payload, TokenType tokenType) { long maxAge = tokenType.equals(TokenType.ACCESS) ? accessTokenMaxAge : refreshTokenMaxAge; Date expiration = payload.getExpiration() != null ? payload.getExpiration() : <START> new Date(System.currentTimeMillis() + maxAge); <END> payload.setExpiration(expiration); payload.setTokenType(tokenType); Map<String, Object> jwtMap = new HashMap<>(); jwtMap.put(JwtPayload.JWT_CLAIM_KEY, payload); Claims claims = Jwts.claims(jwtMap); return Jwts.builder() .setClaims(claims) .signWith(SignatureAlgorithm.HS256, JwtSecretHolder.INSTANCE.getJwtSecret()) .compact(); }</code><technical_language><LINK_0> for Date generation</technical_language>

Target:
public String generateToken(JwtPayload payload, TokenType tokenType) { long maxAge = tokenType.equals(TokenType.ACCESS) ? accessTokenMaxAge : refreshTokenMaxAge; Date expiration = payload.getExpiration() != null ? payload.getExpiration() : timestampService.getDate(System.currentTimeMillis() + maxAge); payload.setExpiration(expiration); payload.setTokenType(tokenType); Map<String, Object> jwtMap = new HashMap<>(); jwtMap.put(JwtPayload.JWT_CLAIM_KEY, payload); Claims claims = Jwts.claims(jwtMap); return Jwts.builder() .setClaims(claims) .signWith(SignatureAlgorithm.HS256, JwtSecretHolder.INSTANCE.getJwtSecret()) .compact(); }
Source:
<code>public boolean isCountQuery() { <START> return getName().startsWith("count"); <END> }</code><technical_language>this a case insensitive check minimize risk of catching it</technical_language>

Target:
public boolean isCountQuery() { return getName().toLowerCase().startsWith("count"); }
Source:
<code>public FileDataStoreFactory(File dataDirectory) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); this.dataDirectory = dataDirectory; <START> if (IOUtils.isSymbolicLink(dataDirectory)) { <END> throw new IOException("unable to use a symbolic link: " + dataDirectory); } if (!dataDirectory.exists() && !dataDirectory.mkdirs()) { throw new IOException("unable to create directory: " + dataDirectory); } setPermissionsToOwnerOnly(dataDirectory); }</code><technical_language>object modified exception is thrown</technical_language>

Target:
public FileDataStoreFactory(File dataDirectory) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); if (IOUtils.isSymbolicLink(dataDirectory)) { throw new IOException("unable to use a symbolic link: " + dataDirectory); } if (!dataDirectory.exists() && !dataDirectory.mkdirs()) { throw new IOException("unable to create directory: " + dataDirectory); } this.dataDirectory = dataDirectory; setPermissionsToOwnerOnly(dataDirectory); }
Source:
<code>public static String gunzip(byte[] value) throws IOException { StringBuilder stringBuilder = new StringBuilder(); byte[] buffer = new byte[1024]; GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(value)); <START> ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); <END> int length; while ((length = inputStream.read(buffer)) > 0) { stringBuilder.append(Charset.forName("UTF-8").decode(ByteBuffer.wrap(buffer)), 0, length); } return stringBuilder.toString(); }</code><technical_language>outputStream is</technical_language>

Target:
public static String gunzip(byte[] value) throws IOException { StringBuilder stringBuilder = new StringBuilder(); byte[] buffer = new byte[1024]; GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(value)); int length; while ((length = inputStream.read(buffer)) > 0) { stringBuilder.append(Charset.forName("UTF-8").decode(ByteBuffer.wrap(buffer)), 0, length); } return stringBuilder.toString(); }
Source:
<code>public boolean isStartOfSegment() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Cannot call isReadFirstObjectOfSegment: PBD has been closed"); } assertions(); moveToValidSegment(); long lastSegmentId = peekLastSegment().segmentIndex(); while (!m_segment.file().exists()) { if (m_segment.segmentIndex() == lastSegmentId) { throw new IOException("Tail segment file " + m_segment.file().getName() + " doesn't exist! "); } m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); } PBDSegmentReader segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } while (!segmentReader.hasMoreEntries()) { if (m_segment.segmentIndex() == lastSegmentId) { return false; } segmentReader.close(); m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); <START> } <END> } if (segmentReader.readIndex() == 0) { return true; } return false; } }</code><technical_language>I in email exchanges, I this logic searches for a specific condition factorized more similar in 3 methods</technical_language>

Target:
public boolean isStartOfSegment() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Cannot call isStartOfSegment: PBD has been closed"); } assertions(); moveToValidSegment(); PBDSegmentReader segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } long lastSegmentId = peekLastSegment().segmentIndex(); while (!segmentReader.hasMoreEntries()) { if (m_segment.segmentIndex() == lastSegmentId) { return false; } segmentReader.close(); m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } } if (segmentReader.readIndex() == 0) { return true; } return false; } }
Source:
<code>public static void createDefaultStorage() { final Storage storage = new Storage(); storage.setId("default"); storage.setType(Storage.Type.KAFKA); storage.setConfiguration(new Storage.KafkaConfiguration(null, null, ZOOKEEPER_URL, "")); try { STORAGE_DB_REPOSITORY.createStorage(storage); <START> } catch (final Exception ignore) { <END> } }</code><technical_language>exception do ignore here? Is DuplicatedStorageException</technical_language>

Target:
public static void createDefaultStorage() { final Storage storage = new Storage(); storage.setId("default"); storage.setType(Storage.Type.KAFKA); storage.setConfiguration(new Storage.KafkaConfiguration(null, null, ZOOKEEPER_URL, "")); try { STORAGE_DB_REPOSITORY.createStorage(storage); } catch (final DuplicatedStorageException ignore) { } }
Source:
<code>private void addOrUpdateAttributeInstance(final Case autopsyCase, Map<UniquePathKey,CorrelationAttributeInstance> artifactInstances, AbstractFile newFile) throws TskCoreException, EamDbException { TskData.FileKnown localKnown = newFile.getKnown(); if (localKnown != TskData.FileKnown.BAD) { List<ContentTag> fileMatchTags = autopsyCase.getServices().getTagsManager().getContentTagsByContent(newFile); for (ContentTag tag : fileMatchTags) { TskData.FileKnown tagKnownStatus = tag.getName().getKnownStatus(); if (tagKnownStatus.equals(TskData.FileKnown.BAD)) { localKnown = TskData.FileKnown.BAD; break; } } } <START> CorrelationCase correlationCase = EamDb.getInstance().getCase(autopsyCase); <END> CorrelationDataSource correlationDataSource = CorrelationDataSource.fromTSKDataSource(correlationCase, newFile.getDataSource()); String filePath = newFile.getParentPath() + newFile.getName(); UniquePathKey uniquePathKey = new UniquePathKey(correlationDataSource.getDeviceID(), filePath); if (localKnown == TskData.FileKnown.BAD || !artifactInstances.containsKey(uniquePathKey)) { String crComment = ""; if (artifactInstances.containsKey(uniquePathKey)) { crComment = artifactInstances.get(uniquePathKey).getComment(); } CorrelationAttributeInstance caseDbInstance = new CorrelationAttributeInstance(correlationCase, correlationDataSource, filePath, crComment, localKnown); artifactInstances.put(uniquePathKey, caseDbInstance); } }</code><technical_language>NPE if CR is enabled</technical_language>

Target:
private void addOrUpdateAttributeInstance(final Case autopsyCase, Map<UniquePathKey,CorrelationAttributeInstance> artifactInstances, AbstractFile newFile) throws TskCoreException, EamDbException { TskData.FileKnown localKnown = newFile.getKnown(); if (localKnown != TskData.FileKnown.BAD) { List<ContentTag> fileMatchTags = autopsyCase.getServices().getTagsManager().getContentTagsByContent(newFile); for (ContentTag tag : fileMatchTags) { TskData.FileKnown tagKnownStatus = tag.getName().getKnownStatus(); if (tagKnownStatus.equals(TskData.FileKnown.BAD)) { localKnown = TskData.FileKnown.BAD; break; } } } String filePath = newFile.getParentPath() + newFile.getName(); String deviceId; try { deviceId = autopsyCase.getSleuthkitCase().getDataSource(newFile.getDataSource().getId()).getDeviceId(); } catch (TskDataException | TskCoreException ex) { LOGGER.log(Level.WARNING, "Error getting data source info: " + ex); return; } UniquePathKey uniquePathKey = new UniquePathKey(deviceId, filePath); if (artifactInstances.containsKey(uniquePathKey)) { if (localKnown == TskData.FileKnown.BAD) { CorrelationAttributeInstance prevInstance = artifactInstances.get(uniquePathKey); prevInstance.setKnownStatus(localKnown); } } else { CorrelationCase correlationCase = new CorrelationCase(autopsyCase.getName(), autopsyCase.getDisplayName()); CorrelationDataSource correlationDataSource = CorrelationDataSource.fromTSKDataSource(correlationCase, newFile.getDataSource()); CorrelationAttributeInstance caseDbInstance = new CorrelationAttributeInstance(correlationCase, correlationDataSource, filePath, "", localKnown); artifactInstances.put(uniquePathKey, caseDbInstance); } }
Source:
<code>protected Optional<C> retrieveCredentials(final WebContext context) { try { <START> final C credentials = this.credentialsExtractor.extract(context); <END> if (credentials == null) { return Optional.empty(); } final long t0 = System.currentTimeMillis(); try { this.authenticator.validate(credentials, context); } finally { final long t1 = System.currentTimeMillis(); logger.debug("Credentials validation took: ms", t1 - t0); } return Optional.of(credentials); } catch (CredentialsException e) { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); logger.debug("Failed to retrieve or validate credentials", e); return Optional.empty(); } }</code><technical_language>credentialsExtractor return optional</technical_language>

Target:
protected Optional<C> retrieveCredentials(final WebContext context) { try { final Optional<C> credentials = this.credentialsExtractor.extract(context); credentials.ifPresent(c -> { final long t0 = System.currentTimeMillis(); try { this.authenticator.validate(c, context); } finally { final long t1 = System.currentTimeMillis(); logger.debug("Credentials validation took: ms", t1 - t0); } }); return credentials; } catch (CredentialsException e) { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); logger.debug("Failed to retrieve or validate credentials", e); return Optional.empty(); } }
Source:
<code>public Properties getKafkaProducerProperties() { final Properties producerProps = getKafkaConsumerProperties(); producerProps.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put("acks", "all"); producerProps.put("request.timeout.ms", kafkaSettings.getRequestTimeoutMs()); producerProps.put("batch.size", kafkaSettings.getBatchSize()); producerProps.put("linger.ms", kafkaSettings.getLingerMs()); <START> producerProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "lz4"); <END> return producerProps; }</code><technical_language>great this constant instead of a String lines above. Do do for other properties</technical_language>

Target:
public Properties getKafkaProducerProperties() { final Properties producerProps = (Properties) kafkaProperties.clone(); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.ACKS_CONFIG, "all"); producerProps.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, kafkaSettings.getRequestTimeoutMs()); producerProps.put(ProducerConfig.BATCH_SIZE_CONFIG, kafkaSettings.getBatchSize()); producerProps.put(ProducerConfig.LINGER_MS_CONFIG, kafkaSettings.getLingerMs()); producerProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "lz4"); return producerProps; }
Source:
<code>private void removeHandlers() { if (fileEventHandlerRegistration != null) { fileEventHandlerRegistration.removeHandler(); <START> } <END> if (resourceChangeHandlerRegistration != null) { resourceChangeHandlerRegistration.removeHandler(); } }</code><technical_language>Set fileEventHandlerRegistration null</technical_language>

Target:
private void removeHandlers() { if (fileEventHandlerRegistration != null) { fileEventHandlerRegistration.removeHandler(); fileEventHandlerRegistration = null; } if (resourceChangeHandlerRegistration != null) { resourceChangeHandlerRegistration.removeHandler(); resourceChangeHandlerRegistration = null; } }
Source:
<code>protected void flushQueues() { long now = now(); Logger.debug(LOG_TAG, "Applying remaining insertions."); try { insertionManager.finishUp(); Logger.debug(LOG_TAG, "Done applying remaining insertions."); } catch (Exception e) { Logger.warn(LOG_TAG, "Unable to apply remaining insertions.", e); } if (enqueuedGuids.size() != insertedGuids.size()) { Logger.warn(LOG_TAG, "Enqueued " + enqueuedGuids.size() + " records, but inserted " + insertedGuids.size() + " records."); Set<String> eSet = new HashSet<String>(enqueuedGuids); Set<String> iSet = new HashSet<String>(insertedGuids); eSet.removeAll(iSet); if (eSet.isEmpty()) { Logger.debug(LOG_TAG, "All enqueued guids were inserted."); } else { Logger.warn(LOG_TAG, "Enqueued but didn't insert the following guids: " + "(" + Utils.toCommaSeparatedString(eSet) + ")"); } iSet.removeAll(new HashSet<String>(enqueuedGuids)); if (iSet.isEmpty()) { } else { Logger.warn(LOG_TAG, "Inserted but didn't enqueue the following guids: " + <START> "(" + Utils.toCommaSeparatedString(iSet) + ")"); <END> } } else { Logger.debug(LOG_TAG, "Enqueued and inserted " + enqueuedGuids.size() + " records."); } Logger.debug(LOG_TAG, "Applying deletions."); try { untrackGUIDs(deletionManager.flushAll(getIDForGUID("unfiled"), now)); Logger.debug(LOG_TAG, "Done applying deletions."); } catch (Exception e) { Logger.error(LOG_TAG, "Unable to apply deletions.", e); } }</code><technical_language>This pile of code allocates sets of fifty strings each. a pile of memory nudge OOM some devices. Remember entire process a 16MB heap limit. I suggest killing insertedGuids more aggressive designing for a constrained-memory device. recover this situation, counters</technical_language>

Target:
protected void flushQueues() { long now = now(); Logger.debug(LOG_TAG, "Applying remaining insertions."); try { insertionManager.finishUp(); Logger.debug(LOG_TAG, "Done applying remaining insertions."); } catch (Exception e) { Logger.warn(LOG_TAG, "Unable to apply remaining insertions.", e); } Logger.debug(LOG_TAG, "Applying deletions."); try { untrackGUIDs(deletionManager.flushAll(getIDForGUID("unfiled"), now)); Logger.debug(LOG_TAG, "Done applying deletions."); } catch (Exception e) { Logger.error(LOG_TAG, "Unable to apply deletions.", e); } }
Source:
<code>private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } <START> byte[] bytes = IOUtils.toByteArray(stream); <END> BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); }</code><technical_language>This is a 5-line method pulled in of commons-io for :(</technical_language>

Target:
private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } MarkableInputStream markStream = new MarkableInputStream(stream); stream = markStream; long mark = markStream.savePosition(1024); byte[] fileHeaderBytes = new byte[WEBP_FILE_HEADER_SIZE]; boolean isWebPFile = false; if (stream.read(fileHeaderBytes, 0, WEBP_FILE_HEADER_SIZE) == WEBP_FILE_HEADER_SIZE) { isWebPFile = WEBP_FILE_HEADER_RIFF.equals(new String(fileHeaderBytes, 0, 4)) && WEBP_FILE_HEADER_WEBP.equals(new String(fileHeaderBytes, 8, 4)); } markStream.reset(mark); if (isWebPFile) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024 * 4]; int n = 0; while (-1 != (n = stream.read(buffer))) { byteArrayOutputStream.write(buffer, 0, n); } byte[] bytes = byteArrayOutputStream.toByteArray(); BitmapFactory.Options options = new BitmapFactory.Options(); options.inPurgeable = true; options.inInputShareable = true; if (data.hasSize()) { options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); } else { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); markStream.reset(mark); } return BitmapFactory.decodeStream(stream, null, options); } }
Source:
<code>public void catchEmailLinkSignIn() { <START> String link = getIntent().getExtras().getString(ExtraConstants.EMAIL_LINK_SIGN_IN); <END> if (link != null) { signInWithEmailLink(link); } }</code><technical_language>I getExtras() is nullable, handle case</technical_language>

Target:
public void catchEmailLinkSignIn() { if (getIntent().getExtras() == null) { return; } String link = getIntent().getExtras().getString(ExtraConstants.EMAIL_LINK_SIGN_IN); if (link != null) { signInWithEmailLink(link); } }
Source:
<code>private static long combineFilters(long[] filters) { if (filters == null) { return 0; } int combined = 0; <START> for (int i = 0; i < filters.length; i++) { <END> combined |= filters[i]; } return combined; }</code><technical_language>java for (long filter : filters) { combined |= filter; }</technical_language>

Target:
private static long combineFilters(long[] filters) { if (filters == null) { return 0; } int combined = 0; for (long filter : filters) { combined |= filter; } return combined; }
Source:
<code>private Map<Integer, Long> loadOffsetFromPreviousMetaData(Object lastCommit) { Map<Integer, Long> offsetMap = Maps.newHashMap(); if (lastCommit == null) { return offsetMap; } <START> Map<Object, Object> lastCommitMap = (Map) lastCommit; <END> for (Map.Entry<Object, Object> entry : lastCommitMap.entrySet()) { try { int partitionId = Integer.parseInt(entry.getKey().toString()); long offset = Long.parseLong(entry.getValue().toString()); log.debug("Recover last commit information partitionId [%s], offset [%s]", partitionId, offset); offsetMap.put(partitionId, offset); } catch (NumberFormatException e) { log.error(e, "Fail to load offset from previous meta data [%s]", entry); } } log.info("Loaded offset map[%s]", offsetMap); return offsetMap; }</code><technical_language>throw a meaningful exception of lastCommit is a map</technical_language>

Target:
private Map<Integer, Long> loadOffsetFromPreviousMetaData(Object lastCommit) { Map<Integer, Long> offsetMap = Maps.newHashMap(); if (lastCommit == null) { return offsetMap; } if (lastCommit instanceof Map) { Map<Object, Object> lastCommitMap = (Map) lastCommit; for (Map.Entry<Object, Object> entry : lastCommitMap.entrySet()) { try { int partitionId = Integer.parseInt(entry.getKey().toString()); long offset = Long.parseLong(entry.getValue().toString()); log.debug("Recover last commit information partitionId [%s], offset [%s]", partitionId, offset); offsetMap.put(partitionId, offset); } catch (NumberFormatException e) { log.error(e, "Fail to load offset from previous meta data [%s]", entry); } } log.info("Loaded offset map[%s]", offsetMap); } else { log.error("Unable to cast lastCommit to Map"); } return offsetMap; }
Source:
<code>public Set<AuditActionContext> getAuditRecordsSince(final LocalDate localDate) { return Sets.newHashSet(couchDb.findAuditRecordsSince(localDate)); <START> } <END></code><technical_language>CollectionUtils please</technical_language>

Target:
public Set<? extends AuditActionContext> getAuditRecordsSince(final LocalDate localDate) { return CollectionUtils.wrapHashSet(couchDb.findAuditRecordsSince(localDate)); }
Source:
<code>protected void initUnregisteredDisksToDB(Guid storageDomainId) { <START> Set<DiskImage> existingDisks = new HashSet<>(diskImageDao.getAllForStorageDomain(storageDomainId)); <END> for (Object unregisteredDiskObj : unregisteredDisks) { UnregisteredDisk unregisteredDisk = (UnregisteredDisk) unregisteredDiskObj; if (existingDisks.contains(unregisteredDisk.getDiskImage())) { log.info("Disk with id '{}' already exists in the engine, therefore will not be " + "part of the unregistered disks.", unregisteredDisk.getDiskAlias(), unregisteredDisk.getDiskImage().getId()); continue; } unregisteredDisksDao.removeUnregisteredDisk(unregisteredDisk.getId().getDiskId(), storageDomainId); unregisteredDisksDao.saveUnregisteredDisk(unregisteredDisk); log.info("Adding unregistered disk of disk id '{}' and disk alias '{}'", unregisteredDisk.getDiskImage().getId(), unregisteredDisk.getDiskAlias()); } }</code><technical_language>Suggestion: try disk id instead of disk, equals evaluate hash a bit more faster in line 625</technical_language>

Target:
protected void initUnregisteredDisksToDB(Guid storageDomainId) { Set<Guid> existingDiskIds = diskImageDao.getAllForStorageDomain(storageDomainId) .stream() .map(DiskImage::getId) .collect(Collectors.toSet()); for (UnregisteredDisk unregisteredDisk: unregisteredDisks) { if (existingDiskIds.contains(unregisteredDisk.getDiskImage())) { log.info("Disk with id '{}' already exists in the engine, therefore will not be " + "part of the unregistered disks.", unregisteredDisk.getDiskAlias(), unregisteredDisk.getDiskId()); continue; } unregisteredDisksDao.removeUnregisteredDisk(unregisteredDisk.getDiskId(), storageDomainId); unregisteredDisksDao.saveUnregisteredDisk(unregisteredDisk); log.info("Adding unregistered disk of disk id '{}' and disk alias '{}'", unregisteredDisk.getDiskId(), unregisteredDisk.getDiskAlias()); } }
Source:
<code>public void testGetHTMLEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); DoorsTableRow dtr = new DoorsTableRow(); dtc.getHTML(dtr, DoorsColumnType.OBJECT_TEXT); <START> Assert.fail(); <END> }</code><technical_language>fail is unecesary if exception happen test fail</technical_language>

Target:
public void testGetHTMLEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); DoorsTableRow dtr = new DoorsTableRow(); dtc.getHTML(dtr, DoorsColumnType.OBJECT_TEXT); }
Source:
<code>protected void testPutBlobTierHelper(Tier tier, PutOptions options) throws Exception { <START> if (!isMacOSX()) { <END> super.testPutBlobTierHelper(tier, options); } }</code><technical_language>Instead flag this skipped via: java if (isMacOSX()) { throw new SkipException("Extended attributes supported Mac OS X"); }</technical_language>

Target:
protected void testPutBlobTierHelper(Tier tier, PutOptions options) throws Exception { checkExtendedAttributesSupport(); super.testPutBlobTierHelper(tier, options); }
Source:
<code>protected String worklogInSec(final Long worklog) { DurationFormatter durationFormatter = new DurationFormatter(); isWorklogInSec = true; <START> if ("false".equals( <END> pluginSettings.get(GlobalSettingsKey.JTTP_PLUGIN_REPORTING_SETTINGS_WORKLOG_IN_SEC))) { isWorklogInSec = false; } if (worklog != null) { if (isWorklogInSec) { return worklog.toString(); } return durationFormatter.exactDuration(worklog); } return ""; }</code><technical_language>This repelaced a UserReportingSettingsHelper call</technical_language>

Target:
protected String worklogInSec(final Long worklog) { DurationFormatter durationFormatter = new DurationFormatter(); isWorklogInSec = true; if (!userReportingSettingsHelper.getWorklogTimeInSeconds()) { isWorklogInSec = false; } if (worklog != null) { if (isWorklogInSec) { return worklog.toString(); } return durationFormatter.exactDuration(worklog); } return ""; }
Source:
<code>private void init() { D2.init(this); SdkQueries.createDBIndexes(); PopulateDB.initDBQuery(); try { PostMigration.launchPostMigration(); }catch (PostMigrationException e){ new AlertDialog.Builder(this) .setTitle(getApplicationContext().getString(R.string.error_message)) .setCancelable(false) .setMessage(getApplicationContext().getString(R.string.db_migration_error)) .setNeutralButton(android.R.string.ok, null).create().show(); } if (!BuildConfig.multiuser) { Log.i(TAG, "Pull on SplashScreen ..."); PullController pullController = new PullController( getApplication().getApplicationContext()); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMainExecutor mainExecutor = new UIThreadExecutor(); PullUseCase pullUseCase = new PullUseCase(pullController, asyncExecutor, mainExecutor); PullFilters pullFilters = new PullFilters(); splashActivityStrategy.initPullFilters(pullFilters); splashActivityStrategy.executePull(pullUseCase, pullFilters); } <START> SurveyDB.deleteOlderSentSurveys(); <END> }</code><technical_language>explained this is in main, I need change gradle var convenient variant, create a strategy create a performMaintenanceTasks method altered depending variant</technical_language>

Target:
private void init() { D2.init(this); SdkQueries.createDBIndexes(); PopulateDB.initDBQuery(); try { PostMigration.launchPostMigration(); }catch (PostMigrationException e){ new AlertDialog.Builder(this) .setTitle(getApplicationContext().getString(R.string.error_message)) .setCancelable(false) .setMessage(getApplicationContext().getString(R.string.db_migration_error)) .setNeutralButton(android.R.string.ok, null).create().show(); } if (!BuildConfig.multiuser) { Log.i(TAG, "Pull on SplashScreen ..."); PullController pullController = new PullController( getApplication().getApplicationContext()); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMainExecutor mainExecutor = new UIThreadExecutor(); PullUseCase pullUseCase = new PullUseCase(pullController, asyncExecutor, mainExecutor); PullFilters pullFilters = new PullFilters(); splashActivityStrategy.initPullFilters(pullFilters); splashActivityStrategy.executePull(pullUseCase, pullFilters); } if(BuildConfig.performMaintenanceTasks) { performMaintenanceTasks(); } }
Source:
<code>public void showSuccess() { <START> Toast.makeText(getContext(), getStringMessage(R.string.collectionsheet_submit_success), <END> Toast.LENGTH_LONG).show(); }</code><technical_language>Toaster in this class for this message. For sake of consistency, class well</technical_language>

Target:
public void showSuccess() { Toaster.show(rootView, getStringMessage(R.string.collectionsheet_submit_success)); }
Source:
<code><START> private ExtensionContext.Store getStore(ExtensionContext context) { <END> return context.getStore(ExtensionContext.Namespace.create(getClass(), context)); }</code><technical_language>this a static method rely state parent class</technical_language>

Target:
private static ExtensionContext.Store getStore(ExtensionContext context) { return context.getStore(ExtensionContext.Namespace.create(AzureTestWatcher.class, context)); }
Source:
<code>public boolean isAuthzClient(String id) { ClientRegistration client = findByRegistrationId(id); <START> return client != null && isAuthzClient(client) && !authorizationProperties.get(id).getOnDemand(); <END> }</code><technical_language>move && !authorizationProperties.get(id).getOnDemand() public boolean isAuthzClient(String id). enrich AzureActiveDirectoryConfigurationTest</technical_language>

Target:
public boolean isAuthzClient(String id) { ClientRegistration client = findByRegistrationId(id); return client != null && isAuthzClient(client); }
Source:
<code>public static String getRemainderOfLineAfter(String context, String phrase) { if (context == null || phrase == null) return null; int index = context.indexOf(phrase); if (index < 0) return null; int lineEndIndex = context.indexOf("\n", index); if (lineEndIndex <= 0) { <START> return trim(context.substring(index + phrase.length())); <END> } else { return trim(context.substring(index + phrase.length(), lineEndIndex)); } }</code><technical_language>I this trim result. expect wording getRemainderOfLineAfter. caller trim instead, if wants to</technical_language>

Target:
public static String getRemainderOfLineAfter(String context, String phrase) { if (context == null || phrase == null) return null; int index = context.indexOf(phrase); if (index < 0) return null; int lineEndIndex = context.indexOf("\n", index); if (lineEndIndex <= 0) { return context.substring(index + phrase.length()); } else { return context.substring(index + phrase.length(), lineEndIndex); } }
Source:
<code>public static boolean isValidIds(String gameId, String placementId) { if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(placementId)) { String ids = TextUtils.isEmpty(gameId) ? TextUtils.isEmpty(placementId) ? "Game ID and Placement ID" : "Game ID" : "Placement ID"; <START> Log.w(TAG, "Unity Ads failed to load interstitial ad: " + ids + " cannot be empty."); <END> return false; } return true; }</code><technical_language>This method is in places other interstitials. remove this log. Callers log something</technical_language>

Target:
public static boolean isValidIds(String gameId, String placementId) { if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(placementId)) { return false; } return true; }
Source:
<code>private void open() { <START> while (!isOpened()) { <END> BusyPopup.retryClickUntilPopupDisappears(dropdownToggle); } }</code><technical_language>This is dangerous, potentially lead looping tests. retryClickUntilPopupDisappears clicking for 10 seconds. restrict number of iterations some fixed (small) 2 3 for loop something</technical_language>

Target:
private void open() { Waits.elementClickable(By.cssSelector(DROPDOWN_TOGGLE)); BusyPopup.retryClickUntilPopupDisappears(dropdownToggle); }
Source:
<code><START> FileMeta getMetadata( final File target, final LocalLockOwner owner ) throws IOException <END> { String path = target.getAbsolutePath(); try { return lockManager.reentrantSynchronous( path, ( opLock ) -> { FileMeta meta = metadataCache.computeIfAbsent( path, ( p ) -> new FileMeta( p, target.isDirectory(), owner ) ); return meta; } ); } catch ( InterruptedException e ) { throw new IOException( "Thread interrupted while retrieving / creating file metadata : " + path, e ); } }</code><technical_language>change this a boolean parameter "create". create entries if this parameter is true. able handle in computeIfAbsent call, I think. Eventually need implement a call File.exists() in partyline, cluster. Avoiding creation of a new FileMeta existence check important this, I think. Scratch this. implement exists() separately, need path locking all</technical_language>

Target:
FileMeta getMetadata( final File target, final LocalLockOwner owner ) throws IOException { String path = target.getAbsolutePath(); try { return lockManager.reentrantSynchronous( path, ( opLock ) -> { FileMeta meta = null; TransactionManager transactionManager = metadataCache.getAdvancedCache().getTransactionManager(); try { transactionManager.begin(); meta = metadataCache.computeIfAbsent( path, ( p ) -> new FileMeta( p, target.isDirectory() ) ); LockLevel currentLockLevel = meta.getLockLevel( this.nodeKey ); if ( currentLockLevel == null || currentLockLevel != owner.getLockLevel() ) { meta.setLock( this.nodeKey, owner.getLockLevel() ); metadataCache.put( path, meta ); } } catch ( NotSupportedException | SystemException e ) { try { transactionManager.rollback(); throw new PartylineException( "Failed to begin transaction. Rolling back. Path: " + path, e ); } catch ( SystemException e1 ) { LoggerFactory.getLogger( getClass().getName() ) .error( "System Exception during transaction rollback involving path: " + path, e1 ); } } finally { try { transactionManager.commit(); } catch ( RollbackException | HeuristicMixedException | HeuristicRollbackException | SystemException e ) { LoggerFactory.getLogger( getClass().getName() ) .error( "Exception during transaction commit involving path: " + path, e ); } } return meta; } ); } catch ( InterruptedException e ) { LoggerFactory.getLogger( getClass().getName() ).error( "Problem retrieving metadata for path: " + path, e ); } return null; }
Source:
<code>protected static List<IArtifactKey> getArtifactKeys(IQueryResult<IInstallableUnit> ius) { List<IArtifactKey> keys = new ArrayList<>(); for (IInstallableUnit <START> iInstallableUnit : <END> ius) keys.addAll(iInstallableUnit.getArtifacts()); return keys; }</code><technical_language>rename iu</technical_language>

Target:
protected static List<IArtifactKey> getArtifactKeys(IQueryResult<IInstallableUnit> ius) { List<IArtifactKey> keys = new ArrayList<>(); for (IInstallableUnit iu : ius) keys.addAll(iu.getArtifacts()); return keys; }
Source:
<code>public boolean isPage500(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.OK_200) || isCustomPage(msg, CustomPage.Type.NOTFOUND_404)) { return false; } return isCustomPage(msg, CustomPage.Type.ERROR_500) ? true <START> : msg.getResponseHeader().getStatusCode() == HttpStatusCode.INTERNAL_SERVER_ERROR; <END> }</code><technical_language>branch covered</technical_language>

Target:
public boolean isPage500(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.OK_200) || isCustomPage(msg, CustomPage.Type.NOTFOUND_404)) { return false; } if (isCustomPage(msg, CustomPage.Type.ERROR_500)) { return true; } return msg.getResponseHeader().getStatusCode() == HttpStatusCode.INTERNAL_SERVER_ERROR; }
Source:
<code><START> public void testServicePostSimpleServerError() throws IOException { <END> expectLifecycleServerError(HttpPost.class, BASE_URL); replayAll(); PostService service = injector.getInstance(PostService.class); service.post(mockCallback); verifyAll(); }</code><technical_language>method names fit line annotation? (Hard github diff.) Edit: do fit line. :)</technical_language>

Target:
@SuppressWarnings("unchecked") public void testServicePostSimpleServerError() throws IOException { expectLifecycleServerError(HttpPost.class, BASE_URL); replayAll(); PostService service = injector.getInstance(PostService.class); service.post(mockCallback); verifyAll(); }