auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ConversionResult convert( final Path path ) { ConversionResult result = new ConversionResult(); if ( !( xlsDTableType.accept( path ) || xlsxDTableType.accept( path ) ) ) { result.addMessage( "Source Asset is not an XLS Decision Table.", ConversionMessageType.ERROR ); return result; } final PackageDataModelOracle dmo = dataModelService.getDataModel( path ); final GuidedDecisionTableGeneratorListener listener = parseAssets( path, result, dmo ); final Path context = Paths.convert( Paths.convert( path ).getParent() ); createNewImports( context, listener.getImports(), result ); createNewFunctions( context, listener.getImports(), listener.getFunctions(), result ); createNewQueries( context, listener.getImports(), listener.getQueries(), result ); makeNewJavaTypes( context, listener.getTypeDeclarations(), result ); createNewGlobals( context, listener.getImports(), listener.getGlobals(), result ); createNewDecisionTables( context, listener.getImports(), listener.getGuidedDecisionTables(), result ); return result; }

Target:
public ConversionResult convert( final Path path ) { ConversionResult result = new ConversionResult(); if ( !( xlsDTableType.accept( path ) || xlsxDTableType.accept( path ) ) ) { result.addMessage( "Source Asset must be either a XLS or XLSX Decision Table file.", ConversionMessageType.ERROR ); return result; } final PackageDataModelOracle dmo = dataModelService.getDataModel( path ); final GuidedDecisionTableGeneratorListener listener = parseAssets( path, result, dmo ); final Path context = Paths.convert( Paths.convert( path ).getParent() ); createNewImports( context, listener.getImports(), result ); createNewFunctions( context, listener.getImports(), listener.getFunctions(), result ); createNewQueries( context, listener.getImports(), listener.getQueries(), result ); makeNewJavaTypes( context, listener.getTypeDeclarations(), result ); createNewGlobals( context, listener.getImports(), listener.getGlobals(), result ); createNewDecisionTables( context, listener.getImports(), listener.getGuidedDecisionTables(), result ); return result; }
Source:
private ForwardIndexReader<?> getForwardIndexReader(ColumnMetadata columnMetadata, SegmentDirectory.Writer segmentWriter) throws IOException { PinotDataBuffer buffer = segmentWriter.getIndexFor(columnMetadata.getColumnName(), ColumnIndexType.FORWARD_INDEX); int numRows = columnMetadata.getTotalDocs(); int numBitsPerValue = columnMetadata.getBitsPerElement(); if (columnMetadata.isSingleValue()) { if (columnMetadata.hasDictionary()) { return new FixedBitSVForwardIndexReader(buffer, numRows, numBitsPerValue); } else { return new FixedByteChunkSVForwardIndexReader(buffer, columnMetadata.getDataType()); } } else { if (columnMetadata.hasDictionary()) { return new FixedBitMVForwardIndexReader(buffer, numRows, columnMetadata.getTotalNumberOfEntries(), numBitsPerValue); } else { throw new RuntimeException("Range indexing is not supported for multi value non-dictionary columns"); } } }

Target:
private ForwardIndexReader<?> getForwardIndexReader(ColumnMetadata columnMetadata, SegmentDirectory.Writer segmentWriter) throws IOException { PinotDataBuffer buffer = segmentWriter.getIndexFor(columnMetadata.getColumnName(), ColumnIndexType.FORWARD_INDEX); int numRows = columnMetadata.getTotalDocs(); int numBitsPerValue = columnMetadata.getBitsPerElement(); if (columnMetadata.isSingleValue()) { if (columnMetadata.hasDictionary()) { return new FixedBitSVForwardIndexReader(buffer, numRows, numBitsPerValue); } else { return new FixedByteChunkSVForwardIndexReader(buffer, columnMetadata.getDataType()); } } else { if (columnMetadata.hasDictionary()) { return new FixedBitMVForwardIndexReader(buffer, numRows, columnMetadata.getTotalNumberOfEntries(), numBitsPerValue); } else { throw new IllegalStateException("Raw index on multi-value column is not supported"); } } }
Source:
private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception { rmHelper = new RMTHelper(); startRmWithConfig(RESTART_CONFIG); Assert.assertFalse("Nodes preservation should not be activated on RM restart for the test", PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()); assertThat(rmHelper.isRMStarted()).isTrue(); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSource(); assertThat(nodeSourceEvent.size()).isEqualTo(1); assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); if (nodesShouldBeRecreated) { rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, NODE_NUMBER); } Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes(); assertThat(allNodes.size()).isEqualTo(NODE_NUMBER); Set<String> nodeSourceNames = new HashSet<>(); nodeSourceNames.add(NODE_SOURCE_NAME); Set<String> aliveNodeUrls = resourceManager.listAliveNodeUrls(nodeSourceNames); assertThat(aliveNodeUrls.size()).isEqualTo(NODE_NUMBER); BooleanWrapper lockSucceeded = resourceManager.lockNodes(allNodes); assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true)); BooleanWrapper unlockSucceeded = resourceManager.unlockNodes(allNodes); assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true)); }

Target:
private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception { rmHelper = new RMTHelper(); startRmWithConfig(RESTART_CONFIG); assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()).isFalse(); assertThat(rmHelper.isRMStarted()).isTrue(); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSource(); assertThat(nodeSourceEvent.size()).isEqualTo(1); assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); if (nodesShouldBeRecreated) { rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, NODE_NUMBER); } Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes(); assertThat(allNodes.size()).isEqualTo(NODE_NUMBER); Set<String> nodeSourceNames = new HashSet<>(); nodeSourceNames.add(NODE_SOURCE_NAME); Set<String> aliveNodeUrls = resourceManager.listAliveNodeUrls(nodeSourceNames); assertThat(aliveNodeUrls.size()).isEqualTo(NODE_NUMBER); BooleanWrapper lockSucceeded = resourceManager.lockNodes(allNodes); assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true)); BooleanWrapper unlockSucceeded = resourceManager.unlockNodes(allNodes); assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true)); }
Source:
public void testIsValid() { LocalTime now = LocalTime.now(); int currentHour = now.getHour(); int currentMinute = now.getMinute(); LocalTime future = now.plusMinutes( 1 ); LocalTime past = now.minusMinutes( 1 ); assertTrue( constraint.isValid( null, null ) ); if (!(currentHour == 23 && currentMinute == 59)) { assertTrue( constraint.isValid( future, null ) ); } if (!(currentHour == 0 && currentMinute == 0)) { assertFalse( constraint.isValid( past, null ) ); } }

