auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void trackFirmwares(final Map<String, Integer> seenFirmwares) { trackDeviceFirmwares(ImmutableMap.copyOf(seenFirmwares)); }

Target:
public void trackFirmwares(final Map<String, Integer> seenFirmwares) { Jedis jedis = null; try { jedis = jedisPool.getResource(); final Pipeline pipe = jedis.pipelined(); pipe.multi(); for(Map.Entry<String, Integer> entry : seenFirmwares.entrySet()) { pipe.sadd(ActiveDevicesTrackerConfiguration.FIRMWARES_SEEN_SET_KEY, entry.getValue().toString()); pipe.zadd(entry.getValue().toString(), DateTime.now().getMillis(), entry.getKey()); } pipe.exec(); }catch (JedisDataException exception) { LOGGER.error("Failed getting data out of redis: {}", exception.getMessage()); jedisPool.returnBrokenResource(jedis); return; } catch(Exception exception) { LOGGER.error("Unknown error connection to redis: {}", exception.getMessage()); jedisPool.returnBrokenResource(jedis); return; } finally { try{ jedisPool.returnResource(jedis); }catch (JedisConnectionException e) { LOGGER.error("Jedis Connection Exception while returning resource to pool. Redis server down?"); } } LOGGER.debug("Tracked device firmware versions", seenFirmwares.size()); }
Source:
public Collection<StatisticDescriptor> getDescriptors() { Set<StatisticDescriptor> descriptors = new HashSet<StatisticDescriptor>(); for (Map.Entry<String, ValueStatistic<? extends Number>> entry : statistics.entrySet()) { String fullStatName = entry.getKey(); StatisticType type = statisticTypes.get(fullStatName); descriptors.add(new StatisticDescriptor(fullStatName, type.name())); } return descriptors; }

Target:
public Collection<StatisticDescriptor> getDescriptors() { Set<StatisticDescriptor> descriptors = new HashSet<StatisticDescriptor>(statistics.size()); for (Map.Entry<String, ValueStatistic<? extends Number>> entry : statistics.entrySet()) { String fullStatName = entry.getKey(); StatisticType type = statisticTypes.get(fullStatName); descriptors.add(new StatisticDescriptor(fullStatName, type.name())); } return descriptors; }
Source:
public boolean isFragment(Bundle bundle) { PlatformAdmin platformAdmin = getPlatformAdmin(); if (platformAdmin == null) return false; return false; }

Target:
public boolean isFragment(Bundle bundle) { BundleRevisions bundleRevisions = bundle.adapt(BundleRevisions.class); List<BundleRevision> revisions = bundleRevisions.getRevisions(); if (revisions.isEmpty()) { return false; } return (revisions.get(0).getTypes() & BundleRevision.TYPE_FRAGMENT) != 0; }
Source:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; int status = -1; GetMethod get = null; try { get = new GetMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH); Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH); get.setQueryString(new NameValuePair[] { new NameValuePair(PARAM_PATH, mRemoteFilePath), new NameValuePair(PARAM_RESHARES, String.valueOf(mReshares)), new NameValuePair(PARAM_SUBFILES, String.valueOf(mSubfiles)) }); get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE); status = client.executeMethod(get); if(isSuccess(status)) { String response = get.getResponseBodyAsString(); Log.d(TAG, "Successful response: " + response); result = new RemoteOperationResult(ResultCode.OK); InputStream is = new ByteArrayInputStream(response.getBytes()); ShareXMLParser xmlParser = new ShareXMLParser(); mShares = xmlParser.parseXMLResponse(is); if (mShares != null) { Log.d(TAG, "Shares: " + mShares.size()); result = new RemoteOperationResult(ResultCode.OK); ArrayList<Object> sharesObjects = new ArrayList<Object>(); for (OCShare share: mShares) { sharesObjects.add(share); } result.setData(sharesObjects); } } else { result = new RemoteOperationResult(false, status, get.getResponseHeaders()); } } catch (Exception e) { result = new RemoteOperationResult(e); Log.e(TAG, "Exception while Creating New Share", e); } finally { if (get != null) { get.releaseConnection(); } } return result; }

Target:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; int status = -1; GetMethod get = null; try { get = new GetMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH); Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH); get.setQueryString(new NameValuePair[] { new NameValuePair(PARAM_PATH, mRemoteFilePath), new NameValuePair(PARAM_RESHARES, String.valueOf(mReshares)), new NameValuePair(PARAM_SUBFILES, String.valueOf(mSubfiles)) }); get.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE); status = client.executeMethod(get); if(isSuccess(status)) { String response = get.getResponseBodyAsString(); Log.d(TAG, "Successful response: " + response); result = new RemoteOperationResult(ResultCode.OK); InputStream is = new ByteArrayInputStream(response.getBytes()); ShareXMLParser xmlParser = new ShareXMLParser(); mShares = xmlParser.parseXMLResponse(is); if (mShares != null) { Log.d(TAG, "Shares: " + mShares.size()); result = new RemoteOperationResult(ResultCode.OK); ArrayList<Object> sharesObjects = new ArrayList<Object>(); for (OCShare share: mShares) { sharesObjects.add(share); } result.setData(sharesObjects); } } else { result = new RemoteOperationResult(false, status, get.getResponseHeaders()); } } catch (Exception e) { result = new RemoteOperationResult(e); Log.e(TAG, "Exception while Creating New Share", e); } finally { if (get != null) { get.releaseConnection(); } } return result; }
Source:
protected void applyRecoverStrategy(final Channel channel) throws MuleException { MuleMessage currentMessage = RequestContext.getEvent().getMessage(); Long deliveryTag = getDeliveryTagOrFail(currentMessage, NACK_CHANNEL_ACTION); try { switch (recoverStrategy) { case NONE : try { channel.txRollback(); if (logger.isDebugEnabled()) { logger.debug("Rolled back AMQP transaction (" + recoverStrategy + ") on channel: " + channel); } } catch (final IOException ioe) { throw new TransactionException(CoreMessages.transactionRollbackFailed(), ioe); } break; case NO_REQUEUE : channel.basicReject(deliveryTag,false); channel.txCommit(); break; case REQUEUE : channel.basicReject(deliveryTag, true); channel.txCommit(); break; } if ((recoverStrategy != NONE) && (logger.isDebugEnabled())) { logger.debug("Applied " + recoverStrategy + " recover strategy on channel: " + channel); } } catch (final IOException ioe) { logger.warn("Failed to recover channel " + channel + " after rollback (recoverStrategy is " + recoverStrategy + ")"); } }

