auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public File zipDirectory(File workingDir, File directoryToZip) { String zipFilePath = workingDir.getAbsolutePath() + "/directory.zip"; try { FileOutputStream fos = new FileOutputStream(zipFilePath); ZipOutputStream zos = new ZipOutputStream(fos); zipFile(directoryToZip, "/", zos); zos.close(); fos.close(); } catch (IOException ex) { exceptionMessage(ex, "There was a problem zipping the directory '" + directoryToZip.getPath() + "'", IO_ERROR); } catch (Exception ex) { exceptionMessage(ex, "There was a problem zipping the directory '" + directoryToZip.getPath() + "'", GENERIC_ERROR); } return new File(zipFilePath); }

Target:
public File zipDirectory(File workingDir, File directoryToZip) { String zipFilePath = workingDir.getAbsolutePath() + "/directory.zip"; try (FileOutputStream fos = new FileOutputStream(zipFilePath); ZipOutputStream zos = new ZipOutputStream(fos)) { zipFile(directoryToZip, "/", zos); } catch (IOException ex) { exceptionMessage(ex, "There was a problem zipping the directory '" + directoryToZip.getPath() + "'", IO_ERROR); } catch (Exception ex) { exceptionMessage(ex, "There was a problem zipping the directory '" + directoryToZip.getPath() + "'", GENERIC_ERROR); } return new File(zipFilePath); }
Source:
public void testRemoteInterpreterWithMultipleInterpreterInGroup() throws TException, InterruptedException { RemoteInterpreterServer server = new RemoteInterpreterServer(3679); server.start(); boolean running = false; long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() - startTime < 10 * 1000) { if (server.isRunning()) { running = true; break; } else { Thread.sleep(200); } } Properties properties = new Properties(); properties.setProperty(Constants.ZEPPELIN_INTERPRETER_PORT, "3679"); properties.setProperty(Constants.ZEPPELIN_INTERPRETER_HOST, "localhost"); InterpreterGroup intpGroup = mock(InterpreterGroup.class); when(intpGroup.getProperty()).thenReturn(properties); when(intpGroup.containsKey(Constants.EXISTING_PROCESS)).thenReturn(true); RemoteInterpreterProcess rip = new RemoteInterpreterProcess(INTERPRETER_SCRIPT, "nonexists", "fakeRepo", new HashMap<String, String>(), 10 * 1000, null); assertFalse(rip.isRunning()); assertEquals(0, rip.referenceCount()); assertEquals(1, rip.reference(intpGroup)); assertEquals(2, rip.reference(intpGroup)); assertEquals(true, rip.isRunning()); }

Target:
public void testRemoteInterpreterWithMultipleInterpreterInGroup() throws TException, InterruptedException { RemoteInterpreterServer server = new RemoteInterpreterServer(3679); server.start(); long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() - startTime < 30 * 1000) { if (server.isRunning()) { break; } else { Thread.sleep(200); } } Properties properties = new Properties(); properties.setProperty(Constants.ZEPPELIN_INTERPRETER_PORT, "3679"); properties.setProperty(Constants.ZEPPELIN_INTERPRETER_HOST, "localhost"); InterpreterGroup intpGroup = mock(InterpreterGroup.class); when(intpGroup.getProperty()).thenReturn(properties); when(intpGroup.containsKey(Constants.EXISTING_PROCESS)).thenReturn(true); RemoteInterpreterProcess rip = new RemoteInterpreterProcess(INTERPRETER_SCRIPT, "nonexists", "fakeRepo", new HashMap<String, String>(), 30 * 1000, null); assertFalse(rip.isRunning()); assertEquals(0, rip.referenceCount()); assertEquals(1, rip.reference(intpGroup)); assertEquals(2, rip.reference(intpGroup)); assertEquals(true, rip.isRunning()); }
Source:
private void initializeEvents() { ChangeHandler encodingChangeHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { if (encoding_.getSelectedItemText() == "Other") { globalDisplay_.promptForText( "Encoding Identifier", "Please enter an encoding identifier. For a list of valid encodings run iconvlist().", encoding_.getSelectedValue(), new OperationWithInput<String>() { @Override public void execute(final String otherEncoding) { int selectedIndex = encoding_.getSelectedIndex(); replaceOtherEncodingItem(selectedIndex, otherEncoding); } } ); } } }; encoding_.addChangeHandler(encodingChangeHandler); }

Target:
private void initializeEvents() { ChangeHandler encodingChangeHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { if (encoding_.getSelectedItemText() == otherLabel) { globalDisplay_.promptForText( "Encoding Identifier", "Please enter an encoding identifier. For a list of valid encodings run iconvlist().", encoding_.getSelectedValue(), new OperationWithInput<String>() { @Override public void execute(final String otherEncoding) { for (int idxEncoding = 0; idxEncoding < encoding_.getItemCount(); idxEncoding++) { if (encoding_.getValue(idxEncoding) == otherEncoding) { encoding_.setSelectedIndex(idxEncoding); return; } } int selectedIndex = encoding_.getSelectedIndex(); addOtherEncodingItem(selectedIndex - 1, otherEncoding); } } ); } } }; encoding_.addChangeHandler(encodingChangeHandler); }
Source:
public BVDesignException(final String bvErrorCode) { super(); this.bvErrorCode = bvErrorCode; }

Target:
public BVDesignException(final String bvErrorCode) { this.bvErrorCode = bvErrorCode; }
Source:
public MainDrawerHandler(WikiDrawerLayout slidingPane, Activity parentActivity) { this.slidingPane = slidingPane; this.parentActivity = parentActivity; ButterKnife.bind(this.slidingPane); setUpViews(); }

