auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void positionedRead() throws Exception { AlluxioURI path = new AlluxioURI(mFilePath); FileSystemTestUtils.createByteFile( mFileSystem, mFilePath, WritePType.MUST_CACHE, PAGE_SIZE_BYTES); try (FileInStream stream = mFileSystem.openFile(path)) { byte[] buffer = new byte[PAGE_SIZE_BYTES / 4]; int bytesRead = stream.positionedRead(PAGE_SIZE_BYTES / 10, buffer, 0, buffer.length); assertEquals(buffer.length, bytesRead); assertTrue(BufferUtils.equalIncreasingByteArray(PAGE_SIZE_BYTES / 10, buffer.length, buffer)); } URIStatus status = mFileSystem.getStatus(path); try (ReadableByteChannel channel = mCacheManager.get(new PageId(status.getFileId(), 0))) { assertNotNull(channel); assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(Channels.newInputStream(channel)))); } mClusterResource.get().stopWorkers(); try (InputStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } }

Target:
public void positionedRead() throws Exception { AlluxioURI path = new AlluxioURI(mFilePath); FileSystemTestUtils.createByteFile( mFileSystem, mFilePath, WritePType.MUST_CACHE, PAGE_SIZE_BYTES); try (FileInStream stream = mFileSystem.openFile(path)) { byte[] buffer = new byte[PAGE_SIZE_BYTES / 4]; int bytesRead = stream.positionedRead(PAGE_SIZE_BYTES / 10, buffer, 0, buffer.length); assertEquals(buffer.length, bytesRead); assertTrue(BufferUtils.equalIncreasingByteArray(PAGE_SIZE_BYTES / 10, buffer.length, buffer)); } mClusterResource.get().stopWorkers(); try (InputStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } }
Source:
protected boolean canDoAction() { boolean retValue = isVmExist(); if (retValue) { List<VM> listVms = getVmDAO().getForDisk(_oldDisk.getId()).get(Boolean.TRUE); sharedLockMap = listVms.isEmpty() ? null : new HashMap<Guid, String>(); for (VM vm : listVms) { sharedLockMap.put(vm.getId(), LockingGroup.VM.name()); if (vm.getstatus() != VMStatus.Down) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); return false; } } retValue = acquireLockInternal() && isDiskExist(_oldDisk) && checkCanPerformRegularUpdate(); } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = isVmExist(); if (retValue) { List<VM> listVms = getVmDAO().getForDisk(_oldDisk.getId()).get(Boolean.TRUE); buidSharedLockMap(listVms); acquireLockInternal(); for (VM vm : listVms) { if (vm.getstatus() != VMStatus.Down) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); return false; } } retValue = isDiskExist(_oldDisk) && checkCanPerformRegularUpdate(); } return retValue; }
Source:
public static Collection<Tile> parseClusterRecordsFromTileMetricsV3( final Collection<File> tileMetricsOutFiles, final Map<Integer, File> phasingMetricsFiles, final ReadStructure readStructure ) throws FileNotFoundException { Map<Integer, Map<Integer, Collection<TilePhasingValue>>> phasingValues = getTilePhasingValues(phasingMetricsFiles, readStructure); for (File tileMetricsOutFile : tileMetricsOutFiles) { TileMetricsOutReader tileMetricsIterator = new TileMetricsOutReader(tileMetricsOutFile, TileMetricsOutReader.TileMetricsVersion.THREE); final Collection<IlluminaTileMetrics> tileMetrics = determineLastValueForLaneTileMetricsCode(tileMetricsIterator); final Map<String, ? extends Collection<IlluminaTileMetrics>> locationToMetricsMap = partitionTileMetricsByLocation(tileMetrics); if (v3TileMetricsHasClusterRecordsFirstPass(locationToMetricsMap)) { final float density = tileMetricsIterator.getDensity(); return getTileClusterRecordsV3(locationToMetricsMap, phasingValues, density); } } for (File tileMetricsOutFile : tileMetricsOutFiles) { TileMetricsOutReader tileMetricsIterator = new TileMetricsOutReader(tileMetricsOutFile, TileMetricsOutReader.TileMetricsVersion.THREE); final float density = tileMetricsIterator.getDensity(); final Collection<IlluminaTileMetrics> tileMetrics = determineLastValueForLaneTileMetricsCode(tileMetricsIterator); final Map<String, ? extends Collection<IlluminaTileMetrics>> locationToMetricsMap = partitionTileMetricsByLocation(tileMetrics); final Collection<Tile> tiles = getTileClusterRecordsV3(locationToMetricsMap, phasingValues, density); if (!tiles.isEmpty()) { return tiles; } } final String pathsString = tileMetricsOutFiles .stream() .map(File::getAbsolutePath) .collect(Collectors.joining(", ")); throw new RuntimeException("None of the following input files contained cluster records:" + pathsString); }

Target:
public static Collection<Tile> parseClusterRecordsFromTileMetricsV3( final Collection<File> tileMetricsOutFiles, final Map<Integer, File> phasingMetricsFiles, final ReadStructure readStructure ) throws FileNotFoundException { final Map<Integer, Map<Integer, Collection<TilePhasingValue>>> phasingValues = getTilePhasingValues(phasingMetricsFiles, readStructure); for (File tileMetricsOutFile : tileMetricsOutFiles) { final TileMetricsOutReader tileMetricsIterator = new TileMetricsOutReader(tileMetricsOutFile, TileMetricsOutReader.TileMetricsVersion.THREE); final float density = tileMetricsIterator.getDensity(); final Collection<IlluminaTileMetrics> tileMetrics = determineLastValueForLaneTileMetricsCode(tileMetricsIterator); final Map<String, ? extends Collection<IlluminaTileMetrics>> locationToMetricsMap = partitionTileMetricsByLocation(tileMetrics); final Collection<Tile> tiles = getTileClusterRecordsV3(locationToMetricsMap, phasingValues, density); if (!tiles.isEmpty()) { return tiles; } } final String pathsString = tileMetricsOutFiles .stream() .map(File::getAbsolutePath) .collect(Collectors.joining(", ")); throw new RuntimeException("None of the following input files contained cluster records: " + pathsString); }
Source:
public long getEnd() { return fXvalues[fXvalues.length]; }

