auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ChargeResponse that = (ChargeResponse) o; return getDelayedCapture() == that.getDelayedCapture() && Objects.equals(getDataLinks(), that.getDataLinks()) && Objects.equals(getChargeId(), that.getChargeId()) && Objects.equals(getAmount(), that.getAmount()) && Objects.equals(getState(), that.getState()) && Objects.equals(getCardBrand(), that.getCardBrand()) && Objects.equals(getGatewayTransactionId(), that.getGatewayTransactionId()) && Objects.equals(getReturnUrl(), that.getReturnUrl()) && Objects.equals(getEmail(), that.getEmail()) && Objects.equals(getDescription(), that.getDescription()) && Objects.equals(getReference(), that.getReference()) && Objects.equals(getProviderName(), that.getProviderName()) && Objects.equals(createdDate, that.createdDate) && Objects.equals(getRefundSummary(), that.getRefundSummary()) && Objects.equals(getSettlementSummary(), that.getSettlementSummary()) && Objects.equals(getAuth3dsData(), that.getAuth3dsData()) && Objects.equals(getCardDetails(), that.getCardDetails()) && getLanguage() == that.getLanguage() && Objects.equals(getCorporateCardSurcharge(), that.getCorporateCardSurcharge()) && Objects.equals(getTotalAmount(), that.getTotalAmount()) && getWalletType() == that.getWalletType(); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ChargeResponse that = (ChargeResponse) o; return delayedCapture == that.delayedCapture && Objects.equals(dataLinks, that.dataLinks) && Objects.equals(chargeId, that.chargeId) && Objects.equals(amount, that.amount) && Objects.equals(state, that.state) && Objects.equals(cardBrand, that.cardBrand) && Objects.equals(gatewayTransactionId, that.gatewayTransactionId) && Objects.equals(returnUrl, that.returnUrl) && Objects.equals(email, that.email) && Objects.equals(description, that.description) && Objects.equals(reference, that.reference) && Objects.equals(providerName, that.providerName) && Objects.equals(createdDate, that.createdDate) && Objects.equals(refundSummary, that.refundSummary) && Objects.equals(settlementSummary, that.settlementSummary) && Objects.equals(auth3dsData, that.auth3dsData) && Objects.equals(cardDetails, that.cardDetails) && language == that.language && Objects.equals(corporateCardSurcharge, that.corporateCardSurcharge) && Objects.equals(totalAmount, that.totalAmount) && walletType == that.walletType; }
Source:
private Set<Symbol> getJoinRequiredSymbols(JoinNode node) { return ImmutableSet.<Symbol>builder() .addAll(node.getCriteria().stream().map(JoinNode.EquiJoinClause::getLeft).collect(toImmutableSet())) .addAll(node.getCriteria().stream().map(JoinNode.EquiJoinClause::getRight).collect(toImmutableSet())) .addAll(node.getFilter().map(SymbolsExtractor::extractUnique).orElse(ImmutableSet.of())) .addAll(node.getLeftHashSymbol().map(ImmutableSet::of).orElse(ImmutableSet.of())) .addAll(node.getRightHashSymbol().map(ImmutableSet::of).orElse(ImmutableSet.of())) .build(); }

Target:
private Set<Symbol> getJoinRequiredSymbols(JoinNode node) { return Streams.concat( node.getCriteria().stream().map(JoinNode.EquiJoinClause::getLeft), node.getCriteria().stream().map(JoinNode.EquiJoinClause::getRight), node.getFilter().map(SymbolsExtractor::extractUnique).orElse(ImmutableSet.of()).stream(), node.getLeftHashSymbol().map(ImmutableSet::of).orElse(ImmutableSet.of()).stream(), node.getRightHashSymbol().map(ImmutableSet::of).orElse(ImmutableSet.of()).stream()) .collect(toImmutableSet()); }
Source:
public void configureBackground(IFigure fig) { if (resolveDDiagram().some() && fig != null) { DSemanticDiagram dSemanticDiagram = (DSemanticDiagram) this.resolveDDiagram().get(); ColorDescription backgroundColor = dSemanticDiagram.getDescription().getBackgroundColor(); if (backgroundColor != null) { RGBValues rgbBackgroundValues = new AbstractColorUpdater().getRGBValuesFromColorDescription(dSemanticDiagram.getTarget(), backgroundColor); Color colorUpdate = new Color(null, rgbBackgroundValues.getRed(), rgbBackgroundValues.getGreen(), rgbBackgroundValues.getBlue()); if (isWhiteColor(rgbBackgroundValues)) { fig.setBackgroundColor(null); fig.setOpaque(false); } else { fig.setBackgroundColor(colorUpdate); fig.setOpaque(true); } } } }

Target:
public synchronized void configureBackground(IFigure fig) { if (resolveDDiagram().some() && fig != null) { DSemanticDiagram dSemanticDiagram = (DSemanticDiagram) this.resolveDDiagram().get(); ColorDescription colorDesc = dSemanticDiagram.getDescription().getBackgroundColor(); RGBValues rgb = WHITE; if (colorDesc != null) { rgb = new AbstractColorUpdater().getRGBValuesFromColorDescription(dSemanticDiagram.getTarget(), colorDesc); } Color previousColor = fig.getBackgroundColor(); if (!sameColor(previousColor, rgb)) { SiriusDiagramGraphicalViewer viewer = (SiriusDiagramGraphicalViewer) this.getViewer(); Color backgroundColor; if (WHITE.equals(rgb)) { backgroundColor = null; } else { backgroundColor = new Color(viewer.getControl().getDisplay(), rgb.getRed(), rgb.getGreen(), rgb.getBlue()); } fig.setBackgroundColor(backgroundColor); fig.setOpaque(backgroundColor != null); viewer.setBackgroundColor(backgroundColor); } } }
Source:
public void generateDeletions(RdfPatchSerializer saver) { for (Entity entity : entities) { Map<String, String[]> deletions = entity.getDeletions(); deletions.forEach((predicate, valuesArray) -> { for (String value : valuesArray) { try { saver.delValue(entity.getSpecializationOf().toString(), predicate, value, RdfConstants.STRING, null); } catch (LogStorageFailedException e) { e.printStackTrace(); } } }); } }