Target:
protected void applyRecoverStrategy(final Channel channel) throws MuleException { MuleMessage currentMessage = RequestContext.getEvent().getMessage(); Long deliveryTag = getDeliveryTagOrFail(currentMessage, NACK_CHANNEL_ACTION); try { switch (recoverStrategy) { case NONE : break; case NO_REQUEUE : channel.basicReject(deliveryTag,false); channel.txCommit(); break; case REQUEUE : channel.basicReject(deliveryTag, true); channel.txCommit(); break; } if ((recoverStrategy != NONE) && (logger.isDebugEnabled())) { logger.debug("Applied " + recoverStrategy + " recover strategy on channel: " + channel); } } catch (final IOException ioe) { logger.warn("Failed to recover channel " + channel + " after rollback (recoverStrategy is " + recoverStrategy + ")"); } }
Source:
public void showProblemColumns(Column... columns) { if (columns != null && columns.length > 0) { List<String> problemColumns = getProblemColumns(); openConfigureColumnsShell(); for (Column column: columns) { if (!problemColumns.contains(column.toString())) { for (TableItem item: new DefaultTable(0).getItems()) { if (column.toString().equals(item.getText())) { item.select(); break; } } new PushButton("Show ->").click(); } } confirmChangesAndCloseConfigureColumnsShell(); } }

Target:
public void showProblemColumns(Column... columns) { String[] columnsToShow = getColumnsToShow(columns); if (columnsToShow.length > 0) { openConfigureColumnsShell(); new DefaultTable(0).select(columnsToShow); new PushButton("Show ->").click(); confirmChangesAndCloseConfigureColumnsShell(); } }
Source:
public void setProgress(final int val, final int max) { boolean processing = getLegacyService().setProcessingEvents(true); if (processing) return; try { final IJ1Helper ij1helper = helper(); if (ij1helper != null) ij1helper.setProgress(val, max); } finally { final LegacyService LegacyService = getLegacyService(); if (LegacyService != null) LegacyService.setProcessingEvents(processing); } }

Target:
public void setProgress(final int val, final int max) { boolean processing = getLegacyService().setProcessingEvents(true); if (processing) return; try { final IJ1Helper ij1Helper = helper(); if (ij1Helper != null) ij1Helper.setProgress(val, max); } finally { final LegacyService legacyService = getLegacyService(); if (legacyService != null) legacyService.setProcessingEvents(processing); } }
Source:
public static String getGroupId(GroupApi groupApi) { for ( GroupState state : groupApi.listGroupStates() ) { Group g = groupApi.get(state.getId()); for ( ScalingPolicyResponse policy : g.getScalingPolicies() ) { if (policy.getName().equals(NAME)) return g.getId(); } } throw new RuntimeException("Group not found"); }

Target:
public static String getGroupId(GroupApi groupApi) { for ( GroupState state : groupApi.listGroupStates() ) { Group g = groupApi.get(state.getId()); for ( ScalingPolicyResponse policy : g.getScalingPolicies() ) { if (policy.getName().equals(NAME)) return g.getId(); } } throw new IllegalArgumentException("Group not found"); }
Source:
public static SmallIntSet of(int i1) { SmallIntSet set = new SmallIntSet(1); set.set(i1); return set; }

Target:
public static SmallIntSet of(int i1) { SmallIntSet set = new SmallIntSet(); set.set(i1); return set; }
Source:
public void adjustViewport( @NotNull final SPath path, final LineRange range, final TextSelection selection) { Set<String> visibleFilePaths = new HashSet<>(); for (VirtualFile virtualFile : projectAPI.getSelectedFiles()) { visibleFilePaths.add(virtualFile.getPath()); } VirtualFile passedFile = VirtualFileConverter.convertToVirtualFile(path); if (passedFile == null) { LOG.warn( "Ignoring request to adjust viewport as no valid VirtualFile could be found for " + path + " - given range: " + range + ", given selection: " + selection); return; } Editor editor = editorPool.getEditor(path); if (!visibleFilePaths.contains(passedFile.getPath())) { localEditorStatusChangeHandler.queueViewPortChange( passedFile.getPath(), editor, range, selection); return; } if (editor == null) { LOG.warn( "Failed to adjust viewport for " + path + " as it is not known to the editor pool even though it is currently open"); return; } ApplicationManager.getApplication() .invokeAndWait(() -> localEditorManipulator.adjustViewport(editor, range, selection)); }

Target:
public void adjustViewport( @NotNull final SPath path, final LineRange range, final TextSelection selection) { Set<String> visibleFilePaths = new HashSet<>(); for (VirtualFile virtualFile : projectAPI.getSelectedFiles()) { visibleFilePaths.add(virtualFile.getPath()); } VirtualFile passedFile = VirtualFileConverter.convertToVirtualFile(path); if (passedFile == null) { LOG.warn( "Ignoring request to adjust viewport as no valid VirtualFile could be found for " + path + " - given range: " + range + ", given selection: " + selection); return; } Editor editor = editorPool.getEditor(path); if (!visibleFilePaths.contains(passedFile.getPath())) { localEditorStatusChangeHandler.queueViewPortChange( passedFile.getPath(), editor, range, selection); return; } if (editor == null) { LOG.warn( "Failed to adjust viewport for " + path + " as it is not known to the editor pool even though it is currently open"); return; } executeInUIThreadSynchronous( () -> localEditorManipulator.adjustViewport(editor, range, selection)); }
Source:
private void reportTimer(long timestamp, String name, Timer timer) { final Snapshot snapshot = timer.getSnapshot(); report(timestamp, name, "count,max,mean,min,stddev,p50,p75,p95,p98,p99,p999,mean_rate,m1_rate,m5_rate,m15_rate,rate_unit,duration_unit", "%d" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "%f" + separator + "calls/%s" + separator + "%s", timer.getCount(), convertDuration(snapshot.getMax()), convertDuration(snapshot.getMean()), convertDuration(snapshot.getMin()), convertDuration(snapshot.getStdDev()), convertDuration(snapshot.getMedian()), convertDuration(snapshot.get75thPercentile()), convertDuration(snapshot.get95thPercentile()), convertDuration(snapshot.get98thPercentile()), convertDuration(snapshot.get99thPercentile()), convertDuration(snapshot.get999thPercentile()), convertRate(timer.getMeanRate()), convertRate(timer.getOneMinuteRate()), convertRate(timer.getFiveMinuteRate()), convertRate(timer.getFifteenMinuteRate()), getRateUnit(), getDurationUnit()); }

