auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void stop() { try { semaphore.acquire(Integer.MAX_VALUE); } catch (InterruptedException e) { log.warnUnableToCloseDb(e); log.warnUnableToCloseExpiredDb(e); return; } try { db.close(); } catch (IOException e) { log.warnUnableToCloseDb(e); } try { expiredDb.close(); } catch (IOException e) { log.warnUnableToCloseExpiredDb(e); } }

Target:
public void stop() { try { semaphore.acquire(Integer.MAX_VALUE); } catch (InterruptedException e) { throw new PersistenceException("Cannot acquire semaphore", e); } try { try { db.close(); } catch (IOException e) { log.warnUnableToCloseDb(e); } try { expiredDb.close(); } catch (IOException e) { log.warnUnableToCloseExpiredDb(e); } } finally { stopped = true; semaphore.release(Integer.MAX_VALUE); } }
Source:
public Builder setCollectorType(CollectorFactory.CollectorType collectorType) { this.collectorType = collectorType; return this; }

Target:
public Builder setCollectorType(CollectorFactory.CollectorType collectorType) { _collectorType = collectorType; return this; }
Source:
private static long convertToBytes(String sizeWithSuffix) { if (sizeWithSuffix == null || sizeWithSuffix.length() == 0) { return 0; } String suffix = sizeWithSuffix.substring(sizeWithSuffix.length() - 2).toLowerCase(); String sizeValue = sizeWithSuffix.substring(0, sizeWithSuffix.length() - 2); double value = Long.parseLong(sizeValue); long bytes = 0; switch (suffix) { case "kb": bytes = (long) value * 1024; break; case "mb": bytes = (long) value * 1024 * 1024; break; case "gb": bytes = (long) value * 1024 * 1024 * 1024; break; } return bytes; }

Target:
private static long convertToBytes(String sizeWithSuffix) { if (sizeWithSuffix == null || sizeWithSuffix.length() == 0) { return 0; } String suffix; String sizeValue; try { suffix = sizeWithSuffix.substring(sizeWithSuffix.length() - 2).toLowerCase(); sizeValue = sizeWithSuffix.substring(0, sizeWithSuffix.length() - 2).trim(); } catch (IndexOutOfBoundsException e) { LOG.warn("Invalid file size '" + sizeWithSuffix + "'. The file size must include a size and the units. eg 128MB"); throw e; } double value = Long.parseLong(sizeValue); long bytes; switch (suffix) { case "kb": bytes = (long) value * 1024; break; case "mb": bytes = (long) value * 1024 * 1024; break; case "gb": bytes = (long) value * 1024 * 1024 * 1024; break; default: LOG.warn("Could not parse unit suffix of '" + suffix + "' from max file size '" + sizeWithSuffix + "'"); throw new IllegalArgumentException("Invalid unit suffix " + suffix); } return bytes; }
Source:
public Object parse(byte[] fileByteContent) throws ParseException { try ( ByteArrayInputStream inputStream = new ByteArrayInputStream(fileByteContent); InputStreamReader streamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(streamReader); CSVReader flatFileReader = buildFlatFileReader(bufferedReader); ) { return parseResultFromReader(flatFileReader); } catch (Exception e) { throw new ParseException("Exception encountered while parsing delimited flat file", e); } }

Target:
public Object parse(byte[] fileByteContent) throws ParseException { try (ByteArrayInputStream inputStream = new ByteArrayInputStream(fileByteContent); InputStreamReader streamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(streamReader); CSVReader flatFileReader = buildFlatFileReader(bufferedReader)) { return parseResultFromReader(flatFileReader); } catch (Exception e) { throw new ParseException("Exception encountered while parsing delimited flat file", e); } }
Source:
public ResponseEntity<String> delete(@PathVariable("id") Long id) { try { userUtil.extractLoggedAppUserFromDatabase(); Loan loan = loanDao.findOne(id); if(loan == null){ throw new NotFoundException("Loan not found"); } loanDao.delete(id); loanDao.flush(); } catch (EmptyResultDataAccessException emptyResultDataAccessException) { throw new NotFoundException(emptyResultDataAccessException.getMessage()); } return new ResponseEntity<>("Loan deleted", HttpStatus.NO_CONTENT); }

Target:
public ResponseEntity<String> delete(@PathVariable("id") Long id) { try { userUtil.extractLoggedAppUserFromDatabase(); Loan loan = loanDao.findOne(id); if(loan == null){ throw new NotFoundException("Loan not found"); } AppUser appUser = userUtil.extractLoggedAppUserFromDatabase(); if(appUser.getUserId() != loan.getUser().getUserId()){ throw new BadRequestException("Bad request"); } loanDao.delete(id); loanDao.flush(); } catch (EmptyResultDataAccessException emptyResultDataAccessException) { throw new NotFoundException(emptyResultDataAccessException.getMessage()); } return new ResponseEntity<>("Loan deleted", HttpStatus.NO_CONTENT); }
Source:
void close() { if (isOpen.compareAndSet(true, false)) { Iterator<DeleteOperation> iter = deleteOperations.iterator(); while (iter.hasNext()) { DeleteOperation deleteOperation = iter.next(); iter.remove(); NonBlockingRouter.completeOperation(deleteOperation.getFutureResult(), deleteOperation.getCallback(), null, new RouterException("Aborted operation because Router is closed.", RouterErrorCode.RouterClosed)); } } }

