auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onActivityResult(int requestCode,int resultCode,Intent capturedData){ if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK){ Bundle capturedImageData = capturedData.getExtras(); Bitmap capturedImage = (Bitmap) capturedImageData.get("data"); Uri capturedImageUri = getImageUri(getApplicationContext(),capturedImage); <START> capturedImagePath = getRealPathFromUri(capturedImageUri); <END> new CheckAvailableSpaceTask().execute(); } else if(resultCode == RESULT_CANCELED){ setResult(RESULT_CANCELED); finish(); } }</code><technical_language>Instead of declaring capturedImagePath global, declare initialize pass CheckAvailableSpaceTask(), answer of [<LINK_0>](url)</technical_language>

Target:
protected void onActivityResult(int requestCode,int resultCode,Intent capturedData){ if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK){ Bundle capturedImageData = capturedData.getExtras(); Bitmap capturedImage = (Bitmap) capturedImageData.get("data"); Uri capturedImageUri = getImageUri(getApplicationContext(),capturedImage); String capturedImagePath = getRealPathFromUri(capturedImageUri); new CheckAvailableSpaceTask(capturedImagePath).execute(); } else if(resultCode == RESULT_CANCELED){ setResult(RESULT_CANCELED); finish(); } }
Source:
<code>protected FileLock lock(final int lockPosition) throws ActiveMQLockAcquisitionTimeoutException, InterruptedException { long start = System.nanoTime(); boolean isRecurringFailure = false; while (!interrupted) { try { FileLock lock = tryLock(lockPosition); isRecurringFailure = false; if (lock == null) { try { Thread.sleep(500); } catch (InterruptedException e) { <START> return null; <END> } if (this.lockAcquisitionTimeoutNanos != -1 && (System.nanoTime() - start) > this.lockAcquisitionTimeoutNanos) { throw new ActiveMQLockAcquisitionTimeoutException("timed out waiting for lock"); } } else { return lock; } } catch (IOException e) { logger.log(isRecurringFailure ? Logger.Level.DEBUG : Logger.Level.WARN, "Failure when accessing a lock file", e); isRecurringFailure = true; long waitTime = LOCK_ACCESS_FAILURE_WAIT_TIME_NANOS; if (this.lockAcquisitionTimeoutNanos != -1) { final long remainingTime = this.lockAcquisitionTimeoutNanos - (System.nanoTime() - start); if (remainingTime <= 0) { throw new ActiveMQLockAcquisitionTimeoutException("timed out waiting for lock"); } waitTime = Math.min(waitTime, remainingTime); } try { TimeUnit.NANOSECONDS.sleep(waitTime); } catch (InterruptedException interrupt) { throw new InterruptedException(); } } } throw new InterruptedException(); }</code><technical_language>catching InterruptedException throwing end</technical_language>

Target:
protected FileLock lock(final int lockPosition) throws ActiveMQLockAcquisitionTimeoutException { long start = System.nanoTime(); boolean isRecurringFailure = false; while (!interrupted) { try { FileLock lock = tryLock(lockPosition); isRecurringFailure = false; if (lock == null) { try { Thread.sleep(500); } catch (InterruptedException e) { return null; } if (this.lockAcquisitionTimeoutNanos != -1 && (System.nanoTime() - start) > this.lockAcquisitionTimeoutNanos) { throw new ActiveMQLockAcquisitionTimeoutException("timed out waiting for lock"); } } else { return lock; } } catch (IOException e) { logger.log(isRecurringFailure ? Logger.Level.DEBUG : Logger.Level.WARN, "Failure when accessing a lock file", e); isRecurringFailure = true; long waitTime = LOCK_ACCESS_FAILURE_WAIT_TIME_NANOS; if (this.lockAcquisitionTimeoutNanos != -1) { final long remainingTime = this.lockAcquisitionTimeoutNanos - (System.nanoTime() - start); if (remainingTime <= 0) { throw new ActiveMQLockAcquisitionTimeoutException("timed out waiting for lock"); } waitTime = Math.min(waitTime, remainingTime); } try { TimeUnit.NANOSECONDS.sleep(waitTime); } catch (InterruptedException interrupt) { return null; } } } return null; }
Source:
<code>public void rollback() { log.warn("Rolling back ActiveMQ transaction"); try { ClientSession session = this.getClientSession(); session.rollback(); <START> session.close(); <END> } catch (ActiveMQException e) { log.error("Error rolling back ActiveMQ transaction", e); } }</code><technical_language>Put close() a finally block attempt is close session, rollback fails. If closing session fails, do -- log move on</technical_language>

Target:
public void rollback() { log.warn("Rolling back ActiveMQ transaction"); try (ClientSession session = this.getClientSession()) { session.rollback(); } catch (ActiveMQException e) { log.error("Error rolling back ActiveMQ transaction", e); } }
Source:
<code>public String getGraphvizPlan(Session session, Statement statement, Type planType, List<Expression> parameters, WarningCollector warningCollector) { DataDefinitionTask<?> task = dataDefinitionTask.get(statement.getClass()); if (task != null) { return explainTask(statement, task, parameters); } switch (planType) { case LOGICAL: Plan plan = getLogicalPlan(session, statement, parameters, warningCollector); <START> return PlanPrinter.graphvizLogicalPlan(plan.getRoot(), plan.getTypes(), session); <END> case DISTRIBUTED: SubPlan subPlan = getDistributedPlan(session, statement, parameters, warningCollector); return PlanPrinter.graphvizDistributedPlan(subPlan, session); } throw new IllegalArgumentException("Unhandled plan type: " + planType); }</code><technical_language>static import graphvizLogicalPlan</technical_language>