Target:
private void reportTimer(long timestamp, String name, Timer timer) { final Snapshot snapshot = timer.getSnapshot(); report(timestamp, name, "count,max,mean,min,stddev,p50,p75,p95,p98,p99,p999,mean_rate,m1_rate,m5_rate,m15_rate,rate_unit,duration_unit", timerFormat, timer.getCount(), convertDuration(snapshot.getMax()), convertDuration(snapshot.getMean()), convertDuration(snapshot.getMin()), convertDuration(snapshot.getStdDev()), convertDuration(snapshot.getMedian()), convertDuration(snapshot.get75thPercentile()), convertDuration(snapshot.get95thPercentile()), convertDuration(snapshot.get98thPercentile()), convertDuration(snapshot.get99thPercentile()), convertDuration(snapshot.get999thPercentile()), convertRate(timer.getMeanRate()), convertRate(timer.getOneMinuteRate()), convertRate(timer.getFiveMinuteRate()), convertRate(timer.getFifteenMinuteRate()), getRateUnit(), getDurationUnit()); }
Source:
private void makeList(int minLen, int maxLen, String baseCase, BaseCase baseCaseObj) { for (int x = minLen; x <= maxLen; x++) { while (listindex[0] < list.length) { try { showString(x, baseCase, baseCaseObj); incrementCounter(x); Thread.sleep(20); } catch (InterruptedException ex) { LOG.error("makeList " + ex.toString()); } } initIndex(); } }

Target:
private void makeList(int minLen, int maxLen, String baseCase, BaseCase baseCaseObj) { for (int x = minLen; x <= maxLen; x++) { while (listindex[0] < list.length) { try { showString(x, baseCase, baseCaseObj); incrementCounter(x); Thread.sleep(20); } catch (InterruptedException ex) { if (LOG.isDebugEnabled()) { LOG.error("makeList " + ex.toString()); } } } initIndex(); } }
Source:
private long getDistanceDifferentTimelines(final NakadiCursor initialCursor, final NakadiCursor finalCursor) { long distance = 0; distance += totalEventsInTimeline(initialCursor) - numberOfEventsBeforeCursor(initialCursor); final String partitionString = initialCursor.getPartition(); for (int order = initialCursor.getTimeline().getOrder() + 1; order < finalCursor.getTimeline().getOrder(); order++) { final Timeline timeline = getTimeline(initialCursor.getTopic(), order); distance += totalEventsInTimeline(timeline, partitionString); } distance += numberOfEventsBeforeCursor(finalCursor); return distance; }

Target:
private long getDistanceDifferentTimelines(final NakadiCursor initialCursor, final NakadiCursor finalCursor) { long distance = 0; if (numberOfEventsBeforeCursor(initialCursor) < 0) { distance += totalEventsInTimeline(initialCursor); } else { distance += totalEventsInTimeline(initialCursor) - numberOfEventsBeforeCursor(initialCursor) - 1; } final String partitionString = initialCursor.getPartition(); for (int order = initialCursor.getTimeline().getOrder() + 1; order < finalCursor.getTimeline().getOrder(); order++) { final Timeline timeline = getTimeline(initialCursor.getEventType(), order); distance += totalEventsInTimeline(timeline, partitionString); } distance += numberOfEventsBeforeCursor(finalCursor) + 1; return distance; }
Source:
public void testShowTablesMultiTenant() throws Exception { String tenantId2 = "T_" + generateUniqueName(); String secondTenantConnectionURL = PHOENIX_JDBC_TENANT_SPECIFIC_URL.replace(TENANT_ID, tenantId2); String tenantTable2 = "V_" + generateUniqueName(); createTestTable(secondTenantConnectionURL, TENANT_TABLE_DDL.replace(TENANT_TABLE_NAME, tenantTable2)); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { Set<String> tables = new HashSet<>(); ResultSet rs = conn.prepareStatement("show tables").executeQuery(); while (rs.next()) tables.add(rs.getString("TABLE_NAME")); assertTrue(tables.contains(PARENT_TABLE_NAME)); assertTrue(tables.contains(TENANT_TABLE_NAME)); assertTrue(tables.contains(tenantTable2)); } try (Connection conn = DriverManager.getConnection(secondTenantConnectionURL, props)) { Set<String> tables = new HashSet<>(); ResultSet rs = conn.prepareStatement("show tables").executeQuery(); while (rs.next()) tables.add(rs.getString("TABLE_NAME")); assertTrue(tables.contains(PARENT_TABLE_NAME)); assertFalse(tables.contains(TENANT_TABLE_NAME)); assertTrue(tables.contains(tenantTable2)); } }

Target:
public void testShowTablesMultiTenant() throws Exception { String tenantId2 = "T_" + generateUniqueName(); String secondTenantConnectionURL = PHOENIX_JDBC_TENANT_SPECIFIC_URL.replace(TENANT_ID, tenantId2); String tenantTable2 = "V_" + generateUniqueName(); createTestTable( secondTenantConnectionURL, TENANT_TABLE_DDL.replace(TENANT_TABLE_NAME, tenantTable2)); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { Set<String> tables = new HashSet<>(); ResultSet rs = conn.prepareStatement("show tables").executeQuery(); while (rs.next()) { tables.add(rs.getString("TABLE_NAME")); } assertTrue(tables.contains(PARENT_TABLE_NAME)); assertTrue(tables.contains(TENANT_TABLE_NAME)); assertTrue(tables.contains(tenantTable2)); } try (Connection conn = DriverManager.getConnection(secondTenantConnectionURL, props)) { Set<String> tables = new HashSet<>(); ResultSet rs = conn.prepareStatement("show tables").executeQuery(); while (rs.next()) { tables.add(rs.getString("TABLE_NAME")); } assertTrue(tables.contains(PARENT_TABLE_NAME)); assertFalse(tables.contains(TENANT_TABLE_NAME)); assertTrue(tables.contains(tenantTable2)); } }
Source:
public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { ResponseQueueReader reader = new ResponseQueueReader(); ScanHandler scanHandler = createReadRowsRetryListener(request, reader); reader.setScanHandler(scanHandler); return new ResumingStreamingResultScanner(reader, scanHandler); }

