auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testJoinAssignment() throws Exception { EasyMock.expect(member.memberId()).andStubReturn("member"); EasyMock.expect(member.currentProtocolVersion()).andStubReturn(CONNECT_PROTOCOL_V0); EasyMock.expect(worker.getPlugins()).andReturn(plugins); expectRebalance(1, Arrays.asList(CONN1), Arrays.asList(TASK1)); expectPostRebalanceCatchup(SNAPSHOT); Capture<Callback<TargetState>> onStart = newCapture(); worker.startConnector(EasyMock.eq(CONN1), EasyMock.<Map<String, String>>anyObject(), EasyMock.<CloseableConnectorContext>anyObject(), EasyMock.eq(herder), EasyMock.eq(TargetState.STARTED), capture(onStart)); PowerMock.expectLastCall().andAnswer(new IAnswer<Boolean>() { @Override public Boolean answer() throws Throwable { onStart.getValue().onCompletion(null, TargetState.STARTED); return true; } }); member.wakeup(); EasyMock.expect(worker.isRunning(CONN1)).andReturn(true); PowerMock.expectLastCall(); EasyMock.expect(worker.connectorTaskConfigs(CONN1, conn1SinkConfig)).andReturn(TASK_CONFIGS); worker.startTask(EasyMock.eq(TASK1), EasyMock.<ClusterConfigState>anyObject(), EasyMock.<Map<String, String>>anyObject(), EasyMock.<Map<String, String>>anyObject(), EasyMock.eq(herder), EasyMock.eq(TargetState.STARTED)); PowerMock.expectLastCall().andReturn(true); member.poll(EasyMock.anyInt()); PowerMock.expectLastCall(); PowerMock.replayAll(); herder.tick(); time.sleep(1000L); assertStatistics(3, 1, 100, 1000L); PowerMock.verifyAll(); }

Target:
public void testJoinAssignment() throws Exception { EasyMock.expect(member.memberId()).andStubReturn("member"); EasyMock.expect(member.currentProtocolVersion()).andStubReturn(CONNECT_PROTOCOL_V0); EasyMock.expect(worker.getPlugins()).andReturn(plugins); expectRebalance(1, Arrays.asList(CONN1), Arrays.asList(TASK1)); expectPostRebalanceCatchup(SNAPSHOT); Capture<Callback<TargetState>> onStart = newCapture(); worker.startConnector(EasyMock.eq(CONN1), EasyMock.<Map<String, String>>anyObject(), EasyMock.<CloseableConnectorContext>anyObject(), EasyMock.eq(herder), EasyMock.eq(TargetState.STARTED), capture(onStart)); PowerMock.expectLastCall().andAnswer(new IAnswer<Boolean>() { @Override public Boolean answer() throws Throwable { onStart.getValue().onCompletion(null, TargetState.STARTED); return true; } }); member.wakeup(); PowerMock.expectLastCall(); EasyMock.expect(worker.isRunning(CONN1)).andReturn(true); PowerMock.expectLastCall(); EasyMock.expect(worker.connectorTaskConfigs(CONN1, conn1SinkConfig)).andReturn(TASK_CONFIGS); worker.startTask(EasyMock.eq(TASK1), EasyMock.<ClusterConfigState>anyObject(), EasyMock.<Map<String, String>>anyObject(), EasyMock.<Map<String, String>>anyObject(), EasyMock.eq(herder), EasyMock.eq(TargetState.STARTED)); PowerMock.expectLastCall().andReturn(true); member.poll(EasyMock.anyInt()); PowerMock.expectLastCall(); PowerMock.replayAll(); herder.tick(); time.sleep(1000L); assertStatistics(3, 1, 100, 1000L); PowerMock.verifyAll(); }
Source:
private Token forceHole() { Token writeToken = rt.getSequencerView().next(streamId).getToken(); LogData hole = LogData.getHole(writeToken); rt.getAddressSpaceView().write(writeToken, hole, CacheOption.WRITE_AROUND); return writeToken; }

Target:
private Token forceHole() { Token writeToken = rt.getSequencerView().next(streamId).getToken(); LogData logData = new LogData(DataType.HOLE); logData.useToken(writeToken); rt.getAddressSpaceView().write(writeToken, logData, CacheOption.WRITE_AROUND); return writeToken; }
Source:
public static Collection<EvaluatorParameters> applyPlan(final Collection<EvaluatorParameters> activeEvaluators, final Plan plan) { final Map<String, EvaluatorParameters> evaluatorMap = new HashMap<>(); for (final EvaluatorParameters evaluator : activeEvaluators) { assertNull(String.format("Evaluator id %s should be unique", evaluator.getId()), evaluatorMap.put(evaluator.getId(), makeCopy(evaluator))); } for (final String idToAdd : plan.getEvaluatorsToAdd()) { assertNull(String.format("Evaluator id %s should be unique", idToAdd), evaluatorMap.put(idToAdd, getNewEvaluatorParameters(idToAdd))); } for (final TransferStep transferStep : plan.getTransferSteps()) { final EvaluatorParameters src = evaluatorMap.get(transferStep.getSrcId()); final EvaluatorParameters dest = evaluatorMap.get(transferStep.getDstId()); assertNotNull(String.format("Src evaluator %s to transfer data does not exist", transferStep.getSrcId()), src); assertNotNull(String.format("Dest evaluator %s to transfer data does not exist", transferStep.getDstId()), dest); removeData(src, transferStep.getDataInfo()); addData(dest, transferStep.getDataInfo()); } for (final String idToDelete : plan.getEvaluatorsToDelete()) { final EvaluatorParameters evaluator = evaluatorMap.remove(idToDelete); assertNotNull(String.format("No evaluator whose id is %s", idToDelete), evaluator); assertTrue(String.format("Evaluator %s to delete has data", idToDelete), isEmpty(evaluator.getDataInfos())); } return evaluatorMap.values(); }