Target:
public void testIsValid() { LocalTime now = LocalTime.now(); int currentHour = now.getHour(); int currentMinute = now.getMinute(); LocalTime future = now.plusMinutes( 1 ); LocalTime past = now.minusMinutes( 1 ); assertTrue( constraint.isValid( null, null ), "null fails validation." ); if (!(currentHour == 23 && currentMinute == 59)) { assertTrue( constraint.isValid( future, null ), "Future LocalTime '" + future + "' fails validation."); } if (!(currentHour == 0 && currentMinute == 0)) { assertFalse( constraint.isValid( past, null ), "Past LocalTime '" + past + "' validated as future."); } }
Source:
static Region merge(Region a, Region b) { Region resultRegion; Region otherRegion; if (a.resultStart < b.resultStart) { resultRegion = a.deepCopy(); otherRegion = b.deepCopy(); } else { resultRegion = b.deepCopy(); otherRegion = a.deepCopy(); } final Region result = resultRegion; while (otherRegion != null) { if (resultRegion.next != null && resultRegion.resultStart < otherRegion.resultStart && resultRegion.next.resultStart < otherRegion.resultStart) { resultRegion = resultRegion.next; } else { Region otherNext = otherRegion.next; otherRegion.next = resultRegion.next; resultRegion.next = otherRegion; resultRegion = otherRegion; otherRegion = otherNext; } } return result; }

Target:
static Region merge(Region a, Region b) { if (a.resultStart > b.resultStart) { Region o = a; a = b; b = o; } final Region result = a; while (b != null) { if (a.next != null && a.resultStart < b.resultStart && a.next.resultStart < b.resultStart) { a = a.next; } else { Region bNext = b.next; b.next = a.next; a.next = b; a = b; b = bNext; } } return result; }
Source:
public static ArrayList<Dish> parseDishes(String dishesRespStr) throws JSONException { if (dishesRespStr == null) { return null; } ArrayList<Dish> resultList = null; JSONObject dishes = new JSONObject(dishesRespStr); resultList = new ArrayList<Dish>(); JSONArray dishArray = dishes.getJSONArray("dishes"); int length = dishArray.length(); for (int i = 0; i < length; i++) { Dish dish = new Dish(); JSONObject dishObj = dishArray.getJSONObject(i); dish.setDishId(dishObj.getLong("_id")); dish.setName(dishObj.getString("name")); dish.setPrice(dishObj.getInt("price")); dish.setDescription(dishObj.getString("description")); dish.setImageServer(dishObj.getString("image_url")); long createTimeValue = dishObj.getLong("create_time"); long updateTimeValue = dishObj.getLong("update_time"); Date createTime = new Date(createTimeValue); Date updateTime = new Date(updateTimeValue); dish.setCreateTime(createTime); dish.setUpdateTime(updateTime); resultList.add(dish); } return resultList; }

Target:
public static ArrayList<Dish> parseDishes(String dishesRespStr) throws JSONException { if (dishesRespStr == null) { return null; } ArrayList<Dish> resultList = new ArrayList<Dish>(); JSONObject dishes = new JSONObject(dishesRespStr); JSONArray dishArray = dishes.getJSONArray("dishes"); int length = dishArray.length(); for (int i = 0; i < length; i++) { Dish dish = new Dish(); JSONObject dishObj = dishArray.getJSONObject(i); dish.setDishId(dishObj.getLong("_id")); dish.setName(dishObj.getString("name")); dish.setPrice(dishObj.getInt("price")); dish.setDescription(dishObj.getString("description")); dish.setImageServer(dishObj.getString("image_url")); long createTimeValue = dishObj.getLong("create_time"); long updateTimeValue = dishObj.getLong("update_time"); Date createTime = new Date(createTimeValue); Date updateTime = new Date(updateTimeValue); dish.setCreateTime(createTime); dish.setUpdateTime(updateTime); resultList.add(dish); } return resultList; }
Source:
public boolean equals(Object obj) { if (obj instanceof Histogram) { Histogram other = (Histogram) obj; return getLastAnalyzed().equals(other.getLastAnalyzed()) && TUtil.checkEquals(this.buckets, other.buckets); } else { return false; } }

Target:
public boolean equals(Object obj) { if (obj instanceof Histogram) { Histogram other = (Histogram) obj; return getLastAnalyzed().equals(other.getLastAnalyzed()) && TUtil.checkEquals(getDataType(), other.getDataType()) && TUtil.checkEquals(this.buckets, other.buckets); } else { return false; } }
Source:
protected DiskSnapshots mapCollection(List<org.ovirt.engine.core.common.businessentities.Disk> entities) { DiskSnapshots collection = new DiskSnapshots(); for (org.ovirt.engine.core.common.businessentities.Disk disk : entities) { DiskSnapshot diskSnapshot = DiskSnapshotMapper.map(disk, null); collection.getDiskSnapshots().add(addLinks(populate(diskSnapshot, disk))); } return collection; }

Target:
protected DiskSnapshots mapCollection(List<org.ovirt.engine.core.common.businessentities.Disk> entities) { DiskSnapshots collection = new DiskSnapshots(); for (org.ovirt.engine.core.common.businessentities.Disk disk : entities) { DiskSnapshot diskSnapshot = getMapper(org.ovirt.engine.core.common.businessentities.Disk.class, DiskSnapshot.class).map(disk, null); diskSnapshot.setStorageDomain(new StorageDomain()); diskSnapshot.getStorageDomain().setId(this.storageDomainId.toString()); collection.getDiskSnapshots().add(addLinks(populate(diskSnapshot, disk))); } return collection; }
Source:
public String getBrokerID() { final String name = this.name; if (name != null && name.length() > 0) { return name; } else { StringBuffer b = new StringBuffer(); if (host != null) { b.append(host); } final Integer port = this.port; if (port != null) { b.append(":"); b.append(port.toString()); } b.append(":s"); return b.toString(); } }