Target:
public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { final ResponseQueueReader reader = new ResponseQueueReader(); RetryingReadRowsOperation operation = createReadRowsRetryListener(request, reader); operation.setResultObserver(new StreamObserver<ReadRowsResponse>(){ @Override public void onNext(ReadRowsResponse value) { reader.addRequestResultMarker(); } @Override public void onError(Throwable t) @Override public void onCompleted() }); operation.getAsyncResult(); return new ResumingStreamingResultScanner(reader, operation); }
Source:
public void validateWebAnnotation(Annotation webAnnotation) throws ParamValidationException, RequestBodyValidationException { if (webAnnotation.getCanonical() != null) { try { URI cannonicalUri = URI.create(webAnnotation.getCanonical()); if (!cannonicalUri.isAbsolute()) throw new ParamValidationException("The canonical URI is not absolute:", I18nConstants.ANNOTATION_VALIDATION, new String[] { WebAnnotationFields.CANONICAL, webAnnotation.getCanonical() }); } catch (IllegalArgumentException e) { throw new ParamValidationException("Error when validating canonical URI:", I18nConstants.ANNOTATION_VALIDATION, new String[] { WebAnnotationFields.CANONICAL, webAnnotation.getCanonical() }, e); } } if (webAnnotation.getVia() != null) { if (webAnnotation.getVia() instanceof String[]) { for (String via : webAnnotation.getVia()) { if (!(UriUtils.isUrl(via))) throw new ParamValidationException("This is not a valid URL:", I18nConstants.ANNOTATION_VALIDATION, new String[] { WebAnnotationFields.VIA, via }); } } } switch (webAnnotation.getMotivationType()) { case LINKING: if (webAnnotation.getTarget() != null) { if (webAnnotation.getTarget().getValue() != null) validateResource(webAnnotation.getTarget().getValue()); if (webAnnotation.getTarget().getValues() != null) for (String url : webAnnotation.getTarget().getValues()) { validateResource(url); } } break; case TAGGING: validateTag(webAnnotation); break; case TRANSCRIBING: validateTranscribing(webAnnotation); validateEdmRights(webAnnotation); break; default: break; } }