Target:
public String getGraphvizPlan(Session session, Statement statement, Type planType, List<Expression> parameters, WarningCollector warningCollector) { DataDefinitionTask<?> task = dataDefinitionTask.get(statement.getClass()); if (task != null) { return explainTask(statement, task, parameters); } switch (planType) { case LOGICAL: Plan plan = getLogicalPlan(session, statement, parameters, warningCollector); return graphvizLogicalPlan(plan.getRoot(), plan.getTypes(), session); case DISTRIBUTED: SubPlan subPlan = getDistributedPlan(session, statement, parameters, warningCollector); return graphvizDistributedPlan(subPlan, session); } throw new IllegalArgumentException("Unhandled plan type: " + planType); }
Source:
<code><START> private void setLayout(View target, int verb, int anchorId) { <END> RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)target.getLayoutParams(); params.addRule(verb, anchorId); final ArrayList<Integer> rules; if (mHorizontalRules.contains(verb)) { rules = mHorizontalRules; } else if (mVerticalRules.contains(verb)) { rules = mVerticalRules; } else { rules = null; } if (rules != null && !verifyLayout(target, rules)) { JSONObject errorInfo = new JSONObject(); try { errorInfo.put("cid", mName); errorInfo.put("error_type", "circular_dependency"); } catch (JSONException e) { ; } throw new LayoutUpdateException("Circular dependency detected!", errorInfo); } target.setLayoutParams(params); }</code><technical_language>setLayout inlined accumulate</technical_language>

Target:
private void setLayout(View target, int verb, int anchorId) throws CantVisitException { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)target.getLayoutParams(); params.addRule(verb, anchorId); final Set<Integer> rules; if (mHorizontalRules.contains(verb)) { rules = mHorizontalRules; } else if (mVerticalRules.contains(verb)) { rules = mVerticalRules; } else { rules = null; } if (rules != null && !verifyLayout(target, rules)) { throw new CantVisitException("Circular dependency detected!", "circular_dependency", mName); } target.setLayoutParams(params); }
Source:
<code>private Function twoArgs(Function func, C context) { assert func.arguments().size() == 2 : "size of arguments must be two"; Symbol arg1 = func.arguments().get(0); Symbol newArg1 = arg1.accept(this, context); <START> assert newArg1 != null : arg1 + " became NULL, symbols must never conver to NULL"; <END> Symbol arg2 = func.arguments().get(1); Symbol newArg2 = arg2.accept(this, context); assert newArg2 != null : arg2 + " became NULL, symbols must never conver to NULL"; Symbol filter = func.filter(); Symbol newFilter = processNullable(filter, context); if (arg1 == newArg1 && arg2 == newArg2 && filter == newFilter) { return func; } return new Function(func.info(), List.of(newArg1, newArg2), newFilter); }</code><technical_language>suggestion assert newArg1 != null : arg1 + " NULL, symbols convert NULL";</technical_language>

Target:
private Function twoArgs(Function func, C context) { assert func.arguments().size() == 2 : "size of arguments must be two"; Symbol arg1 = func.arguments().get(0); Symbol newArg1 = arg1.accept(this, context); assert newArg1 != null : arg1 + " became NULL, symbols must never convert to NULL"; Symbol arg2 = func.arguments().get(1); Symbol newArg2 = arg2.accept(this, context); assert newArg2 != null : arg2 + " became NULL, symbols must never convert to NULL"; Symbol filter = func.filter(); Symbol newFilter = processNullable(filter, context); if (arg1 == newArg1 && arg2 == newArg2 && filter == newFilter) { return func; } return new Function(func.info(), List.of(newArg1, newArg2), newFilter); }
Source:
<code>public boolean match(ChangeData cd) throws OrmException { <START> return cd.change().getLastUpdatedOn().getTime() <= cut.getTime(); <END> }</code><technical_language>Backwards? after:foo match updated is > foo</technical_language>

Target:
public boolean match(ChangeData cd) throws OrmException { return cd.change().getLastUpdatedOn().getTime() >= cut.getTime(); }
Source:
<code>public void registerEndpoint(RabbitListenerEndpoint endpoint, RabbitListenerContainerFactory<?> factory) { Assert.notNull(endpoint, "Endpoint must be set"); <START> Assert.notNull(endpoint.getId(), "Endpoint id must be set"); <END> this.endpointDescriptors.add(new AmqpListenerEndpointDescriptor(endpoint, factory)); }</code><technical_language>prefer Assert.hasText check String identifier. reason out a logic empty string</technical_language>

Target:
public void registerEndpoint(RabbitListenerEndpoint endpoint, RabbitListenerContainerFactory<?> factory) { Assert.notNull(endpoint, "Endpoint must be set"); Assert.hasText(endpoint.getId(), "Endpoint id must be set"); this.endpointDescriptors.add(new AmqpListenerEndpointDescriptor(endpoint, factory)); }
Source:
<code>public boolean promptPassword(String msg) { CredentialItem.Password p = new CredentialItem.Password(msg); if (provider.get(uri, p)) { password = new String(p.getValue()); return true; } else { <START> CredentialItem.StringType v = newPrompt(msg); <END> if (provider.get(uri, v)) { password = v.getValue(); return true; } else { password = null; return false; } } }</code><technical_language>this case here. code plain wrong a StringType for password. Leave original else block get returns false</technical_language>

Target:
public boolean promptPassword(String msg) { CredentialItem.Password p = new CredentialItem.Password(msg); if (provider.get(uri, p)) { password = new String(p.getValue()); return true; } else { password = null; return false; } }
Source:
<code>public void testDownloadDBOffline() { hasError = false; MockNetworkUtils network = new MockNetworkUtils(); network.networkAvailability = false; network.mock(); TestActivityWrapper wrapper = new TestActivityWrapper(getActivity()); WordsStorage.downloadDB(wrapper, "zh", Constants.CATEGORY_COUNTRY, <START> new DownloadDBListener() { <END> @Override public void onProgressing(int progress) { } @Override public void onComplete() { } @Override public void onError(int errorType, Exception e) { hasError = true; } }); assertTrue(hasError); network.restore(); }</code><technical_language>This line \t new DownloadDBListener()</technical_language>

