auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Integer getUploadInterval(final DateTime userLocalDateTime, final SenseUploadConfiguration senseUploadConfiguration, final Long userNextAlarmTimestampMillis) { return adjustUploadIntervalInMinutes( DateTime.now(DateTimeZone.UTC).getMillis(), computeUploadIntervalPerUserPerSetting(userLocalDateTime, senseUploadConfiguration), userNextAlarmTimestampMillis ); }

Target:
public static Integer getUploadInterval(final DateTime userLocalDateTime, final SenseUploadConfiguration senseUploadConfiguration, final Long userNextAlarmTimestampMillis) { final Integer adjustedUploadIntervalInMinutes = adjustUploadIntervalInMinutes( DateTime.now(DateTimeZone.UTC).getMillis(), computeUploadIntervalPerUserPerSetting(userLocalDateTime, senseUploadConfiguration), userNextAlarmTimestampMillis ); LOGGER.debug("Adjusted Upload Interval in Minutes: {}", adjustedUploadIntervalInMinutes); return adjustedUploadIntervalInMinutes; }
Source:
void mergeSegment(String processorName, int segmentId) { EventProcessor eventProcessor = getEventProcessor(processorName); if (!(eventProcessor instanceof TrackingEventProcessor)) { logger.info("Merge segment requested for processor which is not a Tracking Event Processor"); return; } ((TrackingEventProcessor) eventProcessor).mergeSegment(segmentId).whenComplete( (result, throwable) -> { if (throwable != null) { logger.error("Failed to merge segment for processor [{}]", segmentId, processorName, throwable); return; } if (result) { logger.info("Successfully merged segment of processor [{}]", segmentId, processorName); } else { logger.warn("Was not able to merge segment for processor [{}]", segmentId, processorName); } } ); }

Target:
boolean mergeSegment(String processorName, int segmentId) { EventProcessor eventProcessor = getEventProcessor(processorName); if (!(eventProcessor instanceof TrackingEventProcessor)) { logger.info("Merge segment requested for processor which is not a Tracking Event Processor"); return false; } return ((TrackingEventProcessor) eventProcessor) .mergeSegment(segmentId) .thenApply(result -> { if (result) { logger.info("Successfully merged segment of processor [{}]", segmentId, processorName); } else { logger.warn("Was not able to merge segment for processor [{}]", segmentId, processorName); } return result; }).join(); }
Source:
public Iterator<T> iterator() { T[] ts = Iterators.array( date, dateTime, dateTimeZoned, time, timeZoned, duration ); return new Iterator<T>() { private int current = -1; private int next; @Override public boolean hasNext() { while ( next < ts.length && ts[next] == null ) { next++; } return next < ts.length; } @Override public T next() { if ( !hasNext() ) { throw new NoSuchElementException(); } current = next; next++; return ts[current]; } }; }

Target:
public Iterator<T> iterator() { return Iterators.filter( Objects::nonNull, Iterators.iterator( date, dateTime, dateTimeZoned, time, timeZoned, duration ) ); }
Source:
public void bindEntity(Class<?> cls) { if (entityBindings.getOrDefault(lookupEntityClass(cls), EMPTY_BINDING) != EMPTY_BINDING) { return; } entityBindings.remove(lookupEntityClass(cls)); Annotation annotation = getFirstAnnotation(cls, Arrays.asList(Include.class, Exclude.class)); Include include = annotation instanceof Include ? (Include) annotation : null; Exclude exclude = annotation instanceof Exclude ? (Exclude) annotation : null; Entity entity = (Entity) getFirstAnnotation(cls, Arrays.asList(Entity.class)); if (exclude != null) { log.trace("Exclude {}", cls.getName()); return; } if (include == null) { log.trace("Missing include {}", cls.getName()); return; } String name; if (entity == null || "".equals(entity.name())) { name = StringUtils.uncapitalize(cls.getSimpleName()); } else { name = entity.name(); } String type; if ("".equals(include.type())) { type = name; } else { type = include.type(); } Class<?> duplicate = bindJsonApiToEntity.put(type, cls); if (duplicate != null && !duplicate.equals(cls)) { log.error("Duplicate binding for {}, {}", type, cls, duplicate); throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName()); } entityBindings.putIfAbsent(lookupEntityClass(cls), new EntityBinding(this, cls, type, name)); if (include.rootLevel()) { bindEntityRoots.add(cls); } }

Target:
public void bindEntity(Class<?> cls) { if (entityBindings.getOrDefault(lookupEntityClass(cls), EMPTY_BINDING) != EMPTY_BINDING) { return; } Annotation annotation = getFirstAnnotation(cls, Arrays.asList(Include.class, Exclude.class)); Include include = annotation instanceof Include ? (Include) annotation : null; Exclude exclude = annotation instanceof Exclude ? (Exclude) annotation : null; Entity entity = (Entity) getFirstAnnotation(cls, Arrays.asList(Entity.class)); if (exclude != null) { log.trace("Exclude {}", cls.getName()); return; } if (include == null) { log.trace("Missing include {}", cls.getName()); return; } String name; if (entity == null || "".equals(entity.name())) { name = StringUtils.uncapitalize(cls.getSimpleName()); } else { name = entity.name(); } String type; if ("".equals(include.type())) { type = name; } else { type = include.type(); } Class<?> duplicate = bindJsonApiToEntity.put(type, cls); if (duplicate != null && !duplicate.equals(cls)) { log.error("Duplicate binding for {}, {}", type, cls, duplicate); throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName()); } entityBindings.putIfAbsent(lookupEntityClass(cls), new EntityBinding(this, cls, type, name)); if (include.rootLevel()) { bindEntityRoots.add(cls); } }
Source:
public Response registerPill(final byte[] body) { final MorpheusCommand.Builder builder = pair(body, senseKeyStore, PairAction.PAIR_PILL); final Optional<AccessToken> accessTokenOptional = this.tokenStore.getClientDetailsByToken( new ClientCredentials(new OAuthScope[]{OAuthScope.AUTH}, builder.getAccountId()), DateTime.now()); String senseId = "Unknown sense"; if(accessTokenOptional.isPresent()) { final Long accountId = accessTokenOptional.get().accountId; final List<DeviceAccountPair> deviceAccountPairs = this.deviceDAO.getSensesForAccountId(accountId); if(deviceAccountPairs.size() > 0){ senseId = deviceAccountPairs.get(0).externalDeviceId; } } return signAndSend(senseId, builder, senseKeyStore); }