Target:
public void validateWebAnnotation(Annotation webAnnotation) throws ParamValidationException, RequestBodyValidationException { if (webAnnotation.getCanonical() != null) { try { URI cannonicalUri = URI.create(webAnnotation.getCanonical()); if (!cannonicalUri.isAbsolute()) throw new ParamValidationException("The canonical URI is not absolute:", I18nConstants.ANNOTATION_VALIDATION, new String[] { WebAnnotationFields.CANONICAL, webAnnotation.getCanonical() }); } catch (IllegalArgumentException e) { throw new ParamValidationException("Error when validating canonical URI:", I18nConstants.ANNOTATION_VALIDATION, new String[] { WebAnnotationFields.CANONICAL, webAnnotation.getCanonical() }, e); } } if (webAnnotation.getVia() != null) { if (webAnnotation.getVia() instanceof String[]) { for (String via : webAnnotation.getVia()) { if (!(UriUtils.isUrl(via))) throw new ParamValidationException("This is not a valid URL:", I18nConstants.ANNOTATION_VALIDATION, new String[] { WebAnnotationFields.VIA, via }); } } } switch (webAnnotation.getMotivationType()) { case LINKING: if (webAnnotation.getTarget() != null) { if (webAnnotation.getTarget().getValue() != null) validateResource(webAnnotation.getTarget().getValue()); if (webAnnotation.getTarget().getValues() != null) for (String url : webAnnotation.getTarget().getValues()) { validateResource(url); } } break; case TAGGING: validateTag(webAnnotation); break; case TRANSCRIBING: validateTranscription(webAnnotation); break; default: break; } }
Source:
public Optional<Database> getDatabase(String databaseName) { try { return retry() .stopOn(NoSuchObjectException.class) .stopOnIllegalExceptions() .run("getDatabase", stats.getGetDatabase().wrap(() -> wrapHMSCallable((HiveMetastoreClient client, ThriftHiveMetastoreStats stat) -> Optional.of(stat.getGetDatabase().wrapCall(() -> client.getDatabase(databaseName)))))); } catch (NoSuchObjectException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }

Target:
public Optional<Database> getDatabase(String databaseName) { try { return retry() .stopOn(NoSuchObjectException.class) .stopOnIllegalExceptions() .run("getDatabase", stats.getGetDatabase().wrap(() -> wrapMetastoreCallable((HiveMetastoreClient client, ThriftHiveMetastoreStats stat) -> Optional.of(stat.getGetDatabase().wrapCall(() -> client.getDatabase(databaseName)))))); } catch (NoSuchObjectException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }
Source:
private boolean hasRowExpiredOnSource(Long sourceTS, Long ttl) { long currentTS = System.currentTimeMillis(); if (sourceTS + ttl < currentTS) { return true; } else { return false; } }

Target:
protected boolean hasRowExpiredOnSource(Long sourceTS, Long ttl) { long currentTS = EnvironmentEdgeManager.currentTimeMillis(); return ttl != Integer.MAX_VALUE && sourceTS + ttl*1000 < currentTS; }
Source:
public static Schema getSchema(Object object) throws IllegalArgumentException { if (object == null) { return PRIMITIVE_SCHEMAS.get("Null"); } else if (object instanceof Boolean) { return PRIMITIVE_SCHEMAS.get("Boolean"); } else if (object instanceof Integer) { return PRIMITIVE_SCHEMAS.get("Integer"); } else if (object instanceof Long) { return PRIMITIVE_SCHEMAS.get("Long"); } else if (object instanceof Float) { return PRIMITIVE_SCHEMAS.get("Float"); } else if (object instanceof Double) { return PRIMITIVE_SCHEMAS.get("Double"); } else if (object instanceof CharSequence) { return PRIMITIVE_SCHEMAS.get("String"); } else if (object instanceof byte[]) { return PRIMITIVE_SCHEMAS.get("Bytes"); } else if (object instanceof GenericContainer) { return ((GenericContainer) object).getSchema(); } else { ClientLogger logger = new ClientLogger(AvroSchemaUtils.class); throw logger.logExceptionAsError( new IllegalArgumentException( "Unsupported Avro type. Supported types are null, Boolean, Integer, Long, " + "Float, Double, String, byte[] and IndexedRecord")); } }

Target:
public static Schema getSchema(Object object) throws IllegalArgumentException { if (object == null) { return PRIMITIVE_SCHEMAS.get("Null"); } else if (object instanceof Boolean) { return PRIMITIVE_SCHEMAS.get("Boolean"); } else if (object instanceof Integer) { return PRIMITIVE_SCHEMAS.get("Integer"); } else if (object instanceof Long) { return PRIMITIVE_SCHEMAS.get("Long"); } else if (object instanceof Float) { return PRIMITIVE_SCHEMAS.get("Float"); } else if (object instanceof Double) { return PRIMITIVE_SCHEMAS.get("Double"); } else if (object instanceof CharSequence) { return PRIMITIVE_SCHEMAS.get("String"); } else if (object instanceof byte[] || object instanceof ByteBuffer) { return PRIMITIVE_SCHEMAS.get("Bytes"); } else if (object instanceof GenericContainer) { return ((GenericContainer) object).getSchema(); } else { ClientLogger logger = new ClientLogger(AvroSchemaUtils.class); throw logger.logExceptionAsError( new IllegalArgumentException( "Unsupported Avro type. Supported types are null, Boolean, Integer, Long, " + "Float, Double, String, byte[] and IndexedRecord")); } }
Source:
private void resolveConfigurations(Rule rule) { List<ConfigDescriptionParameter> configDescriptions = rule.getConfigurationDescriptions(); Configuration configuration = rule.getConfiguration(); ConfigurationNormalizer.normalizeConfiguration(configuration, ConfigurationNormalizer.getConfigDescriptionMap(configDescriptions)); Map<String, Object> configurationProperties = configuration.getProperties(); if (rule.getTemplateUID() == null) { String uid = rule.getUID(); try { validateConfiguration(configDescriptions, new HashMap<>(configurationProperties)); resolveModuleConfigReferences(rule.getModules(Module.class), configurationProperties); ConfigurationNormalizer.normalizeModuleConfigurations(rule.getModules(Module.class), moduleTypeRegistry); } catch (Exception e) { RuleStatusInfo statusInfo = disabledRulesStorage != null && disabledRulesStorage.get(uid) == null ? new RuleStatusInfo(RuleStatus.UNINITIALIZED, RuleStatusDetail.CONFIGURATION_ERROR, e.getLocalizedMessage()) : new RuleStatusInfo(RuleStatus.DISABLED, RuleStatusDetail.CONFIGURATION_ERROR, e.getLocalizedMessage()); addToRuleEngine(rule, statusInfo); throw new IllegalArgumentException(String.format("The rule '%s' has incorrect configurations", uid), e); } } }

Target:
private void resolveConfigurations(Rule rule) { List<ConfigDescriptionParameter> configDescriptions = rule.getConfigurationDescriptions(); Configuration configuration = rule.getConfiguration(); ConfigurationNormalizer.normalizeConfiguration(configuration, ConfigurationNormalizer.getConfigDescriptionMap(configDescriptions)); Map<String, Object> configurationProperties = configuration.getProperties(); if (rule.getTemplateUID() == null) { String uid = rule.getUID(); try { validateConfiguration(configDescriptions, new HashMap<>(configurationProperties)); resolveModuleConfigReferences(rule.getModules(), configurationProperties); ConfigurationNormalizer.normalizeModuleConfigurations(rule.getModules(), moduleTypeRegistry); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(String.format("The rule '%s' has incorrect configurations", uid), e); } } }
Source:
public void getTaskData(Set<String> taskIds, TaskRepository taskRepository, TaskDataCollector collector, IOperationMonitor monitor) throws BugzillaRestException { BugzillaRestConfiguration config; try { config = connector.getRepositoryConfiguration(taskRepository); } catch (CoreException e1) { throw new BugzillaRestException(e1); } Iterable<String> taskIdsTemp = Iterables.transform(taskIds, function); Iterable<List<String>> partitions = Iterables.partition(taskIdsTemp, MAX_RETRIEVED_PER_QUERY); for (List<String> list : partitions) { Joiner joiner = Joiner.on(",id=").skipNulls(); String urlIDList = "id=" + joiner.join(list); try { List<TaskData> taskDataArray = new BugzillaRestGetTaskData(client, connector, urlIDList, taskRepository) .run(monitor); for (TaskData taskData : taskDataArray) { config.updateProductOptions(taskData); config.addValidOperations(taskData); collector.accept(taskData); } } catch (BugzillaRestException e) { throw e; } catch (Exception e) { throw new BugzillaRestException(e); } } }

Target:
public void getTaskData(Set<String> taskIds, TaskRepository taskRepository, TaskDataCollector collector, IOperationMonitor monitor) throws BugzillaRestException { BugzillaRestConfiguration config; try { config = connector.getRepositoryConfiguration(taskRepository); } catch (CoreException e1) { throw new BugzillaRestException(e1); } Iterable<String> taskIdsTemp = Iterables.transform(taskIds, function); Iterable<List<String>> partitions = Iterables.partition(taskIdsTemp, MAX_RETRIEVED_PER_QUERY); for (List<String> list : partitions) { Joiner joiner = Joiner.on(",id=").skipNulls(); String urlIDList = "id=" + joiner.join(list); try { List<TaskData> taskDataArray = new BugzillaRestGetTaskData(client, connector, urlIDList, taskRepository) .run(monitor); for (TaskData taskData : taskDataArray) { config.updateProductOptions(taskData); config.addValidOperations(taskData); collector.accept(taskData); } } catch (BugzillaRestException e) { throw e; } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof CoreException) { throw new BugzillaRestException(cause); } throw e; } } }
Source:
public static List<MetricType> userTypes() { return Arrays.asList(Arrays.copyOf(MetricType.values(), 3)); }