Target:
public void testDownloadDBOffline() { hasError = false; MockNetworkUtils network = new MockNetworkUtils(); network.networkAvailability = false; network.mock(); TestActivityWrapper wrapper = new TestActivityWrapper(getActivity()); new WordsStorage(wrapper, "zh", Constants.CATEGORY_COUNTRY).downloadDB( new DownloadDBListener() { @Override public void onProgressing(int progress) { } @Override public void onComplete() { } @Override public void onError(int errorType, Exception e) { hasError = true; } }); assertTrue(hasError); network.restore(); }
Source:
<code>public void test_evaluate_evaluation_failed_exception() { final AtomicInteger exception = new AtomicInteger(-1); browser.addProgressListener(new ProgressListener() { @Override public void changed(ProgressEvent event) @Override public void completed(ProgressEvent event) { try { browser.evaluate("return runSomeUndefinedFunctionInJavaScriptWhichCausesUndefinedError()"); } catch (SWTException e) { exception.set(e.code); } } }); browser.setText("<html><body>HelloWorld</body></html>"); shell.open(); for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) { runLoopTimer(waitMS); if (exception.get() != -1) { if (exception.get() == SWT.ERROR_FAILED_EVALUATE) { return; } else { <START> System.err.println("test_evaluate_invalid_return_value - Invalid exception code"); <END> fail(name.getMethodName() + " failed. Incorrect exception thrown: " + exception.get()); } break; } } fail(name.getMethodName() + " failed. Expected exception to be thrown."); }</code><technical_language>need for err.println. junit handle fail only</technical_language>

Target:
public void test_evaluate_evaluation_failed_exception() { assumeFalse(webkit1SkipMsg(), isWebkit1); final AtomicInteger exception = new AtomicInteger(-1); browser.addProgressListener(new ProgressListener() { @Override public void changed(ProgressEvent event) @Override public void completed(ProgressEvent event) { try { browser.evaluate("return runSomeUndefinedFunctionInJavaScriptWhichCausesUndefinedError()"); } catch (SWTException e) { exception.set(e.code); } } }); browser.setText("<html><body>HelloWorld</body></html>"); shell.open(); for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) { runLoopTimer(waitMS); if (exception.get() != -1) { if (exception.get() == SWT.ERROR_FAILED_EVALUATE) { return; } else { fail("Invalid exception thrown: " + exception.get()); } break; } } fail("Expected exception to be thrown, but none was thrown. Test timed out."); }
Source:
<code>public void init() throws javax.mail.MessagingException { <START> content_types = ImmutableSet.copyOf(getCondition().split("\\s*,\\s*")); <END> }</code><technical_language>a excellent guava's Splitter for this</technical_language>

Target:
public void init() throws javax.mail.MessagingException { acceptedContentTypes = ImmutableSet.copyOf(Splitter.on(",").trimResults().split(getCondition())); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; Object bucket = bucketing.bucket(httpRequest); ThrottlingState.Status status = throttler.status(bucket, httpRequest); if (status.banned) { log.info("A request is being <START> throttled."); <END> if (enabled) { nbBannedRequests.increment(); notifyUserBanned(httpResponse, status.bannedUntil); return; } } if (status.throttled) { log.info("A request is being throttled."); if (enabled) { nbThrottledRequests.increment(); notifyUserThrottled(httpResponse, status.backoffDelay); throttler.throttled(bucket, httpRequest); return; } } Stopwatch stopwatch = Stopwatch.createStarted(); try { chain.doFilter(request, response); if (httpResponse.getStatus() < 400) { throttler.success(bucket, httpRequest, stopwatch.elapsed()); } else { throttler.failure(bucket, httpRequest, stopwatch.elapsed()); } } catch (IOException | ServletException e) { throttler.failure(bucket, httpRequest, stopwatch.elapsed()); throw e; } }</code><technical_language>"banned"</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; Object bucket = bucketing.bucket(httpRequest); Instant now = now(); Instant bannedUntil = banThrottler.throttledUntil(bucket, httpRequest); if (bannedUntil.isAfter(now)) { log.info("A request is being banned."); if (enabled) { nbBannedRequests.increment(); notifyUserBanned(httpResponse, bannedUntil); return; } } Instant throttledUntil = timeAndErrorsThrottler.throttledUntil(bucket, httpRequest); if (throttledUntil.isAfter(now)) { log.info("A request is being throttled."); if (enabled) { nbThrottledRequests.increment(); notifyUserThrottled(httpResponse, throttledUntil); banThrottler.throttled(bucket, httpRequest); return; } } Stopwatch stopwatch = Stopwatch.createStarted(); try { chain.doFilter(request, response); if (httpResponse.getStatus() < 400) { timeAndErrorsThrottler.success(bucket, httpRequest, stopwatch.elapsed()); } else { timeAndErrorsThrottler.failure(bucket, httpRequest, stopwatch.elapsed()); } } catch (IOException | ServletException e) { timeAndErrorsThrottler.failure(bucket, httpRequest, stopwatch.elapsed()); throw e; } }
Source:
<code>private static boolean skipBadMessageEnabled(DatastreamTask task) { return task.getDatastreams() .stream() <START> .findFirst() <END> .map(Datastream::getMetadata) .map(metadata -> metadata.getOrDefault(CFG_SKIP_BAD_MESSAGE, "false").toLowerCase().equals("true")) .orElse(false); }</code><technical_language>I forget original intention this findFirst(), thinking now, I anyMatch() is a bit more sane</technical_language>

Target:
private static boolean skipBadMessageEnabled(DatastreamTask task) { return task.getDatastreams() .stream() .findAny() .map(Datastream::getMetadata) .map(metadata -> metadata.getOrDefault(CFG_SKIP_BAD_MESSAGE, "false").toLowerCase().equals("true")) .orElse(false); }
Source:
<code>public void testProvideAndRegisterDocumentSetB() { NhinTargetCommunitiesType targets = createNhinTargetCommunitiesType(receiverHCID); ProvideAndRegisterDocumentSetRequestType request = new ProvideAndRegisterDocumentSetRequestType(); final AssertionType assertion = createAssertion(senderHCID); UrlInfoType urlInfo = new UrlInfoType(); <START> when(mockPolicyChecker.checkXDRRequestPolicy(any(ProvideAndRegisterDocumentSetRequestType.class), <END> any(AssertionType.class), any(String.class), any(String.class), eq(NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION))).thenReturn(Boolean.TRUE); when(mockDelegate.process(any(OutboundDocSubmissionDeferredRequestOrchestratable.class))).thenReturn( createOutboundDocSubmissionDeferredRequestOrchestratable(Boolean.TRUE)); StandardOutboundDocSubmissionDeferredRequest dsDeferredReq = createDocSubmissionDeferredRequestOrchImpl(); XDRAcknowledgementType response = dsDeferredReq.provideAndRegisterDocumentSetBAsyncRequest(request, assertion, targets, urlInfo); assertNotNull(response); assertEquals(NhincConstants.XDR_ACK_STATUS_MSG, response.getMessage().getStatus()); verify(mockAuditLogger).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.NHINC_XDR_REQUEST_SERVICE_NAME)); }</code><technical_language>Is this "when" (and equivalent failure below) reached in tests</technical_language>