Target:
private static Collection<EvaluatorParameters> applyPlan(final Collection<EvaluatorParameters> activeEvaluators, final Plan plan) { final Map<String, EvaluatorParameters> evaluatorMap = new HashMap<>(); for (final EvaluatorParameters evaluator : activeEvaluators) { assertNull(String.format("Evaluator id %s should be unique", evaluator.getId()), evaluatorMap.put(evaluator.getId(), makeCopy(evaluator))); } for (final String idToAdd : plan.getEvaluatorsToAdd()) { assertNull(String.format("Evaluator id %s should be unique", idToAdd), evaluatorMap.put(idToAdd, getNewEvaluatorParameters(idToAdd))); } for (final TransferStep transferStep : plan.getTransferSteps()) { final EvaluatorParameters src = evaluatorMap.get(transferStep.getSrcId()); final EvaluatorParameters dest = evaluatorMap.get(transferStep.getDstId()); assertNotNull(String.format("Src evaluator %s to transfer data does not exist", transferStep.getSrcId()), src); assertNotNull(String.format("Dest evaluator %s to transfer data does not exist", transferStep.getDstId()), dest); removeData(src, transferStep.getDataInfo()); addData(dest, transferStep.getDataInfo()); } for (final String idToDelete : plan.getEvaluatorsToDelete()) { final EvaluatorParameters evaluator = evaluatorMap.remove(idToDelete); assertNotNull(String.format("No evaluator whose id is %s", idToDelete), evaluator); assertTrue(String.format("Evaluator %s to delete has data", idToDelete), isEmpty(evaluator.getDataInfos())); } return evaluatorMap.values(); }
Source:
public void setRecipientMappings(Map<String, String> recipientMappings) { Assert.notEmpty(recipientMappings, "recipientMappings must not be empty"); this.recipients.clear(); for(Iterator<Entry<String, String>> it = recipientMappings.entrySet().iterator(); it.hasNext();) { Entry<String, String> next = it.next(); if(StringUtils.hasText(next.getValue())) { this.addRecipient(next.getKey(), next.getValue()); } else { this.addRecipient(next.getKey()); } } }

Target:
public void setRecipientMappings(Map<String, String> recipientMappings) { Assert.notEmpty(recipientMappings, "recipientMappings must not be empty"); ConcurrentLinkedQueue<Recipient> originalRecipients = this.recipients; this.recipients.clear(); for(Iterator<Entry<String, String>> it = recipientMappings.entrySet().iterator(); it.hasNext();) { Entry<String, String> next = it.next(); if(StringUtils.hasText(next.getValue())) { this.addRecipient(next.getKey(), next.getValue()); } else { this.addRecipient(next.getKey()); } } if (logger.isDebugEnabled()) { logger.debug("Channel Recipients:" + originalRecipients + " replaced with:" + this.recipients); } }
Source:
public void wizardShouldFinishSuccessfully() { By installDoneButtonSelector = by.button(".btn-primary.install-done"); waitFor(installDoneButtonSelector); control(installDoneButtonSelector).click(); waitFor(driver, hasContent("Welcome to Jenkins!"), 30); }

Target:
public void wizardShouldFinishSuccessfully() { By installDoneButtonSelector = by.css(".btn-primary.install-done"); waitFor(installDoneButtonSelector); control(installDoneButtonSelector).click(); waitFor(driver, hasContent("Welcome to Jenkins!"), 30); }
Source:
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException { validateTrade(sign, 1, 2, player, ess); if(ess.getSettings().isSellSignUpdatedToWorth()) { try { updateFromWorth(sign, ess); } catch (SignException e) { } } validateTrade(sign, 3, ess); return true; }

Target:
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException { validateTrade(sign, 1, 2, player, ess); if (sign.getLine(3).isEmpty()) { updateFromWorth(sign, player, ess); } else { validateTrade(sign, 3, ess); } return true; }
Source:
public void afterFromProto(Message proto) { super.afterFromProto(proto); switch (action) { case ACCEPT: flowAction = Rule.Accept; break; case DROP: flowAction = Rule.Drop; break; case REDIRECT: flowAction = Rule.Redirect; break; default: throw new IllegalArgumentException("Invalid action"); } }

Target:
public void afterFromProto(Message proto) { super.afterFromProto(proto); switch (action) { case ACCEPT: flowAction = Rule.Accept; break; case REDIRECT: flowAction = Rule.Redirect; break; default: throw new IllegalArgumentException("Invalid action"); } }
Source:
private int getSystemPropertyLength(String property) { return System.getProperty(property).length(); }

Target:
private int getSystemPropertyLength(String property) { String value = System.getProperty(property); if (value == null) { throw new NullPointerException(); } return value.length(); }
Source:
public MediaEntryViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); if (title_scrollview != null && title != null && itemView instanceof TouchInterceptFrameLayout) { } itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); }

Target:
public MediaEntryViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); }
Source:
private boolean setupNotification() { final Resources res = getResourcesForSubId(mContext, mActiveDataSubId); final SparseArray<Integer> downstreamIcons = getIcons(R.array.tethering_notification_icons, res); final int iconId = downstreamIcons.get(mDownstreamTypesMask, NO_ICON_ID); if (iconId == NO_ICON_ID) return NO_NOTIFY; final String title = res.getString(R.string.tethering_notification_title); final String message = res.getString(R.string.tethering_notification_message); final PendingIntent pi = PendingIntent.getActivity( mContext.createContextAsUser(UserHandle.CURRENT, 0 ), 0 , new Intent(Settings.ACTION_TETHER_SETTINGS), 0 , null ); showNotification(iconId, title, message, ENABLE_NOTIFICATION_ID, pi, new Action[0]); return NOTIFY_DONE; }

Target:
private boolean setupNotification() { final Resources res = getResourcesForSubId(mContext, mActiveDataSubId); final SparseArray<Integer> downstreamIcons = getIcons(R.array.tethering_notification_icons, res); final int iconId = downstreamIcons.get(mDownstreamTypesMask, NO_ICON_ID); if (iconId == NO_ICON_ID) return NO_NOTIFY; final String title = res.getString(R.string.tethering_notification_title); final String message = res.getString(R.string.tethering_notification_message); if (isEmpty(title) || isEmpty(message)) return NO_NOTIFY; final PendingIntent pi = PendingIntent.getActivity( mContext.createContextAsUser(UserHandle.CURRENT, 0 ), 0 , new Intent(Settings.ACTION_TETHER_SETTINGS), Intent.FLAG_ACTIVITY_NEW_TASK, null ); showNotification(iconId, title, message, ENABLE_NOTIFICATION_ID, pi, new Action[0]); return NOTIFY_DONE; }
Source:
public void topicTurnoverTest() throws StartupException, ConnectorException, InterruptedException, ProducerException { String topic = "forklift-string-topic"; Forklift forklift = serviceManager.newManagedForkliftInstance(); ForkliftProducerI producer = forklift.getConnector().getQueueProducer("forklift-string-topic"); sentMessageIds.add(producer.send("message1")); final Consumer c1 = new Consumer(StringConsumer.class, forklift); c1.setOutOfMessages((listener) -> { listener.shutdown(); }); c1.listen(); Thread.sleep(3000); sentMessageIds.add(producer.send("message2")); final Consumer c2 = new Consumer(StringConsumer.class, forklift); c2.setOutOfMessages((listener) -> { listener.shutdown(); }); c2.listen(); messageAsserts(); }

