auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DrawLotteryResultDto drawLotteryPrize(String mobile){ logger.debug(mobile + " is drawing the lottery prize."); Date nowDate = DateTime.now().toDate(); if(!nowDate.before(activityChristmasEndTime) || !nowDate.after(activityChristmasStartTime)){ return new DrawLotteryResultDto(3); } if (StringUtils.isEmpty(mobile)) { logger.debug("User not login. can't draw prize."); return new DrawLotteryResultDto(2); } UserModel userModel = userMapper.findByMobile(mobile); if(userModel == null){ logger.debug(mobile + "User is not found."); return new DrawLotteryResultDto(2); } int drawTime = getDrawPrizeTime(mobile); if(drawTime <= 0){ logger.debug(mobile + "is no chance. draw time:" + drawTime); return new DrawLotteryResultDto(1); } userMapper.lockByLoginName(userModel.getLoginName()); LotteryPrize christmasPrize = lotteryDrawActivityService.lotteryDrawPrize(ActivityCategory.CHRISTMAS_ACTIVITY); PrizeType prizeType = PrizeType.CONCRETE; if(christmasPrize.equals(LotteryPrize.RED_ENVELOPE_20_POINT_DRAW_REF_CARNIVAL)){ couponAssignmentService.assignUserCoupon(mobile, getCouponId(christmasPrize)); prizeType = PrizeType.VIRTUAL; } userLotteryPrizeMapper.create(new UserLotteryPrizeModel(mobile, userModel.getLoginName(), Strings.isNullOrEmpty(userModel.getUserName()) ? "" : userModel.getUserName(), christmasPrize, DateTime.now().toDate(), ActivityCategory.CHRISTMAS_ACTIVITY)); return new DrawLotteryResultDto(0, christmasPrize.name(), prizeType.name(), christmasPrize.getDescription()); }

Target:
public DrawLotteryResultDto drawLotteryPrize(String mobile){ logger.debug(mobile + " is drawing the lottery prize."); Date nowDate = DateTime.now().toDate(); if(!nowDate.before(activityChristmasEndTime) || !nowDate.after(activityChristmasStartTime)){ return new DrawLotteryResultDto(3); } if (StringUtils.isEmpty(mobile)) { logger.debug("User not login. can't draw prize."); return new DrawLotteryResultDto(2); } UserModel userModel = userMapper.findByMobile(mobile); if(userModel == null){ logger.debug(mobile + "User is not found."); return new DrawLotteryResultDto(2); } userMapper.lockByLoginName(userModel.getLoginName()); int drawTime = getDrawPrizeTime(mobile); if(drawTime <= 0){ logger.debug(mobile + "is no chance. draw time:" + drawTime); return new DrawLotteryResultDto(1); } LotteryPrize christmasPrize = lotteryDrawActivityService.lotteryDrawPrize(ActivityCategory.CHRISTMAS_ACTIVITY); PrizeType prizeType = PrizeType.CONCRETE; if(christmasPrize.equals(LotteryPrize.RED_ENVELOPE_20_POINT_DRAW_REF_CARNIVAL)){ couponAssignmentService.assignUserCoupon(mobile, RED_ENVELOPE_20_POINT_DRAW_REF_CARNIVAL_COUPON_ID); prizeType = PrizeType.VIRTUAL; } userLotteryPrizeMapper.create(new UserLotteryPrizeModel(mobile, userModel.getLoginName(), Strings.isNullOrEmpty(userModel.getUserName()) ? "" : userModel.getUserName(), christmasPrize, DateTime.now().toDate(), ActivityCategory.CHRISTMAS_ACTIVITY)); return new DrawLotteryResultDto(0, christmasPrize.name(), prizeType.name(), christmasPrize.getDescription()); }
Source:
public void testRunSyncInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); try { Entity<GroupRequest> serviceUserEntity = Entity.json(groupRequest); resources.client().target("/foxtrot/v1/generate/test").request() .post(serviceUserEntity, GroupResponse.class); } catch (WebApplicationException ex) { assertEquals(Response.Status.NOT_FOUND.getStatusCode(), ex.getResponse().getStatus()); } }

Target:
public void testRunSyncInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); try { Entity<GroupRequest> serviceUserEntity = Entity.json(groupRequest); resources.client().target("/foxtrot/v1/generate/test").request() .post(serviceUserEntity, GroupResponse.class); fail(); } catch (WebApplicationException ex) { assertEquals(Response.Status.NOT_FOUND.getStatusCode(), ex.getResponse().getStatus()); } }
Source:
public IntegrationFlow pollingFlow() { IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(jdbcMessageSource(), new Consumer<SourcePollingChannelAdapterSpec>() { @Override public void accept(SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) { sourcePollingChannelAdapterSpec .autoStartup(false) .poller(poller()); } }); if (properties.isSplit()) { flowBuilder.split(); } flowBuilder.channel(source.output()); return flowBuilder.get(); }

Target:
public IntegrationFlow pollingFlow() { IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(jdbcMessageSource(), new Consumer<SourcePollingChannelAdapterSpec>() { @Override public void accept(SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) { sourcePollingChannelAdapterSpec .autoStartup(false) .poller(poller); } }); if (properties.isSplit()) { flowBuilder.split(); } flowBuilder.channel(source.output()); return flowBuilder.get(); }
Source:
public void configureMarker(TraceMarker traceMarker) { RGBA color = traceMarker.getRGBAColor(); String category = traceMarker.getCategory(); if(!fCategories.contains(category)) { fCategories.add(category); } String label = traceMarker.getLabel(); long start = traceMarker.getStartTime(); long duration = traceMarker.getDuration(); MarkerEvent traceMarkerEvent = new MarkerEvent(null, start, duration, category, color, label, true); fTraceMarkerEvents.add(traceMarkerEvent); TmfMarkerEventSourceUpdatedSignal signal = new TmfMarkerEventSourceUpdatedSignal(this); TmfSignalManager.dispatchSignal(signal); }