Target:
public void testProvideAndRegisterDocumentSetB() { NhinTargetCommunitiesType targets = createNhinTargetCommunitiesType(RECEIVER_HCID); ProvideAndRegisterDocumentSetRequestType request = new ProvideAndRegisterDocumentSetRequestType(); final AssertionType assertion = createAssertion(SENDER_HCID); UrlInfoType urlInfo = new UrlInfoType(); when(mockPolicyChecker.checkXDRRequestPolicy(any(ProvideAndRegisterDocumentSetRequestType.class), any(AssertionType.class), any(String.class), any(String.class), eq(NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION))).thenReturn(Boolean.TRUE); when(mockDelegate.process(any(OutboundDocSubmissionDeferredRequestOrchestratable.class))).thenReturn( createOutboundDocSubmissionDeferredRequestOrchestratable(Boolean.TRUE)); StandardOutboundDocSubmissionDeferredRequest dsDeferredReq = createDocSubmissionDeferredRequestOrchImpl(); XDRAcknowledgementType response = dsDeferredReq.provideAndRegisterDocumentSetBAsyncRequest(request, assertion, targets, urlInfo); assertNotNull(response); assertEquals(NhincConstants.XDR_ACK_STATUS_MSG, response.getMessage().getStatus()); verify(mockAuditLogger).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.NHINC_XDR_REQUEST_SERVICE_NAME)); }
Source:
<code>private void setModerateButtonForStatus(CommentStatus status) { int color; if (status == CommentStatus.APPROVED) { color = ContextCompat.getColor(getActivity(), R.color.orange_jazzy); mBtnModerateTextView.setText(R.string.comment_status_approved); } else { color = ContextCompat.getColor(getActivity(), R.color.grey_text_min); mBtnModerateTextView.setText(R.string.mnu_comment_approve); } <START> ColorUtils.INSTANCE.setImageResourceWithTint(mBtnModerateIcon, R.drawable.ic_checkmark_white_24dp, color); <END> mBtnModerateTextView.setTextColor(color); }</code><technical_language>Glad this change, navigate (java) code notice icons button display. Previously, of cases set vie xml layout file</technical_language>

Target:
private void setModerateButtonForStatus(CommentStatus status) { int color; if (status == CommentStatus.APPROVED) { color = R.color.orange_jazzy; mBtnModerateTextView.setText(R.string.comment_status_approved); } else { color = R.color.grey_text_min; mBtnModerateTextView.setText(R.string.mnu_comment_approve); } ColorUtils.INSTANCE.setImageResourceWithTint(mBtnModerateIcon, R.drawable.ic_checkmark_white_24dp, color); mBtnModerateTextView.setTextColor(ContextCompat.getColor(requireContext(), color)); }
Source:
<code>public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType) throws CredentialStoreException, UnsupportedCredentialTypeException { <START> Assert.assertNotNull(credentialAlias); <END> Assert.assertNotNull(credentialType); if (credentialType.isAssignableFrom(PasswordCredential.class)) { try { return credentialType.cast(createPasswordCredential(executePasswordCommand(credentialAlias))); } catch (Throwable e) { throw log.passwordCommandExecutionProblem(getName(), e); } } else { throw log.credentialTypeNotSupported(credentialType.getName(), getName()); } }</code><technical_language>want checkNotNull - assertNotNull is op if assertions disabled resulting in a NPE below, checkNotNull fail null leading a consistent error message</technical_language>

Target:
public <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType) throws CredentialStoreException, UnsupportedCredentialTypeException { Assert.checkNotNullParam("credentialAlias", credentialAlias); Assert.checkNotNullParam("credentialType", credentialType); if (credentialType.isAssignableFrom(PasswordCredential.class)) { try { return credentialType.cast(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, executePasswordCommand(credentialAlias)))); } catch (Throwable e) { throw log.passwordCommandExecutionProblem(getName(), e); } } else { throw log.credentialTypeNotSupported(credentialType.getName(), getName()); } }
Source:
<code>public String toString() { return "BinlogPosition[" + (gtidSetStr == null ? file + ":" + offset : gtidSetStr) + ", lastHeartbeat=" + String.valueOf(lastHeartbeat) <START> + ", lastHeartbeat=" + String.valueOf(lastHeartbeat) <END> + "]"; }</code><technical_language>duplicated</technical_language>

Target:
public String toString() { return "BinlogPosition[" + (gtidSetStr == null ? file + ":" + offset : gtidSetStr) + ", lastHeartbeat=" + String.valueOf(lastHeartbeat) + "]"; }
Source:
<code>private boolean init(ChangeBoundsRequest request, GraphicalEditPart hostGraphicalEditPart) { List<?> editParts = request.getEditParts(); for (Object editPart : editParts) { if (editPart instanceof DragAndDropWrapper) { DragAndDropWrapper dragAndDropWrapperToDrop = (DragAndDropWrapper) editPart; elementsFromEclipseViewToDrop.add(dragAndDropWrapperToDrop); } else if (editPart instanceof IGraphicalEditPart) { IGraphicalEditPart graphicalEditPartToDrop = (IGraphicalEditPart) editPart; if (!(graphicalEditPartToDrop.getParent() == hostGraphicalEditPart || hostGraphicalEditPart instanceof CompartmentEditPart && graphicalEditPartToDrop.getParent() == hostGraphicalEditPart.getParent()) && graphicalEditPartToDrop.resolveSemanticElement() instanceof DSemanticDecorator) { EObject elementFromDiagramToDrop = graphicalEditPartToDrop.resolveSemanticElement(); DDiagramElement dDiagramElementTopDrop = (DDiagramElement) elementFromDiagramToDrop; elementsFromDiagramToDrop.add(dDiagramElementTopDrop); editPartsFromDiagramToDrop.add(graphicalEditPartToDrop); if <START> (isInLayoutingMode(hostGraphicalEditPart) && <END> graphicalEditPartToDrop instanceof IDiagramBorderNodeEditPart) { return false; } } } } return true; }</code><technical_language>ok for method, need compute for selected item. Please move this loop in patch set 1</technical_language>