Target:
public void topicTurnoverTest() throws StartupException, ConnectorException, InterruptedException, ProducerException { Forklift forklift = serviceManager.newManagedForkliftInstance(); ForkliftProducerI producer = forklift.getConnector().getQueueProducer("forklift-string-topic"); sentMessageIds.add(producer.send("message1")); final Consumer c1 = new Consumer(StringConsumer.class, forklift); c1.setOutOfMessages((listener) -> { listener.shutdown(); }); c1.listen(); Thread.sleep(3000); sentMessageIds.add(producer.send("message2")); final Consumer c2 = new Consumer(StringConsumer.class, forklift); c2.setOutOfMessages((listener) -> { listener.shutdown(); }); c2.listen(); messageAsserts(); }
Source:
public synchronized String encrypt(String plainTextValue) { try { byte[] encryptedBytes = aead.encrypt(plainTextValue.getBytes(), ASSOCIATED_DATA); return Base64.getEncoder().encodeToString(encryptedBytes); } catch (GeneralSecurityException | NullPointerException e) { LOGGER.debug("Key and encryption service failed to set up. Failed to encrypt.", e); return plainTextValue; } }

Target:
public synchronized String encrypt(String plainTextValue) { try { return crypter.encrypt(plainTextValue); } catch (CrypterException e) { LOGGER.debug("Failed to encrypt string.", e); return plainTextValue; } }
Source:
public void setUpBase() { MockitoAnnotations.initMocks(this); injectorRule.bind(TransactionManager.class, transactionManager); ThreadPoolUtil.setExecutorService(Executors.newFixedThreadPool(5)); }

Target:
public void setUpBase() { MockitoAnnotations.initMocks(this); injectorRule.bind(TransactionManager.class, transactionManager); ThreadPoolUtil.setExecutorService(Executors.newFixedThreadPool(1)); }
Source:
public AboutItem(String text, List<HyperlinkRange> linkRanges, List<String> links) { this.text = text; this.linkRanges = linkRanges; this.hrefs = links; }

Target:
public AboutItem(String text, List<HyperlinkRange> linkRanges, List<String> links) { this.text = text; this.linkRanges.addAll(linkRanges); this.hrefs = links; }
Source:
private <Y> Type<Y> getMetaModelType(ValueContext typeContext) { switch ( typeContext.getValueClassification() ) { case BASIC: { return new BasicTypeImpl<Y>( typeContext.getBindableType(), Type.PersistenceType.BASIC ); } case ENTITY: { final org.hibernate.type.EntityType type = (EntityType) typeContext.getValue().getType(); return (Type<Y>) context.locateEntityType( type.getAssociatedEntityName() ); } case EMBEDDABLE: { final Component component = (Component) typeContext.getValue(); final EmbeddableTypeImpl<Y> embeddableType = new EmbeddableTypeImpl<Y>( component.getComponentClass(), typeContext.getAttributeMetadata().getOwnerType(), (ComponentType) typeContext.getValue().getType() ); context.registerEmbeddedableType( embeddableType ); final Iterator<Property> subProperties = component.getPropertyIterator(); while ( subProperties.hasNext() ) { final Property property = subProperties.next(); final AttributeImplementor<Y, Object> attribute = buildAttribute( embeddableType, property ); if ( attribute != null ) { embeddableType.getBuilder().addAttribute( attribute ); } } embeddableType.lock(); return embeddableType; } default: { throw new AssertionFailure( "Unknown type : " + typeContext.getValueClassification() ); } } }

Target:
private <Y> Type<Y> getMetaModelType(ValueContext typeContext) { switch ( typeContext.getValueClassification() ) { case BASIC: { return new BasicTypeImpl<Y>( typeContext.getBindableType(), Type.PersistenceType.BASIC ); } case ENTITY: { final org.hibernate.type.EntityType type = (EntityType) typeContext.getValue().getType(); return (Type<Y>) context.locateEntityType( type.getAssociatedEntityName() ); } case EMBEDDABLE: { final Component component = (Component) typeContext.getValue(); Class javaType; if ( component.getComponentClassName() == null ) { javaType = typeContext.getBindableType(); } else { javaType = component.getComponentClass(); } final EmbeddableTypeImpl<Y> embeddableType = new EmbeddableTypeImpl<Y>( javaType, typeContext.getAttributeMetadata().getOwnerType(), (ComponentType) typeContext.getValue().getType() ); context.registerEmbeddedableType( embeddableType ); final Iterator<Property> subProperties = component.getPropertyIterator(); while ( subProperties.hasNext() ) { final Property property = subProperties.next(); final AttributeImplementor<Y, Object> attribute = buildAttribute( embeddableType, property ); if ( attribute != null ) { embeddableType.getBuilder().addAttribute( attribute ); } } embeddableType.lock(); return embeddableType; } default: { throw new AssertionFailure( "Unknown type : " + typeContext.getValueClassification() ); } } }
Source:
private boolean isClusterLevelChange() { Version newVersion = getParameters().getClusterLevelChangeToVersion(); return newVersion != null && getVm().isRunningOrPaused() && (getVm().getCustomCompatibilityVersion() == null || !newVersion.equals(getVm().getCompatibilityVersion())); }