Target:
public void generateDeletions(RdfPatchSerializer saver) throws LogStorageFailedException { for (Entity entity : entities) { Map<String, String[]> deletions = entity.getDeletions(); for (Map.Entry<String, String[]> entry : deletions.entrySet()) { for (String value : entry.getValue()) { saver.delValue(entity.getSpecializationOf().toString(), RdfConstants.TIM_PROP_ID + "/" + entry.getKey(), "\"" + value + "\"", RdfConstants.STRING, null); } } } }
Source:
public static void createInsidePortLabelCells(final NodeContext nodeContext) { AtomicCell northCell = new AtomicCell(); nodeContext.nodeContainer.setCell(ContainerArea.BEGIN, northCell); nodeContext.insidePortLabelCells.put(PortSide.NORTH, northCell); AtomicCell southCell = new AtomicCell(); nodeContext.nodeContainer.setCell(ContainerArea.END, southCell); nodeContext.insidePortLabelCells.put(PortSide.SOUTH, southCell); AtomicCell westCell = new AtomicCell(); nodeContext.nodeContainerMiddleRow.setCell(ContainerArea.BEGIN, westCell); nodeContext.insidePortLabelCells.put(PortSide.WEST, westCell); AtomicCell eastCell = new AtomicCell(); nodeContext.nodeContainerMiddleRow.setCell(ContainerArea.END, eastCell); nodeContext.insidePortLabelCells.put(PortSide.EAST, eastCell); setupNorthOrSouthPortLabelCell(nodeContext, PortSide.NORTH); setupNorthOrSouthPortLabelCell(nodeContext, PortSide.SOUTH); setupEastOrWestPortLabelCell(nodeContext, PortSide.EAST); setupEastOrWestPortLabelCell(nodeContext, PortSide.WEST); }

Target:
public static void createInsidePortLabelCells(final NodeContext nodeContext) { createInsidePortLabelCell(nodeContext, nodeContext.nodeContainer, ContainerArea.BEGIN, PortSide.NORTH); createInsidePortLabelCell(nodeContext, nodeContext.nodeContainer, ContainerArea.END, PortSide.SOUTH); createInsidePortLabelCell(nodeContext, nodeContext.nodeContainerMiddleRow, ContainerArea.BEGIN, PortSide.WEST); createInsidePortLabelCell(nodeContext, nodeContext.nodeContainerMiddleRow, ContainerArea.END, PortSide.EAST); setupNorthOrSouthPortLabelCell(nodeContext, PortSide.NORTH); setupNorthOrSouthPortLabelCell(nodeContext, PortSide.SOUTH); setupEastOrWestPortLabelCell(nodeContext, PortSide.EAST); setupEastOrWestPortLabelCell(nodeContext, PortSide.WEST); }
Source:
public BgGraphBuilder(Context context){ this.context = context; this.prefs = PreferenceManager.getDefaultSharedPreferences(context); this.highMark = Double.parseDouble(prefs.getString("highValue", "170")); this.lowMark = Double.parseDouble(prefs.getString("lowValue", "70")); this.doMgdl = (prefs.getString("units", "mgdl").compareTo("mmol") != 0); defaultMinY = unitized(40); defaultMaxY = unitized(250); pointSize = isXLargeTablet(context) ? 5 : 3; axisTextSize = isXLargeTablet(context) ? 20 : Axis.DEFAULT_TEXT_SIZE_SP; previewAxisTextSize = isXLargeTablet(context) ? 12 : 5; hoursPreviewStep = isXLargeTablet(context) ? 2 : 1; }