Target:
public long getEnd() { return fXvalues[Integer.max(0, fXvalues.length - 1)]; }
Source:
private void writeEmailsIntoTextFile(HashSet<String> studentEmailSet, HashSet<String> instructorEmailSet) { try { File newFile = new File(filePathForSaving + this.getCurrentDateForDisplay() + ".txt"); FileOutputStream fos = new FileOutputStream(newFile); OutputStreamWriter osw = new OutputStreamWriter(fos); try (Writer w = new BufferedWriter(osw)) { int studentEmailCount = 0; if (!studentEmailSet.isEmpty()) { for (String email : studentEmailSet) { if (!shouldIncludeTestData && email.endsWith(".tmt")) { continue; } w.write(email + ","); studentEmailCount++; } } int instructorEmailCount = 0; if (!instructorEmailSet.isEmpty()) { for (String email : instructorEmailSet) { if (!shouldIncludeTestData && email.endsWith(".tmt")) { continue; } w.write(email + ","); instructorEmailCount++; } } System.out.print("Student email num: " + studentEmailCount + "\n"); System.out.print("Instructor email num: " + instructorEmailCount + "\n"); } } catch (IOException e) { System.err.println("Problem writing to the file statsTest.txt"); } }

Target:
private void writeEmailsIntoTextFile(HashSet<String> studentEmailSet, HashSet<String> instructorEmailSet) { try { File newFile = new File(filePathForSaving + this.getCurrentDateForDisplay() + ".txt"); try (BufferedWriter w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile)))) { int studentEmailCount = 0; for (String email : studentEmailSet) { if (!shouldIncludeTestData && email.endsWith(".tmt")) { continue; } w.write(email + ","); studentEmailCount++; } int instructorEmailCount = 0; for (String email : instructorEmailSet) { if (!shouldIncludeTestData && email.endsWith(".tmt")) { continue; } w.write(email + ","); instructorEmailCount++; } System.out.print("Student email num: " + studentEmailCount + "\n"); System.out.print("Instructor email num: " + instructorEmailCount + "\n"); } } catch (IOException e) { System.err.println("Problem writing to the file statsTest.txt"); } }
Source:
private synchronized void createSupplementaryDirectory() { IFolder supplFolder = getTraceSupplementaryFolder(getResourceName()); if (!supplFolder.exists()) { try { supplFolder.create(true, true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError("Error creating resource supplementary file " + supplFolder, e); } } try { fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocationURI().getPath()); } catch (CoreException e) { Activator.getDefault().logError("Error setting persistant property " + TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, e); } }

Target:
private void createSupplementaryDirectory() { IFolder supplFolder = getTraceSupplementaryFolder(getResourceName()); if (!supplFolder.exists()) { try { supplFolder.create(true, true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError("Error creating resource supplementary file " + supplFolder, e); } } try { fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocationURI().getPath()); } catch (CoreException e) { Activator.getDefault().logError("Error setting persistant property " + TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, e); } }
Source:
protected void executeCommand() { getNetwork().setId(Guid.newGuid()); NetworkUtils.setNetworkVdsmName(getNetwork()); TransactionSupport.executeInNewTransaction(() -> { networkDao.save(getNetwork()); if (getNetwork().isVmNetwork() && getParameters().isVnicProfileRequired()) { vnicProfileDao.save(networkHelper.createVnicProfile(getNetwork())); } networkHelper.addPermissionsOnNetwork(getUserId(), getNetwork().getId()); return null; }); List<NetworkCluster> networkAttachments = getParameters().getNetworkClusterList(); if (networkAttachments != null) { ActionReturnValue attachToClustersResult = attachToClusters(networkAttachments); if (!attachToClustersResult.getSucceeded()) { propagateFailure(attachToClustersResult); return; } } getReturnValue().setActionReturnValue(getNetwork().getId()); setSucceeded(true); }

Target:
protected void executeCommand() { getNetwork().setId(Guid.newGuid()); NetworkUtils.setNetworkVdsmName(getNetwork()); TransactionSupport.executeInNewTransaction(() -> { networkDao.save(getNetwork()); if (getNetwork().isVmNetwork() && getParameters().isVnicProfileRequired()) { vnicProfileDao.save(networkHelper.createVnicProfile(getNetwork())); } networkHelper.addPermissionsOnNetwork(getUserId(), getNetwork().getId()); return null; }); runClusterAttachment(); getReturnValue().setActionReturnValue(getNetwork().getId()); setSucceeded(true); }
Source:
public void process(Exchange exchange) throws Exception { List<Exchange> exchanges = prepareExchangeList(exchange); List<Exchange> processGroup = new ArrayList<>(); String partitionDecorator = ""; String suffix = ""; String tableId = configuration.getTableId() == null ? "" : configuration.getTableId(); int totalProcessed = 0; for (Exchange ex: exchanges) { String tmpPartitionDecorator = ex.getIn().getHeader(GoogleBigQueryConstants.PARTITION_DECORATOR, "", String.class); String tmpSuffix = ex.getIn().getHeader(GoogleBigQueryConstants.TABLE_SUFFIX, "", String.class); String tmpTableId = ex.getIn().getHeader(GoogleBigQueryConstants.TABLE_ID, tableId, String.class); if (tmpTableId.isEmpty()) { throw new IllegalArgumentException("tableId need to be specified in one of endpoint configuration or exchange header"); } if (!tmpPartitionDecorator.equals(partitionDecorator) || !tmpSuffix.equals(suffix) || !tmpTableId.equals(tableId)) { if (!processGroup.isEmpty()) { totalProcessed += process(tableId, partitionDecorator, suffix, processGroup, exchange.getExchangeId()); } processGroup.clear(); partitionDecorator = tmpPartitionDecorator; suffix = tmpSuffix; tableId = tmpTableId; } processGroup.add(ex); } if (!processGroup.isEmpty()) { totalProcessed += process(tableId, partitionDecorator, suffix, processGroup, exchange.getExchangeId()); } if (totalProcessed == 0) { logger.debug("The incoming message is either null or empty for exchange {}", exchange.getExchangeId()); } }

