auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void uploadFile(String filePath) { File file = new File(filePath); RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file); MultipartBody.Part body = MultipartBody.Part.createFormData("picture", file.getName(), requestFile); String descriptionString = "hello, this is description speaking"; RequestBody description = RequestBody.create( MediaType.parse("multipart/form-data"), descriptionString); final String loadingMsg = getResources().getString(R.string.uploading_message); Call<ResponseBody> call = ((ZulipApp) getApplicationContext()).getZulipServices().upload(description, body); call.enqueue(new Callback<ResponseBody>() { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { if (response.message().equals("OK")) { String filePathOnServer = ""; try { String jsonResponse = getJsonResponseForUpload(response.body().charStream()); filePathOnServer = parseUploadJSON(jsonResponse); } catch (IOException e) { e.printStackTrace(); } if (!filePathOnServer.equals("")) { sendingMessage(false, loadingMsg); messageEt.append(" " + UrlHelper.addHost(filePathOnServer)); } else { sendingMessage(false, loadingMsg); Toast.makeText(ZulipActivity.this, "Failed to upload", Toast.LENGTH_SHORT).show(); } } else { sendingMessage(false, loadingMsg); Toast.makeText(ZulipActivity.this, "Failed to upload", Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<ResponseBody> call, Throwable t) { sendingMessage(false, loadingMsg); Log.e("Upload error:", t.getMessage()); } }); }

Target:
private void uploadFile(String filePath) { File file = new File(filePath); RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file); MultipartBody.Part body = MultipartBody.Part.createFormData("picture", file.getName(), requestFile); final String loadingMsg = getResources().getString(R.string.uploading_message); Call<UploadResponse> call = ((ZulipApp) getApplicationContext()).getZulipServices().upload(body); call.enqueue(new Callback<UploadResponse>() { @Override public void onResponse(Call<UploadResponse> call, Response<UploadResponse> response) { if (response.isSuccessful()) { String filePathOnServer = ""; UploadResponse uploadResponse = response.body(); filePathOnServer = uploadResponse.getUri(); if (!filePathOnServer.equals("")) { sendingMessage(false, loadingMsg); messageEt.append(" " + UrlHelper.addHost(filePathOnServer)); } else { sendingMessage(false, loadingMsg); Toast.makeText(ZulipActivity.this, R.string.failed_to_upload, Toast.LENGTH_SHORT).show(); } } else { sendingMessage(false, loadingMsg); Toast.makeText(ZulipActivity.this, R.string.failed_to_upload, Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<UploadResponse> call, Throwable t) { sendingMessage(false, loadingMsg); ZLog.logException(t); } }); }
Source:
public ComplexMetricExtractor getExtractor() { return new ComplexMetricExtractor() { @Override public Class<HyperLogLogCollector> extractedClass() { return HyperLogLogCollector.class; } @Override public HyperLogLogCollector extractValue(InputRow inputRow, String metricName) { Object rawValue = inputRow.getRaw(metricName); if (rawValue instanceof HyperLogLogCollector) { return (HyperLogLogCollector) rawValue; } else { HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); List<String> dimValues = inputRow.getDimension(metricName); if (dimValues == null) { return collector; } for (String dimensionValue : dimValues) { collector.fold(ByteBuffer.wrap(Base64.decodeBase64(dimensionValue))); } return collector; } } }; }

Target:
public ComplexMetricExtractor getExtractor() { return new ComplexMetricExtractor() { @Override public Class<HyperLogLogCollector> extractedClass() { return HyperLogLogCollector.class; } @Override public HyperLogLogCollector extractValue(InputRow inputRow, String metricName) { Object rawValue = inputRow.getRaw(metricName); if (rawValue == null) { return HyperLogLogCollector.makeLatestCollector(); } else if (rawValue instanceof HyperLogLogCollector) { return (HyperLogLogCollector) rawValue; } else if (rawValue instanceof byte[]) { return HyperLogLogCollector.makeLatestCollector().fold(ByteBuffer.wrap((byte[]) rawValue)); } else if (rawValue instanceof String) { return HyperLogLogCollector.makeLatestCollector().fold(ByteBuffer.wrap(Base64.decodeBase64((String) rawValue))); } throw new ISE("Object is not of a type[%s] that can be deserialized to HyperLogLog.", rawValue.getClass()); } }; }
Source:
public O implementInterface(JavaInterface<?> type) { O obj = addInterface(type); if (type instanceof JavaInterfaceSource) { for (Import imprt : ((JavaInterfaceSource) type).getImports()) { addImport(imprt); } } for (MethodSource<?> methodSource : Methods.implementAbstractMethods(type, this)) { methodSource.setPublic().addAnnotation(Override.class); } return obj; }

Target:
public O implementInterface(JavaInterface<?> type) { O obj = addInterface(type); if (type instanceof JavaInterfaceSource) { Set<Import> usedImports = new HashSet<Import>(); JavaInterfaceSource interfaceSource = (JavaInterfaceSource) type; for (MethodSource<JavaInterfaceSource> method : interfaceSource.getMethods()) { if (method.isDefault()) { continue; } if (!method.isReturnTypeVoid()) { usedImports.add(interfaceSource.getImport(method.getReturnType().getQualifiedName())); } for (ParameterSource<JavaInterfaceSource> parameter : method.getParameters()) { usedImports.add(interfaceSource.getImport(parameter.getType().getQualifiedName())); } } for (Import imprt : interfaceSource.getImports()) { if (usedImports.contains(imprt)) { addImport(imprt); } } } for (MethodSource<?> methodSource : Methods.implementAbstractMethods(type, this)) { methodSource.setPublic().addAnnotation(Override.class); } return obj; }
Source:
public Response undo(Action action) { action.setAsync(false); RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, guid); Response response = doAction(VdcActionType.RestoreAllSnapshots, restoreParams, action, PollingType.JOB); return response; }

Target:
public Response undo(Action action) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, guid); Response response = doAction(VdcActionType.RestoreAllSnapshots, restoreParams, action); return response; }
Source:
public static int[][] calculateResponseFrequencyExcludingSelf(List<FeedbackResponseAttributes> responses, FeedbackRubricQuestionDetails questionDetails) { int numOfRubricSubQuestions = questionDetails.getNumOfRubricSubQuestions(); int numOfRubricChoices = questionDetails.getNumOfRubricChoices(); int responseTotalIndex = numOfRubricChoices; int[][] responseFrequencyExcludingSelf = new int[numOfRubricSubQuestions][numOfRubricChoices + 1]; for (FeedbackResponseAttributes response : responses) { FeedbackRubricResponseDetails frd = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < numOfRubricSubQuestions; i++) { int chosenChoice = frd.getAnswer(i); if (chosenChoice != -1 && !response.giver.equals(response.recipient)) { responseFrequencyExcludingSelf[i][chosenChoice] += 1; responseFrequencyExcludingSelf[i][responseTotalIndex] += 1; } } } return responseFrequencyExcludingSelf; }