Target:
void close() { for (DeleteOperation op : deleteOperations) { if (deleteOperations.remove(op)) { NonBlockingRouter.completeOperation(op.getFutureResult(), op.getCallback(), null, new RouterException("Aborted operation because Router is closed.", RouterErrorCode.RouterClosed)); } } }
Source:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { AuthorizationResult authorizationResult = context.authorize(operation); if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerLogger.ROOT_LOGGER.unauthorized(operation.get(OP).asString(), context.getCurrentAddress(), authorizationResult.getExplanation()); } ModelNode commentNode = COMMENT.resolveModelAttribute(context, operation); ModelNode snapshotNode = SNAPSHOT_NAME.resolveModelAttribute(context, operation); String comment = commentNode.isDefined() ? commentNode.asString() : null; String snapshot = snapshotNode.isDefined() ? snapshotNode.asString() : null; try { String name = persister.snapshot(snapshot, comment); context.getResult().set(name); } catch (ConfigurationPersistenceException e) { throw new OperationFailedException(e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { AuthorizationResult authorizationResult = context.authorize(operation); if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerLogger.ROOT_LOGGER.unauthorized(operation.get(OP).asString(), context.getCurrentAddress(), authorizationResult.getExplanation()); } ModelNode commentNode = COMMENT.resolveModelAttribute(context, operation); ModelNode snapshotNode = SNAPSHOT_NAME.resolveModelAttribute(context, operation); String comment = commentNode.asStringOrNull(); String snapshot = snapshotNode.asStringOrNull(); try { String name = persister.snapshot(snapshot, comment); context.getResult().set(name); } catch (ConfigurationPersistenceException e) { throw new OperationFailedException(e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
Source:
public RevTag call() throws JGitInternalException, ConcurrentRefUpdateException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { TagBuilder newTag = new TagBuilder(); newTag.setTag(name); newTag.setMessage(message); newTag.setTagger(tagger); if (id == null) { ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); if (objectId == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); newTag.setObjectId(objectId, Constants.OBJ_COMMIT); } else { newTag.setObjectId(id); } ObjectInserter inserter = repo.newObjectInserter(); try { ObjectId tagId = inserter.insert(newTag); inserter.flush(); RevWalk revWalk = new RevWalk(repo); try { RevTag revTag = revWalk.parseTag(newTag.getTagId()); String refName = Constants.R_TAGS + newTag.getTag(); RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: case FORCED: return revTag; case LOCK_FAILURE: throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, tagRef.getRef(), updateResult); default: throw new JGitInternalException(MessageFormat.format( JGitText.get().updatingRefFailed, refName, newTag.toString(), updateResult)); } } finally { revWalk.release(); } } finally { inserter.release(); } } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfTagCommand, e); } }