Target:
public void configureMarker(TraceMarker traceMarker) { RGBA color = traceMarker.getRGBAColor(); String category = traceMarker.getCategory(); if (!fCategories.contains(category)) { fCategories.add(category); } String label = traceMarker.getLabel(); long start = traceMarker.getStartTime(); long duration = traceMarker.getDuration(); MarkerEvent traceMarkerEvent = new MarkerEvent(null, start, duration, category, color, label, true); fTraceMarkerEvents.add(traceMarkerEvent); TmfSignalManager.dispatchSignal(new TmfMarkerEventSourceUpdatedSignal(this)); }
Source:
private TableStatistics pruneStatistics(TableStatistics tableStatistics, Set<ColumnHandle> desiredColumns) { Map<ColumnHandle, ColumnStatistics> columnStatistics = tableStatistics.getColumnStatistics() .entrySet().stream() .filter(entry -> desiredColumns.contains(entry.getKey())) .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); return new TableStatistics(tableStatistics.getRowCount(), columnStatistics); }

Target:
private TableStatistics pruneStatistics(TableStatistics tableStatistics, Set<ColumnHandle> desiredColumns) { Map<ColumnHandle, ColumnStatistics> columnStatistics = tableStatistics.getColumnStatistics().entrySet().stream() .filter(entry -> desiredColumns.contains(entry.getKey())) .collect(toImmutableMap(Entry::getKey, Entry::getValue)); return new TableStatistics(tableStatistics.getRowCount(), columnStatistics); }
Source:
public ClassNameNode(ClassTree tree) { super(TreeUtils.typeOf(tree)); assert TreeUtils.isClassTree(tree); this.tree = tree; this.element = TreeUtils.elementFromDeclaration(tree); this.parent = null; }

Target:
public ClassNameNode(ClassTree tree) { super(TreeUtils.typeOf(tree)); this.tree = tree; this.element = TreeUtils.elementFromDeclaration(tree); this.parent = null; }
Source:
private static TreeSet<Text> genSplits(int level, int numTablets, long max, int nodeSize) { TreeSet<Text> splits = new TreeSet<>(); int numSplits = numTablets - 1; long distance = ((max - 0) / numTablets) + 1; long split = distance; for (int i = 0; i < numSplits; i++) { Node node = new Node(split, level, nodeSize); splits.add(new Text(node.getRowId())); split += distance; } return splits; }

Target:
private static TreeSet<Text> genSplits(int level, int numTablets, long max, int nodeSize) { TreeSet<Text> splits = new TreeSet<>(); int numSplits = numTablets - 1; long distance = (max / numTablets) + 1; long split = distance; for (int i = 0; i < numSplits; i++) { Node node = new Node(split, level, nodeSize); splits.add(new Text(node.getRowId())); split += distance; } return splits; }
Source:
public List<IItemDescriptor<T>> getItemDescriptors() { ArrayList<IItemDescriptor<T>> descriptors = Lists.newArrayList(registry.values()); if (descriptors.size() > 0) { Collections.sort(descriptors); } return descriptors; }

Target:
public List<IItemDescriptor<T>> getItemDescriptors() { return Lists.newArrayList(registry.values()); }
Source:
protected void fetchDocumentationFile() { fetchFile(getDocumentationBaseURL() + "userportal", documentationFileFetchedEvent); }

Target:
protected void fetchDocumentationFile() { fetchFile(getDocumentationBaseURL() + "userportal.json", documentationFileFetchedEvent); }
Source:
public void validate(String s) { NumberRepresentation br = new NumberRepresentation( s, true, false, false ) { @Override void parse(String val, int radix) { if ( radix == 10 ) { Integer.parseInt( val, radix ); } else { if ( new BigInteger( val, radix ).bitLength() > 32 ) { throw new NumberFormatException( "integer number too large" ); } } } }; br.validate(); }

Target:
public void validate(String s) { NumberRepresentation br = new NumberRepresentation( s, true, false, false ) { @Override void parse(String val, int radix) { if ( radix == 10 ) { Integer.parseInt( val, radix ); } else if ( new BigInteger( val, radix ).bitLength() > 32 ) { throw new NumberFormatException( "integer number too large" ); } } }; br.validate(); }
Source:
public void info(String message) { LoggerFactory lf = getLoggerFactory(); if (lf == null) { parentServletContext.log(message); } else { lf.getLogger(consumingContext.getBundle(), HttpServiceRuntimeImpl.class.getName(), Logger.class).info("{}", message); } }

Target:
public void info(String message) { Logger logger = loggerFactoryTracker.getService(); if (logger == null) { parentServletContext.log(String.valueOf(message)); } else { logger.info(String.valueOf(message)); } }
Source:
protected void runInContext() { try { s_logger.debug("HostStatsCollector is running..."); SearchCriteria<HostVO> sc = _hostDao.createSearchCriteria(); sc.addAnd("status", SearchCriteria.Op.EQ, Status.Up.toString()); sc.addAnd("resourceState", SearchCriteria.Op.NIN, ResourceState.Maintenance, ResourceState.PrepareForMaintenance, ResourceState.ErrorInMaintenance); sc.addAnd("type", SearchCriteria.Op.EQ, Host.Type.Routing.toString()); ConcurrentHashMap<Long, HostStats> hostStats = new ConcurrentHashMap<Long, HostStats>(); Map<Object, Object> metrics = new HashMap<>(); List<HostVO> hosts = _hostDao.search(sc, null); for (HostVO host : hosts) { HostStatsEntry hostStatsEntry = (HostStatsEntry)_resourceMgr.getHostStatistics(host.getId()); if (hostStatsEntry != null) { hostStatsEntry.setHostVo(host); metrics.put(hostStatsEntry.getHostId(), hostStatsEntry); _hostStats.put(host.getId(), hostStatsEntry); } else { s_logger.warn("Received invalid host stats for host: " + host.getId()); } } if (externalStatsType == ExternalStatsProtocol.INFLUXDB) { sendMetricsToInfluxdb(metrics); } updateGpuEnabledHostsDetails(hosts); } catch (Throwable t) { s_logger.error("Error trying to retrieve host stats", t); } }