Target:
public BgGraphBuilder(Context context){ this.context = context; this.prefs = PreferenceManager.getDefaultSharedPreferences(context); this.highMark = Double.parseDouble(prefs.getString("highValue", "170")); this.lowMark = Double.parseDouble(prefs.getString("lowValue", "70")); this.doMgdl = (prefs.getString("units", "mgdl").equals("mgdl")); defaultMinY = unitized(40); defaultMaxY = unitized(250); pointSize = isXLargeTablet(context) ? 5 : 3; axisTextSize = isXLargeTablet(context) ? 20 : Axis.DEFAULT_TEXT_SIZE_SP; previewAxisTextSize = isXLargeTablet(context) ? 12 : 5; hoursPreviewStep = isXLargeTablet(context) ? 2 : 1; }
Source:
public abstract Item doCreateItem( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException; @Restricted(DoNotUse.class) public FormValidation doCheckJobName(@QueryParameter String value) { getOwner().checkPermission(Item.CREATE); if (Util.fixEmpty(value) == null) { return FormValidation.ok(); } try { checkGoodName(value); value = value.trim(); Jenkins.getInstance().getProjectNamingStrategy().checkName(value); } catch (Failure e) { return FormValidation.error(e.getMessage()); } if (getOwnerItemGroup().getItem(value) != null) { return FormValidation.error(Messages.Hudson_JobAlreadyExists(value)); } return FormValidation.ok(); }

Target:
public abstract Item doCreateItem( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException; @Restricted(DoNotUse.class) public FormValidation doCheckJobName(@QueryParameter String value) { getOwner().checkPermission(Item.CREATE); if (Util.fixEmpty(value) == null) { return FormValidation.ok(); } try { Jenkins.checkGoodName(value); value = value.trim(); Jenkins.getInstance().getProjectNamingStrategy().checkName(value); } catch (Failure e) { return FormValidation.error(e.getMessage()); } if (getOwnerItemGroup().getItem(value) != null) { return FormValidation.error(Messages.Hudson_JobAlreadyExists(value)); } return FormValidation.ok(); }
Source:
private void logWarnings(XProperty member, IndexedEmbedded indexedEmbeddedAnnotation) { if ( !isDepthNotSet( indexedEmbeddedAnnotation ) ) { log.indexEmbeddedValueIgnored( member.getName(), "depth" ); } if ( void.class != indexedEmbeddedAnnotation.targetElement() ) { log.indexEmbeddedValueIgnored( member.getName(), "targetElement" ); } if ( !isDefaultPrefix( indexedEmbeddedAnnotation ) ) { log.indexEmbeddedValueIgnored( member.getName(), "prefix" ); } if ( indexedEmbeddedAnnotation.includeEmbeddedObjectId() ) { log.indexEmbeddedValueIgnored( member.getName(), "includeEmbeddedObjectId" ); } }

Target:
private void logWarnings(XProperty member, IndexedEmbedded indexedEmbeddedAnnotation) { if ( isDepthSet( indexedEmbeddedAnnotation ) ) { log.indexEmbeddedValueIgnored( member.getName(), "depth" ); } if ( void.class != indexedEmbeddedAnnotation.targetElement() ) { log.indexEmbeddedValueIgnored( member.getName(), "targetElement" ); } if ( !isDefaultPrefix( indexedEmbeddedAnnotation ) ) { log.indexEmbeddedValueIgnored( member.getName(), "prefix" ); } if ( indexedEmbeddedAnnotation.includeEmbeddedObjectId() ) { log.indexEmbeddedValueIgnored( member.getName(), "includeEmbeddedObjectId" ); } }
Source:
public void registerColumnMapper(ResultColumnMapper m) { this.mappingRegistry.addColumn(m); }

Target:
public void registerColumnMapper(ResultColumnMapper m) { this.mappingRegistry.addColumnMapper(m); }
Source:
public void canFetchAndCombineHistoriesForLocalAndRemote() { Set<PaxosValue> paxosValues = PaxosSerializationTestUtils.writeToLogs(acceptorLog, learnerLog, 1, 100); int lastVerified = -1; List<HistoryQuery> historyQueries = ImmutableList.of( HistoryQuery.of(ImmutableNamespaceAndUseCase.of(CLIENT, USE_CASE), lastVerified, lastVerified + 500)); List<LogsForNamespaceAndUseCase> remoteHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, historyQueries); when(remote.getPaxosHistory(any(), any())).thenReturn(PaxosHistoryOnRemote.of(remoteHistory)); List<CompletePaxosHistoryForNamespaceAndUseCase> completeHistory = paxosLogHistoryProvider.getHistory(); CompletePaxosHistoryForNamespaceAndUseCase historyForNamespaceAndUseCase = Iterables.getOnlyElement(completeHistory); assertThat(historyForNamespaceAndUseCase.namespace()).isEqualTo(CLIENT); assertSanityWithValuesOfFetchedRecords(historyForNamespaceAndUseCase, CLIENT, USE_CASE, 100, paxosValues); }

Target:
public void canFetchAndCombineHistoriesForLocalAndRemote() { Set<PaxosValue> paxosValues = PaxosSerializationTestUtils.writeToLogs(acceptorLog, learnerLog, 1, 100); int lastVerified = -1; List<HistoryQuery> historyQueries = ImmutableList.of(HistoryQueries.unboundedHistoryQuerySinceSeq(lastVerified)); List<LogsForNamespaceAndUseCase> remoteHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, historyQueries); when(remote.getPaxosHistory(any(), any())).thenReturn(PaxosHistoryOnRemote.of(remoteHistory)); List<CompletePaxosHistoryForNamespaceAndUseCase> completeHistory = paxosLogHistoryProvider.getHistory(); CompletePaxosHistoryForNamespaceAndUseCase historyForNamespaceAndUseCase = Iterables.getOnlyElement(completeHistory); assertThat(historyForNamespaceAndUseCase.namespace()).isEqualTo(DEFAULT_CLIENT); assertSanityWithValuesOfFetchedRecords( historyForNamespaceAndUseCase, DEFAULT_CLIENT, DEFAULT_USE_CASE, 100, paxosValues); }
Source:
public DiscoveryResults discover(DiscoveryJob job) { List<IPPollRange> ranges = new ArrayList<IPPollRange>(job.getRanges()); CompletableFuture<PingSweepSummary> summary = client.ping().withForeignSource(job.getForeignSource()) .withLocation(job.getLocation()).withIpPollRanges(ranges) .withPacketSize((int) job.getPacketsPerSecond()).execute(); PingSweepSummary pingSummary; try { pingSummary = summary.get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("Exception in Pinging the IPRange",e); } return new DiscoveryResults(pingSummary.getResponses(), job.getForeignSource(), job.getLocation()); }

Target:
public DiscoveryResults discover(DiscoveryJob job) { final PingResponseTracker tracker = new PingResponseTracker(); List<IPPollAddress> addresses = StreamSupport.stream(job.getAddresses().spliterator(), false) .filter(j -> j.getAddress() != null) .collect(Collectors.toList()); addresses.stream() .map(a -> a.getAddress()) .forEach(a -> tracker.expectCallbackFor(a)); RateLimiter limiter = RateLimiter.create(job.getPacketsPerSecond()); addresses.stream().forEach(a -> { limiter.acquire(); ping(a, tracker); }); if (!addresses.isEmpty()) { try { tracker.getLatch().await(); } catch (InterruptedException e) { throw Throwables.propagate(e); } } return new DiscoveryResults(tracker.getResponses(), job.getForeignSource(), job.getLocation()); }
Source:
private String registerClassInternalName(String name) { int num; if (internalNames.containsKey(name)) { num = internalNames.get(name) + 1; } else { num = 1; } internalNames.put(name, num); return num + name; }

Target:
private String registerClassInternalName(String name) { internalNames.add(name); return internalNames.count(name) + name; }
Source:
public String toString() { MoreObjects.ToStringHelper strHelper = MoreObjects.toStringHelper(this); if (!mTierAlias.equals(ANY_TIER)) { strHelper.add("TierAlias", mTierAlias); } if (mDirIndex != ANY_DIR) { strHelper.add("DirIndex", mDirIndex); } if (!mMediumType.equals(ANY_MEDIUM)) { strHelper.add("MediumType", mMediumType); } return strHelper.toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("TierAlias", (!mTierAlias.equals(ANY_TIER)) ? mTierAlias : "<Any>") .add("DirIndex", (mDirIndex != ANY_DIR) ? mDirIndex : "<Any>") .add("MediumType", (!mMediumType.equals(ANY_MEDIUM)) ? mMediumType : "<Any>") .toString(); }
Source:
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other) { return false; }

Target:
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other) { throw new UnsupportedOperationException(); }
Source:
private void parseSrcs(String localSource) { for (int i = 0; i < srcs.length; i++) { if (StringUtils.equalsIgnoreCase(srcs[i], LOCAL_SOURCE) || StringUtils.isBlank(srcs[i])) { srcs[i] = localSource; } } }

Target:
private void parseSrcs(String localSource) { for (int i = 0; i < srcs.size(); i++) { if (StringUtils.equalsIgnoreCase(srcs.get(i), LOCAL_SOURCE)) { srcs.set(i, localSource); } } }
Source:
public void run() { BluetoothDevice remoteDevice = mmSocket.getRemoteDevice(); while (true) { try { boolean messageRecvd = mmMessenger.deserializeMessage(mmInStream); if (messageRecvd) { for (IMessage message : mmMessenger.getReceivedMessages()) { sendMessageToHandler(message, remoteDevice.getAddress()); } } } catch (IOException e) { e.printStackTrace(); break; } catch (Throwable t) { t.printStackTrace(); break; } } stopWriteThread(); cancel(); }