Target:
public RevTag call() throws JGitInternalException, ConcurrentRefUpdateException, InvalidTagNameException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { TagBuilder newTag = new TagBuilder(); newTag.setTag(name); newTag.setMessage(message); newTag.setTagger(tagger); if (id == null) { ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); if (objectId == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); newTag.setObjectId(objectId, Constants.OBJ_COMMIT); } else { newTag.setObjectId(id); } ObjectInserter inserter = repo.newObjectInserter(); try { ObjectId tagId = inserter.insert(newTag); inserter.flush(); RevWalk revWalk = new RevWalk(repo); try { RevTag revTag = revWalk.parseTag(newTag.getTagId()); String refName = Constants.R_TAGS + newTag.getTag(); RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: case FORCED: return revTag; case LOCK_FAILURE: throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, tagRef.getRef(), updateResult); default: throw new JGitInternalException(MessageFormat.format( JGitText.get().updatingRefFailed, refName, newTag.toString(), updateResult)); } } finally { revWalk.release(); } } finally { inserter.release(); } } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfTagCommand, e); } }
Source:
private static INDArray buildArray(List<Integer> dimensions, String rawArray) { int rank = dimensions.size(); int[] shape = new int[rank]; for(int i = 0; i < rank; i++) { shape[i] = dimensions.get(i); } String[] entries = rawArray.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\\n", "").split(","); double[] entryValues = new double[entries.length]; for (int i = 0; i < entries.length; i++) { entryValues[i] = Double.parseDouble(entries[i]); } return Nd4j.create(entryValues, shape); }

Target:
private static INDArray buildArray(List<Integer> dimensions, String rawArray) { int[] shape = Ints.toArray(dimensions); String[] entries = StringUtils.replacePattern(rawArray, "[\\[\\]\\n]", "").split(","); double[] entryValues = new double[entries.length]; for (int i = 0; i < entries.length; i++) { entryValues[i] = Double.parseDouble(entries[i]); } return Nd4j.create(entryValues, shape); }
Source:
private static boolean prefixExists(SubfieldPath subfieldPath, Collection<SubfieldPath> subfieldPaths) { List<PathElement> path = subfieldPath.getPath(); for (SubfieldPath otherSubfiledPath : subfieldPaths) { List<PathElement> otherPath = otherSubfiledPath.getPath(); if (!otherPath.isEmpty() && otherPath.size() < path.size() && Objects.equals(otherPath, path.subList(0, otherPath.size()))) { return true; } } return false; }

Target:
private static boolean prefixExists(SubfieldPath subfieldPath, Collection<SubfieldPath> subfieldPaths) { return subfieldPaths.stream() .filter(path -> path.isPrefix(subfieldPath)) .findAny() .isPresent(); }
Source:
public void testBufferOverflow() throws MetacardCreationException { String metacardTypeName = "states"; Set<AttributeDescriptor> attributeDescriptors = new HashSet<>(1); String attributeName = Metacard.METADATA; attributeDescriptors.add(new CoreAttributes().getAttributeDescriptor(attributeName)); StringBuilder mockValue = new StringBuilder(); mockValue.append("<?xml version=\"1.1\" encoding=\"UTF-32\"?><metadata></metadata>"); Attribute mockAttribute = new AttributeImpl(Metacard.METADATA, mockValue.toString()); Metacard mockMetacard = mock(Metacard.class, RETURNS_DEEP_STUBS); when(mockMetacard.getMetacardType().getName()).thenReturn(metacardTypeName); when(mockMetacard.getMetacardType().getAttributeDescriptors()).thenReturn(attributeDescriptors); when(mockMetacard.getAttribute(attributeName)).thenReturn(mockAttribute); when(mockMetacard.getMetadata()).thenReturn(mockValue.toString()); SolrInputDocument mockSolrInputDocument = mock(SolrInputDocument.class); DynamicSchemaResolver resolver = new DynamicSchemaResolver() { @Override protected byte[] createTinyBinary(String xml) throws XMLStreamException, SaxonApiException, IOException { throw new BufferOverflowException(); } }; resolver.addFields(mockMetacard, mockSolrInputDocument); }

Target:
public void testBufferOverflow() throws MetacardCreationException { String metacardTypeName = "states"; Set<AttributeDescriptor> attributeDescriptors = new HashSet<>(1); String attributeName = Metacard.METADATA; attributeDescriptors.add(new CoreAttributes().getAttributeDescriptor(attributeName)); StringBuilder mockValue = new StringBuilder(); mockValue.append("<?xml version=\"1.1\" encoding=\"UTF-32\"?><metadata></metadata>"); Attribute mockAttribute = new AttributeImpl(Metacard.METADATA, mockValue.toString()); Metacard mockMetacard = mock(Metacard.class, RETURNS_DEEP_STUBS); when(mockMetacard.getMetacardType().getName()).thenReturn(metacardTypeName); when(mockMetacard.getMetacardType().getAttributeDescriptors()).thenReturn(attributeDescriptors); when(mockMetacard.getAttribute(attributeName)).thenReturn(mockAttribute); when(mockMetacard.getMetadata()).thenReturn(mockValue.toString()); SolrInputDocument mockSolrInputDocument = mock(SolrInputDocument.class); DynamicSchemaResolver resolver = new DynamicSchemaResolver( Collections.EMPTY_LIST, tinyTree -> { throw new BufferOverflowException(); }); resolver.addFields(mockMetacard, mockSolrInputDocument); verify(mockMetacard).getId(); verify(mockSolrInputDocument) .addField(eq(SchemaFields.METACARD_TYPE_OBJECT_FIELD_NAME), Matchers.any()); verify(mockSolrInputDocument, times(0)).addField(eq("lux_xml"), Matchers.any()); }
Source:
public Object execute(Object[] parameters) { KeyValueQuery<?> query = prepareQuery(parameters); if (this.isCount) { final Class<?> javaType = queryMethod.getEntityInformation().getJavaType(); if( this.isDistinct ){ Iterable<?> iterable = this.keyValueOperations.find(query, javaType); final List<?> list = IterableConverter.toList(iterable); List<?> result = collectDistinct(list); return result.size(); } else{ return this.keyValueOperations.count(query, javaType); } } if (this.isDelete) { return this.executeDeleteQuery(query, queryMethod); } if (queryMethod.isPageQuery() || queryMethod.isSliceQuery()) { return this.executePageSliceQuery(parameters, query, queryMethod); } if (queryMethod.isCollectionQuery() || queryMethod.isQueryForEntity() || queryMethod.isStreamQuery()) { return this.executeFindQuery(query, queryMethod, this.isDistinct); } String message = String.format("Query method '%s' not supported.", queryMethod.getName()); throw new UnsupportedOperationException(message); }

Target:
public Object execute(Object[] parameters) { KeyValueQuery<?> query = prepareQuery(parameters); if (this.isCount) { final Class<?> javaType = queryMethod.getEntityInformation().getJavaType(); if (this.isDistinct) { final Iterable<?> iterable = this.keyValueOperations.find(query, javaType); return StreamUtils.createStreamFromIterator(iterable.iterator()).distinct().count(); } else { return this.keyValueOperations.count(query, javaType); } } if (this.isDelete) { return this.executeDeleteQuery(query, queryMethod); } if (queryMethod.isPageQuery() || queryMethod.isSliceQuery()) { return this.executePageSliceQuery(parameters, query, queryMethod); } if (queryMethod.isCollectionQuery() || queryMethod.isQueryForEntity() || queryMethod.isStreamQuery()) { return this.executeFindQuery(query, queryMethod, this.isDistinct); } String message = String.format("Query method '%s' not supported.", queryMethod.getName()); throw new UnsupportedOperationException(message); }
Source:
private void invite(final Bout bout, final StringBuilder msg, final Href href) throws IOException { final Iterator<String> invite = href.param("invite").iterator(); while (invite.hasNext()) { final String friend = invite.next(); try { bout.friends().invite(friend); } catch (final Friends.UnknownAliasException ex) { this.discard(bout); throw new RsFailure(ex); } msg.append(String.format(", \"%s\" invited", friend)); } }

Target:
private void invite(final Bout bout, final StringBuilder msg, final Href href) throws IOException { final Iterator<String> invite = href.param("invite").iterator(); while (invite.hasNext()) { final String friend = invite.next(); try { bout.friends().invite(friend); msg.append( String.format(", the invitation sent to \"%s\"", friend) ); } catch (final Friends.UnknownAliasException ex) { this.discard(bout); throw new RsFailure(ex); } } }
Source:
private Map<PaxosAcceptor, ExecutorService> createLatestRoundVerifierExecutors( List<PaxosAcceptor> paxosAcceptors, Function<String, ExecutorService> executorServiceFactory) { Map<PaxosAcceptor, ExecutorService> executors = Maps.newHashMap(); for (int i = 0; i < paxosAcceptors.size(); i++) { executors.put(paxosAcceptors.get(i), executorServiceFactory.apply("lates-round-verifier-" + i)); } return executors; }

Target:
private Map<PaxosAcceptor, ExecutorService> createLatestRoundVerifierExecutors( List<PaxosAcceptor> paxosAcceptors, Function<String, ExecutorService> executorServiceFactory) { Map<PaxosAcceptor, ExecutorService> executors = Maps.newHashMap(); for (int i = 0; i < paxosAcceptors.size(); i++) { executors.put(paxosAcceptors.get(i), executorServiceFactory.apply("latest-round-verifier-" + i)); } return executors; }
Source:
private StudentProfileAttributes getProfileAttributesFrom( String[] submissionParams) { StudentProfileAttributes spa = StudentProfileAttributes.builder().build(); spa.shortName = StringHelper.trimIfNotNull(submissionParams[1]); spa.email = StringHelper.trimIfNotNull(submissionParams[3]); spa.institute = StringHelper.trimIfNotNull(submissionParams[5]); spa.nationality = StringHelper.trimIfNotNull(submissionParams[7]); try { spa.gender = GenderType.valueOf(submissionParams[9]); } catch (IllegalArgumentException iae) { iae.printStackTrace(); } spa.moreInfo = StringHelper.trimIfNotNull(submissionParams[11]); spa.modifiedDate = null; return spa; }

Target:
private StudentProfileAttributes getProfileAttributesFrom( String[] submissionParams) { StudentProfileAttributes spa = StudentProfileAttributes.builder().build(); spa.shortName = StringHelper.trimIfNotNull(submissionParams[1]); spa.email = StringHelper.trimIfNotNull(submissionParams[3]); spa.institute = StringHelper.trimIfNotNull(submissionParams[5]); spa.nationality = StringHelper.trimIfNotNull(submissionParams[7]); spa.gender = GenderType.valueOf(submissionParams[9]); spa.moreInfo = StringHelper.trimIfNotNull(submissionParams[11]); spa.modifiedDate = null; return spa; }
Source:
public default Number getReadable() { return 1; }

Target:
public default Number getReadable() { throw new UnsupportedOperationException(); }
Source:
public void testKafkaSourceAndSink() throws Exception { final String stringToPost = "Hi there!"; final HttpSource httpSource1 = newHttpSource(); final HttpSource httpSource2 = newHttpSource(); stream().create(generateStreamName(), "%s | kafka --topic='%s' --brokerList='%s'", httpSource1, topic1ToUse, kafkaTestSupport.getBrokerAddress()); stream().create(generateStreamName(), "%s | kafka --topic='%s' --brokerList='%s'", httpSource2, topic2ToUse, kafkaTestSupport.getBrokerAddress()); final CounterSink counter = metrics().newCounterSink(); stream().create(generateStreamName(), "kafka --topics='%s,%s' --zkconnect=%s --outputType=text/plain | " + "filter --expression=payload.toString().contains('%s') | %s", topic1ToUse, topic2ToUse, kafkaTestSupport.getZkConnectString(), stringToPost, counter ); httpSource1.ensureReady().postData(stringToPost); httpSource1.ensureReady().postData(stringToPost); assertThat(counter, eventually(exists())); assertThat(counter, eventually(hasValue("2"))); }

Target:
public void testKafkaSourceAndSink() throws Exception { final String stringToPost = "Hi there!"; final HttpSource httpSource = newHttpSource(); stream().create(generateStreamName(), "%s | kafka --topic='%s' --brokerList='%s'", httpSource, topic1ToUse, kafkaTestSupport.getBrokerAddress()); final CounterSink counter = metrics().newCounterSink(); stream().create(generateStreamName(), "kafka --topic='%s' --zkconnect=%s --outputType=text/plain | " + "filter --expression=payload.toString().contains('%s') | %s", topic1ToUse, kafkaTestSupport.getZkConnectString(), stringToPost, counter ); httpSource.ensureReady().postData(stringToPost); assertThat(counter, eventually(exists())); }
Source:
private ShardStats deleteShardsAndIndex(long tableId, Map<UUID, Optional<UUID>> oldShardUuidsMap, Set<UUID> oldDeltaUuidSet, Handle handle, boolean tableSupportsDeltaDelete) throws SQLException { if (tableSupportsDeltaDelete) { ShardStats shardStats = deleteShardsAndIndexWithDelta(tableId, oldShardUuidsMap, handle); long rowCount = shardStats.getRowCount(); long compressedSize = shardStats.getCompressedSize(); long uncompressedSize = shardStats.getUncompressedSize(); ShardStats deltaStats = deleteShardsAndIndexSimple(tableId, oldDeltaUuidSet, handle, true); rowCount -= deltaStats.getRowCount(); compressedSize += deltaStats.getCompressedSize(); uncompressedSize += deltaStats.getUncompressedSize(); return new ShardStats(rowCount, compressedSize, uncompressedSize); } else { Set<UUID> oldShardUuidSet = oldShardUuidsMap.keySet(); ShardStats stats = deleteShardsAndIndexSimple(tableId, oldShardUuidSet, handle, false); return stats; } }

Target:
private ShardStats deleteShardsAndIndex(long tableId, Map<UUID, Optional<UUID>> oldShardUuidsMap, Set<UUID> oldDeltaUuidSet, Handle handle, boolean tableSupportsDeltaDelete) throws SQLException { if (tableSupportsDeltaDelete) { ShardStats shardStats = deleteShardsAndIndexWithDelta(tableId, oldShardUuidsMap, handle); long rowCount = shardStats.getRowCount(); long compressedSize = shardStats.getCompressedSize(); long uncompressedSize = shardStats.getUncompressedSize(); ShardStats deltaStats = deleteShardsAndIndexSimple(tableId, oldDeltaUuidSet, handle, true); rowCount -= deltaStats.getRowCount(); compressedSize += deltaStats.getCompressedSize(); uncompressedSize += deltaStats.getUncompressedSize(); return new ShardStats(rowCount, compressedSize, uncompressedSize); } return deleteShardsAndIndexSimple(tableId, oldShardUuidsMap.keySet(), handle, false); }
Source:
protected Log getImplementation(final String name) { final Log log = LogFactory.getLog(name); if (log.getClass().getName().endsWith("Jdk14Logger")) { return null; } return log; }

Target:
protected Log getImplementation(final String name) { final Log log = LogFactory.getLog(name); if (log != null && log.getClass().getName().equals("org.apache.commons.logging.impl.Jdk14Logger")) { return null; } return log; }
Source:
CreditBasedSequenceNumberingViewReader( InputChannelID receiverId, int initialCredit, PartitionRequestQueue requestQueue) { this.receiverId = receiverId; this.numCreditsAvailable = initialCredit; this.requestQueue = requestQueue; this.withoutExclusiveCredits = initialCredit > 0; }

Target:
CreditBasedSequenceNumberingViewReader( InputChannelID receiverId, int initialCredit, PartitionRequestQueue requestQueue) { this.receiverId = receiverId; this.numCreditsAvailable = initialCredit; this.requestQueue = requestQueue; this.withoutExclusiveCredits = initialCredit == 0; }
Source:
public CompletionStage<Void> passivateAsync(InternalCacheEntry entry) { Object key; if (enabled && entry != null && !isL1Key(key = entry.getKey())) { if (notifier.hasListener(CacheEntryPassivated.class)) { return passivateListener(key, entry); } else { passivate(key, entry); } } return CompletableFutures.completedNull(); }

Target:
public CompletionStage<Void> passivateAsync(InternalCacheEntry entry) { Object key; if (enabled && entry != null && !isL1Key(key = entry.getKey())) { if (notifier.hasListener(CacheEntryPassivated.class)) { return notifier.notifyCacheEntryPassivated(key, entry.getValue(), true, ImmutableContext.INSTANCE, null) .thenCompose(v -> { if (doPassivate(key, entry)) { return notifier.notifyCacheEntryPassivated(key, null, false, ImmutableContext.INSTANCE, null); } return CompletableFutures.completedNull(); }); } else { doPassivate(key, entry); } } return CompletableFutures.completedNull(); }
Source:
public void testTransactionMetadataCleanup() throws Exception { try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) { queryRunner.execute("select count(*) from nation"); queryRunner.execute("select count(*) from lineitem"); assertTrue(queryRunner.getTransactionManager().getAllTransactionInfos().isEmpty()); assertThatThrownBy(() -> queryRunner.execute("SELECT non_existing_column FROM non_existing_table")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> queryRunner.execute("select * from unnest('wrong_type')")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> queryRunner.execute("select count(*) from nation tablesample BERNOULLI ('wrong_value')")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> queryRunner.execute("select regionkey from nation natural join region")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> queryRunner.execute("select regionkey from nation group by regionkey having 'wrong_condition'")) .isInstanceOf(RuntimeException.class); assertTrue(queryRunner.getTransactionManager().getAllTransactionInfos().isEmpty()); } }