Target:
public void process(Exchange exchange) throws Exception { List<Exchange> exchanges = prepareExchangeList(exchange); List<Exchange> processGroup = new ArrayList<>(); String partitionDecorator = ""; String suffix = ""; String tableId = configuration.getTableId() == null ? "" : configuration.getTableId(); int totalProcessed = 0; for (Exchange ex: exchanges) { String tmpPartitionDecorator = ex.getIn().getHeader(GoogleBigQueryConstants.PARTITION_DECORATOR, "", String.class); String tmpSuffix = ex.getIn().getHeader(GoogleBigQueryConstants.TABLE_SUFFIX, "", String.class); String tmpTableId = ex.getIn().getHeader(GoogleBigQueryConstants.TABLE_ID, tableId, String.class); if (tmpTableId.isEmpty()) { throw new IllegalArgumentException("tableId need to be specified in one of endpoint configuration or exchange header"); } if (!tmpPartitionDecorator.equals(partitionDecorator) || !tmpSuffix.equals(suffix) || !tmpTableId.equals(tableId)) { if (!processGroup.isEmpty()) { totalProcessed += process(tableId, partitionDecorator, suffix, processGroup, exchange.getExchangeId()); } processGroup.clear(); partitionDecorator = tmpPartitionDecorator; suffix = tmpSuffix; tableId = tmpTableId; } processGroup.add(ex); } if (!processGroup.isEmpty()) { totalProcessed += process(tableId, partitionDecorator, suffix, processGroup, exchange.getExchangeId()); } if (totalProcessed == 0) { log.debug("The incoming message is either null or empty for exchange {}", exchange.getExchangeId()); } }
Source:
private static List<Entity> generateLance(String faction, int skill, int quality, List<Integer> unitTypes, String weights, boolean artillery, Campaign campaign) { List<Entity> retval = new ArrayList<>(); for(int i = 0; i < unitTypes.size(); i++) { Entity en = getEntity(faction, skill, quality, unitTypes.get(i), AtBConfiguration.decodeWeightStr(weights, i), artillery, campaign); if(en != null) { retval.add(en); } } return retval; }

Target:
private static List<Entity> generateLance(String faction, int skill, int quality, List<Integer> unitTypes, String weights, boolean artillery, Campaign campaign) { List<Entity> retval = new ArrayList<>(); int unitTypeSize = unitTypes.size(); if(unitTypeSize > weights.length()) { MekHQ.getLogger().error(AtBDynamicScenarioFactory.class, "generateLance", String.format("More unit types (%d) provided than weights (%d). Truncating generated lance.", unitTypes.size(), weights.length())); unitTypeSize = weights.length(); } for(int i = 0; i < unitTypeSize; i++) { Entity en = getEntity(faction, skill, quality, unitTypes.get(i), AtBConfiguration.decodeWeightStr(weights, i), artillery, campaign); if(en != null) { retval.add(en); } } return retval; }
Source:
public SegmentPublishResult perform(Task task, TaskActionToolbox toolbox) throws IOException { for (DataSegment segment : segments) { if (!toolbox.getTaskLockbox().upgrade(task, segment.getInterval()).isOk()) { return SegmentPublishResult.fail(); } } TaskActionPreconditions.checkTaskLocks(task, toolbox.getTaskLockbox(), segments); final SegmentPublishResult retVal = toolbox.getIndexerMetadataStorageCoordinator().announceHistoricalSegments( segments, startMetadata, endMetadata ); for (DataSegment segment : segments) { toolbox.getTaskLockbox().downgrade(task, segment.getInterval()); } final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder() .setDimension(DruidMetrics.DATASOURCE, task.getDataSource()) .setDimension(DruidMetrics.TASK_TYPE, task.getType()); if (retVal.isSuccess()) { toolbox.getEmitter().emit(metricBuilder.build("segment/txn/success", 1)); } else { toolbox.getEmitter().emit(metricBuilder.build("segment/txn/failure", 1)); } for (DataSegment segment : retVal.getSegments()) { metricBuilder.setDimension(DruidMetrics.INTERVAL, segment.getInterval().toString()); toolbox.getEmitter().emit(metricBuilder.build("segment/added/bytes", segment.getSize())); } return retVal; }

Target:
public SegmentPublishResult perform(Task task, TaskActionToolbox toolbox) throws IOException { TaskActionPreconditions.checkLockCoversSegments(task, toolbox.getTaskLockbox(), segments); final SegmentPublishResult retVal; try { retVal = toolbox.getTaskLockbox().doInCriticalSection( task, segments.stream().map(DataSegment::getInterval).collect(Collectors.toList()), CriticalAction.<SegmentPublishResult>builder() .onValidLocks( () -> toolbox.getIndexerMetadataStorageCoordinator().announceHistoricalSegments( segments, startMetadata, endMetadata ) ) .onInvalidLocks(SegmentPublishResult::fail) .build() ); } catch (Exception e) { throw new RuntimeException(e); } if (retVal.isSuccess()) { final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder() .setDimension(DruidMetrics.DATASOURCE, task.getDataSource()) .setDimension(DruidMetrics.TASK_TYPE, task.getType()); if (retVal.isSuccess()) { toolbox.getEmitter().emit(metricBuilder.build("segment/txn/success", 1)); } else { toolbox.getEmitter().emit(metricBuilder.build("segment/txn/failure", 1)); } for (DataSegment segment : retVal.getSegments()) { metricBuilder.setDimension(DruidMetrics.INTERVAL, segment.getInterval().toString()); toolbox.getEmitter().emit(metricBuilder.build("segment/added/bytes", segment.getSize())); } } return retVal; }
Source:
public static void assertBuildContains(List<HudsonModelRun> builds, String name) { String allBuildNames = ""; for (HudsonModelRun build : builds) { String displayName = build.getFullDisplayName().substring(18, 30); allBuildNames += (displayName + ", "); if (displayName.equals(name)) { return; } } Assert.fail("Expected '" + name + "' in {" + allBuildNames + "}"); }