Target:
private boolean init(ChangeBoundsRequest request, GraphicalEditPart hostGraphicalEditPart) { List<?> editParts = request.getEditParts(); boolean isInLayoutingMode = isInLayoutingMode(hostGraphicalEditPart); for (Object editPart : editParts) { if (editPart instanceof DragAndDropWrapper) { DragAndDropWrapper dragAndDropWrapperToDrop = (DragAndDropWrapper) editPart; elementsFromEclipseViewToDrop.add(dragAndDropWrapperToDrop); } else if (editPart instanceof IGraphicalEditPart) { IGraphicalEditPart graphicalEditPartToDrop = (IGraphicalEditPart) editPart; if (!(graphicalEditPartToDrop.getParent() == hostGraphicalEditPart || hostGraphicalEditPart instanceof CompartmentEditPart && graphicalEditPartToDrop.getParent() == hostGraphicalEditPart.getParent()) && graphicalEditPartToDrop.resolveSemanticElement() instanceof DSemanticDecorator) { EObject elementFromDiagramToDrop = graphicalEditPartToDrop.resolveSemanticElement(); DDiagramElement dDiagramElementTopDrop = (DDiagramElement) elementFromDiagramToDrop; elementsFromDiagramToDrop.add(dDiagramElementTopDrop); editPartsFromDiagramToDrop.add(graphicalEditPartToDrop); if (isInLayoutingMode && graphicalEditPartToDrop instanceof IDiagramBorderNodeEditPart) { return false; } } } } return true; }
Source:
<code>private void warnAboutProblematicCredentials(GoogleCredentials credentials) { <START> if (!Boolean.parseBoolean(getEnv(SUPPRESS_GCLOUD_CREDS_WARNING_ENV_VAR)) <END> && credentials instanceof UserCredentials && ((UserCredentials) credentials).getClientId().equals(CLOUDSDK_CLIENT_ID)) { LOGGER.log(Level.WARNING, CLOUDSDK_CREDENTIALS_WARNING); } }</code><technical_language>this check (i.e. check environment variable if log warning?). Otherwise, this check performed more times necessary (whenever attempt load credentials location)</technical_language>

Target:
private void warnAboutProblematicCredentials(GoogleCredentials credentials) { if (credentials instanceof UserCredentials && ((UserCredentials) credentials).getClientId().equals(CLOUDSDK_CLIENT_ID) && !Boolean.parseBoolean(getEnv(SUPPRESS_GCLOUD_CREDS_WARNING_ENV_VAR))) { LOGGER.log(Level.WARNING, CLOUDSDK_CREDENTIALS_WARNING); } }
Source:
<code>public List<ExperimentLibraryDesign> list() { <START> List expmts = this.getHibernateTemplate().find("from ExperimentLibraryDesign as libraryDesign order by libraryDesign.experimentLibraryDesignId asc" END> ); return expmts; }</code><technical_language>this need ordered synthetic primary key</technical_language>

Target:
public List<ExperimentLibraryDesign> list() { List expmts = this.getHibernateTemplate().find("from ExperimentLibraryDesign as libraryDesign" ); return expmts; }
Source:
<code>private int appendChild(IStatus status, String indentation) { if (indentation == null) { <START> appendStatusAndChildren(status, null); <END> return appendAndReturnLength("; "); } else { result.append(indentation); appendStatusAndChildren(status, indentation); return appendAndReturnLength("\n"); } }</code><technical_language>wrong existing code FindBugs it. This is personal taste, -2 changes code change in irrelevant ways. leave untouched</technical_language>

Target:
private int appendChild(IStatus status, String indentation) { if (indentation == null) { appendStatusAndChildren(status, indentation); return appendAndReturnLength("; "); } else { result.append(indentation); appendStatusAndChildren(status, indentation); return appendAndReturnLength("\n"); } }
Source:
<code>public UploadPartResult uploadPart(UploadPartRequest request) throws IOException { return retry("upload part #" + request.getPartNumber() <START> + " upload "+ request.getUploadId(), <END> request.getKey(), true, () -> owner.uploadPart(request)); }</code><technical_language>nit: s/upload/upload ID/ I thinking of consistent log keywords taht for retry log search "upload ID" "commit ID"</technical_language>

Target:
public UploadPartResult uploadPart(UploadPartRequest request) throws IOException { return retry("upload part #" + request.getPartNumber() + " upload ID "+ request.getUploadId(), request.getKey(), true, () -> owner.uploadPart(request)); }
Source:
<code>public void onDataChange(String path) { if (operationType.equals(StoreOperationType.WRITE)) { latch.countDown(); } else { <START> System.err.println("Data is changed but wrong operation type is specified. " + operationType); <END> } }</code><technical_language>System.err? logger here</technical_language>

Target:
public void onDataChange(String path) { if (!operationType.equals(StoreOperationType.WRITE)) { exceptionRef.set(new Exception("Data is changed but wrong operation type is specified. " + operationType)); } latch.countDown(); }
Source:
<code>public <T> ListenableFuture<T> execute(Request request, final AsyncHandler<T> asyncHandler) throws IOException { final URI uri = request.getURI(); <START> channels.configureProcessor(requestSender, closed, uri.getHost(), uri.getPort()); <END> return requestSender.sendRequest(request, asyncHandler, null, false); }</code><technical_language>this is right? uri.getPort return -1 if scheme default port. I AsyncHttpProviderUtils.getHost/getPort</technical_language>