Target:
public void testTransactionMetadataCleanup() throws Exception { try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) { queryRunner.execute("select count(*) from nation"); queryRunner.execute("select count(*) from lineitem"); assertTrue(queryRunner.getTransactionManager().getAllTransactionInfos().isEmpty()); assertThatThrownBy(() -> queryRunner.execute("SELECT non_existing_column FROM non_existing_table")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> queryRunner.execute("select * from unnest('wrong_type')")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> queryRunner.execute("select regionkey from nation group by regionkey having 'wrong_condition'")) .isInstanceOf(RuntimeException.class); assertTrue(queryRunner.getTransactionManager().getAllTransactionInfos().isEmpty()); assertThatThrownBy(() -> queryRunner.execute("select 1/0")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> queryRunner.execute("select regionkey / (regionkey - regionkey) from nation")) .isInstanceOf(RuntimeException.class); assertTrue(queryRunner.getTransactionManager().getAllTransactionInfos().isEmpty()); } }
Source:
private void generateActionMethod(Method method) { javaBuffer.addImport(Consumes.class); javaBuffer.addImport(POST.class); javaBuffer.addImport(Path.class); javaBuffer.addImport(Response.class); javaBuffer.addImport(javaPackages.getXjcPackageName(), "Action"); javaBuffer.addImport(javaPackages.getXjcPackageName(), "Actionable"); generateDoc(method); javaBuffer.addLine("@POST"); javaBuffer.addLine("@Consumes({ %s })", generateMediaTypes()); javaBuffer.addLine("@Actionable"); javaBuffer.addLine( "@Path(\"%s\")", jaxrsNames.getActionPath(method.getName()) ); javaBuffer.addLine(generateResponseReturnMethodSignature( jaxrsNames.getMethodName(method.getName()) + "(Action action)")); javaBuffer.addLine(); }