Target:
public static void assertBuildContains(List<HudsonModelRun> builds, String name) { String allBuildNames = ""; for (HudsonModelRun build : builds) { String displayName = build.getFullDisplayName().split(" ")[2]; allBuildNames += (displayName + ", "); if (displayName.contains(name)) { return; } } Assert.fail("Expected '" + name + "' in {" + allBuildNames + "}"); }
Source:
private MarshalledValueByteStream serialize(Object instance) { try { MarshalledValueByteStream baos = new ExpandableMarshalledValueByteStream(this.serialisedSize); ObjectOutput out = marshaller.startObjectOutput(baos, true, this.serialisedSize); try { marshaller.objectToObjectStream(instance, out); } finally { marshaller.finishObjectOutput(out); } return new ImmutableMarshalledValueByteStream(Arrays.copyOfRange(baos.getRaw(), 0, baos.size())); } catch (Exception e) { throw new CacheException("Unable to marshall value " + instance, e); } }

Target:
private MarshalledValueByteStream serialize(Object instance) { try { MarshalledValueByteStream baos = new ExpandableMarshalledValueByteStream(this.serialisedSize); ObjectOutput out = marshaller.startObjectOutput(baos, true, this.serialisedSize); try { marshaller.objectToObjectStream(instance, out); } finally { marshaller.finishObjectOutput(out); } return baos; } catch (Exception e) { throw new CacheException("Unable to marshall value " + instance, e); } }
Source:
public byte[] decrypt(final byte[] inputData) { try { final Cipher cipher = Cipher.getInstance(ALGORITHM, PROVIDER); cipher.init(Cipher.DECRYPT_MODE, this.key, new IvParameterSpec(IVBYTES)); return cipher.doFinal(inputData); } catch (final NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchProviderException | InvalidAlgorithmParameterException ex) { LOGGER.error("Unexpected exception during decryption", ex); throw new EncrypterException("Unexpected exception during decryption!", ex); } }

Target:
public byte[] decrypt(final byte[] inputData) { try { final Cipher cipher = Cipher.getInstance(ALGORITHM, PROVIDER); cipher.init(Cipher.DECRYPT_MODE, this.key, new IvParameterSpec(IVBYTES)); return cipher.doFinal(inputData); } catch (final NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchProviderException | InvalidAlgorithmParameterException ex) { LOGGER.error(UNEXPECTED_EXCEPTION_DURING_DECRYPTION, ex); throw new EncrypterException("Unexpected exception during decryption!", ex); } }
Source:
public GenericWeighting(DataFlagEncoder encoder, PMap hintsMap) { super(encoder); gEncoder = encoder; headingPenalty = hintsMap.getDouble(Routing.HEADING_PENALTY, Routing.DEFAULT_HEADING_PENALTY); headingPenaltyMillis = Math.round(headingPenalty * 1000); result = encoder.createResult(hintsMap); double biggestSpecifiedSpeed = result.getMaxspeed(); if (biggestSpecifiedSpeed > encoder.getMaxPossibleSpeed()) throw new IllegalArgumentException("Some specified speed value bigger than maximum possible speed: " + biggestSpecifiedSpeed + " > " + encoder.getMaxPossibleSpeed()); this.maxSpeed = biggestSpecifiedSpeed / SPEED_CONV; accessType = gEncoder.getAccessType("motor_vehicle"); height = hintsMap.getDouble(HEIGHT_LIMIT, 0d); weight = hintsMap.getDouble(WEIGHT_LIMIT, 0d); width = hintsMap.getDouble(WIDTH_LIMIT, 0d); }

Target:
public GenericWeighting(DataFlagEncoder encoder, PMap hintsMap) { super(encoder); gEncoder = encoder; headingPenalty = hintsMap.getDouble(Routing.HEADING_PENALTY, Routing.DEFAULT_HEADING_PENALTY); headingPenaltyMillis = Math.round(headingPenalty * 1000); weightingConfig = encoder.createWeightingConfig(hintsMap); double maxSpecifiedSpeed = weightingConfig.getMaxSpecifiedSpeed(); if (maxSpecifiedSpeed > encoder.getMaxPossibleSpeed()) throw new IllegalArgumentException("Some specified speed value bigger than maximum possible speed: " + maxSpecifiedSpeed + " > " + encoder.getMaxPossibleSpeed()); this.maxSpeed = maxSpecifiedSpeed / SPEED_CONV; accessType = gEncoder.getAccessType("motor_vehicle"); height = hintsMap.getDouble(HEIGHT_LIMIT, 0d); weight = hintsMap.getDouble(WEIGHT_LIMIT, 0d); width = hintsMap.getDouble(WIDTH_LIMIT, 0d); }
Source:
protected Object transform( Message in, String mimeType, String transformerId, MimeTypeToTransformerMapper mapper) throws MimeTypeParseException, CatalogTransformerException { InputStream message = in.getBody(InputStream.class); if (message == null) { throw new CatalogTransformerException("Message body was null; unable to generate Metacard!"); } MimeType derivedMimeType; if (StringUtils.isEmpty(mimeType)) { derivedMimeType = new MimeType(getMimeTypeFromHeader(in, message)); } else if (StringUtils.isNotBlank(transformerId)) { derivedMimeType = new MimeType(mimeType + ";" + MimeTypeToTransformerMapper.ID_KEY + "=" + transformerId); } else { derivedMimeType = new MimeType(mimeType); } String metacardUpdateID = getHeaderAsStringAndRemove(in, METACARD_ID_HEADER); Metacard metacard; try { metacard = generateMetacard(derivedMimeType, mapper, message, metacardUpdateID); } catch (MetacardCreationException e) { throw new CatalogTransformerException( "Did not find an InputTransformer for MIME Type [" + mimeType + "] and " + MimeTypeToTransformerMapper.ID_KEY + " [" + transformerId + "]", e); } finally { IOUtils.closeQuietly(message); } return metacard; }