Target:
public static EnumSet<MetricType> userTypes() { return userDefinableTypes; }
Source:
protected void doRun(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, MakeUIPlugin.getResourceString("MakeCCWizard.task_name"), 10); super.doRun(progress.split(9)); if (newProject != null) { CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, progress.split(1)); } else progress.worked(1); }

Target:
protected void doRun(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, MakeUIPlugin.getResourceString("MakeCCWizard.task_name"), 10); super.doRun(progress.split(9)); if (newProject != null) { CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, progress.split(1)); } else { progress.worked(1); } }
Source:
public void writeConfiguration(String host, int port) throws IOException { Message m = Message.createMessage("config"); m.addTag("reindex"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLEncoder e = new XMLEncoder(baos); e.writeObject(configuration); e.close(); m.setText(baos.toString()); m.write(host, port); }

Target:
public void writeConfiguration(String host, int port) throws IOException { Message m = Message.createMessage("config"); m.addTag("reindex"); m.setText(configuration.getXMLRepresentationAsString()); m.write(host, port); }
Source:
public void addInput(Page page) { requireNonNull(page, "page is null"); if (page.getPositionCount() == 0) { return; } page = pagePreprocessor.apply(page); if (useOptmizedPartitionedOutputOperator) { partitionFunction.ariaPartitionPage(page); } else { partitionFunction.partitionPage(page); } operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); long partitionsSizeInBytes = partitionFunction.getSizeInBytes(); systemMemoryContext.setBytes(partitionsSizeInBytes + partitionsInitialRetainedSize); }

Target:
public void addInput(Page page) { requireNonNull(page, "page is null"); if (page.getPositionCount() == 0) { return; } page = pagePreprocessor.apply(page); partitionFunction.partitionPage(page); operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); long partitionsSizeInBytes = partitionFunction.getSizeInBytes(); systemMemoryContext.setBytes(partitionsSizeInBytes + partitionsInitialRetainedSize); }
Source:
public PagesSpatialIndexSupplier( Session session, LongArrayList addresses, List<Type> types, List<Integer> outputChannels, List<List<Block>> channels, int geometryChannel, Optional<Integer> radiusChannel, Optional<Integer> partitionChannel, SpatialPredicate spatialRelationshipTest, Optional<JoinFilterFunctionCompiler.JoinFilterFunctionFactory> filterFunctionFactory, Map<Integer, Rectangle> partitions, LocalMemoryContext localUserMemoryContext) { requireNonNull(localUserMemoryContext); this.session = session; this.addresses = addresses; this.types = types; this.outputChannels = outputChannels; this.channels = channels; this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = filterFunctionFactory; this.partitions = partitions; this.rtree = buildRTree(addresses, channels, geometryChannel, radiusChannel, partitionChannel, localUserMemoryContext); this.radiusChannel = radiusChannel; this.memorySizeInBytes = INSTANCE_SIZE + (rtree.isEmpty() ? 0 : STRTREE_INSTANCE_SIZE + computeMemorySizeInBytes(rtree.getRoot())); }

Target:
public PagesSpatialIndexSupplier( Session session, LongArrayList addresses, List<Type> types, List<Integer> outputChannels, List<List<Block>> channels, int geometryChannel, Optional<Integer> radiusChannel, Optional<Integer> partitionChannel, SpatialPredicate spatialRelationshipTest, Optional<JoinFilterFunctionCompiler.JoinFilterFunctionFactory> filterFunctionFactory, Map<Integer, Rectangle> partitions, LocalMemoryContext localUserMemoryContext) { requireNonNull(localUserMemoryContext, "localUserMemoryContext is null"); this.session = session; this.addresses = addresses; this.types = types; this.outputChannels = outputChannels; this.channels = channels; this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = filterFunctionFactory; this.partitions = partitions; this.rtree = buildRTree(addresses, channels, geometryChannel, radiusChannel, partitionChannel, localUserMemoryContext); this.radiusChannel = radiusChannel; this.memorySizeInBytes = INSTANCE_SIZE + rtree.getEstimatedSizeInBytes(); }
Source:
private long extractLongKey(QueryableEntry entry) { Object key = entry.getAttributeValue(keyAttribute); if (key == null) { throw new NullPointerException("non-null unique key value is required"); } if (!Numbers.isLongRepresentable(key.getClass())) { throw new NullPointerException("integer-valued unique key value is required"); } return ((Number) key).longValue(); }

Target:
private long extractLongKey(QueryableEntry entry) { Object key = entry.getAttributeValue(keyAttribute); return extractLongKey(key); }
Source:
protected void handleExceptionWhileProcessingMetadata(Member member, Exception e) { if (e instanceof HazelcastInstanceNotActiveException) { logger.finest(e); } else if (logger.isWarningEnabled()) { logger.warning(format("Can't extract invalidation meta-data of %s", member), e); } }

Target:
protected void handleExceptionWhileProcessingMetadata(Member member, Exception e) { if (e instanceof IllegalStateException) { logger.finest(e); } else if (logger.isWarningEnabled()) { logger.warning(format("Can't fetch or extract invalidation meta-data of %s", member), e); } }
Source:
public void test_addKeyListenerKeyPressedAdapterLorg_eclipse_swt_events_KeyListener() { KeyListener listener = KeyListener.keyPressedAdapter(event -> { eventOccurred = true; }); control.addKeyListener(listener); eventOccurred = false; control.notifyListeners(SWT.KeyDown, new Event()); assertTrue(eventOccurred); control.removeKeyListener(listener); eventOccurred = false; control.notifyListeners(SWT.KeyDown, new Event()); assertFalse(eventOccurred); }