Target:
public static int[][] calculateResponseFrequencyExcludingSelf(List<FeedbackResponseAttributes> responses, FeedbackRubricQuestionDetails questionDetails) { List<FeedbackResponseAttributes> responsesExcludingSelf = responses.stream() .filter(response -> !response.giver.equals(response.recipient)).collect(Collectors.toList()); return calculateResponseFrequency(responsesExcludingSelf, questionDetails); }
Source:
public int getViewId() { if (channel == null) throw new CacheException("The cache has been stopped and invocations are not allowed!"); return (int) clusterView.getViewId(); }

Target:
public int getViewId() { if (channel == null) throw new CacheException("The cache has been stopped and invocations are not allowed!"); return clusterView.getViewId(); }
Source:
public void setTitle(SafeHtml text) { if (text != null) { setText(text.asString()); } }

Target:
public void setTitle(SafeHtml text) { setTitle(text == null ? (String)null : text.asString()); }
Source:
private boolean issueHasNewComments(TurboIssue issue, boolean hasMetadata) { List<String> filterQualifierNames = currentFilterExpression.getQualifierNames(); if ((filterQualifierNames.contains(Qualifier.UPDATED) || filterQualifierNames.contains(Qualifier.UPDATED_OTHERS)) && hasMetadata) { return issueNonSelfCommentCounts.containsKey(issue.getId()) && Math.abs( issueNonSelfCommentCounts.get(issue.getId()) - issue.getMetadata().getNonSelfCommentCount() ) > 0; } else { return issueCommentCounts.containsKey(issue.getId()) && Math.abs(issueCommentCounts.get(issue.getId()) - issue.getCommentCount()) > 0; } }

Target:
private boolean issueHasNewComments(TurboIssue issue, boolean hasMetadata) { if (hasMetadata && Qualifier.qualifierNamesHaveUpdatedQualifier(currentFilterExpression)) { return issueNonSelfCommentCounts.containsKey(issue.getId()) && Math.abs( issueNonSelfCommentCounts.get(issue.getId()) - issue.getMetadata().getNonSelfCommentCount() ) > 0; } else { return issueCommentCounts.containsKey(issue.getId()) && Math.abs(issueCommentCounts.get(issue.getId()) - issue.getCommentCount()) > 0; } }
Source:
protected void copyFrom(ServiceState s) { mVoiceRegState = s.mVoiceRegState; mDataRegState = s.mDataRegState; mVoiceRoamingType = s.mVoiceRoamingType; mDataRoamingType = s.mDataRoamingType; mVoiceOperatorAlphaLong = s.mVoiceOperatorAlphaLong; mVoiceOperatorAlphaShort = s.mVoiceOperatorAlphaShort; mVoiceOperatorNumeric = s.mVoiceOperatorNumeric; mDataOperatorAlphaLong = s.mDataOperatorAlphaLong; mDataOperatorAlphaShort = s.mDataOperatorAlphaShort; mDataOperatorNumeric = s.mDataOperatorNumeric; mIsManualNetworkSelection = s.mIsManualNetworkSelection; mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology; mRilDataRadioTechnology = s.mRilDataRadioTechnology; mCssIndicator = s.mCssIndicator; mNetworkId = s.mNetworkId; mSystemId = s.mSystemId; mCdmaRoamingIndicator = s.mCdmaRoamingIndicator; mCdmaDefaultRoamingIndicator = s.mCdmaDefaultRoamingIndicator; mCdmaEriIconIndex = s.mCdmaEriIconIndex; mCdmaEriIconMode = s.mCdmaEriIconMode; mIsEmergencyOnly = s.mIsEmergencyOnly; mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration; mIsUsingCarrierAggregation = s.mIsUsingCarrierAggregation; mChannelNumber = s.mChannelNumber; mCellBandwidths = s.mCellBandwidths == null ? null : Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length); mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost; mNetworkRegistrationStates = new ArrayList<>(s.mNetworkRegistrationStates); }

Target:
protected void copyFrom(ServiceState s) { mVoiceRegState = s.mVoiceRegState; mDataRegState = s.mDataRegState; mVoiceRoamingType = s.mVoiceRoamingType; mDataRoamingType = s.mDataRoamingType; mVoiceOperatorAlphaLong = s.mVoiceOperatorAlphaLong; mVoiceOperatorAlphaShort = s.mVoiceOperatorAlphaShort; mVoiceOperatorNumeric = s.mVoiceOperatorNumeric; mDataOperatorAlphaLong = s.mDataOperatorAlphaLong; mDataOperatorAlphaShort = s.mDataOperatorAlphaShort; mDataOperatorNumeric = s.mDataOperatorNumeric; mIsManualNetworkSelection = s.mIsManualNetworkSelection; mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology; mRilDataRadioTechnology = s.mRilDataRadioTechnology; mCssIndicator = s.mCssIndicator; mNetworkId = s.mNetworkId; mSystemId = s.mSystemId; mCdmaRoamingIndicator = s.mCdmaRoamingIndicator; mCdmaDefaultRoamingIndicator = s.mCdmaDefaultRoamingIndicator; mCdmaEriIconIndex = s.mCdmaEriIconIndex; mCdmaEriIconMode = s.mCdmaEriIconMode; mIsEmergencyOnly = s.mIsEmergencyOnly; mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration; mIsUsingCarrierAggregation = s.mIsUsingCarrierAggregation; mChannelNumber = s.mChannelNumber; mCellBandwidths = s.mCellBandwidths == null ? null : Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length); mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost; mNetworkRegistrationStates = s.mNetworkRegistrationStates == null ? null : new ArrayList<>(s.mNetworkRegistrationStates); }
Source:
public static void verifyCassandraIsSettled() throws IOException, InterruptedException { StartupIndependenceUtils.restartAtlasWithChecks(); StartupIndependenceUtils.assertSatisfiedWithin(240, StartupIndependenceUtils::canPerformTransaction); StartupIndependenceUtils.randomizeNamespace(); }