Target:
public Response registerPill(final byte[] body) { final MorpheusCommand.Builder builder = pair(body, senseKeyStore, PairAction.PAIR_PILL); final Optional<AccessToken> accessTokenOptional = this.tokenStore.getClientDetailsByToken( new ClientCredentials(new OAuthScope[]{OAuthScope.AUTH}, builder.getAccountId()), DateTime.now()); if(!accessTokenOptional.isPresent()) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } final Long accountId = accessTokenOptional.get().accountId; final List<DeviceAccountPair> deviceAccountPairs = this.deviceDAO.getSensesForAccountId(accountId); if(deviceAccountPairs.size() == 0) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } final String senseId = deviceAccountPairs.get(0).externalDeviceId; return signAndSend(senseId, builder, senseKeyStore); }
Source:
public final void testQueryQueries() throws DbException, CatalogException { Schema schema = new Schema(ImmutableList.of(Type.LONG_TYPE, Type.STRING_TYPE), ImmutableList.of("id", "raw")); CatalogQueryScan scan = new CatalogQueryScan("select query_id, raw_query from queries", schema, catalog); scan.open(null); assertEquals(false, scan.eos()); TupleBatch tb = scan.nextReady(); assertEquals(false, scan.eos()); assertEquals(1, tb.numTuples()); assertEquals(schema, tb.getSchema()); tb = scan.nextReady(); assertEquals(true, scan.eos()); }

Target:
public final void testQueryQueries() throws DbException, CatalogException { Schema schema = Schema.ofFields(Type.LONG_TYPE, "id", Type.STRING_TYPE, "raw"); CatalogQueryScan scan = new CatalogQueryScan("select query_id, raw_query from queries", schema, catalog); scan.open(null); assertEquals(false, scan.eos()); TupleBatch tb = scan.nextReady(); assertEquals(false, scan.eos()); assertEquals(1, tb.numTuples()); assertEquals(schema, tb.getSchema()); tb = scan.nextReady(); assertEquals(true, scan.eos()); }
Source:
protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) { if (fDataReadMemoryBytes) { fCommandCache.execute( fCommandFactory.createMIDataWriteMemoryBytes(dmc, address.add(offset).toString(), buffer), new DataRequestMonitor<MIDataWriteMemoryBytesInfo>(getExecutor(), rm) ); } else { final CountingRequestMonitor countingRM = new CountingRequestMonitor(getExecutor(), rm); countingRM.setDoneCount(count); int format = MIFormat.DECIMAL; String baseAddress = address.toString(); for (int i = 0; i < count; i++) { String value = new Byte(buffer[i]).toString(); fCommandCache.execute( fCommandFactory.createMIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM) ); } } }

Target:
protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) { if (fDataReadMemoryBytes) { fCommandCache.execute( fCommandFactory.createMIDataWriteMemoryBytes(dmc, address.add(offset).toString(), (buffer.length == count) ? buffer : Arrays.copyOf(buffer, count)), new DataRequestMonitor<MIInfo>(getExecutor(), rm) ); } else { final CountingRequestMonitor countingRM = new CountingRequestMonitor(getExecutor(), rm); countingRM.setDoneCount(count); int format = MIFormat.DECIMAL; String baseAddress = address.toString(); for (int i = 0; i < count; i++) { String value = new Byte(buffer[i]).toString(); fCommandCache.execute( fCommandFactory.createMIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM) ); } } }
Source:
private static boolean validAggregate(Aggregate aggregate, DruidQuery query) { ImmutableBitSet.Builder builder = ImmutableBitSet.builder(); for (AggregateCall aggCall : aggregate.getAggCallList()) { builder.addAll(aggCall.getArgList()); } for (int index : aggregate.getGroupSet()) { if (query.druidTable.metricFieldNames .contains(query.getTopNode().getRowType().getFieldNames().get(index))) { return false; } } return !checkTimestampRefOnQuery(builder.build(), query.getTopNode(), query); }

Target:
private static boolean validAggregate(Aggregate aggregate, DruidQuery query) { ImmutableBitSet.Builder builder = ImmutableBitSet.builder(); for (AggregateCall aggCall : aggregate.getAggCallList()) { builder.addAll(aggCall.getArgList()); } if (checkAggregateOnMetric(aggregate.getGroupSet(), aggregate, query)) { return false; } return !checkTimestampRefOnQuery(builder.build(), query.getTopNode(), query); }
Source:
private void check(Rule rule) { if (rule.att().contains("unblock")) return; resetVars(); gatherVars(rule.body()); gatherVars(rule.requires()); gatherVars(rule.ensures()); check(rule.body()); check(rule.requires()); check(rule.ensures()); }

Target:
private void check(Rule rule) { resetVars(); gatherVars(rule.body()); check(rule.body(), true); check(rule.requires(), false); check(rule.ensures(), false); }
Source:
private static boolean hasAtLeastOneSiblingWithSameTokenType(DetailAST ast) { boolean result = false; if (ast.getParent() == null) { DetailAST prev = ast.getPreviousSibling(); while (prev != null) { if (prev.getType() == ast.getType()) { result = true; break; } prev = prev.getPreviousSibling(); } if (!result) { DetailAST next = ast.getNextSibling(); while (next != null) { if (next.getType() == ast.getType()) { result = true; break; } next = next.getNextSibling(); } } } else { result = ast.getParent().getChildCount(ast.getType()) > 1; } return result; }