Target:
protected void runInContext() { try { s_logger.debug("HostStatsCollector is running..."); SearchCriteria<HostVO> sc = createSearchCriteriaForHostTypeRoutingStateUpAndNotInMaintenance(); Map<Object, Object> metrics = new HashMap<>(); List<HostVO> hosts = _hostDao.search(sc, null); for (HostVO host : hosts) { HostStatsEntry hostStatsEntry = (HostStatsEntry)_resourceMgr.getHostStatistics(host.getId()); if (hostStatsEntry != null) { hostStatsEntry.setHostVo(host); metrics.put(hostStatsEntry.getHostId(), hostStatsEntry); _hostStats.put(host.getId(), hostStatsEntry); } else { s_logger.warn("The Host stats is null for host: " + host.getId()); } } if (externalStatsType == ExternalStatsProtocol.INFLUXDB) { sendMetricsToInfluxdb(metrics); } updateGpuEnabledHostsDetails(hosts); } catch (Throwable t) { s_logger.error("Error trying to retrieve host stats", t); } }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { NGuid dataCenterId = getNetwork().getDataCenterId(); return Collections.singletonList(new PermissionSubject(dataCenterId == null ? null : dataCenterId.getValue(), VdcObjectType.StoragePool, getActionType().getActionGroup())); }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { if (getNetwork() == null) { return Collections.<PermissionSubject> emptyList(); } NGuid dataCenterId = getNetwork().getDataCenterId(); return Collections.singletonList(new PermissionSubject(dataCenterId == null ? null : dataCenterId.getValue(), VdcObjectType.StoragePool, getActionType().getActionGroup())); }
Source:
protected void buildVmCD() { Map<String, Object> struct; if (vm.getVmPayload() != null && vm.getVmPayload().getType() == VmDeviceType.CDROM) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, (vm.getVmPayload() == null) ? null : vm.getVmPayload().getSpecParams(), true, true, true, ""); struct = new HashMap<String, Object>(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, ""); } if (vm.isRunOnce() && !StringUtils.isEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, (vm.getVmPayload() == null) ? null : vm.getVmPayload().getSpecParams(), true, true, true, ""); struct = new HashMap<String, Object>(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (!VmPayload.isPayload(vmDevice.getSpecParams()) && vmDevices.size() > 1) { continue; } struct = new HashMap<String, Object>(); String cdPath = vm.getCdPath(); addCdDetails(vmDevice, struct); addAddress(vmDevice, struct); addDevice(struct, vmDevice, cdPath == null ? "" : cdPath); } } }

Target:
protected void buildVmCD() { Map<String, Object> struct; if (vm.getVmPayload() != null && vm.getVmPayload().getType() == VmDeviceType.CDROM) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName(), "", 0, (vm.getVmPayload() == null) ? null : vm.getVmPayload().getSpecParams(), true, true, true, "", null); struct = new HashMap<String, Object>(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, ""); } if (vm.isRunOnce() && !StringUtils.isEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName(), "", 0, (vm.getVmPayload() == null) ? null : vm.getVmPayload().getSpecParams(), true, true, true, "", null); struct = new HashMap<String, Object>(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (!VmPayload.isPayload(vmDevice.getSpecParams()) && vmDevices.size() > 1) { continue; } struct = new HashMap<String, Object>(); String cdPath = vm.getCdPath(); addCdDetails(vmDevice, struct); addAddress(vmDevice, struct); addDevice(struct, vmDevice, cdPath == null ? "" : cdPath); } } }
Source:
public void setUp() throws Exception { configService = new OpenMRSConfigServiceImpl(); initMocks(this); doNothing().when(eventRelay).sendEventMessage(new MotechEvent(Constants.CONFIG_CHANGE_EVENT, new HashMap<>())); configService.setEventRelay(eventRelay); }

Target:
public void setUp() throws Exception { configService = new OpenMRSConfigServiceImpl(); initMocks(this); }
Source:
private void validateSchema(Schema inputSchema) { Schema.Type fieldToClassifyType = inputSchema.getField(config.fieldToClassify).getSchema().getType(); Preconditions.checkArgument(fieldToClassifyType == Schema.Type.STRING, "Field to classify must be of type String, but was %s.", fieldToClassifyType); Schema.Field predictionField = inputSchema.getField(config.fieldToSet); Preconditions.checkArgument(predictionField == null, "Prediction field must already not exist in input schema."); }

Target:
private void validateSchema(Schema inputSchema) { Schema.Type fieldToClassifyType = inputSchema.getField(config.fieldToClassify).getSchema().getType(); Preconditions.checkArgument(fieldToClassifyType == Schema.Type.STRING, "Field to classify must be of type String, but was %s.", fieldToClassifyType); Schema.Field predictionField = inputSchema.getField(config.fieldToSet); Preconditions.checkArgument(predictionField == null, "Prediction field must not already exist in input schema."); }
Source:
public int hashCode() { return Collections.hash(this); }

Target:
public int hashCode() { return trie.hashCode(); }
Source:
public void onEvent(CourseUpgradedEvent event) { EventBus.getDefault().removeStickyEvent(CourseUpgradedEvent.class); finish(); }

Target:
public void onEvent(CourseUpgradedEvent event) { finish(); }
Source:
private void validateMetadata(List<Metadata> metadatas) throws InvalidProductException { for (int i = 0; i < metadatas.size(); i++) { Metadata metadata = metadatas.get(i); if (metadata.getKey().equals("open_ports")) { List<String> ports = getFields((String) metadata.getValue()); for (String port : ports) { checkPortMetadata(port); } } else if (metadata.getKey().equals("open_ports_udp")) { List<String> ports = getFields((String) metadata.getValue()); for (String port : ports) { checkPortMetadata(port); } } else if (metadata.getKey().equals("installator")) { if (!(metadata.getValue().equals("chef")) && !(metadata.getValue().equals("puppet"))) { String msg = "Metadata " + metadata.getValue() + " MUST BE \"chef\" or \"puppet\""; throw new InvalidProductException(msg); } } else if (metadata.getKey().equals("dependencies")) { checkDependence(metadata.getValue()); } else if (metadata.getKey().equals("public")) { if (!(metadata.getValue().equals("no")) && !(metadata.getValue().equals("yes"))) { String msg = "Metadata " + metadata.getValue() + " MUST BE \"yes\" or \"not\""; throw new InvalidProductException(msg); } } else if (metadata.getKey().equals("cloud")) { if (!(metadata.getValue().equals("no")) && !(metadata.getValue().equals("yes"))) { String msg = "Metadata " + metadata.getValue() + " MUST BE \"yes\" or \"not\""; throw new InvalidProductException(msg); } } } }