Target:
public static void verifyCassandraIsSettled() throws IOException, InterruptedException { restartAtlasWithChecks(); assertSatisfiedWithin(240, StartupIndependenceUtils::canPerformTransaction); randomizeNamespace(); }
Source:
void storeProjectName(IProject genProject, Package model, InstanceSpecification node) { final String projectGeneratedName = model.getName() + "_" + node.getName() + "_" + TransformationContext.current.deploymentPlan.getName(); if (genProject != null) { final String pName = genProject.getName(); TransactionalEditingDomain domain = TransactionUtil .getEditingDomain(TransformationContext.initialDeploymentPlan); if (domain != null) { domain.getCommandStack().execute(new RecordingCommand(domain) { @Override protected void doExecute() { Package deploymentPlanElement = TransformationContext.initialDeploymentPlan; DeploymentPlan deploymentPlan = UMLUtil.getStereotypeApplication(deploymentPlanElement, DeploymentPlan.class); EList<String> projectMappings = deploymentPlan.getProjectMappings(); String newMapping = ""; int oldMappingIndex = -1; for (int j = 0; j < projectMappings.size(); j++) { StringTokenizer str = new StringTokenizer(projectMappings.get(j), "="); String genName = str.nextToken(); if (genName.equals(projectGeneratedName)) { newMapping = projectGeneratedName + "=" + pName; oldMappingIndex = j; } } if (oldMappingIndex != -1) { projectMappings.remove(oldMappingIndex); projectMappings.add(newMapping); } } }); } } }

Target:
void storeProjectName(IProject genProject, Package model, InstanceSpecification node) { final String projectGeneratedName = model.getName() + "_" + node.getName() + "_" + TransformationContext.current.deploymentPlan.getName(); if (genProject != null) { final String pName = genProject.getName(); CommandSupport.exec(TransactionUtil.getEditingDomain(TransformationContext.initialDeploymentPlan), "Change Project Mapping", new Runnable() { @Override public void run() { Package deploymentPlanElement = TransformationContext.initialDeploymentPlan; DeploymentPlan deploymentPlan = UMLUtil.getStereotypeApplication(deploymentPlanElement, DeploymentPlan.class); EList<String> projectMappings = deploymentPlan.getProjectMappings(); String newMapping = ""; int oldMappingIndex = -1; for (int j = 0; j < projectMappings.size(); j++) { StringTokenizer str = new StringTokenizer(projectMappings.get(j), "="); String genName = str.nextToken(); if (genName.equals(projectGeneratedName)) { newMapping = projectGeneratedName + "=" + pName; oldMappingIndex = j; } } if (oldMappingIndex != -1) { projectMappings.remove(oldMappingIndex); projectMappings.add(newMapping); } } }); } }
Source:
private boolean isBrowserActive(){ if (driver.getCurrentUrl().isEmpty() && driver != null){ logger.warn("Unable to read url from bview. Resetting."); return false; } else if (driver == null){ logger.warn("chromedriver process was killed !"); return false; } return true; }

Target:
private boolean isBrowserActive(){ if (driver == null){ logger.warn("chromedriver process was killed !"); return false; } try { String url = driver.getCurrentUrl(); if(url.isEmpty() || url == null){ return false; } } catch (WebDriverException e){ logger.warn("Unable to read url from bview. Resetting."); return false; } return true; }
Source:
private void withExpandedLineWidget(LineWidget widget, final CommandWithArg<Boolean> onExpansionCompleted) { ChunkOutputWidget cow = lwToPlwMap_.get(widget); if (cow == null) return; cow.setExpansionState(ChunkOutputWidget.EXPANDED, onExpansionCompleted); }

Target:
private void withExpandedLineWidget(LineWidget widget, final CommandWithArg<Boolean> onExpansionCompleted) { ChunkOutputWidget cow = lwToPlwMap_.get(widget); if (cow == null) { onExpansionCompleted.execute(false); return; } cow.setExpansionState(ChunkOutputWidget.EXPANDED, onExpansionCompleted); }
Source:
private void readIntegers( int total, LongColumnVector c, int rowId) throws IOException { int left = total; while (left > 0) { consume(); readRepetitionAndDefinitionLevels(); if (definitionLevel >= maxDefLevel) { c.vector[rowId] = dataColumn.readInteger(); c.isNull[rowId] = false; c.isRepeating = c.isRepeating && (c.vector[0] == c.vector[rowId]); } else { c.isNull[rowId] = true; c.isRepeating = false; c.noNulls = false; } rowId++; left--; } }

Target:
private void readIntegers( int total, LongColumnVector c, int rowId) throws IOException { int left = total; while (left > 0) { readRepetitionAndDefinitionLevels(); if (definitionLevel >= maxDefLevel) { c.vector[rowId] = dataColumn.readInteger(); c.isNull[rowId] = false; c.isRepeating = c.isRepeating && (c.vector[0] == c.vector[rowId]); } else { c.isNull[rowId] = true; c.isRepeating = false; c.noNulls = false; } rowId++; left--; } }
Source:
public void testServiceAsTagOption() { StatsDClient client = EasyMock.createMock(StatsDClient.class); StatsDEmitter emitter = new StatsDEmitter( new StatsDEmitterConfig("localhost", 8888, null, null, true, null, null, true, null, true), new ObjectMapper(), client ); client.time("druid.query.time", 10, "druidService:druid/broker", "dataSource:data-source", "type:groupBy", "hostname:brokerHost1" ); EasyMock.replay(client); emitter.emit(new ServiceMetricEvent.Builder() .setDimension("dataSource", "data-source") .setDimension("type", "groupBy") .build(DateTimes.nowUtc(), "query/time", 10) .build("druid/broker", "brokerHost1") ); EasyMock.verify(client); }

Target:
public void testServiceAsTagOption() { StatsDClient client = EasyMock.createMock(StatsDClient.class); StatsDEmitter emitter = new StatsDEmitter( new StatsDEmitterConfig("localhost", 8888, null, null, true, null, null, true, null, true), new ObjectMapper(), client ); client.time("druid.query.time", 10, "druid_service:druid/broker", "dataSource:data-source", "type:groupBy", "hostname:brokerHost1" ); EasyMock.replay(client); emitter.emit(new ServiceMetricEvent.Builder() .setDimension("dataSource", "data-source") .setDimension("type", "groupBy") .build(DateTimes.nowUtc(), "query/time", 10) .build("druid/broker", "brokerHost1") ); EasyMock.verify(client); }
Source:
private void handleLedgerEviction(RemovalNotification<Long, CachedFileInfo> notification) { CachedFileInfo fileInfo = notification.getValue(); Long ledgerId = notification.getKey(); if (null == fileInfo || null == notification.getKey()) { return; } if (notification.wasEvicted()) { evictedLedgersCounter.inc(); } fileInfo.release(); }