Target:
protected Object transform( Message in, String mimeType, String transformerId, MimeTypeToTransformerMapper mapper) throws MimeTypeParseException, CatalogTransformerException { InputStream message = in.getBody(InputStream.class); if (message == null) { throw new CatalogTransformerException("Message body was null; unable to generate Metacard!"); } MimeType derivedMimeType = null; if (StringUtils.isEmpty(mimeType)) { try (TemporaryFileBackedOutputStream fileBackedOutputStream = new TemporaryFileBackedOutputStream()) { try { IOUtils.copy(message, fileBackedOutputStream); derivedMimeType = new MimeType( getMimeTypeFromHeader(in, fileBackedOutputStream.asByteSource().openStream())); } catch (IOException e) { LOGGER.debug("Failed to copy incoming inputStream message", e); } finally { message = fileBackedOutputStream.asByteSource().openStream(); } } catch (IOException e) { LOGGER.debug("Failed to create TemporaryFileBackedOuputStream", e); } } else if (StringUtils.isNotBlank(transformerId)) { derivedMimeType = new MimeType(mimeType + ";" + MimeTypeToTransformerMapper.ID_KEY + "=" + transformerId); } if (derivedMimeType == null) { derivedMimeType = new MimeType(mimeType); } String metacardUpdateID = getHeaderAsStringAndRemove(in, METACARD_ID_HEADER); Metacard metacard; try { metacard = generateMetacard(derivedMimeType, mapper, message, metacardUpdateID); } catch (MetacardCreationException e) { throw new CatalogTransformerException( "Did not find an InputTransformer for MIME Type [" + mimeType + "] and " + MimeTypeToTransformerMapper.ID_KEY + " [" + transformerId + "]", e); } finally { IOUtils.closeQuietly(message); } return metacard; }
Source:
private void processFailureWhenClosed() { this.countDown--; LOGGER.warn("Failure occurred. Decreased countDown value for circuit breaker to {}", this.countDown); if (this.countDown == 0) { this.openCircuit(); } }

Target:
private void processFailureWhenClosed() { this.lock.lock(); try { this.countDown--; LOGGER.warn("Failure occurred. Decreased countDown value for circuit breaker to {}", this.countDown); if (this.countDown == 0) { this.openCircuit(); } } finally { this.lock.unlock(); } }
Source:
public long sizeInBytes() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Reader " + m_cursorId + " has been closed"); } assertions(); long size = 0; for (PBDSegment segment : m_segments.values()) { final boolean wasClosed = segment.isClosed(); if (!segment.isOpenForReading(m_cursorId)) segment.openForRead(m_cursorId); size += segment.uncompressedBytesToRead(m_cursorId); if (wasClosed) { segment.close(); } } return size; } }

Target:
public long sizeInBytes() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Reader " + m_cursorId + " has been closed"); } assertions(); moveToValidSegment(); long size = 0; boolean inclusive = true; if (m_segment.isOpenForReading(m_cursorId)) { size = m_segment.getReader(m_cursorId).uncompressedBytesToRead(); inclusive = false; } for (PBDSegment currSegment : m_segments.tailMap(m_segment.segmentId(), inclusive).values()) { size += currSegment.size(); } return size; } }
Source:
protected <T> void processSetting(EntityViewSetting<T, ?> setting, Object[] values) { for (JpaParameter parameter : parameters.getOptionalParameters()) { String parameterName = parameter.getParameterName(); Object parameterValue = values[parameter.getIndex()]; setting.addOptionalParameter(parameterName, parameterValue); } int entityViewSettingProcessorIndex = parameters.getEntityViewSettingProcessorIndex(); if (entityViewSettingProcessorIndex >= 0) { EntityViewSettingProcessor<T> processor = (EntityViewSettingProcessor<T>) values[entityViewSettingProcessorIndex]; processor.acceptEntityViewSetting(setting); } }

Target:
protected <T> void processSetting(EntityViewSetting<T, ?> setting, Object[] values) { int entityViewSettingProcessorIndex = parameters.getEntityViewSettingProcessorIndex(); if (entityViewSettingProcessorIndex >= 0) { EntityViewSettingProcessor<T> processor = (EntityViewSettingProcessor<T>) values[entityViewSettingProcessorIndex]; if (processor != null) { setting = processor.acceptEntityViewSetting(setting); } } for (JpaParameter parameter : parameters.getOptionalParameters()) { String parameterName = parameter.getParameterName(); Object parameterValue = values[parameter.getIndex()]; setting.addOptionalParameter(parameterName, parameterValue); } }
Source:
public ParseResult parse(String infixTagExpression) { return constructExpressionFrom(tokensDerivedFrom(infixTagExpression)); }

Target:
ParseResult parse(String infixTagExpression) { return constructExpressionFrom(tokensDerivedFrom(infixTagExpression)); }
Source:
public void justWorks() throws Exception { FtRemote.secure(new TkFork(new FkRegex("/", "hello, world!"))).exec( new FtRemote.Script() { @Override public void exec(final URI home) throws IOException { new JdkRequest(home) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody(Matchers.startsWith("hello")); } } ); }

Target:
public void justWorks() throws Exception { FtSecureTest.secure(new TkFixed("hello, world")).exec( new FtRemote.Script() { @Override public void exec(final URI home) throws IOException { new JdkRequest(home) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody(Matchers.startsWith("hello")); } } ); }
Source:
public Set<Class<?>> findAnnotatedClasses(Class annotationClass) throws ClassNotFoundException { Set<Class<?>> annotatedClasses = new HashSet<Class<?>>(); ArrayList<String> dynamicClasses = classNames; for (String dynamicClass : dynamicClasses) { Class<?> classz = getClassLoader().loadClass(dynamicClass); if (classz.getAnnotation(annotationClass) != null) { annotatedClasses.add(classz); } } return annotatedClasses; }

Target:
public Set<Class<?>> findAnnotatedClasses(Class annotationClass) throws ClassNotFoundException { Set<Class<?>> annotatedClasses = new HashSet<Class<?>>(); ArrayList<String> dynamicClasses = classNames; for (String dynamicClass : dynamicClasses) { Class<?> classz = compiledObjects.get(dynamicClass); if (classz.getAnnotation(annotationClass) != null) { annotatedClasses.add(classz); } } return annotatedClasses; }
Source:
public void initForViewByRecipientGiverQuestion(InstructorAttributes instructor, String selectedSection, String showStats, String groupByTeam) { viewType = ViewType.RECIPIENT_GIVER_QUESTION; this.instructor = instructor; this.selectedSection = selectedSection; this.showStats = showStats; this.groupByTeam = groupByTeam; if (!bundle.isComplete) { buildSectionPanelsForForAjaxLoading(sections); return; } if (bundle.responses.isEmpty()) { return; } setShouldCollapsed(bundle.responses.size() > RESPONSE_LIMIT_FOR_COLLAPSING_PANEL); Map<String, Map<String, List<FeedbackResponseAttributes>>> sortedResponses = bundle.getResponsesSortedByRecipient(true); buildSectionPanelsForRecipientGiverQuestion(sortedResponses); }