Target:
private static boolean hasAtLeastOneSiblingWithSameTokenType(DetailAST ast) { boolean result = false; DetailAST prev = ast.getPreviousSibling(); while (prev != null) { if (prev.getType() == ast.getType()) { result = true; break; } prev = prev.getPreviousSibling(); } DetailAST next = ast.getNextSibling(); while (next != null) { if (next.getType() == ast.getType()) { result = true; break; } next = next.getNextSibling(); } return result; }
Source:
public VdsManager GetVdsManager(Guid vdsId) { return GetVdsManager(vdsId, true); }

Target:
public VdsManager GetVdsManager(Guid vdsId) { return GetVdsManager(vdsId, false); }
Source:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && getStoragePool().getCompatibilityVersion().compareTo(vm.getCustomCompatibilityVersion()) > 0) .map(VM::getName) .collect(Collectors.joining(", ")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }

Target:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) .collect(Collectors.joining(", ")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }
Source:
private void setSubmitType(final Project.SubmitType newSubmitType) { if (submitType != null) { for (int i = 0; i < submitType.getItemCount(); i++) { if (newSubmitType.name().equals(submitType.getValue(i))) { submitType.setSelectedIndex(i); return; } } submitType.setSelectedIndex(-1); setEnabledForUseContentMerge(); } }

Target:
private void setSubmitType(final Project.SubmitType newSubmitType) { int index = -1; if (submitType != null) { for (int i = 0; i < submitType.getItemCount(); i++) { if (newSubmitType.name().equals(submitType.getValue(i))) { index = i; break; } } submitType.setSelectedIndex(index); setEnabledForUseContentMerge(); } }
Source:
@Test public void extractTraceContext_malformed() { MapEntry mapEntry = new MapEntry(); map.put("x-b3-traceid", "1"); map.put("x-b3-parentspanid", "-"); SamplingFlags result = propagation().extractor(mapEntry).extract(map).samplingFlags(); assertThat(result) .isEqualTo(SamplingFlags.EMPTY); }

Target:
@Test public void extractTraceContext_malformed() { MapEntry mapEntry = new MapEntry(); map.put("X-B3-TraceId", "463ac35c9f6413ad48485a3953bb6124"); map.put("X-B3-SpanId", "48485a3953bb6124"); map.put("X-B3-ParentSpanId", "-"); SamplingFlags result = propagation().extractor(mapEntry).extract(map).samplingFlags(); assertThat(result) .isEqualTo(SamplingFlags.EMPTY); }
Source:
private void testNamespace(String namespace, boolean shouldFail) { boolean errorThrown = false; try { ensureValidNamespace(namespace); } catch (IllegalStateException e) { errorThrown = true; if (shouldFail) { assertThat(e.getMessage(), equalTo( "Namespace must only have alphanumeric characters or the underscore symbol" )); } else { fail(String.format("ensureValidNamespace provided false positive for value: %s", namespace)); } } if (shouldFail && !errorThrown) { fail(String.format("ensureValidNamespace failed to throw exception for value: %s", namespace)); } }

Target:
private void testNamespace(String namespace, boolean shouldFail) { boolean errorThrown = false; try { ensureValidNamespace(namespace); } catch (Exception e) { errorThrown = true; if (shouldFail) { assertThat(e, new IsInstanceOf(InvalidNamespaceException.class)); } else { fail(String.format("ensureValidNamespace provided false positive for value: %s", namespace)); } } if (shouldFail && !errorThrown) { fail(String.format("ensureValidNamespace failed to throw exception for value: %s", namespace)); } }
Source:
public Map<String, String> storeLevelTagMap(final String taskName, final String storeType, final String storeName) { final Map<String, String> tagMap = taskLevelTagMap(taskName); tagMap.put(storeType + STORE_ID_TAG, storeName); return tagMap; }

Target:
public Map<String, String> storeLevelTagMap(final String taskName, final String storeType, final String storeName) { final Map<String, String> tagMap = taskLevelTagMap(taskName); tagMap.put(storeType + "-" + STORE_ID_TAG, storeName); return tagMap; }
Source:
void newSlotsAreAvailable(Collection<? extends PhysicalSlot> newSlots) { final Collection<PhysicalSlot> slotsToProcess = new ArrayList<>(); for (PhysicalSlot newSlot : newSlots) { if (newSlotsSet.add(newSlot.getAllocationId())) { slotsToProcess.add(newSlot); } } final Collection<PendingRequestSlotMatching> matchingsToFulfill = new ArrayList<>(); for (PhysicalSlot newSlot : slotsToProcess) { final Optional<PendingRequest> matchingPendingRequest = findMatchingPendingRequest(newSlot); matchingPendingRequest.ifPresent(pendingRequest -> { Preconditions.checkNotNull(pendingRequests.remove(pendingRequest.getSlotRequestId()), "Cannot fulfill a non existing pending slot request."); reserveFreeSlot(pendingRequest.getSlotRequestId(), newSlot.getAllocationId(), pendingRequest.resourceProfile); matchingsToFulfill.add(PendingRequestSlotMatching.createFor(pendingRequest, newSlot)); }); newSlotsSet.remove(newSlot.getAllocationId()); } for (PendingRequestSlotMatching pendingRequestSlotMatching : matchingsToFulfill) { pendingRequestSlotMatching.fulfillPendingRequest(); } }