Target:
private void handleLedgerEviction(RemovalNotification<Long, CachedFileInfo> notification) { CachedFileInfo fileInfo = notification.getValue(); if (null == fileInfo || null == notification.getKey()) { return; } if (notification.wasEvicted()) { evictedLedgersCounter.inc(); } fileInfo.release(); }
Source:
public List<Map<String, Long>> getInstanceInformation(final Integer datasetId, final Integer studyId) { try { final StringBuilder sql = new StringBuilder("SELECT \n" + " g.description as environment,\n" + " COUNT(*) AS observations,\n" + " (SELECT \n" + " COUNT(*)\n" + " FROM\n" + " stock s\n" + " WHERE\n" + " s.project_id = :studyId ) AS entries,\n" + " geop.value AS repNumber\n" + "FROM\n" + " nd_experiment nd,\n" + " nd_geolocation g,\n" + " nd_geolocationprop geop\n" + "WHERE\n" + " g.nd_geolocation_id = nd.nd_geolocation_id\n" + " AND nd.project_id = :datasetId \n" + " AND nd.nd_geolocation_id = geop.nd_geolocation_id\n" + " AND geop.type_id = " + TermId.NUMBER_OF_REPLICATES.getId() +" \n" + "GROUP BY g.description"); final SQLQuery query = this.getSession().createSQLQuery(sql.toString()); query.addScalar("environment",new LongType()); query.addScalar("observations",new LongType()); query.addScalar("entries",new LongType()); query.addScalar("repNumber",new LongType()); query.setParameter("studyId", studyId); query.setParameter("datasetId", datasetId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); final List<Map<String, Long>> results = query.list(); return results; } catch ( final HibernateException e) { final String message = "Error at getInstanceInformation query at ExperimentDao: " + e.getMessage(); ExperimentDao.LOG.error(message, e); throw new MiddlewareQueryException(message, e); } }

Target:
public List<InstanceDetailsDTO> getInstanceInformation(final Integer datasetId, final Integer studyId) { try { final StringBuilder sql = new StringBuilder( "SELECT\n" + " g.description AS environment,\n" + " COUNT(*) AS nOfObservations,\n" + " (SELECT COUNT(*)\n" + " FROM stock s\n" + " WHERE s.project_id = :studyId) AS nOfEntries,\n" + " COALESCE((SELECT geop.value\n" + " FROM nd_geolocationprop geop\n" + " WHERE nd.nd_geolocation_id = geop.nd_geolocation_id\n" + " AND geop.type_id = " + TermId.NUMBER_OF_REPLICATES.getId() +"),\n" + " 1) AS nOfReps\n" + "FROM\n" + " nd_experiment nd,\n" + " nd_geolocation g\n" + "WHERE\n" + " g.nd_geolocation_id = nd.nd_geolocation_id\n" + " AND nd.project_id = :datasetId \n" + "GROUP BY g.description;"); final SQLQuery query = this.getSession().createSQLQuery(sql.toString()); query.addScalar("environment",new LongType()); query.addScalar("nOfObservations",new LongType()); query.addScalar("nOfEntries",new LongType()); query.addScalar("nOfReps",new LongType()); query.setParameter("studyId", studyId); query.setParameter("datasetId", datasetId); query.setResultTransformer(Transformers.aliasToBean(InstanceDetailsDTO.class)); final List<InstanceDetailsDTO> results = query.list(); return results; } catch ( final HibernateException e) { final String message = "Error at getInstanceInformation query at ExperimentDao: " + e.getMessage(); ExperimentDao.LOG.error(message, e); throw new MiddlewareQueryException(message, e); } }
Source:
public void init(final NotificationWidgetView.Presenter presenter, List<NotificationRow> rows) { this.rows = rows; presenter.addValueChangeHandler(event -> { dataProvider.getList().clear(); dataProvider.getList().addAll(event.getValue()); refreshTable(); }); this.presenter = presenter; this.dataProvider = new ListDataProvider<>(rows); modal.setTitle(presenter.getNameHeader()); modal.setWidth("1200px"); modal.setBody(this); table.setWidth("1220px"); closeButton.setName(StunnerFormsClientFieldsConstants.INSTANCE.Cancel()); saveButton.setName(StunnerFormsClientFieldsConstants.INSTANCE.Save()); addButton.setName(StunnerFormsClientFieldsConstants.INSTANCE.Add()); initTable(); }