Target:
public void run() { BluetoothDevice remoteDevice = mmSocket.getRemoteDevice(); while (true) { try { boolean messageRecvd = mmMessenger.deserializeMessage(mmInStream); if (messageRecvd) { for (IMessage message : mmMessenger.getReceivedMessages()) { sendMessageToHandler(message, remoteDevice.getAddress()); } mmMessenger.clearReceivedMessages(); } } catch (IOException e) { e.printStackTrace(); break; } catch (Throwable t) { t.printStackTrace(); break; } } stopWriteThread(); cancel(); }
Source:
public Coords getPosition() { if (secondaryPos == -1) { return entity.getPosition(); } else { return entity.getSecondaryPositions().get(secondaryPos); } }

Target:
public Coords getPosition() { if (secondaryPos < 0 || secondaryPos >= entity.getSecondaryPositions().size()) { return entity.getPosition(); } else { return entity.getSecondaryPositions().get(secondaryPos); } }
Source:
public Void visit(VarRefNode varRefNode) { String object; switch (varRefNode.getName()) { case "true": object = "org/twnc/runtime/BTrue"; break; case "false": object = "org/twnc/runtime/BFalse"; break; case "this": object = cn.getName(); break; default: object = ""; try { VarDeclNode decl = scope.getVarDeclNode(varRefNode.getName()); mv.visitVarInsn(ALOAD, 1 + decl.getOffset()); } catch (VariableNotDeclaredException e) { object = "org/twnc/runtime/BNil"; } } if (!object.isEmpty()) { mv.visitTypeInsn(NEW, object); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, object, "<init>", "()V", false); } return super.visit(varRefNode); }

Target:
public Void visit(VarRefNode varRefNode) { String name = varRefNode.getName(); if (ScopeStack.isSpecial(name)) { String object; switch (name) { case "true": object = "org/twnc/runtime/BTrue"; break; case "false": object = "org/twnc/runtime/BFalse"; break; case "this": object = cn.getName(); break; default: object = "org/twnc/runtime/BNil"; break; } mv.visitTypeInsn(NEW, object); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, object, "<init>", "()V", false); } else { try { VarDeclNode decl = scope.getVarDeclNode(varRefNode.getName()); mv.visitVarInsn(ALOAD, 1 + decl.getOffset()); } catch (VariableNotDeclaredException e) { e.printStackTrace(); } } return super.visit(varRefNode); }
Source:
private int getPriority(String key) { if (key != null && !priorityMap.containsKey(key)) { int priority = AbstractMenuBuilder.DEFAULT_PRIORITY; try { priority = Integer.parseInt(SiriusEditorPlugin.INSTANCE.getString(key)); } catch (MissingResourceException mre) { } catch (NumberFormatException nfe) { } priorityMap.put(key, priority); } return priorityMap.get(key); }

Target:
private int getPriority(String key) { if (key != null && !priorityMap.containsKey(key)) { int priority = AbstractMenuBuilder.DEFAULT_PRIORITY; try { priority = Integer.parseInt(SiriusEditorPlugin.INSTANCE.getString(key)); } catch (MissingResourceException mre) { } catch (NumberFormatException nfe) { } priorityMap.put(key, priority); } return Objects.firstNonNull(priorityMap.get(key), DEFAULT_PRIORITY); }
Source:
private DNASequence readGenbankResource(final String resource) throws Exception { DNASequence sequence = null; InputStream inputStream = null; try { inputStream = getClass().getResourceAsStream(resource); GenbankReader<DNASequence, NucleotideCompound> genbankDNA = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) ); LinkedHashMap<String, DNASequence> dnaSequences = genbankDNA.process(); sequence = dnaSequences.values().iterator().next(); } catch (Exception e) { fail(e.getMessage()); } finally { try { inputStream.close(); } catch (Exception e) { } } return sequence; }

Target:
private DNASequence readGenbankResource(final String resource) throws Exception { DNASequence sequence = null; InputStream inputStream = null; try { inputStream = getClass().getResourceAsStream(resource); GenbankReader<DNASequence, NucleotideCompound> genbankDNA = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) ); LinkedHashMap<String, DNASequence> dnaSequences = genbankDNA.process(); sequence = dnaSequences.values().iterator().next(); } finally { try { inputStream.close(); } catch (Exception e) { } } return sequence; }
Source:
public String getChecksum() { try { Properties properties2 = getProperties(); String old = properties2.getProperty(Constants.TSTAMP); properties2.setProperty(Constants.TSTAMP, "0"); try { Properties flattenedProperties = getFlattenedProperties(); Digester<SHA1> digester = SHA1.getDigester(); @SuppressWarnings({ "unchecked", "rawtypes" }) Set<String> keySet = new TreeSet<>((Set) flattenedProperties.keySet()); keySet.forEach(k -> { try { byte[] bytes = k.getBytes(StandardCharsets.UTF_8); digester.write(bytes); String s = flattenedProperties.getProperty(k); if (s == null) return; bytes = s.getBytes(StandardCharsets.UTF_8); digester.write(bytes); } catch (Exception e) { throw Exceptions.duck(e); } }); String checksum = digester.digest() .asHex(); return checksum; } finally { if (old == null) { properties2.remove(Constants.TSTAMP); } else { properties2.setProperty(Constants.TSTAMP, old); } } } catch (Exception e) { throw Exceptions.duck(e); } }

Target:
public String getChecksum() { try (Processor p = new Processor(this)) { p.setProperty(Constants.TSTAMP, "0"); Properties flattenedProperties = p.getFlattenedProperties(); Digester<SHA1> digester = SHA1.getDigester(); @SuppressWarnings({ "unchecked", "rawtypes" }) Set<String> keySet = new TreeSet<>((Set) flattenedProperties.keySet()); keySet.forEach(k -> { try { byte[] bytes = k.getBytes(StandardCharsets.UTF_8); digester.write(bytes); String s = flattenedProperties.getProperty(k); if (s == null) return; bytes = s.getBytes(StandardCharsets.UTF_8); digester.write(bytes); } catch (Exception e) { throw Exceptions.duck(e); } }); String checksum = digester.digest() .asHex(); return checksum; } catch (Exception e) { throw Exceptions.duck(e); } }
Source:
public void deleteStudentFromRespondantsList(StudentAttributes student) { if (student == null || student.email == null) { return; } List<FeedbackSessionAttributes> sessionsToUpdate = fsDb.getFeedbackSessionsForCourse(student.course); for (FeedbackSessionAttributes session : sessionsToUpdate) { try { deleteStudentFromRespondantList(student.email, session.feedbackSessionName, session.courseId); } catch (InvalidParametersException | EntityDoesNotExistException e) { Assumption.fail("Fail to delete instructor respondant for " + session.feedbackSessionName); } } }