Target:
private void generateActionMethod(Method method) { javaBuffer.addImport(Consumes.class); javaBuffer.addImport(POST.class); javaBuffer.addImport(Path.class); javaBuffer.addImport(Response.class); javaBuffer.addImport(javaPackages.getXjcPackageName(), "Action"); javaBuffer.addImport(javaPackages.getXjcPackageName(), "Actionable"); generateDoc(method); javaBuffer.addLine("@POST"); javaBuffer.addLine("@Consumes({ %s })", generateMediaTypes()); javaBuffer.addLine("@Actionable"); javaBuffer.addLine( "@Path(\"%s\")", jaxrsNames.getActionPath(method.getName()) ); generateResponseReturnMethod(jaxrsNames.getMethodName(method.getName()) + "(Action action)"); javaBuffer.addLine(); }
Source:
private void saveColumnFamilyNames() throws IOException { final Path file = rocksdbDir.resolve(CF_NAMES_FILENAME); try(final PrintWriter writer = new PrintWriter(new OutputStreamWriter(Files.newOutputStream(file), UTF_8))) { writer.println(new String(RocksDB.DEFAULT_COLUMN_FAMILY, UTF_8)); for(final String cfName : COLUMN_FAMILIES.keySet()) { writer.println(cfName); } } }

Target:
private void saveColumnFamilyNames() throws IOException { final Path file = rocksDbDir.resolve(COLUMN_FAMILY_NAMES_FILENAME); try(final PrintWriter writer = new PrintWriter(Files.newBufferedWriter(file, UTF_8))) { writer.println(new String(RocksDB.DEFAULT_COLUMN_FAMILY, UTF_8)); for(final String cfName : COLUMN_FAMILIES.keySet()) { writer.println(cfName); } } }
Source:
private void init(String serviceName, String host, Integer port) { this.serviceName = serviceName; if (host != null && host.contains(":")) { final String[] hostParts = host.split(":"); int parsedPort = -1; try { parsedPort = Integer.parseInt(hostParts[1]); } catch (NumberFormatException e) { } if (port != null && port != parsedPort) { throw new IAE("Conflicting host:port [%s] and port [%d] settings", host, port); } host = hostParts[0]; port = parsedPort; } if (port == null && host != null) { port = SocketUtil.findOpenPort(8080); } this.port = port != null ? port : -1; this.host = host != null ? host : DEFAULT_HOST; }