Target:
private void validateMetadata(List<Metadata> metadatas) throws InvalidProductException { for (int i = 0; i < metadatas.size(); i++) { Metadata metadata = metadatas.get(i); if (metadata.getKey().equals("open_ports") || metadata.getKey().equals("open_ports_udp")) { List<String> ports = getFields((String) metadata.getValue()); for (String port : ports) { checkPortMetadata(port); } } else if (metadata.getKey().equals("installator")) { if (!(metadata.getValue().equals("chef")) && !(metadata.getValue().equals("puppet"))) { String msg = "Metadata " + metadata.getValue() + " MUST BE \"chef\" or \"puppet\""; throw new InvalidProductException(msg); } } else if (metadata.getKey().equals("dependencies")) { checkDependence(metadata.getValue()); } else if (metadata.getKey().equals("public") || metadata.getKey().equals("cloud")) { if (!(metadata.getValue().equals("no")) && !(metadata.getValue().equals("yes"))) { String msg = "Metadata " + metadata.getValue() + " MUST BE \"yes\" or \"not\""; throw new InvalidProductException(msg); } } } }
Source:
private static boolean isRootPrivate(Component root, Map<String, ComponentDto> existingDtosByKeys) { String rootKey = root.getKey(); ComponentDto rootDto = existingDtosByKeys.get(rootKey); if (rootDto == null) { if (Component.Type.VIEW == root.getType()) { return NEW_VIEWS_SHOULD_BE_PRIVATE; } throw new IllegalStateException(String.format("The project '%s' is not stored in the database, during a project analysis.", rootKey)); } return rootDto.isPrivate(); }

Target:
private static boolean isRootPrivate(Component root, Map<String, ComponentDto> existingDtosByKeys) { String rootKey = root.getKey(); ComponentDto rootDto = existingDtosByKeys.get(rootKey); if (rootDto == null) { if (Component.Type.VIEW == root.getType()) { return false; } throw new IllegalStateException(String.format("The project '%s' is not stored in the database, during a project analysis.", rootKey)); } return rootDto.isPrivate(); }
Source:
final CachedNode cachedNode( SessionCache cache, CachedNode node, Path path, String... actions ) throws PathNotFoundException, AccessDeniedException, RepositoryException { for (Segment segment : path) { if (segment.isSelfReference()) continue; if (segment.isParentReference()) { node = cache.getNode(node.getParentKey(cache)); } else { ChildReference ref = node.getChildReferences(cache).getChild(segment); if (ref == null) { throw new PathNotFoundException(JcrI18n.nodeNotFound.text(stringFactory().create(path), workspaceName())); } CachedNode child = cache.getNode(ref); assert child != null : "Found a child reference in " + node.getPath(cache) + " to a non-existant child " + segment; node = child; } } Path absPath = path.isAbsolute() ? path : null; if (absPath == null) { try { absPath = node.getPath(cache); if (actions.length > 0) { checkPermission(absPath, actions); } } catch (NodeNotFoundException e) { throw new PathNotFoundException(JcrI18n.nodeNotFound.text(stringFactory().create(path), workspaceName())); } } return node; }

Target:
final CachedNode cachedNode( SessionCache cache, CachedNode node, Path path, String... actions ) throws PathNotFoundException, AccessDeniedException, RepositoryException { for (Segment segment : path) { if (segment.isSelfReference()) continue; if (segment.isParentReference()) { node = cache.getNode(node.getParentKey(cache)); } else { ChildReference ref = node.getChildReferences(cache).getChild(segment); if (ref == null) { throw new PathNotFoundException(JcrI18n.nodeNotFound.text(stringFactory().create(path), workspaceName())); } CachedNode child = cache.getNode(ref); assert child != null : "Found a child reference in " + node.getPath(cache) + " to a non-existant child " + segment; node = child; } } Path absPath = path.isAbsolute() ? path : null; if (absPath == null) { try { if (actions.length > 0) { checkPermission(node, cache, actions); } } catch (NodeNotFoundException e) { throw new PathNotFoundException(JcrI18n.nodeNotFound.text(stringFactory().create(path), workspaceName())); } } return node; }
Source:
public void registerContribution(Object contribution, String xp, ComponentInstance component) { if (QUEUES_EP.equals(xp)) { WorkQueueDescriptor descriptor = (WorkQueueDescriptor) contribution; if (ALL_QUEUES.equals(descriptor.getId())) { Boolean processing = descriptor.processing; if (processing == null) { getLog().error("Ignoring work queue descriptor " + ALL_QUEUES + " with no processing/queuing"); return; } String what = " processing=" + processing + (queuing == null ? "" : " queuing=" + queuing); getLog().info("Setting on all work queues:" + what); getDescriptors(QUEUES_EP).stream().forEach(d -> { WorkQueueDescriptor wqd = new WorkQueueDescriptor(); wqd.id = d.getId(); wqd.processing = processing; register(QUEUES_EP, wqd); }); } else { register(QUEUES_EP, descriptor); } } else { super.registerContribution(contribution, xp, component); } }

Target:
public void registerContribution(Object contribution, String xp, ComponentInstance component) { if (QUEUES_EP.equals(xp)) { WorkQueueDescriptor descriptor = (WorkQueueDescriptor) contribution; if (ALL_QUEUES.equals(descriptor.getId())) { Boolean processing = descriptor.processing; if (processing == null) { getLog().error("Ignoring work queue descriptor " + ALL_QUEUES + " with no processing/queuing"); return; } String what = " processing=" + processing + (queuing == null ? "" : " queuing=" + queuing); getLog().info("Setting on all work queues:" + what); getDescriptors(QUEUES_EP).forEach(d -> { WorkQueueDescriptor wqd = new WorkQueueDescriptor(); wqd.id = d.getId(); wqd.processing = processing; register(QUEUES_EP, wqd); }); } else { register(QUEUES_EP, descriptor); } } else { super.registerContribution(contribution, xp, component); } }
Source:
public WorkflowResponse complete(WorkflowDTO workFlowDTO) throws WorkflowException { workFlowDTO.setUpdatedTime(System.currentTimeMillis()); ApiMgtDAO dao = ApiMgtDAO.getInstance(); try { if (dao.getApplicationById(Integer.parseInt(workFlowDTO.getWorkflowReference())) != null) { super.complete(workFlowDTO); log.info("Application Creation [Complete] Workflow Invoked. Workflow ID : " + workFlowDTO .getExternalWorkflowReference() + "Workflow State : " + workFlowDTO.getStatus()); String status = null; if (WorkflowStatus.CREATED.equals(workFlowDTO.getStatus())) { status = APIConstants.ApplicationStatus.APPLICATION_CREATED; } else if (WorkflowStatus.REJECTED.equals(workFlowDTO.getStatus())) { status = APIConstants.ApplicationStatus.APPLICATION_REJECTED; } else if (WorkflowStatus.APPROVED.equals(workFlowDTO.getStatus())) { status = APIConstants.ApplicationStatus.APPLICATION_APPROVED; } try { dao.updateApplicationStatus(Integer.parseInt(workFlowDTO.getWorkflowReference()), status); } catch (APIManagementException e) { String msg = "Error occurred when updating the status of the Application creation " + "process"; log.error(msg, e); throw new WorkflowException(msg, e); } } else { String msg = "Application does not exist"; throw new WorkflowException(msg); } } catch (APIManagementException e) { String msg = "Error occurred when retrieving the Application creation with workflow ID :" + workFlowDTO .getWorkflowReference(); log.error(msg, e); throw new WorkflowException(msg, e); } return new GeneralWorkflowResponse(); }