Target:
public void deleteStudentFromRespondantsList(StudentAttributes student) { if (student == null || student.email == null) { return; } List<FeedbackSessionAttributes> sessionsToUpdate = fsDb.getFeedbackSessionsForCourse(student.course); for (FeedbackSessionAttributes session : sessionsToUpdate) { try { deleteStudentFromRespondentList(student.email, session.getFeedbackSessionName(), session.getCourseId()); } catch (InvalidParametersException | EntityDoesNotExistException e) { Assumption.fail("Fail to delete instructor respondant for " + session.getFeedbackSessionName()); } } }
Source:
public void testCreateAllocatedSlotReport() throws Exception { try (SlotPoolImpl slotPool = createAndSetUpSlotPool()) { final ArrayBlockingQueue<AllocationID> allocationIds = new ArrayBlockingQueue<>(1); resourceManagerGateway.setRequestSlotConsumer( slotRequest -> allocationIds.offer(slotRequest.getAllocationId())); final SlotRequestId slotRequestId = new SlotRequestId(); final CompletableFuture<PhysicalSlot> slotRequestFuture = requestNewAllocatedSlot( slotPool, slotRequestId ); final List<AllocatedSlotInfo> allocatedSlotInfos = new ArrayList<>(2); final List<SlotOffer> slotOffers = new ArrayList<>(2); final AllocationID allocatedId = allocationIds.take(); slotOffers.add(new SlotOffer(allocatedId, 0, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(0, allocatedId)); final AllocationID availableId = new AllocationID(); slotOffers.add(new SlotOffer(availableId, 1, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(1, availableId)); slotPool.registerTaskManager(taskManagerLocation.getResourceID()); slotPool.offerSlots(taskManagerLocation, taskManagerGateway, slotOffers); slotRequestFuture.get(1, TimeUnit.SECONDS); final AllocatedSlotReport slotReport = slotPool.createAllocatedSlotReport(taskManagerLocation.getResourceID()); assertThat(jobId, is(slotReport.getJobId())); assertThat(slotReport.getAllocatedSlotInfos(), containsInAnyOrder(isEachEqual(allocatedSlotInfos))); } }

Target:
public void testCreateAllocatedSlotReport() throws Exception { final JobID jobId = new JobID(); try (SlotPoolImpl slotPool = createAndSetUpSlotPool(resourceManagerGateway, jobId)) { final ArrayBlockingQueue<AllocationID> allocationIds = new ArrayBlockingQueue<>(1); resourceManagerGateway.setRequestSlotConsumer( slotRequest -> allocationIds.offer(slotRequest.getAllocationId())); final CompletableFuture<PhysicalSlot> slotRequestFuture = requestNewAllocatedSlot( slotPool, new SlotRequestId()); final List<AllocatedSlotInfo> allocatedSlotInfos = new ArrayList<>(2); final List<SlotOffer> slotOffers = new ArrayList<>(2); final AllocationID allocatedId = allocationIds.take(); slotOffers.add(new SlotOffer(allocatedId, 0, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(0, allocatedId)); final AllocationID availableId = new AllocationID(); slotOffers.add(new SlotOffer(availableId, 1, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(1, availableId)); slotPool.registerTaskManager(taskManagerLocation.getResourceID()); slotPool.offerSlots(taskManagerLocation, taskManagerGateway, slotOffers); slotRequestFuture.get(); final AllocatedSlotReport slotReport = slotPool.createAllocatedSlotReport(taskManagerLocation.getResourceID()); assertThat(jobId, is(slotReport.getJobId())); assertThat(slotReport.getAllocatedSlotInfos(), containsInAnyOrder(isEachEqual(allocatedSlotInfos))); } }
Source:
public String toString() { return String.format("int@0x%x=0x%x (%d)", Pointer.nativeValue(getPointer()), getValue(), getValue()); }

Target:
public String toString() { return String.format("int@0x%1$x=0x%2$x (%2$d)", Pointer.nativeValue(getPointer()), getValue()); }
Source:
public IProblemProfile getResourceProfile(IResource element) { IProblemProfile prof = profiles.get(element); if (prof == null) { if (element instanceof IProject) { prof = (IProblemProfile) getWorkspaceProfile().clone(); ((ProblemProfile) prof).setResource(element); CodanPreferencesLoader loader = new CodanPreferencesLoader(prof); Preferences projectNode = CodanPreferencesLoader.getProjectNode((IProject) element); boolean useWorkspace = projectNode == null ? true : projectNode.getBoolean(PreferenceConstants.P_USE_PARENT, true); if (!useWorkspace) { loader.load(projectNode); } profiles.put(element, prof); } else if (element.getParent() != null) { prof = getResourceProfile(element.getParent()); } else { prof = getResourceProfile(element.getProject()); } } return prof; }

Target:
public IProblemProfile getResourceProfile(IResource element) { IProblemProfile prof = profiles.get(element); if (prof == null) { if (element instanceof IProject) { prof = (IProblemProfile) getWorkspaceProfile().clone(); ((ProblemProfile) prof).setResource(element); CodanPreferencesLoader loader = new CodanPreferencesLoader(prof); Preferences projectNode = CodanPreferencesLoader.getProjectNode((IProject) element); if (projectNode != null && !projectNode.getBoolean(PreferenceConstants.P_USE_PARENT, true)) { loader.load(projectNode); } profiles.put(element, prof); } else if (element.getParent() != null) { prof = getResourceProfile(element.getParent()); } else { prof = getResourceProfile(element.getProject()); } } return prof; }
Source:
private void tryReAddingEventToFrontOfQueue(E event) { try { deque.addFirst(event); } catch (IllegalStateException ese) { addInfo("Dropping event due to socket connection error and maxed out deque capacity"); } }

Target:
private void tryReAddingEventToFrontOfQueue(E event) { final boolean wasInserted = deque.offerFirst(event); if (!wasInserted) { addInfo("Dropping event due to socket connection error and maxed out deque capacity"); } }
Source:
public ColumnChunk(Block block, int[] definitionLevels, int[] repetitionLevels) { this.block = block; this.definitionLevels = definitionLevels; this.repetitionLevels = repetitionLevels; }

Target:
public ColumnChunk(Block block, int[] definitionLevels, int[] repetitionLevels) { this.block = requireNonNull(block, "block is null"); this.definitionLevels = requireNonNull(definitionLevels, "definitionLevels is null"); this.repetitionLevels = requireNonNull(repetitionLevels, "repetitionLevels is null"); }
Source:
public void testShouldPropogateExceptions() { Stream<Integer> values = ConcurrentStreams.map( ImmutableList.of(1, 2, 3, 4), value -> { throw new CustomExecutionException(); }, executor, 2); values.collect(Collectors.toList()); }

Target:
public void testShouldPropogateExceptions() { Stream<Integer> values = ConcurrentStreams.map( ImmutableList.of(1, 2, 3, 4), value -> { throw new CustomExecutionException(); }, executor, 2); assertThatThrownBy(() -> values.collect(Collectors.toList())) .isInstanceOf(CustomExecutionException.class); }
Source:
public void mdbWithFinalClass() throws IOException { MdbValidationsUtil.assertMDBClassValidity(buildClassInfoForClass("org.jboss.as.ejb3.util.InvalidMdbFinalClass")); }

Target:
public void mdbWithFinalClass() throws IOException, DeploymentUnitProcessingException { assertEquals(MdbValidityStatus.MDB_CLASS_CANNOT_BE_PRIVATE_ABSTRACT_OR_FINAL, MdbValidationsUtil.assertMDBClassValidity(buildClassInfoForClass(InvalidMdbFinalClass.class.getName()))); }
Source:
public void testRealTimeQueryNotId2() throws Exception { final String metacardTitle = "testRealTimeQueryNotId"; deleteAll(provider); MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord()); metacard.setTitle(metacardTitle); CreateResponse createResponse = create(metacard, provider); Optional<String> id = createResponse.getCreatedMetacards().stream().map(m -> m.getId()).findFirst(); if (!id.isPresent()) { Assert.fail("Metacard creation failed for metacard with title: " + metacardTitle); } queryAndVerifyCount( 1, getFilterBuilder().attribute(Metacard.ID).is().equalTo().text(id.get()), provider); Filter filter = getFilterBuilder() .not(getFilterBuilder().attribute(Metacard.ID).equalTo().text("can't match this")); queryAndVerifyCount(0, filter, provider); }

Target:
public void testRealTimeQueryNotId2() throws Exception { final String metacardTitle = "testRealTimeQueryNotId"; deleteAll(provider); MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord()); metacard.setTitle(metacardTitle); CreateResponse createResponse = create(metacard, provider); Optional<String> id = createResponse.getCreatedMetacards().stream().map(m -> m.getId()).findFirst(); assertTrue( "Metacard creation failed for metacard with title: " + metacardTitle, id.isPresent()); queryAndVerifyCount( 1, getFilterBuilder().attribute(Metacard.ID).is().equalTo().text(id.get()), provider); Filter filter = getFilterBuilder() .not(getFilterBuilder().attribute(Metacard.ID).equalTo().text("can't match this")); queryAndVerifyCount(0, filter, provider); }
Source:
public void setup() { super.setup(); roleAdminOption = api.getRoleAdminApi(); }

Target:
public void setup() { super.setup(); roleAdminOption = api.getRoleAdminApi(); if (!roleAdminOption.isPresent()) { throw new SkipException("The tests are skipped since OS-KSADM extension is not exposed through the Keystone API"); } }
Source:
protected void init(final VfsNicLabelModel model) { super.init(model); for (ListModel<String> labelModel : model.getItems()) { labelModel.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { ValueChangeEvent.fire(VfsNicLabelWidget.this, null); model.updateSuggestedLabels(); } }); } }