Target:
void newSlotsAreAvailable(Collection<? extends PhysicalSlot> newSlots) { final Collection<PendingRequestSlotMatching> matchingsToFulfill = new ArrayList<>(); for (PhysicalSlot newSlot : newSlots) { final Optional<PendingRequest> matchingPendingRequest = findMatchingPendingRequest(newSlot); matchingPendingRequest.ifPresent(pendingRequest -> { Preconditions.checkNotNull(pendingRequests.remove(pendingRequest.getSlotRequestId()), "Cannot fulfill a non existing pending slot request."); reserveFreeSlot(pendingRequest.getSlotRequestId(), newSlot.getAllocationId(), pendingRequest.resourceProfile); matchingsToFulfill.add(PendingRequestSlotMatching.createFor(pendingRequest, newSlot)); }); } for (PendingRequestSlotMatching pendingRequestSlotMatching : matchingsToFulfill) { pendingRequestSlotMatching.fulfillPendingRequest(); } }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_PREFERENCES: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_SETTINGS); createPreferencesMenu(this); return true; case MENU_UPDATE: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_UPDATE_CC); Intent i = new Intent(getApplicationContext(), UpdateActivity.class); startActivity(i); return true; case MENU_REPORT_PROBLEM: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_REPORT_PROBLEM); startReportActivity(); return true; case MENU_VALIDATE_MEDIA: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_VALIDATE_MM); startValidationActivity(); return true; case MENU_DUMP_FORMS: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_MANAGE_SD); startFormDumpActivity(); return true; case MENU_WIFI_DIRECT: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_WIFI_DIRECT); startWifiDirectActivity(); return true; case MENU_CONNECTION_DIAGNOSTIC: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_CONNECTION_TEST); startMenuConnectionActivity(); return true; case MENU_SAVED_FORMS: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_SAVED_FORMS); goToFormArchive(false); return true; case MENU_ABOUT: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_ABOUT_CC); showAboutCommCareDialog(); return true; } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { Map<Integer, String> menuIdToAnalyticsEventLabel = createMenuItemToEventMapping(); GoogleAnalyticsUtils.reportOptionsMenuItemEntry( GoogleAnalyticsFields.CATEGORY_HOME_SCREEN, menuIdToAnalyticsEventLabel.get(item.getItemId())); switch (item.getItemId()) { case MENU_PREFERENCES: createPreferencesMenu(this); return true; case MENU_UPDATE: Intent i = new Intent(getApplicationContext(), UpdateActivity.class); startActivity(i); return true; case MENU_REPORT_PROBLEM: startReportActivity(); return true; case MENU_VALIDATE_MEDIA: startValidationActivity(); return true; case MENU_DUMP_FORMS: startFormDumpActivity(); return true; case MENU_WIFI_DIRECT: startWifiDirectActivity(); return true; case MENU_CONNECTION_DIAGNOSTIC: startMenuConnectionActivity(); return true; case MENU_SAVED_FORMS: goToFormArchive(false); return true; case MENU_ABOUT: showAboutCommCareDialog(); return true; case MENU_DISABLE_ANALYTICS: showAnalyticsOptOutDialog(); return true; } return super.onOptionsItemSelected(item); }
Source:
public CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery> getCacheStrategy(final SegmentMetadataQuery query) { return new CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery>() { @Override public boolean isCacheable(SegmentMetadataQuery updatedQuery, boolean willMergeRunners) { return true; } @Override public byte[] computeCacheKey(SegmentMetadataQuery query) { SegmentMetadataQuery updatedQuery = (SegmentMetadataQuery) query.withAnalysisTypes(getFinalAnalysisTypes(query)); byte[] includerBytes = updatedQuery.getToInclude().getCacheKey(); byte[] analysisTypesBytes = updatedQuery.getAnalysisTypesCacheKey(); return ByteBuffer.allocate(1 + includerBytes.length + analysisTypesBytes.length) .put(SEGMENT_METADATA_CACHE_PREFIX) .put(includerBytes) .put(analysisTypesBytes) .array(); } @Override public TypeReference<SegmentAnalysis> getCacheObjectClazz() { return getResultTypeReference(); } @Override public Function<SegmentAnalysis, SegmentAnalysis> prepareForCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } @Override public Function<SegmentAnalysis, SegmentAnalysis> pullFromCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } }; }

Target:
public CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery> getCacheStrategy(final SegmentMetadataQuery query) { return new CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery>() { @Override public boolean isCacheable(SegmentMetadataQuery query, boolean willMergeRunners) { return true; } @Override public byte[] computeCacheKey(SegmentMetadataQuery query) { SegmentMetadataQuery updatedQuery = query.withFinalizedAnalysisTypes(config); byte[] includerBytes = updatedQuery.getToInclude().getCacheKey(); byte[] analysisTypesBytes = updatedQuery.getAnalysisTypesCacheKey(); return ByteBuffer.allocate(1 + includerBytes.length + analysisTypesBytes.length) .put(SEGMENT_METADATA_CACHE_PREFIX) .put(includerBytes) .put(analysisTypesBytes) .array(); } @Override public TypeReference<SegmentAnalysis> getCacheObjectClazz() { return getResultTypeReference(); } @Override public Function<SegmentAnalysis, SegmentAnalysis> prepareForCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } @Override public Function<SegmentAnalysis, SegmentAnalysis> pullFromCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } }; }
Source:
private void handleNewCallEvent(EslEvent event) { String uuid = getHeader(event, FS_UUID); logger.debug("Adding Call with uuid " + uuid); Channel channel = new Channel(event); if(eventCache.containsKey(uuid)) return; eventCache.put(uuid, channel); itemMap.put(uuid, new LinkedList<FreeswitchBindingConfig>()); CallType call = channel.getCall(); logger.debug(String.format("new call to : %s from : %s", call.getDestNum(), call.getOrigNum())); for (FreeswitchBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { FreeswitchBindingConfig config = provider.getFreeswitchBindingConfig(itemName); if(config.getType() == FreeswitchBindingType.ACTIVE){ if(config.filtered()){ logger.debug(String.format("Trying to match filter string %s",config.getArgument())); String[] filters = config.getArgument().split(","); boolean matched = true; for(String filterString : filters){ String args = filterString.split(":"); if(args.length == 2 && StringUtils.isNotBlank(args[0]) && StringUtils.isNotBlank(args[1])){ String value = channel.getEventHeader(args[0]); try { if(StringUtils.isBlank(value) || !args[1].equals(URLDecoder.decode(value, "UTF-8"))){ matched = false; } } catch (UnsupportedEncodingException e) { logger.warn("Could not decode header", e); matched = false; } } else { logger.warn("The filter string does not look valid, not updating item"); matched = false; } if(!matched) break; } if(matched){ itemMap.get(uuid).add(config); newCallItemUpdate(config, channel); } } else { String direction = channel.getEventHeader("Call-Direction"); if(StringUtils.isNotBlank(direction) && "inbound".equals(direction)){ itemMap.get(uuid).add(config); newCallItemUpdate(config, channel); } } } } } }