Target:
public <T> ListenableFuture<T> execute(Request request, final AsyncHandler<T> asyncHandler) throws IOException { final URI uri = request.getURI(); final String host = AsyncHttpProviderUtils.getHost(uri); final int port = AsyncHttpProviderUtils.getPort(uri); channels.configureProcessor(requestSender, closed, host, port); return requestSender.sendRequest(request, asyncHandler, null, false); }
Source:
<code>public int calculateMaxNumCharsFromNewNoteLine(String noteLine, String currentCheckStubDataLine) { String proposedCheckStubLine = (isLastCharacterSpace(currentCheckStubDataLine) || isFirstCharacterSpace(noteLine)) ? (currentCheckStubDataLine + noteLine) : (currentCheckStubDataLine + KFSConstants.BLANK_SPACE + noteLine); int totalNumChars = proposedCheckStubLine.length(); if (totalNumChars < CuDisbursementVoucherConstants.DV_EXTRACT_MAX_NOTE_LINE_SIZE) { return noteLine.length(); } else { <START> String wrappedText = WordUtils.wrap(proposedCheckStubLine, CuDisbursementVoucherConstants.DV_EXTRACT_MAX_NOTE_LINE_SIZE); String[] constructedCheckStubLines = wrappedText.replaceAll("[\r]", "").split("\\n"); return noteLine.length() - constructedCheckStubLines[1].length(); <END> } }</code><technical_language>I suggest four-arg version of WordUtils.wrap() instead. way, explicitly "\n" newline, instead of deferring system's default manually removing "\r" afterwards. (Unless users enter data "\r" in already?) Also, four-arg version lets long words forcibly wrapped (though affect calculation logic currently stands). In addition, WordUtils.wrap() do line wrapping if proposed line is max length? If not, need tweak this avoid index-out-of-bounds exception array</technical_language>

Target:
public int calculateMaxNumCharsFromNewNoteLine(String noteLine, String currentCheckStubDataLine) { String proposedCheckStubLine; if (StringUtils.isBlank(currentCheckStubDataLine) && StringUtils.isBlank(noteLine)) { proposedCheckStubLine = KFSConstants.EMPTY_STRING; } else if (StringUtils.isBlank(currentCheckStubDataLine) && StringUtils.isNotBlank(noteLine)) { proposedCheckStubLine = noteLine; } else if (StringUtils.isNotBlank(currentCheckStubDataLine) && StringUtils.isBlank(noteLine)) { proposedCheckStubLine = currentCheckStubDataLine; } else { proposedCheckStubLine = (currentCheckStubDataLine + KFSConstants.BLANK_SPACE + noteLine); } int totalNumChars = proposedCheckStubLine.length(); if (totalNumChars == 0 || totalNumChars <= CuDisbursementVoucherConstants.DV_EXTRACT_MAX_NOTE_LINE_SIZE) { return noteLine.length(); } else { String wrappedText = WordUtils.wrap(proposedCheckStubLine, CuDisbursementVoucherConstants.DV_EXTRACT_MAX_NOTE_LINE_SIZE, "\n", false); String[] constructedCheckStubLines = wrappedText.split("\n"); return noteLine.length() - constructedCheckStubLines[1].length(); } }
Source:
<code>public void testCreateDonationWithDonationWithIneligibleDonorAndBackEntry_shouldAddDonationAndDiscardComponents() { Donation donation = aDonation().build(); long donorId = 993L; String donationBatchNumber = "000001"; DonationBackingForm backingForm = aDonationBackingForm() .withDonation(donation) .withDonor(aDonor().withId(donorId).build()) .withDonationBatchNumber(donationBatchNumber) .withPackType(aPackType().withId(IRRELEVANT_PACK_TYPE_ID).build()) .build(); PostDonationCounselling postDonationCounselling = aPostDonationCounselling().build(); DonationBatch donationBatch = aDonationBatch().thatIsBackEntry().build(); PackType packTypeThatCountsAsDonation = aPackType().withCountAsDonation(true).build(); when(packTypeRepository.getPackTypeById(IRRELEVANT_PACK_TYPE_ID)).thenReturn(packTypeThatCountsAsDonation); when(donorConstraintChecker.isDonorEligibleToDonate(donorId)).thenReturn(false); when(donationBatchRepository.findDonationBatchByBatchNumber(donationBatchNumber)).thenReturn(donationBatch); <START> when(postDonationCounsellingCRUDService.createPostDonationCounsellingForDonation(donation)).thenReturn(postDonationCounselling); <END> Donation returnedDonation = donationCRUDService.createDonation(backingForm); verify(donationRepository).addDonation(donation); verify(componentCRUDService).markComponentsBelongingToDonationAsUnsafe(donation); verify(postDonationCounsellingCRUDService).createPostDonationCounsellingForDonation(donation); assertThat(returnedDonation, is(donation)); }</code><technical_language>@debonair return I reason this mock here. verify suffice</technical_language>

Target:
public void testCreateDonationWithDonationWithIneligibleDonorAndBackEntry_shouldAddDonationAndDiscardComponents() { Donation donation = aDonation().build(); long donorId = 993L; String donationBatchNumber = "000001"; DonationBackingForm backingForm = aDonationBackingForm() .withDonation(donation) .withDonor(aDonor().withId(donorId).build()) .withDonationBatchNumber(donationBatchNumber) .withPackType(aPackType().withId(IRRELEVANT_PACK_TYPE_ID).build()) .build(); DonationBatch donationBatch = aDonationBatch().thatIsBackEntry().build(); PackType packTypeThatCountsAsDonation = aPackType().withCountAsDonation(true).build(); when(packTypeRepository.getPackTypeById(IRRELEVANT_PACK_TYPE_ID)).thenReturn(packTypeThatCountsAsDonation); when(donorConstraintChecker.isDonorEligibleToDonate(donorId)).thenReturn(false); when(donationBatchRepository.findDonationBatchByBatchNumber(donationBatchNumber)).thenReturn(donationBatch); Donation returnedDonation = donationCRUDService.createDonation(backingForm); verify(donationRepository).addDonation(donation); verify(componentCRUDService).markComponentsBelongingToDonationAsUnsafe(donation); verify(postDonationCounsellingCRUDService).createPostDonationCounsellingForDonation(donation); assertThat(returnedDonation, is(donation)); }
Source:
<code>public Object getQueryObject() { return new MongoDBQueryDescriptor( collectionName, <START> getOperation(), <END> query, projection, orderBy, null, null, null, unwinds, null, null, null, count ); }</code><technical_language>a formatting issue</technical_language>

Target:
public Object getQueryObject() { return new MongoDBQueryDescriptor( collectionName, operation, query, projection, orderBy, null, null, null, unwinds, null, null, null ); }
Source:
<code>public Map<Statistic, Long> getStatistics() { <START> StatisticsFile statisticsFile = statsFile; <END> return ((IMixinStatisticHolder) statisticsFile).getStatistics(); }</code><technical_language>Is a reason store field in a variable instead of casting directly</technical_language>