Target:
private void init(String serviceName, String host, Integer port) { Preconditions.checkNotNull(serviceName); this.serviceName = serviceName; if(host == null && port == null) { host = DEFAULT_HOST; port = -1; } else { final HostAndPort hostAndPort; if (host != null) { hostAndPort = HostAndPort.fromString(host); if (port != null && hostAndPort.hasPort() && port != hostAndPort.getPort()) { throw new IAE("Conflicting host:port [%s] and port [%d] settings", host, port); } } else { hostAndPort = HostAndPort.fromParts(DEFAULT_HOST, port); } host = hostAndPort.getHostText(); if (hostAndPort.hasPort()) { port = hostAndPort.getPort(); } if (port == null) { port = SocketUtil.findOpenPort(8080); } } this.port = port; this.host = host; }
Source:
private void showConnectedDevices() { UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap<String, UsbDevice> devices = manager.getDeviceList(); StringBuilder builder = new StringBuilder(); if (devices.isEmpty()) { builder.append(getString(R.string.no_connected_devices)); } else { for (UsbDevice device : devices.values()) { builder.append( getString(R.string.usb_device_name_vendor_product, device.getDeviceName(), device.getVendorId(), device.getProductId() ) ); } } Toaster.newInstance(this).popBurntToast(builder.toString()); }

Target:
private void showConnectedDevices() { UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap<String, UsbDevice> devices = manager.getDeviceList(); StringBuilder builder = new StringBuilder(); if (devices.isEmpty()) { builder.append(getString(R.string.no_connected_devices)); } else { for (UsbDevice device : devices.values()) { builder.append( getString(R.string.usb_device_name_vendor_product, device.getDeviceName(), device.getVendorId(), device.getProductId() ) ).append("\n"); } } Toaster.newInstance(this).popBurntToast(builder.toString()); }
Source:
public void should_not_lookup_abuseC_if_rpsl_source_do_not_match() { databaseHelper.updateObject(RpslObject.parse( "inetnum: 173.0.0.0 - 173.255.255.255\n" + "org: ORG-TEST-1\n" + "netname: NN\n" + "status: OTHER\n" + "source: RIPE")); final String responseNoAbuseC = TelnetWhoisClient.queryLocalhost(QueryServer.port, "173.0.0.0"); assertFalse(responseNoAbuseC.contains("Abuse contact for '173.0.0.0 - 173.255.255.255' is 'abuse@ripe.net'")); databaseHelper.updateObject(RpslObject.parse( "inetnum: 173.0.0.0 - 173.255.255.255\n" + "org: ORG-TEST-1\n" + "netname: NN\n" + "status: OTHER\n" + "source: TEST")); final String response = TelnetWhoisClient.queryLocalhost(QueryServer.port, "173.0.0.0"); assertThat(response, containsString("% Abuse contact for '173.0.0.0 - 173.255.255.255' is 'abuse@ripe.net'")); }

Target:
public void should_not_lookup_abuseC_if_rpsl_source_do_not_match() { databaseHelper.updateObject(RpslObject.parse( "inetnum: 173.0.0.0 - 173.255.255.255\n" + "org: ORG-TEST-1\n" + "netname: NN\n" + "status: OTHER\n" + "source: NON-TEST")); final String responseNoAbuseC = TelnetWhoisClient.queryLocalhost(QueryServer.port, "173.0.0.0"); assertFalse(responseNoAbuseC.contains("Abuse contact for '173.0.0.0 - 173.255.255.255' is 'abuse@ripe.net'")); databaseHelper.updateObject(RpslObject.parse( "inetnum: 173.0.0.0 - 173.255.255.255\n" + "org: ORG-TEST-1\n" + "netname: NN\n" + "status: OTHER\n" + "source: TEST")); final String response = TelnetWhoisClient.queryLocalhost(QueryServer.port, "173.0.0.0"); assertThat(response, containsString("% Abuse contact for '173.0.0.0 - 173.255.255.255' is 'abuse@ripe.net'")); }
Source:
public void share(Context context){ String content = ""; if (isJoke()){ content = "Joke: "; } if (isFunFact()){ content = "Fun fact: "; } if (isFortune()){ content = "Fortune cookie: "; } if (isQuote()){ content = getAuthor() + ": \""; } content += getMessage(); if (isQuote()){ content += "\""; } Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, content); context.startActivity(Intent.createChooser(shareIntent, "Share via")); }

Target:
public void share(Context context){ String content = ""; if (isJoke()){ content = context.getString(R.string.reward_joke) + ": "; } if (isFunFact()){ content = context.getString(R.string.reward_fact) + ": "; } if (isFortune()){ content = context.getString(R.string.reward_fortune) + ": "; } if (isQuote()){ content = getAuthor() + ": \""; } content += getMessage(); if (isQuote()){ content += "\""; } Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, content); context.startActivity(Intent.createChooser( shareIntent, context.getString(R.string.reward_share_via) )); }
Source:
private List<UserGroup> loadUserGroups(String graphApiToken) throws IOException { String responseInJson = getUserMemberships(graphApiToken, Optional.empty()); final List<UserGroup> lUserGroups = new ArrayList<>(); final ObjectMapper objectMapper = JacksonObjectMapperFactory.getInstance(); objectMapper.registerModule(new Jdk8Module()); UserGroups groupsFromJson = objectMapper.readValue(responseInJson, UserGroups.class); if (groupsFromJson.getValue() != null) { lUserGroups.addAll(groupsFromJson.getValue().stream().filter(this::isMatchingUserGroupKey) .collect(Collectors.toList())); } while (groupsFromJson.getOdataNextLink().isPresent()) { responseInJson = getUserMemberships(graphApiToken, groupsFromJson.getOdataNextLink()); groupsFromJson = objectMapper.readValue(responseInJson, UserGroups.class); lUserGroups.addAll(groupsFromJson.getValue().stream().filter(this::isMatchingUserGroupKey) .collect(Collectors.toList())); } return lUserGroups; }

Target:
private List<UserGroup> loadUserGroups(String graphApiToken) throws IOException { String responseInJson = getUserMemberships(graphApiToken, null); final List<UserGroup> lUserGroups = new ArrayList<>(); final ObjectMapper objectMapper = JacksonObjectMapperFactory.getInstance(); UserGroups groupsFromJson = objectMapper.readValue(responseInJson, UserGroups.class); if (groupsFromJson.getValue() != null) { lUserGroups.addAll(groupsFromJson.getValue().stream().filter(this::isMatchingUserGroupKey) .collect(Collectors.toList())); } while (groupsFromJson.getOdataNextLink() != null) { responseInJson = getUserMemberships(graphApiToken, groupsFromJson.getOdataNextLink()); groupsFromJson = objectMapper.readValue(responseInJson, UserGroups.class); lUserGroups.addAll(groupsFromJson.getValue().stream().filter(this::isMatchingUserGroupKey) .collect(Collectors.toList())); } return lUserGroups; }
Source:
public void createEphemeral(String path) { throw new UnsupportedOperationException( "Create ephemeral nodes using " + SharedZkClient.class.getSimpleName() + " is not supported."); }

