auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testFew() { final UnweightedDoubleReservoirSample sample = new UnweightedDoubleReservoirSample(200); sample.add(1.0); sample.add(2.0); sample.add(3.0); Set<Double> samples = new HashSet<>(); sample.stream().forEach(o -> samples.add(Double.valueOf(o))); assertEquals(samples.size(), 3); assertTrue(samples.contains(Double.valueOf(1))); assertTrue(samples.contains(Double.valueOf(2))); assertTrue(samples.contains(Double.valueOf(3))); }

Target:
public void testFew() { UnweightedDoubleReservoirSample reservoir = new UnweightedDoubleReservoirSample(200); reservoir.add(1.0); reservoir.add(2.0); reservoir.add(3.0); assertEquals(Arrays.stream(reservoir.getSamples()).sorted().toArray(), new double[] {1.0, 2.0, 3.0}); }
Source:
public <T> T createProxy(Optional<SSLSocketFactory> sslSocketFactory, Set<String> uris, Class<T> type) { FailoverFeignTarget<T> target = new FailoverFeignTarget<>(uris, type, backoffStrategy); Client client = clientSupplier.apply(sslSocketFactory); client = target.wrapClient(client); return Feign.builder() .contract(contract) .encoder(encoder) .decoder(decoder) .errorDecoder(errorDecoder) .client(client) .retryer(target) .options(options) .logger(new Slf4jLogger(FeignClientFactory.class)) .logLevel(Level.BASIC) .target(target); }

Target:
public <T> T createProxy(Optional<SSLSocketFactory> sslSocketFactory, Set<String> uris, Class<T> type) { FailoverFeignTarget<T> target = new FailoverFeignTarget<>(uris, type, backoffStrategy); Client client = clientSupplier.apply(sslSocketFactory); client = target.wrapClient(client); return Feign.builder() .contract(contract) .encoder(encoder) .decoder(decoder) .errorDecoder(errorDecoder) .client(client) .retryer(target) .options(options) .logger(new Slf4jLogger(FeignClients.class)) .logLevel(Level.BASIC) .target(target); }
Source:
public static String mapAsStringWithEncodedValues(Map<String, String> p_map) { if (p_map != null && p_map.size() != 0) { return p_map.entrySet().stream().map(e -> { try { return e.getKey() + "=" + encode(e.getValue()); } catch (UnsupportedEncodingException e1) { throw new RuntimeException(e1); } }).collect(Collectors.joining("&")); } else { return null; } }

Target:
public static String mapAsStringWithEncodedValues(Map<String, String> p_map) { if (p_map != null && p_map.size() != 0) { return p_map.entrySet().stream().map(e -> { try { return e.getKey() + "=" + encode(e.getValue()); } catch (UnsupportedEncodingException e1) { throw new RuntimeException(e1); } }).collect(Collectors.joining("&")); } else { return ""; } }
Source:
public String execute(String container, Blob blob) { String key = blob.getMetadata().getName(); Payload payload = blob.getPayload(); algorithm .calculateChunkSize(checkNotNull( payload.getContentMetadata().getContentLength(), "contentLength required on all uploads to amazon s3; please invoke payload.getContentMetadata().setContentLength(length) first")); int parts = algorithm.getParts(); long chunkSize = algorithm.getChunkSize(); if (parts > 0) { String uploadId = client.initiateMultipartUpload(container, ObjectMetadataBuilder.create().key(key).build()); try { SortedMap<Integer, String> etags = Maps.newTreeMap(); int part; while ((part = algorithm.getNextPart()) <= parts) { prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), chunkSize, etags); } long remaining = algorithm.getRemaining(); if (remaining > 0) { prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), remaining, etags); } return client.completeMultipartUpload(container, key, uploadId, etags); } catch (RuntimeException ex) { client.abortMultipartUpload(container, key, uploadId); throw ex; } } else { return client.putObject(container, blobToObject.apply(blob)); } }

Target:
public String execute(String container, Blob blob) { String key = blob.getMetadata().getName(); Payload payload = blob.getPayload(); Long length = payload.getContentMetadata().getContentLength(); checkNotNull(length, "please invoke payload.getContentMetadata().setContentLength(length) prior to multipart upload"); long chunkSize = algorithm.calculateChunkSize(length); int partCount = algorithm.getParts(); if (partCount > 0) { String uploadId = client.initiateMultipartUpload(container, ObjectMetadataBuilder.create().key(key).build()); try { SortedMap<Integer, String> etags = Maps.newTreeMap(); int part; while ((part = algorithm.getNextPart()) <= partCount) { prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), chunkSize, etags); } long remaining = algorithm.getRemaining(); if (remaining > 0) { prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), remaining, etags); } return client.completeMultipartUpload(container, key, uploadId, etags); } catch (RuntimeException ex) { client.abortMultipartUpload(container, key, uploadId); throw ex; } } else { return client.putObject(container, blobToObject.apply(blob)); } }
Source:
protected void updateKernelCmdlineCheckboxesChangeability() { final CpuVendor cpuVendor = getCurrentCpuVendor(); if (cpuVendor == null) { return; } switch (cpuVendor) { case INTEL: case AMD: case IBMS390: setKernelCmdlineCheckboxesChangeability( isKernelCmdlineParsable(), constants.kernelCmdlineCheckboxesAndDirectCustomizationNotAllowed()); break; case IBM: setKernelCmdlineCheckboxesChangeability( false, constants.kernelCmdlineNotAvailableInClusterWithIbmCpu()); getKernelCmdlineFips().setIsChangeable(true); getKernelCmdlineSmtDisabled().setIsChangeable(true); break; default: throw new RuntimeException("Unknown CpuVendor type: " + cpuVendor); } }