Target:
protected void init(final VfsNicLabelModel model) { super.init(model); selectedLabelsChanged(VfsNicLabelWidget.this); for (ListModel<String> labelModel : model.getItems()) { labelModel.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { selectedLabelsChanged(VfsNicLabelWidget.this); } }); } }
Source:
private void updateAppearanceColorWidgets(String systemDefaultKey) { if (systemDefaultKey == null) { fAppearanceColorDefault.setSelection(false); fAppearanceColorDefault.setVisible(false); fAppearanceColorEditor.getButton().setEnabled(true); } else { boolean systemDefault= fOverlayStore.getBoolean(systemDefaultKey); fAppearanceColorDefault.setSelection(systemDefault); fAppearanceColorDefault.setVisible(true); fAppearanceColorEditor.getButton().setEnabled(!systemDefault); } fAppearanceColorTableViewer.refresh(); }

Target:
private void updateAppearanceColorWidgets(String systemDefaultKey) { if (systemDefaultKey == null) { fAppearanceColorDefault.setSelection(false); fAppearanceColorDefault.setVisible(false); fAppearanceColorEditor.getButton().setEnabled(true); } else { boolean systemDefault= fOverlayStore.getBoolean(systemDefaultKey); fAppearanceColorDefault.setSelection(systemDefault); fAppearanceColorDefault.setVisible(true); fAppearanceColorEditor.getButton().setEnabled(!systemDefault); } }
Source:
public void publish(ChatRoom room, TranscriptionResult result) { JSONObject eventObject = createJSONObject(result); eventObject.put(JSON_KEY_TYPE, JSON_VALUE_TOPIC); super.sendJsonMessage(room, eventObject); }

Target:
public void publish(ChatRoom room, TranscriptionResult result) { JSONObject eventObject = createJSONObject(result); super.sendJsonMessage(room, eventObject); }
Source:
public void EdgeReached(Direction edge) { postEvent(this, "EdgeReached", edge); }

Target:
public void EdgeReached(Direction edge) { postEvent(this, "EdgeReached", edge.getValue()); }
Source:
public void testDontCreateNewTasksWhenInstanceChanged() { String[] instances = new String[]{"instance1", "instance2", "instance3"}; List<DatastreamGroup> datastreams = generateDatastreams("ds", 5); BroadcastStrategy strategy = new BroadcastStrategy(Optional.empty()); Map<String, Set<DatastreamTask>> assignment = strategy.assign(datastreams, Arrays.asList(instances), new HashMap<>()); instances = new String[]{"instance1", "instance2", "instance4"}; Map<String, Set<DatastreamTask>> newAssignment = strategy.assign(datastreams, Arrays.asList(instances), assignment); Set<DatastreamTask> oldAssignmentTasks = assignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); Set<DatastreamTask> newAssignmentTasks = newAssignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); LOG.info("{}", oldAssignmentTasks); LOG.info("{}", newAssignmentTasks); Assert.assertTrue(oldAssignmentTasks.containsAll(newAssignmentTasks)); }