Target:
public void initForViewByRecipientGiverQuestion(InstructorAttributes instructor, String selectedSection, String showStats, String groupByTeam) { viewType = ViewType.RECIPIENT_GIVER_QUESTION; this.instructor = instructor; this.selectedSection = selectedSection; this.showStats = showStats; this.groupByTeam = groupByTeam; if (!bundle.isComplete) { if (isAllSectionsSelected()) { buildSectionPanelsForForAjaxLoading(sections); } else { buildSectionPanelWithErrorMessage(); } return; } if (bundle.responses.isEmpty()) { return; } setShouldCollapsed(bundle.responses.size() > RESPONSE_LIMIT_FOR_COLLAPSING_PANEL); Map<String, Map<String, List<FeedbackResponseAttributes>>> sortedResponses = bundle.getResponsesSortedByRecipient(true); buildSectionPanelsForRecipientGiverQuestion(sortedResponses); }
Source:
public void setParams(Integer lower, Integer upper) { if (lower != null) { this.lower = lower; this.hasLower = true; } if (upper != null) { this.upper = upper; this.hasUpper = true; } if (this.hasLower && this.hasUpper) { if (this.lower > this.upper) { throw new IllegalArgumentException( "UniformInt distribution requires that lower <= upper"); } } }

Target:
public void setParams(Integer lower, Integer upper) { if (lower != null) { this.lower = lower; this.hasLower = true; } if (upper != null) { this.upper = upper; this.hasUpper = true; } if (this.hasLower && this.hasUpper) { if (this.lower > this.upper) { throw new IllegalArgumentException( "UniformInt distribution requires that lower <= upper"); } this.prob = 1.0 / (this.upper - this.lower + 1); this.logProb = Math.log(this.prob); } }
Source:
private static Map<String, String> parseAttrs(List<String> attributes) throws BadRequestException, ForbiddenException { if (attributes == null) { return new HashMap<>(); } final Map<String, String> res = Maps.newHashMapWithExpectedSize(attributes.size()); for (String attribute : attributes) { final int colonIdx = attribute.indexOf(':'); if (colonIdx == -1) { throw new BadRequestException( "Attribute '" + attribute + "' is not valid, " + "it should contain name and value separated with colon. " + "For example: attributeName:attributeValue"); } String name = attribute.substring(0, colonIdx); String value = attribute.substring(colonIdx + 1); if (name.isEmpty()) throw new BadRequestException( "Attribute '" + attribute + "' is not valid, " + "Empty attribute name is not allowed. "); if (name.startsWith("codenvy")) throw new ForbiddenException( "Attribute '" + attribute + "' is not allowed. 'codenvy' prefix is reserved. "); res.put(name, value); } return res; }

Target:
private static Map<String, String> parseAttrs(List<String> attributes) throws BadRequestException, ForbiddenException { if (attributes == null) { return Maps.newHashMapWithExpectedSize(1); } final Map<String, String> res = Maps.newHashMapWithExpectedSize(attributes.size()); for (String attribute : attributes) { final int colonIdx = attribute.indexOf(':'); if (colonIdx == -1) { throw new BadRequestException( "Attribute '" + attribute + "' is not valid, " + "it should contain name and value separated with colon. " + "For example: attributeName:attributeValue"); } String name = attribute.substring(0, colonIdx); String value = attribute.substring(colonIdx + 1); if (name.isEmpty()) throw new BadRequestException( "Attribute '" + attribute + "' is not valid, " + "Empty attribute name is not allowed. "); if (name.startsWith("codenvy")) throw new ForbiddenException( "Attribute '" + attribute + "' is not allowed. 'codenvy' prefix is reserved. "); res.put(name, value); } return res; }
Source:
SearchIndexAsyncClient(String endpoint, String indexName, SearchServiceVersion apiVersion, HttpPipeline httpPipeline) { SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint); if (StringUtils.isBlank(indexName)) { throw logger.logExceptionAsError(new IllegalArgumentException("Invalid indexName")); } if (apiVersion == null) { throw logger.logExceptionAsError(new IllegalArgumentException("Invalid apiVersion")); } if (httpPipeline == null) { throw logger.logExceptionAsError(new IllegalArgumentException("Invalid httpPipeline")); } this.endpoint = endpoint; this.indexName = indexName; this.apiVersion = apiVersion; this.httpPipeline = httpPipeline; restClient = new SearchIndexRestClientBuilder() .searchServiceName(parts.serviceName) .indexName(indexName) .searchDnsSuffix(parts.dnsSuffix) .apiVersion(apiVersion.getVersion()) .pipeline(httpPipeline) .serializer(SERIALIZER) .build(); }

Target:
SearchIndexAsyncClient(String endpoint, String indexName, SearchServiceVersion apiVersion, HttpPipeline httpPipeline) { SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint); if (CoreUtils.isNullOrEmpty(indexName)) { throw logger.logExceptionAsError(new NullPointerException("Invalid indexName")); } if (apiVersion == null) { throw logger.logExceptionAsError(new NullPointerException("Invalid apiVersion")); } if (httpPipeline == null) { throw logger.logExceptionAsError(new NullPointerException("Invalid httpPipeline")); } this.endpoint = endpoint; this.indexName = indexName; this.apiVersion = apiVersion; this.httpPipeline = httpPipeline; restClient = new SearchIndexRestClientBuilder() .searchServiceName(parts.serviceName) .indexName(indexName) .searchDnsSuffix(parts.dnsSuffix) .apiVersion(apiVersion.getVersion()) .pipeline(httpPipeline) .serializer(SERIALIZER) .build(); }
Source:
public <T> Maybe<Class<T>> tryResolveClass(String bundleUrl, String type) { try { Class<T> clazz = (Class<T>) Osgis.getBundle(framework, bundleUrl).get().loadClass(type); return Maybe.of(clazz); } catch (Exception e) { Exceptions.propagateIfFatal(e); return Maybe.absent(e); } }