Target:
public void createEphemeral(String path) { throw new UnsupportedOperationException( "Creating ephemeral nodes using " + SharedZkClient.class.getSimpleName() + " is not supported."); }
Source:
protected boolean checkSqlEngineIndicatorExist() { for (ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) { if (modelElementIndicator.contains(IndicatorEnum.SqlPatternMatchingIndicatorEnum) || modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) && searchJUDI(modelElementIndicator, false)) { return true; } } return super.checkSqlEngineIndicatorExist(); }

Target:
protected boolean checkSqlEngineIndicatorExist() { for (ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) { if (modelElementIndicator.contains(IndicatorEnum.SqlPatternMatchingIndicatorEnum) || (modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) && searchJUDI( modelElementIndicator, false))) { return true; } } return super.checkSqlEngineIndicatorExist(); }
Source:
@Override public Type[] getParameterTypes() { return method.getParameterTypes(); }

Target:
public Class<?>[] getParameterTypes() { return method.getParameterTypes(); }
Source:
public void onPlayerChat(final AsyncPlayerChatEvent event) { final User user = ess.getUser(event.getPlayer()); if (user.isMuted()) { event.setCancelled(true); if (user.getMuteReason ().equals ("")) { user.sendMessage(tl("voiceSilenced")); } else { user.sendMessage(tl("voiceSilenced") + tl("muteFormat", user.getMuteReason ())); } LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage())); } try { final Iterator<Player> it = event.getRecipients().iterator(); while (it.hasNext()) { final User u = ess.getUser(it.next()); if (u.isIgnoredPlayer(user)) { it.remove(); } } } catch (UnsupportedOperationException ex) { if (ess.getSettings().isDebug()) { ess.getLogger().log(Level.INFO, "Ignore could not block chat due to custom chat plugin event.", ex); } else { ess.getLogger().info("Ignore could not block chat due to custom chat plugin event."); } } user.updateActivity(true); user.setDisplayNick(); }

Target:
public void onPlayerChat(final AsyncPlayerChatEvent event) { final User user = ess.getUser(event.getPlayer()); if (user.isMuted()) { event.setCancelled(true); user.sendMessage(user.hasMuteReason() ? tl("voiceSilencedReason", user.getMuteReason()) : tl("voiceSilenced")); LOGGER.info(tl("mutedUserSpeaks", user.getName(), event.getMessage())); } try { final Iterator<Player> it = event.getRecipients().iterator(); while (it.hasNext()) { final User u = ess.getUser(it.next()); if (u.isIgnoredPlayer(user)) { it.remove(); } } } catch (UnsupportedOperationException ex) { if (ess.getSettings().isDebug()) { ess.getLogger().log(Level.INFO, "Ignore could not block chat due to custom chat plugin event.", ex); } else { ess.getLogger().info("Ignore could not block chat due to custom chat plugin event."); } } user.updateActivity(true); user.setDisplayNick(); }
Source:
private static String listIndices(LibraryDilution dilution) { return String.join(", ", dilution.getLibrary().getIndices().stream().map(Index::getSequence).collect(Collectors.toList())); }

Target:
private static String listIndices(LibraryDilution dilution) { return dilution.getLibrary().getIndices().stream().map(Index::getSequence).collect(Collectors.joining(", ")); }
Source:
public DuplicateSet next() { if(!nextSetsIterator.hasNext()) process(wrappedIterator.next()); return nextSetsIterator.next(); }

Target:
public DuplicateSet next() { if (!nextSetsIterator.hasNext()) { process(wrappedIterator.next()); } return nextSetsIterator.next(); }
Source:
public TestHiveDistributedQueries() { super(() -> createQueryRunner( getTables(), ImmutableMap.of("internal-communication.task-communication-protocol", "THRIFT"), ImmutableMap.of(), Optional.empty())); }

Target:
public TestHiveDistributedQueries() { super(() -> createQueryRunner(getTables())); }
Source:
private static void clean(ByteBuffer buffer) { if (!buffer.isDirect()) { throw new IllegalArgumentException("Unmapping only works with direct buffers"); } if (UNMAP == null) { throw UNMAP_NOT_SUPPORTED_EXCEPTION; } try { UNMAP.invokeExact(buffer); } catch (Throwable throwable) { throw new RuntimeException("Unable to unmap the mapped buffer", throwable); } }

Target:
private static void clean(ByteBuffer buffer) { if (!buffer.isDirect()) { throw new IllegalArgumentException("Unmapping only works with direct buffers"); } if (UNMAP == null) { throw new UnsupportedOperationException(UNMAP_NOT_SUPPORTED_EXCEPTION); } try { UNMAP.invokeExact(buffer); } catch (Throwable throwable) { throw new RuntimeException("Unable to unmap the mapped buffer", throwable); } }
Source:
public String getErrorMessage() { if (getError().isPresent()) { return getError().get().getMessage(); } return ""; }

Target:
public Optional<String> getErrorMessage() { return getError().map(error -> error.getMessage()); }
Source:
private void resultsHide() { if (!resultsShowing) { return; } if (!isMultiple) { selectedItem.removeClass(css.chznSingleWithDrop()); } resultClearHighlight(); fireEvent(new HidingDropDownEvent(this)); dropdown.css("display", "none"); resultsShowing = false; }