Target:
public String getBrokerID() { final String name = this.name; if (name != null && name.length() > 0) { return name; } else { StringBuffer b = new StringBuffer(); if (host != null) { b.append(host); } final Integer port = this.port; if (port != null) { b.append(":"); b.append(port.toString()); } if (secure) { b.append(":s"); } return b.toString(); } }
Source:
public PutStatus put(final K key, final V value) throws StoreAccessException { putObserver.begin(); PutOperation<K, V> operation = new PutOperation<K, V>(key, value, timeSource.getTimeMillis(), true); ByteBuffer payload = codec.encode(operation); Chain chain = storeProxy.getAndAppend(key.hashCode(), payload); ResolvedChain<K, V> resolvedChain = resolver.resolve(chain, key, timeSource.getTimeMillis()); if(resolvedChain.getResolvedResult(key) == null) { putObserver.end(StoreOperationOutcomes.PutOutcome.PUT); return PutStatus.PUT; } else { putObserver.end(StoreOperationOutcomes.PutOutcome.REPLACED); return PutStatus.UPDATE; } }

Target:
public PutStatus put(final K key, final V value) throws StoreAccessException { putObserver.begin(); PutOperation<K, V> operation = new PutOperation<K, V>(key, value, timeSource.getTimeMillis()); ByteBuffer payload = codec.encode(operation); Chain chain = storeProxy.getAndAppend(key.hashCode(), payload); ResolvedChain<K, V> resolvedChain = resolver.resolve(chain, key, timeSource.getTimeMillis()); if(resolvedChain.getResolvedResult(key) == null) { putObserver.end(StoreOperationOutcomes.PutOutcome.PUT); return PutStatus.PUT; } else { putObserver.end(StoreOperationOutcomes.PutOutcome.REPLACED); return PutStatus.UPDATE; } }
Source:
public void servoEnable(ServoControl servo) { int deviceId = getDeviceId(servo); msg.servoAttachPin(deviceId, getAddress(servo.getPin())); }

Target:
public void servoEnable(ServoControl servo) { Integer deviceId = getDeviceId(servo); if (deviceId == null) { log.warn("servoEnable servo does not have a corresponding device currently - did you attach?", servo.getName()); } msg.servoAttachPin(deviceId, getAddress(servo.getPin())); }
Source:
public static Object buildBean(Class<?> beanClass, Map<String, String> values) { try { Object obj = null; if (beanClass.isInterface()) { obj = ekbService.createModelObject(beanClass); } else { obj = beanClass.newInstance(); } BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyDescriptor.getWriteMethod() == null || !Modifier.isPublic(propertyDescriptor.getWriteMethod().getModifiers())) { continue; } String value = values.get(propertyDescriptor.getName()); Object ob = convertToCorrectClass(propertyDescriptor.getPropertyType(), value); propertyDescriptor.getWriteMethod().invoke(obj, ob); } return obj; } catch (Exception e) { throw new IllegalArgumentException(e); } }

Target:
public static Object buildBean(Class<?> beanClass, Map<String, String> values) { try { Object obj = null; if (beanClass.isInterface()) { @SuppressWarnings("unchecked") Class<? extends OpenEngSBModel> model = (Class<? extends OpenEngSBModel>) beanClass; obj = ekbService.createEmptyModelObject(model); } else { obj = beanClass.newInstance(); } BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyDescriptor.getWriteMethod() == null || !Modifier.isPublic(propertyDescriptor.getWriteMethod().getModifiers())) { continue; } String value = values.get(propertyDescriptor.getName()); Object ob = convertToCorrectClass(propertyDescriptor.getPropertyType(), value); propertyDescriptor.getWriteMethod().invoke(obj, ob); } return obj; } catch (Exception e) { throw new IllegalArgumentException(e); } }
Source:
private void syncAStack(Stack stack) { try { checkedMeasure(() -> { ThreadBasedUserCrnProvider.doAsInternalActor(() -> { Set<InstanceMetaData> notTerminatedForStack = stack.getAllInstanceMetaDataList().stream() .filter(Predicate.not(InstanceMetaData::isTerminated)) .collect(Collectors.toSet()); Set<InstanceMetaData> checkableInstances = notTerminatedForStack.stream() .filter(Predicate.not(InstanceMetaData::isDeletedOnProvider)) .collect(Collectors.toSet()); int alreadyDeletedCount = notTerminatedForStack.size() - checkableInstances.size(); if (alreadyDeletedCount > 0) { LOGGER.info(":::Auto sync::: Count of already in deleted on provider side state: {}", alreadyDeletedCount); } if (!checkableInstances.isEmpty()) { SyncResult syncResult = freeipaChecker.getStatus(stack, checkableInstances); List<ProviderSyncResult> results = providerChecker.updateAndGetStatuses(stack, checkableInstances); if (results.size() > 0) { updateStackStatus(stack, syncResult, results, alreadyDeletedCount); } } }); return null; }, LOGGER, ":::Auto sync::: freeipa stack sync in {}ms"); } catch (Exception e) { LOGGER.info(":::Auto sync::: Error occurred during freeipa sync: {}", e.getMessage(), e); } }