Target:
public <T> Maybe<Class<T>> tryResolveClass(String bundleUrl, String type) { try { Maybe<Bundle> bundle = Osgis.getBundle(framework, bundleUrl); if (bundle.isPresent()) { Class<T> clazz = (Class<T>) bundle.get().loadClass(type); return Maybe.of(clazz); } else { return Maybe.absent("No bundle found in " + framework + " at URL: " + bundleUrl); } } catch (ClassNotFoundException e) { return Maybe.absent(e); } }
Source:
public void testWithParameterAuthorizationUrl(String host, String redirectUrl, String opHost, String redirectUrls, String postLogoutRedirectUrl, String logoutUrl, String paramRedirectUrl) throws IOException { ClientInterface client = Tester.newClient(host); final RegisterSiteResponse site = RegisterSiteTest.registerWithMultipleRedirectUrls(client, opHost, redirectUrl, postLogoutRedirectUrl, logoutUrl, redirectUrls); final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams(); commandParams.setOxdId(site.getOxdId()); commandParams.setAuthorizationRedirectUri(paramRedirectUrl); final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(), commandParams); assertNotNull(resp); notEmpty(resp.getAuthorizationUrl()); }

Target:
public void testWithParameterAuthorizationUrl(String host, String redirectUrl, String opHost, String redirectUrls, String postLogoutRedirectUrl, String logoutUrl, String paramRedirectUrl) throws IOException { ClientInterface client = Tester.newClient(host); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl, postLogoutRedirectUrl, logoutUrl, StringUtils.isNotBlank(redirectUrls) ? Lists.newArrayList(redirectUrls.split(" ")) : null); final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams(); commandParams.setOxdId(site.getOxdId()); commandParams.setAuthorizationRedirectUri(paramRedirectUrl); final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(), commandParams); assertNotNull(resp); notEmpty(resp.getAuthorizationUrl()); assertTrue(resp.getAuthorizationUrl().contains(paramRedirectUrl)); }
Source:
private boolean hasAnyRolePermission(final WorkflowAction wa,final Iterable<Role> roles) throws DotDataException{ for(Role role:roles){ if (permissionAPI.doesRoleHavePermission(wa, PermissionAPI.PERMISSION_USE, role)) { return true; } } return false; }

Target:
private boolean hasAnyRolePermission(final WorkflowAction wa,final Iterable<Role> roles) throws DotDataException{ for(final Role role:roles){ if (permissionAPI.doesRoleHavePermission(wa, PermissionAPI.PERMISSION_USE, role)) { return true; } } return false; }
Source:
public void testWebGetCallMeter() { sleep20Millis(); long currMeterNum = dr.getMeter("Web-Get-Call-Meter"); WebMetrics.INSTANCE.markWebGetCall(); sleep20Millis(); Assert.assertEquals(dr.getMeter("Web-Get-Call-Meter"), currMeterNum + 1); WebMetrics.INSTANCE.markWebGetCall(); WebMetrics.INSTANCE.markWebGetCall(); sleep20Millis(); Assert.assertEquals(dr.getMeter("Web-Get-Call-Meter"), currMeterNum + 3); }

Target:
public void testWebGetCallMeter() { MetricsTestUtility.testMeter("Web-Get-Call-Meter", dr, WebMetrics.INSTANCE::markWebGetCall); }
Source:
public String removeEvent(@PathVariable("id") long id, RedirectAttributes redirectAttributes) { Event event = eventRepository.findOne(id); if (event != null) { eventRepository.delete(event); redirectAttributes.addFlashAttribute("message", "Event '" + event.getTitle() + "' deleted!"); } else { redirectAttributes.addFlashAttribute("message", "That event does not exist."); } return "redirect:/events/"; }

Target:
public String removeEvent(@PathVariable("id") long id, RedirectAttributes redirectAttributes) throws EventNotFoundException { Event event = eventRepository.findOne(id); if (event != null) { eventRepository.delete(event); redirectAttributes.addFlashAttribute("message", "Event '" + event.getTitle() + "' deleted!"); return "redirect:/events/"; } else { throw new EventNotFoundException("This event does not exist"); } }
Source:
public static HostInfo buildFromEndpoint(final String endPoint) { final String host = getHost(endPoint); final Integer port = getPort(endPoint); if (host == null || port == null) { throw new ConfigException( String.format("Error parsing host address %s. Expected format host:port.", endPoint) ); } return new HostInfo(host, port); }

Target:
public static HostInfo buildFromEndpoint(final String endPoint) { if (endPoint == null || endPoint.trim().isEmpty()) { return null; } final String host = getHost(endPoint); final Integer port = getPort(endPoint); if (host == null || port == null) { throw new ConfigException( String.format("Error parsing host address %s. Expected format host:port.", endPoint) ); } return new HostInfo(host, port); }
Source:
public Stream<Object> extractAllEntitiesStream(Solution_ solution) { List<Stream<Object>> streamList = new ArrayList<>( entityMemberAccessorMap.size() + entityCollectionMemberAccessorMap.size()); for (MemberAccessor memberAccessor : entityMemberAccessorMap.values()) { Object entity = extractMemberObject(memberAccessor, solution); if (entity != null) { streamList.add(Stream.of(entity)); } } for (MemberAccessor memberAccessor : entityCollectionMemberAccessorMap.values()) { Collection<Object> entityCollection = extractMemberCollectionOrArray(memberAccessor, solution, false); streamList.add(entityCollection.stream()); } return streamList.stream().flatMap(Function.identity()); }