Target:
MainDrawerHandler(WikiDrawerLayout slidingPane, Activity parentActivity) { this.slidingPane = slidingPane; this.parentActivity = parentActivity; setUpViews(); }
Source:
protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); Log.d(LOG_TAG, "mButtonClicked=" + mButtonClicked + ", positiveResult=" + positiveResult); if (this.mButtonClicked != DialogInterface.BUTTON_NEGATIVE) { int action = (isToggled() || (mButtonClicked == DialogInterface.BUTTON_POSITIVE)) ? CommandsInterface.CF_ACTION_REGISTRATION : CommandsInterface.CF_ACTION_DISABLE; int time = 0; if (reason == CommandsInterface.CF_REASON_NO_REPLY) { PersistableBundle carrierConfig = PhoneGlobals.getInstance() .getCarrierConfigForSubId(mPhone.getSubId()); if (carrierConfig.getBoolean( CarrierConfigManager.KEY_SUPPORT_NO_REPLY_TIMER_FOR_CFNRY_BOOL)) { time = 20; } } final String number = getPhoneNumber(); Log.d(LOG_TAG, "callForwardInfo=" + callForwardInfo); if (action == CommandsInterface.CF_ACTION_REGISTRATION && callForwardInfo != null && callForwardInfo.status == 1 && number.equals(callForwardInfo.number)) { Log.d(LOG_TAG, "no change, do nothing"); } else { Log.d(LOG_TAG, "reason=" + reason + ", action=" + action + ", number=" + number); setSummaryOn(""); mPhone.setCallForwardingOption(action, reason, number, time, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CF, action, MyHandler.MESSAGE_SET_CF)); if (mTcpListener != null) { mTcpListener.onStarted(this, false); } } } }

Target:
protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); Log.d(LOG_TAG, "mButtonClicked=" + mButtonClicked + ", positiveResult=" + positiveResult); if (this.mButtonClicked != DialogInterface.BUTTON_NEGATIVE) { int action = (isToggled() || (mButtonClicked == DialogInterface.BUTTON_POSITIVE)) ? CommandsInterface.CF_ACTION_REGISTRATION : CommandsInterface.CF_ACTION_DISABLE; int time = 0; if (reason == CommandsInterface.CF_REASON_NO_REPLY) { PersistableBundle carrierConfig = PhoneGlobals.getInstance() .getCarrierConfigForSubId(mPhone.getSubId()); if (carrierConfig.getBoolean( CarrierConfigManager.KEY_SUPPORT_NO_REPLY_TIMER_FOR_CFNRY_BOOL, true)) { time = 20; } } final String number = getPhoneNumber(); Log.d(LOG_TAG, "callForwardInfo=" + callForwardInfo); if (action == CommandsInterface.CF_ACTION_REGISTRATION && callForwardInfo != null && callForwardInfo.status == 1 && number.equals(callForwardInfo.number)) { Log.d(LOG_TAG, "no change, do nothing"); } else { Log.d(LOG_TAG, "reason=" + reason + ", action=" + action + ", number=" + number); setSummaryOn(""); mPhone.setCallForwardingOption(action, reason, number, time, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CF, action, MyHandler.MESSAGE_SET_CF)); if (mTcpListener != null) { mTcpListener.onStarted(this, false); } } } }
Source:
public String addAssessment(PortletRequest request, PortletResponse response) throws Exception { initialize(request); initializeJSONData(request.getParameterMap()); Session session = HibernateUtil.getCurrentSession(); Assessment assessment = dbAssessmentsMap.entrySet().iterator().next().getValue(); List<AssessmentCriteria> sortedAssessmentCriteria = assessment.getSortedAssessmentCriteria(); List<CriterionArea> criterionAreas = new ArrayList<CriterionArea>(); for (AssessmentCriteria assessmentCriteria : sortedAssessmentCriteria) { criterionAreas.add(assessmentCriteria.getCriteriaArea()); } GoalVersion reactivatedGoalVersion = appraisal.getReactivatedGoalVersion(); if (reactivatedGoalVersion == null) { reactivatedGoalVersion = (GoalVersion) appraisal.getGoalVersions().toArray()[0]; } Integer nextSequence = calculateAssessmentSequence(dbAssessmentsMap); assessment = AppraisalMgr.createNewAssessment(reactivatedGoalVersion, nextSequence, criterionAreas); session.save(assessment); String returnJSON = ""; returnJSON += "{id:" + assessment.getId(); returnJSON += ", assessmentCriteria:{"; ArrayList<String> assessmentCriteriaJSON = new ArrayList<String>(); for(AssessmentCriteria criterion : assessment.getAssessmentCriteria()) { assessmentCriteriaJSON.add("\"" + criterion.getCriteriaArea().getName() + "\":" + criterion.getId()); } returnJSON += StringUtils.join(assessmentCriteriaJSON, ','); returnJSON += "}, status:\"success\"}"; System.out.println(returnJSON); return returnJSON; }

Target:
public String addAssessment(PortletRequest request, PortletResponse response) throws Exception { initialize(request); initializeJSONData(request.getParameterMap()); Session session = HibernateUtil.getCurrentSession(); Assessment assessment = dbAssessmentsMap.entrySet().iterator().next().getValue(); List<AssessmentCriteria> sortedAssessmentCriteria = assessment.getSortedAssessmentCriteria(); List<CriterionArea> criterionAreas = new ArrayList<CriterionArea>(); for (AssessmentCriteria assessmentCriteria : sortedAssessmentCriteria) { criterionAreas.add(assessmentCriteria.getCriteriaArea()); } GoalVersion reactivatedGoalVersion = appraisal.getReactivatedGoalVersion(); if (reactivatedGoalVersion == null) { reactivatedGoalVersion = (GoalVersion) appraisal.getGoalVersions().toArray()[0]; } Integer nextSequence = calculateAssessmentSequence(dbAssessmentsMap); assessment = AppraisalMgr.createNewAssessment(reactivatedGoalVersion, nextSequence, criterionAreas); session.save(assessment); HashMap jsonMap = new HashMap(); HashMap criteriaMap = new HashMap(); jsonMap.put("id", assessment.getId()); for(AssessmentCriteria criterion : assessment.getAssessmentCriteria()) { criteriaMap.put(criterion.getCriteriaArea().getName(), criterion.getId()); } jsonMap.put("assessmentCriteria", criteriaMap); jsonMap.put("status", "success"); Gson gson = new Gson(); return gson.toJson(jsonMap); }
Source:
protected void doStartMachine(KubernetesServerResolver serverResolver) throws InfrastructureException { final KubernetesEnvironment environment = getContext().getEnvironment(); final Map<String, InternalMachineConfig> machineConfigs = environment.getMachines(); final String workspaceId = getContext().getIdentity().getWorkspaceId(); LOG.debug("Begin pods creation for workspace {}", workspaceId); for (Pod toCreate : environment.getPods().values()) { final Pod createdPod = namespace.deployments().deploy(toCreate); LOG.debug("Creating pod in workspace {}", toCreate.getMetadata().getName(), workspaceId); final ObjectMeta podMetadata = createdPod.getMetadata(); for (Container container : createdPod.getSpec().getContainers()) { String machineName = Names.machineName(toCreate, container); LOG.debug("Creating machine in workspace {}", machineName, workspaceId); machines.put( getContext().getIdentity(), new KubernetesMachineImpl( workspaceId, machineName, podMetadata.getName(), container.getName(), MachineStatus.STARTING, machineConfigs.get(machineName).getAttributes(), serverResolver.resolve(machineName))); eventPublisher.sendStartingEvent(machineName, getContext().getIdentity()); } } LOG.debug("Pods creation finished in in ws {}", workspaceId); }