Target:
private void handleNewCallEvent(EslEvent event) { String uuid = getHeader(event, UUID); logger.debug("Adding Call with uuid " + uuid); Channel channel = new Channel(event); if(eventCache.containsKey(uuid)) return; eventCache.put(uuid, channel); itemMap.put(uuid, new LinkedList<FreeswitchBindingConfig>()); CallType call = channel.getCall(); logger.debug("new call to : from : {}", call.getDestNum(), call.getOrigNum()); for (FreeswitchBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { FreeswitchBindingConfig config = provider .getFreeswitchBindingConfig(itemName); if (config.getType() == FreeswitchBindingType.ACTIVE) { if ((config.filtered() && matchCall(channel,config.getArgument())) || (!config.filtered() && isInboundCall(channel))) { itemMap.get(uuid).add(config); newCallItemUpdate(config, channel); } } } } }
Source:
getPluginFCPServer(String pluginClassName) throws PluginNotFoundException{ PluginInfoWrapper piw = getPluginInfoByClassName(pluginClassName); if(piw != null && piw.isFCPServerPlugin()) { return (FredPluginFCPMessageHandler.ServerSideFCPMessageHandler)piw.plug; } else { throw new PluginNotFoundException(pluginClassName); } }

Target:
getPluginFCPServer(String pluginClassName) throws PluginNotFoundException{ PluginInfoWrapper piw = getPluginInfoByClassName(pluginClassName); if(piw != null && piw.isFCPServerPlugin()) { return piw.getFCPServerPlugin(); } else { throw new PluginNotFoundException(pluginClassName); } }
Source:
public void setReceiver(String username) { super.setReceiver(username); privateChatTabRoot.setId(username); privateChatTabRoot.setText(username); userPlayer = playerService.getPlayerForUsername(username); if (userPlayer != null) { CountryCode countryCode = CountryCode.getByCode(userPlayer.getCountry()); usernameLabel.setText(username); userImageView.setImage(IdenticonUtil.createIdenticon(userPlayer.getId())); countryImageView.setImage(countryFlagService.loadCountryFlag(userPlayer.getCountry())); countryLabel.setText(countryCode == null ? userPlayer.getCountry() : countryCode.getName()); userPlayer.globalRatingMeanProperty().addListener((observable) -> loadReceiverGlobalRatingInformation(userPlayer)); userPlayer.globalRatingDeviationProperty().addListener((observable) -> loadReceiverGlobalRatingInformation(userPlayer)); userPlayer.leaderboardRatingMeanProperty().addListener((observable) -> loadReceiverLadderRatingInformation(userPlayer)); userPlayer.leaderboardRatingDeviationProperty().addListener((observable) -> loadReceiverLadderRatingInformation(userPlayer)); loadReceiverGlobalRatingInformation(userPlayer); loadReceiverLadderRatingInformation(userPlayer); gamesPlayedLabel.textProperty().bind(userPlayer.numberOfGamesProperty().asString()); loadPlayerGameInformation(userPlayer.getGame()); userPlayer.gameProperty().addListener((observable, oldValue, newValue) -> { loadPlayerGameInformation(newValue); }); } }

Target:
public void setReceiver(String username) { super.setReceiver(username); privateChatTabRoot.setId(username); privateChatTabRoot.setText(username); Player player = playerService.getPlayerForUsername(username); privateUserInfoController.setPlayer(player); }
Source:
public ASTNode loadPgmAst(String content, Source source, Boolean kappize, Sort startSymbol, Context context) throws ParseFailedException { org.kframework.parser.concrete.KParser.ImportTblPgm(context.files.resolveKompiled(".")); String parsed = org.kframework.parser.concrete.KParser.ParseProgramString(content, startSymbol.toString()); Document doc = XmlLoader.getXMLDoc(parsed); XmlLoader.addSource(doc.getFirstChild(), source); XmlLoader.reportErrors(doc); JavaClassesFactory.startConstruction(context); ASTNode out = JavaClassesFactory.getTerm((Element) doc.getDocumentElement().getFirstChild().getNextSibling()); JavaClassesFactory.endConstruction(); out = new PriorityFilter(context, null, null).visitNode(out); out = new PreferAvoidFilter(context, null, null).visitNode(out); out = new NormalizeASTTransformer(context).visitNode(out); out = new AmbFilter(context, null, null).visitNode(out); out = new RemoveBrackets(context).visitNode(out); if (kappize) out = new FlattenTerms(context).visitNode(out); return out; }

Target:
public ASTNode loadPgmAst(String content, Source source, Boolean kappize, Sort startSymbol, Context context) throws ParseFailedException { String parsed = org.kframework.parser.concrete.DefinitionLocalKParser.ParseProgramString(content, startSymbol.toString(), context.files.resolveKompiled(".")); Document doc = XmlLoader.getXMLDoc(parsed); XmlLoader.addSource(doc.getFirstChild(), source); XmlLoader.reportErrors(doc); ASTNode out = new JavaClassesFactory(context).getTerm((Element) doc.getDocumentElement().getFirstChild().getNextSibling()); out = new PriorityFilter(context).visitNode(out); out = new PreferAvoidFilter(context).visitNode(out); out = new NormalizeASTTransformer(context, kem).visitNode(out); out = new AmbFilter(context, kem).visitNode(out); out = new RemoveBrackets(context).visitNode(out); if (kappize) out = new FlattenTerms(context).visitNode(out); return out; }
Source:
private void validate(String[] schemaList) { Schema schema = createSchema(schemaList); if (schema != null) { Validator validator = createSchema(schemaList).newValidator(); setFeature(validator, Constants.XERCES_FEATURE_PREFIX + "continue-after-fatal-error", true); validator.setErrorHandler(new MessageHandler()); validator.setResourceResolver(new SchemaResolver()); try { LOG.info("Validating with schema {}", getWebSourceCode(), StringUtils.join(schemaList, ",")); validator.validate(new StreamSource(getWebSourceCode().createInputStream())); } catch (SAXException e) { if (!containsMessage(e)) { createViolation(0, e.getMessage()); } } catch (IOException e) { LOG.warn("Unable to validate file {}", getWebSourceCode()); LOG.warn("Cause: {}", e.getMessage()); } catch (UnrecoverableParseError e) { } } }