Target:
public Stream<Object> extractAllEntitiesStream(Solution_ solution) { Stream<Object> stream = Stream.empty(); for (MemberAccessor memberAccessor : entityMemberAccessorMap.values()) { Object entity = extractMemberObject(memberAccessor, solution); if (entity != null) { stream = Stream.concat(stream, Stream.of(entity)); } } for (MemberAccessor memberAccessor : entityCollectionMemberAccessorMap.values()) { Collection<Object> entityCollection = extractMemberCollectionOrArray(memberAccessor, solution, false); stream = Stream.concat(stream, entityCollection.stream()); } return stream; }
Source:
public void clear() { authzManager.checkPermission(CachePermission.WRITE); delegate.clear(); }

Target:
public void clear() { authzManager.checkPermission(AuthorizationPermission.BULK_WRITE); delegate.clear(); }
Source:
private boolean originalConstraintMatches(TableScanNode node) { Map<String, SymbolReference> assignments = node.getOutputSymbols().stream() .collect(toMap(Symbol::getName, Symbol::toSymbolReference)); SymbolAliases symbolAliases = SymbolAliases.builder().putAll(assignments).build(); ExpressionVerifier verifier = new ExpressionVerifier(symbolAliases); return expectedOriginalConstraint .map(expected -> verifier.process(node.getOriginalConstraint(), expected)) .orElse(true); }

Target:
private boolean originalConstraintMatches(TableScanNode node) { return expectedOriginalConstraint .map(expected -> { Map<String, SymbolReference> assignments = node.getOutputSymbols().stream() .collect(toMap(Symbol::getName, Symbol::toSymbolReference)); SymbolAliases symbolAliases = SymbolAliases.builder().putAll(assignments).build(); ExpressionVerifier verifier = new ExpressionVerifier(symbolAliases); return verifier.process(node.getOriginalConstraint(), expected); }) .orElse(true); }
Source:
public boolean logoutCurrentUser(String sessionID) throws IOException { if(sessionID == null || sessionID.isEmpty()) throw new IOException("invalid input of session ID"); final String url = URL_AUTH + "/" + URL_LOGOUT; Map<String, String> response = request(url, null, sessionID, HTTP_METHOD_POST); String responseCode = response.get(RESPONSE_CODE); int result = checkResponseCode(response.get(RESPONSE_CODE), "logout"); if(result != 0) throw new IOException("logout with session id failed "); return (result == 0); }

Target:
public boolean logoutCurrentUser(String sessionID) throws IOException, IllegalArgumentException { if(sessionID == null || sessionID.isEmpty()) throw new IllegalArgumentException("invalid input of session ID"); final String url = URL_AUTH + "/" + URL_LOGOUT; Map<String, String> response = request(url, null, sessionID, HTTP_METHOD_POST); String responseCode = response.get(RESPONSE_CODE); int result = checkResponseCode(response.get(RESPONSE_CODE), "logout"); return (result == 0); }
Source:
protected boolean isUserAuthorizedToRunAction() { if (isInternalExecution()) { if (log.isDebugEnabled()) { log.debugFormat("Permission check skipped for internal action {0}.", getActionType()); } return true; } if (!MultiLevelAdministrationHandler.isMultilevelAdministrationOn()) { if (log.isDebugEnabled()) { log.debugFormat("Permission check for action {0} skipped because multilevel administration is disabled.", getActionType()); } return true; } if (getCurrentUser() == null) { addCanDoActionMessage(VdcBllMessages.USER_IS_NOT_LOGGED_IN); return false; } final List<PermissionSubject> permSubjects = getPermissionCheckSubjects(); if (permSubjects == null || permSubjects.isEmpty()) { if (log.isDebugEnabled()) { log.debugFormat("The set of objects to check is null or empty for action {0}.", getActionType()); } addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } if (isQuotaDependant()) { addQuotaPermissionSubject(permSubjects); } if (log.isDebugEnabled()) { StringBuilder builder = getPermissionSubjectsAsStringBuilder(permSubjects); log.debugFormat("Checking whether user {0} has permission on {1}", getCurrentUser().getId(), builder.toString()); } return checkPermissions(permSubjects); }

Target:
protected boolean isUserAuthorizedToRunAction() { if (isInternalExecution()) { if (log.isDebugEnabled()) { log.debugFormat("Permission check skipped for internal action {0}.", getActionType()); } return true; } if (!MultiLevelAdministrationHandler.isMultilevelAdministrationOn()) { if (log.isDebugEnabled()) { log.debugFormat("Permission check for action {0} skipped because multilevel administration is disabled.", getActionType()); } return true; } if (getCurrentUser() == null) { addCanDoActionMessage(VdcBllMessages.USER_IS_NOT_LOGGED_IN); return false; } final List<PermissionSubject> permSubjects = getPermissionCheckSubjects(); if (permSubjects == null || permSubjects.isEmpty()) { if (log.isDebugEnabled()) { log.debugFormat("The set of objects to check is null or empty for action {0}.", getActionType()); } addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); StringBuilder builder = getPermissionSubjectsAsStringBuilder(permSubjects); log.infoFormat("Checking whether user {0} or one of the groups he is member of, have the following permissions: {1}", getCurrentUser().getId(), builder.toString()); return false; } if (isQuotaDependant()) { addQuotaPermissionSubject(permSubjects); } return checkPermissions(permSubjects); }
Source:
private static void fetchExecutorMetrics(long now, MBeanServer mbs, List<Metric> metrics) throws JMException { final ObjectName executorName = new ObjectName("Catalina:type=Executor,*"); final Set<ObjectName> names = mbs.queryNames(executorName, null); if (names == null) { return; } for (ObjectName name : names) { AttributeList list = mbs.getAttributes(name, EXECUTOR_ATTRS); for (Attribute a : list.asList()) { metrics.add(toGauge(now, name, a)); } } }

Target:
private static void fetchExecutorMetrics(long now, MBeanServer mbs, List<Metric> metrics) throws JMException { final ObjectName executorName = new ObjectName("Catalina:type=Executor,*"); final Set<ObjectName> names = mbs.queryNames(executorName, null); if (names == null) { return; } for (ObjectName name : names) { AttributeList list = mbs.getAttributes(name, EXECUTOR_ATTRS); for (Attribute a : list.asList()) { addMetric(metrics, a.getName().equals("completedTaskCount") ? toCounter(now, name, a) : toGauge(now, name, a)); } } }