Target:
private void syncAStack(Stack stack) { try { checkedMeasure(() -> { ThreadBasedUserCrnProvider.doAsInternalActor(() -> { Set<InstanceMetaData> notTerminatedForStack = stack.getAllInstanceMetaDataList().stream() .filter(Predicate.not(InstanceMetaData::isTerminated)) .collect(Collectors.toSet()); Set<InstanceMetaData> checkableInstances = notTerminatedForStack.stream() .filter(Predicate.not(InstanceMetaData::isDeletedOnProvider)) .collect(Collectors.toSet()); int alreadyDeletedCount = notTerminatedForStack.size() - checkableInstances.size(); if (alreadyDeletedCount > 0) { LOGGER.info(":::Auto sync::: Count of already in deleted on provider side state: {}", alreadyDeletedCount); } if (!checkableInstances.isEmpty()) { SyncResult syncResult = freeipaChecker.getStatus(stack, checkableInstances); List<ProviderSyncResult> results = providerChecker.updateAndGetStatuses(stack, checkableInstances); if (!results.isEmpty()) { updateStackStatus(stack, syncResult, results, alreadyDeletedCount); } else { LOGGER.debug("results is empty, skip update"); } } }); return null; }, LOGGER, ":::Auto sync::: freeipa stack sync in {}ms"); } catch (Exception e) { LOGGER.info(":::Auto sync::: Error occurred during freeipa sync: {}", e.getMessage(), e); } }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { requestsReceived.incrementAndGet(); if (latch.isPresent()) { try { latch.get().await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } response.setStatus(SC_OK); if (request.getUserPrincipal() != null) { response.getOutputStream().write(request.getUserPrincipal().getName().getBytes()); } response.setHeader("X-Protocol", request.getProtocol()); try { if (request.getParameter("sleep") != null) { Thread.sleep(Long.parseLong(request.getParameter("sleep"))); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) { try { if (requestLatch != null) { requestLatch.countDown(); } response.setStatus(SC_OK); response.setHeader("X-Protocol", request.getProtocol()); if (request.getUserPrincipal() != null) { response.getOutputStream().write(request.getUserPrincipal().getName().getBytes()); } if (request.getParameter("sleep") != null) { Thread.sleep(Long.parseLong(request.getParameter("sleep"))); } } catch (Exception t) { if (t instanceof InterruptedException) { Thread.currentThread().interrupt(); } exception.set(t); } }
Source:
public RevisionResource parse(ChangeResource change, IdString id) throws ResourceNotFoundException, OrmException { if (id.equals("current")) { PatchSet.Id p = change.getChange().currentPatchSetId(); PatchSet ps = p != null ? dbProvider.get().patchSets().get(p) : null; if (ps == null) { throw new ResourceNotFoundException(id); } return new RevisionResource(change, ps); } List<PatchSet> match = Lists.newArrayListWithExpectedSize(2); for (PatchSet ps : find(change, id.get())) { Change.Id changeId = ps.getId().getParentKey(); if (changeId.equals(change.getChange().getId()) && change.getControl().isPatchVisible(ps, dbProvider.get())) { match.add(ps); } } if (match.size() != 1) { throw new ResourceNotFoundException(id); } return new RevisionResource(change, match.get(0)); }

Target:
public RevisionResource parse(ChangeResource change, IdString id) throws ResourceNotFoundException, OrmException { if (id.equals("current")) { PatchSet.Id p = change.getChange().currentPatchSetId(); PatchSet ps = p != null ? dbProvider.get().patchSets().get(p) : null; if (ps != null && visible(change, ps)) { return new RevisionResource(change, ps); } throw new ResourceNotFoundException(id); } List<PatchSet> match = Lists.newArrayListWithExpectedSize(2); for (PatchSet ps : find(change, id.get())) { Change.Id changeId = ps.getId().getParentKey(); if (changeId.equals(change.getChange().getId()) && visible(change, ps)) { match.add(ps); } } if (match.size() != 1) { throw new ResourceNotFoundException(id); } return new RevisionResource(change, match.get(0)); }
Source:
protected void onNewIntent(Intent intent) { super.onNewIntent(intent); assert intent != null; if (intent.getExtras() != null){ if (intent.getExtras().containsKey(RES_ITEM)) bottomNavigation.setSelectedItemId(intent.getIntExtra(RES_ITEM, R.id.dashboard)); else if (intent.getExtras().containsKey(NOTIFICATION_DIALOG)){ new ConfirmDialogFragment.Builder() .withTitle(intent.getExtras().getString("title")) .withMessage(intent.getExtras().getString("message")) .withNegativeButton("") .withPositiveButton(getString(R.string.Modal_OK)) .build().show(getSupportFragmentManager(), null); } } }

Target:
protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (intent.getExtras() != null){ if (intent.getExtras().containsKey(RES_ITEM)) bottomNavigation.setSelectedItemId(intent.getIntExtra(RES_ITEM, R.id.dashboard)); else if (intent.getExtras().containsKey(NOTIFICATION_DIALOG)){ new ConfirmDialogFragment.Builder() .withTitle(intent.getExtras().getString("title")) .withMessage(intent.getExtras().getString("message")) .withNegativeButton("") .withPositiveButton(getString(R.string.Modal_OK)) .build().show(getSupportFragmentManager(), null); } } }
Source:
public static String revisionHistoryToJson(List<DocumentRevision> history, List<? extends Attachment> attachments) { Preconditions.checkNotNull(history, "History must not be null"); Preconditions.checkArgument(history.size() > 0, "History must not have at least one DocumentRevision."); Preconditions.checkArgument(checkHistoryIsInDescendingOrder(history), "History must be in descending order."); DocumentRevision currentNode = history.get(0); Map<String, Object> m = currentNode.asMap(); if (attachments != null && !attachments.isEmpty()) { addAttachments(attachments, m, CouchUtils.generationFromRevId(currentNode.getRevision())); } m.put(CouchConstants._revisions, createRevisions(history)); return sJsonHelper.toJson(m); }

Target:
public static String revisionHistoryToJson(List<DocumentRevision> history, List<? extends Attachment> attachments) { Preconditions.checkNotNull(history, "History must not be null"); Preconditions.checkArgument(history.size() > 0, "History must have at least one DocumentRevision."); Preconditions.checkArgument(checkHistoryIsInDescendingOrder(history), "History must be in descending order."); DocumentRevision currentNode = history.get(0); Map<String, Object> m = currentNode.asMap(); if (attachments != null && !attachments.isEmpty()) { addAttachments(attachments, m, CouchUtils.generationFromRevId(currentNode.getRevision())); } m.put(CouchConstants._revisions, createRevisions(history)); return sJsonHelper.toJson(m); }
Source:
protected static void assignSSLContextProvider(BrokerHandlerConfig config, MqttBrokerConnection connection, PinnedCallback callback) throws IllegalArgumentException { final PinTrustManager trustManager = new PinTrustManager(); connection.setSSLContextProvider(new PinningSSLContextProvider(trustManager)); trustManager.setCallback(callback); if (config.certificatepin) { try { Pin pin; if (StringUtils.isBlank(config.certificate)) { pin = Pin.LearningPin(PinType.CERTIFICATE_TYPE); } else { String[] split = config.certificate.split(":"); if (split.length != 2) { throw new NoSuchAlgorithmException("Algorithm is missing"); } pin = Pin.CheckingPin(PinType.CERTIFICATE_TYPE, new PinMessageDigest(split[0]), HexUtils.hexToBytes(split[1])); } trustManager.addPinning(pin); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } } if (config.publickeypin) { try { Pin pin; if (StringUtils.isBlank(config.publickey)) { pin = Pin.LearningPin(PinType.PUBLIC_KEY_TYPE); } else { String[] split = config.publickey.split(":"); if (split.length != 2) { throw new NoSuchAlgorithmException("Algorithm is missing"); } pin = Pin.CheckingPin(PinType.PUBLIC_KEY_TYPE, new PinMessageDigest(split[0]), HexUtils.hexToBytes(split[1])); } trustManager.addPinning(pin); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } } }

Target:
protected void assignSSLContextProvider(BrokerHandlerConfig config, MqttBrokerConnection connection, PinnedCallback callback) throws IllegalArgumentException { final PinTrustManager trustManager = new PinTrustManager(); connection.setSSLContextProvider(new PinningSSLContextProvider(trustManager)); trustManager.setCallback(callback); if (config.certificatepin) { try { Pin pin; if (StringUtils.isBlank(config.certificate)) { pin = Pin.LearningPin(PinType.CERTIFICATE_TYPE); } else { String[] split = config.certificate.split(":"); if (split.length != 2) { throw new NoSuchAlgorithmException("Algorithm is missing"); } pin = Pin.CheckingPin(PinType.CERTIFICATE_TYPE, new PinMessageDigest(split[0]), HexUtils.hexToBytes(split[1])); } trustManager.addPinning(pin); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } } if (config.publickeypin) { try { Pin pin; if (StringUtils.isBlank(config.publickey)) { pin = Pin.LearningPin(PinType.PUBLIC_KEY_TYPE); } else { String[] split = config.publickey.split(":"); if (split.length != 2) { throw new NoSuchAlgorithmException("Algorithm is missing"); } pin = Pin.CheckingPin(PinType.PUBLIC_KEY_TYPE, new PinMessageDigest(split[0]), HexUtils.hexToBytes(split[1])); } trustManager.addPinning(pin); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } } }
Source:
public Dac findById(Integer dacId) { Dac dac = dacDAO.findById(dacId); List<User> chairs = dacDAO.findMembersByDacIdAndRoleId(dacId, UserRoles.CHAIRPERSON.getRoleId()); List<User> members = dacDAO.findMembersByDacIdAndRoleId(dacId, UserRoles.MEMBER.getRoleId()); if (dac != null) { dac.setChairpersons(chairs); dac.setMembers(members); } return dac; }

Target:
public Dac findById(Integer dacId) { Dac dac = dacDAO.findById(dacId); List<User> chairs = dacDAO.findMembersByDacIdAndRoleId(dacId, UserRoles.CHAIRPERSON.getRoleId()); List<User> members = dacDAO.findMembersByDacIdAndRoleId(dacId, UserRoles.MEMBER.getRoleId()); if (Objects.nonNull(dac)) { dac.setChairpersons(chairs); dac.setMembers(members); return dac; } throw new NotFoundException("Could not find DAC with the provided id: " + dacId); }
Source:
public long getSerial() { return getAttribute(SERIAL).incrementAndGet(); }

Target:
public long getSerial() { long next = getAttribute(SERIAL) + 1; setAttribute(SERIAL, next); return next; }
Source:
protected <T> Optional<T> resolveDefaultProperty(IClientConfigKey<T> key) { return Optional.ofNullable(defaultProperties.get(key.key())) .map(value -> { final Class type = key.type(); if (!value.getClass().equals(type)) { if (value.getClass().equals(String.class)) { final String strValue = (String) value; if (Integer.class.equals(type)) { return (T)Integer.valueOf(strValue); } else if (Boolean.class.equals(type)) { return (T)Boolean.valueOf(strValue); } else if (Float.class.equals(type)) { return(T) Float.valueOf(strValue); } else if (Long.class.equals(type)) { return (T)Long.valueOf(strValue); } else if (Double.class.equals(type)) { return (T)Double.valueOf(strValue); } else if (TimeUnit.class.equals(type)) { return (T)TimeUnit.valueOf(strValue); } else { LOG.warn("Unsupported value type `{}` for key `{}` with value `{}`", type, key.key(), value); return null; } } else { LOG.warn("Invalid value type for key `{}`. Expecting `{}`. Got `{}` for value `{}`", key.key(), type, value.getClass(), value); return null; } } else { return (T)value; } }); }

Target:
protected <T> Optional<T> resolveDefaultProperty(IClientConfigKey<T> key) { return Optional.ofNullable(defaultProperties.get(key.key())) .map(value -> { final Class type = key.type(); if (!value.getClass().equals(type)) { try { if (value.getClass().equals(String.class)) { final String strValue = (String) value; if (Integer.class.equals(type)) { return (T) Integer.valueOf(strValue); } else if (Boolean.class.equals(type)) { return (T) Boolean.valueOf(strValue); } else if (Float.class.equals(type)) { return (T) Float.valueOf(strValue); } else if (Long.class.equals(type)) { return (T) Long.valueOf(strValue); } else if (Double.class.equals(type)) { return (T) Double.valueOf(strValue); } else if (TimeUnit.class.equals(type)) { return (T) TimeUnit.valueOf(strValue); } else { throw new IllegalArgumentException("Unsupported value type `" + type + "'"); } } else { throw new IllegalArgumentException("Incompatible value type `" + value.getClass() + "` while expecting '" + type + "`"); } } catch (Exception e) { throw new IllegalArgumentException("Error parsing value '" + value + "' for '" + key.key() + "'", e); } } else { return (T)value; } }); }
Source:
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http://localhost:8080;Id=0000000000000;Secret=MDAwMDAw"; tokenCredential = null; String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .buildClient(); } else { connectionString = Configuration.getGlobalConfiguration().get(AZURE_APPCONFIG_CONNECTION_STRING); tokenCredential = new DefaultAzureCredentialBuilder().build(); String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .addPolicy(interceptorManager.getRecordPolicy()) .buildClient(); } }

Target:
public void setup() throws InvalidKeyException, NoSuchAlgorithmException { if (interceptorManager.isPlaybackMode()) { connectionString = "Endpoint=http://localhost:8080;Id=0000000000000;Secret=MDAwMDAw"; String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .buildClient(); } else { connectionString = Configuration.getGlobalConfiguration().get(AZURE_APPCONFIG_CONNECTION_STRING); tokenCredential = new DefaultAzureCredentialBuilder().build(); String endpoint = new ConfigurationClientCredentials(connectionString).getBaseUri(); client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .addPolicy(interceptorManager.getRecordPolicy()) .buildClient(); } }
Source:
public void createFromSelectableStringAttributeAndSelectableNumberAttribute() { mockProductAttributeSettings(STRING_ATTRIBUTE_NAME, NUMBER_ATTRIBUTE_NAME); final List<ProductVariant> variants = Arrays.asList(mockProductVariant(stringAttribute1, numberAttribute1), mockProductVariant(stringAttribute2, numberAttribute2)); final AttributeWithProductType attributeWithProductType = AttributeWithProductType.of(stringAttribute1, productTypeRef); final SelectableProductAttributeViewModel attributeViewModel = viewModelFactory.create(variants, attributeWithProductType); final Map<String, Map<String, List<String>>> selectData = attributeViewModel.getSelectData(); assertThat(selectData).isNotEmpty(); final Map<String, List<String>> attribute1Data = selectData.get(stringAttribute1.getValueAsString()); assertThat(attribute1Data).containsKey(NUMBER_ATTRIBUTE_NAME); assertThat(attribute1Data.get(NUMBER_ATTRIBUTE_NAME)).containsExactly("120"); final Map<String, List<String>> attribute2Data = selectData.get(stringAttribute2.getValueAsString()); assertThat(attribute2Data).containsKey(NUMBER_ATTRIBUTE_NAME); assertThat(attribute2Data.get(NUMBER_ATTRIBUTE_NAME)).containsExactly("130"); }

Target:
public void createFromSelectableStringAttributeAndSelectableNumberAttribute() { final String stringValue = "v1"; final AttributeWithProductType stringAttributeWithProductType = attributeWithProductType(STRING_ATTRIBUTE_NAME, AttributeAccess.ofString(), stringValue); when(fakeAttributeFormatter.encodedValue(eq(stringAttributeWithProductType))).thenReturn(stringValue); final AttributeWithProductType numberAttributeWithProductType = attributeWithProductType(NUMBER_ATTRIBUTE_NAME, AttributeAccess.ofDouble(), 12.0); when(fakeAttributeFormatter.encodedValue(eq(numberAttributeWithProductType))).thenReturn("120"); mockProductAttributeSettings(STRING_ATTRIBUTE_NAME, NUMBER_ATTRIBUTE_NAME); final ProductVariant productVariant = mockProductVariant(stringAttributeWithProductType, numberAttributeWithProductType); final List<ProductVariant> variants = Collections.singletonList(productVariant); final SelectableProductAttributeViewModel attributeViewModel = viewModelFactory.create(variants, stringAttributeWithProductType); assertThat(attributeViewModel.getSelectData()) .hasSize(1) .containsEntry(stringValue, singletonMap(NUMBER_ATTRIBUTE_NAME, singletonList("120"))); }
Source:
public void perform(final IServer server) { IWorkbenchPart part = null; try { part = bringViewToFront(viewId); } catch(PartInitException pie) { WTPOveridePlugin.getInstance().getLog().log(new Status(IStatus.ERROR, WTPOveridePlugin.PLUGIN_ID, "Error loading MBean Explorer", pie)); } if( part != null ) { final CommonNavigator view = (CommonNavigator) part.getAdapter(CommonNavigator.class); if (view != null) { Display.getDefault().asyncExec(new Runnable() { public void run() { Object connection = adaptToViewItem(server); if( connection != null ) { view.getCommonViewer().collapseAll(); view.getCommonViewer().expandToLevel(2); ISelection sel = new StructuredSelection(new Object[] { connection }); view.getCommonViewer().setSelection(sel, true); } } }); } } }

Target:
public void perform(final IServer server) { IWorkbenchPart part = null; try { part = bringViewToFront(viewId); } catch(PartInitException pie) { CDKCoreActivator.pluginLog().logError("Error opening view " + viewId, pie); } if( part != null ) { final CommonNavigator view = (CommonNavigator) part.getAdapter(CommonNavigator.class); if (view != null && view.getCommonViewer() != null && view.getCommonViewer().getTree() != null && !view.getCommonViewer().getTree().isDisposed()){ Object connection = adaptToViewItem(server); if( connection != null ) { view.getCommonViewer().collapseAll(); view.getCommonViewer().expandToLevel(2); ISelection sel = new StructuredSelection(new Object[] { connection }); view.getCommonViewer().setSelection(sel, true); } } } }
Source:
private void openSubscriptionFilter() { SubscriptionFilterDialog filterDialog = new SubscriptionFilterDialog(getContext(), autoDownload,keepUpdated,autoDelete) { @Override protected void updateFilter(ArrayList<SubscriptionFilter> filterValues) { currentFeeds = new ArrayList<>(); for(SubscriptionFilter filter: filterValues){ switch (filter.getOption()) { case STRING_AUTO_DOWNLOAD: autoDownload = filter.getValue(); break; case STRING_KEEP_UPDATED: keepUpdated = filter.getValue(); break; case STRING_AUTO_DELETE: autoDelete = filter.getValue(); break; } } prefs.edit().putString(PREF_AUTO_DOWNLOAD,autoDownload).apply(); prefs.edit().putString(PREF_KEEP_UPDATED,keepUpdated).apply(); prefs.edit().putString(PREF_AUTO_DELETE,autoDelete).apply(); loadFilter(); } }; filterDialog.openDialog(); }

Target:
private void openSubscriptionFilter() { SubscriptionFilter.AutoDownload autoDownload= SubscriptionFilter.AutoDownload.valueOf(prefs.getString(PREF_AUTO_DOWNLOAD, SubscriptionFilter.STRING_NO_FILTER)); SubscriptionFilter.KeepUpdated keepUpdated = SubscriptionFilter.KeepUpdated.valueOf(prefs.getString(PREF_KEEP_UPDATED, SubscriptionFilter.STRING_NO_FILTER)); SubscriptionFilter.AutoDelete autoDelete = SubscriptionFilter.AutoDelete.valueOf(prefs.getString(PREF_AUTO_DELETE, SubscriptionFilter.STRING_NO_FILTER)); SubscriptionFilterDialog filterDialog = new SubscriptionFilterDialog(getContext(), autoDownload, keepUpdated, autoDelete) { @Override protected void updateFilter(SubscriptionFilter.AutoDownload autoDownload, SubscriptionFilter.KeepUpdated keepUpdated, SubscriptionFilter.AutoDelete autoDelete) { currentFeeds = new ArrayList<>(); prefs.edit().putString(PREF_AUTO_DOWNLOAD,autoDownload.name()).apply(); prefs.edit().putString(PREF_KEEP_UPDATED,keepUpdated.name()).apply(); prefs.edit().putString(PREF_AUTO_DELETE,autoDelete.name()).apply(); loadFilter(autoDownload, keepUpdated, autoDelete); } }; filterDialog.openDialog().show(); }
Source:
public void testBackgroundAppFunctionality() throws Exception { openStartActivity(); driver().backgroundApp(); String currentActivity = execCmd(System.getenv("ANDROID_HOME")+"/platform-tools/"+"adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'"); Assert.assertTrue(currentActivity.contains("com.android.launcher2.Launcher")); driver().resumeApp(); currentActivity = execCmd(System.getenv("ANDROID_HOME")+"/platform-tools/"+"adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'"); Assert.assertTrue(currentActivity.contains("io.selendroid.testapp.HomeScreenActivity")); }

Target:
public void testBackgroundAppFunctionality() throws Exception { openStartActivity(); driver().backgroundApp(); String currentActivity = adbCurrentActivity(); Assert.assertTrue(currentActivity.contains("com.android.launcher2.Launcher")); driver().resumeApp(); currentActivity = adbCurrentActivity(); Assert.assertTrue(currentActivity.contains("io.selendroid.testapp.HomeScreenActivity")); }
Source:
private static Map<String, VisorBaselineNode> toMapWithResolvedAddresses(Collection<? extends BaselineNode> nodes) { if (F.isEmpty(nodes)) return null; Map<String, VisorBaselineNode> map = new TreeMap<>(); for (BaselineNode node : nodes) { Collection<IgniteBiTuple<String, String>> addrs = Collections.emptyList(); if (node instanceof IgniteClusterNode) { try { addrs = IgniteUtils.toInetAddresses((ClusterNode)node).stream() .map(addr -> new IgniteBiTuple<>(addr.getHostAddress(), addr.getHostName())) .collect(Collectors.toList()); } catch (IgniteCheckedException ex) { throw IgniteUtils.convertException(ex); } } VisorBaselineNode dto = new VisorBaselineNode(node, addrs); map.put(dto.getConsistentId(), dto); } return map; }

Target:
private static Map<String, VisorBaselineNode> toMapWithResolvedAddresses(Collection<? extends BaselineNode> nodes) { if (F.isEmpty(nodes)) return null; Map<String, VisorBaselineNode> map = new TreeMap<>(); for (BaselineNode node : nodes) { Collection<VisorBaselineNode.ResolvedAddresses> addrs = new ArrayList<>(); if (node instanceof IgniteClusterNode) { for (InetAddress inetAddress: resolveInetAddresses((ClusterNode)node)) addrs.add(new VisorBaselineNode.ResolvedAddresses(inetAddress)); } VisorBaselineNode dto = new VisorBaselineNode(node, addrs); map.put(dto.getConsistentId(), dto); } return map; }
Source:
protected Event doExecute(final RequestContext requestContext) { val authentication = WebUtils.getAuthentication(requestContext); val principal = authentication.getPrincipal(); val flowId = requestContext.getActiveFlow().getId(); val applicationContext = ApplicationContextProvider.getApplicationContext(); val provider = (DuoMultifactorAuthenticationProvider) MultifactorAuthenticationUtils.getMultifactorAuthenticationProviderById(flowId, applicationContext).orElseThrow(AuthenticationException::new); val enrollEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ENROLL); val denyEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_DENY); val unavailableEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE); val errorEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ERROR); val duoAuthenticationService = provider.getDuoAuthenticationService(); val account = duoAuthenticationService.getDuoUserAccount(principal.getId()); switch (account.getStatus()) { case ENROLL: if (!StringUtils.isEmpty(provider.getRegistrationUrl())) { LOGGER.error("Duo webflow resolved to event ENROLL, but no registration url was provided."); return errorEvent; } requestContext.getFlowScope().put("duoRegistrationUrl", provider.getRegistrationUrl()); return enrollEvent; case ALLOW: return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_BYPASS); case DENY: return denyEvent; case UNAVAILABLE: return unavailableEvent; default: } return success(); }