Target:
private void validate(String[] schemaList) { Schema schema = createSchema(schemaList); if (schema != null) { Validator validator = schema.newValidator(); setFeature(validator, Constants.XERCES_FEATURE_PREFIX + "continue-after-fatal-error", true); validator.setErrorHandler(new MessageHandler()); validator.setResourceResolver(new SchemaResolver()); try { LOG.info("Validating with schema {}", getWebSourceCode(), StringUtils.join(schemaList, ",")); validator.validate(new StreamSource(getWebSourceCode().createInputStream())); } catch (SAXException e) { if (!containsMessage(e)) { createViolation(0, e.getMessage()); } } catch (IOException e) { LOG.warn("Unable to validate file {}", getWebSourceCode()); LOG.warn("Cause: {}", e.getMessage()); } catch (UnrecoverableParseError e) { } } }
Source:
public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); return ByteBuffer.allocate(1 + fieldNameBytes.length).put(CACHE_TYPE_ID).put(fieldNameBytes).array(); }

Target:
public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); byte[] bitMapFactoryCacheKey = StringUtils.toUtf8(bitMapFactory.toString()); return ByteBuffer.allocate(1 + fieldNameBytes.length + bitMapFactoryCacheKey.length) .put(CACHE_TYPE_ID) .put(fieldNameBytes) .put(bitMapFactoryCacheKey) .array(); }
Source:
public Datastream createBootstrapDatastream(Datastream bootstrapDatastream) { ActionRequest<Datastream> request = _bootstrapBuilders.actionCreate() .boostrapDatastreamParam(bootstrapDatastream).build(); ResponseFuture<Datastream> datastreamResponseFuture = _restClient.sendRequest(request); try { return datastreamResponseFuture.getResponse().getEntity(); } catch (RemoteInvocationException e) { throw new DatastreamRuntimeException( String.format("Create Bootstrap Datastream {%s} failed with error.", bootstrapDatastream), e); } }

Target:
public Datastream createBootstrapDatastream(Datastream bootstrapDatastream) { ActionRequest<Datastream> request = _bootstrapBuilders.actionCreate() .boostrapDatastreamParam(bootstrapDatastream).build(); ResponseFuture<Datastream> datastreamResponseFuture = _restClient.sendRequest(request); try { return datastreamResponseFuture.getResponse().getEntity(); } catch (RemoteInvocationException e) { String errorMessage = String.format("Create Bootstrap Datastream {%s} failed with error.", bootstrapDatastream); ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, e); } return null; }
Source:
public void process(Node externs, Node root) { NodeTraversal.traverse(compiler, root, new FindCrossChunkReferences()); for (JSModule chunk : compiler.getModuleGraph().getAllModules()) { if (!crossChunkExports.containsKey(chunk) && !crossChunkImports.containsKey(chunk) && chunk.getInputs().size() > 0) { crossChunkExports.put(chunk, new HashSet<>()); } } ConvertChunkSourcesToModules(); AddExportStatements(); AddImportStatements(); }

Target:
public void process(Node externs, Node root) { NodeTraversal.traverse(compiler, root, new FindCrossChunkReferences()); for (JSModule chunk : compiler.getModuleGraph().getAllModules()) { if (!crossChunkExports.containsKey(chunk) && !crossChunkImports.containsKey(chunk) && chunk.getInputs().size() > 0) { crossChunkExports.put(chunk, new HashSet<>()); } } convertChunkSourcesToModules(); addExportStatements(); addImportStatements(); compiler.setFeatureSet(compiler.getFeatureSet().with(Feature.MODULES)); }
Source:
private static List<Method> findAllMethodsInHierarchy(Class<?> clazz, MethodSortOrder sortOrder) { Preconditions.notNull(clazz, "Class must not be null"); Preconditions.notNull(sortOrder, "MethodSortOrder must not be null"); List<Method> localMethods = Arrays.stream(clazz.getDeclaredMethods()) .filter(Method::isBridge) .collect(toList()); List<Method> superclassMethods = getSuperclassMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> interfaceMethods = getInterfaceMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> methods = new ArrayList<>(); if (sortOrder == MethodSortOrder.HierarchyDown) { methods.addAll(superclassMethods); methods.addAll(interfaceMethods); } methods.addAll(localMethods); if (sortOrder == MethodSortOrder.HierarchyUp) { methods.addAll(interfaceMethods); methods.addAll(superclassMethods); } return methods; }

Target:
private static List<Method> findAllMethodsInHierarchy(Class<?> clazz, MethodSortOrder sortOrder) { Preconditions.notNull(clazz, "Class must not be null"); Preconditions.notNull(sortOrder, "MethodSortOrder must not be null"); List<Method> localMethods = Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> !method.isBridge()) .collect(toList()); List<Method> superclassMethods = getSuperclassMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> interfaceMethods = getInterfaceMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> methods = new ArrayList<>(); if (sortOrder == MethodSortOrder.HierarchyDown) { methods.addAll(superclassMethods); methods.addAll(interfaceMethods); } methods.addAll(localMethods); if (sortOrder == MethodSortOrder.HierarchyUp) { methods.addAll(interfaceMethods); methods.addAll(superclassMethods); } return methods; }
Source:
private void logNameChange() { String runtimeName = vmDynamicDao.get(getVmId()).getRuntimeName(); String newName = getParameters().getVmStaticData().getName(); if (!newName.equals(runtimeName)) { log.info("changing the name of a vm that started as to {}", runtimeName, newName); } }