Target:
public WorkflowResponse complete(WorkflowDTO workFlowDTO) throws WorkflowException { workFlowDTO.setUpdatedTime(System.currentTimeMillis()); ApiMgtDAO dao = ApiMgtDAO.getInstance(); try { if (dao.getApplicationById(Integer.parseInt(workFlowDTO.getWorkflowReference())) != null) { super.complete(workFlowDTO); log.info("Application Creation [Complete] Workflow Invoked. Workflow ID : " + workFlowDTO .getExternalWorkflowReference() + "Workflow State : " + workFlowDTO.getStatus()); String status = null; if (WorkflowStatus.CREATED.equals(workFlowDTO.getStatus())) { status = APIConstants.ApplicationStatus.APPLICATION_CREATED; } else if (WorkflowStatus.REJECTED.equals(workFlowDTO.getStatus())) { status = APIConstants.ApplicationStatus.APPLICATION_REJECTED; } else if (WorkflowStatus.APPROVED.equals(workFlowDTO.getStatus())) { status = APIConstants.ApplicationStatus.APPLICATION_APPROVED; } try { dao.updateApplicationStatus(Integer.parseInt(workFlowDTO.getWorkflowReference()), status); } catch (APIManagementException e) { String msg = "Error occurred when updating the status of the Application creation process"; log.error(msg, e); throw new WorkflowException(msg, e); } } else { String msg = "Application does not exist"; throw new WorkflowException(msg); } } catch (APIManagementException e) { String msg = "Error occurred when retrieving the Application creation with workflow ID :" + workFlowDTO .getWorkflowReference(); log.error(msg, e); throw new WorkflowException(msg, e); } return new GeneralWorkflowResponse(); }
Source:
public String findMailAddressFor(User u) { if (disabled) return null; String username = u.getId(); for (JiraSite site : JiraGlobalConfiguration.get().getSites()) { JiraSession session = site.getSession(null); if (session == null) { continue; } com.atlassian.jira.rest.client.api.domain.User user = session.service.getUser(username); if (user != null) { String email = user.getEmailAddress(); if (email != null) { email = unmaskEmail(email); return email; } } } return null; }

Target:
public String findMailAddressFor(User u) { if (disabled) { return null; } String username = u.getId(); Job<?, ?> job = Stapler.getCurrentRequest().findAncestorObject( Job.class); for (JiraSite site : JiraSite.getJiraSites(job)) { JiraSession session = site.getSession(job); if (session == null) { continue; } com.atlassian.jira.rest.client.api.domain.User user = session.service.getUser(username); if (user != null) { String email = user.getEmailAddress(); if (email != null) { email = unmaskEmail(email); return email; } } } return null; }
Source:
public boolean remove(final K key) throws CacheAccessException { removeObserver.begin(); checkKey(key); final StoreEventSink<K, V> eventSink = eventDispatcher.eventSink(); final long now = timeSource.getTimeMillis(); final AtomicBoolean removed = new AtomicBoolean(false); try { backingMap().computeIfPresent(key, new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { @Override public OffHeapValueHolder<V> apply(K mappedKey, OffHeapValueHolder<V> mappedValue) { if (mappedValue != null && mappedValue.isExpired(now, TimeUnit.MILLISECONDS)) { onExpiration(key, mappedValue, eventSink); return null; } if (mappedValue != null) { removed.set(true); eventSink.removed(mappedKey, mappedValue.value()); } return null; } }); eventDispatcher.releaseEventSink(eventSink); if (removed.get()) { removeObserver.end(StoreOperationOutcomes.RemoveOutcome.REMOVED); } else { removeObserver.end(StoreOperationOutcomes.RemoveOutcome.MISS); } return removed.get(); } catch (RuntimeException re) { eventDispatcher.releaseEventSinkAfterFailure(eventSink, re); handleRuntimeException(re); return false; } }

Target:
public boolean remove(final K key) throws CacheAccessException { removeObserver.begin(); checkKey(key); final StoreEventSink<K, V> eventSink = eventDispatcher.eventSink(); final long now = timeSource.getTimeMillis(); final AtomicBoolean removed = new AtomicBoolean(false); try { backingMap().computeIfPresent(key, new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { @Override public OffHeapValueHolder<V> apply(K mappedKey, OffHeapValueHolder<V> mappedValue) { if (mappedValue != null && mappedValue.isExpired(now, TimeUnit.MILLISECONDS)) { onExpiration(mappedKey, mappedValue, eventSink); return null; } if (mappedValue != null) { removed.set(true); eventSink.removed(mappedKey, mappedValue.value()); } return null; } }); eventDispatcher.releaseEventSink(eventSink); if (removed.get()) { removeObserver.end(StoreOperationOutcomes.RemoveOutcome.REMOVED); } else { removeObserver.end(StoreOperationOutcomes.RemoveOutcome.MISS); } return removed.get(); } catch (RuntimeException re) { eventDispatcher.releaseEventSinkAfterFailure(eventSink, re); handleRuntimeException(re); return false; } }
Source:
public ServerLRAFilter() throws Exception { String rcHost = System.getProperty("lra.http.host", "localhost"); int rcPort = Integer.getInteger("lra.http.port", 8082); String coordinatorPath = System.getProperty("lra.coordinator.path", "lra-coordinator"); lraClient = (LRAClient) Class.forName(NarayanaLRAClient.class.getCanonicalName()).getDeclaredConstructor().newInstance(); lraClient.setCoordinatorURI(new URI(String.format("http://%s:%d/%s", rcHost, rcPort, coordinatorPath))); }