Target:
public void testDontCreateNewTasksWhenInstanceChanged() { String[] instances = new String[]{"instance1", "instance2", "instance3"}; List<DatastreamGroup> datastreams = generateDatastreams("ds", 5); BroadcastStrategy strategy = new BroadcastStrategy(Optional.empty()); Map<String, Set<DatastreamTask>> assignment = strategy.assign(datastreams, Arrays.asList(instances), new HashMap<>()); instances = new String[]{"instance1", "instance2", "instance4"}; Map<String, Set<DatastreamTask>> newAssignment = strategy.assign(datastreams, Arrays.asList(instances), assignment); Set<DatastreamTask> oldAssignmentTasks = assignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); Set<DatastreamTask> newAssignmentTasks = newAssignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); Assert.assertEquals(oldAssignmentTasks, newAssignmentTasks); int totalTasks = newAssignment.values().stream().mapToInt(Set::size).sum(); Assert.assertEquals(totalTasks, newAssignmentTasks.size()); }
Source:
public CommandPalette(Commands commands, RAddins addins, ShortcutManager shortcuts, Host host) { initWidget(uiBinder.createAndBindUi(this)); entries_ = new ArrayList<CommandPaletteEntry>(); host_ = host; shortcuts_ = shortcuts; selected_ = -1; addins_ = addins; commands_ = commands; styles_.ensureInjected(); Element searchBox = searchBox_.getElement(); searchBox.setAttribute("placeholder", "Search and run commands"); searchBox.setAttribute("spellcheck", "false"); Element commandList = commandList_.getElement(); ElementIds.assignElementId(commandList, ElementIds.COMMAND_PALETTE_LIST); Roles.getListboxRole().set(commandList); Roles.getListboxRole().setAriaLabelProperty(commandList, "Matching commands"); ElementIds.assignElementId(searchBox_, ElementIds.COMMAND_PALETTE_SEARCH); Roles.getComboboxRole().setAriaOwnsProperty(searchBox, Id.of(commandList_.getElement())); Roles.getComboboxRole().set(searchBox); Roles.getComboboxRole().setAriaLabelProperty(searchBox, "Search for and run a command"); Roles.getComboboxRole().setAriaExpandedState(searchBox, ExpandedValue.TRUE); A11y.setARIAAutocomplete(searchBox_, "list"); A11y.setVisuallyHidden(resultsCount_); Roles.getAlertRole().setAriaLiveProperty(resultsCount_.getElement(), LiveValue.ASSERTIVE); Scheduler.get().scheduleDeferred(() -> { populate(); }); updateResultsCount_ = new DebouncedCommand(1000) { @Override protected void execute() { int count = 0; for (CommandPaletteEntry entry: entries_) { if (entry.isVisible()) count++; } resultsCount_.getElement().setInnerText(count + " " + "commands found, press up and down to navigate"); } }; }

Target:
public CommandPalette(Commands commands, RAddins addins, ShortcutManager shortcuts, Host host) { initWidget(uiBinder.createAndBindUi(this)); entries_ = new ArrayList<>(); host_ = host; shortcuts_ = shortcuts; selected_ = -1; addins_ = addins; commands_ = commands; attached_ = false; pageSize_ = 0; styles_.ensureInjected(); Element searchBox = searchBox_.getElement(); searchBox.setAttribute("placeholder", "Search and run commands"); searchBox.setAttribute("spellcheck", "false"); Element commandList = commandList_.getElement(); ElementIds.assignElementId(commandList, ElementIds.COMMAND_PALETTE_LIST); Roles.getListboxRole().set(commandList); Roles.getListboxRole().setAriaLabelProperty(commandList, "Matching commands"); ElementIds.assignElementId(searchBox_, ElementIds.COMMAND_PALETTE_SEARCH); Roles.getComboboxRole().setAriaOwnsProperty(searchBox, Id.of(commandList_.getElement())); Roles.getComboboxRole().set(searchBox); Roles.getComboboxRole().setAriaLabelProperty(searchBox, "Search for and run a command"); Roles.getComboboxRole().setAriaExpandedState(searchBox, ExpandedValue.TRUE); A11y.setARIAAutocomplete(searchBox_, "list"); Scheduler.get().scheduleDeferred(() -> { populate(); }); }
Source:
public Mail parseToEmail(EmailWrapper wrapper) { Mail email = new Mail(); Email sender; if (wrapper.getSenderName() == null || wrapper.getSenderName().isEmpty()) { sender = new Email(wrapper.getSenderEmail()); } else { sender = new Email(wrapper.getSenderEmail(), wrapper.getSenderName()); } email.setFrom(sender); email.setReplyTo(new Email(wrapper.getReplyTo())); Personalization personalization = new Personalization(); personalization.addTo(new Email(wrapper.getRecipient())); if (wrapper.getBcc() != null && !wrapper.getBcc().isEmpty()) { personalization.addBcc(new Email(wrapper.getBcc())); } email.addPersonalization(personalization); email.setSubject(wrapper.getSubject()); email.addContent(new Content("text/html", wrapper.getContent())); return email; }

Target:
public Mail parseToEmail(EmailWrapper wrapper) { Mail email = new Mail(); Email sender; if (wrapper.getSenderName() == null || wrapper.getSenderName().isEmpty()) { sender = new Email(wrapper.getSenderEmail()); } else { sender = new Email(wrapper.getSenderEmail(), wrapper.getSenderName()); } email.setFrom(sender); email.setReplyTo(new Email(wrapper.getReplyTo())); Personalization personalization = new Personalization(); personalization.addTo(new Email(wrapper.getRecipient())); if (wrapper.getBcc() != null && !wrapper.getBcc().isEmpty()) { personalization.addBcc(new Email(wrapper.getBcc())); } email.addPersonalization(personalization); email.setSubject(wrapper.getSubject()); email.addContent(new Content("text/plain", Jsoup.parse(wrapper.getContent()).text())); email.addContent(new Content("text/html", wrapper.getContent())); return email; }
Source:
private static List<Mutation> getMutationsForSystemTaskTable( PhoenixConnection conn, PreparedStatement stmt, boolean accessCheckEnabled) throws IOException { if (accessCheckEnabled) { return User.runAsLoginUser(() -> { final RpcCall rpcContext = RpcUtil.getRpcContext(); try { RpcUtil.setRpcContext(null); stmt.execute(); return conn.getMutationState().toMutations().next() .getSecond(); } catch (SQLException e) { throw new IOException(e); } finally { RpcUtil.setRpcContext(rpcContext); } }); } else { try { stmt.execute(); return conn.getMutationState().toMutations().next().getSecond(); } catch (SQLException e) { throw new IOException(e); } } }