Target:
protected void doStartMachine(KubernetesServerResolver serverResolver) throws InfrastructureException { final KubernetesEnvironment environment = getContext().getEnvironment(); final Map<String, InternalMachineConfig> machineConfigs = environment.getMachines(); final String workspaceId = getContext().getIdentity().getWorkspaceId(); LOG.debug("Begin pods creation for workspace '{}'", workspaceId); for (Pod toCreate : environment.getPods().values()) { final Pod createdPod = namespace.deployments().deploy(toCreate); LOG.debug( "Creating pod '{}' in workspace '{}'", toCreate.getMetadata().getName(), workspaceId); final ObjectMeta podMetadata = createdPod.getMetadata(); for (Container container : createdPod.getSpec().getContainers()) { String machineName = Names.machineName(toCreate, container); LOG.debug("Creating machine '{}' in workspace '{}'", machineName, workspaceId); machines.put( getContext().getIdentity(), new KubernetesMachineImpl( workspaceId, machineName, podMetadata.getName(), container.getName(), MachineStatus.STARTING, machineConfigs.get(machineName).getAttributes(), serverResolver.resolve(machineName))); eventPublisher.sendStartingEvent(machineName, getContext().getIdentity()); } } LOG.debug("Pods creation finished in workspace '{}'", workspaceId); }
Source:
private String getId(EObject object) { if (object instanceof Component) { final Component component = (Component) object; return component.getId(); } else if (object instanceof SnomedRefSetMember) { final SnomedRefSetMember member = (SnomedRefSetMember) object; return member.getUuid(); } throw new IllegalStateException(); }

Target:
private String getId(EObject object) { if (object instanceof Component) { final Component component = (Component) object; return component.getId(); } else if (object instanceof SnomedRefSetMember) { final SnomedRefSetMember member = (SnomedRefSetMember) object; return member.getUuid(); } throw new IllegalArgumentException("Object was neither instance of Component or SnomedRefSetMember"); }
Source:
public ItemOverrideList getOverrides() { return new ItemOverrideList( Collections.emptyList() ) { @Override public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) { final long hash; if( stack.getItem() instanceof IMemoryCard ) { final IMemoryCard memoryCard = (IMemoryCard) stack.getItem(); hash = memoryCard.getHash( stack ); } else { hash = 0x77777777; } try { return MemoryCardBakedModel.this.modelCache.get( hash, () -> new MemoryCardBakedModel( MemoryCardBakedModel.this.format, MemoryCardBakedModel.this.baseModel, MemoryCardBakedModel.this.texture, hash, MemoryCardBakedModel.this.modelCache ) ); } catch( ExecutionException e ) { AELog.error( e ); return MemoryCardBakedModel.this; } } }; }

Target:
public ItemOverrideList getOverrides() { return new ItemOverrideList( Collections.emptyList() ) { @Override public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) { try { if( stack.getItem() instanceof IMemoryCard ) { final IMemoryCard memoryCard = (IMemoryCard) stack.getItem(); final AEColor[] colors = memoryCard.getColorCode( stack ); return MemoryCardBakedModel.this.modelCache.get( new CacheKey( colors ), () -> new MemoryCardBakedModel( MemoryCardBakedModel.this.format, MemoryCardBakedModel.this.baseModel, MemoryCardBakedModel.this.texture, colors, MemoryCardBakedModel.this.modelCache ) ); } } catch( ExecutionException e ) { AELog.error( e ); } return MemoryCardBakedModel.this; } }; }
Source:
public void executeRecordsParityStatusForChargesExistingInLedger() { when(chargeDao.findMaxId()).thenReturn(1L); when(chargeDao.findById(1L)).thenReturn(Optional.of(chargeEntity)); when(ledgerService.getTransaction(chargeEntity.getExternalId())).thenReturn(Optional.of(new LedgerTransaction())); worker.execute(1L, OptionalLong.empty()); assertThat(chargeEntity.getParityCheckStatus(), is(ParityCheckStatus.EXISTS_IN_LEDGER)); verify(stateTransitionQueue, never()).offer(any()); verify(emittedEventDao, never()).recordEmission(any()); verify(chargeDao, never()).findById(2L); }