Target:
protected Event doExecute(final RequestContext requestContext) throws Exception { val authentication = WebUtils.getAuthentication(requestContext); val principal = authentication.getPrincipal(); val duoAuthenticationService = provider.getDuoAuthenticationService(); val account = duoAuthenticationService.getDuoUserAccount(principal.getId()); if (account.getStatus() == DuoUserAccountAuthStatus.ENROLL) { if (StringUtils.isBlank(provider.getRegistrationUrl())) { LOGGER.error("Duo webflow resolved to event ENROLL, but no registration url was provided."); return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ERROR); } requestContext.getFlowScope().put("duoRegistrationUrl", provider.getRegistrationUrl()); return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ENROLL); } if (account.getStatus() == DuoUserAccountAuthStatus.ALLOW) { return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_BYPASS); } if (account.getStatus() == DuoUserAccountAuthStatus.DENY) { return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_DENY); } if (account.getStatus() == DuoUserAccountAuthStatus.UNAVAILABLE) { return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE); } return success(); }
Source:
public O evaluate(IotasEvent iotasEvent) throws ScriptException { log.debug("Evaluating {}" + iotasEvent); if (iotasEvent != null) { for (Map.Entry<String, Object> fieldAndValue : iotasEvent.getFieldsAndValues().entrySet()) { log.debug("{Putting into engine key = {}, val = {}", fieldAndValue.getKey(), fieldAndValue.getValue()); scriptEngine.put(fieldAndValue.getKey(), fieldAndValue.getValue()); } } final O result = (O) scriptEngine.eval(scriptText); log.debug("Expression evaluated to [{}]", scriptText, result); return result; }