Target:
private static List<Mutation> getMutationsForSystemTaskTable( PhoenixConnection conn, PreparedStatement stmt, boolean accessCheckEnabled) throws IOException { if (accessCheckEnabled) { return User.runAsLoginUser(() -> { final RpcCall rpcContext = RpcUtil.getRpcContext(); try { RpcUtil.setRpcContext(null); return executeStatementAndGetTaskMutations(conn, stmt); } catch (SQLException e) { throw new IOException(e); } finally { RpcUtil.setRpcContext(rpcContext); } }); } else { try { return executeStatementAndGetTaskMutations(conn, stmt); } catch (SQLException e) { throw new IOException(e); } } }
Source:
public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath, Function<byte[], T> deserializer, Closure<T> dataUpdateListener) throws InterruptedException, KeeperException, ZooKeeperConnectionException { ZooKeeperNode<T> zkNode = new ZooKeeperNode<T>(zkClient, nodePath, new FunctionWrapper<T>(deserializer), dataUpdateListener); zkNode.init(); return zkNode; }

Target:
public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath, Function<byte[], T> deserializer, Closure<T> dataUpdateListener) throws InterruptedException, KeeperException, ZooKeeperConnectionException { return create(zkClient, nodePath, new FunctionWrapper<T>(deserializer), dataUpdateListener); }
Source:
static public ExpressionThreadPoolExecutor getExpressionScheduledPool(String poolName) { ExecutorService pool = pools.get(poolName); if (pool == null) { synchronized (pools) { pool = pools.get(poolName); if (pool == null) { Integer cfg = getConfig(poolName); pool = new ExpressionThreadPoolExecutor(poolName, cfg); ((ThreadPoolExecutor) pool).setKeepAliveTime(THREAD_TIMEOUT, TimeUnit.SECONDS); ((ThreadPoolExecutor) pool).allowCoreThreadTimeOut(true); pools.put(poolName, pool); LoggerFactory.getLogger(ExpressionThreadPoolManager.class).debug( "Created an expression-drive scheduled thread pool '{}' of size {}", new Object[] { poolName, cfg }); } } } if (pool instanceof ExpressionThreadPoolExecutor) { return (ExpressionThreadPoolExecutor) pool; } else { throw new IllegalArgumentException("Pool " + poolName + " is not an expression-driven scheduled pool!"); } }

Target:
public static ExpressionThreadPoolExecutor getExpressionScheduledPool(String poolName) { ExecutorService pool = pools.get(poolName); if (pool == null) { synchronized (pools) { pool = pools.get(poolName); if (pool == null) { Integer cfg = getConfig(poolName); pool = new ExpressionThreadPoolExecutor(poolName, cfg); ((ThreadPoolExecutor) pool).setKeepAliveTime(THREAD_TIMEOUT, TimeUnit.SECONDS); ((ThreadPoolExecutor) pool).allowCoreThreadTimeOut(true); pools.put(poolName, pool); LoggerFactory.getLogger(ExpressionThreadPoolManager.class) .debug("Created an expression-drive scheduled thread pool '{}' of size {}", poolName, cfg); } } } if (pool instanceof ExpressionThreadPoolExecutor) { return (ExpressionThreadPoolExecutor) pool; } else { throw new IllegalArgumentException("Pool " + poolName + " is not an expression-driven scheduled pool!"); } }
Source:
public List<Training> showMentoringTrainings(@RequestParam String userId) { User user = userService.getUserById(Long.parseLong(userId)).get(); if (user.getRole() == UserRole.ADMIN || user.getRole() == UserRole.EMPLOYEE) return ((Employee)user).getMentoringTrainings(); else if (user.getRole() == UserRole.EXTERNAL_TRAINER) return ((ExternalTrainer)user).getMentoringTrainings(); return null; }

Target:
public List<Training> showMentoringTrainings(@RequestParam String userId) { User user = userService.getUserById(Long.parseLong(userId)).get(); if (user.getRole() == UserRole.ADMIN || user.getRole() == UserRole.EMPLOYEE || user.getRole() == UserRole.EXTERNAL_TRAINER) return ((ExternalTrainer)user).getMentoringTrainings(); return null; }
Source:
public void onOverlayViewSizeChanged(int width, int height) { synchronized(sLock) { if (sOverlayViewSizeChangedCallback != null) { if (!sOverlayViewSizeChangedCallback.getBundle() .getBoolean("OverlayViewCreated")) { sOverlayViewSizeChangedCallback.getBundle() .putBoolean("OverlayViewCreated", true); } else { if (sDummyVideoTrack.getVideoHeight() <= 0 || sDummyVideoTrack.getVideoWidth() <= 0) { Log.w(TAG, "The width or height of the selected video track is invalid."); } else if (height <= 0 || width <= 0) { Log.w(TAG, "The width or height of the OverlayView is incorrect."); } else if (Math.abs((float)width / height - (float)sDummyVideoTrack.getVideoWidth() * sDummyVideoTrack.getVideoPixelAspectRatio() / sDummyVideoTrack.getVideoHeight()) < sRatioEpsilon) { sOverlayViewSizeChangedCallback.post(); sOverlayViewSizeChangedCallback = null; notifyTrackSelected(TvTrackInfo.TYPE_VIDEO, null); } } } } }

Target:
public void onOverlayViewSizeChanged(int width, int height) { synchronized(sLock) { draw(); if (sOverlayViewSizeChangedCallback != null) { if (sDummyVideoTrack.getVideoHeight() <= 0 || sDummyVideoTrack.getVideoWidth() <= 0) { Log.w(TAG, "The width or height of the selected video track is invalid."); } else if (height <= 0 || width <= 0) { Log.w(TAG, "The width or height of the OverlayView is incorrect."); } else if (Math.abs((float)width / height - (float)sDummyVideoTrack.getVideoWidth() * sDummyVideoTrack.getVideoPixelAspectRatio() / sDummyVideoTrack.getVideoHeight()) < DISPLAY_RATIO_EPSILON) { sOverlayViewSizeChangedCallback.post(); sOverlayViewSizeChangedCallback = null; } } } }