Target:
private boolean isClusterLevelChange() { Version newVersion = getParameters().getClusterLevelChangeToVersion(); return newVersion != null && getVm().isRunningOrPaused() && (getVm().getCustomCompatibilityVersion() == null || !newVersion.equals(getVm().getCustomCompatibilityVersion())); }
Source:
public static int count(OgmEntityPersister persister, TransactionalRemoteCacheImpl cache, ProtoStreamMappingAdapter mapper, Session currentSession) { if ( cache.getTransactionManager() == null ) { return cache.size(); } final Set<Object> committedKeys = new HashSet<>(); cache.keySet().forEach( committedKey -> { Boolean stillPresentInLocalTransaction = mapper.withinCacheEncodingContext( c -> c.containsKey( committedKey ) ); if ( stillPresentInLocalTransaction ) { committedKeys.add( committedKey ); } } ); Integer counter = new Integer( committedKeys.size() ); OgmSessionImpl ogmSession = (OgmSessionImpl) currentSession; PersistenceContext persistenceContext = ogmSession.getPersistenceContext(); for ( Object key : persistenceContext.getEntitiesByKey().keySet() ) { EntityKey entityKey = (EntityKey) key; if ( !( persister.getEntityName().equals( entityKey.getEntityName() ) ) ) { continue; } ProtostreamId entryKey = convertEntityKey( entityKey, ogmSession, mapper ); if ( !committedKeys.contains( entryKey ) ) { counter++; } } return counter; }

Target:
public static int count(OgmEntityPersister persister, TransactionalRemoteCacheImpl cache, ProtoStreamMappingAdapter mapper, Session currentSession) { if ( cache.getTransactionManager() == null ) { return cache.size(); } final Set<Object> committedKeys = new HashSet<>(); cache.keySet().forEach( committedKey -> { Boolean stillPresentInLocalTransaction = mapper.withinCacheEncodingContext( c -> c.containsKey( committedKey ) ); if ( stillPresentInLocalTransaction ) { committedKeys.add( committedKey ); } } ); int counter = committedKeys.size(); OgmSessionImpl ogmSession = (OgmSessionImpl) currentSession; PersistenceContext persistenceContext = ogmSession.getPersistenceContext(); for ( Object key : persistenceContext.getEntitiesByKey().keySet() ) { EntityKey entityKey = (EntityKey) key; if ( !( persister.getEntityName().equals( entityKey.getEntityName() ) ) ) { continue; } ProtostreamId entryKey = convertEntityKey( entityKey, ogmSession, mapper ); if ( !committedKeys.contains( entryKey ) ) { counter++; } } return counter; }
Source:
private static ThemeSource<?> parseThemeSource(Map<String, ?> map) { String type = (String) map.get("type"); if (type == null) throw new RuntimeException("Theme source must have type"); if (type.equals("filesystem")) { String path = (String) map.get("path"); if (path == null) throw new RuntimeException("Filesystem theme source must have path"); return new FilesystemThemeSource(new File(path)); } else { throw new RuntimeException("Unrecognized theme source type: " + type); } }

Target:
private static ThemeSource<?> parseThemeSource(Map<String, ?> map) { String typeStr = (String) map.get("type"); if (typeStr == null) throw new RuntimeException("Theme source must have type"); ThemeSourceType sourceType = ThemeSourceType.BY_TYPE.get(typeStr); if (sourceType == null) throw new RuntimeException("Unrecognized theme source type: " + typeStr); return sourceType.build(map); }
Source:
protected AgentInstance(Agent agent, AgentType agentType, SystemEnvironment systemEnvironment, AgentStatusChangeListener agentStatusChangeListener) { this.systemEnvironment = systemEnvironment; this.agentRuntimeInfo = AgentRuntimeInfo.initialState(agent); this.agentStatusChangeListener = agentStatusChangeListener; this.agentConfigStatus = AgentConfigStatus.Pending; this.agent = agent; this.agentType = agentType; this.timeProvider = new TimeProvider(); }

Target:
protected AgentInstance(Agent agent, AgentType agentType, SystemEnvironment systemEnvironment, AgentStatusChangeListener agentStatusChangeListener) { this.systemEnvironment = systemEnvironment; this.agentRuntimeInfo = AgentRuntimeInfo.initialState(agent); this.agentStatusChangeListener = agentStatusChangeListener; this.agentConfigStatus = Pending; this.agent = agent; this.agentType = agentType; this.timeProvider = new TimeProvider(); }
Source:
public void execute() { if (analysisMetadataHolder.isFirstAnalysis()) { LOG.debug("First analysis. Do nothing."); return; } Map<String, DbComponent> dbFilesByKey = getDbFilesByKey(); if (dbFilesByKey.isEmpty()) { LOG.debug("Previous snapshot has no file. Do nothing."); return; } Map<String, Component> reportFilesByKey = getReportFilesByKey(this.rootHolder.getRoot()); if (reportFilesByKey.isEmpty()) { LOG.debug("No files in report. Do nothing."); return; } Set<String> addedFileKeys = Sets.difference(reportFilesByKey.keySet(), dbFilesByKey.keySet()); Set<String> removedFileKeys = Sets.difference(dbFilesByKey.keySet(), reportFilesByKey.keySet()); if (addedFileKeys.isEmpty() || removedFileKeys.isEmpty()) { LOG.debug("Either no files added or no files removed. Do nothing."); return; } Map<String, File> reportFileSourcesByKey = getReportFileSourcesByKey(reportFilesByKey, addedFileKeys); ScoreMatrix scoreMatrix = computeScoreMatrix(dbFilesByKey, removedFileKeys, reportFileSourcesByKey); printIfDebug(scoreMatrix); if (scoreMatrix.getMaxScore() < MIN_REQUIRED_SCORE) { LOG.debug("max score in matrix is less than min required score (%s). Do nothing.", MIN_REQUIRED_SCORE); return; } MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix); ElectedMatches electedMatches = electMatches(removedFileKeys, reportFileSourcesByKey, matchesByScore); registerMatches(dbFilesByKey, reportFilesByKey, electedMatches); }

Target:
public void execute() { if (analysisMetadataHolder.isFirstAnalysis()) { LOG.debug("First analysis. Do nothing."); return; } Map<String, DbComponent> dbFilesByKey = getDbFilesByKey(); if (dbFilesByKey.isEmpty()) { LOG.debug("Previous snapshot has no file. Do nothing."); return; } Map<String, Component> reportFilesByKey = getReportFilesByKey(this.rootHolder.getRoot()); if (reportFilesByKey.isEmpty()) { LOG.debug("No files in report. Do nothing."); return; } Set<String> addedFileKeys = ImmutableSet.copyOf(Sets.difference(reportFilesByKey.keySet(), dbFilesByKey.keySet())); Set<String> removedFileKeys = ImmutableSet.copyOf(Sets.difference(dbFilesByKey.keySet(), reportFilesByKey.keySet())); if (addedFileKeys.isEmpty() || removedFileKeys.isEmpty()) { LOG.debug("Either no files added or no files removed. Do nothing."); return; } Map<String, File> reportFileSourcesByKey = getReportFileSourcesByKey(reportFilesByKey, addedFileKeys); ScoreMatrix scoreMatrix = computeScoreMatrix(dbFilesByKey, removedFileKeys, reportFileSourcesByKey); printIfDebug(scoreMatrix); if (scoreMatrix.getMaxScore() < MIN_REQUIRED_SCORE) { LOG.debug("max score in matrix is less than min required score (%s). Do nothing.", MIN_REQUIRED_SCORE); return; } MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix); ElectedMatches electedMatches = electMatches(removedFileKeys, reportFileSourcesByKey, matchesByScore); registerMatches(dbFilesByKey, reportFilesByKey, electedMatches); }
Source:
public synchronized void close() { _zkClient.close(); try { _forwardHttpClient.close(); } catch (IOException e) { LOG.error("HttpClient fails to close. ", e); } }

Target:
public synchronized void close() { _zkClient.close(); try { _forwardHttpClient.close(); } catch (IOException e) { LOG.error("HttpClient failed to close. ", e); } }
Source:
public void handle(FailureContext context) { try { String failingOperationDescription = context.getFailingOperation().toString(); Throwable throwable = context.getThrowable(); } catch (Throwable t) { } }

Target:
public void handle(FailureContext context) { String failingOperationDescription = context.getFailingOperation().toString(); Throwable throwable = context.getThrowable(); }
Source:
private boolean isVisible(long txnId) throws IOException{ TxnView toCompare=fetchTransaction(txnId); if(toCompare == null) { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "Transaction %d cannot be found. Splice assumes it is visible.", txnId); } } return toCompare != null ? myTxn.canSee(toCompare) : true; }

Target:
private boolean isVisible(long txnId) throws IOException{ TxnView toCompare=fetchTransaction(txnId); if(toCompare == null && ignoreMissingTxns) { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "Transaction %d cannot be found. Splice assumes it is visible.", txnId); } } return toCompare != null ? myTxn.canSee(toCompare) : (ignoreMissingTxns ? true :false); }
Source:
public void sendPluginResult(PluginResult pluginResult) { synchronized (this) { if (finished) { return; } else { finished = true; } } JSONObject event = new JSONObject(); JSONObject pluginResultObject = new JSONObject(); try { pluginResultObject.put("pluginServiceName", this.serviceName); pluginResultObject.put("pluginStatus", PluginResult.StatusMessages[pluginResult.getStatus()]); event.put("action", "resume"); event.put("pendingResult", pluginResultObject); } catch (JSONException e) { LOG.e(TAG, "Unable to create resume object for Activity Result"); } PluginResult eventResult = new PluginResult(PluginResult.Status.OK, event); List<PluginResult> result = new ArrayList<PluginResult>(); result.add(eventResult); result.add(pluginResult); CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result)); }

Target:
public void sendPluginResult(PluginResult pluginResult) { synchronized (this) { if (finished) { LOG.w(TAG, serviceName + " attempted to send a second callback to ResumeCallback\nResult was: " + pluginResult.getMessage()); return; } else { finished = true; } } JSONObject event = new JSONObject(); JSONObject pluginResultObject = new JSONObject(); try { pluginResultObject.put("pluginServiceName", this.serviceName); pluginResultObject.put("pluginStatus", PluginResult.StatusMessages[pluginResult.getStatus()]); event.put("action", "resume"); event.put("pendingResult", pluginResultObject); } catch (JSONException e) { LOG.e(TAG, "Unable to create resume object for Activity Result"); } PluginResult eventResult = new PluginResult(PluginResult.Status.OK, event); List<PluginResult> result = new ArrayList<PluginResult>(); result.add(eventResult); result.add(pluginResult); CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result)); }
Source:
private HeaderChannelBuffer(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) { this.channel = channel; this.buffer = ByteBuffer.allocate(maxPageBytes).order(ByteOrder.LITTLE_ENDIAN); this.remaining = capacity; }

Target:
private HeaderChannelBuffer(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) { this.channel = channel; int limit = (int) Math.min(maxPageBytes, capacity); this.buffer = ByteBuffer.allocate(limit).order(ByteOrder.LITTLE_ENDIAN); this.remaining = capacity; }
Source:
private Iterable<String> urisFor(String csvIds) { if (Strings.isNullOrEmpty((csvIds))) { return ImmutableSet.of(); } Iterable<Long> ids = StreamSupport.stream(commaSplitter.split(csvIds).spliterator(), false) .map(input -> codec.decode(input).longValue()) .collect(Collectors.toList()); return StreamSupport.stream(lookupEntryStore.entriesForIds(ids).spliterator(), false) .map(LookupEntry.TO_ID::apply) .collect(Collectors.toList()); }

Target:
private Iterable<String> urisFor(String csvIds) { if (Strings.isNullOrEmpty((csvIds))) { return ImmutableSet.of(); } Iterable<Long> ids = StreamSupport.stream(commaSplitter.split(csvIds).spliterator(), false) .map(input -> codec.decode(input).longValue()) .collect(Collectors.toList()); return StreamSupport.stream(lookupEntryStore.entriesForIds(ids).spliterator(), false) .map(LookupEntry::uri) .collect(Collectors.toList()); }
Source:
public void patientVoided_shouldVoidMemberships() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); Patient voidedPatient = new Patient(7); voidedPatient.setVoided(true); CohortMembership newMemberContainingVoidedPatient = new CohortMembership(voidedPatient); cohort.addMembership(newMemberContainingVoidedPatient); assertTrue(cohort.contains(newMemberContainingVoidedPatient)); service.patientVoided(voidedPatient); assertNotNull(newMemberContainingVoidedPatient.getEndDate()); assertTrue(newMemberContainingVoidedPatient.getVoided()); assertNotNull(newMemberContainingVoidedPatient.getDateVoided()); assertNotNull(newMemberContainingVoidedPatient.getVoidedBy()); assertNotNull(newMemberContainingVoidedPatient.getVoidReason()); }

Target:
public void patientVoided_shouldVoidMemberships() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(2); Patient voidedPatient = new Patient(7); voidedPatient.setVoided(true); voidedPatient.setDateVoided(new Date()); voidedPatient.setVoidedBy(Context.getAuthenticatedUser()); voidedPatient.setVoidReason("Voided as a result of the associated patient getting voided"); CohortMembership newMemberContainingVoidedPatient = new CohortMembership(voidedPatient); cohort.addMembership(newMemberContainingVoidedPatient); assertTrue(cohort.contains(voidedPatient)); service.patientVoided(voidedPatient); assertTrue(newMemberContainingVoidedPatient.getVoided()); assertEquals(voidedPatient.getDateVoided(), newMemberContainingVoidedPatient.getDateVoided()); assertEquals(voidedPatient.getVoidedBy(), newMemberContainingVoidedPatient.getVoidedBy()); assertEquals(voidedPatient.getVoidReason(), newMemberContainingVoidedPatient.getVoidReason()); }
Source:
public FacadeBlockStateInfo(IBlockState state, ItemStack requiredStack, ImmutableSet<IProperty<?>> varyingProperties) { this.state = Objects.requireNonNull(state, "state must not be null!"); Objects.requireNonNull(state.getBlock(), "state.getBlock must not be null!"); Objects.requireNonNull(state.getBlock().getRegistryName(), "state.getBlock.getRegistryName() must not be null!"); this.requiredStack = requiredStack; this.varyingProperties = varyingProperties; this.isTransparent = !state.isOpaqueCube(); this.isVisible = !requiredStack.isEmpty(); IBlockAccess access = new SingleBlockAccess(state); for (EnumFacing side : EnumFacing.VALUES) { isSideSolid[side.ordinal()] = state.isSideSolid(access, BlockPos.ORIGIN, side) || state.getBlockFaceShape(access, BlockPos.ORIGIN, side) == BlockFaceShape.SOLID; } }

Target:
public FacadeBlockStateInfo(IBlockState state, ItemStack requiredStack, ImmutableSet<IProperty<?>> varyingProperties) { this.state = Objects.requireNonNull(state, "state must not be null!"); Objects.requireNonNull(state.getBlock(), "state.getBlock must not be null!"); Objects.requireNonNull(state.getBlock().getRegistryName(), "state.getBlock.getRegistryName() must not be null!"); this.requiredStack = requiredStack; this.varyingProperties = varyingProperties; this.isTransparent = !state.isOpaqueCube(); this.isVisible = !requiredStack.isEmpty(); IBlockAccess access = new SingleBlockAccess(state); for (EnumFacing side : EnumFacing.VALUES) { isSideSolid[side.ordinal()] = state.isSideSolid(access, BlockPos.ORIGIN, side); blockFaceShape[side.ordinal()] = state.getBlockFaceShape(access, BlockPos.ORIGIN, side); } }
Source:
public void start() { try { startStopLock.writeLock().lockInterruptibly(); } catch (InterruptedException e) { throw Throwables.propagate(e); } try { if (!started.getAndSet(true)) { if (lookupSnapshotTaker != null) { final List<LookupBean> lookupBeanList = lookupSnapshotTaker.pullExistingSnapshot(); for (LookupBean lookupBean : lookupBeanList) { this.put(lookupBean.name, lookupBean.factory); } } LOGGER.info("Started lookup factory references manager"); } } finally { startStopLock.writeLock().unlock(); } }

Target:
public void start() { startStopLock.writeLock().lock(); try { if (!started.getAndSet(true)) { if (lookupSnapshotTaker != null) { final List<LookupBean> lookupBeanList = lookupSnapshotTaker.pullExistingSnapshot(); for (LookupBean lookupBean : lookupBeanList) { this.put(lookupBean.name, lookupBean.factory); } } LOGGER.info("Started lookup factory references manager"); } } finally { startStopLock.writeLock().unlock(); } }
Source:
private void runManagement() { while (true) { if (Thread.interrupted()) { LOG.debug("Coordinator interrupted."); break; } BlockManagementTask currentTask; try { if (mBackoffStrategy == BackoffStrategy.ANY && mLoadTracker.loadDetected(BlockStoreLocation.anyTier())) { LOG.debug("Load detected. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } final BlockManagementTask nextTask = getNextTask(); if (nextTask == null) { LOG.debug("No management task pending. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } currentTask = nextTask; LOG.debug("Running task of type:{}", currentTask.getClass().getSimpleName()); try { BlockManagementTaskResult result = currentTask.run(); LOG.debug("Management task: finished with result: {}", currentTask.getClass().getSimpleName(), result); if (result.noProgress()) { LOG.debug("Task made no progress due to failures/back-offs. Sleeping {}ms", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); } } catch (Exception e) { LOG.error("Management task failed: {}. Error: {}", currentTask.getClass().getSimpleName(), e); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } catch (Throwable t) { LOG.error("Unexpected error during block management: {}", t); } } LOG.debug("Block management coordinator exited."); }

Target:
private void runManagement() { while (true) { if (Thread.interrupted()) { LOG.debug("Coordinator interrupted."); break; } BlockManagementTask currentTask; try { if (mBackoffStrategy == BackoffStrategy.ANY && mLoadTracker.loadDetected(BlockStoreLocation.anyTier())) { LOG.debug("Load detected. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } final BlockManagementTask nextTask = getNextTask(); if (nextTask == null) { LOG.debug("No management task pending. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } currentTask = nextTask; LOG.debug("Running task of type:{}", currentTask.getClass().getSimpleName()); try { BlockManagementTaskResult result = currentTask.run(); LOG.info("{} finished with result: {}", currentTask.getClass().getSimpleName(), result); if (result.noProgress()) { LOG.debug("Task made no progress due to failures/back-offs. Sleeping {}ms", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); } } catch (Exception e) { LOG.error("Management task failed: {}. Error: {}", currentTask.getClass().getSimpleName(), e); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } catch (Throwable t) { LOG.error("Unexpected error during block management: {}", t); } } LOG.debug("Block management coordinator exited."); }
Source:
private void populateReviews(List<TaskReview> reviewContainers) throws NumberFormatException { for (ITask review : reviews) { reviewContainers.add(new TaskReview(review)); } }

Target:
private void populateReviews(List<TaskReview> reviewContainers) { for (ITask review : reviews) { reviewContainers.add(new TaskReview(review)); } }
Source:
public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); try { monitor.beginTask("Submitting_task", IProgressMonitor.UNKNOWN); BugzillaRestClient client = connector.getClient(repository); try { IOperationMonitor progress = OperationUtil.convert(monitor, "post taskdata", 3); progress.addFlag(OperationFlag.BACKGROUND); return client.postTaskData(taskData, oldAttributes, progress); } catch (BugzillaRestException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, 2, "Error post taskdata.\n\n" + e.getMessage(), e)); } } finally { monitor.done(); } }