Target:
public void executeRecordsParityStatusForChargesExistingInLedger() { when(chargeDao.findMaxId()).thenReturn(1L); when(chargeDao.findById(1L)).thenReturn(Optional.of(chargeEntity)); when(ledgerService.getTransaction(chargeEntity.getExternalId())).thenReturn(Optional.of(new LedgerTransaction())); worker.execute(1L, OptionalLong.empty()); verify(chargeService, times(1)).updateChargeParityStatus(chargeEntity.getExternalId(), ParityCheckStatus.EXISTS_IN_LEDGER); verify(stateTransitionQueue, never()).offer(any()); verify(emittedEventDao, never()).recordEmission(any()); verify(chargeDao, never()).findById(2L); }
Source:
public static void setColor(Context context, CanvasContext canvasContext, String hexColor, CanvasCallback<CanvasColor> callback) { if (APIHelpers.paramIsNull(context, canvasContext, hexColor, callback)) { return; } if(canvasContext instanceof Course || canvasContext instanceof Group) { buildInterface(context, false).setColor(canvasContext.getContextId(), hexColor, callback); } }

Target:
public static void setColor(Context context, CanvasContext canvasContext, String hexColor, CanvasCallback<CanvasColor> callback) { if (APIHelpers.paramIsNull(context, canvasContext, hexColor, callback)) { return; } buildInterface(context, false).setColor(canvasContext.getContextId(), hexColor, callback); }
Source:
public static BooleanExpression isAnyFieldSetForSelectedEntry(List<Field> fields, StateManager stateManager) { ObservableList<BibEntry> selectedEntries = stateManager.getSelectedEntries(); if (selectedEntries.isEmpty()) { return Bindings.createBooleanBinding(() -> false, selectedEntries); } BibEntry entry = selectedEntries.get(0); return Bindings.createBooleanBinding( () -> entry.getFields().stream().anyMatch(fields::contains), entry.getFieldsObservable(), selectedEntries); }

Target:
public static BooleanExpression isAnyFieldSetForSelectedEntry(List<Field> fields, StateManager stateManager) { ObservableList<BibEntry> selectedEntries = stateManager.getSelectedEntries(); MonadicBinding<Boolean> fieldsAreSet = EasyBind.monadic(Bindings.valueAt(selectedEntries, 0)) .flatMap(entry -> Bindings.createBooleanBinding(() -> { return entry.getFields().stream().anyMatch(fields::contains); }, entry.getFieldsObservable())) .orElse(false); return BooleanExpression.booleanExpression(fieldsAreSet); }
Source:
private ManagedScheduledExecutorServiceResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE), EeExtension.getResourceDescriptionResolver(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE)) .setAddHandler(ManagedScheduledExecutorServiceAdd.INSTANCE) .setRemoveHandler(ManagedScheduledExecutorServiceRemove.INSTANCE) .addCapabilities(CAPABILITY)); }

Target:
private ManagedScheduledExecutorServiceResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE), EeExtension.getResourceDescriptionResolver(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE)) .setAddHandler(ManagedScheduledExecutorServiceAdd.INSTANCE) .setRemoveHandler(new ServiceRemoveStepHandler(ManagedScheduledExecutorServiceAdd.INSTANCE)) .addCapabilities(CAPABILITY)); }
Source:
protected void executeQueryCommand() { List<Disk> disks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (disks.size() == 1 && disks.get(0) instanceof LunDisk){ getQueryReturnValue().setReturnValue(disks.get(0)); return; } List<DiskImage> snapshots = new ArrayList<>(); disks.stream() .filter(disk -> !(disk instanceof LunDisk)) .map(disk -> (DiskImage) disk) .forEach(disk -> { if (disk.getActive()) { disk.getSnapshots().add(DiskImage.copyOf(disk)); activeDisk = disk; activeDisk.getSnapshots().addAll(snapshots); } else { if (activeDisk != null){ activeDisk.getSnapshots().add(disk); } else { snapshots.add(disk); } } }); getQueryReturnValue().setReturnValue(activeDisk); }

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(diskDao.get(getParameters().getId(), getUserID(), getParameters().isFiltered())); }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } Player player = getPlayer(args[0]); if (player == null) { playerMsg(PLAYER_NOT_FOUND); return true; } if (sender instanceof Player) { if (player.equals(sender_p)) { playerMsg(ChatColor.RED + "Please, don't try to report yourself."); return true; } } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(ChatColor.RED + "You may report admin abuse on the forums, however, include screenshots! <LINK_0>"); return true; } String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); TFM_Util.reportAction(sender_p, player, report); playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged."); return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } Player player = getPlayer(args[0]); if (player == null) { playerMsg(PLAYER_NOT_FOUND); return true; } if (sender instanceof Player) { if (player.equals(sender_p)) { playerMsg(ChatColor.RED + "Please, don't try to report yourself."); return true; } } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(ChatColor.RED + "You may report admin abuse on the forums, however, please include screenshots! <LINK_0>"); return true; } String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); TFM_Util.reportAction(sender_p, player, report); playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged."); return true; }
Source:
protected boolean anyRejects() { for (final ReceiveCommand cmd : commands) { if (cmd.getResult() != Result.NOT_ATTEMPTED || cmd.getResult() != Result.OK) return false; } return true; }

Target:
protected boolean anyRejects() { for (ReceiveCommand cmd : commands) { if (cmd.getResult() != Result.NOT_ATTEMPTED && cmd.getResult() != Result.OK) return true; } return false; }
Source:
protected void openExampleReadme(IProject project) throws PartInitException { if (ExampleData.DESC_FILE != null) { IResource indexFile = project.findMember(ExampleData.DESC_FILE); if (indexFile != null) { IDE.openEditor(getPage(), (IFile) indexFile, true); } } }

Target:
protected void openExampleReadme(IProject project) throws PartInitException { IResource indexFile = project.findMember(ExampleData.DESC_FILE); if (indexFile != null) { IDE.openEditor(getPage(), (IFile) indexFile, true); } }
Source:
private void startFileIngestStreaming() { synchronized (this.stageCompletionCheckLock) { this.stage = IngestJobPipeline.Stages.STREAMING_FILE_INGEST; } if (this.hasFileIngestPipeline()) { synchronized (this.fileIngestProgressLock) { this.estimatedFilesToProcess = 0; } } if (this.doUI) { if (this.hasFileIngestPipeline()) { this.startFileIngestProgressBar(); } } logInfoMessage("Waiting for streaming files"); }