Target:
public O evaluate(IotasEvent iotasEvent) throws ScriptException { log.debug("Evaluating with [{}]", expression, iotasEvent); O evaluatedResult = null; if (iotasEvent != null) { final Map<String, Object> fieldsToValues = iotasEvent.getFieldsAndValues(); if (fieldsToValues != null) { getEngineScopeBindings().putAll(fieldsToValues); log.debug("Set script binding to [{}]", fieldsToValues); evaluatedResult = (O) scriptEngine.eval(expression); log.debug("Expression evaluated to [{}]", expression, evaluatedResult); } } return evaluatedResult; }
Source:
public void testDeleteCommentAsAdmin() { assertTrue(this.commentsTab.isCommentFormShown()); this.commentsTab.postComment(COMMENT_CONTENT, true); this.commentsTab.deleteCommentByID(this.commentsTab.getCommentID(COMMENT_CONTENT)); assertEquals(this.commentsTab.getCommentID(COMMENT_CONTENT), -1); }

Target:
public void testDeleteCommentAsAdmin() { assertTrue(this.commentsTab.isCommentFormShown()); this.commentsTab.postComment(COMMENT_CONTENT, true); this.commentsTab.deleteCommentByID(this.commentsTab.getCommentID(COMMENT_CONTENT)); assertEquals(-1, this.commentsTab.getCommentID(COMMENT_CONTENT)); }
Source:
public void resetAuthenticator() { if (useProxyAuth && useHttpsServer && !okUsable) { Authenticator.setDefault(null); } System.setProperty("jdk.http.auth.tunneling.disabledSchemes", defaultDisabledList); }