Target:
public void init(final NotificationWidgetView.Presenter presenter, List<NotificationRow> rows) { this.rows = rows; presenter.addValueChangeHandler(event -> { dataProvider.getList().clear(); dataProvider.getList().addAll(event.getValue()); refreshTable(); }); this.presenter = presenter; this.dataProvider.setList(rows); modal.setTitle(presenter.getNameHeader()); modal.setWidth("1200px"); modal.setBody(this); modal.setClosable(false); table.setToolBarVisible(false); table.setWidth("1220px"); initTable(); }
Source:
void executeRefresh(ZWaveNode node, ZWaveThermostatModeCommandClass commandClass, int endpointId, Map<String, String> arguments) { logger.debug("NODE {}: Generating poll message for for node endpoint {}", commandClass.getCommandClass().getLabel(), node.getNodeId(), endpointId); SerialMessage serialMessage = node.encapsulate(commandClass.getValueMessage(), commandClass, endpointId); if (serialMessage == null) { logger.warn("NODE {}: Generating message failed for command class = {}, endpoint = {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId); return; } this.getController().sendData(serialMessage); }

Target:
void executeRefresh(ZWaveNode node, ZWaveThermostatModeCommandClass commandClass, int endpointId, Map<String, String> arguments) { logger.debug("NODE {}: Generating poll message for endpoint {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId); SerialMessage serialMessage = node.encapsulate(commandClass.getValueMessage(), commandClass, endpointId); if (serialMessage == null) { logger.warn("NODE {}: Generating message failed for command class = {}, endpoint = {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId); return; } this.getController().sendData(serialMessage); }
Source:
CustomRestClientImpl(HttpClient httpClient) { _httpClient = httpClient; _semaphore = new Semaphore(10); }

Target:
CustomRestClientImpl(HttpClient httpClient) { _httpClient = httpClient; }
Source:
private static int makeVillagerAgressive(ServerPlayerEntity asPlayer) { List<VillagerEntity> l = asPlayer.getEntityWorld().getEntitiesWithinAABB(VillagerEntity.class, asPlayer.getBoundingBox().grow(3, 2, 3)); for (VillagerEntity v : l) { TotemTileEntity.makeAgressive(v); } return 0; }

Target:
private static int makeVillagerAgressive(ServerPlayerEntity asPlayer) { List<VillagerEntity> l = asPlayer.getEntityWorld().getEntitiesWithinAABB(VillagerEntity.class, asPlayer.getBoundingBox().grow(3, 2, 3)); for (VillagerEntity v : l) { if(v instanceof IFactionEntity)continue; TotemTileEntity.makeAgressive(v); } return 0; }
Source:
@Test public void shouldProperlyPersistFolderPropertiesOnMultipleReloads() throws Exception { Folder folder = r.jenkins.createProject(Folder.class, "myFolder"); r.jenkins.setAuthorizationStrategy(new ProjectMatrixAuthorizationStrategy()); folder.addProperty(new FolderCredentialsProvider.FolderCredentialsProperty(new DomainCredentials[0])); folder.doReload(); Map<Permission,Set<String>> grantedPermissions = new HashMap<Permission, Set<String>>(); Set<String> sids = new HashSet<String>(); sids.add("admin"); grantedPermissions.put(Jenkins.ADMINISTER, sids); folder.addProperty(new com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty(grantedPermissions)); folder.doReload(); Folder reloadedFolder = r.jenkins.getItemByFullName("myFolder", Folder.class); assertThat("Folder has not been found after the reloading", reloadedFolder, notNullValue()); assertThat("Property has not been reloaded, hence it has not been saved properly", reloadedFolder.getProperties().get(com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty.class), notNullValue()); }

Target:
@Test public void shouldProperlyPersistFolderPropertiesOnMultipleReloads() throws Exception { Folder folder = r.jenkins.createProject(Folder.class, "myFolder"); folder.addProperty(new FolderCredentialsProvider.FolderCredentialsProperty(new DomainCredentials[0])); r.jenkins.reload(); Map<Permission,Set<String>> grantedPermissions = new HashMap<Permission, Set<String>>(); Set<String> sids = new HashSet<String>(); sids.add("admin"); grantedPermissions.put(Jenkins.ADMINISTER, sids); folder = r.jenkins.getItemByFullName("myFolder", Folder.class); r.jenkins.setAuthorizationStrategy(new ProjectMatrixAuthorizationStrategy()); folder.addProperty(new com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty(grantedPermissions)); r.jenkins.reload(); Folder reloadedFolder = r.jenkins.getItemByFullName("myFolder", Folder.class); assertThat("Folder has not been found after the reloading", reloadedFolder, notNullValue()); assertThat("Property has not been reloaded, hence it has not been saved properly", reloadedFolder.getProperties().get(com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty.class), notNullValue()); assertPropertyOwner("After reload", reloadedFolder, FolderCredentialsProvider.FolderCredentialsProperty.class); assertPropertyOwner("After reload", reloadedFolder, com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty.class); }
Source:
private void copyStack(ActionInvocation invocation, CompoundRoot root) { List list = prepareList(root); Map<String, Object> ctxMap = invocation.getInvocationContext().getContextMap(); for (Object object : list) { if (shouldCopy(object)) { String actionConfigClassName = invocation.getProxy().getConfig().getClassName(); Object action = invocation.getAction(); if (action.getClass().getName().equals(actionConfigClassName)) reflectionProvider.copy(object, action, ctxMap, prepareExcludes(), includes, null); else { Class <?> editable; try { editable = Class.forName(actionConfigClassName); } catch (ClassNotFoundException e) { LOG.warn("An unexpected state. This may be due to a bug. Please report this: ClassNotFoundException" + actionConfigClassName); return; } reflectionProvider.copy(object, action, ctxMap, prepareExcludes(), includes, editable); } } } }

Target:
private void copyStack(ActionInvocation invocation, CompoundRoot root) { List list = prepareList(root); Map<String, Object> ctxMap = invocation.getInvocationContext().getContextMap(); for (Object object : list) { if (shouldCopy(object)) { Object action = invocation.getAction(); Class <?> editable = null; if (null != editableClass && !action.getClass().getName().equals(editableClass)) { try { editable = Class.forName(editableClass); } catch (ClassNotFoundException e) { LOG.warn("Restrict property setting failed: " + editableClass + " class not found", e); } } reflectionProvider.copy(object, action, ctxMap, prepareExcludes(), includes, editable); } } }
Source:
private static void scheduleUpdate(FileWithDocument fileWithDoc) { ISonarLintFile file = fileWithDoc.getFile(); if (!file.getProject().isAutoEnabled() || !FileExclusionsUtils.shouldAnalyze(file.getProject(), file.getResource())) { return; } AnalyzeProjectRequest request = new AnalyzeProjectRequest(file.getProject(), Arrays.asList(fileWithDoc), TriggerType.EDITOR_OPEN); new AnalyzeProjectJob(request).schedule(); }

Target:
private static void scheduleUpdate(FileWithDocument fileWithDoc) { ISonarLintFile file = fileWithDoc.getFile(); FileExclusionsChecker exclusionsChecker = new FileExclusionsChecker(file.getProject()); if (!file.getProject().isAutoEnabled() || !exclusionsChecker.shouldAnalyze(file, true)) { return; } AnalyzeProjectRequest request = new AnalyzeProjectRequest(file.getProject(), Arrays.asList(fileWithDoc), TriggerType.EDITOR_OPEN); new AnalyzeProjectJob(request).schedule(); }
Source:
private Map<Resource, Set<URI>> getTypePropertyImplyingType(final Resource queryType, final Map<Resource, Map<Resource, URI>> schemaMap) { final Map<Resource, Set<URI>> implications = new HashMap<>(); if (schemaMap != null) { final HashSet<Resource> queryTypes = new HashSet<>(); queryTypes.add(queryType); if (queryType instanceof URI) { queryTypes.addAll(getSubClasses((URI) queryType)); } for (final Resource querySubType : queryTypes) { if (schemaMap.containsKey(querySubType)) { final Map<Resource, URI> otherTypeToProperty = schemaMap.get(querySubType); for (final Resource otherType : otherTypeToProperty.keySet()) { if (!implications.containsKey(otherType)) { implications.put(otherType, new HashSet<>()); } final URI property = otherTypeToProperty.get(otherType); implications.get(otherType).add(property); implications.get(otherType).addAll(getSubProperties(property)); } } } } return implications; }

Target:
private Map<Resource, Set<URI>> getTypePropertyImplyingType(final Resource queryType, final Map<Resource, Map<Resource, URI>> schemaMap) { final Map<Resource, Set<URI>> implications = new HashMap<>(); if (schemaMap != null && queryType != null) { final HashSet<Resource> queryTypes = new HashSet<>(); queryTypes.add(queryType); if (queryType instanceof URI) { queryTypes.addAll(getSubClasses((URI) queryType)); } for (final Resource querySubType : queryTypes) { if (schemaMap.containsKey(querySubType)) { final Map<Resource, URI> otherTypeToProperty = schemaMap.get(querySubType); for (final Resource otherType : otherTypeToProperty.keySet()) { if (!implications.containsKey(otherType)) { implications.put(otherType, new HashSet<>()); } final URI property = otherTypeToProperty.get(otherType); if (property != null) { implications.get(otherType).add(property); implications.get(otherType).addAll(getSubProperties(property)); } } } } } return implications; }
Source:
public void sphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised, @Switch('h') boolean hollow, @Switch('s') boolean hemi, @Switch('i') boolean upsideDown, @Switch('p') boolean precisionMode) throws WorldEditException { String[] radii = radiusString.split(","); final double radiusX, radiusY, radiusZ; switch (radii.length) { case 1: radiusX = radiusY = radiusZ = Math.max(1, Double.parseDouble(radii[0])); break; case 3: radiusX = Math.max(1, Double.parseDouble(radii[0])); radiusY = Math.max(1, Double.parseDouble(radii[1])); radiusZ = Math.max(1, Double.parseDouble(radii[2])); break; default: player.printError("You must either specify 1 or 3 radius values."); return; } worldEdit.checkMaxRadius(radiusX); worldEdit.checkMaxRadius(radiusY); worldEdit.checkMaxRadius(radiusZ); Vector pos = session.getPlacementPosition(player); if (raised && !hemi) { pos = pos.add(0, radiusY, 0); } Vector directionVector = null; if (hemi && precisionMode) { directionVector = player.getLocation().getDirection(); } int affected = editSession.makeSphere(pos, Patterns.wrap(pattern), radiusX, radiusY, radiusZ, !hollow, hemi, upsideDown, directionVector); player.findFreePosition(); player.print(affected + " block(s) have been created."); }

Target:
public void sphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised, @Switch('h') boolean hollow, @Switch('s') boolean hemi, @Switch('i') boolean upsideDown, @Switch('p') boolean precisionMode) throws WorldEditException { boolean error = false; if (!hemi) { if (precisionMode) { player.printError("-p flag doesn't have an effect when it's not a hemisphere."); error = true; } if (upsideDown) { player.printError("-i flag doesn't have an effect when it's not a hemisphere."); error = true; } } if (error) { return; } String[] radii = radiusString.split(","); final double radiusX, radiusY, radiusZ; switch (radii.length) { case 1: radiusX = radiusY = radiusZ = Math.max(1, Double.parseDouble(radii[0])); break; case 3: radiusX = Math.max(1, Double.parseDouble(radii[0])); radiusY = Math.max(1, Double.parseDouble(radii[1])); radiusZ = Math.max(1, Double.parseDouble(radii[2])); break; default: player.printError("You must either specify 1 or 3 radius values."); return; } worldEdit.checkMaxRadius(radiusX); worldEdit.checkMaxRadius(radiusY); worldEdit.checkMaxRadius(radiusZ); Vector pos = session.getPlacementPosition(player); if (raised && !hemi) { pos = pos.add(0, radiusY, 0); } Vector directionVector = null; if (hemi && precisionMode) { directionVector = player.getLocation().getDirection(); } int affected = editSession.makeSphere(pos, Patterns.wrap(pattern), radiusX, radiusY, radiusZ, !hollow, hemi, upsideDown, directionVector); player.findFreePosition(); player.print(affected + " block(s) have been created."); }
Source:
private void deleteStylesheetsCacheDirectory() { Path cacheStylesheetsDirectory = preferencesService.getCacheStylesheetsDirectory(); if (Files.exists(cacheStylesheetsDirectory)) { try { deleteRecursively(cacheStylesheetsDirectory); } catch (IOException e) { logger.warn("Missing permission to delete style sheets cache directory ''{}''", cacheStylesheetsDirectory); } } }

Target:
private void deleteStylesheetsCacheDirectory() { Path cacheStylesheetsDirectory = preferencesService.getCacheStylesheetsDirectory(); if (Files.exists(cacheStylesheetsDirectory)) { try { deleteRecursively(cacheStylesheetsDirectory); } catch (IOException e) { logger.warn("Missing permission to delete style sheets cache directory '{}'", cacheStylesheetsDirectory); } } }
Source:
public String getRootLevel() { return getLevel(""); }

Target:
public String getRootLevel() { return logging.getRootLevel().toString(); }
Source:
private String buildJobsAllSqlQuery() { StringBuilder sb = new StringBuilder("SELECT A.TRIGGER_NAME, A.TRIGGER_GROUP, B.JOB_DATA FROM "); sb = sb.append(getCorrectNameRepresentation(sqlProperties.get(TABLE_PREFIX).toString() + TRIGGERS)); sb = sb.append(" AS A JOIN QRTZ_JOB_DETAILS AS B ON A.TRIGGER_NAME = B.JOB_NAME AND A.TRIGGER_GROUP = B.JOB_GROUP"); return sb.toString(); }

Target:
private String buildJobsAllSqlQuery() { StringBuilder sb = new StringBuilder("SELECT A. TRIGGER_NAME, A.TRIGGER_GROUP, B.JOB_DATA FROM ") .append(getCorrectNameRepresentation(sqlProperties.get(TABLE_PREFIX).toString() + TRIGGERS)) .append(" AS A JOIN QRTZ_JOB_DETAILS AS B ON A.TRIGGER_NAME = B.JOB_NAME AND A.TRIGGER_GROUP = B.JOB_GROUP"); return sb.toString(); }
Source:
protected void executeCommand() { Map<String, Object> raidParams = new HashMap<String, Object>(); if (!getParameters().getRaidType().equals(RaidType.None) && !getParameters().getRaidType().equals(RaidType.Raid0)) { raidParams.put("type", getParameters().getRaidType().getValue()); raidParams.put("pdCount", getParameters().getNoOfPhysicalDisksInRaidVolume()); raidParams.put("stripSize", getParameters().getStripeSize()); } VDSReturnValue returnValue = runVdsCommand( VDSCommandType.CreateBrick, new CreateBrickVDSParameters(getVdsId(), getParameters().getLvName(), getParameters().getMountPoint(), raidParams, "xfs", getParameters().getDisks())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { StorageDevice storageDevice = (StorageDevice) returnValue.getReturnValue(); saveStoageDevice(storageDevice); resetIsFreeFlag(getParameters().getDisks()); } else { handleVdsError(returnValue); } }

Target:
protected void executeCommand() { Map<String, Object> raidParams = new HashMap<>(); if (!getParameters().getRaidType().equals(RaidType.None) && !getParameters().getRaidType().equals(RaidType.Raid0)) { raidParams.put("type", getParameters().getRaidType().getValue()); raidParams.put("pdCount", getParameters().getNoOfPhysicalDisksInRaidVolume()); raidParams.put("stripSize", getParameters().getStripeSize()); } VDSReturnValue returnValue = runVdsCommand( VDSCommandType.CreateBrick, new CreateBrickVDSParameters(getVdsId(), getParameters().getLvName(), getParameters().getMountPoint(), raidParams, GlusterConstants.FS_TYPE_XFS, getParameters().getDisks())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { StorageDevice storageDevice = (StorageDevice) returnValue.getReturnValue(); saveStoageDevice(storageDevice); resetIsFreeFlag(getParameters().getDisks()); } else { handleVdsError(returnValue); } }
Source:
public void formatValue(String fieldName, Pair<String, String> pair, boolean caseSensitive) { if (APPS.equals(fieldName)) { pair.setSecond( StringFormat.format(BaseConditionFieldAutoCompleter.getI18NPrefix() + "'%%%1$s%%'", StringHelper.trim(pair.getSecond(), '\'').replace("N'", ""))); if ("=".equals(pair.getFirst())) { pair.setFirst(BaseConditionFieldAutoCompleter.getLikeSyntax(caseSensitive)); } else if ("!=".equals(pair.getFirst())) { pair.setFirst("NOT " + BaseConditionFieldAutoCompleter.getLikeSyntax(caseSensitive)); } } else if (UPTIME.equals(fieldName)) { int milisecond = 1000; pair.setSecond(StringHelper.trim(pair.getSecond(), '\'')); TimeSpan ts = TimeSpan.parse(pair.getSecond()); pair.setSecond(StringFormat.format("'%1$s'", ts.TotalMilliseconds < milisecond ? 0 : ts.TotalMilliseconds / milisecond)); } else if (CREATIONDATE.equals(fieldName)) { Date tmp = new Date(Date.parse(StringHelper.trim(pair.getSecond(), '\''))); pair.setSecond(StringFormat.format("'%1$s'", tmp)); } else { super.formatValue(fieldName, pair, caseSensitive); } }

Target:
public void formatValue(String fieldName, Pair<String, String> pair, boolean caseSensitive) { if (APPS.equals(fieldName)) { pair.setSecond( StringFormat.format(BaseConditionFieldAutoCompleter.getI18NPrefix() + "'%%%1$s%%'", StringHelper.trim(pair.getSecond(), '\'').replace("N'", ""))); if ("=".equals(pair.getFirst())) { pair.setFirst(BaseConditionFieldAutoCompleter.getLikeSyntax(caseSensitive)); } else if ("!=".equals(pair.getFirst())) { pair.setFirst("NOT " + BaseConditionFieldAutoCompleter.getLikeSyntax(caseSensitive)); } } else if (UPTIME.equals(fieldName)) { pair.setSecond(StringHelper.trim(pair.getSecond(), '\'')); TimeSpan ts = TimeSpan.parse(pair.getSecond()); pair.setSecond(StringFormat.format("'%1$s'", ts.TotalMilliseconds < MILISECOND ? 0 : ts.TotalMilliseconds / MILISECOND)); } else if (CREATIONDATE.equals(fieldName)) { Date tmp = new Date(Date.parse(StringHelper.trim(pair.getSecond(), '\''))); pair.setSecond(StringFormat.format("'%1$s'", tmp)); } else { super.formatValue(fieldName, pair, caseSensitive); } }
Source:
ElasticsearchTableDescriptionProvider(ElasticsearchConnectorConfig config, JsonCodec<ElasticsearchTableDescription> codec) { requireNonNull(config, "config is null"); requireNonNull(codec, "codec is null"); checkArgument(config.getScrollTimeout().toMillis() >= 10, "scrollTimeout must be at least 10 ms"); checkArgument(config.getRequestTimeout().toMillis() >= 10, "requestTimeout must be at least 10 ms"); tableDefinitions = createTableDescriptions(config, codec); }

Target:
ElasticsearchTableDescriptionProvider(ElasticsearchConnectorConfig config, JsonCodec<ElasticsearchTableDescription> codec) { requireNonNull(config, "config is null"); requireNonNull(codec, "codec is null"); tableDefinitions = createTableDescriptions(config, codec); }
Source:
public void testAssistForUnknownButConnectedType() throws CoreException, InvocationTargetException, IOException, InterruptedException { List<CompletionItem> items = new ArrayList<>(); items.add(createCompletionItem("FirstClass", CompletionItemKind.Class)); MockLanguageServer.INSTANCE.setCompletionList(new CompletionList(false, items)); IFile testFile = TestUtils.createUniqueTestFileOfUnknownType(project, ""); ITextViewer viewer = TestUtils.openTextViewer(testFile); LanguageServerDefinition serverDefinition = LanguageServersRegistry.getInstance().getDefinition("org.eclipse.lsp4e.test.server"); assertNotNull(serverDefinition); IPath fileLocation = testFile.getLocation(); LanguageServerWrapper lsWrapperForConnection = LanguageServiceAccessor .getLSWrapperForConnection(testFile.getProject(), serverDefinition, fileLocation); lsWrapperForConnection.connect(testFile, null); new DisplayHelper() { @Override protected boolean condition() { return lsWrapperForConnection.isConnectedTo(fileLocation); } }.waitForCondition(Display.getCurrent(), 3000); Assert.assertTrue(lsWrapperForConnection.isConnectedTo(fileLocation)); ICompletionProposal[] proposals = contentAssistProcessor.computeCompletionProposals(viewer, 0); assertEquals(items.size(), proposals.length); LSCompletionProposal lsCompletionProposal = (LSCompletionProposal)proposals[0]; lsCompletionProposal.apply(viewer, '\n', 0, 0); assertEquals(new Point("FirstClass".length(), 0), lsCompletionProposal.getSelection(viewer.getDocument())); }

Target:
public void testAssistForUnknownButConnectedType() throws CoreException, InvocationTargetException, IOException, InterruptedException { List<CompletionItem> items = new ArrayList<>(); items.add(createCompletionItem("FirstClass", CompletionItemKind.Class)); MockLanguageServer.INSTANCE.setCompletionList(new CompletionList(false, items)); IFile testFile = TestUtils.createUniqueTestFileOfUnknownType(project, ""); ITextViewer viewer = TestUtils.openTextViewer(testFile); LanguageServerDefinition serverDefinition = LanguageServersRegistry.getInstance().getDefinition("org.eclipse.lsp4e.test.server"); assertNotNull(serverDefinition); IPath fileLocation = testFile.getLocation(); LanguageServerWrapper lsWrapperForConnection = LanguageServiceAccessor .getLSWrapperForConnection(testFile.getProject(), serverDefinition); lsWrapperForConnection.connect(testFile, null); new DisplayHelper() { @Override protected boolean condition() { return lsWrapperForConnection.isConnectedTo(fileLocation); } }.waitForCondition(Display.getCurrent(), 3000); Assert.assertTrue(lsWrapperForConnection.isConnectedTo(fileLocation)); ICompletionProposal[] proposals = contentAssistProcessor.computeCompletionProposals(viewer, 0); assertEquals(items.size(), proposals.length); LSCompletionProposal lsCompletionProposal = (LSCompletionProposal)proposals[0]; lsCompletionProposal.apply(viewer, '\n', 0, 0); assertEquals(new Point("FirstClass".length(), 0), lsCompletionProposal.getSelection(viewer.getDocument())); }
Source:
public void delete(Path path) throws IOException { AzurePath aPath = validatePathInstanceType(path); validateNotRoot(path, "Delete"); BlobClient blobClient = aPath.toBlobClient(); DirectoryStatus dirStatus = checkDirStatus(blobClient); if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) { throw Utility.logError(logger, new NoSuchFileException(path.toString())); } if (dirStatus.equals(DirectoryStatus.NOT_EMPTY)) { throw Utility.logError(logger, new DirectoryNotEmptyException(path.toString())); } try { blobClient.delete(); } catch (BlobStorageException e) { throw Utility.logError(logger, new IOException(e)); } }

Target:
public void delete(Path path) throws IOException { AzurePath aPath = validatePathInstanceType(path); validateNotRoot(path, "Delete"); BlobClient blobClient = aPath.toBlobClient(); DirectoryStatus dirStatus = checkDirStatus(blobClient); if (dirStatus.equals(DirectoryStatus.DOES_NOT_EXIST)) { throw Utility.logError(logger, new NoSuchFileException(path.toString())); } if (dirStatus.equals(DirectoryStatus.NOT_EMPTY)) { throw Utility.logError(logger, new DirectoryNotEmptyException(path.toString())); } try { blobClient.delete(); } catch (BlobStorageException e) { if (e.getErrorCode().equals(BlobErrorCode.BLOB_NOT_FOUND)) { throw Utility.logError(logger, new NoSuchFileException(path.toString())); } throw Utility.logError(logger, new IOException(e)); } }
Source:
void processMsg(byte[] data, int offset, int length) { SubscriptionImpl sub; mu.lock(); try { stats.incrementInMsgs(); stats.incrementInBytes(length); sub = subs.get(parser.ps.ma.sid); if (sub == null) { return; } Message msg = new Message(parser.ps.ma, sub, data, offset, length); MsgDeliveryWorker mdw = null; if (sub instanceof AsyncSubscriptionImpl) { mdw = ((AsyncSubscriptionImpl) sub).getDeliveryWorker(); } if (mdw != null) { mdw.lock(); } else { sub.lock(); } try { sub.pMsgs++; if (sub.pMsgs > sub.pMsgsMax) { sub.pMsgsMax = sub.pMsgs; } sub.pBytes += (msg.getData() == null ? 0 : msg.getData().length); if (sub.pBytes > sub.pBytesMax) { sub.pBytesMax = sub.pBytes; } if ((sub.pMsgsLimit > 0 && sub.pMsgs > sub.pMsgsLimit) || (sub.pBytesLimit > 0 && sub.pBytes > sub.pBytesLimit)) { handleSlowConsumer(sub, msg); } else { if (mdw != null) { mdw.postMsg(msg); } else { if (sub.getChannel() != null) { if (sub.getChannel().add(msg)) { sub.pCond.signal(); sub.setSlowConsumer(false); } else { handleSlowConsumer(sub, msg); } } } } } finally { if (mdw != null) { mdw.unlock(); } else { sub.unlock(); } } } finally { mu.unlock(); } }

Target:
void processMsg(byte[] data, int offset, int length) { SubscriptionImpl sub; mu.lock(); try { stats.incrementInMsgs(); stats.incrementInBytes(length); sub = subs.get(parser.ps.ma.sid); if (sub == null) { return; } Message msg = new Message(parser.ps.ma, sub, data, offset, length); MsgDeliveryWorker mdw = null; if (sub instanceof AsyncSubscriptionImpl) { mdw = ((AsyncSubscriptionImpl) sub).getDeliveryWorker(); } if (mdw != null) { mdw.lock(); } else { sub.lock(); } try { sub.pMsgs++; if (sub.pMsgs > sub.pMsgsMax) { sub.pMsgsMax = sub.pMsgs; } sub.pBytes += (msg.getData() == null ? 0 : msg.getData().length); if (sub.pBytes > sub.pBytesMax) { sub.pBytesMax = sub.pBytes; } if ((sub.pMsgsLimit > 0 && sub.pMsgs > sub.pMsgsLimit) || (sub.pBytesLimit > 0 && sub.pBytes > sub.pBytesLimit)) { handleSlowConsumer(sub, msg); } else { sub.setSlowConsumer(false); if (mdw != null) { mdw.postMsg(msg); } else { if (sub.getChannel() != null) { if (sub.getChannel().add(msg)) { sub.pCond.signal(); } else { handleSlowConsumer(sub, msg); } } } } } finally { if (mdw != null) { mdw.unlock(); } else { sub.unlock(); } } } finally { mu.unlock(); } }