Target:
private void resultsHide() { if (!resultsShowing) { return; } if (!isMultiple) { selectedItem.removeClass(css.chznSingleWithDrop()); } resultClearHighlight(); fireEvent(new HidingDropDownEvent(this)); dropdown.css(isRTL ? "right" : "left", HORIZONTAL_OFFSET + "px"); dropdown.css("top", VERTICAL_OFFSET + "px"); resultsShowing = false; }
Source:
protected Map<String, String> getInternalAddressesAndPorts(ContainerInfo containerInfo, String internalHost) { String internalAddressContainer = containerInfo.getNetworkSettings().getIpAddress(); String internalAddress; if (useContainerAddress) { internalAddress = !isNullOrEmpty(internalAddressContainer) ? internalAddressContainer : internalHost; } else { internalAddress = internalAddressProperty != null ? internalAddressProperty : internalHost; } boolean useExposedPorts = useContainerAddress && internalAddress != internalHost; return getExposedPortsToAddressPorts(internalAddress, containerInfo.getNetworkSettings().getPorts(), useExposedPorts); }

Target:
protected Map<String, String> getInternalAddressesAndPorts(ContainerInfo containerInfo, String internalHost) { final String internalAddressContainer = containerInfo.getNetworkSettings().getIpAddress(); final String internalAddress; if (useContainerAddress) { internalAddress = !isNullOrEmpty(internalAddressContainer) ? internalAddressContainer : internalHost; } else { internalAddress = cheDockerIp != null ? cheDockerIp : internalHost; } boolean useExposedPorts = useContainerAddress && internalAddress != internalHost; return getExposedPortsToAddressPorts(internalAddress, containerInfo.getNetworkSettings().getPorts(), useExposedPorts); }
Source:
void testbuildVendorDetailExtensionForeignFormEmpty() { conversionService.setPaymentWorksFormModeService(buildMockPaymentWorksFormModeService(true)); PaymentWorksVendor pmwVendor = new PaymentWorksVendor(); pmwVendor.setRequestingCompanyTaxCountry(ARUBA_ISO_CODE); pmwVendor.setPaymentMethod(StringUtils.EMPTY); try { conversionService.buildVendorDetailExtension(pmwVendor, buildPaymentWorksIsoToFipsCountryMap()); } catch (IllegalArgumentException iae) { assertTrue(true, "expected illegal argument exception"); return; } assertTrue(false, "expected illegal argument exception"); }

Target:
void testbuildVendorDetailExtensionForeignFormEmpty() { conversionService.setPaymentWorksFormModeService(buildMockPaymentWorksFormModeService(true)); PaymentWorksVendor pmwVendor = new PaymentWorksVendor(); pmwVendor.setRequestingCompanyTaxCountry(ARUBA_ISO_CODE); pmwVendor.setPaymentMethod(StringUtils.EMPTY); try { conversionService.buildVendorDetailExtension(pmwVendor, buildPaymentWorksIsoToFipsCountryMap()); fail("With no payment method provided, an Illegal Argument Exception should have been thrown."); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } }
Source:
private void validateMetatags(File templateFile) throws IOException { Document doc = Jsoup.parse(templateFile, null, ""); Elements metatagsWithCharsetAttribute = doc.select("meta[charset]"); if (metatagsWithCharsetAttribute.isEmpty() || metatagsWithCharsetAttribute.size() > 1) { throw new APIException("radiology.report.template.validation.error", null, new Throwable("Template file should have exactly one meta element with charset attribute")); } Elements dublinAttributes = doc.select("meta[name]"); if (dublinAttributes.isEmpty()) { throw new APIException("radiology.report.template.validation.error", null, new Throwable("Template file should have at least one meta tag containing dublin core attributes")); } }

Target:
private void validateMetatags(File templateFile) throws IOException { final Document doc = Jsoup.parse(templateFile, null, ""); final Elements metatagsWithCharsetAttribute = doc.select("meta[charset]"); if (metatagsWithCharsetAttribute.isEmpty() || metatagsWithCharsetAttribute.size() > 1) { throw new APIException("radiology.report.template.validation.error.meta.charset"); } final Elements dublinAttributes = doc.select("meta[name]"); if (dublinAttributes.isEmpty()) { throw new APIException("radiology.report.template.validation.error.meta.dublinCore"); } }
Source:
public boolean isStartingPosition() { return false; }

Target:
public boolean isStartingPosition() { return square.hasProperty(PropertyType.STARTING_POSITION); }
Source:
public void showClientIdentifiers(List<Identifier> identifiers) { if (ll_error.getVisibility() == View.VISIBLE) { ll_error.setVisibility(View.GONE); } this.identifiers = identifiers; identifierListAdapter.setIdentifiers(identifiers); }

Target:
public void showClientIdentifiers(List<Identifier> identifiers) { if (llError.getVisibility() == View.VISIBLE) { llError.setVisibility(View.GONE); } this.identifiers = identifiers; identifierListAdapter.setIdentifiers(identifiers); }
Source:
public List<ServicePort> getServicePortsFrom(Set<String> exposedPorts) { List<ServicePort> servicePorts = new ArrayList<>(); for (String exposedPort : exposedPorts) { String[] portAndProtocol = exposedPort.split("/", 2); String port = portAndProtocol[0]; String protocol = portAndProtocol[1]; int portNumber = Integer.parseInt(port); String portName = CheServicePorts.get().get(portNumber); portName = isNullOrEmpty(portName) ? exposedPort.replace("/", "-") : portName; int targetPortNumber = portNumber; ServicePort servicePort = new ServicePort(); servicePort.setName(portName); servicePort.setProtocol(protocol); servicePort.setPort(portNumber); servicePort.setTargetPort(new IntOrString(targetPortNumber)); servicePorts.add(servicePort); } return servicePorts; }

Target:
public List<ServicePort> getServicePortsFrom(Set<String> exposedPorts) { List<ServicePort> servicePorts = new ArrayList<>(exposedPorts.size()); for (String exposedPort : exposedPorts) { String[] portAndProtocol = exposedPort.split("/", 2); String port = portAndProtocol[0]; String protocol = portAndProtocol[1]; int portNumber = Integer.parseInt(port); String portName = CheServicePorts.get().get(portNumber); portName = isNullOrEmpty(portName) ? exposedPort.replace("/", "-") : portName; int targetPortNumber = portNumber; ServicePort servicePort = new ServicePort(); servicePort.setName(portName); servicePort.setProtocol(protocol); servicePort.setPort(portNumber); servicePort.setTargetPort(new IntOrString(targetPortNumber)); servicePorts.add(servicePort); } return servicePorts; }