Target:
private void logNameChange() { String runtimeName = vmDynamicDao.get(getVmId()).getRuntimeName(); String newName = newVmStatic.getName(); if (!newName.equals(oldVm.getName()) && !newName.equals(runtimeName)) { log.info("changing the name of a vm that started as to {}", runtimeName, newName); } }
Source:
private ArrayList<IPAddress> parseDhclientFile(File dhClientFile, String interfaceMatch, String fixedAddressMatch) throws KuraException { ArrayList<IPAddress> servers = new ArrayList<>(); try (FileReader fr = new FileReader(dhClientFile); BufferedReader br = new BufferedReader(fr)) { String line = null; while ((line = br.readLine()) != null) { if ("lease {".equals(line.trim())) { if (!br.readLine().trim().equals(interfaceMatch)) { continue; } if (!br.readLine().trim().equals(fixedAddressMatch)) { continue; } while ((line = br.readLine()) != null) { if (line.indexOf("domain-name-servers") >= 0) { StringTokenizer st = new StringTokenizer( line.substring(line.indexOf("domain-name-servers") + 19), ", ;"); while (st.hasMoreTokens()) { String nameServer = st.nextToken(); logger.debug("Found nameserver... {}", nameServer); IPAddress ipa = IPAddress.parseHostAddress(nameServer); if (!servers.contains(ipa)) { servers.add(IPAddress.parseHostAddress(nameServer)); } } break; } else if (line.indexOf("expire") >= 0) { break; } } } } } catch (Exception e) { throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, e); } return servers; }