Target:
public ServerLRAFilter() throws Exception { if (!NarayanaLRAClient.isInitialised()) { String rcHost = System.getProperty(LRA_COORDINATOR_HOST_KEY, "localhost"); int rcPort = Integer.getInteger(LRA_COORDINATOR_PORT_KEY, 8082); String coordinatorPath = System.getProperty(LRA_COORDINATOR_PATH_KEY, "lra-coordinator"); NarayanaLRAClient.setDefaultEndpoint(new URI(String.format("http://%s:%d/%s", rcHost, rcPort, coordinatorPath))); } lraClient = (LRAClient) Class.forName(NarayanaLRAClient.class.getCanonicalName()).getDeclaredConstructor().newInstance(); }
Source:
protected ICompletableFuture<Void> setAsyncInternal(long ttl, TimeUnit timeunit, Long maxIdle, TimeUnit maxIdleUnit, Object key, Object value) { try { Data keyData = toData(key); Data valueData = toData(value); long ttlMillis = timeInMsOrOneIfResultIsZero(ttl, timeunit); ClientMessage request; if (maxIdle != null) { request = MapSetCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis, timeInMsOrOneIfResultIsZero(maxIdle, maxIdleUnit)); } else { request = MapPutCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis); } ClientInvocationFuture future = invokeOnKeyOwner(request, keyData); return new ClientDelegatingFuture<Void>(future, getSerializationService(), SET_ASYNC_RESPONSE_DECODER); } catch (Exception e) { throw rethrow(e); } }

Target:
protected ICompletableFuture<Void> setAsyncInternal(long ttl, TimeUnit timeunit, Long maxIdle, TimeUnit maxIdleUnit, Object key, Object value) { try { Data keyData = toData(key); Data valueData = toData(value); long ttlMillis = timeInMsOrOneIfResultIsZero(ttl, timeunit); ClientMessage request; if (maxIdle != null) { request = MapSetCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis, timeInMsOrOneIfResultIsZero(maxIdle, maxIdleUnit)); } else { request = MapSetCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis); } ClientInvocationFuture future = invokeOnKeyOwner(request, keyData); return new ClientDelegatingFuture<Void>(future, getSerializationService(), SET_ASYNC_RESPONSE_DECODER); } catch (Exception e) { throw rethrow(e); } }
Source:
public static String doubleToString(double d) { if (d == Double.POSITIVE_INFINITY) { return "Infinity"; } else if (d == Double.NEGATIVE_INFINITY) { return "-Infinity"; } return String.valueOf(d); }

Target:
public static String doubleToString(double d) { if (d == Double.POSITIVE_INFINITY) { return "Infinity"; } if (d == Double.NEGATIVE_INFINITY) { return "-Infinity"; } return String.valueOf(d); }
Source:
public static boolean isValidBooleanPropertyKey(String key) { return validProperties.contains(key) && getPropertyByKey(key).getType().equals(PropertyType.BOOLEAN); }

Target:
public static boolean isValidBooleanPropertyKey(String key) { return validProperties.contains(key) && getPropertyByKey(key).getType() == PropertyType.BOOLEAN; }
Source:
protected Size onSuggestedResolutionUpdated(@NonNull Size suggestedResolution) { MeteringRepeatingConfig configWithDefaults = (MeteringRepeatingConfig) getUseCaseConfig(); SurfaceTexture surfaceTexture = new SurfaceTexture(0); surfaceTexture.setDefaultBufferSize(640, 480); Surface surface = new Surface(surfaceTexture); SessionConfig.Builder builder = SessionConfig.Builder.createFrom(configWithDefaults); builder.setTemplateType(CameraDevice.TEMPLATE_PREVIEW); if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = new ImmediateSurface(surface); mDeferrableSurface.getTerminationFuture().addListener(() -> { Log.d(TAG, "Release metering surface and surface texture"); surface.release(); surfaceTexture.release(); }, CameraXExecutors.directExecutor()); builder.addSurface(mDeferrableSurface); attachToCamera(builder.build()); notifyActive(); return new Size(640, 480); }

Target:
protected Size onSuggestedResolutionUpdated(@NonNull Size suggestedResolution) { MeteringRepeatingConfig configWithDefaults = (MeteringRepeatingConfig) getUseCaseConfig(); SurfaceTexture surfaceTexture = new SurfaceTexture(0); surfaceTexture.setDefaultBufferSize(0, 0); Surface surface = new Surface(surfaceTexture); SessionConfig.Builder builder = SessionConfig.Builder.createFrom(configWithDefaults); builder.setTemplateType(CameraDevice.TEMPLATE_PREVIEW); if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = new ImmediateSurface(surface); mDeferrableSurface.getTerminationFuture().addListener(() -> { Log.d(TAG, "Release metering surface and surface texture"); surface.release(); surfaceTexture.release(); }, CameraXExecutors.directExecutor()); builder.addSurface(mDeferrableSurface); attachToCamera(builder.build()); notifyActive(); return new Size(0, 0); }
Source:
boolean filter(Attr attr) { if (attributeFilter == null) return false; String name = attr.getNodeName(); for (String element : attributeFilter) { if (name.matches(element)) return false; } return true; }

Target:
boolean filter(Attr attr) { if (attributeFilter == null) return false; String name = attr.getNodeName(); for (String filteredName : attributeFilter) { if (name.matches(filteredName)) return false; } return true; }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissions = new ArrayList<PermissionSubject>(); Guid networkId = getParameters().getNetwork() == null ? null : getParameters().getNetwork().getId(); permissions.add(new PermissionSubject(networkId, VdcObjectType.Network, getActionType().getActionGroup())); if (networkExists()) { permissions.add(new PermissionSubject(getParameters().getVdsGroupId(), VdcObjectType.VdsGroups, ActionGroup.CONFIGURE_CLUSTER_NETWORK)); } return permissions; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissions = new ArrayList<PermissionSubject>(); Guid networkId = getClusterNetwork() == null ? null : getClusterNetwork().getnetwork_id(); permissions.add(new PermissionSubject(networkId, VdcObjectType.Network, getActionType().getActionGroup())); if (networkExists()) { permissions.add(new PermissionSubject(getParameters().getVdsGroupId(), VdcObjectType.VdsGroups, ActionGroup.CONFIGURE_CLUSTER_NETWORK)); } return permissions; }
Source:
public void onSubscribe(Disposable d) { if (DisposableHelper.set(this, d)) { actual.onSubscribe(this); } }

