auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof TreePath) { element = ((TreePath) element).getLastSegment(); } if (element instanceof EntityDefinition) { EntityDefinition entityDef = (EntityDefinition) element; Definition<?> def = entityDef.getDefinition(); if (def instanceof PropertyDefinition) { Cardinality cardinality = ((PropertyDefinition) def) .getConstraint(Cardinality.class); return !(cardinality.getMinOccurs() == 0 && ((PropertyDefinition) def) .getConstraint(NillableFlag.class).isEnabled()); } } return true; }

Target:
public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof TreePath) { element = ((TreePath) element).getLastSegment(); } if (element instanceof EntityDefinition) { EntityDefinition entityDef = (EntityDefinition) element; Definition<?> def = entityDef.getDefinition(); if (def instanceof PropertyDefinition) { Cardinality cardinality = ((PropertyDefinition) def) .getConstraint(Cardinality.class); if (cardinality.getMinOccurs() == 0) return false; if (((PropertyDefinition) def).getConstraint(NillableFlag.class).isEnabled()) { return !areChildrenOptional(entityDef); } } } return true; }
Source:
public void makeDiscoverablePatchUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .makeUnDiscoverable() .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", "true"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient().perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnauthorized()); getClient(token).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(false))); }

Target:
public void makeDiscoverablePatchUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .makeUnDiscoverable() .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", true); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient().perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnauthorized()); getClient(token).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(false))); }
Source:
public List<OtherCanonicalAlignment> getOtherCanonicalAlignments() { String xp=this.getStringAttribute(ReservedTagConstants.SA); if(xp==null) return Collections.emptyList(); String ss[]=xp.split("[;]"); List<OtherCanonicalAlignment> L=new ArrayList<OtherCanonicalAlignment>(ss.length); for(String s:ss) { if(s.isEmpty()) continue; String tokens[]=s.split("[,]"); if(tokens.length!=6) { String msg="Cannot extract OtherCanonicalAlignment from "+s+" expected 6 tokens, got "+tokens.length; switch(this.getValidationStringency()) { case STRICT:throw new SAMFormatException(msg); case LENIENT:System.err.println(msg);break; default:break; } continue; } OtherCanonicalAlignmentImpl aln=new OtherCanonicalAlignmentImpl(); aln.reference=tokens[0]; aln.pos=Integer.parseInt(tokens[1]); aln.strand=tokens[2].charAt(0); aln.cigarStr=tokens[3]; aln.mapq=Integer.parseInt(tokens[4]); aln.nm=Integer.parseInt(tokens[5]); L.add(aln); } return L; }

Target:
public List<SAMRecord> getOtherCanonicalAlignments() { final Pattern semiColonRegex = Pattern.compile("[;]"); final Pattern commaRegex = Pattern.compile("[,]"); final DefaultSAMRecordFactory samRecordFactory=new DefaultSAMRecordFactory(); String saAttribute = this.getStringAttribute(ReservedTagConstants.SA); if(saAttribute==null) return Collections.emptyList(); String otherAlignments[] = semiColonRegex.split(saAttribute); List<SAMRecord> returnedList = new ArrayList<SAMRecord>(otherAlignments.length); for(String alignAsString : otherAlignments) { if(alignAsString.isEmpty()) continue; String tokens[]=commaRegex.split(alignAsString); if(tokens.length!=6) { String msg="Cannot extract OtherCanonicalAlignment from "+alignAsString+ " expected 6 tokens, got "+tokens.length; switch(this.getValidationStringency()) { case STRICT:throw new SAMFormatException(msg); case LENIENT:System.err.println(msg);break; default:break; } continue; } SAMRecord aln=samRecordFactory.createSAMRecord(this.getHeader()); aln.setSupplementaryAlignmentFlag(true); aln.setMappingQuality(Integer.parseInt(tokens[4])); aln.setReadNegativeStrandFlag(tokens[2].equals("-")); aln.setReferenceName(tokens[0]); aln.setReadName(this.getReadName()); aln.setAlignmentStart(Integer.parseInt(tokens[1])); aln.setAttribute("NM", Integer.parseInt(tokens[5])); aln.setCigarString(tokens[3]); aln.setReadBases(this.getReadBases()); aln.setBaseQualities(this.getBaseQualities()); aln.setFileSource(this.getFileSource()); returnedList.add(aln); } return returnedList; }
Source:
public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean recycleBuffer = true; try { if (isReleased.get()) { return; } if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } if (inputGate.bufferReceivedListener != null) { CheckpointBarrier checkpointBarrier = parseCheckpointBarrier(buffer); if (checkpointBarrier == null) { inputGate.bufferReceivedListener.notifyBufferReceived(buffer, channelInfo); } else { inputGate.bufferReceivedListener.notifyBarrierReceived(checkpointBarrier, channelInfo); } } final boolean wasEmpty; synchronized (receivedBuffers) { wasEmpty = receivedBuffers.isEmpty(); receivedBuffers.add(buffer); recycleBuffer = false; } ++expectedSequenceNumber; if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } } finally { if (recycleBuffer) { buffer.recycleBuffer(); } } }

Target:
public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean recycleBuffer = true; try { if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } final boolean wasEmpty; final CheckpointBarrier notifyReceivedBarrier; final Buffer notifyReceivedBuffer; final BufferReceivedListener listener = inputGate.getBufferReceivedListener(); synchronized (receivedBuffers) { if (isReleased.get()) { return; } wasEmpty = receivedBuffers.isEmpty(); receivedBuffers.add(buffer); if (listener != null && buffer.isBuffer() && receivedCheckpointId < lastRequestedCheckpointId) { notifyReceivedBuffer = buffer.retainBuffer(); } else { notifyReceivedBuffer = null; } notifyReceivedBarrier = listener != null ? parseCheckpointBarrierOrNull(buffer) : null; } recycleBuffer = false; ++expectedSequenceNumber; if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } if (notifyReceivedBarrier != null) { receivedCheckpointId = notifyReceivedBarrier.getId(); listener.notifyBarrierReceived(notifyReceivedBarrier, channelInfo); } else if (notifyReceivedBuffer != null) { listener.notifyBufferReceived(notifyReceivedBuffer, channelInfo); } } finally { if (recycleBuffer) { buffer.recycleBuffer(); } } }
Source:
public static List<EObject> getNonUnionSupersetReferences(EReference reference) { return Lists.newArrayList(Iterables.filter(getSupersetReferences(reference), new KeepOnlyNonUnionEReferences())); }

Target:
public static Iterable<EReference> getNonUnionSupersetReferences(EReference reference) { return Iterables.filter(getSupersetReferences(reference), isNonUnionReference()); }
Source:
private Set<GlusterVolumeEntity> getUpVolumesWithSuggestedCapacityAndNotInMasterCluster(GlusterVolumeEntity masterVolume) { Set<GlusterVolumeEntity> eligibleVolumeList = new HashSet<GlusterVolumeEntity>(); List<VDSGroup> vdsGroups = getVdsGroupDao().getAll(); VDSGroup masterVdsGroup = getVdsGroupDao().get(masterVolume.getClusterId()); for (VDSGroup vdsGroup : vdsGroups) { if (vdsGroup.getId() != masterVolume.getClusterId() && vdsGroup.getcompatibility_version().equals(masterVdsGroup.getcompatibility_version()) && vdsGroup.supportsGlusterService()) { List<GlusterVolumeEntity> volumes = getGlusterVolumeDao().getByClusterId(vdsGroup.getId()); for (GlusterVolumeEntity volume : volumes) { if (volume.getStatus() == GlusterStatus.UP) { if (volume.getAdvancedDetails().getCapacityInfo()!= null && masterVolume.getAdvancedDetails().getCapacityInfo()!= null) { if(volume.getAdvancedDetails().getCapacityInfo().getTotalSize() != null && masterVolume.getAdvancedDetails().getCapacityInfo().getTotalSize() != null && volume.getAdvancedDetails().getCapacityInfo().getTotalSize() >= masterVolume.getAdvancedDetails().getCapacityInfo().getTotalSize()) { eligibleVolumeList.add(volume); } } } } } } return eligibleVolumeList; }

Target:
private Set<GlusterVolumeEntity> getUpVolumesWithSuggestedCapacityAndNotInMasterCluster(GlusterVolumeEntity masterVolume) { Set<GlusterVolumeEntity> eligibleVolumeList = new HashSet<GlusterVolumeEntity>(); VDSGroup masterVdsGroup = getVdsGroupDao().get(masterVolume.getClusterId()); List<VDSGroup> vdsGroups = getVdsGroupDao().getClustersByServiceAndCompatibilityVersion(true, false, masterVdsGroup.getcompatibility_version()); for (VDSGroup vdsGroup : vdsGroups) { if (!vdsGroup.getId().equals(masterVolume.getClusterId())) { List<GlusterVolumeEntity> volumes = getGlusterVolumeDao().getByClusterId(vdsGroup.getId()); for (GlusterVolumeEntity volume : volumes) { if (volume.getStatus() == GlusterStatus.UP) { if (volume.getAdvancedDetails().getCapacityInfo()!= null && masterVolume.getAdvancedDetails().getCapacityInfo()!= null) { if(volume.getAdvancedDetails().getCapacityInfo().getTotalSize() != null && masterVolume.getAdvancedDetails().getCapacityInfo().getTotalSize() != null && volume.getAdvancedDetails().getCapacityInfo().getTotalSize() >= masterVolume.getAdvancedDetails().getCapacityInfo().getTotalSize()) { eligibleVolumeList.add(volume); } } } } } } return eligibleVolumeList; }
Source:
public IndexDefinition apply(boolean useStateFromBuilder) { IndexFormatVersion version = IndexDefinition.determineVersionForFreshIndex(definitionBuilder); definitionBuilder.setProperty(IndexDefinition.INDEX_VERSION, version.getVersion()); NodeState defnState = useStateFromBuilder ? definitionBuilder.getNodeState() : definitionBuilder.getBaseState(); if (!IndexDefinition.isDisableStoredIndexDefinition()) { definitionBuilder.setChildNode(INDEX_DEFINITION_NODE, NodeStateCloner.cloneVisibleState(defnState)); if (definitionBuilder.getChildNode(STATUS_NODE).exists()) { definitionBuilder.getChildNode(STATUS_NODE).removeProperty(REINDEX_COMPLETION_TIMESTAMP); log.info(REINDEX_COMPLETION_TIMESTAMP + " property removed for index at {}", this.indexPath); } } String uid = configureUniqueId(definitionBuilder); return indexDefBuilder .root(root) .defn(defnState) .indexPath(indexPath) .version(version) .uid(uid) .reindex() .build(); }