Target:
private ArrayList<IPAddress> parseDhclientFile(File dhClientFile, String interfaceMatch, String fixedAddressMatch) throws KuraException { ArrayList<IPAddress> servers = new ArrayList<>(); try (FileReader fr = new FileReader(dhClientFile); BufferedReader br = new BufferedReader(fr)) { String line = null; ArrayList<String> leaseBlock = null; while ((line = br.readLine()) != null) { if ("lease {".equals(line.trim())) { leaseBlock = new ArrayList<>(); } else if ("}".equals(line.trim())) { servers = parseDhclientLeaseBlock(leaseBlock, interfaceMatch, fixedAddressMatch); leaseBlock = null; } else if ((leaseBlock != null) && !line.trim().isEmpty()) { leaseBlock.add(line.trim()); } } } catch (Exception e) { throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, e); } return servers; }
Source:
public void process(FProtocol iprot, FProtocol oprot) throws TException { FContext ctx = iprot.readRequestHeader(); TMessage message = iprot.readMessageBegin(); FProcessorFunction processor = this.processMap.get(message.name); if (processor != null) { try { processor.process(ctx, iprot, oprot); } catch (Exception e) { System.err.println("frugal: Error processing request with correlationID " + ctx.getCorrelationId() + ": " + e.getMessage()); throw e; } return; } TProtocolUtil.skip(iprot, TType.STRUCT); iprot.readMessageEnd(); TApplicationException e = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Unknown function " + message.name); synchronized (WRITE_LOCK) { oprot.writeResponseHeader(ctx); oprot.writeMessageBegin(new TMessage(message.name, TMessageType.EXCEPTION, 0)); e.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } throw e; }

Target:
public void process(FProtocol iprot, FProtocol oprot) throws TException { FContext ctx = iprot.readRequestHeader(); TMessage message = iprot.readMessageBegin(); FProcessorFunction processor = this.processMap.get(message.name); if (processor != null) { try { processor.process(ctx, iprot, oprot); } catch (Exception e) { logger.log(Level.WARNING, "Error processing request with correlationID " + ctx.getCorrelationId() + ": " + e.getMessage()); throw e; } return; } TProtocolUtil.skip(iprot, TType.STRUCT); iprot.readMessageEnd(); TApplicationException e = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Unknown function " + message.name); synchronized (WRITE_LOCK) { oprot.writeResponseHeader(ctx); oprot.writeMessageBegin(new TMessage(message.name, TMessageType.EXCEPTION, 0)); e.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } throw e; }
Source:
public boolean matches(ScriptPath path) { String mob = path.eventArgLowerAt(1); if (!mob.equals("mob") && !mob.equals(CoreUtilities.toLowerCase(this.mob.getMobType().getInternalName()))) { return false; } if (!runInCheck(path, location)) { return false; } return super.matches(path); }

Target:
public boolean matches(ScriptPath path) { String mob = path.eventArgLowerAt(1); if (!mob.equals("mob") && !runGenericCheck(mob, mythicmob.getMobType().getInternalName())) { return false; } if (!runInCheck(path, location)) { return false; } return super.matches(path); }
Source:
private void writeSummary(String summaryLocation, String propLocation) { String[] properties = { "graph.nodes", "graph.edges", "measurement.seed", CH.PREPARE + "time", CH.PREPARE + "shortcuts", "routing.distance_mean", "routing.mean", "routing.visited_nodes_mean", "routingCH.distance_mean", "routingCH.mean", "routingCH.visited_nodes_mean" }; try { File f = new File(summaryLocation); boolean writeHeader = !f.exists(); FileWriter writer = new FileWriter(f, true); if (writeHeader) writer.write(getSummaryHeader(properties)); writer.write(getSummaryLogLine(properties, propLocation)); writer.close(); } catch (IOException e) { logger.error("Could not write summary to file '{}'", summaryLocation, e); } }

Target:
private void writeSummary(String summaryLocation, String propLocation) { logger.info("writing summary to " + summaryLocation); String[] properties = { "graph.nodes", "graph.edges", "measurement.seed", CH.PREPARE + "time", CH.PREPARE + "shortcuts", "routing.distance_mean", "routing.mean", "routing.visited_nodes_mean", "routingCH.distance_mean", "routingCH.mean", "routingCH.visited_nodes_mean", "measurement.timestamp" }; File f = new File(summaryLocation); boolean writeHeader = !f.exists(); try (FileWriter writer = new FileWriter(f, true)) { if (writeHeader) writer.write(getSummaryHeader(properties)); writer.write(getSummaryLogLine(properties, propLocation)); } catch (IOException e) { logger.error("Could not write summary to file '{}'", summaryLocation, e); } }
Source:
public boolean isMatch(String forwardedIpAddresses, Set<String> allowedIpAddresses) { if (Objects.nonNull(forwardedIpAddresses) && Objects.nonNull(allowedIpAddresses)) { String ipAddress = getFirstIpAddress(forwardedIpAddresses); if (ipAddressValidator.isValid(ipAddress)) { return allowedIpAddresses.contains(getFirstIpAddress(forwardedIpAddresses)); } } return false; }

Target:
public boolean isMatch(String forwardedIpAddresses, Set<String> allowedIpAddresses) { if (Objects.nonNull(forwardedIpAddresses) && Objects.nonNull(allowedIpAddresses)) { String ipAddress = getFirstIpAddress(forwardedIpAddresses); if (ipAddressValidator.isValid(ipAddress)) { return allowedIpAddresses.contains(ipAddress); } } return false; }
Source:
public static MessageNumberSet[] createMessageNumberSets(@Nonnull final long[] msgs) { List<MessageNumberSet> v = new ArrayList<MessageNumberSet>(); int i, j; for (i = 0; i < msgs.length; i++) { long start = msgs[i]; for (j = i + 1; j < msgs.length; j++) { if (msgs[j] != msgs[j - 1] + 1) { break; } } long end = msgs[j - 1]; v.add(new MessageNumberSet(start, end)); i = j - 1; } return v.toArray(new MessageNumberSet[v.size()]); }

Target:
public static MessageNumberSet[] createMessageNumberSets(@Nonnull final long[] msgs) { final List<MessageNumberSet> v = new ArrayList<MessageNumberSet>(); int i = 0; while (i < msgs.length) { long start = msgs[i]; int j = i + 1; while (j < msgs.length && msgs[j] == msgs[j - 1] + 1) { j++; } long end = msgs[j - 1]; v.add(new MessageNumberSet(start, end)); i = j; } return v.toArray(new MessageNumberSet[v.size()]); }
Source:
protected CDONet4jSessionConfiguration getNet4jSessionConfiguration(IConnector connector, CDOURIData uriData, URI uri) { String userName = uriData.getUserName(); String passWord = uriData.getPassWord(); String repositoryName = uriData.getRepositoryName(); CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); configuration.setConnector(connector); configuration.setRepositoryName(repositoryName); IPasswordCredentialsProvider credentialsProvider = null; if (userName != null && passWord != null) { credentialsProvider = new PasswordCredentialsProvider(userName, passWord); } else { try { CDOURIData minimalUriData = new CDOURIData(uri); minimalUriData.setUserName(null); minimalUriData.setPassWord(null); minimalUriData.setResourcePath(null); minimalUriData.setBranchPath(null); minimalUriData.setTimeStamp(CDOBranchPoint.UNSPECIFIED_DATE); minimalUriData.setTransactional(false); credentialsProvider = (IPasswordCredentialsProvider)getContainer().getElement(CredentialsProviderFactory.PRODUCT_GROUP, "password", minimalUriData.toString()); } catch (FactoryNotFoundException ex) { } if (credentialsProvider == null) { credentialsProvider = getCredentialProvider(connector, repositoryName); } } configuration.setCredentialsProvider(credentialsProvider); return configuration; }

Target:
protected CDONet4jSessionConfiguration getNet4jSessionConfiguration(IConnector connector, CDOURIData uriData, URI uri) { String userName = uriData.getUserName(); String passWord = uriData.getPassWord(); String repositoryName = uriData.getRepositoryName(); CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); configuration.setConnector(connector); configuration.setRepositoryName(repositoryName); IPasswordCredentialsProvider credentialsProvider = null; if (userName != null && passWord != null) { credentialsProvider = new PasswordCredentialsProvider(userName, passWord); } else { try { CDOURIData minimalUriData = CDOUtil.getMinimalCDOURIData(uri); credentialsProvider = (IPasswordCredentialsProvider)getContainer().getElement(CredentialsProviderFactory.PRODUCT_GROUP, "password", minimalUriData.toString()); } catch (FactoryNotFoundException ex) { } if (credentialsProvider == null) { credentialsProvider = getCredentialProvider(connector, repositoryName); } } configuration.setCredentialsProvider(credentialsProvider); return configuration; }
Source:
private static void unparseCube(SqlWriter writer, SqlCall call) { writer.keyword(call.getOperator().getName()); final SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")"); for (SqlNode operand : call.getOperandList()) { writer.sep(","); if (operand.getKind() == SqlKind.ROW) { final SqlWriter.Frame frame2 = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE, "(", ")"); for (SqlNode operand2 : ((SqlCall) operand).getOperandList()) { writer.sep(","); operand2.unparse(writer, PRECEDENCE + 1, PRECEDENCE + 1); } writer.endList(frame2); } else if (operand instanceof SqlNodeList && ((SqlNodeList) operand).size() == 0) { writer.keyword("()"); } else { operand.unparse(writer, PRECEDENCE + 1, PRECEDENCE + 1); } } writer.endList(frame); }

Target:
private void unparseCube(SqlWriter writer, SqlCall call) { writer.keyword(call.getOperator().getName()); final SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")"); for (SqlNode operand : call.getOperandList()) { writer.sep(","); if (operand.getKind() == SqlKind.ROW) { final SqlWriter.Frame frame2 = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE, "(", ")"); for (SqlNode operand2 : ((SqlCall) operand).getOperandList()) { writer.sep(","); operand2.unparse(writer, getLeftPrec() + 1, getRightPrec() + 1); } writer.endList(frame2); } else if (operand instanceof SqlNodeList && ((SqlNodeList) operand).size() == 0) { writer.keyword("()"); } else { operand.unparse(writer, getLeftPrec() + 1, getRightPrec() + 1); } } writer.endList(frame); }