Target:
public Map<Statistic, Long> getStatistics() { return ((IMixinStatisticHolder) statsFile).getStatistics(); }
Source:
<code>private Set<File> findDotProjectFiles(Set<File> changedFiles, Repository repository) { Set<File> result = new HashSet<>(); String workingTreeRootPath = repository.getWorkTree().toString(); for (File changedFile : changedFiles) { File projectFile = searchEnclosingProjectInWorkDir( changedFile.getParentFile().getAbsoluteFile(), workingTreeRootPath); <START> if (projectFile != null) { <END> result.add(projectFile); } } return result; }</code><technical_language>unrelated change</technical_language>

Target:
private Set<File> findDotProjectFiles(Set<File> changedFiles, Repository repository) { Set<File> result = new HashSet<>(); String workingTreeRootPath = repository.getWorkTree().toString(); for (File changedFile : changedFiles) { File projectFile = searchEnclosingProjectInWorkDir( changedFile.getParentFile().getAbsoluteFile(), workingTreeRootPath); if (projectFile != null) result.add(projectFile); } return result; }
Source:
<code>public static Map<String, Set<String>> getComputerTags(Computer computer) { Set<LabelAtom> labels = null; try { labels = computer.getNode().getAssignedLabels(); } catch (NullPointerException e){ logger.fine("Could not retrieve labels"); } String nodeHostname = null; try { nodeHostname = computer.getHostName(); } catch (IOException | InterruptedException e) { logger.fine("Could not retrieve hostname"); } <START> String nodeName; if (computer instanceof Jenkins.MasterComputer) { nodeName = "master"; } else { nodeName = computer.getName(); } <END> Map<String, Set<String>> result = new HashMap<>(); Set<String> nodeNameValues = new HashSet<>(); nodeNameValues.add(nodeName); result.put("node_name", nodeNameValues); if(nodeHostname != null){ Set<String> nodeHostnameValues = new HashSet<>(); nodeHostnameValues.add(nodeHostname); result.put("node_hostname", nodeHostnameValues); } if(labels != null){ Set<String> nodeLabelsValues = new HashSet<>(); for (LabelAtom label: labels){ nodeLabelsValues.add(label.getName()); } result.put("node_label", nodeLabelsValues); } return result; }</code><technical_language>reuse getNodeName() method defined</technical_language>

Target:
public static Map<String, Set<String>> getComputerTags(Computer computer) { Set<LabelAtom> labels = null; try { labels = computer.getNode().getAssignedLabels(); } catch (NullPointerException e){ logger.fine("Could not retrieve labels"); } String nodeHostname = null; try { nodeHostname = computer.getHostName(); } catch (IOException | InterruptedException e) { logger.fine("Could not retrieve hostname"); } String nodeName = getNodeName(computer); Map<String, Set<String>> result = new HashMap<>(); Set<String> nodeNameValues = new HashSet<>(); nodeNameValues.add(nodeName); result.put("node_name", nodeNameValues); if(nodeHostname != null){ Set<String> nodeHostnameValues = new HashSet<>(); nodeHostnameValues.add(nodeHostname); result.put("node_hostname", nodeHostnameValues); } if(labels != null){ Set<String> nodeLabelsValues = new HashSet<>(); for (LabelAtom label: labels){ nodeLabelsValues.add(label.getName()); } result.put("node_label", nodeLabelsValues); } return result; }
Source:
<code><START> public RequestOptions toRequestOptions() { <END> final RequestOptions requestOptions = new RequestOptions(); requestOptions.setIfMatchETag(getIfMatchETag()); requestOptions.setIfNoneMatchETag(getIfNoneMatchETag()); requestOptions.setConsistencyLevel(getConsistencyLevel()); requestOptions.setIndexingDirective(indexingDirective); requestOptions.setSessionToken(sessionToken); return requestOptions; }</code><technical_language>ditto RequestOptions is internal type public api expose it</technical_language>

Target:
RequestOptions toRequestOptions() { final RequestOptions requestOptions = new RequestOptions(); requestOptions.setConsistencyLevel(getConsistencyLevel()); requestOptions.setSessionToken(sessionToken); return requestOptions; }
Source:
<code>public List<Annotation> process(List<String> ensemblVariants) throws Exception { List<Annotation> annotations = new ArrayList<>(); <START> for (String ensemblVariant : ensemblVariants) { <END> annotations.add(annotationLineMapper.mapLine(ensemblVariant, UNUSED_LINE_NUMBER)); } return annotations; }</code><technical_language>This is bad, this loop replaced like: ensemblVariants.stream().map(v -> annotationLineMapper.mapLine(v, ....)).collect(Collectors.toList());</technical_language>

Target:
public List<Annotation> process(List<String> ensemblVariants) throws Exception { return ensemblVariants.stream() .map(ensemblVariant -> annotationLineMapper.mapLine(ensemblVariant, UNUSED_LINE_NUMBER)) .collect(Collectors.toList()); }
Source:
<code>public PrestoSparkRow get() throws InterruptedException { PrestoSparkRow row; synchronized (monitor) { while (!finished && buffer.isEmpty()) { <START> monitor.wait(); <END> } if (finished) { return null; } row = buffer.poll(); } memoryManager.updateMemoryUsage(-row.getRetainedSize()); return row; }</code><technical_language>PrestoSparkRowBuffer#get is a blocked call. Is reason for -- I asking this general convention in Presto ListenableFuture<PrestoSparkRow> for cases</technical_language>

Target:
public PrestoSparkRow get() throws InterruptedException { PrestoSparkRow row = null; synchronized (monitor) { while (buffer.isEmpty() && !finished) { monitor.wait(); } if (!buffer.isEmpty()) { row = buffer.poll(); } } if (row != null) { memoryManager.updateMemoryUsage(-row.getRetainedSize()); } return row; }
Source:
<code>protected GenericRecord[] getTestData() { <START> GenericRecord[] records = { new GenericRecordBuilder(SCHEMA) <END> .set("afield", "foo bar") .build() }; return records; }</code><technical_language>about: @Override protected GenericRecord[] getTestData() { return new GenericRecord[]{ new GenericRecordBuilder(SCHEMA) .set("afield", "foo bar") .build()}; }</technical_language>