Target:
public IndexDefinition apply(boolean useStateFromBuilder) { IndexFormatVersion version = IndexDefinition.determineVersionForFreshIndex(definitionBuilder); definitionBuilder.setProperty(IndexDefinition.INDEX_VERSION, version.getVersion()); NodeState defnState = useStateFromBuilder ? definitionBuilder.getNodeState() : definitionBuilder.getBaseState(); if (!IndexDefinition.isDisableStoredIndexDefinition()) { definitionBuilder.setChildNode(INDEX_DEFINITION_NODE, NodeStateCloner.cloneVisibleState(defnState)); if (definitionBuilder.getChildNode(STATUS_NODE).exists()) { definitionBuilder.getChildNode(STATUS_NODE).removeProperty(REINDEX_COMPLETION_TIMESTAMP); LOG.info("{} property removed for index at {}", REINDEX_COMPLETION_TIMESTAMP, this.indexPath); } } String uid = configureUniqueId(definitionBuilder); return indexDefBuilder .root(root) .defn(defnState) .indexPath(indexPath) .version(version) .uid(uid) .reindex() .build(); }
Source:
public synchronized long requestMemoryRevoking() { boolean alreadyRequested = isMemoryRevokingRequested(); if (!alreadyRequested && revocableMemoryReservation > 0) { memoryRevokingRequested.set(true); runListener(); return revocableMemoryReservation; } return 0; }

Target:
public long requestMemoryRevoking() { long revokedMemory = 0L; Runnable listener = null; synchronized (this) { if (!isMemoryRevokingRequested() && revocableMemoryReservation > 0) { memoryRevokingRequested = true; revokedMemory = revocableMemoryReservation; listener = memoryRevocationRequestListener; } } if (listener != null) { runListener(listener); } return revokedMemory; }
Source:
public HttpLatencyDetector build() { HttpLatencyDetector result = new HttpLatencyDetector(); if (urlSensor!=null) { result.urlSensor = urlSensor; if (urlPostProcessing!=null) result.urlPostProcessing = urlPostProcessing; if (url!=null) throw new IllegalStateException("Cannot set URL and UrlSensor"); } else { result.url.set(url); } result.rollupPeriod = rollupWindowSize; return result; }

Target:
public HttpLatencyDetector build() { HttpLatencyDetector result = new HttpLatencyDetector(); if (periodMillis!=null) result.periodMillis = periodMillis; if (requireServiceUp!=null) result.requireServiceUp = requireServiceUp; if (urlSensor!=null) { result.urlSensor = urlSensor; if (urlPostProcessing!=null) result.urlPostProcessing = urlPostProcessing; if (url!=null) throw new IllegalStateException("Cannot set URL and UrlSensor"); } else { result.url.set(url); } result.rollupPeriod = rollupWindowSize; return result; }
Source:
public boolean equals(Object other) { if (other == null) { return false; } if (!(other instanceof Principal)) { return false; } if (this.name.equals(everyone) || ((Principal) other).getName().equals(everyone)) { return true; } return ((Principal) other).getName().equals(name); }

Target:
public boolean equals(Object other) { if (other instanceof Principal) { if (other == this) { return true; } if (this.getName().equals(EVERYONE_PRINCIPAL_NAME)) { return true; } Principal that = (Principal) other; return this.getName().equals(that.getName()); } return false; }
Source:
public static Path getAppDataRoot() { if (APP_DATA_ROOT == null) { throw new RuntimeException("Missing required application data root"); } return APP_DATA_ROOT; }

Target:
public static Path getAppDataRoot() { if (APP_DATA_ROOT == null) { throw new IllegalStateException("Missing required application data root"); } return APP_DATA_ROOT; }
Source:
public void onConfigChanged(OnConfigChangedEvent event) { if (getMetadata().modId.equals(event.getModID())) { if ("chunkLoader".equals(event.getConfigID())) { ForgeChunkManager.syncConfigDefaults(); ForgeChunkManager.loadConfiguration(); } else { if (event.isWorldRunning()) { boolean tmp = config.get(Configuration.CATEGORY_CLIENT, "disableStairSlabCulling", disableStairSlabCulling).getBoolean(); if (disableStairSlabCulling != tmp) { disableStairSlabCulling = tmp; FMLCommonHandler.instance().reloadRenderers(); } } syncConfig(false); } } }