Target:
public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); try { monitor.beginTask("Submitting_task", IProgressMonitor.UNKNOWN); BugzillaRestClient client = connector.getClient(repository); try { IOperationMonitor progress = OperationUtil.convert(monitor, "post taskdata", 3); return client.postTaskData(taskData, oldAttributes, progress); } catch (BugzillaRestException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, 2, "Error post taskdata.\n\n" + e.getMessage(), e)); } } finally { monitor.done(); } }
Source:
private void setUsbConfig(long config, boolean chargingFunctions) { if (true) Slog.d(TAG, "setUsbConfig(" + config + ") request:" + ++mCurrentRequest); removeMessages(MSG_FUNCTION_SWITCH_TIMEOUT); removeMessages(MSG_SET_FUNCTIONS_TIMEOUT); removeMessages(MSG_SET_CHARGING_FUNCTIONS); synchronized (mGadgetProxyLock) { if (mGadgetProxy == null) { Slog.e(TAG, "setUsbConfig mGadgetProxy is null"); return; } try { UsbGadgetCallback usbGadgetCallback = new UsbGadgetCallback(mCurrentRequest, config, chargingFunctions); mGadgetProxy.setCurrentUsbFunctions(UsbManager.FUNCTION_NONE, usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); if ((config & UsbManager.FUNCTION_ADB) != 0) { setSystemProperty(CTL_START, ADBD); } else { setSystemProperty(CTL_STOP, ADBD); } mGadgetProxy.setCurrentUsbFunctions(config, usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); sendMessageDelayed(MSG_SET_FUNCTIONS_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS); sendMessageDelayed(MSG_FUNCTION_SWITCH_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS + ENUMERATION_TIME_OUT_MS); if (DEBUG) Slog.d(TAG, "timeout message queued"); } catch (RemoteException e) { Slog.e(TAG, "Remoteexception while calling setCurrentUsbFunctions", e); } } }

Target:
private void setUsbConfig(long config, boolean chargingFunctions) { if (true) Slog.d(TAG, "setUsbConfig(" + config + ") request:" + ++mCurrentRequest); removeMessages(MSG_FUNCTION_SWITCH_TIMEOUT); removeMessages(MSG_SET_FUNCTIONS_TIMEOUT); removeMessages(MSG_SET_CHARGING_FUNCTIONS); synchronized (mGadgetProxyLock) { if (mGadgetProxy == null) { Slog.e(TAG, "setUsbConfig mGadgetProxy is null"); return; } try { UsbGadgetCallback usbGadgetCallback = new UsbGadgetCallback(mCurrentRequest, config, chargingFunctions); isCbReceived.close(); mGadgetProxy.setCurrentUsbFunctions(UsbManager.FUNCTION_NONE, usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); boolean isThreadOpened = isCbReceived.block(SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); if (!isThreadOpened) { Slog.e(TAG, "Callback was received with unsuccessful status"); } if ((config & UsbManager.FUNCTION_ADB) != 0) { setSystemProperty(CTL_START, ADBD); } else { setSystemProperty(CTL_STOP, ADBD); } mGadgetProxy.setCurrentUsbFunctions(config, usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); sendMessageDelayed(MSG_SET_FUNCTIONS_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS); sendMessageDelayed(MSG_FUNCTION_SWITCH_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS + ENUMERATION_TIME_OUT_MS); if (DEBUG) Slog.d(TAG, "timeout message queued"); } catch (RemoteException e) { Slog.e(TAG, "Remoteexception while calling setCurrentUsbFunctions", e); } } }
Source:
private static RetryOptions.Builder createRetryOptions(Configuration configuration) { RetryOptions.Builder retryOptionsBuilder = new RetryOptions.Builder(); boolean enableRetries = configuration.getBoolean( ENABLE_GRPC_RETRIES_KEY, ENABLE_GRPC_RETRIES_DEFAULT); LOG.debug("gRPC retries enabled: %s", enableRetries); retryOptionsBuilder.setEnableRetries(enableRetries); boolean retryOnDeadlineExceeded = configuration.getBoolean( ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_KEY, ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_DEFAULT); LOG.debug("gRPC retry on deadline exceeded enabled: %s", retryOnDeadlineExceeded); retryOptionsBuilder.setRetryOnDeadlineExceeded(retryOnDeadlineExceeded); int maxElapsedBackoffMillis = configuration.getInt( MAX_ELAPSED_BACKOFF_MILLIS_KEY, MAX_ELAPSED_BACKOFF_MILLIS_DEFAULT); LOG.debug("gRPC retry maxElapsedBackoffMillis: %d", maxElapsedBackoffMillis); retryOptionsBuilder.setMaxElapsedBackoffMillis(maxElapsedBackoffMillis); return retryOptionsBuilder; }

Target:
private static RetryOptions createRetryOptions(Configuration configuration) { RetryOptions.Builder retryOptionsBuilder = new RetryOptions.Builder(); boolean enableRetries = configuration.getBoolean( ENABLE_GRPC_RETRIES_KEY, ENABLE_GRPC_RETRIES_DEFAULT); LOG.debug("gRPC retries enabled: %s", enableRetries); retryOptionsBuilder.setEnableRetries(enableRetries); boolean retryOnDeadlineExceeded = configuration.getBoolean( ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_KEY, ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_DEFAULT); LOG.debug("gRPC retry on deadline exceeded enabled: %s", retryOnDeadlineExceeded); retryOptionsBuilder.setRetryOnDeadlineExceeded(retryOnDeadlineExceeded); int maxElapsedBackoffMillis = configuration.getInt( MAX_ELAPSED_BACKOFF_MILLIS_KEY, MAX_ELAPSED_BACKOFF_MS_DEFAULT); LOG.debug("gRPC retry maxElapsedBackoffMillis: %d", maxElapsedBackoffMillis); retryOptionsBuilder.setMaxElapsedBackoffMillis(maxElapsedBackoffMillis); return retryOptionsBuilder.build(); }
Source:
private void onDelegateException( RuntimeException e ) { if ( isUnrecoverableErrorsOccurred( e ) ) { unrecoverableErrorsOccurred = true; if( isClusterError( e ) ) { e = new ClientException( "The driver and server are incompatible. " + "1.0 driver does not support running statements against a 3.1+ core edge cluster. " + "Please upgrade to 1.1 driver and use `bolt+cluster` scheme to run statements directly" + " against a 3.1+ core edge cluster.", e ); } } else { ackFailure(); } if( onError != null ) { onError.run(); } throw e; }