Target:
public void onSubscribe(Disposable d) { if (DisposableHelper.setOnce(this, d)) { actual.onSubscribe(this); } }
Source:
public List<Permission> getAdmins() { try { return ImmutableList.copyOf( addDefaultAdmin(resourceCache.get(ADMIN_RESOURCE, authorizationDbRepository::listAdmins))); } catch (ExecutionException e) { return addDefaultAdmin(authorizationDbRepository.listAdmins()); } }

Target:
public List<Permission> getAdmins() { return addDefaultAdmin(authorizationDbRepository.listAdmins()); }
Source:
public TestCase(Annotated<String, LocationData> definition, List<Annotated<String, LocationData>> programs, String[] extensions, String[] excludes, List<Annotated<String, LocationData>> results, List<PgmArg> kompileOpts, ProgramProfile krunOpts, Map<String, ProgramProfile> pgmSpecificKRunOpts, Set<KTestStep> skips) throws InvalidConfigError { File definitionFile = new File(definition.getObj()); File output = new File(definitionFile.getParentFile(), FilenameUtils.removeExtension(definitionFile.getName()) + "-kompiled"); for (PgmArg arg : kompileOpts) { if (arg.arg.equals("--output")) { output = new File(definitionFile.getParentFile(), arg.val); } } this.compiledDir = output; this.definition = definition; this.programs = programs; this.extensions = toSet(extensions); this.excludes = toSet(excludes); this.results = results; this.kompileOpts = kompileOpts; this.krunOpts = krunOpts; this.pgmSpecificKRunOpts = pgmSpecificKRunOpts; this.skips = skips; }

Target:
public TestCase(Annotated<String, LocationData> definition, List<Annotated<String, LocationData>> programs, String[] extensions, String[] excludes, List<Annotated<String, LocationData>> results, List<PgmArg> kompileOpts, ProgramProfile krunOpts, Map<String, ProgramProfile> pgmSpecificKRunOpts, Set<KTestStep> skips) throws InvalidConfigError { this.definition = definition; this.programs = programs; this.extensions = toSet(extensions); this.excludes = toSet(excludes); this.results = results; this.kompileOpts = kompileOpts; this.krunOpts = krunOpts; this.pgmSpecificKRunOpts = pgmSpecificKRunOpts; this.skips = skips; }
Source:
public static void denySelectColumns(String tableName, Collection<String> columnNames, String extraInfo) { throw new AccessDeniedException(format("Cannot select from columns %s in table %s%s", columnNames, tableName, formatExtraInfo(extraInfo))); }

Target:
public static void denySelectColumns(String tableName, Collection<String> columnNames, String extraInfo) { throw new AccessDeniedException(format("Cannot select from columns %s in table or view %s%s", columnNames, tableName, formatExtraInfo(extraInfo))); }
Source:
private Set<String> translateToPrivileges(String permission) { if (permission == null || permission.equalsIgnoreCase("rw")) { return Privileges.rw(); } else { return Privileges.r(); } }

Target:
private Set<String> translateToPrivileges(String permission) { if (permission == null || permission.equalsIgnoreCase(Privileges.DEFAULT)) { return Privileges.rw(); } else { return Privileges.r(); } }
Source:
private void moveReceivedFiles() { File receiveFolder = new File(toBeSubmittedDirectory); if (!receiveFolder.isDirectory() || !receiveFolder.exists()) { return; } File[] files = receiveFolder.listFiles(); try { Log.d(TAG, "We have " + files.length + " toBeSubmitted files to transfer"); for (File instanceDirectory : files) { FileUtil.copyFileDeep(instanceDirectory, new File(toBeTransferredDirectory, instanceDirectory.getName())); Log.d(TAG, "Transferred " + instanceDirectory + " to " + toBeTransferredDirectory + "/" + instanceDirectory.getName()); } } catch(IOException e){ for (File instanceDirectory : files) { File newDestination = new File(toBeTransferredDirectory, instanceDirectory.getName()); if(newDestination.exists()){ FileUtil.deleteFileOrDir(newDestination); } } } for (File instanceDirectory : files) { if(instanceDirectory.exists()){ FileUtil.deleteFileOrDir(instanceDirectory); } } }

Target:
private void moveReceivedFiles() { File receiveFolder = new File(toBeSubmittedDirectory); if (!receiveFolder.isDirectory() || !receiveFolder.exists()) { return; } File[] originFiles = receiveFolder.listFiles(); File[] destinationFiles = new File[originFiles.length]; for(int i=0; i< originFiles.length; i++){ destinationFiles[i] = new File(toBeTransferredDirectory, originFiles[i].getName()); } try { Log.d(TAG, "We have " + originFiles.length + " toBeSubmitted files to transfer"); for (int i=0; i< originFiles.length; i++) { FileUtil.copyFileDeep(originFiles[i], destinationFiles[i]); Log.d(TAG, "Transferred " + originFiles[i] + " to " + destinationFiles[i]); } } catch(IOException e){ for (File destinationFile : destinationFiles) { if(destinationFile.exists()){ FileUtil.deleteFileOrDir(destinationFile); } } } for (File originFile : originFiles) { if(originFile.exists()){ FileUtil.deleteFileOrDir(originFile); } } }
Source:
public void scheduleInitial(SourceScheduler scheduler) { checkState(!initialScheduled, "Initial scheduling happened before scheduleInitial is called"); int driverGroupsScheduledPerTask = 0; synchronized (this) { while (!driverGroupNoPreferenceQueue.isEmpty() || !driverGroupWithPreferenceMapQueue.isEmpty()) { for (int taskId = 0; taskId < nodeByTaskId.size() && (!driverGroupNoPreferenceQueue.isEmpty() || !driverGroupWithPreferenceMapQueue.isEmpty()); taskId++) { InternalNode node = nodeByTaskId.get(taskId); int driverGroupId = pickDriverGroupForNode(node); if (driverGroupId == -1) { continue; } scheduler.startLifespan(Lifespan.driverGroup(driverGroupId), partitionHandles.get(driverGroupId)); taskByDriverGroup[driverGroupId] = taskId; runningDriverGroupIdsByTask[taskId].add(driverGroupId); } driverGroupsScheduledPerTask++; if (concurrentLifespansPerTask.isPresent() && driverGroupsScheduledPerTask == concurrentLifespansPerTask.getAsInt()) { break; } } initialScheduled = true; } }