Target:
public void test_addKeyListenerKeyPressedAdapterLorg_eclipse_swt_events_KeyListener() { KeyListener listener = KeyListener.keyPressedAdapter(event -> eventOccurred = true); control.addKeyListener(listener); eventOccurred = false; control.notifyListeners(SWT.KeyDown, new Event()); assertTrue(eventOccurred); control.removeKeyListener(listener); eventOccurred = false; control.notifyListeners(SWT.KeyDown, new Event()); assertFalse(eventOccurred); }
Source:
public String computeHmac256(final String stringToSign) { try { Mac hmacSha256 = Mac.getInstance("HmacSHA256"); hmacSha256.init(new SecretKeySpec(this.accountKey, "HmacSHA256")); byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); return Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); } catch (final NoSuchAlgorithmException e) { throw new RuntimeException("There is no such algorithm. Error Details: " + e.getMessage()); } catch (InvalidKeyException e) { throw new RuntimeException("Please double check the account key. Error details: " + e.getMessage()); } }

Target:
public String computeHmac256(final String stringToSign) { try { Mac hmacSha256 = Mac.getInstance("HmacSHA256"); hmacSha256.init(new SecretKeySpec(this.accountKey, "HmacSHA256")); byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); return Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); } catch (final NoSuchAlgorithmException e) { String errorMsg = "There is no such algorithm. Error Details: " + e.getMessage(); logger.asWarning().log(errorMsg); throw new RuntimeException(errorMsg); } catch (InvalidKeyException e) { String errorMsg = "Please double check the account key. Error details: " + e.getMessage(); logger.asWarning().log(errorMsg); throw new RuntimeException(errorMsg); } }
Source:
public static Date convertEventTimestampToDate(String timestamp) throws ParseException { if (StringUtils.isBlank(timestamp)) { throw new IllegalArgumentException("Pod event timestamp can not be blank"); } return dateFormat.parse(timestamp); }

Target:
public static Date convertEventTimestampToDate(String timestamp) throws ParseException { if (Strings.isNullOrEmpty(timestamp)) { throw new IllegalArgumentException("Pod event timestamp can not be blank"); } return dateFormat.parse(timestamp); }
Source:
private static void readRepositoryCategory(IConfigurationElement element) { String id = element.getAttribute(ELMNT_REPOSITORY_CATEGORY_ID); String label = element.getAttribute(ELMNT_REPOSITORY_CATEGORY_LABEL); String rank = element.getAttribute(ELMNT_REPOSITORY_CATEGORY_RANK); RepositoryCategory cat = new RepositoryCategory(id, label, Integer.parseInt(rank)); repositoryCategories.put(cat.getId(), cat); }

Target:
private static void readRepositoryCategory(IConfigurationElement element) { String id = element.getAttribute(ELEMENT_REPOSITORY_CATEGORY_ID); String label = element.getAttribute(ELEMENT_REPOSITORY_CATEGORY_LABEL); String rank = element.getAttribute(ELEMENT_REPOSITORY_CATEGORY_RANK); int rankInt; try { rankInt = Integer.parseInt(rank); } catch (NumberFormatException e) { rankInt = 0; } RepositoryCategory cat = new RepositoryCategory(id, label, rankInt); repositoryCategories.put(cat.getId(), cat); }
Source:
public void testLambdaBug1470() throws Exception { String code = IOUtils.toString(ParserCornersTest.class.getResourceAsStream("LambdaBug1470.java"), StandardCharsets.UTF_8); parseJava18(code); }

Target:
public void testLambdaBug1470() { String code = readAsString("LambdaBug1470.java"); parseJava18(code); }
Source:
public JailPanel(int totalPieces) { super(false); if(totalPieces % 4 == 0) { mJailSize = BoardSize.withDimensions(JAIL_WIDTH, totalPieces / JAIL_WIDTH); } else { mJailSize = BoardSize.withDimensions(JAIL_WIDTH, (totalPieces / JAIL_WIDTH) + 1); } mSquareLabels = new ArrayList<>(totalPieces); setBorder(UiUtility.createBorder(Messages.getString("PlayGamePanel.capturedPieces"))); setLayout(new GridLayout(mJailSize.height, mJailSize.width)); createGrid(); }

Target:
public JailPanel(int totalPieces) { super(false); if(totalPieces % JAIL_WIDTH == 0) { mJailSize = BoardSize.withDimensions(JAIL_WIDTH, totalPieces / JAIL_WIDTH); } else { mJailSize = BoardSize.withDimensions(JAIL_WIDTH, (totalPieces / JAIL_WIDTH) + 1); } mSquareLabels = new ArrayList<>(totalPieces); setBorder(UiUtility.createBorder(Messages.getString("PlayGamePanel.capturedPieces"))); setLayout(new GridLayout(mJailSize.height, mJailSize.width)); createGrid(); }
Source:
public void predicate_nativeField_exists() { StubMappingSearchScope scope = indexManager.createSearchScope(); IndexSearchQuery<DocumentReference> query = scope.query() .asReference() .predicate( f -> f.exists().onField( "nativeField" ) ) .toQuery(); assertThat( query ) .hasDocRefHitsAnyOrder( INDEX_NAME, FIRST_ID, SECOND_ID, THIRD_ID, FOURTH_ID ); }

Target:
public void predicate_nativeField_exists() { StubMappingSearchScope scope = indexManager.createSearchScope(); SubTest.expectException( "exists() predicate on unsupported native field", () -> scope.predicate().exists().onField( "nativeField" ) ) .assertThrown() .isInstanceOf( SearchException.class ) .hasMessageContaining( "Native fields do not support defining predicates with the DSL: use the Lucene extension and a native query." ) .satisfies( FailureReportUtils.hasContext( EventContexts.fromIndexFieldAbsolutePath( "nativeField" ) ) ); }
Source:
private void send(final String destId, final AvroPSMsg msg) { final ConnectionFactory<AvroPSMsg> connFactory = psNetworkSetup.getConnectionFactory(); if (connFactory == null) { throw new RuntimeException("ConnectionFactory has not been registered or has been removed"); } final Connection<AvroPSMsg> conn = connFactory .newConnection(identifierFactory.getNewInstance(destId)); try { conn.open(); conn.write(msg); } catch (final NetworkException ex) { throw new RuntimeException("NetworkException during connection open/write", ex); } }