Target:
private void onDelegateException( RuntimeException e ) { if ( isUnrecoverableErrorsOccurred( e ) ) { unrecoverableErrorsOccurred = true; if( isClusterError( e ) ) { e = new ClientException( format( "Failed to run a statement on a 3.1+ Neo4j core-edge cluster server. %n" + "Please retry the statement if you have defined your own routing strategy to route driver messages to the cluster. " + "Note: 1.0 java driver does not support routing statements to a 3.1+ Neo4j core edge cluster. " + "Please upgrade to 1.1 driver and use `bolt+routing` scheme to route and run statements " + "directly to a 3.1+ core edge cluster." ), e ); } } else { ackFailure(); } if( onError != null ) { onError.run(); } throw e; }
Source:
private void handleRemoteRequest(JsonRpcPeer peer, JSONObject requestNode) throws MessageHandlingException { JsonRpcRequest request; request = mObjectMapper.convertValue( requestNode, JsonRpcRequest.class); JSONObject result = null; JSONObject error = null; try { result = mMethodDispatcher.dispatch(peer, request.method, request.params); } catch (JsonRpcException e) { logDispatchException(e); error = mObjectMapper.convertValue(e.getErrorMessage(), JSONObject.class); } if (request.id != null) { JsonRpcResponse response = new JsonRpcResponse(); response.id = request.id; response.result = result; response.error = error; JSONObject jsonObject = mObjectMapper.convertValue(response, JSONObject.class); String responseString; try { responseString = jsonObject.toString(); } catch (OutOfMemoryError e) { throw new MessageHandlingException(e); } peer.getWebSocket().sendText(responseString); } }

Target:
private void handleRemoteRequest(JsonRpcPeer peer, JSONObject requestNode) throws MessageHandlingException { JsonRpcRequest request; request = mObjectMapper.convertValue( requestNode, JsonRpcRequest.class); JSONObject result = null; JSONObject error = null; try { result = mMethodDispatcher.dispatch(peer, request.method, request.params); } catch (JsonRpcException e) { logDispatchException(e); error = mObjectMapper.convertValue(e.getErrorMessage(), JSONObject.class); } if (request.id != null) { JsonRpcResponse response = new JsonRpcResponse(); response.id = request.id; response.result = result; response.error = error; JSONObject jsonObject = mObjectMapper.convertValue(response, JSONObject.class); String responseString; try { responseString = jsonObject.toString(); } catch (OutOfMemoryError e) { response.result = null; response.error = mObjectMapper.convertValue(e.getMessage(), JSONObject.class); jsonObject = mObjectMapper.convertValue(response, JSONObject.class); responseString = jsonObject.toString(); } peer.getWebSocket().sendText(responseString); } }
Source:
protected AnnotationDescriptor<A> createAnnotationDescriptor() { AnnotationDescriptor.Builder<A> annotationDescriptorBuilder = new AnnotationDescriptor.Builder<>( annotationType ); for ( Map.Entry<String, Object> parameter : parameters.entrySet() ) { annotationDescriptorBuilder.setAttribute( parameter.getKey(), parameter.getValue() ); } for ( Map.Entry<String, List<AnnotationDef<?, ?>>> annotationAsParameter : annotationsAsParameters.entrySet() ) { annotationDescriptorBuilder.setAttribute( annotationAsParameter.getKey(), toAnnotationParameterArray( annotationAsParameter.getValue(), annotationsAsParametersTypes.get( annotationAsParameter.getKey() ) ) ); } try { return annotationDescriptorBuilder.build(); } catch (RuntimeException e) { throw LOG.getUnableToCreateAnnotationForConfiguredConstraintException( e ); } }

Target:
protected AnnotationDescriptor<A> createAnnotationDescriptor() { for ( Map.Entry<String, List<AnnotationDef<?, ?>>> annotationAsParameter : annotationsAsParameters.entrySet() ) { annotationDescriptorBuilder.setAttribute( annotationAsParameter.getKey(), toAnnotationParameterArray( annotationAsParameter.getValue(), annotationsAsParametersTypes.get( annotationAsParameter.getKey() ) ) ); } try { return annotationDescriptorBuilder.build(); } catch (RuntimeException e) { throw LOG.getUnableToCreateAnnotationForConfiguredConstraintException( e ); } }
Source:
private void populateSourceContextData(AbstractFile sourceFile) throws NoCurrentCaseException, TskCoreException { SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase(); boolean foundASource = false; for (BlackboardArtifact.ARTIFACT_TYPE artifactType : SOURCE_CONTEXT_ARTIFACTS) { List<BlackboardArtifact> artifactsList = tskCase.getBlackboardArtifacts(artifactType, sourceFile.getId()); if (!artifactsList.isEmpty()) { foundASource = true; } for (BlackboardArtifact contextArtifact : artifactsList) { addSourceEntry(contextArtifact); } } if (foundASource == false) { setSourceName("Unknown"); showSourceText(false); } }

Target:
private void populateSourceContextData(AbstractFile sourceFile) throws NoCurrentCaseException, TskCoreException { SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase(); boolean foundASource = false; for (BlackboardArtifact.ARTIFACT_TYPE artifactType : SOURCE_CONTEXT_ARTIFACTS) { List<BlackboardArtifact> artifactsList = tskCase.getBlackboardArtifacts(artifactType, sourceFile.getId()); foundASource = !artifactsList.isEmpty(); for (BlackboardArtifact contextArtifact : artifactsList) { addSourceEntry(contextArtifact); } } if (foundASource == false) { setSourceName("Unknown"); showSourceText(false); } }