Target:
public void onConfigChanged(OnConfigChangedEvent event) { if (getMetadata().modId.equals(event.getModID())) { if ("chunkLoader".equals(event.getConfigID())) { ForgeChunkManager.syncConfigDefaults(); ForgeChunkManager.loadConfiguration(); } else { boolean tmpStairs = disableStairSlabCulling; syncConfig(false); if (event.isWorldRunning() && tmpStairs != disableStairSlabCulling) { FMLCommonHandler.instance().reloadRenderers(); } } } }
Source:
public Object postProcess(Message<?> message, Object result) { if (result == null) { if (StringUtils.hasText(this.discardChannelName)) { synchronized (this) { if (this.discardChannelName != null) { try { this.discardChannel = this.getBeanFactory() .getBean(this.discardChannelName, MessageChannel.class); this.discardChannelName = null; } catch (BeansException e) { throw new DestinationResolutionException("Failed to look up MessageChannel with name '" + this.discardChannelName + "' in the BeanFactory."); } } } } if (this.discardChannel != null) { this.getMessagingTemplate().send(this.discardChannel, message); } if (this.throwExceptionOnRejection) { throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message"); } } return result; }

Target:
public Object postProcess(Message<?> message, Object result) { if (result == null) { if (this.discardChannelName != null) { synchronized (this) { if (this.discardChannelName != null) { try { this.discardChannel = this.getBeanFactory() .getBean(this.discardChannelName, MessageChannel.class); this.discardChannelName = null; } catch (BeansException e) { throw new DestinationResolutionException("Failed to look up MessageChannel with name '" + this.discardChannelName + "' in the BeanFactory."); } } } } if (this.discardChannel != null) { this.getMessagingTemplate().send(this.discardChannel, message); } if (this.throwExceptionOnRejection) { throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message"); } } return result; }
Source:
public Collection<GameProfile> match(String lastKnownName) { lastKnownName = checkNotNull(lastKnownName, "lastKnownName").toLowerCase(Locale.ROOT); Collection<GameProfile> allProfiles = UserDiscoverer.getAllProfiles(); Collection<GameProfile> matching = Sets.newHashSet(); for (GameProfile profile : allProfiles) { Optional<String> name = profile.getName().map(n -> n.toLowerCase(Locale.ROOT)); if (name.isPresent() && name.get().startsWith(lastKnownName)) { matching.add(profile); } } return matching; }

Target:
public Collection<GameProfile> match(String lastKnownName) { lastKnownName = checkNotNull(lastKnownName, "lastKnownName").toLowerCase(Locale.ROOT); Collection<GameProfile> allProfiles = UserDiscoverer.getAllProfiles(); Collection<GameProfile> matching = Sets.newHashSet(); for (GameProfile profile : allProfiles) { Optional<String> name = profile.getName(); if (name.isPresent() && name.get().toLowerCase(Locale.ROOT).startsWith(lastKnownName)) { matching.add(profile); } } return matching; }
Source:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(1) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<HudsonModelJob>(); List<Object> jobsNodes = hudson.getJob(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonModelJob.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); job.setUrl(jobUrl); buildPlans.add(job); } else { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }

Target:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(1) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<HudsonModelJob>(); List<Object> jobsNodes = hudson.getJob(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonModelJob.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); job.setUrl(jobUrl); buildPlans.add(job); } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }
Source:
private void loadChildEntities(KitDescriptor kitDescriptor) throws IOException { for (TargetedSequencing ts : kitDescriptor.getTargetedSequencing()) { if (ts != null && ts.getId() != TargetedSequencing.UNSAVED_ID) { kitDescriptor.addTargetedSequencing(targetedSequencingService.get(ts.getId())); } } }

Target:
private void loadChildEntities(KitDescriptor kitDescriptor) throws IOException { Set<TargetedSequencing> maybeManaged = Sets.newHashSet(kitDescriptor.getTargetedSequencing()); kitDescriptor.clearTargetedSequencing(); for (TargetedSequencing ts : maybeManaged) { if (ts != null && ts.getId() != TargetedSequencing.UNSAVED_ID) { kitDescriptor.addTargetedSequencing(targetedSequencingService.get(ts.getId())); } } }
Source:
public void testImportWithoutPadding() throws IOException { if(failWithoutExtraArgs){ thrown.expect(IOException.class); thrown.expectMessage("Failure during job; return status 1"); NumericTypesTestUtils.configureJunitToExpectFailure(thrown); } ArgumentArrayBuilder builder = getArgsBuilder(); String[] args = builder.build(); runImport(args); if (!failWithoutExtraArgs) { verify(); } }

Target:
public void testImportWithoutPadding() throws IOException { if(failWithoutExtraArgs){ NumericTypesTestUtils.configureJunitToExpectFailure(thrown); } ArgumentArrayBuilder builder = getArgsBuilder(); String[] args = builder.build(); runImport(args); if (!failWithoutExtraArgs) { verify(); } }
Source:
public synchronized void updateTableStatistics(String databaseName, String tableName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = getTableStatistics(databaseName, tableName); PartitionStatistics updatedStatistics = update.apply(currentStatistics); Table metastoreApiTable = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); metastoreApiTable.setParameters(updateStatisticParameters(metastoreApiTable.getParameters(), updatedStatistics.getBasicStatistics())); alterTable(databaseName, tableName, metastoreApiTable); com.facebook.presto.hive.metastore.Table table = fromMetastoreApiTable(metastoreApiTable); List<ColumnStatisticsObj> metastoreColumnStatistics = updatedStatistics.getColumnStatistics().entrySet() .stream() .map(entry -> createMetastoreColumnStatistics(entry.getKey(), table.getColumn(entry.getKey()).get().getType(), entry.getValue())) .collect(toImmutableList()); if (!metastoreColumnStatistics.isEmpty()) { setTableColumnStatistics(databaseName, tableName, metastoreColumnStatistics); } Set<String> removedColumnStatistics = difference(currentStatistics.getColumnStatistics().keySet(), updatedStatistics.getColumnStatistics().keySet()); removedColumnStatistics.forEach(column -> deleteTableColumnStatistics(databaseName, tableName, column)); }

Target:
public synchronized void updateTableStatistics(String databaseName, String tableName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = getTableStatistics(databaseName, tableName); PartitionStatistics updatedStatistics = update.apply(currentStatistics); Table originalTable = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); Table modifiedTable = originalTable.deepCopy(); modifiedTable.setParameters(updateStatisticParameters(modifiedTable.getParameters(), updatedStatistics.getBasicStatistics())); alterTable(databaseName, tableName, modifiedTable); com.facebook.presto.hive.metastore.Table table = fromMetastoreApiTable(modifiedTable); List<ColumnStatisticsObj> metastoreColumnStatistics = updatedStatistics.getColumnStatistics().entrySet().stream() .map(entry -> createMetastoreColumnStatistics(entry.getKey(), table.getColumn(entry.getKey()).get().getType(), entry.getValue())) .collect(toImmutableList()); if (!metastoreColumnStatistics.isEmpty()) { setTableColumnStatistics(databaseName, tableName, metastoreColumnStatistics); } Set<String> removedColumnStatistics = difference(currentStatistics.getColumnStatistics().keySet(), updatedStatistics.getColumnStatistics().keySet()); removedColumnStatistics.forEach(column -> deleteTableColumnStatistics(databaseName, tableName, column)); }
Source:
public void playFile(String fileName, String sink, PercentType volume) throws AudioException { if (fileName == null) { throw new NullPointerException("File cannot be played as fileName is null."); } File file = new File( ConfigConstants.getConfigFolder() + File.separator + SOUND_DIR + File.separator + fileName); FileAudioStream is = new FileAudioStream(file); play(is, sink, volume); }

Target:
public void playFile(String fileName, String sink, PercentType volume) throws AudioException { Objects.requireNonNull(fileName, "File cannot be played as fileName is null."); File file = new File( ConfigConstants.getConfigFolder() + File.separator + SOUND_DIR + File.separator + fileName); FileAudioStream is = new FileAudioStream(file); play(is, sink, volume); }
Source:
protected void handlePythonReadinessChange(boolean ready) { boolean wasPythonReady = pythonReady; firePropertyChange(PYTHON_READINESS_PROPERTY, pythonReady, pythonReady = ready); if (ready == false && wasPythonReady != ready) { CompletableFuture.runAsync(() -> { try { cleanUp(); setUpPythonThread(); } catch(IOException e) { LOG.error("Failed to load Python"); LOG.error(e); try { Thread.sleep(1000); } catch (InterruptedException e1) { LOG.error(e); } handlePythonReadinessChange(ready); } }, THREAD); } }

Target:
protected void handlePythonReadinessChange(boolean ready) { boolean wasPythonReady = pythonReady; firePropertyChange(PYTHON_READINESS_PROPERTY, pythonReady, pythonReady = ready); if (ready == false && wasPythonReady != ready) { THREAD.submit(() -> restartPython()); } }
Source:
public void remove(EntityKey entityKey) { Map<String, Object> parameters = parameters( entityKey ); StringBuilder query = new StringBuilder( "MATCH" ); appendNodePattern( entityKey, parameters, query, NodeLabel.ENTITY ); query.append( " OPTIONAL MATCH (n) - [r] - () DELETE r,n" ); engine.execute( query.toString(), parameters ); }

Target:
public void remove(EntityKey entityKey) { Map<String, Object> parameters = new HashMap<String, Object>( entityKey.getColumnNames().length ); StringBuilder query = new StringBuilder( "MATCH" ); appendNodePattern( entityKey, parameters, query, NodeLabel.ENTITY ); query.append( " OPTIONAL MATCH (n) - [r] - () DELETE r,n" ); engine.execute( query.toString(), parameters ); }
Source:
public Object getValueAt(int row, int col) { assert row >= 0 && row < getRowCount() && col >= 0 && col < getColumnCount(); if (row == myAssignments.size()) { return null; } ResourceAssignment ra = myAssignments.get(row); Column column = Column.values()[col]; switch (column) { case ID: { return ra.getTask().getTaskID(); } case NAME: { return ra.getTask(); } case UNIT: { return ra.getLoad(); } default: throw new IllegalArgumentException("Illegal row number=" + row); } }

Target:
public Object getValueAt(int row, int col) { assert row >= 0 && row < getRowCount() && col >= 0 && col < getColumnCount() : String.format("Row/column index is out of bounds: (%d,%d) [%d,%d]", row, col, getRowCount(), getColumnCount()); if (row == myAssignments.size()) { return null; } ResourceAssignment ra = myAssignments.get(row); Column column = Column.values()[col]; switch (column) { case ID: { return ra.getTask().getTaskID(); } case NAME: { return ra.getTask(); } case UNIT: { return ra.getLoad(); } default: throw new IllegalArgumentException("Illegal row number=" + row); } }
Source:
public List<GerritQueryResult> queryMyReviews(IProgressMonitor monitor) throws GerritException { return executeQuery(monitor, "owner:self OR reviewer:self", ImmutableList.of(GET_DETAILED_ACCOUNTS_OPTION)); }

Target:
public List<GerritQueryResult> queryMyReviews(IProgressMonitor monitor) throws GerritException { return executeQuery(monitor, "owner:self OR reviewer:self"); }
Source:
private void setUserId(String userId) throws IllegalArgumentException { if (userId == null || userId.trim().isEmpty()) { throw new IllegalArgumentException("User ID cannot be null or an empty string."); } else { this.userId = userId; } }

Target:
private void setUserId(String userId) throws IllegalArgumentException { if (userId != null && userId.trim().isEmpty()) { throw new IllegalArgumentException("User ID cannot be an empty string."); } else { this.userId = userId; } }
Source:
private Result getMockResult(String id) { Metacard metacard = mock(Metacard.class); MetacardType metacardType = mock(MetacardType.class); doReturn(id).when(metacard).getId(); metacard.setAttribute(new AttributeImpl(Core.ID, id)); doReturn(metacardType).when(metacard).getMetacardType(); Result result = mock(Result.class); doReturn(metacard).when(result).getMetacard(); return result; }

Target:
private Result getMockResult(String id) { Metacard metacard = mock(Metacard.class); MetacardType metacardType = mock(MetacardType.class); doReturn(id).when(metacard).getId(); doReturn(metacardType).when(metacard).getMetacardType(); return getMockResult(metacard); }
Source:
void nonAirWithMovementLeftAreMarkedAsMoved() { final BattleState battleState = givenBattleStateBuilder() .battleRound(1) .headless(false) .attackingUnits(List.of(givenNonAirUnitWithMovementLeft(BigDecimal.ONE))) .build(); final MarkNoMovementLeft markNoMovementLeft = new MarkNoMovementLeft(battleState, battleActions); markNoMovementLeft.execute(executionStack, delegateBridge); verify(delegateBridge).addChange(any()); }

Target:
void nonAirWithMovementLeftAreMarkedAsMoved() { final BattleState battleState = givenBattleStateBuilder() .battleRound(1) .headless(false) .attackingUnits(List.of(givenNonAirUnitWithMovementLeft(BigDecimal.ONE))) .build(); final MarkNoMovementLeft markNoMovementLeft = new MarkNoMovementLeft(battleState, battleActions); markNoMovementLeft.execute(executionStack, delegateBridge); verify(delegateBridge) .addChange( argThat( compositeChangeContains( propertyChange(Unit.ALREADY_MOVED, BigDecimal.ONE, BigDecimal.ZERO)))); }
Source:
public List<NewsConfiguration> getNewsConfigurations(String subscribeId) { logger.debug("fetching news configurations for " + subscribeId); Query<NewsConfiguration> query = createQuery( "from NewsConfiguration config where " + "subscribeId = ? and displayed = true " + "order by newsDefinition.name"); query.setParameter(0, subscribeId); return query.list(); }

Target:
public List<NewsConfiguration> getNewsConfigurations(String subscribeId) { String hql = " FROM NewsConfiguration AS config " + " WHERE subscribeId = ? " + " AND displayed = TRUE " + "ORDER BY newsDefinition.name"; Query<NewsConfiguration> query = generateQuery(hql); query.setParameter(0, subscribeId); return query.list(); }
Source:
private List<MavenProject> trimResumedProjects( List<MavenProject> projects, MavenExecutionRequest request ) throws MavenExecutionException { List<MavenProject> result = projects; if ( StringUtils.isNotEmpty( request.getResumeFrom() ) || request.isResumeFromLastFailedProject() ) { File reactorDirectory = null; if ( request.getBaseDirectory() != null ) { reactorDirectory = new File( request.getBaseDirectory() ); } String selector; if ( StringUtils.isNotEmpty( request.getResumeFrom() ) ) { selector = request.getResumeFrom(); } else { String buildDirectory = projects.stream() .filter( mp -> mp.getBasedir().toString().equals( request.getBaseDirectory() ) ) .findFirst() .map( mp -> mp.getBuild().getDirectory() ) .orElseThrow( () -> new MavenExecutionException( "Could not determine build directory for root project", request.getPom() ) ); Path resumeFromCacheFile = Paths.get( buildDirectory, "resume-from-cache" ); try ( Stream<String> allLines = Files.lines( resumeFromCacheFile ) ) { selector = allLines.findFirst().orElseThrow( () -> new MavenExecutionException( "resume-from-cache file was empty", request.getPom() ) ); } catch ( IOException e ) { throw new MavenExecutionException( "Error occurred while reading resume-from-cache file", request.getPom() ); } } result = new ArrayList<>( projects.size() ); boolean resumed = false; for ( MavenProject project : projects ) { if ( !resumed && isMatchingProject( project, selector, reactorDirectory ) ) { resumed = true; } if ( resumed ) { result.add( project ); } } if ( !resumed ) { throw new MavenExecutionException( "Could not find project to resume reactor build from: " + selector + " vs " + formatProjects( projects ), request.getPom() ); } } return result; }

Target:
private List<MavenProject> trimResumedProjects( List<MavenProject> projects, MavenExecutionRequest request ) throws MavenExecutionException { List<MavenProject> result = projects; String resumeFrom = request.getResumeFrom(); if ( resumeFrom != null ) { File reactorDirectory = null; if ( request.getBaseDirectory() != null ) { reactorDirectory = new File( request.getBaseDirectory() ); } String selector; if ( StringUtils.isNotEmpty( resumeFrom ) ) { selector = resumeFrom; } else { selector = getLastFailedProject( projects, request ); } result = new ArrayList<>( projects.size() ); boolean resumed = false; for ( MavenProject project : projects ) { if ( !resumed && isMatchingProject( project, selector, reactorDirectory ) ) { resumed = true; } if ( resumed ) { result.add( project ); } } if ( !resumed ) { throw new MavenExecutionException( "Could not find project to resume reactor build from: " + selector + " vs " + formatProjects( projects ), request.getPom() ); } } return result; }
Source:
public void testFactoryNamedParameters() { final List<String> names = new ArrayList<>(); names.add("a"); names.add("b"); names.add("c"); final ParsedParameters parameters = ParsedParameters.of(false, names); assertThat(parameters).isNotNull(); assertThat(parameters.isPositional()).isFalse(); assertThat(parameters.getParameterCount()).isEqualTo(3); assertThat(parameters.getParameterNames()).containsExactly("a", "b", "c"); }

Target:
public void testFactoryNamedParameters() { final List<String> names = Arrays.asList("a", "b", "c"); final ParsedParameters parameters = ParsedParameters.named(names); assertThat(parameters).isNotNull(); assertThat(parameters.isPositional()).isFalse(); assertThat(parameters.getParameterCount()).isEqualTo(3); assertThat(parameters.getParameterNames()).containsExactly("a", "b", "c"); }
Source:
public static Status fromValue(String value) { if (value == null) { return PENDING; } Optional<Status> status = Enums.getIfPresent(Status.class, value.toUpperCase()); checkArgument(status.isPresent(), "%s is not a valid value", value); return status.get(); }

Target:
public static Status fromValue(String value) { if (value == null) { return PENDING; } Optional<Status> status = Enums.getIfPresent(Status.class, value.toUpperCase()); checkArgument(status.isPresent(), "Expected one of %s but was", Joiner.on(',').join(Status.values()), value); return status.get(); }
Source:
public void testPushesAggregationThroughLeftJoin() { new RuleTester().assertThat(new PushAggregationThroughOuterJoin()) .on(p -> p.aggregation(ab -> ab .source( p.join( JoinNode.Type.LEFT, p.values(ImmutableList.of(p.symbol("COL1", BIGINT)), ImmutableList.of(expressions("10"))), p.values(p.symbol("COL2", BIGINT)), ImmutableList.of(new JoinNode.EquiJoinClause(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT))), ImmutableList.of(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT)), Optional.empty(), Optional.empty(), Optional.empty() )) .addAggregation(p.symbol("AVG", DOUBLE), PlanBuilder.expression("avg(COL2)"), ImmutableList.of(DOUBLE)) .groupingSets(ImmutableList.of(ImmutableList.of(p.symbol("COL1", BIGINT)))))) .matches( project(ImmutableMap.of( "COL1", expression("COL1"), "COALESCE", expression("coalesce(AVG, AVG_NULL)")), join(JoinNode.Type.INNER, ImmutableList.of(), join(JoinNode.Type.LEFT, ImmutableList.of(equiJoinClause("COL1", "COL2")), values(ImmutableMap.of("COL1", 0)), aggregation( ImmutableList.of(ImmutableList.of("COL2")), ImmutableMap.of(Optional.of("AVG"), functionCall("avg", ImmutableList.of("COL2"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("COL2", 0)))), aggregation( ImmutableList.of(ImmutableList.of()), ImmutableMap.of(Optional.of("AVG_NULL"), functionCall("avg", ImmutableList.of("null_literal"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("null_literal", 0)))))); }

Target:
public void testPushesAggregationThroughLeftJoin() { new RuleTester().assertThat(new PushAggregationThroughOuterJoin()) .on(p -> p.aggregation(ab -> ab .source( p.join( JoinNode.Type.LEFT, p.values(ImmutableList.of(p.symbol("COL1", BIGINT)), ImmutableList.of(expressions("10"))), p.values(p.symbol("COL2", BIGINT)), ImmutableList.of(new JoinNode.EquiJoinClause(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT))), ImmutableList.of(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT)), Optional.empty(), Optional.empty(), Optional.empty() )) .addAggregation(p.symbol("AVG", DOUBLE), PlanBuilder.expression("avg(COL2)"), ImmutableList.of(DOUBLE)) .addGroupingSet(p.symbol("COL1", BIGINT)))) .matches( project(ImmutableMap.of( "COL1", expression("COL1"), "COALESCE", expression("coalesce(AVG, AVG_NULL)")), join(JoinNode.Type.INNER, ImmutableList.of(), join(JoinNode.Type.LEFT, ImmutableList.of(equiJoinClause("COL1", "COL2")), values(ImmutableMap.of("COL1", 0)), aggregation( ImmutableList.of(ImmutableList.of("COL2")), ImmutableMap.of(Optional.of("AVG"), functionCall("avg", ImmutableList.of("COL2"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("COL2", 0)))), aggregation( ImmutableList.of(ImmutableList.of()), ImmutableMap.of(Optional.of("AVG_NULL"), functionCall("avg", ImmutableList.of("null_literal"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("null_literal", 0)))))); }
Source:
private Map<String, Value> getValueAttributes(Schematic sch, Map<String, TypeValue> expectedTypes, JsonObject obj) throws UndeclaredIdentifierException, UndeclaredAttributeException { JsonObject attributeMapJson = obj.getAsJsonObject(ATTRIBUTES); HashMap<String, Value> attributeMap = new HashMap<>(); if (attributeMapJson == null) { return attributeMap; } TypeValue bool = sch.getUserDefinedType("Bool"); TypeValue integer = sch.getUserDefinedType("Int"); TypeValue str = sch.getUserDefinedType("String"); for (Entry<String, JsonElement> attrEntry : attributeMapJson.entrySet()) { TypeValue type = expectedTypes.get(attrEntry.getKey()); Value attrValue = null; String valueString = attrEntry.getValue().getAsString(); if (type == null) { throw new UndeclaredAttributeException(attrEntry.getKey()); } if (type.equals(bool)) { attrValue = BooleanValue.getInstance(Boolean.valueOf(valueString)); } else if (type.equals(integer)) { attrValue = new IntegerValue(IntegerTypeValue.getInstance(), Integer.valueOf(valueString)); } else if (type.equals(str)) { attrValue = new StringValue(StringTypeValue.getInstance(), valueString); } else { throw new UndeclaredAttributeException(attrEntry.getKey()); } attributeMap.put(attrEntry.getKey(), attrValue); } return attributeMap; }

Target:
private Map<String, Value> getValueAttributes(Schematic sch, Map<String, TypeValue> expectedTypes, JsonObject obj) throws UndeclaredIdentifierException, UndeclaredAttributeException { JsonObject attributeMapJson = obj.getAsJsonObject(ATTRIBUTES); HashMap<String, Value> attributeMap = new HashMap<>(); if (attributeMapJson == null) { return attributeMap; } TypeValue bool = sch.getUserDefinedType("Bool"); TypeValue integer = sch.getUserDefinedType("Int"); TypeValue str = sch.getUserDefinedType("String"); for (Entry<String, JsonElement> attrEntry : attributeMapJson.entrySet()) { TypeValue type = expectedTypes.get(attrEntry.getKey()); Value attrValue = null; String valueString = attrEntry.getValue().getAsString(); if (type == null) { throw new UndeclaredAttributeException(attrEntry.getKey()); } if (type.equals(bool)) { if (!(Boolean.TRUE.toString().equals(valueString) || Boolean.FALSE.toString().equals(valueString))) { throw new IllegalArgumentException(String.format( "Expected boolean value of true or false, got %s", valueString)); } attrValue = BooleanValue.getInstance(Boolean.parseBoolean(valueString)); } else if (type.equals(integer)) { attrValue = new IntegerValue(IntegerTypeValue.getInstance(), Integer.valueOf(valueString)); } else if (type.equals(str)) { attrValue = new StringValue(StringTypeValue.getInstance(), valueString); } else { throw new UndeclaredAttributeException(attrEntry.getKey()); } attributeMap.put(attrEntry.getKey(), attrValue); } return attributeMap; }
Source:
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { long start = System.currentTimeMillis(); while (!done && System.currentTimeMillis() - start < unit.toMillis(timeout)) { Thread.sleep(250); } return resultObject; }

Target:
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { long start = System.currentTimeMillis(); while (!done && System.currentTimeMillis() - start < unit.toMillis(timeout)) { Thread.sleep(250); } if (!done) { throw new TimeoutException("ListenableFutureJob.get() could not get the result!"); } return resultObject; }
Source:
public PriceIndexCurveMultiplyFixedCurve(final String name, final PriceIndexCurve curve, final DoublesCurve fixedCurve) { ArgumentChecker.notNull(curve, "Curve"); ArgumentChecker.notNull(fixedCurve, "Curve fixed"); _name = name; _curve = curve; _fixedCurve = fixedCurve; }

Target:
public PriceIndexCurveMultiplyFixedCurve(final String name, final PriceIndexCurve curve, final DoublesCurve fixedCurve) { ArgumentChecker.notNull(name, "name"); ArgumentChecker.notNull(curve, "Curve"); ArgumentChecker.notNull(fixedCurve, "Curve fixed"); _name = name; _curve = curve; _fixedCurve = fixedCurve; }
Source:
private RelationPlan planLateralJoin(Join join, RelationPlan leftPlan, Lateral lateral) { RelationPlan rightPlan = process(lateral.getQuery(), null); PlanBuilder leftPlanBuilder = initializePlanBuilder(leftPlan); PlanBuilder rightPlanBuilder = initializePlanBuilder(rightPlan); PlanBuilder planBuilder = subqueryPlanner.appendLateralJoin(leftPlanBuilder, rightPlanBuilder, subQueryNotSupportedError(lateral.getQuery()), true, LateralJoinNode.Type.INNER); List<Symbol> outputSymbols = ImmutableList.<Symbol>builder() .addAll(leftPlan.getRoot().getOutputSymbols()) .addAll(rightPlan.getRoot().getOutputSymbols()) .build(); return new RelationPlan(planBuilder.getRoot(), analysis.getScope(join), outputSymbols); }

Target:
private RelationPlan planLateralJoin(Join join, RelationPlan leftPlan, Lateral lateral) { RelationPlan rightPlan = process(lateral.getQuery(), null); PlanBuilder leftPlanBuilder = initializePlanBuilder(leftPlan); PlanBuilder rightPlanBuilder = initializePlanBuilder(rightPlan); PlanBuilder planBuilder = subqueryPlanner.appendLateralJoin(leftPlanBuilder, rightPlanBuilder, lateral.getQuery(), true, LateralJoinNode.Type.INNER); List<Symbol> outputSymbols = ImmutableList.<Symbol>builder() .addAll(leftPlan.getRoot().getOutputSymbols()) .addAll(rightPlan.getRoot().getOutputSymbols()) .build(); return new RelationPlan(planBuilder.getRoot(), analysis.getScope(join), outputSymbols); }
Source:
public Long clear(String key, String... fields) { RedisConnection<byte[], byte[]> redisCommands = null; try { redisCommands = getRedisConnection(); int maxBytes = Integer.MIN_VALUE; for (int i = 0; i < fields.length; i++) { if (fields[i].getBytes().length > maxBytes) maxBytes = fields[i].getBytes().length; } byte[][] fieldsInBytes = new byte[fields.length][maxBytes + 1]; for (int i = 0; i < fields.length; i++) { fieldsInBytes[i] = fields[i].getBytes(); } return redisCommands.hdel(key.getBytes(), fieldsInBytes); } catch (Exception e) { logger.error("Exception Occurred while clearing a value from redis", e); } finally { closeConnection(redisCommands); } return new Long(-1); }

Target:
public Long clear(String key, String... fields) { RedisConnection<byte[], byte[]> redisCommands = null; try { redisCommands = getRedisConnection(); byte[][] fieldsInBytes = new byte[fields.length][]; for (int i = 0; i < fields.length; i++) { fieldsInBytes[i] = fields[i].getBytes(); } return redisCommands.hdel(key.getBytes(), fieldsInBytes); } finally { closeConnection(redisCommands); } }
Source:
private <T> CompletionStage<T> fireRequest(final HttpRequest request, final Class<T> responseType) { return _http.singleRequest(request.addHeader(AcceptEncoding.create(HttpEncodings.GZIP)), _materializer) .thenCompose(httpResponse -> { final HttpEncoding encoding = httpResponse.encoding(); final Coder flow; if (encoding == HttpEncodings.GZIP) { flow = Gzip$.MODULE$; } else if (encoding == HttpEncodings.DEFLATE) { flow = Deflate$.MODULE$; } else { flow = NoCoding$.MODULE$; } return httpResponse.entity() .toStrict(READ_TIMEOUT.toMillis(), _materializer) .thenCompose(strict -> FutureConverters.toJava(flow.decode(strict.getData(), _materializer))); }) .thenApply(body -> { try { return _mapper.readValue(body.utf8String(), responseType); } catch (final IOException e) { throw new RuntimeException(e); } }); }

Target:
private <T> CompletionStage<T> fireRequest(final HttpRequest request, final Class<T> responseType) { return _http.singleRequest(request.addHeader(AcceptEncoding.create(HttpEncodings.GZIP)), _materializer) .thenCompose(httpResponse -> { final HttpEncoding encoding = httpResponse.encoding(); final Coder flow; if (HttpEncodings.GZIP.equals(encoding)) { flow = Gzip$.MODULE$; } else if (HttpEncodings.DEFLATE.equals(encoding)) { flow = Deflate$.MODULE$; } else { flow = NoCoding$.MODULE$; } return httpResponse.entity() .toStrict(_readTimeout.toMillis(), _materializer) .thenCompose(strict -> FutureConverters.toJava(flow.decode(strict.getData(), _materializer))); }) .thenApply(body -> { try { return _mapper.readValue(body.utf8String(), responseType); } catch (final IOException e) { throw new RuntimeException(e); } }); }