Target:
protected GenericRecord[] getTestData() { return new GenericRecord[]{ new GenericRecordBuilder(SCHEMA) .set("afield", "foo bar") .build()}; }
Source:
<code>public static ByteString wrap(final byte[] array, int offset, int length) { <START> return USE_ZEROCOPYBYTESTRING? <END> ZeroCopyByteStringUtil.wrap(array, offset, length) : ByteString.copyFrom(array, offset, length); }</code><technical_language>Is a reason check (offset == 0 && length == array.length) here, wrap if case? Is a performance advantage of ZeroCopyByteStringUtil.wrap(array, offset, length)</technical_language>

Target:
public static ByteString wrap(final byte[] array, int offset, int length) { if (USE_ZEROCOPYBYTESTRING && offset == 0 && length == array.length) { return ZeroCopyByteStringUtil.wrap(array); } else { return ByteString.copyFrom(array, offset, length); } }
Source:
<code>public FluentInitializer withHighlightedDates(Collection<Date> dates) { <START> if (dates != null) { <END> highlightDates(dates); } return this; }</code><technical_language>is != null check necessary here</technical_language>

Target:
public FluentInitializer withHighlightedDates(Collection<Date> dates) { highlightDates(dates); return this; }
Source:
<code>public void assertJdkDynamicProxyForGetTarget() { ElasticJob target = new TargetJob(); ProxyFactory pf = new ProxyFactory(target); pf.addInterface(ElasticJob.class); ElasticJob proxy = (ElasticJob) pf.getProxy(); assertTrue(AopUtils.isJdkDynamicProxy(proxy)); <START> assertEquals(AopTargetUtils.getTarget(proxy), target); <END> }</code><technical_language>For multiple parameter asserts, assertThat used</technical_language>

Target:
public void assertJdkDynamicProxyForGetTarget() { ElasticJob target = new TargetJob(); ProxyFactory pf = new ProxyFactory(target); pf.addInterface(ElasticJob.class); ElasticJob proxy = (ElasticJob) pf.getProxy(); assertTrue(AopUtils.isJdkDynamicProxy(proxy)); assertThat(AopTargetUtils.getTarget(proxy), is(target)); }
Source:
<code>private InstructorFeedbackResultsGroupByParticipantPanel buildGroupByParticipantPanel( String primaryParticipantIdentifier, String currentTeam, String additionalInfoId, int primaryParticipantIndex, Map.Entry<String, Map<String, List<FeedbackResponseAttributes>>> primaryToSecondaryToResponsesMap) { Map<String, List<FeedbackResponseAttributes>> giverToResponsesMap = primaryToSecondaryToResponsesMap.getValue(); List<InstructorFeedbackResultsSecondaryParticipantPanelBody> secondaryParticipantPanels = buildSecondaryParticipantPanels( additionalInfoId, primaryParticipantIndex, giverToResponsesMap); <START> String primaryParticipantNameWithTeamNameAppended = bundle.appendTeamNameToName(bundle.getNameForEmail(primaryParticipantIdentifier), bundle.getTeamNameForEmail(primaryParticipantIdentifier)); <END> InstructorFeedbackResultsGroupByParticipantPanel recipientPanel = buildInstructorFeedbackResultsGroupBySecondaryParticipantPanel( primaryParticipantIdentifier, primaryParticipantNameWithTeamNameAppended, secondaryParticipantPanels, null, false); return recipientPanel; }</code><technical_language>temporary variables line breaks, this line is 200 characters now</technical_language>

Target:
private InstructorFeedbackResultsGroupByParticipantPanel buildGroupByParticipantPanel( String primaryParticipantIdentifier, String currentTeam, String additionalInfoId, int primaryParticipantIndex, Map.Entry<String, Map<String, List<FeedbackResponseAttributes>>> primaryToSecondaryToResponsesMap) { Map<String, List<FeedbackResponseAttributes>> giverToResponsesMap = primaryToSecondaryToResponsesMap.getValue(); List<InstructorFeedbackResultsSecondaryParticipantPanelBody> secondaryParticipantPanels = buildSecondaryParticipantPanels( additionalInfoId, primaryParticipantIndex, giverToResponsesMap); String primaryParticipantNameWithTeamNameAppended = bundle.appendTeamNameToName(bundle.getNameForEmail(primaryParticipantIdentifier), bundle.getTeamNameForEmail(primaryParticipantIdentifier)); InstructorFeedbackResultsGroupByParticipantPanel recipientPanel = buildInstructorFeedbackResultsGroupBySecondaryParticipantPanel( primaryParticipantIdentifier, primaryParticipantNameWithTeamNameAppended, secondaryParticipantPanels, null); return recipientPanel; }
Source:
<code>public boolean close() { inMemoryChannels.clear(); if (recordManager != null) { <START> try { <END> logger.info("Closing Record Manager"); recordManager.close(); recordManager = null; } catch (IOException e) { } } return true; }</code><technical_language>For clarity I a boolean variable, set true end of init method, returned here. if I agree result is in usage</technical_language>

Target:
public boolean close() { inMemoryChannels.clear(); if (recordManager != null) { try { logger.info("Closing Record Manager"); recordManager.close(); recordManager = null; } catch (IOException e) { logger.warn("Error when closing Record Manager", e); } } return true; }
Source:
<code>public void createsRedirectResponseWithURLAndStatus() throws IOException { final int status = HttpURLConnection.HTTP_MOVED_TEMP; final String url = "/"; MatcherAssert.assertThat( new RsPrint( new TkRedirect(url, status).act() ).print(), Matchers.equalTo( <START> Joiner.on(NEWLINE).join( <END> "HTTP/1.1 302 Moved Temporarily", LOCATION + url, "", "" ) ) ); }</code><technical_language>@d-molotchko reference static variable full path</technical_language>

Target:
public void createsRedirectResponseWithURLAndStatus() throws IOException { final String url = "/"; MatcherAssert.assertThat( new RsPrint( new TkRedirect(url, HttpURLConnection.HTTP_MOVED_TEMP).act() ).print(), Matchers.equalTo( Joiner.on(TkRedirectTest.NEWLINE).join( "HTTP/1.1 302 Moved Temporarily", String.format(TkRedirectTest.LOCATION, url), "", "" ) ) ); }