Target:
protected void updateKernelCmdlineCheckboxesChangeability() { final CpuVendor cpuVendor = getCurrentCpuVendor(); if (cpuVendor == null) { return; } switch (cpuVendor) { case INTEL: case AMD: case IBMS390: setKernelCmdlineCheckboxesChangeability( isKernelCmdlineParsable(), constants.kernelCmdlineCheckboxesAndDirectCustomizationNotAllowed()); break; case IBM: setKernelCmdlineCheckboxesChangeability( false, constants.kernelCmdlineNotAvailableInClusterWithIbmCpu()); getKernelCmdlineFips().setIsChangeable(isKernelCmdlineParsable()); getKernelCmdlineSmtDisabled().setIsChangeable(isKernelCmdlineParsable()); break; default: throw new RuntimeException("Unknown CpuVendor type: " + cpuVendor); } }
Source:
public List<Pair<Task, ListenableFuture<TaskStatus>>> restore() { final File restoreFile = getRestoreFile(); final TaskRestoreInfo taskRestoreInfo; if (restoreFile.exists()) { try { taskRestoreInfo = jsonMapper.readValue(restoreFile, TaskRestoreInfo.class); } catch (Exception e) { log.warn(e, "Failed to restore tasks from file[%s]. Skipping restore.", restoreFile); return ImmutableList.of(); } } else { return ImmutableList.of(); } final List<Pair<Task, ListenableFuture<TaskStatus>>> retVal = Lists.newArrayList(); for (final String taskId : taskRestoreInfo.getRunningTasks()) { try { final File taskFile = new File(taskConfig.getTaskDir(taskId), "task.json"); final Task task = jsonMapper.readValue(taskFile, Task.class); if (task.canRestore()) { log.info("Restoring task[%s].", task.getId()); retVal.add(Pair.of(task, run(task))); } } catch (Exception e) { log.warn(e, "Failed to restore task[%s]. Trying to restore other tasks.", taskId); } } log.info("Restored %,d tasks.", retVal.size()); return retVal; }

Target:
public List<Pair<Task, ListenableFuture<TaskStatus>>> restore() { final File restoreFile = getRestoreFile(); final TaskRestoreInfo taskRestoreInfo; if (restoreFile.exists()) { try { taskRestoreInfo = jsonMapper.readValue(restoreFile, TaskRestoreInfo.class); } catch (Exception e) { log.error(e, "Failed to read restorable tasks from file[%s]. Skipping restore.", restoreFile); return ImmutableList.of(); } } else { return ImmutableList.of(); } final List<Pair<Task, ListenableFuture<TaskStatus>>> retVal = Lists.newArrayList(); for (final String taskId : taskRestoreInfo.getRunningTasks()) { try { final File taskFile = new File(taskConfig.getTaskDir(taskId), "task.json"); final Task task = jsonMapper.readValue(taskFile, Task.class); if (!task.getId().equals(taskId)) { throw new ISE("WTF?! Task[%s] restore file had wrong id[%s].", taskId, task.getId()); } if (task.canRestore()) { log.info("Restoring task[%s].", task.getId()); retVal.add(Pair.of(task, run(task))); } } catch (Exception e) { log.warn(e, "Failed to restore task[%s]. Trying to restore other tasks.", taskId); } } log.info("Restored %,d tasks.", retVal.size()); return retVal; }
Source:
public int compareTo(Object o) { if(Objects.equals(key, ((CacheKey<?>)o).key)) { return 0; } else { if (key instanceof String) { return ((String) key).compareTo((String) ((CacheKey<?>)o).key); } else { return key.toString().compareTo((((CacheKey<?>) o).key).toString()); } } }

Target:
public int compareTo(Object o) { if(Objects.equals(key, ((CacheKey<?>)o).key)) { return 0; } else { return key.toString().compareTo((((CacheKey<?>) o).key).toString()); } }
Source:
private MethodInvocationGateway doCreateMethodInvocationGateway(Method method, @Nullable Expression payloadExpression, Map<String, Expression> headerExpressions, @Nullable String requestChannelName, @Nullable String replyChannelName, @Nullable Expression requestTimeout, @Nullable Expression replyTimeout) { GatewayMethodInboundMessageMapper messageMapper = createGatewayMessageMapper(method, headerExpressions); MethodInvocationGateway gateway = new MethodInvocationGateway(messageMapper); gateway.setupReturnType(this.serviceInterface, method); if (method.getParameterTypes().length == 0 && !findPayloadExpression(method)) { gateway.setPollable(); } JavaUtils.INSTANCE .acceptIfNotNull(payloadExpression, messageMapper::setPayloadExpression) .acceptIfNotNull(getTaskScheduler(), gateway::setTaskScheduler); channels(requestChannelName, replyChannelName, gateway); timeouts(requestTimeout, replyTimeout, messageMapper, gateway); String gatewayMethodBeanName = getComponentName() + '#' + method.getName() + '(' + Arrays.stream(method.getParameterTypes()) .map(Class::getName) .collect(Collectors.joining(", ")) + ')'; gateway.setBeanName(gatewayMethodBeanName); gateway.setBeanFactory(getBeanFactory()); gateway.setShouldTrack(this.shouldTrack); gateway.registerMetricsCaptor(this.metricsCaptor); gateway.afterPropertiesSet(); return gateway; }

Target:
private MethodInvocationGateway doCreateMethodInvocationGateway(Method method, @Nullable Expression payloadExpression, Map<String, Expression> headerExpressions, @Nullable String requestChannelName, @Nullable String replyChannelName, @Nullable Expression requestTimeout, @Nullable Expression replyTimeout) { GatewayMethodInboundMessageMapper messageMapper = createGatewayMessageMapper(method, headerExpressions); MethodInvocationGateway gateway = new MethodInvocationGateway(messageMapper); gateway.setupReturnType(this.serviceInterface, method); if (method.getParameterTypes().length == 0 && !findPayloadExpression(method)) { gateway.setPollable(); } JavaUtils.INSTANCE .acceptIfNotNull(payloadExpression, messageMapper::setPayloadExpression) .acceptIfNotNull(getTaskScheduler(), gateway::setTaskScheduler); channels(requestChannelName, replyChannelName, gateway); timeouts(requestTimeout, replyTimeout, messageMapper, gateway); String gatewayMethodBeanName = getComponentName() + '#' + method.getName() + '(' + Arrays.stream(method.getParameterTypes()) .map(Class::getSimpleName) .collect(Collectors.joining(", ")) + ')'; gateway.setBeanName(gatewayMethodBeanName); gateway.setBeanFactory(getBeanFactory()); gateway.setShouldTrack(this.shouldTrack); gateway.registerMetricsCaptor(this.metricsCaptor); gateway.afterPropertiesSet(); return gateway; }
Source:
public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException { CallContext ctx = CallContext.current(); long vmId = cmd.getId(); boolean expunge = cmd.getExpunge(); UserVmVO vm = _vmDao.findById(vmId); List<VolumeVO> listVolumes = _volsDao.findRootVolumeByInstance(vmId); for (VolumeVO volume : listVolumes) { List<SnapshotVO> activeSnapshots = _snapshotDao.listByStatus(volume.getInstanceId(), Snapshot.State.Creating, Snapshot.State.CreatedOnPrimary, Snapshot.State.BackingUp); if (activeSnapshots.size() > 0) { throw new CloudRuntimeException("There is active snapshot on ROOT volume, vm destroy is not permitted, please try again later."); } if (vm.getHypervisorType() == HypervisorType.KVM && volume.getFormat() != ImageFormat.QCOW2) { throw new CloudRuntimeException("We only support create vm snapshots from vm with QCOW2 image"); } } if (expunge && !_accountMgr.isAdmin(ctx.getCallingAccount().getId()) && !AllowUserExpungeRecoverVm.valueIn(cmd.getEntityOwnerId())) { throw new PermissionDeniedException("Parameter " + ApiConstants.EXPUNGE + " can be passed by Admin only. Or when the allow.user.expunge.recover.vm key is set."); } UserVm destroyedVm = destroyVm(vmId, expunge); if (expunge) { if (!expunge(vm, ctx.getCallingUserId(), ctx.getCallingAccount())) { throw new CloudRuntimeException("Failed to expunge vm " + destroyedVm); } } return destroyedVm; }