Target:
public void resetAuthenticator() { if (useProxyAuth && useHttpsServer && !okUsable) { Authenticator.setDefault(null); System.setProperty("jdk.http.auth.tunneling.disabledSchemes", defaultDisabledList); } }
Source:
public static boolean execute(WebhookResponse webhook) throws IOException { return execute(webhook.getAnonymousExecutionURI()); }

Target:
public static boolean execute(WebhookResponse webhook) throws IOException { return execute(webhook.getAnonymousExecutionURI().get()); }
Source:
synchronized void deleteOldRedisplayedInAppMessages() { long sixMonthsAgo = System.currentTimeMillis() / 1000 - SIX_MONTHS_TIME_SECONDS; SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); writableDb.delete(OneSignalDbContract.InAppMessageTable.TABLE_NAME, OneSignalDbContract.InAppMessageTable.COLUMN_NAME_LAST_DISPLAY + "<?", new String[]{String.valueOf(sixMonthsAgo)}); writableDb.close(); }

Target:
synchronized void deleteOldRedisplayedInAppMessages() { long sixMonthsAgo = System.currentTimeMillis() / 1000 - OS_IAM_MAX_CACHE_TIME; SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); writableDb.delete(OneSignalDbContract.InAppMessageTable.TABLE_NAME, OneSignalDbContract.InAppMessageTable.COLUMN_NAME_LAST_DISPLAY + "< ?", new String[]{String.valueOf(sixMonthsAgo)}); writableDb.close(); }
Source:
public boolean listPartitionsSpecByExpr(String catName, String dbName, String tblName, byte[] expr, String defaultPartitionName, short maxParts, List<PartitionSpec> result) throws TException { assert result != null; PartitionsByExprRequest req = new PartitionsByExprRequest( dbName, tblName, ByteBuffer.wrap(expr)); if (defaultPartitionName != null) { req.setDefaultPartitionName(defaultPartitionName); } if (maxParts >= 0) { req.setMaxParts(maxParts); } PartitionsSpecByExprResult r; try { r = client.get_partitions_spec_by_expr(req); } catch (TApplicationException te) { if (te.getType() != TApplicationException.UNKNOWN_METHOD && te.getType() != TApplicationException.WRONG_METHOD_NAME) { throw te; } throw new IncompatibleMetastoreException( "Metastore doesn't support listPartitionsByExpr: " + te.getMessage()); } r.setPartitionsSpec(r.getPartitionsSpec()); result.addAll(r.getPartitionsSpec()); return !r.isSetHasUnknownPartitions() || r.isHasUnknownPartitions(); }

Target:
public boolean listPartitionsSpecByExpr(String catName, String dbName, String tblName, byte[] expr, String defaultPartitionName, short maxParts, List<PartitionSpec> result) throws TException { assert result != null; PartitionsByExprRequest req = new PartitionsByExprRequest( dbName, tblName, ByteBuffer.wrap(expr)); if (defaultPartitionName != null) { req.setDefaultPartitionName(defaultPartitionName); } if (maxParts >= 0) { req.setMaxParts(maxParts); } PartitionsSpecByExprResult r; try { r = client.get_partitions_spec_by_expr(req); } catch (TApplicationException te) { if (te.getType() != TApplicationException.UNKNOWN_METHOD && te.getType() != TApplicationException.WRONG_METHOD_NAME) { throw te; } throw new IncompatibleMetastoreException( "Metastore doesn't support listPartitionsByExpr: " + te.getMessage()); } r.setPartitionsSpec(FilterUtils.filterPartitionSpecsIfEnabled( isClientFilterEnabled, filterHook, r.getPartitionsSpec())); result.addAll(r.getPartitionsSpec()); return !r.isSetHasUnknownPartitions() || r.isHasUnknownPartitions(); }