Target:
private void startFileIngestStreaming() { synchronized (this.stageCompletionCheckLock) { this.stage = IngestJobPipeline.Stages.FIRST_STAGE_FILES_ONLY; } if (this.hasFileIngestPipeline()) { synchronized (this.fileIngestProgressLock) { this.estimatedFilesToProcess = 0; } } if (this.doUI) { if (this.hasFileIngestPipeline()) { this.startFileIngestProgressBar(); } } logInfoMessage("Waiting for streaming files"); }
Source:
public Scope linkScope(StaticAnalysis analysis, Scope parentScope, ParseTree ast, Environment env, Set<ConfigCompileException> exceptions, boolean codeInheritsParentScope) { if(ast.numberOfChildren() == 0) { return parentScope; } int ind = 0; Scope retTypeScope = (ast.getChildAt(ind).getData().isInstanceOf(CClassType.TYPE) ? analysis.linkScope(parentScope, ast.getChildAt(ind++), env, exceptions) : parentScope); Scope paramScope = analysis.createNewScope(); if(codeInheritsParentScope) { paramScope.addParent(parentScope); } else { paramScope.addSpecificParent(parentScope, Namespace.PROCEDURE); } paramScope.addDeclaration(new ParamDeclaration("@arguments", CArray.TYPE, ast.getTarget())); Scope valScope = parentScope; while(ind < ast.numberOfChildren() - 1) { ParseTree param = ast.getChildAt(ind++); Scope[] scopes = analysis.linkParamScope(paramScope, valScope, param, env, exceptions); valScope = scopes[1]; paramScope = scopes[0]; } ParseTree code = ast.getChildAt(ast.numberOfChildren() - 1); analysis.linkScope(paramScope, code, env, exceptions); return parentScope; }

Target:
public Scope linkScope(StaticAnalysis analysis, Scope parentScope, ParseTree ast, Environment env, Set<ConfigCompileException> exceptions, boolean codeInheritsParentScope) { if(ast.numberOfChildren() == 0) { return parentScope; } int ind = 0; if(ast.getChildAt(ind).getData().isInstanceOf(CClassType.TYPE)) { analysis.linkScope(parentScope, ast.getChildAt(ind++), env, exceptions); } Scope paramScope = analysis.createNewScope(); if(codeInheritsParentScope) { paramScope.addParent(parentScope); } else { paramScope.addSpecificParent(parentScope, Namespace.PROCEDURE); } paramScope.addDeclaration(new ParamDeclaration("@arguments", CArray.TYPE, ast.getTarget())); Scope valScope = parentScope; while(ind < ast.numberOfChildren() - 1) { ParseTree param = ast.getChildAt(ind++); Scope[] scopes = analysis.linkParamScope(paramScope, valScope, param, env, exceptions); valScope = scopes[1]; paramScope = scopes[0]; } ParseTree code = ast.getChildAt(ast.numberOfChildren() - 1); analysis.linkScope(paramScope, code, env, exceptions); return parentScope; }
Source:
public void setDataGroupsAssignedWhileConsented(Set<String> dataGroups) { if (dataGroups != null) { this.dataGroupsAssignedWhileConsented = new HashSet<>(dataGroups); } }

Target:
public void setDataGroupsAssignedWhileConsented(Set<String> dataGroups) { this.dataGroupsAssignedWhileConsented = (dataGroups != null) ? new HashSet<>(dataGroups) : new HashSet<>(); }
Source:
public String resetPassword(@RequestBody final UserResetPasswordRequest userInfo) throws UserRetrievalException, MessagingException { UserResetTokenDTO userResetTokenDTO = userManager.createResetUserPasswordToken(userInfo.getUserName(), userInfo.getEmail()); String htmlMessage = "<p>Please follow this link to reset your password </p>" + "<pre>" + env.getProperty("chplUrlBegin") + "/#/admin/authorizePasswordReset?token=" + userResetTokenDTO.getUserResetToken() + "</pre>"; String[] toEmails = { userInfo.getEmail() }; EmailBuilder emailBuilder = new EmailBuilder(env); emailBuilder.recipients(new ArrayList<String>(Arrays.asList(toEmails))) .subject("Open Data CHPL Password Reset") .htmlMessage(htmlMessage) .htmlFooter() .sendEmail(); return "{\"passwordResetEmailSent\" : true }"; }

Target:
public String resetPassword(@RequestBody final UserResetPasswordRequest userInfo) throws UserRetrievalException, MessagingException { UserResetTokenDTO userResetTokenDTO = userManager.createResetUserPasswordToken(userInfo.getUserName(), userInfo.getEmail()); String htmlMessage = String.format(env.getProperty("user.resetPassword.body"), env.getProperty("chplUrlBegin"), userResetTokenDTO.getUserResetToken()); String[] toEmails = { userInfo.getEmail() }; EmailBuilder emailBuilder = new EmailBuilder(env); emailBuilder.recipients(new ArrayList<String>(Arrays.asList(toEmails))) .subject(env.getProperty("user.resetPassword.subject")) .htmlMessage(htmlMessage) .publicHtmlFooter() .sendEmail(); return "{\"passwordResetEmailSent\" : true }"; }
Source:
public void reuseSession() { getSessionId(new StorageCallback() { @Override public void onSuccess(String result) { if (result != null) { restApiSessionId = result; RestApiSessionAcquiredEvent.fire(eventBus, result); scheduleKeepAliveHeartbeat(); } else { RestApiSessionManager.logger.severe("Engine REST API session ID is not available"); } } @Override public void onFailure(Throwable caught) { RestApiSessionManager.logger.severe("Engine REST API session ID is not available"); } }); }

Target:
public void reuseSession() { if (getSessionId() != null) { RestApiSessionAcquiredEvent.fire(eventBus, getSessionId()); scheduleKeepAliveHeartbeat(); } else { getSessionId(new StorageCallback() { @Override public void onSuccess(String result) { if (result != null) { restApiSessionId = result; RestApiSessionAcquiredEvent.fire(eventBus, result); scheduleKeepAliveHeartbeat(); } else { RestApiSessionManager.logger.severe("Engine REST API session ID is not available"); } } @Override public void onFailure(Throwable caught) { RestApiSessionManager.logger.severe("Engine REST API session ID is not available"); } }); } }
Source:
public void onSaveClick() { editView.setError(null); editView.setSaveState(true); if (call != null) { call.cancel(); } call = new DescriptionEditClient().request(pageTitle, editView.getDescription(), new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { if (getActivity() != null) { DeviceUtil.hideSoftKeyboard(getActivity()); editView.setSaveState(false); startActivityForResult(DescriptionEditSuccessActivity.newIntent(getContext()), Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, boolean disallowed) { if (disallowed) { } else { } } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editView.setSaveState(false); editView.setError(caught.getMessage()); } }); }

Target:
public void onSaveClick() { editView.setError(null); editView.setSaveState(true); if (call != null) { call.cancel(); } call = new DescriptionEditClient().request(pageTitle, editView.getDescription(), new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { if (getActivity() != null) { DeviceUtil.hideSoftKeyboard(getActivity()); editView.setSaveState(false); startActivityForResult(DescriptionEditSuccessActivity.newIntent(getContext()), Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT_SUCCESS); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, boolean disallowed) { if (disallowed) { } else { } } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editView.setSaveState(false); editView.setError(caught.getMessage()); } }); }
Source:
public synchronized void start(final StartContext context) throws StartException { ROOT_LOGGER.endpointStarting(name); try { SocketBinding socketBinding = getSocketBinding().getValue(); InetSocketAddress socketAddress = socketBinding.getSocketAddress(); configurationBuilder.ip(socketAddress.getAddress()); configurationBuilder.port(socketAddress.getPort()); sniRouting.entrySet().stream().forEach(e -> { HotRodServer hotRod = e.getValue().getHotRod().getValue(); SecurityRealm securityRealm = e.getValue().getSecurityRealm().getValue(); String sniHostName = e.getKey(); SniNettyRouteSource source = new SniNettyRouteSource(sniHostName, securityRealm.getSSLContext()); NettyHandlerRouteDestination destination = new NettyHandlerRouteDestination(hotRod.getQualifiedName(), hotRod.getInitializer()); configurationBuilder.routing().add(new Route<>(source, destination)); }); router = Optional.of(new MultiTenantRouter(configurationBuilder.build())); router.ifPresent(r -> r.start()); ROOT_LOGGER.endpointStarted(name, NetworkUtils.formatAddress(socketAddress)); } catch (Exception e) { throw ROOT_LOGGER.failedStart(e, name); } }

Target:
public synchronized void start(final StartContext context) throws StartException { ROOT_LOGGER.endpointStarting(name); try { SocketBinding hotrodSocketBinding = getHotrodSocketBinding().getOptionalValue(); InetSocketAddress hotrodAddress = hotrodSocketBinding != null ? hotrodSocketBinding.getSocketAddress() : null; SocketBinding restSocketBinding = getRestSocketBinding().getOptionalValue(); InetSocketAddress restAddress = restSocketBinding != null ? restSocketBinding.getSocketAddress() : null; if (hotrodAddress != null) { HotRodRouterBuilder hotrodConfigurationBuilder = configurationBuilder.hotrod(); hotrodConfigurationBuilder.ip(hotrodAddress.getAddress()); hotrodConfigurationBuilder.port(hotrodAddress.getPort()); } if (restAddress != null) { configurationBuilder.rest().ip(restAddress.getAddress()); configurationBuilder.rest().port(restAddress.getPort()); } hotrodRouting.forEach((sniHostName, routing) -> { HotRodServer hotRod = routing.getHotRod().getValue(); SecurityRealm securityRealm = routing.getSecurityRealm().getValue(); SniNettyRouteSource source = new SniNettyRouteSource(sniHostName, securityRealm.getSSLContext()); NettyHandlerRouteDestination destination = new NettyHandlerRouteDestination(hotRod.getQualifiedName(), hotRod.getInitializer()); configurationBuilder.routing().add(new Route<>(source, destination)); }); restRouting.forEach((path, routing) -> { Server restResource = routing.getRest().getValue().getServer(); String name = routing.getName(); RestRouteSource source = new RestRouteSource(path); NettyRestServerRouteDestination destination = new NettyRestServerRouteDestination(name, restResource); configurationBuilder.routing().add(new Route<>(source, destination)); }); this.router = new MultiTenantRouter(configurationBuilder.build()); this.router.start(); ROOT_LOGGER.routerStarted(NetworkUtils.formatAddress(hotrodAddress), NetworkUtils.formatAddress(restAddress)); } catch (Exception e) { throw ROOT_LOGGER.failedStart(e, name); } }
Source:
public void storeSpan(String tenantId, List<Span> spans, Function<Span, String> spanIdSupplier) throws StoreException { client.initTenant(tenantId); BulkRequestBuilder bulkRequestBuilder = client.getClient().prepareBulk(); try { for (Span span: spans) { final String modifiedId = spanIdSupplier.apply(span); String json = serialize(span); msgLog.tracef("Storing span: %s", json); bulkRequestBuilder .add(client.getClient() .prepareIndex(client.getIndex(tenantId), SPAN_TYPE, modifiedId) .setSource(json)); } } catch (IOException ex) { throw new StoreException(ex); } BulkResponse bulkItemResponses = bulkRequestBuilder.execute().actionGet(); if (bulkItemResponses.hasFailures()) { msgLog.tracef("Failed to store traces to elasticsearch: %s", bulkItemResponses.buildFailureMessage()); throw new StoreException(bulkItemResponses.buildFailureMessage()); } msgLog.trace("Success storing traces to elasticsearch"); }

Target:
public void storeSpan(String tenantId, List<Span> spans, Function<Span, String> spanIdSupplier) throws StoreException { client.initTenant(tenantId); BulkRequestBuilder bulkRequestBuilder = client.getClient().prepareBulk(); for (Span span : spans) { String json; try { json = serialize(span); } catch(IOException ex){ log.errorf("Failed to serialize span %s", span); throw new StoreException(ex); } log.tracef("Storing span: %s", json); final String modifiedId = spanIdSupplier.apply(span); bulkRequestBuilder.add(client.getClient() .prepareIndex(client.getIndex(tenantId), SPAN_TYPE, modifiedId) .setSource(json)); } BulkResponse bulkItemResponses = bulkRequestBuilder.execute().actionGet(); if (bulkItemResponses.hasFailures()) { log.tracef("Failed to store traces to elasticsearch: %s", bulkItemResponses.buildFailureMessage()); throw new StoreException(bulkItemResponses.buildFailureMessage()); } log.trace("Success storing traces to elasticsearch"); }
Source:
private void validateNames() { if ((mQualifier != null) && !KijiNameValidator.isValidPrintableASCII(mQualifier)) { throw new KijiInvalidNameException( String.format("Qualifier name not valid printable ASCII): " + mQualifier)); } if ((mFamily != null) && !KijiNameValidator.isValidLayoutName(mFamily)) { throw new KijiInvalidNameException(String.format("Invalid family name: " + mFamily)); } }

Target:
private void validateNames() { if (!KijiNameValidator.isValidLayoutName(mFamily)) { throw new KijiInvalidNameException(String.format("Invalid family name: %s", mFamily)); } }
Source:
InputStatus emitNext(DataOutput<T> output) throws Exception; interface DataOutput<T> { void emitRecord(StreamRecord<T> streamRecord) throws Exception; void emitWatermark(Watermark watermark) throws Exception; void emitStreamStatus(StreamStatus streamStatus) throws Exception; void emitLatencyMarker(LatencyMarker latencyMarker) throws Exception; default void endOutput() throws Exception }

Target:
InputStatus emitNext(DataOutput<T> output) throws Exception; interface DataOutput<T> { void emitRecord(StreamRecord<T> streamRecord) throws Exception; void emitWatermark(Watermark watermark) throws Exception; void emitStreamStatus(StreamStatus streamStatus) throws Exception; void emitLatencyMarker(LatencyMarker latencyMarker) throws Exception; }
Source:
public Datepicker(Datepicker other) { this.closeText = other.closeText; this.prevText = other.prevText; this.nextText = other.nextText; this.currentText = other.currentText; this.monthNames = new LinkedList<String>(other.monthNames); this.monthNamesShort = new LinkedList<String>(other.monthNamesShort); this.dayNames = new LinkedList<String>(other.dayNames); this.dayNamesShort = new LinkedList<String>(other.dayNamesShort); this.dayNamesMin = new LinkedList<String>(other.dayNamesMin); this.weekHeader = other.weekHeader; this.dateFormat = other.dateFormat; this.firstDay = other.firstDay; this.isRTL = other.isRTL; this.showMonthAfterYear = other.showMonthAfterYear; this.yearSuffix = other.yearSuffix; }

Target:
public Datepicker(Datepicker other) { this.closeText = other.closeText; this.prevText = other.prevText; this.nextText = other.nextText; this.currentText = other.currentText; this.monthNames = (other.monthNames != null) ? new LinkedList<String>(other.monthNames) : null; this.monthNamesShort = (other.monthNamesShort != null) ? new LinkedList<String>(other.monthNamesShort) : null; this.dayNames = (other.dayNames != null) ? new LinkedList<String>(other.dayNames) : null; this.dayNamesShort = (other.dayNamesShort != null) ? new LinkedList<String>(other.dayNamesShort) : null; this.dayNamesMin = (other.dayNamesMin != null) ? new LinkedList<String>(other.dayNamesMin) : null; this.weekHeader = other.weekHeader; this.dateFormat = other.dateFormat; this.firstDay = other.firstDay; this.isRTL = other.isRTL; this.showMonthAfterYear = other.showMonthAfterYear; this.yearSuffix = other.yearSuffix; }
Source:
private String updateInternal(Entity oldEntity, Entity newEntity, Cluster cluster, BundleJob oldBundle, String user, Boolean skipDryRun) throws FalconException { String currentUser = CurrentUser.getUser(); switchUser(user); String clusterName = cluster.getName(); Date effectiveTime = getEffectiveTime(cluster, newEntity); LOG.info("Effective time " + effectiveTime); try { dryRunForUpdate(cluster, newEntity, effectiveTime, skipDryRun); boolean suspended = BUNDLE_SUSPENDED_STATUS.contains(oldBundle.getStatus()); updateCoords(clusterName, oldBundle, EntityUtil.getParallel(oldEntity), effectiveTime, newEntity); String newJobId = scheduleForUpdate(newEntity, cluster, effectiveTime, user); BundleJob newBundle = null; if (newJobId != null) { newBundle = getBundleInfo(clusterName, newJobId); } if (suspended) { doBundleAction(newEntity, BundleAction.SUSPEND, cluster.getName()); } switchUser(currentUser); return getUpdateString(newEntity, effectiveTime, oldBundle, newBundle); } finally { switchUser(currentUser); } }

Target:
private String updateInternal(Entity oldEntity, Entity newEntity, Cluster cluster, BundleJob oldBundle, String user, Boolean skipDryRun) throws FalconException { String currentUser = CurrentUser.getUser(); switchUser(user); String clusterName = cluster.getName(); Date effectiveTime = getEffectiveTime(cluster, newEntity); LOG.info("Effective time " + effectiveTime); try { dryRunForUpdate(cluster, newEntity, effectiveTime, skipDryRun); boolean suspended = BUNDLE_SUSPENDED_STATUS.contains(oldBundle.getStatus()); updateCoords(clusterName, oldBundle, EntityUtil.getParallel(oldEntity), effectiveTime, newEntity); String newJobId = scheduleForUpdate(newEntity, cluster, effectiveTime); BundleJob newBundle = null; if (newJobId != null) { newBundle = getBundleInfo(clusterName, newJobId); } if (suspended) { doBundleAction(newEntity, BundleAction.SUSPEND, cluster.getName()); } return getUpdateString(newEntity, effectiveTime, oldBundle, newBundle); } finally { switchUser(currentUser); } }
Source:
public long getEventsInRange(ITmfTimestamp start, ITmfTimestamp end) { int countAtStart = 0, countAtEnd = 0; long startTimestamp = checkStartTime(start.getValue()); long endTimestamp = checkEndTime(end.getValue()); try { final int quark = stats.getQuarkAbsolute(Attributes.TOTAL); countAtStart = stats.querySingleState(startTimestamp, quark).getStateValue().unboxInt(); countAtEnd = stats.querySingleState(endTimestamp, quark).getStateValue().unboxInt(); } catch (TimeRangeException e) { return 0; } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } long total = countAtEnd - countAtStart; return total; }