Target:
public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException { CallContext ctx = CallContext.current(); long vmId = cmd.getId(); boolean expunge = cmd.getExpunge(); if (expunge && !_accountMgr.isAdmin(ctx.getCallingAccount().getId()) && !AllowUserExpungeRecoverVm.valueIn(cmd.getEntityOwnerId())) { throw new PermissionDeniedException("Parameter " + ApiConstants.EXPUNGE + " can be passed by Admin only. Or when the allow.user.expunge.recover.vm key is set."); } UserVmVO vm = _vmDao.findById(vmId); if (vm == null) { throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); } s_logger.debug("Checking if there are any ongoing snapshots on the ROOT volumes associated with VM with ID " + vmId); if (checkStatusOfVolumeSnapshots(vmId, Volume.Type.ROOT)) { throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on ROOT volume, vm destroy is not permitted, please try again later."); } s_logger.debug("Found no ongoing snapshots on volume of type ROOT, for the vm with id " + vmId); UserVm destroyedVm = destroyVm(vmId, expunge); if (expunge) { if (!expunge(vm, ctx.getCallingUserId(), ctx.getCallingAccount())) { throw new CloudRuntimeException("Failed to expunge vm " + destroyedVm); } } return destroyedVm; }
Source:
public void validate(List<AccountTag> accountTags) { for (AccountTagResponse defaultTag : getDefaults().getResponses()) { Optional<AccountTag> requestContainsUnmodifiableTag = accountTags .stream() .filter(e -> e.getTagKey().equals(defaultTag.getKey())) .findFirst(); if (requestContainsUnmodifiableTag.isPresent()) { throw new BadRequestException(String.format("Tag with %s key exist as an unmodifiable tag.", defaultTag.getKey())); } } for (AccountTag accountTag : accountTags) { Pattern pattern = Pattern.compile(ACCOUNT_TAG_PATTERN); Matcher keyMatcher = pattern.matcher(accountTag.getTagKey()); Matcher valueMatcher = pattern.matcher(accountTag.getTagValue()); if (!keyMatcher.matches()) { throw new BadRequestException( String.format("The key '%s' can only can not start with microsoft or azure or aws or windows or space", accountTag.getTagKey())); } if (!valueMatcher.matches()) { throw new BadRequestException( String.format("The value '%s' can only can not start with microsoft or azure or aws or windows or space", accountTag.getTagValue())); } if (isAccountTagContainsTemplate(accountTag.getTagKey())) { if (isAccountTagInvalid(accountTag.getTagKey())) { throw new BadRequestException( String.format("The key '%s' of the tag contains invalid templates", accountTag.getTagKey())); } } if (isAccountTagContainsTemplate(accountTag.getTagValue())) { if (isAccountTagInvalid(accountTag.getTagValue())) { throw new BadRequestException( String.format("The value '%s' of the tag contains invalid templates", accountTag.getTagValue())); } } } }

Target:
public void validate(List<AccountTag> accountTags) { for (AccountTagResponse defaultTag : getDefaults().getResponses()) { Optional<AccountTag> requestContainsUnmodifiableTag = accountTags .stream() .filter(e -> e.getTagKey().equals(defaultTag.getKey())) .findFirst(); if (requestContainsUnmodifiableTag.isPresent()) { throw new BadRequestException(String.format("Tag with %s key exist as an unmodifiable tag.", defaultTag.getKey())); } } for (AccountTag accountTag : accountTags) { Pattern pattern = Pattern.compile(ACCOUNT_TAG_PATTERN); Matcher keyMatcher = pattern.matcher(accountTag.getTagKey()); Matcher valueMatcher = pattern.matcher(accountTag.getTagValue()); if (!keyMatcher.matches()) { throw new BadRequestException( String.format("The key '%s' can only can not start with microsoft or azure or aws or windows or space", accountTag.getTagKey())); } if (!valueMatcher.matches()) { throw new BadRequestException( String.format("The value '%s' can only can not start with microsoft or azure or aws or windows or space", accountTag.getTagValue())); } if (isAccountTagContainsTemplate(accountTag.getTagKey()) && isAccountTagInvalid(accountTag.getTagKey())) { throw new BadRequestException( String.format("The key '%s' of the tag contains invalid templates", accountTag.getTagKey())); } if (isAccountTagContainsTemplate(accountTag.getTagValue()) && isAccountTagInvalid(accountTag.getTagValue())) { throw new BadRequestException( String.format("The value '%s' of the tag contains invalid templates", accountTag.getTagValue())); } } }
Source:
private DataGenerator<String> getNettyTextDataGenerator(final Map<CharSequence, Object> sourceConf) throws IllegalArgumentException { final Map<String, Object> sourceConfString = new HashMap<>(); for (final Map.Entry<CharSequence, Object> entry : sourceConf.entrySet()) { sourceConfString.put(entry.getKey().toString(), entry.getValue()); } final String socketHostAddress = sourceConfString.get(TextSocketSourceParameters.SOCKET_HOST_ADDRESS).toString(); final String socketHostPort = sourceConfString.get(TextSocketSourceParameters.SOCKET_HOST_PORT).toString(); try { return sourceFactory.newDataGenerator(socketHostAddress, Integer.valueOf(socketHostPort)); } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }

Target:
private DataGenerator<String> getNettyTextDataGenerator(final Map<CharSequence, Object> sourceConf) throws IllegalArgumentException { final Map<String, Object> sourceConfString = new HashMap<>(); for (final Map.Entry<CharSequence, Object> entry : sourceConf.entrySet()) { sourceConfString.put(entry.getKey().toString(), entry.getValue()); } final String socketHostAddress = sourceConfString.get(TextSocketSourceParameters.SOCKET_HOST_ADDRESS).toString(); final String socketHostPort = sourceConfString.get(TextSocketSourceParameters.SOCKET_HOST_PORT).toString(); try { return dataGeneratorFactory.newDataGenerator(socketHostAddress, Integer.valueOf(socketHostPort)); } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }
Source:
public CleanCommand clean_() { return new CleanCommand() { private List<String> excludePatterns = Collections.emptyList(); private Integer timeout = TIMEOUT; public CleanCommand excludePatterns(List<String> excludePatterns) { this.excludePatterns = excludePatterns; return this; } public CleanCommand timeout(Integer timeout) { this.timeout = timeout; return this; } public void execute() throws GitException, InterruptedException { reset(true); ArgumentListBuilder args = new ArgumentListBuilder(); args.add("clean"); args.add("-fdx"); if (excludePatterns != null) { for (String pattern : excludePatterns) { if ( !Strings.isNullOrEmpty(pattern) ) { args.add("-e"); args.add(pattern); } } } String result = launchCommandIn(args, workspace, environment, timeout); listener.getLogger().println(result); } }; }

Target:
public CleanCommand clean_() { return new CleanCommand() { private List<String> excludePatterns = Collections.emptyList(); private boolean removeSubmodules = false; private Integer timeout = TIMEOUT; public CleanCommand excludePatterns(List<String> excludePatterns) { this.excludePatterns = excludePatterns; return this; } @Override public CleanCommand submodules(boolean removeSubmodules) { this.removeSubmodules = false; return this; } public CleanCommand timeout(Integer timeout) { this.timeout = timeout; return this; } public void execute() throws GitException, InterruptedException { reset(true); ArgumentListBuilder args = new ArgumentListBuilder(); args.add("clean"); if (removeSubmodules) { args.add("-ffdx"); } else { args.add("-fdx"); } if (excludePatterns != null) { for (String pattern : excludePatterns) { if ( !Strings.isNullOrEmpty(pattern) ) { args.add("-e"); args.add(pattern); } } } String result = launchCommandIn(args, workspace, environment, timeout); listener.getLogger().println(result); } }; }
Source:
public final String getDefaultMetaVariable() { return "PATCH-SET-ID"; }

Target:
public final String getDefaultMetaVariable() { return "CHANGE,PATCHSET"; }
Source:
public BlockAndTypeBuilder(List<PinotColumnHandle> columnHandles, GeneratedPql brokerPql, List<PinotColumnHandle> expectedColumnHandles) { List<Type> expectedTypes = columnHandles.stream() .map(PinotColumnHandle::getDataType) .collect(Collectors.toList()); pageBuilder = new PageBuilder(expectedTypes); Preconditions.checkState(brokerPql.getExpectedColumnIndices().size() == expectedColumnHandles.size()); Preconditions.checkState(expectedColumnHandles.size() >= columnHandles.size()); int[] expectedToActual = new int[expectedColumnHandles.size()]; for (int i = 0; i < expectedToActual.length; ++i) { expectedToActual[i] = columnHandles.indexOf(expectedColumnHandles.get(i)); } columnBlockBuilders = new ArrayList<>(); columnTypes = new ArrayList<>(); for (int expectedColIdx : brokerPql.getExpectedColumnIndices()) { int actualColIdx = -1; if (expectedColIdx >= 0) { actualColIdx = expectedToActual[expectedColIdx]; } columnBlockBuilders.add(actualColIdx >= 0 ? pageBuilder.getBlockBuilder(actualColIdx) : null); columnTypes.add(actualColIdx >= 0 ? expectedTypes.get(actualColIdx) : null); } }

Target:
public BlockAndTypeBuilder(List<PinotColumnHandle> columnHandles, GeneratedPql brokerPql, List<PinotColumnHandle> expectedColumnHandles) { List<Type> expectedTypes = columnHandles.stream() .map(PinotColumnHandle::getDataType) .collect(Collectors.toList()); this.pageBuilder = new PageBuilder(expectedTypes); checkState(brokerPql.getExpectedColumnIndices().size() == expectedColumnHandles.size()); checkState(expectedColumnHandles.size() >= columnHandles.size()); int[] handleMapping = new int[expectedColumnHandles.size()]; for (int i = 0; i < handleMapping.length; ++i) { handleMapping[i] = columnHandles.indexOf(expectedColumnHandles.get(i)); } this.columnBlockBuilders = new ArrayList<>(); this.columnTypes = new ArrayList<>(); for (int expectedColumnIndex : brokerPql.getExpectedColumnIndices()) { int columnIndex = -1; if (expectedColumnIndex >= 0) { columnIndex = handleMapping[expectedColumnIndex]; } this.columnBlockBuilders.add(columnIndex >= 0 ? pageBuilder.getBlockBuilder(columnIndex) : null); this.columnTypes.add(columnIndex >= 0 ? expectedTypes.get(columnIndex) : null); } }
Source:
public Builder(String rootServerURL) { pushConfiguration = new PushConfiguration(); if (isEmpty(rootServerURL)) { throw new IllegalStateException("server can not be null"); } pushConfiguration.setServerUrl(!rootServerURL.endsWith("/") ? rootServerURL + '/' : rootServerURL); }

Target:
private Builder(String rootServerURL) { pushConfiguration = new PushConfiguration(); if (isEmpty(rootServerURL)) { throw new IllegalStateException("server can not be null"); } pushConfiguration.setServerUrl(!rootServerURL.endsWith("/") ? rootServerURL + '/' : rootServerURL); }
Source:
public void testForNodeIds() { UUID node0Id = nodeId(0); UUID node1Id = nodeId(1); assertNodes(client.cluster().forNodeId(node0Id, node1Id), 0, 1); assertNodes(client.cluster().forNodeId(node0Id), 0); assertNodes(client.cluster().forNodeId(node1Id), 1); assertNodes(client.cluster().forNodeIds(F.asList(node0Id, node1Id)), 0, 1); assertNodes(client.cluster().forNodeIds(F.asList(node0Id)), 0); assertNodes(client.cluster().forNodeIds(F.asList(node0Id, node1Id)).forNodeId(node0Id), 0); assertNodes(client.cluster().forNodeId(node0Id, node1Id).forNodeIds(F.asList(node0Id, node1Id)), 0, 1); assertNodes(client.cluster().forNodeId(node0Id).forNodeIds(F.asList(node0Id, node1Id)), 0); assertNodes(client.cluster().forNodeId(node0Id).forNodeIds(F.asList(node1Id))); assertNodes(client.cluster().forNodeId(UUID.randomUUID())); assertNodes(client.cluster().forNodeIds(F.asList(UUID.randomUUID()))); }

Target:
public void testForNodeIds() { UUID id0 = nodeId(0); UUID id1 = nodeId(1); assertNodes(client.cluster().forNodeId(id0, id1), 0, 1); assertNodes(client.cluster().forNodeId(id0), 0); assertNodes(client.cluster().forNodeId(id1), 1); assertNodes(client.cluster().forNodeIds(F.asList(id0, id1)), 0, 1); assertNodes(client.cluster().forNodeIds(F.asList(id0)), 0); assertNodes(client.cluster().forNodeIds(F.asList(id0, id1)).forNodeId(id0), 0); assertNodes(client.cluster().forNodeId(id0, id1).forNodeIds(F.asList(id0, id1)), 0, 1); assertNodes(client.cluster().forNodeId(id0).forNodeIds(F.asList(id0, id1)), 0); assertNodes(client.cluster().forNodeId(id0).forNodeIds(F.asList(id1))); assertNodes(client.cluster().forNodeId(UUID.randomUUID())); assertNodes(client.cluster().forNodeIds(F.asList(UUID.randomUUID()))); }
Source:
public void createForwardingRule(String forwardingRuleName, String targetPoolName, String protocol, String portRange) { log.info("Creating a forwarding rule: " + forwardingRuleName); TargetPool targetPool = getTargetPool(targetPoolName); String targetPoolURL = targetPool.getSelfLink(); ForwardingRule forwardingRule = new ForwardingRule(); forwardingRule.setName(forwardingRuleName); forwardingRule.setTarget(targetPoolURL); forwardingRule.setIPProtocol(protocol); forwardingRule.setPortRange(portRange); try { Operation operation = compute.forwardingRules().insert(PROJECT_ID, REGION_NAME, forwardingRule).execute(); waitForRegionOperationCompletion(operation.getName()); } catch (Exception e) { log.warn("Could not create a forwarding rule " + forwardingRuleName + " " + e); } log.info("Forwarding rule: " + forwardingRuleName + " was created"); }

Target:
public void createForwardingRule(String forwardingRuleName, String targetPoolName, String protocol, String portRange) { log.info("Creating a forwarding rule: " + forwardingRuleName); TargetPool targetPool = getTargetPool(targetPoolName); String targetPoolURL = targetPool.getSelfLink(); ForwardingRule forwardingRule = new ForwardingRule(); forwardingRule.setName(forwardingRuleName); forwardingRule.setTarget(targetPoolURL); forwardingRule.setIPProtocol(protocol); forwardingRule.setPortRange(portRange); try { Operation operation = compute.forwardingRules().insert(PROJECT_ID, REGION_NAME, forwardingRule).execute(); waitForRegionOperationCompletion(operation.getName()); log.info("Forwarding rule: " + forwardingRuleName + " was created"); } catch (Exception e) { log.error("Could not create a forwarding rule " + forwardingRuleName, e); } }
Source:
public Date getNextRunTime(LastExecution lastExecution, Date date) { Date nextExecutionDate = generator.next(new Date()); return nextExecutionDate; }

Target:
public Date getNextRunTime(LastExecution lastExecution, Date date) { return timer.getNextTimeout(); }
Source:
public EnumerableRepeatUnionRule() { super( LogicalRepeatUnion.class, Convention.NONE, EnumerableConvention.INSTANCE, "EnumerableRepeatUnionRule"); }

Target:
EnumerableRepeatUnionRule() { super( LogicalRepeatUnion.class, Convention.NONE, EnumerableConvention.INSTANCE, "EnumerableRepeatUnionRule"); }
Source:
public void testGetParent() throws Exception { final String xpath = " final List<Item> nodes = getXpathItems(xpath, rootNode); assertEquals("Invalid number of nodes", 1, nodes.size()); final AbstractNode parent = (AbstractNode) ((NodeInfo) nodes.get(0)).getParent(); assertEquals("Invalid number of nodes", TokenTypes.CLASS_DEF, parent.getTokenType()); }

Target:
public void testGetParent() throws Exception { final String xpath = " final List<Item> nodes = getXpathItems(xpath, rootNode); assertEquals("Invalid number of nodes", 1, nodes.size()); final AbstractNode parent = (AbstractNode) ((NodeInfo) nodes.get(0)).getParent(); assertEquals("Invalid token type", TokenTypes.CLASS_DEF, parent.getTokenType()); }
Source:
public void testShowStatsWithHavingFails() { assertQueryFails("SHOW STATS FOR (SELECT categoryid FROM orders GROUP BY categoryid HAVING categoryid < 5)", ".*HAVING is not supported in SHOW STATS SELECT clause"); }

Target:
public void testShowStatsWithHavingFails() { assertQueryFails("SHOW STATS FOR (SELECT count(nationkey) FROM nation_partitioned GROUP BY regionkey HAVING regionkey > 0)", ".*HAVING is not supported in SHOW STATS SELECT clause"); }
Source:
public static String getAutoGenDDLFromJar(InMemoryJarfile jarfile) throws IOException { byte[] ddlBytes = jarfile.get(VoltCompiler.AUTOGEN_DDL_FILE_NAME); if (ddlBytes == null) { throw new IOException("Auto generated schema DDL not found - please make sure the database is initialized with valid schema."); } String ddl = new String(ddlBytes, Constants.UTF8ENCODING); return ddl.trim(); }

Target:
public static String getAutoGenDDLFromJar(InMemoryJarfile jarfile) throws IOException { byte[] ddlBytes = jarfile.get(VoltCompiler.AUTOGEN_DDL_FILE_NAME); if (ddlBytes == null) { throw new IOException("Auto generated schema DDL not found - please make sure the database is initialized with valid schema."); } String ddl = new String(ddlBytes, StandardCharsets.UTF_8); return ddl.trim(); }
Source:
private void createIec61850Device(final Map<String, String> settings) { final Iec61850Device iec61850Device = new Iec61850Device( getString(settings, PlatformMicrogridsKeys.KEY_DEVICE_IDENTIFICATION, PlatformMicrogridsDefaults.DEFAULT_DEVICE_IDENTIFICATION)); iec61850Device.setIcdFilename(getString(settings, PlatformMicrogridsKeys.KEY_IEC61850_ICD_FILENAME)); iec61850Device.setPort(getInteger(settings, PlatformMicrogridsKeys.KEY_IEC61850_PORT)); iec61850Device.setServerName(getString(settings, PlatformMicrogridsKeys.KEY_IEC61850_SERVERNAME)); iec61850Device.setEnableAllReportsOnConnect(Helpers.getBoolean(settings, PlatformMicrogridsKeys.ENABLE_ALL_REPORTS, PlatformMicrogridsDefaults.ENABLE_ALL_REPORTS)); this.iec61850DeviceRespository.save(iec61850Device); }

Target:
private void createIec61850Device(final Map<String, String> settings) { final Iec61850Device iec61850Device = new Iec61850Device( getString(settings, PlatformMicrogridsKeys.KEY_DEVICE_IDENTIFICATION, PlatformMicrogridsDefaults.DEFAULT_DEVICE_IDENTIFICATION)); iec61850Device.setIcdFilename(getString(settings, PlatformMicrogridsKeys.KEY_IEC61850_ICD_FILENAME)); iec61850Device.setPort(getInteger(settings, PlatformMicrogridsKeys.KEY_IEC61850_PORT)); iec61850Device.setServerName(getString(settings, PlatformMicrogridsKeys.KEY_IEC61850_SERVERNAME)); iec61850Device.setEnableAllReportsOnConnect(getBoolean(settings, PlatformMicrogridsKeys.ENABLE_ALL_REPORTS, PlatformMicrogridsDefaults.ENABLE_ALL_REPORTS)); this.iec61850DeviceRespository.save(iec61850Device); }
Source:
public LeashData copy() { checkState(getValue() != null); return new SpongeLeashData(getValue()); }

Target:
public LeashData copy() { return new SpongeLeashData(getValue()); }
Source:
public void fromXML( String XML, SchemaMeta localSchemaMeta ) throws PentahoMetadataException { if ( XML == null ) { throw new PentahoMetadataException( Messages.getErrorString( "MQLQuery.ERROR_0017_XML_NULL" ) ); } Document doc; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse( new InputSource( new java.io.StringReader( XML ) ) ); } catch ( ParserConfigurationException pcx ) { throw new PentahoMetadataException( pcx ); } catch ( SAXException sex ) { throw new PentahoMetadataException( sex ); } catch ( IOException iex ) { throw new PentahoMetadataException( iex ); } fromXML( doc, localSchemaMeta ); }

Target:
public void fromXML( String XML, SchemaMeta localSchemaMeta ) throws PentahoMetadataException { if ( XML == null ) { throw new PentahoMetadataException( Messages.getErrorString( "MQLQuery.ERROR_0017_XML_NULL" ) ); } Document doc; try { DocumentBuilderFactory dbf = XmiParser.createSecureDocBuilderFactory(); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse( new InputSource( new java.io.StringReader( XML ) ) ); } catch ( ParserConfigurationException pcx ) { throw new PentahoMetadataException( pcx ); } catch ( SAXException sex ) { throw new PentahoMetadataException( sex ); } catch ( IOException iex ) { throw new PentahoMetadataException( iex ); } fromXML( doc, localSchemaMeta ); }
Source:
public File getContextDir() { return contextDir != null ? new File(contextDir) : (getDockerFile().getParentFile() != null ? getDockerFile().getParentFile() : new File(Paths.get("").toAbsolutePath().toString())); }

Target:
public File getContextDir() { if (!isDockerFileMode()) { return null; } if (contextDir != null) { return new File(contextDir); } if (getDockerFile().getParentFile() == null) { return new File(""); } return getDockerFile().getParentFile(); }
Source:
public boolean handleRedirect(int statusCode, HttpHeaders responseHeaders) { String redirectLocation = responseHeaders.getLocation(); if (getFollowRedirects() && HttpStatusCodes.isRedirect(statusCode) && redirectLocation != null) { setUrl(new GenericUrl(url.toURL(redirectLocation), true)); if (statusCode == HttpStatusCodes.STATUS_CODE_SEE_OTHER) { setRequestMethod(HttpMethods.GET); setContent(null); } headers.setAuthorization((String) null); headers.setIfMatch((String) null); headers.setIfNoneMatch((String) null); headers.setIfModifiedSince((String) null); headers.setIfUnmodifiedSince((String) null); headers.setIfRange((String) null); return true; } return false; }

Target:
public boolean handleRedirect(int statusCode, HttpHeaders responseHeaders) { String redirectLocation = responseHeaders.getLocation(); if (getFollowRedirects() && HttpStatusCodes.isRedirect(statusCode) && redirectLocation != null) { setUrl(new GenericUrl(url.toURL(redirectLocation), useRawRedirectUrls)); if (statusCode == HttpStatusCodes.STATUS_CODE_SEE_OTHER) { setRequestMethod(HttpMethods.GET); setContent(null); } headers.setAuthorization((String) null); headers.setIfMatch((String) null); headers.setIfNoneMatch((String) null); headers.setIfModifiedSince((String) null); headers.setIfUnmodifiedSince((String) null); headers.setIfRange((String) null); return true; } return false; }
Source:
public String configureExternalAlert() { generateApiToken(); String httpString = "window.open('" + toolHandler.getToolUrlWithQueryParams()+ "','_blank'" +")"; RequestContext.getCurrentInstance().execute(httpString); JH.addMessage(FacesMessage.SEVERITY_WARN, tool.getDisplayName(), BundleUtil.getStringFromBundle("file.configure.launchMessage.details") + " " + tool.getDisplayName() + "."); return ""; }

Target:
public String configureExternalAlert() { generateApiToken(); PrimeFaces.current().executeScript("location.reload(true)"); String httpString = "window.open('" + toolHandler.getToolUrlWithQueryParams()+ "','_blank'" +")"; PrimeFaces.current().executeScript(httpString); return ""; }
Source:
public int hashCode() { int result = bitmapSerdeFactory != null ? bitmapSerdeFactory.hashCode() : 0; result = 31 * result + (dimensionCompression != null ? dimensionCompression.hashCode() : 0); result = 31 * result + (metricCompression != null ? metricCompression.hashCode() : 0); result = 31 * result + (spatialDimensionDelimiter != null ? spatialDimensionDelimiter.hashCode() : 0); return result; }

Target:
public int hashCode() { int result = bitmapSerdeFactory.hashCode(); result = 31 * result + dimensionCompression.hashCode(); result = 31 * result + metricCompression.hashCode(); result = 31 * result + longEncoding.hashCode(); result = 31 * result + spatialDimensionDelimiter.hashCode(); return result; }
Source:
public void run(@Nonnull JSession session) throws JackUserException, LibraryIOException { OutputJackLibrary outputJackLibrary = Jack.getSession().getJackOutputLibrary(); boolean generatingLibrary = !ThreadConfig.getConfig().get(Options.GENERATE_DEX_FILE).booleanValue(); List<JDefinedClassOrInterface> types = new ArrayList<JDefinedClassOrInterface>(); for(JType type : session.getTypesToEmit()) { if(type instanceof JDefinedClassOrInterface) { JDefinedClassOrInterface node = (JDefinedClassOrInterface) type; if(node.getLocation() instanceof TypeInInputLibraryLocation) { TypeInInputLibraryLocation location = (TypeInInputLibraryLocation) node.getLocation(); if(generatingLibrary || location.getInputLibraryLocation().equals(outputJackLibrary.getLocation())) { types.add(node); } } else if(node.getLocation() instanceof FileLocation) { types.add(node); } } } try { OutputVFile vFile = outputJackLibrary.createFile(FileType.IDX, new VPath("index", '/')); OutputStream out = new BufferedOutputStream(vFile.openWrite()); JayceInternalWriter writer = JayceWriterFactory.get(outputJackLibrary, out); try { for(JDefinedClassOrInterface node : types) { writer.writeType(node); } } finally { out.close(); } } catch (IOException e) { throw new LibraryIOException(outputJackLibrary.getLocation(), e); } }

Target:
public void run(@Nonnull JSession session) throws JackUserException { OutputJackLibrary outputJackLibrary = Jack.getSession().getJackOutputLibrary(); boolean generatingLibrary = !ThreadConfig.getConfig().get(Options.GENERATE_DEX_FILE).booleanValue(); List<JDefinedClassOrInterface> types = new ArrayList<JDefinedClassOrInterface>(); for (JType type : session.getTypesToEmit()) { if (type instanceof JDefinedClassOrInterface) { JDefinedClassOrInterface node = (JDefinedClassOrInterface) type; if (generatingLibrary) { types.add(node); } else { if (node.getLocation() instanceof TypeInInputLibraryLocation) { TypeInInputLibraryLocation location = (TypeInInputLibraryLocation) node.getLocation(); if (location.getInputLibraryLocation().equals(outputJackLibrary.getLocation())) { types.add(node); } } else if (node.getLocation() instanceof FileLocation) { types.add(node); } } } } OutputVFile vFile; try { vFile = outputJackLibrary.createFile(FileType.IDX, new VPath("index", '/')); OutputStream out = new BufferedOutputStream(vFile.getOutputStream()); JayceInternalWriter writer = JayceWriterFactory.get(outputJackLibrary, out); try { for (JDefinedClassOrInterface node : types) { writer.writeJNodeTypeInfo(node); } } finally { out.close(); } } catch (CannotCreateFileException e) { Jack.getSession().getReporter().report(Severity.NON_FATAL, new IndexWritingException(e)); } catch (WrongPermissionException e) { Jack.getSession().getReporter().report(Severity.NON_FATAL, new IndexWritingException(e)); } catch (IOException e) { Jack.getSession().getReporter().report(Severity.NON_FATAL, new IndexWritingException(e)); } }
Source:
public final void fetchContentsAndUpdateMap(final List<String> fileNames) { String esFileQueryJson = jsonUtils.getJsonForFileContent(fileNames); String esFileResultJson; esFileResultJson = getESResultJson(esFileQueryJson, windowObjects.getEsURL() + SOURCEFILE_SEARCH); JsonObject jsonElements = getJsonElements(esFileResultJson); assert jsonElements != null; JsonArray hitsArray = getJsonHitsArray(jsonElements); for (JsonElement hits : hitsArray) { JsonObject hitObject = hits.getAsJsonObject(); JsonObject sourceObject = hitObject.getAsJsonObject(SOURCE); String fileContent = sourceObject.getAsJsonPrimitive(FILE_CONTENT). getAsString().replaceAll("\r", ""); String fileName = sourceObject.getAsJsonPrimitive(FILE_NAME).getAsString(); windowObjects.getFileNameContentsMap().put(fileName, fileContent); } }

Target:
public final void fetchContentsAndUpdateMap(final List<String> fileNames) { String esFileQueryJson = jsonUtils.getJsonForFileContent(fileNames); String esFileResultJson; esFileResultJson = getESResultJson(esFileQueryJson, windowObjects.getEsURL() + SOURCEFILE_SEARCH); JsonObject jsonElements = getJsonElements(esFileResultJson); if (jsonElements != null) { JsonArray hitsArray = getJsonHitsArray(jsonElements); for (JsonElement hits : hitsArray) { JsonObject hitObject = hits.getAsJsonObject(); JsonObject sourceObject = hitObject.getAsJsonObject(SOURCE); String fileContent = sourceObject.getAsJsonPrimitive(FILE_CONTENT). getAsString().replaceAll("\r", ""); String fileName = sourceObject.getAsJsonPrimitive(FILE_NAME).getAsString(); windowObjects.getFileNameContentsMap().put(fileName, fileContent); } } }
Source:
K addSideCondition(K requires) { return requires; }

Target:
K addSideCondition(K requires) { if (skipSortPredicates) return requires; else { Optional<KApply> sideCondition = casts.stream().map(k -> { return new TransformKORE() { @Override public K apply(KVariable k) { if (varToTypedVar.containsKey(k)) { return varToTypedVar.get(k); } return k; } }.apply(k); }).map(k -> KApply(KLabel("is" + getSortNameOfCast((KApply) k)), transform(k))).reduce(BooleanUtils::and); if (!sideCondition.isPresent()) { return requires; } else if (requires.equals(BooleanUtils.TRUE) && sideCondition.isPresent()) { return sideCondition.get(); } else { return BooleanUtils.and(sideCondition.get(), requires); } } }
Source:
public List<Data> queryDbaseIndex(Filter filter, int maxFeatures) throws IOException { if (filter!=null && !Filter.INCLUDE.equals(filter) && !Filter.EXCLUDE.equals(filter)) { DbaseFileIndex dbaseIndex = null; if (!(filter instanceof BinarySpatialOperator)) { URL url = new URL(shpFiles.get(DBF)); for (DbaseFileIndexFactory factory : FACTORY_CACHE) { if ((dbaseIndex = factory.getIndexManager(url, store.getCharset(), store.getTimeZone()))!=null) { break; } } } ExpressionFilterVisitor filterVisitor = createExpressionFilterVisitor(filter); List<Integer> recnoList = null; try { if (dbaseIndex != null) { Map<String,Node> indexNodeMap = dbaseIndex.getIndexNodeMap(); if (!supportsFilter(filter, indexNodeMap)) return null; filterVisitor.setIndexNodeMap(indexNodeMap); } if (filterVisitor.fullySupports(filter)) { recnoList = DbaseFileIndex.queryDbaseIndex(filter, filterVisitor, maxFeatures); } } finally { if (dbaseIndex != null) { dbaseIndex.close(); } } return convertRecordNumbersToDataObjects(recnoList, true); } return null; }

Target:
protected List<Data> queryDbaseIndex(Filter filter, int maxFeatures) throws IOException { if (filter!=null && !Filter.INCLUDE.equals(filter) && !Filter.EXCLUDE.equals(filter)) { DbaseFileIndex dbaseIndex = null; if (!(filter instanceof BinarySpatialOperator)) { URL url = new URL(shpFiles.get(DBF)); for (DbaseFileIndexFactory factory : getDbaseFileIndexFactories()) { if ((dbaseIndex = factory.getIndexManager(url, store.getCharset(), store.getTimeZone()))!=null) { break; } } } if (dbaseIndex == null) { return null; } ExpressionFilterVisitor filterVisitor = createExpressionFilterVisitor(filter); List<Integer> recnoList = null; try { Map<String,Node> indexNodeMap = dbaseIndex.getIndexNodeMap(); if (!supportsFilter(filter, indexNodeMap)) return null; filterVisitor.setIndexNodeMap(indexNodeMap); if (filterVisitor.fullySupports(filter)) { recnoList = DbaseFileIndex.queryDbaseIndex(filter, filterVisitor, maxFeatures); } } finally { dbaseIndex.close(); } return convertRecordNumbersToDataObjects(recnoList, true); } return null; }
Source:
public CachingClusteredClient( QueryToolChestWarehouse warehouse, TimelineServerView serverView, Cache cache, @Smile ObjectMapper objectMapper, @BackgroundCaching ExecutorService backgroundExecutorService, CacheConfig cacheConfig ) { this.warehouse = warehouse; this.serverView = serverView; this.cache = cache; this.objectMapper = objectMapper; this.cacheConfig = cacheConfig; this.backgroundExecutorService = MoreExecutors.listeningDecorator(backgroundExecutorService); if (cacheConfig.isQueryCacheable(Query.GROUP_BY)) { log.warn("Caching for groupBys is enabled, but they won't be cached if they are executed with the strategy v2!"); } serverView.registerSegmentCallback( Execs.singleThreaded("CCClient-ServerView-CB-%d"), new ServerView.BaseSegmentCallback() { @Override public ServerView.CallbackAction segmentRemoved(DruidServerMetadata server, DataSegment segment) { CachingClusteredClient.this.cache.close(segment.getIdentifier()); return ServerView.CallbackAction.CONTINUE; } } ); }

Target:
public CachingClusteredClient( QueryToolChestWarehouse warehouse, TimelineServerView serverView, Cache cache, @Smile ObjectMapper objectMapper, @BackgroundCaching ExecutorService backgroundExecutorService, CacheConfig cacheConfig ) { this.warehouse = warehouse; this.serverView = serverView; this.cache = cache; this.objectMapper = objectMapper; this.cacheConfig = cacheConfig; this.backgroundExecutorService = MoreExecutors.listeningDecorator(backgroundExecutorService); if (cacheConfig.isQueryCacheable(Query.GROUP_BY)) { log.warn( "Even though groupBy caching is enabled, v2 groupBys will not be cached. " + "Consider disabling cache on your broker and enabling it on your data nodes to enable v2 groupBy caching." ); } serverView.registerSegmentCallback( Execs.singleThreaded("CCClient-ServerView-CB-%d"), new ServerView.BaseSegmentCallback() { @Override public ServerView.CallbackAction segmentRemoved(DruidServerMetadata server, DataSegment segment) { CachingClusteredClient.this.cache.close(segment.getIdentifier()); return ServerView.CallbackAction.CONTINUE; } } ); }
Source:
public FilestoreModel.Status downloadBlob(String oid, UserModel user, RepositoryModel repo, OutputStream streamOut) { Status status = canGetObject(oid, user, repo); if (status != Status.Available) { return status; } FilestoreModel item = fileCache.get(oid); if (streamOut != null) { try { FileInputStream streamIn = new FileInputStream(getStoragePath(oid)); IOUtils.copyLarge(streamIn, streamOut); streamOut.flush(); streamIn.close(); } catch (EofException e) { logger.error(MessageFormat.format("Client aborted connection for {0}", oid), e); return Status.Error_Unexpected_Stream_End; } catch (Exception e) { logger.error(MessageFormat.format("Failed to download blob {0}", oid), e); return Status.Error_Unknown; } } return item.getStatus(); }

Target:
public FilestoreModel.Status downloadBlob(String oid, UserModel user, RepositoryModel repo, OutputStream streamOut) { Status status = canGetObject(oid, user, repo); if (status != Status.Available) { return status; } FilestoreModel item = fileCache.get(oid); if (streamOut != null) { try (FileInputStream streamIn = new FileInputStream(getStoragePath(oid))) { IOUtils.copyLarge(streamIn, streamOut); streamOut.flush(); streamIn.close(); } catch (EofException e) { logger.error(MessageFormat.format("Client aborted connection for {0}", oid), e); return Status.Error_Unexpected_Stream_End; } catch (Exception e) { logger.error(MessageFormat.format("Failed to download blob {0}", oid), e); return Status.Error_Unknown; } } return item.getStatus(); }
Source:
protected void execute() { logger.debug("execute() method is called!"); try { MailConnector connector = connectorBuilder.createAndCheckMailConnector(); service = new MessagesService<T>(connector, eventPublisher); service.receiveMessages(); } catch(ServiceException ex) { logger.error("Cannot receive messages", ex); } catch(ConfigurationException ex) { logger.error("Cannot receive messages", ex); } }

Target:
protected void execute() { try { MailConnector connector = connectorBuilder.createAndCheckMailConnector(); service = new MessagesService<T>(connector, eventPublisher, config); service.receiveMessages(); } catch (ServiceException ex) { logger.error("Cannot receive messages", ex); } catch (ConfigurationException ex) { logger.error("Cannot receive messages", ex); } }
Source:
public void copyFromLocalFile(File srcFile, URI dstUri) throws Exception { String[] parts = srcFile.getName().split("__"); if (parts.length > 3 && (Integer.parseInt(parts[2]) % UPLOAD_FAILURE_MOD == 0)) { throw new IllegalArgumentException(srcFile.getAbsolutePath()); } try { _localPinotFS.copyFromLocalFile(srcFile, new URI(_basePath + dstUri.getPath())); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } }

Target:
public void copyFromLocalFile(File srcFile, URI dstUri) throws Exception { if (new LLCSegmentName(srcFile.getName()).getSequenceNumber() % UPLOAD_FAILURE_MOD == 0) { throw new IllegalArgumentException(srcFile.getAbsolutePath()); } try { _localPinotFS.copyFromLocalFile(srcFile, new URI(_basePath + dstUri.getPath())); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } }