auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void resetPassword(final String id) { try { LOGGER.debug("Resetting password of user id {}", id); Optional<User> optionalUser = userRepository.findById(id); if (!optionalUser.isPresent()) { throw new UserNotFoundException(id); } final User user = optionalUser.get(); if (!IDP_SOURCE_GRAVITEE.equals(user.getSource())) { throw new UserNotInternallyManagedException(id); } user.setPassword(null); user.setUpdatedAt(new Date()); userRepository.update(user); final Map<String, Object> params = getTokenRegistrationParams(convert(user, false), "/#!/resetPassword/"); notifierService.trigger(PortalHook.PASSWORD_RESET, params); auditService.createPortalAuditLog( Collections.singletonMap(USER, user.getId()), User.AuditEvent.PASSWORD_RESET, user.getUpdatedAt(), null, null); emailService.sendAsyncEmailNotification(new EmailNotificationBuilder() .to(user.getEmail()) .subject("Password reset - " + getDisplayName(user)) .template(EmailNotificationBuilder.EmailTemplate.PASSWORD_RESET) .params(params) .build() ); } catch (TechnicalException ex) { final String message = "An error occurs while trying to reset password for user " + id; LOGGER.error(message, ex); throw new TechnicalManagementException(message, ex); } }

Target:
public void resetPassword(final String id) { try { LOGGER.debug("Resetting password of user id {}", id); Optional<User> optionalUser = userRepository.findById(id); if (!optionalUser.isPresent()) { throw new UserNotFoundException(id); } final User user = optionalUser.get(); if (!IDP_SOURCE_GRAVITEE.equals(user.getSource())) { throw new UserNotInternallyManagedException(id); } user.setPassword(null); user.setUpdatedAt(new Date()); userRepository.update(user); final Map<String, Object> params = getTokenRegistrationParams(convert(user, false), "/#!/resetPassword/"); notifierService.trigger(PortalHook.PASSWORD_RESET, params); auditService.createPortalAuditLog( Collections.singletonMap(USER, user.getId()), User.AuditEvent.PASSWORD_RESET, user.getUpdatedAt(), null, null); emailService.sendAsyncEmailNotification(new EmailNotificationBuilder() .to(user.getEmail()) .subject("Password reset - " + convert(user, false).getDisplayName()) .template(EmailNotificationBuilder.EmailTemplate.PASSWORD_RESET) .params(params) .build() ); } catch (TechnicalException ex) { final String message = "An error occurs while trying to reset password for user " + id; LOGGER.error(message, ex); throw new TechnicalManagementException(message, ex); } }
Source:
void download(DownloadBatch downloadBatch, Map<DownloadBatchId, DownloadBatch> downloadBatchMap) { DownloadBatchId downloadBatchId = downloadBatch.getId(); if (!downloadBatchMap.containsKey(downloadBatchId)) { downloadBatchMap.put(downloadBatchId, downloadBatch); } DownloadBatch batchToDownload = downloadBatchMap.get(downloadBatchId); executor.submit(() -> { Wait.<Void>waitFor(serviceCriteria, waitForDownloadService) .thenPerform(executeDownload(batchToDownload, downloadBatchMap)); }); }

Target:
void download(DownloadBatch downloadBatch, Map<DownloadBatchId, DownloadBatch> downloadBatchMap) { DownloadBatchId downloadBatchId = downloadBatch.getId(); if (!downloadBatchMap.containsKey(downloadBatchId)) { downloadBatchMap.put(downloadBatchId, downloadBatch); } DownloadBatch batchToDownload = downloadBatchMap.get(downloadBatchId); executor.submit(new Runnable() { @Override public void run() { Wait.<Void>waitFor(serviceCriteria, waitForDownloadService) .thenPerform(executeDownload(batchToDownload, downloadBatchMap)); } }); }
Source:
public int available() { final ReentrantLock lock = this.lock; lock.lock(); try { return objects.size(); } finally { lock.unlock(); } }

Target:
public int available() { return objects.size(); }
Source:
final void execute(final Channel channel) { channel.executingCalls.put(id,this); future = channel.executor.submit(new Runnable() { private int startIoId; private int calcLastIoId() { int endIoId = channel.lastIoId(); if (startIoId==endIoId) return 0; return endIoId; } public void run() { String oldThreadName = Thread.currentThread().getName(); Thread.currentThread().setName(oldThreadName+" for "+channel.getName()+" id="+id); try { Command rsp; CURRENT.set(Request.this); startIoId = channel.lastIoId(); try { channel.pipeWriter.get(lastIoId).get(); RSP r = Request.this.perform(channel); rsp = new Response<RSP, EXC>(Request.this, id, calcLastIoId(), r); } catch (Throwable t) { rsp = new Response<RSP, Throwable>(Request.this, id, calcLastIoId(), t); } finally { CURRENT.set(null); } if(chainCause) { rsp.chainCause(createdAt); } channel.send(rsp); } catch (IOException e) { if (e instanceof ChannelClosedException) { logger.log(Level.INFO, "Failed to send back a reply to the request {0}: {1}", new Object[] {this, e}); } else { logger.log(Level.WARNING, "Failed to send back a reply to the request " + this, e); } } finally { channel.executingCalls.remove(id); Thread.currentThread().setName(oldThreadName); } } }); }

Target:
final void execute(final Channel channel) { channel.executingCalls.put(id,this); future = channel.executor.submit(new Runnable() { private int startIoId; private int calcLastIoId() { int endIoId = channel.lastIoId(); if (startIoId==endIoId) return 0; return endIoId; } public void run() { String oldThreadName = Thread.currentThread().getName(); Thread.currentThread().setName(oldThreadName+" for "+channel.getName()+" id="+id); try { Command rsp; CURRENT.set(Request.this); startIoId = channel.lastIoId(); try { channel.pipeWriter.get(lastIoId).get(); RSP r = Request.this.perform(channel); rsp = new Response<RSP, EXC>(Request.this, id, calcLastIoId(), r); } catch (Throwable t) { rsp = new Response<RSP, Throwable>(Request.this, id, calcLastIoId(), t); } finally { CURRENT.set(null); } if(chainCause) { rsp.chainCause(createdAt); } channel.send(rsp); } catch (IOException e) { if (e instanceof ChannelClosedException && !logger.isLoggable(Level.FINE)) { logger.log(Level.INFO, "Failed to send back a reply to the request {0}: {1}", new Object[] {this, e}); } else { logger.log(Level.WARNING, "Failed to send back a reply to the request " + this, e); } } finally { channel.executingCalls.remove(id); Thread.currentThread().setName(oldThreadName); } } }); }
Source:
public double getDouble(int field) { checkFieldType(field, ImmutableSet.of(DOUBLE)); return Double.valueOf(String.valueOf(getFieldValue(field))); }

Target:
public double getDouble(int field) { checkFieldType(field, ImmutableSet.of(DOUBLE)); return Double.parseDouble(getFieldValue(field).toString()); }
Source:
public Object getPropertyValue(Object id) { if (sfName.equals(id)) { return getName(); } if (sfPath.equals(id)) { return getPath().toString(); } if (sfLocation.equals(id)) { return getLocation().getScheme() + ':' + getLocation().getPath(); } if (sfIsLinked.equals(id)) { return Boolean.valueOf(getResource().isLinked()).toString(); } if (sfEventType.equals(id)) { if (getTraceType() != null) { IConfigurationElement ce = sfTraceTypeAttributes.get(getTraceType()); return (ce != null) ? (getCategory(ce) + " : " + ce.getAttribute(TmfTraceType.NAME_ATTR)) : ""; } } Map<String, String> traceProperties = getTraceProperties(); if (id != null && !traceProperties.isEmpty()) { String key = (String) id; key = key.replaceFirst(this.getName() + "_", ""); String value = traceProperties.get(key); return value; } return null; }

Target:
public Object getPropertyValue(Object id) { if (sfName.equals(id)) { return getName(); } if (sfPath.equals(id)) { return getPath().toString(); } if (sfLocation.equals(id)) { return URIUtil.toUnencodedString(getLocation()); } if (sfIsLinked.equals(id)) { return Boolean.valueOf(getResource().isLinked()).toString(); } if (sfEventType.equals(id)) { if (getTraceType() != null) { IConfigurationElement ce = sfTraceTypeAttributes.get(getTraceType()); return (ce != null) ? (getCategory(ce) + " : " + ce.getAttribute(TmfTraceType.NAME_ATTR)) : ""; } } Map<String, String> traceProperties = getTraceProperties(); if (id != null && !traceProperties.isEmpty()) { String key = (String) id; key = key.replaceFirst(this.getName() + "_", ""); String value = traceProperties.get(key); return value; } return null; }
Source:
private boolean shouldEnforceAutoApproveReasonRule(MaintenanceDocument document) { String documentInitiator = document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId(); Collection<String> byPassInitiators = getParameterService().getParameterValuesAsString(KFSConstants.OptionalModuleNamespaces.CONTRACTS_AND_GRANTS, CUKFSConstants.CGParms.AWARD_RULE_COMPNONENT, CUKFSConstants.CGParms.BYPASS_AWARD_EXTENSION_AUTO_APPROVE_REASON_RULE_INITIATORS); if (LOG.isDebugEnabled()) { LOG.debug("shouldEnforceAutoApproveReasonRule, the document intiator: " + documentInitiator); LOG.debug("shouldEnforceAutoApproveReasonRule, the bypass intiators: " + byPassInitiators); } if (CollectionUtils.isNotEmpty(byPassInitiators) && byPassInitiators.contains(documentInitiator)) { LOG.debug("shouldEnforceAutoApproveReasonRule, the document initiator is in the list of bypass initiators, so do not enfource for the auto approve reason rule."); return false; } return true; }

Target:
private boolean shouldEnforceAutoApproveReasonRule(MaintenanceDocument document) { String documentInitiator = document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId(); Collection<String> byPassInitiators = getParameterService().getParameterValuesAsString( KFSConstants.OptionalModuleNamespaces.CONTRACTS_AND_GRANTS, CUKFSConstants.CGParms.AWARD_RULE_COMPNONENT, CUKFSConstants.CGParms.BYPASS_AWARD_EXTENSION_AUTO_APPROVE_REASON_RULE_INITIATORS); if (LOG.isDebugEnabled()) { LOG.debug("shouldEnforceAutoApproveReasonRule, the document intiator: " + documentInitiator); LOG.debug("shouldEnforceAutoApproveReasonRule, the bypass intiators: " + byPassInitiators); } if (CollectionUtils.isNotEmpty(byPassInitiators) && byPassInitiators.contains(documentInitiator)) { LOG.debug("shouldEnforceAutoApproveReasonRule, the document initiator is in the list of bypass initiators, so do not enforce for the auto approve reason rule."); return false; } return true; }
Source:
public static TmfStateValue newValueLong(long longValue) { return new LongStateValue(longValue); }

Target:
public static TmfStateValue newValueLong(long longValue) { if (longValue == -1) { return nullValue(); } return new LongStateValue(longValue); }
Source:
public synchronized void initCamelCronService() { if (this.service == null) { this.service = CronHelper.resolveCamelCronService( getCamelContext(), this.cronService ); if (this.service == null) { throw new RuntimeCamelException("Cannot find any CamelCronService: please add a valid implementation, such as 'camel-quartz', in order to use the 'camel-cron' component"); } try { getCamelContext().addService(this.service, true, false); } catch (Exception e) { throw new RuntimeCamelException(e); } } }

Target:
public void initCamelCronService() { if (this.service == null) { this.service = CronHelper.resolveCamelCronService( getCamelContext(), this.cronService ); if (this.service == null) { throw new RuntimeCamelException("Cannot find any CamelCronService: please add a valid implementation, such as 'camel-quartz', in order to use the 'camel-cron' component"); } try { getCamelContext().addService(this.service, true, false); } catch (Exception e) { throw new RuntimeCamelException(e); } } }
Source:
public void assertNoneProxyForGetTarget() { ElasticJob proxy = new TargetJob(); assertFalse(AopUtils.isAopProxy(proxy)); assertEquals(AopTargetUtils.getTarget(proxy), proxy); }

Target:
public void assertNoneProxyForGetTarget() { ElasticJob proxy = new TargetJob(); assertFalse(AopUtils.isAopProxy(proxy)); assertThat(AopTargetUtils.getTarget(proxy), is(proxy)); }
Source:
public int writeData() throws Exception { String linestr = this.groupedFields ? influxDbWriteObjectSerializer.getGroupedLineProtocolString(influxDbWriteObject,measurement) : influxDbWriteObjectSerializer.getLineProtocolString(influxDbWriteObject); final byte[] line = linestr.getBytes(UTF_8); return writeData(line); }

Target:
public int writeData() throws Exception { String linestr = influxDbWriteObjectSerializer.getLineProtocolString(influxDbWriteObject); final byte[] line = linestr.getBytes(UTF_8); return writeData(line); }
Source:
private void updateSliderIfInteger(UISlider slider) { T settingValue = getSetting().getValue(); if (settingValue instanceof Float || settingValue instanceof Double) { return; } slider.setIncrement(1.0f); slider.setPrecision(0); }

Target:
private void updateSliderIfInteger(UISlider slider) { T settingValue = getSetting().get(); if (settingValue instanceof Float || settingValue instanceof Double) { return; } slider.setIncrement(1.0f); slider.setPrecision(0); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { LOG.debug("Prepare to interceptor request in Filter"); if (!(request instanceof HttpServletRequest)) { filterChain.doFilter(request, response); return; } if (request instanceof HttpServletRequest) { HttpServletRequest hrequest = (HttpServletRequest) request; HttpServletResponse hresponse = (HttpServletResponse) response; final String servletPath = hrequest.getServletPath(); LOG.debug("servlet Request: " + servletPath); try { if (!servletPath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER)) { checkHeaders(hrequest); } } catch (SanitizationException e) { LOG.error("Error in SanitilizeMessage {}: ", e.getLocalizedMessage(), e); ESAPI.authenticator().logout(); hrequest.getServletContext().getRequestDispatcher(NavigationConstant.CUSTOM_ERROR_XHTML) .forward(hrequest, hresponse); } finally { ESAPI.httpUtilities().clearCurrent(); } if (hresponse.isCommitted()) { return; } filterChain.doFilter(hrequest, hresponse); } else { LOG.debug("request is not instance of HttpServletRequest"); filterChain.doFilter(request, response); return; } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { LOG.debug("Prepare to interceptor request in Filter"); if (!(request instanceof HttpServletRequest)) { filterChain.doFilter(request, response); return; } if (request instanceof HttpServletRequest) { HttpServletRequest hrequest = (HttpServletRequest) request; HttpServletResponse hresponse = (HttpServletResponse) response; final String servletPath = hrequest.getServletPath(); LOG.debug("servlet Request: {}", servletPath); try { if (!servletPath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER)) { checkHeaders(hrequest); } } catch (SanitizationException e) { LOG.error("Error in SanitilizeMessage {}: ", e.getLocalizedMessage(), e); hrequest.getSession().invalidate(); hrequest.getServletContext().getRequestDispatcher(NavigationConstant.CUSTOM_ERROR_XHTML) .forward(hrequest, hresponse); } finally { ESAPI.httpUtilities().clearCurrent(); } if (hresponse.isCommitted()) { return; } filterChain.doFilter(hrequest, hresponse); } else { LOG.debug("request is not instance of HttpServletRequest"); filterChain.doFilter(request, response); return; } }
Source:
public void createResources() { if (checkpointManager != null) { checkpointManager.createResources(); checkpointManager.stop(); } createChangelogStreams(); }

Target:
public void createResources() { if (checkpointManager != null) { checkpointManager.createResources(); } createChangelogStreams(); }
Source:
private void decorateResource(@NonNull IResource resource, IDecoration decoration) throws CoreException { if (resource.getType() == IResource.ROOT || !resource.isAccessible() || !ResourceUtil.isSharedWithGit(resource)) { return; } IndexDiffData indexDiffData = ResourceStateFactory.getInstance() .getIndexDiffDataOrNull(resource); if (indexDiffData == null) { return; } IDecoratableResource decoratableResource = null; final DecorationHelper helper = new DecorationHelper( Activator.getDefault().getPreferenceStore()); try { decoratableResource = new DecoratableResourceAdapter(indexDiffData, resource); } catch (IOException e) { throw new CoreException(Activator.createErrorStatus( NLS.bind(UIText.Decorator_exceptionMessage, resource), e)); } helper.decorate(decoration, decoratableResource); }

Target:
private void decorateResource(@NonNull IResource resource, IDecoration decoration) throws CoreException { if (resource.getType() == IResource.ROOT || !resource.isAccessible()) { return; } IndexDiffData indexDiffData = ResourceStateFactory.getInstance() .getIndexDiffDataOrNull(resource); if (indexDiffData == null) { return; } IDecoratableResource decoratableResource = null; final DecorationHelper helper = new DecorationHelper( Activator.getDefault().getPreferenceStore()); try { decoratableResource = new DecoratableResourceAdapter(indexDiffData, resource); } catch (IOException e) { throw new CoreException(Activator.createErrorStatus( NLS.bind(UIText.Decorator_exceptionMessage, resource), e)); } helper.decorate(decoration, decoratableResource); }
Source:
public Optional<ImmutableGameModeData> with(Key<? extends BaseValue<?>> key, Object value, ImmutableGameModeData immutable) { return Optional.absent(); }

Target:
public Optional<ImmutableGameModeData> with(Key<? extends BaseValue<?>> key, Object value, ImmutableGameModeData immutable) { if (!key.equals(Keys.GAME_MODE)) { return Optional.absent(); } return Optional.<ImmutableGameModeData>of( ImmutableDataCachingUtil.getManipulator(ImmutableSpongeGameModeData.class, (GameMode) value)); }
Source:
public TestingWarningCollector(WarningCollectorConfig config, TestingWarningCollectorConfig testConfig) { super(config); requireNonNull(testConfig, "testConfig is null"); addWarnings = testConfig.getAddWarnings(); for (int warningCode = 1; warningCode <= testConfig.getPreloadedWarnings(); warningCode++) { super.add(createTestWarning(warningCode)); } warningCode.set(testConfig.getPreloadedWarnings()); }

Target:
public TestingWarningCollector(WarningCollectorConfig config, TestingWarningCollectorConfig testConfig) { this.config = requireNonNull(config, "config is null"); requireNonNull(testConfig, "testConfig is null"); addWarnings = testConfig.getAddWarnings(); for (int warningCode = 1; warningCode <= testConfig.getPreloadedWarnings(); warningCode++) { add(createTestWarning(warningCode)); } warningCode.set(testConfig.getPreloadedWarnings()); }
Source:
protected Position handlePosition(Position position) { class AsyncRequestAndCallback implements InvocationCallback<Response> { private Integer delay = retryDelayMin; private Map<String, Object> jsonPayload; private Invocation.Builder requestBuilder; AsyncRequestAndCallback(Position position) { String formattedUrl; try { formattedUrl = (json) ? url : formatRequest(position); } catch (UnsupportedEncodingException | JsonProcessingException e) { throw new RuntimeException("Forwarding formatting error", e); } requestBuilder = client.target(formattedUrl).request(); if (header != null && !header.isEmpty()) { for (String line: header.split("\\r?\\n")) { String[] values = line.split(":", 2); requestBuilder.header(values[0].trim(), values[1].trim()); } } if (json) { jsonPayload = prepareJsonPayload(position); } deliveryPendingCurrent.incrementAndGet(); send(); } private void send() { if (json) { requestBuilder.async().post(Entity.json(jsonPayload), this); } else { requestBuilder.async().get(this); } } private void retry() { try { deliveryFaliuresInRow.incrementAndGet(); if (!retryEnabled || deliveryPendingCurrent.get() > deliveryPendingLimit) { deliveryPendingCurrent.decrementAndGet(); } else { Integer i = 0; for ( ; i < delay; i++) { Thread.sleep(1000); if (deliveryFaliuresInRow.get() == 0) { delay = retryDelayMin; break; } } if (i >= delay && delay < retryDelayMax) { delay++; } send(); } } catch (Exception e) { } } public void completed(Response response) { if (response.getStatus() == 200) { deliveryFaliuresInRow.set(0); deliveryPendingCurrent.decrementAndGet(); } else { retry(); } } public void failed(Throwable throwable) { retry(); } } new AsyncRequestAndCallback(position); return position; }

Target:
protected Position handlePosition(Position position) { AsyncRequestAndCallback request = new AsyncRequestAndCallback(position); request.send(); return position; }
Source:
private HeadersRequest requestHeadersImpl(int count) { long startNumber; boolean reverse = false; if (!hasGaps()) { startNumber = maxNum + 1; } else { List<HeaderElement> longestChain = getLongestChain(); startNumber = longestChain.get(longestChain.size() - 1).header.getNumber(); if (!rnd.nextBoolean()) reverse = true; } int headersCount; if (endBlockNumber != null) headersCount = (int) Math.min(count, endBlockNumber - startNumber + 1); else headersCount = count; return new HeadersRequestImpl(startNumber, headersCount, reverse); }

Target:
private HeadersRequest requestHeadersImpl(int count) { long startNumber; int headersCount; boolean reverse = false; if (!hasGaps()) { startNumber = maxNum + 1; if (endBlockNumber != null) { headersCount = (int) Math.min(count, endBlockNumber - startNumber + 1); } else { headersCount = count; } } else { List<HeaderElement> longestChain = getLongestChain(); startNumber = longestChain.get(longestChain.size() - 1).header.getNumber(); headersCount = MAX_CHAIN_LEN; if (!rnd.nextBoolean()) reverse = true; } return new HeadersRequestImpl(startNumber, headersCount, reverse); }
Source:
public QueryIterator iterator(FetchOptions fetchOptions) throws SearchException { hSearchQuery.maxResults(getNodeMaxResults()); if (fetchOptions.getFetchMode().equals(FetchOptions.FetchMode.EAGER)) { ClusteredQueryCommand command = ClusteredQueryCommand.createEagerIterator(hSearchQuery, cache); HashMap<UUID, ClusteredTopDocs> topDocsResponses = broadcastQuery(command); return new DistributedIterator(sort, fetchOptions.getFetchSize(), this.resultSize, maxResults, firstResult, topDocsResponses, cache); } else if (fetchOptions.getFetchMode().equals(FetchOptions.FetchMode.LAZY)) { UUID lazyItId = UUID.randomUUID(); ClusteredQueryCommand command = ClusteredQueryCommand.createLazyIterator(hSearchQuery, cache, lazyItId); HashMap<UUID, ClusteredTopDocs> topDocsResponses = broadcastQuery(command); return new DistributedLazyIterator(sort, fetchOptions.getFetchSize(), this.resultSize, maxResults, firstResult, lazyItId, topDocsResponses, asyncExecutor, cache); } else { throw new IllegalArgumentException("Unknown FetchMode " + fetchOptions.getFetchMode()); } }

Target:
public ResultIterator iterator(FetchOptions fetchOptions) throws SearchException { hSearchQuery.maxResults(getNodeMaxResults()); switch (fetchOptions.getFetchMode()) { case EAGER: { ClusteredQueryCommand command = ClusteredQueryCommand.createEagerIterator(hSearchQuery, cache); HashMap<UUID, ClusteredTopDocs> topDocsResponses = broadcastQuery(command); return new DistributedIterator(sort, fetchOptions.getFetchSize(), this.resultSize, maxResults, firstResult, topDocsResponses, cache); } case LAZY: { UUID lazyItId = UUID.randomUUID(); ClusteredQueryCommand command = ClusteredQueryCommand.createLazyIterator(hSearchQuery, cache, lazyItId); HashMap<UUID, ClusteredTopDocs> topDocsResponses = broadcastQuery(command); return new DistributedLazyIterator(sort, fetchOptions.getFetchSize(), this.resultSize, maxResults, firstResult, lazyItId, topDocsResponses, asyncExecutor, cache); } default: throw new IllegalArgumentException("Unknown FetchMode " + fetchOptions.getFetchMode()); } }
Source:
public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive"); int notifyId = intent.getIntExtra(NOTIFICATION_ID, NavigationServiceProvider.NOTIFICATION_ID + 1); int actionNum = intent.getIntExtra(ACTION_NUM, 0); if (actionNum == DISMISS_FEEDBACK_NOTIFICATION) { Log.d(TAG, "Dismiss intent"); } else { Log.d(TAG, "Capturing user feedback from notification"); captureFeedback(context, intent, notifyId); } }

Target:
public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive"); int notifyId = intent.getIntExtra(NOTIFICATION_ID, NavigationServiceProvider.NOTIFICATION_ID + 1); String action = intent.getAction(); if (action == ACTION_DISMISS_FEEDBACK) { Log.d(TAG, "Dismiss intent"); } else if (action == ACTION_REPLY) { Log.d(TAG, "Capturing user feedback from notification"); captureFeedback(context, intent, notifyId); } }
Source:
public static void setUpClass() throws HandlerRequestException { HashMap<String, String> receivedPathParameters = new HashMap<>(3); receivedPathParameters.put(JobIDPathParameter.KEY, JOBID.toString()); receivedPathParameters.put(JobVertexIdPathParameter.KEY, JOB_VERTEXID.toString()); receivedPathParameters.put(SubtaskIndexPathParameter.KEY, Integer.toString(SUBTASK_INDEX)); testRequest = new HandlerRequest<>( EmptyRequestBody.getInstance(), new SubtaskMessageParameters(), receivedPathParameters, Collections.emptyMap()); metricFetcher = new MetricFetcherImpl<>( () -> null, address -> null, TestingUtils.defaultExecutor(), Time.milliseconds(1000L), MetricOptions.METRIC_FETCHER_UPDATE_INTERVAL.defaultValue()); RestHandlerConfiguration restHandlerConfiguration = RestHandlerConfiguration.fromConfiguration(new Configuration()); handler = new SubtaskAllExecutionAttemptsDetailsHandler( () -> null, Time.milliseconds(100), Collections.emptyMap(), SubtaskAllExecutionAttemptDetailsHeaders.getInstance(), new ExecutionGraphCache( restHandlerConfiguration.getTimeout(), Time.milliseconds(restHandlerConfiguration.getRefreshInterval())), TestingUtils.defaultExecutor(), metricFetcher); }

Target:
public static void setUpClass() throws HandlerRequestException { HashMap<String, String> receivedPathParameters = new HashMap<>(); receivedPathParameters.put(JobIDPathParameter.KEY, JOBID.toString()); receivedPathParameters.put(JobVertexIdPathParameter.KEY, JOB_VERTEXID.toString()); receivedPathParameters.put(SubtaskIndexPathParameter.KEY, Integer.toString(SUBTASK_INDEX)); testRequest = new HandlerRequest<>( EmptyRequestBody.getInstance(), new SubtaskMessageParameters(), receivedPathParameters, Collections.emptyMap()); metricFetcher = new MetricFetcherImpl<>( () -> null, address -> null, TestingUtils.defaultExecutor(), Time.milliseconds(1000L), MetricOptions.METRIC_FETCHER_UPDATE_INTERVAL.defaultValue()); RestHandlerConfiguration restHandlerConfiguration = RestHandlerConfiguration.fromConfiguration(new Configuration()); handler = new SubtaskAllExecutionAttemptsDetailsHandler( () -> null, Time.milliseconds(100), Collections.emptyMap(), SubtaskAllExecutionAttemptDetailsHeaders.getInstance(), new DefaultExecutionGraphCache( restHandlerConfiguration.getTimeout(), Time.milliseconds(restHandlerConfiguration.getRefreshInterval())), TestingUtils.defaultExecutor(), metricFetcher); }
Source:
public void after() { TmfTraceStub trace = fTrace; assertNotNull(trace); TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace)); fViewBot.close(); fBot.waitUntil(ConditionHelpers.ViewIsClosed(fViewBot)); fTrace.dispose(); }

Target:
public void after() { TmfTraceStub trace = fTrace; assertNotNull(trace); UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace))); fViewBot.close(); fBot.waitUntil(ConditionHelpers.ViewIsClosed(fViewBot)); fTrace.dispose(); }
Source:
public static SpeedUnit getPreferredSpeedUnit(Context context){ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String speedUnit = prefs.getString(context.getResources().getString(R.string.pref_speedunit), "pace"); assert speedUnit != null; switch(speedUnit){ case "speed": return SpeedUnit.SPEED; case "pace": default: return SpeedUnit.PACE; } }

Target:
public static SpeedUnit getPreferredSpeedUnit(Context context){ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String speedUnit = prefs.getString(context.getResources().getString(R.string.pref_speedunit), SpeedUnit.PACE.getValue()); assert speedUnit != null; switch(speedUnit){ case Constants.SPEED_UNIT.SPEED: return SpeedUnit.SPEED; case Constants.SPEED_UNIT.PACE: default: return SpeedUnit.PACE; } }
Source:
private Response makeSyncRequest(PostRequest syncPost) throws CommCareSessionException { Hashtable<String, String> params = syncPost.getEvaluatedParams(sessionWrapper.getEvaluationContext()); String url = buildUrl(syncPost.getUrl().toString()); printStream.println(String.format("Syncing with url %s and parameters %s", url, params)); MultipartBody postBody = buildPostBody(params); String credential = Credentials.basic(username, password); Request request = new Request.Builder() .url(url) .method("POST", RequestBody.create(null, new byte[0])) .header("Authorization", credential) .post(postBody) .build(); try { OkHttpClient client = new OkHttpClient(); return client.newCall(request).execute(); } catch (IOException e) { throw new CommCareSessionException("Exception while making sync request", e); } }

Target:
private Response makeSyncRequest(PostRequest syncPost) throws CommCareSessionException, IOException { Hashtable<String, String> params = syncPost.getEvaluatedParams(sessionWrapper.getEvaluationContext()); String url = buildUrl(syncPost.getUrl().toString()); printStream.println(String.format("Syncing with url %s and parameters %s", url, params)); MultipartBody postBody = buildPostBody(params); String credential = Credentials.basic(username, password); Request request = new Request.Builder() .url(url) .method("POST", RequestBody.create(null, new byte[0])) .header("Authorization", credential) .post(postBody) .build(); OkHttpClient client = new OkHttpClient(); return client.newCall(request).execute(); }
Source:
public void removeRemoteSource(TaskId sourceTaskId) { requireNonNull(sourceTaskId, "sourceTaskId is null"); log.debug("Removing remote source %s from task %s", sourceTaskId, taskId); for (ExchangeClient exchangeClient : ImmutableList.copyOf(exchangeClientManager.getExchangeClients())) { exchangeClient.removeRemoteSource(sourceTaskId); } }

Target:
public void removeRemoteSource(TaskId sourceTaskId) { requireNonNull(sourceTaskId, "sourceTaskId is null"); log.debug("Removing remote source %s from task %s", sourceTaskId, taskId); taskExchangeClientManager.getExchangeClients() .forEach(exchangeClient -> exchangeClient.removeRemoteSource(sourceTaskId)); }
Source:
public void testExistingTryGetProperty(){ Properties properties = System.getProperties(); properties.setProperty("MyNiceProp","MyNiceValue"); assertEquals(ConfigurationUtils.tryGetProperty("MyNiceProp"),"MyNiceValue"); }

Target:
public void testExistingTryGetProperty(){ Properties properties = System.getProperties(); properties.setProperty("MyNiceProp","MyNiceValue"); assertThat(ConfigurationUtils.tryGetProperty("MyNiceProp")).isEqualTo("MyNiceValue"); }
Source:
public void setAmendCommitMessage() { service.log(appContext.getDevMachine(), project.getLocation(), null, false) .then(log -> { final List<Revision> commits = log.getCommits(); String message = ""; if (commits != null && (!commits.isEmpty())) { final Revision tip = commits.get(0); if (tip != null) { message = tip.getMessage(); } } CommitPresenter.this.view.setMessage(message); CommitPresenter.this.view.setEnableCommitButton(!message.isEmpty()); }) .catchError(error -> { if (getErrorCode(error.getCause()) == ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED) { dialogFactory.createMessageDialog(constant.commitTitle(), constant.initCommitWasNotPerformed(), null).show(); } else { CommitPresenter.this.view.setMessage(""); notificationManager.notify(constant.logFailed(), FAIL, NOT_EMERGE_MODE); } }); }

Target:
public void setAmendCommitMessage() { service.log(appContext.getDevMachine(), project.getLocation(), null, -1, -1, false) .then(log -> { String message = ""; final Revision revision = getFirst(log.getCommits(), null); if (revision != null) { message = revision.getMessage(); } CommitPresenter.this.view.setMessage(message); CommitPresenter.this.view.setEnableCommitButton(!message.isEmpty()); }) .catchError(error -> { if (getErrorCode(error.getCause()) == ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED) { dialogFactory.createMessageDialog(constant.commitTitle(), constant.initCommitWasNotPerformed(), null).show(); } else { CommitPresenter.this.view.setMessage(""); notificationManager.notify(constant.logFailed(), FAIL, NOT_EMERGE_MODE); } }); }
Source:
private BsonDocument asCommandDocument(final ConnectionDescription description) { BsonDocument command = new BsonDocument("findandmodify", new BsonString(namespace.getCollectionName())); putIfNotNull(command, "query", getFilter()); putIfNotNull(command, "fields", getProjection()); putIfNotNull(command, "sort", getSort()); putIfNotZero(command, "maxTimeMS", getMaxTime(MILLISECONDS)); command.put("remove", BsonBoolean.TRUE); if (writeConcern != null & serverIsAtLeastVersionThreeDotTwo(description)) { command.put("writeConcern", writeConcern.asDocument()); } return command; }

Target:
private BsonDocument asCommandDocument(final ConnectionDescription description) { BsonDocument command = new BsonDocument("findandmodify", new BsonString(namespace.getCollectionName())); putIfNotNull(command, "query", getFilter()); putIfNotNull(command, "fields", getProjection()); putIfNotNull(command, "sort", getSort()); putIfNotZero(command, "maxTimeMS", getMaxTime(MILLISECONDS)); command.put("remove", BsonBoolean.TRUE); if (serverIsAtLeastVersionThreeDotTwo(description) && writeConcern.isAcknowledged() && !writeConcern.isServerDefault()) { command.put("writeConcern", writeConcern.asDocument()); } return command; }
Source:
private EntitlementSpecifier sanityAndReorderBPOrStandaloneSpecFirst(final Catalog catalog, final SubscriptionBaseWithAddOnsSpecifier subscriptionBaseWithAddOnsSpecifier, final DateTime effectiveDate, final Collection<EntitlementSpecifier> outputEntitlementSpecifier) throws SubscriptionBaseApiException { EntitlementSpecifier baseOrStandalonePlanSpecifier = null; final Collection<EntitlementSpecifier> addOnSpecifiers = new ArrayList<EntitlementSpecifier>(); try { for (final EntitlementSpecifier cur : subscriptionBaseWithAddOnsSpecifier.getEntitlementSpecifiers()) { final boolean isBase = isBaseSpecifier(catalog, effectiveDate, cur); final boolean isStandalone = isStandaloneSpecifier(catalog, effectiveDate, cur); final boolean isBaseOrStandaloneSpecifier = isBase || isStandalone; if (isBaseOrStandaloneSpecifier) { if (baseOrStandalonePlanSpecifier == null && (isStandalone || (isBase && subscriptionBaseWithAddOnsSpecifier.getBundleId() == null))) { baseOrStandalonePlanSpecifier = cur; } else { throw new SubscriptionBaseApiException(ErrorCode.SUB_CREATE_INVALID_ENTITLEMENT_SPECIFIER); } } else { addOnSpecifiers.add(cur); } } } catch (final CatalogApiException e) { throw new SubscriptionBaseApiException(e); } if (baseOrStandalonePlanSpecifier != null) { outputEntitlementSpecifier.add(baseOrStandalonePlanSpecifier); } outputEntitlementSpecifier.addAll(addOnSpecifiers); return baseOrStandalonePlanSpecifier; }

Target:
private EntitlementSpecifier sanityAndReorderBPOrStandaloneSpecFirst(final Catalog catalog, final SubscriptionBaseWithAddOnsSpecifier subscriptionBaseWithAddOnsSpecifier, final DateTime effectiveDate, final Collection<EntitlementSpecifier> outputEntitlementSpecifier) throws SubscriptionBaseApiException { EntitlementSpecifier baseOrStandalonePlanSpecifier = null; final Collection<EntitlementSpecifier> addOnSpecifiers = new ArrayList<EntitlementSpecifier>(); try { for (final EntitlementSpecifier cur : subscriptionBaseWithAddOnsSpecifier.getEntitlementSpecifiers()) { final boolean isBase = isBaseSpecifier(catalog, effectiveDate, cur); final boolean isStandalone = isStandaloneSpecifier(catalog, effectiveDate, cur); final boolean isBaseOrStandaloneSpecifier = isBase || isStandalone; if (isBaseOrStandaloneSpecifier) { if (baseOrStandalonePlanSpecifier == null) { baseOrStandalonePlanSpecifier = cur; } else { throw new SubscriptionBaseApiException(ErrorCode.SUB_CREATE_INVALID_ENTITLEMENT_SPECIFIER); } } else { addOnSpecifiers.add(cur); } } } catch (final CatalogApiException e) { throw new SubscriptionBaseApiException(e); } if (baseOrStandalonePlanSpecifier != null) { outputEntitlementSpecifier.add(baseOrStandalonePlanSpecifier); } outputEntitlementSpecifier.addAll(addOnSpecifiers); return baseOrStandalonePlanSpecifier; }
Source:
public Iterable<RoleDTO> getRoles() { Collection<? extends RoleInfo> roles = this.userService.listRoles(); return roles.stream().map(this.modelTranslator.getStreamMapper(RoleInfo.class, RoleDTO.class)) .collect(Collectors.toSet()); }

Target:
public Stream<RoleDTO> getRoles() { Collection<? extends RoleInfo> roles = this.userService.listRoles(); return roles.stream().map(this.modelTranslator.getStreamMapper(RoleInfo.class, RoleDTO.class)); }
Source:
public void flush() throws IOException { synchronized ( InfinispanJF.this ) { if ( closed ) { throw new IOException( "Cannot write to closed stream!" ); } } doFlush( false ); }

Target:
public void flush() throws IOException { if ( closed ) { throw new IOException( "Cannot write to closed stream!" ); } doFlush( false ); }
Source:
public void register(Object object) { Class<?> listenerClass = object.getClass(); if(!Modifier.isPublic(listenerClass.getModifiers())){ throw new IllegalArgumentException("Event Subscriber class needs to be public"); } List<SubscriberMethod> methods = new ArrayList<SubscriberMethod>(); do { for (Method m : listenerClass.getDeclaredMethods()) { if (m.isAnnotationPresent(com.cloudant.sync.event.Subscribe.class)) { if (!Modifier.isPublic(m.getModifiers())){ throw new IllegalArgumentException("Subscriber method with @Subscribe is required to be public"); } Class[] params = m.getParameterTypes(); if (params.length == 1) { methods.add(new SubscriberMethod(m, params[0])); } else { throw new IllegalArgumentException("Subscriber method is required to have only 1 parameter"); } } } } while ((listenerClass = listenerClass.getSuperclass()) != null); listeners.put(object, methods); }

Target:
public void register(Object object) { Class<?> listenerClass = object.getClass(); if(!Modifier.isPublic(listenerClass.getModifiers())){ throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Event Subscriber class %s needs to be public", listenerClass.getName())); } List<SubscriberMethod> methods = new ArrayList<SubscriberMethod>(); do { for (Method m : listenerClass.getDeclaredMethods()) { if (m.isAnnotationPresent(com.cloudant.sync.event.Subscribe.class)) { if (!Modifier.isPublic(m.getModifiers())){ throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Subscriber method %s#%s is required to be public", listenerClass.getName(), m.getName())); } Class[] params = m.getParameterTypes(); if (params.length == 1) { if(!Notification.class.isAssignableFrom(params[0])){ throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Subscriber method %s#%s parameter is required to be assignable %s", listenerClass.getName(), m.getName(), Notification.class.getCanonicalName())); } methods.add(new SubscriberMethod(m, params[0])); } else { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Subscriber method %s#%s is required to have only 1 parameter", listenerClass.getName(), m.getName())); } } } } while ((listenerClass = listenerClass.getSuperclass()) != null); listeners.put(object, methods); }
Source:
public Parameter(final ParameterModifier typeModifier, final String parameterType, final String name, final ParameterPointerType parameterPointerType, final boolean isRequired) { this.parameterType = parameterType; this.typeModifier = typeModifier; this.name = name; this.parameterPointerType = parameterPointerType; this.isRequired = isRequired; this.documentation = null; }

Target:
public Parameter(final ParameterModifier typeModifier, final String parameterType, final String name, final ParameterPointerType parameterPointerType, final boolean isRequired) { this( typeModifier, parameterType, name, parameterPointerType, isRequired, null); }
Source:
public void internalReceiveCommand(String itemName, Command command) { logger.debug("received command from " + itemName); String serialNumber = null; for (MaxCubeBindingProvider provider : providers) { serialNumber = provider.getSerialNumber(itemName); if (serialNumber != null) break; } if (serialNumber == null) return; Device device = findDevice(serialNumber, devices); if (device == null) return; String rfAddress = device.getRFAddress(); if (command instanceof DecimalType) { DecimalType decimalType = (DecimalType) command; S_Command scmd = new S_Command(rfAddress, decimalType.doubleValue()); String commandString = scmd.getCommandString(); Socket socket = null; try { socket = new Socket(ip, port); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.print(commandString); socket.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }

Target:
public void internalReceiveCommand(String itemName, Command command) { logger.debug("Received command from " + itemName); String serialNumber = null; for (MaxCubeBindingProvider provider : providers) { serialNumber = provider.getSerialNumber(itemName); if (serialNumber != null) break; } if (serialNumber == null) return; Device device = findDevice(serialNumber, devices); if (device == null) return; String rfAddress = device.getRFAddress(); if (command instanceof DecimalType) { DecimalType decimalType = (DecimalType) command; S_Command scmd = new S_Command(rfAddress, decimalType.doubleValue()); String commandString = scmd.getCommandString(); Socket socket = null; try { socket = new Socket(ip, port); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.print(commandString); socket.close(); } catch (UnknownHostException e) { logger.warn("Cannot establish connection with MAX!cube lan gateway while sending command to '{}'", ip); } catch (IOException e) { logger.warn("Cannot write data from MAX!cube lan gateway while connecting to '{}'", ip); } } }
Source:
public void visitFunctionDef(FunctionDef functionDef) { symbols.add(new SymbolImpl(functionDef.name().name(), null)); }

Target:
public void visitFunctionDef(FunctionDef functionDef) { symbols.add(symbol(functionDef.name())); }
Source:
private String substFinalName(String finalname) { final String markerVarBeg = "${"; final String markerVarEnd = "}"; boolean startsWithVariable = finalname.startsWith(markerVarBeg) && finalname.contains(markerVarEnd); if (startsWithVariable) { String marker = finalname.substring(markerVarBeg.length(), finalname.indexOf(markerVarEnd)); switch (marker) { case "karaf.base": return this.homeDirectory + finalname.substring(finalname.indexOf(markerVarEnd) + markerVarEnd.length()); case "karaf.etc": return this.etcDirectory + finalname.substring(finalname.indexOf(markerVarEnd) + markerVarEnd.length()); default: break; } } return finalname; }

Target:
private String substFinalName(String finalname) { final String markerVarBeg = "${"; final String markerVarEnd = "}"; boolean startsWithVariable = finalname.startsWith(markerVarBeg) && finalname.contains(markerVarEnd); if (startsWithVariable) { String marker = finalname.substring(markerVarBeg.length(), finalname.indexOf(markerVarEnd)); switch (marker) { case "karaf.home": case "karaf.base": return this.baseDirectory + finalname.substring(finalname.indexOf(markerVarEnd) + markerVarEnd.length()); case "karaf.etc": return this.etcDirectory + finalname.substring(finalname.indexOf(markerVarEnd) + markerVarEnd.length()); default: break; } } return finalname; }
Source:
private IStatus updateScanQueue(IProgressMonitor monitor, final Set<String> filesToScan, final List<String> traceTypes) throws InterruptedException { for (String fileToScan : filesToScan) { for (String traceCat : traceTypes) { TraceValidationHelper tv = new TraceValidationHelper(fileToScan, traceCat); if (!fResults.containsKey(tv)) { if (!fTracesToScan.contains(tv)) { fTracesToScan.put(tv); monitor.subTask(tv.getTraceToScan()); if (monitor.isCanceled()) { ((ImportTraceWizardScanPage) fScanPage).refresh(); return CANCEL_STATUS; } } } } } ((ImportTraceWizardScanPage) fScanPage).refresh(); return Status.OK_STATUS; }

Target:
private IStatus updateScanQueue(IProgressMonitor monitor, final Set<String> filesToScan, final List<String> traceTypes) throws InterruptedException { for (String fileToScan : filesToScan) { for (String traceCat : traceTypes) { TraceValidationHelper tv = new TraceValidationHelper(fileToScan, traceCat); if (!fResults.containsKey(tv)) { if (!fTracesToScan.contains(tv)) { fTracesToScan.put(tv); monitor.subTask(tv.getTraceToScan()); if (monitor.isCanceled()) { fScanPage.refresh(); return CANCEL_STATUS; } } } } } fScanPage.refresh(); return Status.OK_STATUS; }
Source:
public void prepareServerSpecificServicesMBean() { if (getDatabaseSession() != null && shouldRegisterRuntimeBean) { this.setRuntimeServicesMBean(new MBeanOpenEJBRuntimeServices(getDatabaseSession())); } }

Target:
public void prepareServerSpecificServicesMBean() { if (isRuntimeServicesEnabledDefault() && getDatabaseSession() != null && shouldRegisterRuntimeBean) { this.setRuntimeServicesMBean(new MBeanOpenEJBRuntimeServices(getDatabaseSession())); } }
Source:
protected final Runnable pollScheduledTask(long nanoTime) { assert inEventLoop(); Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue; ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek(); if (scheduledTask == null || scheduledTask.deadlineNanos() > nanoTime) { return null; } scheduledTaskQueue.remove(); return scheduledTask; }

Target:
protected final Runnable pollScheduledTask(long nanoTime) { assert inEventLoop(); Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue; ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek(); if (scheduledTask == null || scheduledTask.deadlineNanos() - nanoTime > 0) { return null; } scheduledTaskQueue.remove(); return scheduledTask; }
Source:
public Response<TreeSet<String>> apply(ChangeResource req) throws AuthException, OrmException, IOException, BadRequestException { ChangeControl control = req.getControl(); ChangeNotes notes = control.getNotes().load(); Set<String> hashtags = notes.getHashtags(); if (hashtags == null) { hashtags = ImmutableSet.of(); } return Response.ok(new TreeSet<String>(hashtags)); }

Target:
public Response<? extends Set<String>> apply(ChangeResource req) throws AuthException, OrmException, IOException, BadRequestException { ChangeControl control = req.getControl(); ChangeNotes notes = control.getNotes().load(); Set<String> hashtags = notes.getHashtags(); if (hashtags == null) { hashtags = ImmutableSet.of(); } return Response.ok(new TreeSet<String>(hashtags)); }
Source:
public void compareTo() { RealmInteger ri1 = new RealmInteger(10); RealmInteger ri2 = new RealmInteger("11"); assertEquals(ri1.compareTo(ri2), -1); ri2.decrement(1); assertEquals(ri1.compareTo(ri2), 0); ri2.decrement(1); assertEquals(ri1.compareTo(ri2), 1); }

Target:
public void compareTo() { RealmInteger ri1 = new RealmInteger(10); RealmInteger ri2 = new RealmInteger("11"); assertEquals(-1, ri1.compareTo(ri2)); ri2.decrement(1); assertEquals(0, ri1.compareTo(ri2)); ri2.decrement(1); assertEquals(1, ri1.compareTo(ri2)); }
Source:
public static ScenarioTemplate Deserialize(File inputFile) { ScenarioTemplate resultingTemplate = null; try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); Unmarshaller um = context.createUnmarshaller(); JAXBElement<ScenarioTemplate> templateElement = um.unmarshal(new StreamSource(inputFile), ScenarioTemplate.class); resultingTemplate = templateElement.getValue(); } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Deserialize", "Error Deserializing Scenario Template", e); } return resultingTemplate; }

Target:
public static ScenarioTemplate Deserialize(File inputFile) { ScenarioTemplate resultingTemplate = null; try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); Unmarshaller um = context.createUnmarshaller(); Source inputSource = MekHqXmlUtil.createSafeXmlSource(new FileInputStream(inputFile)); JAXBElement<ScenarioTemplate> templateElement = um.unmarshal(inputSource, ScenarioTemplate.class); resultingTemplate = templateElement.getValue(); } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Deserialize", "Error Deserializing Scenario Template", e); } return resultingTemplate; }
Source:
private static void cleanup() { try { client.getDatabase(databaseId).delete().block(); } catch (Exception e) { } }

Target:
private static void cleanup() { try { client.getDatabase(DATABASE_ID).delete().block(); } catch (Exception e) { } }