Target:
public void scheduleInitial(SourceScheduler scheduler) { checkState(!initialScheduled, "Initial scheduling happened before scheduleInitial is called"); int driverGroupsScheduledPerTask = 0; synchronized (this) { while (!noPreferenceDriverGroups.isEmpty() || !nodeToPreferredDriverGroups.isEmpty()) { for (int taskId = 0; taskId < nodeByTaskId.size() && (!noPreferenceDriverGroups.isEmpty() || !nodeToPreferredDriverGroups.isEmpty()); taskId++) { InternalNode node = nodeByTaskId.get(taskId); OptionalInt driverGroupId = getNextDriverGroup(node); if (!driverGroupId.isPresent()) { continue; } scheduler.startLifespan(Lifespan.driverGroup(driverGroupId.getAsInt()), partitionHandles.get(driverGroupId.getAsInt())); taskByDriverGroup[driverGroupId.getAsInt()] = taskId; runningDriverGroupIdsByTask[taskId].add(driverGroupId.getAsInt()); } driverGroupsScheduledPerTask++; if (concurrentLifespansPerTask.isPresent() && driverGroupsScheduledPerTask == concurrentLifespansPerTask.getAsInt()) { break; } } initialScheduled = true; } }
Source:
public String formatResult(String msg) { StringBuilder res = new StringBuilder("%table "); Matcher ml = KYLIN_TABLE_FORMAT_REGEX_LABEL.matcher(msg); while (!ml.hitEnd() && ml.find()) { res.append(ml.group(1) + " \t"); } res.append(" \n"); Matcher mr = KYLIN_TABLE_FORMAT_REGEX_RESULTS.matcher(msg); String table = null; while (!mr.hitEnd() && mr.find()) { table = mr.group(1); } String[] row = table.split("],\\["); for (int i = 0; i < row.length; i++) { String[] col = row[i].split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1); for (int j = 0; j < col.length; j++) { if (col[j] != null) { col[j] = col[j].replaceAll("^\"|\"$", ""); } res.append(col[j] + " \t"); } res.append(" \n"); } return res.toString(); }

Target:
String formatResult(String msg) { StringBuilder res = new StringBuilder("%table "); Matcher ml = KYLIN_TABLE_FORMAT_REGEX_LABEL.matcher(msg); while (!ml.hitEnd() && ml.find()) { res.append(ml.group(1) + " \t"); } res.append(" \n"); Matcher mr = KYLIN_TABLE_FORMAT_REGEX_RESULTS.matcher(msg); String table = null; while (!mr.hitEnd() && mr.find()) { table = mr.group(1); } String[] row = table.split("],\\["); for (int i = 0; i < row.length; i++) { String[] col = row[i].split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1); for (int j = 0; j < col.length; j++) { if (col[j] != null) { col[j] = col[j].replaceAll("^\"|\"$", ""); } res.append(col[j] + " \t"); } res.append(" \n"); } return res.toString(); }
Source:
protected JmsSubscription createJmsSubscription(IDestination<?> destination, SubscribeInput input, IJmsSessionProvider sessionProvider, IFuture<?> worker) throws JMSException { JmsSubscription subscription = new JmsSubscription(destination, input, sessionProvider, worker); subscription.awaitStarted(30, TimeUnit.SECONDS); return subscription; }

Target:
protected JmsSubscription createJmsSubscription(IDestination<?> destination, SubscribeInput input, IJmsSessionProvider sessionProvider, IFuture<?> worker) throws JMSException { JmsSubscription subscription = new JmsSubscription(destination, input, sessionProvider, worker); subscription.awaitStarted(m_subscriptionAwaitStartedSeconds, TimeUnit.SECONDS); return subscription; }
Source:
public InputRow nextRow() { if (!it.hasNext()) { try { CloseQuietly.close(jsonParser); if (++fileIndex >= files.size()) { throw new IllegalStateException("No more data!"); } jsonParser = factory.createParser(files.get(fileIndex)); it = jsonParser.readValuesAs(Row.class); } catch (IOException e) { Throwables.propagate(e); } } return Rows.toCaseInsensitiveInputRow(it.next(), dimensions); }

Target:
public InputRow nextRow() { return Rows.toCaseInsensitiveInputRow(it.next(), dimensions); }
Source:
protected int doWork() { IOUtil.assertFileIsReadable(PED_FILE); IOUtil.assertFileIsReadable(MAP_FILE); IOUtil.assertFileIsReadable(ZCALL_THRESHOLDS_FILE); IOUtil.assertFileIsWritable(OUTPUT); try { parseZCallThresholds(); ZCallPedFile zCallPedFile = ZCallPedFile.fromFile(PED_FILE, MAP_FILE); VCFFileReader vcfFileReader = new VCFFileReader(ORIGINAL_VCF, false); VCFHeader header = vcfFileReader.getFileHeader(); addAdditionalHeaderFields(header); writeVcf(vcfFileReader.iterator(), OUTPUT, vcfFileReader.getFileHeader().getSequenceDictionary(), header, zCallPedFile); } catch (FileNotFoundException e) { e.printStackTrace(); } return 0; }

Target:
protected int doWork() { IOUtil.assertFileIsReadable(PED_FILE); IOUtil.assertFileIsReadable(MAP_FILE); IOUtil.assertFileIsReadable(ZCALL_THRESHOLDS_FILE); IOUtil.assertFileIsWritable(OUTPUT); try { parseZCallThresholds(); final ZCallPedFile zCallPedFile = ZCallPedFile.fromFile(PED_FILE, MAP_FILE); final VCFFileReader vcfFileReader = new VCFFileReader(ORIGINAL_VCF, false); final VCFHeader header = vcfFileReader.getFileHeader(); if (header.getGenotypeSamples().size() > 1) { throw new PicardException("MergePedIntoVCF only works with single-sample VCFs."); } addAdditionalHeaderFields(header); writeVcf(vcfFileReader.iterator(), OUTPUT, vcfFileReader.getFileHeader().getSequenceDictionary(), header, zCallPedFile); } catch (Exception e) { e.printStackTrace(); } return 0; }