Target:
private void send(final String destId, final AvroPSMsg msg) { final ConnectionFactory<AvroPSMsg> connFactory = psNetworkSetup.getConnectionFactory(); if (connFactory == null) { throw new RuntimeException("ConnectionFactory has not been registered, or has been removed accidentally"); } final Connection<AvroPSMsg> conn = connFactory .newConnection(identifierFactory.getNewInstance(destId)); try { conn.open(); conn.write(msg); } catch (final NetworkException ex) { throw new RuntimeException("NetworkException during connection open/write", ex); } }
Source:
protected void executeCommand() { lunsToUpdateInDb = getLunsToUpdateInDb(); if (acquireLockInternal()) { TransactionSupport.executeInNewTransaction(() -> { Collection<LUNs> oldLuns = lunIdToDiskIdOfDirectLunsAttachedToVmsInPool.keySet() .stream() .map(lunDao::get) .collect(Collectors.toList()); CompensationContext context = getCompensationContext(); context.snapshotEntities(oldLuns); lunDao.updateAllInBatch(lunsToUpdateInDb); context.stateChanged(); log.info("LUNs with IDs: [" + lunsToUpdateInDb.stream().map(LUNs::getLUNId).collect(Collectors.joining(", ")) + "] were updated in the DB."); setSucceeded(true); return null; }); freeLock(); } else { addCustomValue("DisksIds", lunsToUpdateInDb.stream() .map(LUNs::getDiskId).map(Guid::toString).collect(Collectors.joining(", "))); auditLogDirector.log(this, AuditLogType.DIRECT_LUNS_COULD_NOT_BE_SYNCED); } }

Target:
protected void executeCommand() { lunsToUpdateInDb = getLunsToUpdateInDb(); TransactionSupport.executeInNewTransaction(() -> { Collection<LUNs> oldLuns = diskToLunIdsOfDirectLunsAttachedToVmsInPool.values() .stream() .map(lunDao::get) .collect(Collectors.toList()); CompensationContext context = getCompensationContext(); context.snapshotEntities(oldLuns); lunDao.updateAllInBatch(lunsToUpdateInDb); context.stateChanged(); log.info(lunsToUpdateInDb.stream().map(LUNs::getLUNId).collect( Collectors.joining(", ", "LUNs with IDs: [", "] were updated in the DB."))); setSucceeded(true); return null; }); }
Source:
public void onNewJobModelAvailable(final String version) { debounceTimer.scheduleAfterDebounceTime(ScheduleAfterDebounceTime.JOB_MODEL_VERSION_CHANGE, 0, () -> { LOG.info("pid=" + processorId + "new JobModel available"); metrics.newJobModel.inc(); if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } newJobModel = zkUtils.getJobModel(version); LOG.info("pid=" + processorId + ": new JobModel available. ver=" + version + "; jm = " + newJobModel); barrier.join(version, processorId); }); }

Target:
public void onNewJobModelAvailable(final String version) { debounceTimer.scheduleAfterDebounceTime(ScheduleAfterDebounceTime.JOB_MODEL_VERSION_CHANGE, 0, () -> { LOG.info("pid=" + processorId + "new JobModel available"); if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } newJobModel = zkUtils.getJobModel(version); LOG.info("pid=" + processorId + ": new JobModel available. ver=" + version + "; jm = " + newJobModel); barrier.join(version, processorId); }); }
Source:
public synchronized static void setReactorsMap(String vmId, ReactorClient client){ reactorsMap.put(vmId, client); }

Target:
public static void setReactorsMap(String vmId, ReactorClient client){ reactorsMap.put(vmId, client); }
Source:
public void checkResourceIsClosableAndReusable() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(1); config.setBlockWhenExhausted(false); JedisPool pool = new JedisPool(config, hnp.getHost(), hnp.getPort(), 2000, "foobared", 0, "closable-resuable-pool", false, null, null, null); Jedis jedis = pool.getResource(); try { jedis.set("hello", "jedis"); } finally { jedis.close(); } Jedis jedis2 = pool.getResource(); try { assertEquals(jedis, jedis2); assertEquals("jedis", jedis2.get("hello")); } finally { jedis2.close(); } }

Target:
public void checkResourceIsClosableAndReusable() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(1); config.setBlockWhenExhausted(false); try (JedisPool pool = new JedisPool(config, hnp.getHost(), hnp.getPort(), 2000, "foobared", 0, "closable-resuable-pool", false, null, null, null)) { Jedis jedis = pool.getResource(); jedis.set("hello", "jedis"); jedis.close(); Jedis jedis2 = pool.getResource(); assertEquals(jedis, jedis2); assertEquals("jedis", jedis2.get("hello")); jedis2.close(); } }
Source:
protected Object executeInTransaction(DataStore dataStore, Transactional action) { log.debug("executeInTransaction"); Object result = null; try (DataStoreTransaction tx = dataStore.beginTransaction()) { JsonApiDocument jsonApiDoc = new JsonApiDocument(); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); RequestScope scope = new RequestScope("query", NO_VERSION, jsonApiDoc, tx, null, queryParams, UUID.randomUUID(), elide.getElideSettings()); result = action.execute(tx, scope); tx.flush(scope); tx.commit(scope); } catch (IOException e) { log.error("IOException: {}", e); throw new IllegalStateException(e); } return result; }

Target:
protected Object executeInTransaction(DataStore dataStore, Transactional action) { log.debug("executeInTransaction"); Object result = null; try (DataStoreTransaction tx = dataStore.beginTransaction()) { JsonApiDocument jsonApiDoc = new JsonApiDocument(); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); RequestScope scope = new RequestScope("", "query", NO_VERSION, jsonApiDoc, tx, null, queryParams, UUID.randomUUID(), elide.getElideSettings()); result = action.execute(tx, scope); tx.flush(scope); tx.commit(scope); } catch (IOException e) { log.error("IOException: {}", e); throw new IllegalStateException(e); } return result; }
Source:
public static QuantityType<?> operator_divide(QuantityType<?> x, Number y) { BigDecimal yValue = numberToBigDecimal(y); if (x == null) { return new QuantityType<>("0").divide(yValue); } else if (yValue == null) { return x.divide(NULL_DEFINITION); } else { return x.divide(yValue); } }

Target:
public static QuantityType<?> operator_divide(QuantityType<?> x, Number y) { BigDecimal yValue = numberToBigDecimal(y); return x.divide(yValue); }