Target:
public long getEventsInRange(ITmfTimestamp start, ITmfTimestamp end) { int countAtStart = 0, countAtEnd = 0; long startTime = checkStartTime(start); long endTime = checkEndTime(end); try { final int quark = stats.getQuarkAbsolute(Attributes.TOTAL); countAtStart = stats.querySingleState(startTime, quark).getStateValue().unboxInt(); countAtEnd = stats.querySingleState(endTime, quark).getStateValue().unboxInt(); } catch (TimeRangeException e) { return 0; } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } long total = countAtEnd - countAtStart; return total; }
Source:
private void addUsage(JNode jNode, JavaClass javaClass, CodeLinesInfo linesInfo, CodePosition codePosition, List<StringRef> lines) { UsageInfo usageInfo; synchronized (jNode) { usageInfo = usageMap.get(jNode); if (usageInfo == null) { usageInfo = new UsageInfo(); usageMap.put(jNode, usageInfo); } } int line = codePosition.getLine(); JavaNode javaNodeByLine = linesInfo.getJavaNodeByLine(line); StringRef codeLine = lines.get(line - 1); JNode node = nodeCache.makeFrom(javaNodeByLine == null ? javaClass : javaNodeByLine); CodeNode codeNode = new CodeNode(node, line, codeLine); usageInfo.addUsage(codeNode); }

Target:
private void addUsage(JNode jNode, JavaClass javaClass, CodeLinesInfo linesInfo, CodePosition codePosition, List<StringRef> lines) { UsageInfo usageInfo = usageMap.computeIfAbsent(jNode, key -> new UsageInfo()); int line = codePosition.getLine(); JavaNode javaNodeByLine = linesInfo.getJavaNodeByLine(line); StringRef codeLine = lines.get(line - 1); JNode node = nodeCache.makeFrom(javaNodeByLine == null ? javaClass : javaNodeByLine); CodeNode codeNode = new CodeNode(node, line, codeLine); usageInfo.addUsage(codeNode); }
Source:
public Response handle(Request request) { final ListDeviceRequest req = (ListDeviceRequest) request.getBody(); final boolean sortOrderAsc = SortOrder.parse(req.isSortOrderAsc()); final List<DeviceVO> devices = deviceDao.list(req.getName(), req.getNamePattern(), req.getNetworkId(), req.getNetworkName(), req.getSortField(), sortOrderAsc, req.getTake(), req.getSkip(), req.getPrincipal()); return Response.newBuilder() .withBody(new ListDeviceResponse(devices)) .buildSuccess(); }

Target:
public Response handle(Request request) { final ListDeviceRequest req = (ListDeviceRequest) request.getBody(); final List<DeviceVO> devices = deviceDao.list(req.getName(), req.getNamePattern(), req.getNetworkId(), req.getNetworkName(), req.getSortField(), req.isSortOrderAsc(), req.getTake(), req.getSkip(), req.getPrincipal()); return Response.newBuilder() .withBody(new ListDeviceResponse(devices)) .buildSuccess(); }
Source:
private int registerWithMessageId(final Exchange exchange, final Message message) { enableStatus = true; int mid = message.getMID(); if (Message.NONE == mid) { mid = assignMessageId(message); if (Message.NONE != mid) { KeyMID key = KeyMID.fromOutboundMessage(message); if (exchangesByMID.putIfAbsent(key, exchange) != null) { throw new IllegalArgumentException(String.format( "automatic message ID [%d] already in use, cannot register exchange", message.getMID())); } LOGGER.debug("exchange added with generated mid {}, {}", key, message); } } else { KeyMID key = KeyMID.fromOutboundMessage(message); Exchange existingExchange = exchangesByMID.putIfAbsent(key, exchange); if (existingExchange != null) { if (existingExchange != exchange) { throw new IllegalArgumentException(String .format("message ID [%d] already in use, cannot register exchange", message.getMID())); } else if (exchange.getFailedTransmissionCount() == 0) { throw new IllegalArgumentException(String.format( "message with already registered ID [%d] is not a re-transmission, cannot register exchange", message.getMID())); } } else { LOGGER.debug("exchange added with {}, {}", key, message); } } return mid; }

Target:
private int registerWithMessageId(final Exchange exchange, final Message message) { enableStatus = true; int mid = message.getMID(); if (Message.NONE == mid) { mid = assignMessageId(message); if (Message.NONE != mid) { KeyMID key = KeyMID.fromOutboundMessage(message); if (exchangesByMID.putIfAbsent(key, exchange) != null) { throw new IllegalArgumentException(String.format( "generated mid [%d] already in use, cannot register exchange", message.getMID())); } LOGGER.debug("exchange added with generated mid {}, {}", key, message); } } else { KeyMID key = KeyMID.fromOutboundMessage(message); Exchange existingExchange = exchangesByMID.putIfAbsent(key, exchange); if (existingExchange != null) { if (existingExchange != exchange) { throw new IllegalArgumentException(String .format("mid [%d] already in use, cannot register exchange", message.getMID())); } else if (exchange.getFailedTransmissionCount() == 0) { throw new IllegalArgumentException(String.format( "message with already registered mid [%d] is not a re-transmission, cannot register exchange", message.getMID())); } } else { LOGGER.debug("exchange added with {}, {}", key, message); } } return mid; }