auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public ConsumerTestRuntimeEnvironment(Supplier<CuratorFramework> curatorSupplier) { <END> this.paths = new ZookeeperPaths("/hermes"); this.curatorSupplier = curatorSupplier; this.curator = curatorSupplier.get(); this.groupRepository = new ZookeeperGroupRepository(curator, objectMapper, paths); this.topicRepository = new ZookeeperTopicRepository(curator, objectMapper, paths, groupRepository); this.subscriptionRepository = new ZookeeperSubscriptionRepository(curator, objectMapper, paths, topicRepository); this.configFactory = new MutableConfigFactory().overrideProperty(CONSUMER_WORKLOAD_REBALANCE_INTERVAL, 1); this.consumersRegistry = new ConsumerNodesRegistry(curator, executorService, paths.consumersRegistryPath(), "id"); this.metrics = mock(HermesMetrics.class); when(metrics.timer(anyString())).thenReturn(new Timer()); try { curator.create().creatingParentsIfNeeded().forPath("/hermes/groups"); consumersRegistry.start(); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>a lot in this class, creates subscriptions, spawns SelectiveSupervisorControllers, assertions. separate this work classes</technical_language>

Target:
public ConsumerTestRuntimeEnvironment(Supplier<CuratorFramework> curatorSupplier) { this.paths = new ZookeeperPaths("/hermes"); this.curatorSupplier = curatorSupplier; this.curator = curatorSupplier.get(); this.groupRepository = new ZookeeperGroupRepository(curator, objectMapper, paths); this.topicRepository = new ZookeeperTopicRepository(curator, objectMapper, paths, groupRepository); this.subscriptionRepository = new ZookeeperSubscriptionRepository(curator, objectMapper, paths, topicRepository); this.configFactory = new MutableConfigFactory().overrideProperty(CONSUMER_WORKLOAD_REBALANCE_INTERVAL, 1); this.consumersRegistry = new ConsumerNodesRegistry(curator, executorService, paths.consumersRegistryPath(CLUSTER_NAME), "id"); this.metrics = mock(HermesMetrics.class); when(metrics.consumersWorkloadRebalanceDurationTimer(anyString())).thenReturn(new Timer()); try { curator.create().creatingParentsIfNeeded().forPath("/hermes/groups"); consumersRegistry.start(); } catch (Exception e) { throw new InternalProcessingException(e); } }
Source:
<code>public void testDefaults() { <START> ConfigAssertions.assertRecordedDefaults(ConfigAssertions.recordDefaults(JsonWebTokenConfig.class) <END> .setKey(null) .setRequiredAudience(null) .setRequiredIssuer(null)); }</code><technical_language>Static import assertion methods</technical_language>

Target:
public void testDefaults() { assertRecordedDefaults(ConfigAssertions.recordDefaults(JsonWebTokenConfig.class) .setKey(null) .setRequiredAudience(null) .setRequiredIssuer(null)); }
Source:
<code>public Message[] getErrors() { Message[] messages = new Message[fErrors.size()]; int i = 0; for (String <START> string : <END> fErrors) { messages[i++] = new Message(string, -1); } return messages; }</code><technical_language>rename message</technical_language>

Target:
public Message[] getErrors() { Message[] messages = new Message[fErrors.size()]; int i = 0; for (String message : fErrors) { messages[i++] = new Message(message, -1); } return messages; }
Source:
<code>public void publishJobModelVersion(String oldVersion, String newVersion) { Stat stat = new Stat(); String currentVersion = zkClient.<String>readData(keyBuilder.getJobModelVersionPath(), stat); LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat .getVersion() + ")"); if (currentVersion != null && !currentVersion.equals(oldVersion)) { throw new SamzaException( "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion); } int dataVersion = stat.getVersion(); try { stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion); } catch (Exception e) { String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion; LOG.error(msg, e); <START> throw new SamzaException(e); <END> } LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) + "(actual data version after update = " + stat.getVersion() + ")"); }</code><technical_language>Please leave msg</technical_language>

Target:
public void publishJobModelVersion(String oldVersion, String newVersion) { Stat stat = new Stat(); String currentVersion = zkClient.<String>readData(keyBuilder.getJobModelVersionPath(), stat); LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat .getVersion() + ")"); if (currentVersion != null && !currentVersion.equals(oldVersion)) { throw new SamzaException( "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion); } int dataVersion = stat.getVersion(); try { stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion); } catch (Exception e) { String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion; LOG.error(msg, e); throw new SamzaException(msg, e); } LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) + "(actual data version after update = " + stat.getVersion() + ")"); }
Source:
<code>private String generateExcludes(final Iterable<String> excludes) { final StringBuilder xml = new StringBuilder(75); xml.append("<FindBugsFilter><Match><Or>"); for (final String exclude : excludes) { <START> xml.append("<Class name=\"").append(exclude).append("\"/>"); <END> } xml.append("</Or></Match></FindBugsFilter>"); return xml.toString(); }</code><technical_language>yeah, this is a bad idea, exclude equal to, say, "hey" entire code crash. find a Xembly</technical_language>

Target:
private String generateExcludes(final Iterable<String> excludes) { final Directives directives = new Directives() .add("FindBugsFilter") .add("Match") .add("Or"); for (final String exclude : excludes) { if (exclude != null) { directives.add("Class").attr("name", exclude).up(); } } return new Xembler(directives).xmlQuietly(); }
Source:
<code>public Registration deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { JsonNode node = p.readValueAsTree(); <START> Registration.Builder builder = Registration.builder(); <END> if (node.hasNonNull("name")) { builder.name(node.get("name").asText()); } if (node.hasNonNull("url")) { String url = node.get("url").asText(); builder.healthUrl(url.replaceFirst("/+$", "") + "/health").managementUrl(url); } else { if (node.hasNonNull("healthUrl")) { builder.healthUrl(node.get("healthUrl").asText()); } if (node.hasNonNull("managementUrl")) { builder.managementUrl(node.get("managementUrl").asText()); } if (node.hasNonNull("serviceUrl")) { builder.serviceUrl(node.get("serviceUrl").asText()); } } if (node.hasNonNull("metadata")) { Iterator<Map.Entry<String, JsonNode>> it = node.get("metadata").fields(); while (it.hasNext()) { Map.Entry<String, JsonNode> entry = it.next(); builder.metadata(entry.getKey(), entry.getValue().asText()); } } return builder.build(); }</code><technical_language>iirc source is added in controller part of request</technical_language>

Target:
public Registration deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { JsonNode node = p.readValueAsTree(); Registration.Builder builder = Registration.builder(); if (node.hasNonNull("name")) { builder.name(node.get("name").asText()); } if (node.hasNonNull("url")) { String url = node.get("url").asText(); builder.healthUrl(url.replaceFirst("/+$", "") + "/health").managementUrl(url); } else { if (node.hasNonNull("healthUrl")) { builder.healthUrl(node.get("healthUrl").asText()); } if (node.hasNonNull("managementUrl")) { builder.managementUrl(node.get("managementUrl").asText()); } if (node.hasNonNull("serviceUrl")) { builder.serviceUrl(node.get("serviceUrl").asText()); } } if (node.has("metadata")) { Iterator<Map.Entry<String, JsonNode>> it = node.get("metadata").fields(); while (it.hasNext()) { Map.Entry<String, JsonNode> entry = it.next(); builder.metadata(entry.getKey(), entry.getValue().asText()); } } if (node.hasNonNull("source")) { builder.source(node.get("source").asText()); } return builder.build(); }
Source:
<code>private Map<Long, Pair<String, Long>> recoverPendingLargeMessages() throws Exception { Map<Long, Pair<String, Long>> largeMessages = new HashMap<>(); List<String> filenames = largeMessagesFactory.listFiles("msg"); List<Long> idList = new ArrayList<>(); for (String filename : filenames) { <START> Long id = getLargeMessageIdFromFilename(filename); <END> if (!largeMessagesToDelete.containsKey(id)) { idList.add(id); SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename); long size = seqFile.size(); largeMessages.put(id, new Pair<>(filename, size)); } } return largeMessages; }</code><technical_language>a primitive long</technical_language>

Target:
private Map<Long, Pair<String, Long>> recoverPendingLargeMessages() throws Exception { Map<Long, Pair<String, Long>> largeMessages = new HashMap<>(); List<String> filenames = largeMessagesFactory.listFiles("msg"); for (String filename : filenames) { long id = getLargeMessageIdFromFilename(filename); if (!largeMessagesToDelete.containsKey(id)) { SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename); long size = seqFile.size(); largeMessages.put(id, new Pair<>(filename, size)); } } return largeMessages; }
Source:
<code><START> public void setComponent(T component) { <END> this.component = component; }</code><technical_language>I introduced mutability here? Local variables worked well. If want that, please setters package-private</technical_language>

Target:
void setComponent(T component) { this.component = component; }
Source:
<code>private void activeDetailModelChanging(HasEntity<D> newValue, boolean stopRefresh) { for (HasEntity<D> oldValue : activeDetailModels) { if (oldValue != null <START> && stopRefresh) { <END> oldValue.setEntity(null); if (oldValue instanceof SearchableListModel) { ((SearchableListModel) oldValue).stopRefresh(); } } } if (newValue != null) { newValue.setEntity(provideDetailModelEntity(getSelectedItem())); } }</code><technical_language>a top-level if (stopRefresh) guard condition better, instead of checking loop</technical_language>

Target:
private void activeDetailModelChanging(HasEntity<D> newValue, boolean stopRefresh) { if (stopRefresh) { for (HasEntity<D> oldValue : activeDetailModels) { if (oldValue != null) { oldValue.setEntity(null); if (oldValue instanceof SearchableListModel) { ((SearchableListModel) oldValue).stopRefresh(); } } } } if (newValue != null) { newValue.setEntity(provideDetailModelEntity(getSelectedItem())); } }
Source:
<code>public void findAllPaginationTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@gmail.com") .build(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/eperson/epersons") .param("size", "1")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.contains(Matchers.anyOf( EPersonMatcher.matchEPersonOnEmail(eperson.getEmail()), EPersonMatcher.matchEPersonOnEmail(admin.getEmail()), <START> EPersonMatcher.matchEPersonOnEmail(ePerson.getEmail()) <END> )))) .andExpect(jsonPath("$._embedded.epersons", Matchers.hasSize(1))) .andExpect(jsonPath("$.page.size", is(1))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient(token).perform(get("/api/eperson/epersons") .param("size", "1") .param("page", "1")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.contains(Matchers.anyOf( EPersonMatcher.matchEPersonOnEmail(eperson.getEmail()), EPersonMatcher.matchEPersonOnEmail(admin.getEmail()), EPersonMatcher.matchEPersonOnEmail(ePerson.getEmail()) )))) .andExpect(jsonPath("$._embedded.epersons", Matchers.hasSize(1))) .andExpect(jsonPath("$.page.size", is(1))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient().perform(get("/api/eperson/epersons")) .andExpect(status().isForbidden()) ; }</code><technical_language>variables eperson ePerson confusing in block. more specific names used</technical_language>

Target:
public void findAllPaginationTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson testEPerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(get("/api/eperson/epersons") .param("size", "2")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.containsInAnyOrder( EPersonMatcher.matchEPersonEntry(admin), EPersonMatcher.matchEPersonEntry(testEPerson) ))) .andExpect(jsonPath("$._embedded.epersons", Matchers.not( Matchers.contains( EPersonMatcher.matchEPersonEntry(admin) ) ))) .andExpect(jsonPath("$.page.size", is(2))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient(authToken).perform(get("/api/eperson/epersons") .param("size", "2") .param("page", "1")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.contains( EPersonMatcher.matchEPersonEntry(eperson) ))) .andExpect(jsonPath("$._embedded.epersons", Matchers.hasSize(1))) .andExpect(jsonPath("$.page.size", is(2))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient().perform(get("/api/eperson/epersons")) .andExpect(status().isUnauthorized()) ; }
Source:
<code>public void testAccessControl_studentNotExistInCourse_shouldFail() { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse2 = typicalBundle.students.get("student1InCourse2"); CourseAttributes typicalCourse1 = typicalBundle.courses.get("typicalCourse1"); <START> loginAsInstructor(instructor1OfCourse1.googleId); <END> String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, typicalCourse1.getId(), Const.ParamsNames.STUDENT_EMAIL, student1InCourse2.getEmail(), }; verifyCannotAccess(submissionParams); }</code><technical_language>test for instructor student</technical_language>

Target:
public void testAccessControl_studentNotExistInCourse_shouldFail() { StudentAttributes student1InCourse2 = typicalBundle.students.get("student1InCourse2"); CourseAttributes typicalCourse1 = typicalBundle.courses.get("typicalCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, typicalCourse1.getId(), Const.ParamsNames.STUDENT_EMAIL, student1InCourse2.getEmail(), }; verifyInaccessibleForInstructors(submissionParams); verifyInaccessibleForStudents(submissionParams); }
Source:
<code>public @Nullable String resolveDeviceType(int quark, long timestamp) { <START> return TmfStrings.cpu(); <END> }</code><technical_language>this TmfCpuAspect</technical_language>

Target:
public @Nullable String resolveDeviceType(int quark, long timestamp) { ITmfTrace trace = getTrace(); if (trace != null) { for (ITmfEventAspect<?> aspect : trace.getEventAspects()) { if (aspect instanceof TmfCpuAspect) { return ((TmfCpuAspect) aspect).getDeviceType(); } } } return "unknown"; }
Source:
<code>public void run() { <START> logger.info("System Resource: {}", <END> SystemResourceMonitor.create(SystemResourceMonitor.allResources).getFormattedSystemResourceUsage()); }</code><technical_language>create method call separate logger call</technical_language>

Target:
public void run() { logger.info("System Resource: {}", allResourceMonitor.getFormattedSystemResourceUsage()); }
Source:
<code>public RangeResourceEntry remove(ResourceEntry<Long> resourceEntry) { RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; <START> if (this.begin > rangeResourceEntry.getBegin()) { <END> this.begin = rangeResourceEntry.getBegin(); } if (this.end < rangeResourceEntry.getEnd()) { this.end = rangeResourceEntry.getEnd(); } return this; }</code><technical_language>This of remove me, range beginning end, if remove resourceEntry.begin resourceEntry.end, if original is larger resourceEntry.begin set resourceEntry.begin, adding ports resourceEntry.begin range. Similarly for end</technical_language>

Target:
public RangeResourceEntry remove(ResourceEntry<Long> resourceEntry) { RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; if (this.begin < rangeResourceEntry.getBegin()) { this.begin = rangeResourceEntry.getBegin(); } if (this.end > rangeResourceEntry.getEnd()) { this.end = rangeResourceEntry.getEnd(); } return this; }
Source:
<code>public void secondary_no_location() throws Exception { <START> thrown.expectMessage("Precise secondary location should contain at least one '^'"); <END> check( "foo(); "x = bar();\n" + " TestIssue.create("msg1", 1).secondary("Secondary message", 3, 5, 8)); }</code><technical_language>@vilchik-elena message give line number</technical_language>

Target:
public void secondary_no_location() throws Exception { thrown.expectMessage("Precise location should contain at least one '^' for comment at line 3"); check( "foo(); "x = bar();\n" + " TestIssue.create("msg1", 1).secondary("Secondary message", 3, 5, 8)); }
Source:
<code>public ASN1DataFormat() { <START> super(); <END> this.usingIterator = false; }</code><technical_language>3 implicit super() calls removed</technical_language>

Target:
public ASN1DataFormat() { this.usingIterator = false; }
Source:
<code>public Long getUuid() { <START> return new Long(artId); <END> }</code><technical_language>Long.valueOf() instead of new Long() - for performance reasons</technical_language>

Target:
public Long getUuid() { return Long.valueOf(artId); }
Source:
<code>public void testCreateProcessWithLogonW() { String winDir = Kernel32Util.getEnvironmentVariable("WINDIR"); if (winDir == null || !(new File(winDir).exists())) { throw new IllegalStateException("WINDIR environment variable did not properly resolve to a directory."); <START> } <END> STARTUPINFO si = new STARTUPINFO(); si.lpDesktop = null; PROCESS_INFORMATION results = new PROCESS_INFORMATION(); boolean result = Advapi32.INSTANCE.CreateProcessWithLogonW("A" + System.currentTimeMillis(), "localhost", "12345", Advapi32.LOGON_WITH_PROFILE, new File(winDir, "notepad.exe").getAbsolutePath(), "", 0, null, "", si, results); assertFalse(result); assertEquals(Native.getLastError(), W32Errors.ERROR_LOGON_FAILURE); }</code><technical_language>assertNotNull("No WINDIR returned", winDir); assertTrue("Specified WINDIR exist: " + winDir, new File(winDir).exists());</technical_language>

Target:
public void testCreateProcessWithLogonW() { String winDir = Kernel32Util.getEnvironmentVariable("WINDIR"); assertNotNull("No WINDIR value returned", winDir); assertTrue("Specified WINDIR does not exist: " + winDir, new File(winDir).exists()); STARTUPINFO si = new STARTUPINFO(); si.lpDesktop = null; PROCESS_INFORMATION results = new PROCESS_INFORMATION(); boolean result = Advapi32.INSTANCE.CreateProcessWithLogonW("A" + System.currentTimeMillis(), "localhost", "12345", Advapi32.LOGON_WITH_PROFILE, new File(winDir, "notepad.exe").getAbsolutePath(), "", 0, null, "", si, results); assertFalse("CreateProcessWithLogonW should have returned false because the username was bogus.", result); assertEquals("GetLastError() should have returned ERROR_LOGON_FAILURE because the username was bogus.", W32Errors.ERROR_LOGON_FAILURE, Native.getLastError()); }
Source:
<code>public void compileSuccessForBundleSparseArray() { CompileResult result = compileFiles(BundleSparseArrayCompileSuccessActivity.class); <START> assertCompilationSuccessful(result); <END> }</code><technical_language>Sorry, i i clear. Please add assertGeneratedClassContains() check correct method call generated</technical_language>

Target:
public void compileSuccessForBundleSparseArray() { String[] methodSignature = { " @Override", " public void onSaveInstanceState(Bundle bundle_) {", " super.onSaveInstanceState(bundle_);", " bundle_.putSparseParcelableArray(\"sparseArrayWithParcelable\", sparseArrayWithParcelable);", " bundle_.putSparseParcelableArray(\"sparseArrayWithExtendParcelable\", sparseArrayWithExtendParcelable);", " }", "", " private void restoreSavedInstanceState_(Bundle savedInstanceState) {", " if (savedInstanceState == null) {", " return;", " }", " sparseArrayWithParcelable = savedInstanceState.getSparseParcelableArray(\"sparseArrayWithParcelable\");", " sparseArrayWithExtendParcelable = savedInstanceState.getSparseParcelableArray(\"sparseArrayWithExtendParcelable\");", " }"}; CompileResult result = compileFiles(BundleSparseArrayCompileSuccessActivity.class); assertCompilationSuccessful(result); assertGeneratedClassContains(toGeneratedFile(BundleSparseArrayCompileSuccessActivity.class), methodSignature); }
Source:
<code>public ExecutionError filter(ExecutionErrorContext errorContext) { <START> Builder errorBuilder = ExecutionError.builder().type("DB").initActivityId(getInitActivityId(errorContext)); <END> String stacktrace = getStackTrace(errorContext.getCause()); Task task = errorContext.getLastExecutedTask(); NodeInstance nodeInstance = errorContext.getLastExecutedNode(); logger.debug("Last executed node instance {}, last executed task {}", nodeInstance, task); if (nodeInstance != null) { logger.debug("Last executed node instance will be used to populate error details", nodeInstance); errorBuilder .deploymentId(((ProcessInstanceImpl)nodeInstance.getProcessInstance()).getDeploymentId()) .processInstanceId(nodeInstance.getProcessInstance().getId()) .processId(nodeInstance.getProcessInstance().getProcessId()) .activityId(nodeInstance.getId()) .activityName(nodeName(nodeInstance)); } else if (task != null) { logger.debug("Last executed task will be used to populate error details", task); errorBuilder .deploymentId(task.getTaskData().getDeploymentId()) .processInstanceId(task.getTaskData().getProcessInstanceId()) .processId(task.getTaskData().getProcessId()) .activityId(task.getId()) .activityName(task.getName()); } return errorBuilder .message(errorContext.getCause().getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }</code><technical_language>good constants for builder types, right hard-coded strings "DB", "Task". WDYT</technical_language>

Target:
public ExecutionError filter(ExecutionErrorContext errorContext) { Builder errorBuilder = ExecutionError.builder().type(TYPE).initActivityId(getInitActivityId(errorContext)); String stacktrace = getStackTrace(errorContext.getCause()); Task task = errorContext.getLastExecutedTask(); NodeInstance nodeInstance = errorContext.getLastExecutedNode(); logger.debug("Last executed node instance {}, last executed task {}", nodeInstance, task); if (nodeInstance != null) { logger.debug("Last executed node instance will be used to populate error details", nodeInstance); errorBuilder .deploymentId(((ProcessInstanceImpl)nodeInstance.getProcessInstance()).getDeploymentId()) .processInstanceId(nodeInstance.getProcessInstance().getId()) .processId(nodeInstance.getProcessInstance().getProcessId()) .activityId(nodeInstance.getId()) .activityName(nodeName(nodeInstance)); } else if (task != null) { logger.debug("Last executed task will be used to populate error details", task); errorBuilder .deploymentId(task.getTaskData().getDeploymentId()) .processInstanceId(task.getTaskData().getProcessInstanceId()) .processId(task.getTaskData().getProcessId()) .activityId(task.getId()) .activityName(task.getName()); } return errorBuilder .message(errorContext.getCause().getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }
Source:
<code>public Urllib login() throws LoginException, BankException, IOException { LoginPackage lp = preLogin(); HttpResponse response = urlopen.openAsHttpResponse(lp.getLoginTarget(), new StringEntity(objectAsJson(new LoginRequest(getUsername(), getPassword())), HTTP.UTF_8), true); loginResponse = MAPPER.reader() .withType(LoginResponse.class) .readValue(response.getEntity().getContent()); <START> if(loginResponse.getLogonData().getStatus() != 0) { <END> throw new BankException(loginResponse.getLogonData().getMessage()); } urlopen.addHeader("cupcake", loginResponse.getLogonData().getCupcake()); return urlopen; }</code><technical_language>get Android Studio highlight for type. Settings / Editor / Inspections / Java / Constant conditions & exceptions. Enable inspection, check "Suggest @Nullable annotations ...". get this type, as-you-do-PRs :). Yay, short feedback cycles</technical_language>

Target:
public Urllib login() throws LoginException, BankException, IOException { LoginPackage lp = preLogin(); loginResponse = parseLoginResponse(urlopen.openAsHttpResponse( lp.getLoginTarget(), new StringEntity( objectAsJson(new LoginRequest( getUsername(), getPassword())), HTTP.UTF_8), true)); urlopen.addHeader("cupcake", loginResponse.getLogonData().getCupcake()); return urlopen; }
Source:
<code>public boolean walRollFinished() { <START> return wals.values().stream().noneMatch(RollController::isRollRequested) && isWaiting(); <END> }</code><technical_language>isRollRequested, need needsRoll</technical_language>

Target:
public boolean walRollFinished() { return wals.values().stream().noneMatch(rc -> rc.needsRoll(System.currentTimeMillis())) && isWaiting(); }
Source:
<code>private Function<IConstraintEvaluationContext, Float> createCostFunction(IQueryRuntimeContext runtimeContext, PQuery query){ Object object = hintProvider.getHints(query).get(LocalSearchHintKeys.PLANNER_COST_FUNCTION); <START> if (object instanceof ICostFunction){ ICostFunction costFunction = (ICostFunction)object; return costFunction; } <END> return new IndexerBasedConstraintCostFunction(); }</code><technical_language>some kind of a warning if cost function, provided a hint, is rejected of invalid type default implementation is used</technical_language>

Target:
private Function<IConstraintEvaluationContext, Float> createCostFunction(IQueryRuntimeContext runtimeContext, PQuery query){ Object object = hintProvider.getHints(query).get(LocalSearchHintKeys.PLANNER_COST_FUNCTION); if (object != null){ Preconditions.checkArgument(object instanceof ICostFunction); ICostFunction costFunction = (ICostFunction)object; return costFunction; } return new IndexerBasedConstraintCostFunction(); }
Source:
<code><START> void processMsg(TxMessage txMessage) { <END> OpaqueEntry opaqueEntry = OpaqueEntry.deserialize(Unpooled.wrappedBuffer(txMessage.getData())); Map<UUID, List<SMREntry>> map = opaqueEntry.getEntries(); if (!streamUUIDs.contains(map.keySet())) { log.error("txMessage contains noisy streams {}, expecting {}", map.keySet(), streamUUIDs); } try { rt.getObjectsView().TXBegin(); TokenResponse tokenResponse = rt.getSequencerView().next((UUID[])(map.keySet().toArray())); MultiObjectSMREntry multiObjectSMREntry = new MultiObjectSMREntry(); for (UUID uuid : opaqueEntry.getEntries().keySet()) { for(SMREntry smrEntry : opaqueEntry.getEntries().get(uuid)) { multiObjectSMREntry.addTo(uuid, smrEntry); } } rt.getAddressSpaceView().write(tokenResponse.getToken(), multiObjectSMREntry); } finally { rt.getObjectsView().TXEnd(); } }</code><technical_language>ths need throw exception</technical_language>

Target:
void processMsg(TxMessage txMessage) throws Exception { OpaqueEntry opaqueEntry = OpaqueEntry.deserialize(Unpooled.wrappedBuffer(txMessage.getData())); Map<UUID, List<SMREntry>> map = opaqueEntry.getEntries(); if (!streamUUIDs.containsAll(map.keySet())) { log.error("txMessage contains noisy streams {}, expecting {}", map.keySet(), streamUUIDs); throw new Exception("Wrong streams set"); } try { rt.getObjectsView().TXBegin(); TokenResponse tokenResponse = rt.getSequencerView().next((UUID[])(map.keySet().toArray())); MultiObjectSMREntry multiObjectSMREntry = new MultiObjectSMREntry(); for (UUID uuid : opaqueEntry.getEntries().keySet()) { for(SMREntry smrEntry : opaqueEntry.getEntries().get(uuid)) { multiObjectSMREntry.addTo(uuid, smrEntry); } } rt.getAddressSpaceView().write(tokenResponse.getToken(), multiObjectSMREntry); } catch (Exception e) { log.error("Catch an exception while processing message {}", txMessage.getMetadata(), e); throw e; } finally { rt.getObjectsView().TXEnd(); } }
Source:
<code>private void sendEvents() throws MalformedURLException { URL url = new URL(cleanupUrl(managementCenterUrl) + "events.do"); OutputStream outputStream = null; OutputStreamWriter writer = null; try { HttpURLConnection connection = openJsonConnection(url); outputStream = connection.getOutputStream(); writer = new OutputStreamWriter(outputStream, "UTF-8"); ArrayList<Event> eventList = new ArrayList<Event>(); events.drainTo(eventList); String groupName = instance.getConfig().getGroupConfig().getName(); String address = instance.node.address.getHost() + ":" + instance.node.address.getPort(); <START> JsonObject batch = !eventList.isEmpty() ? new EventBatch(groupName, address, eventList).toJson() : null; <END> if (batch != null) { batch.writeTo(writer); writer.flush(); outputStream.flush(); boolean success = post(connection); if (eventSendFailed && success) { logger.info("Sent events to Management Center successfully."); eventSendFailed = false; } } } catch (Exception e) { if (!eventSendFailed) { eventSendFailed = true; log("Failed to send events to Management Center.", e); } } finally { closeResource(writer); closeResource(outputStream); } }</code><technical_language>Minor: check if managed drain events opening connection avoid unnecessarily opening it</technical_language>

Target:
private void sendEvents() throws MalformedURLException { ArrayList<Event> eventList = new ArrayList<Event>(); if (events.drainTo(eventList) == 0) { return; } URL url = new URL(cleanupUrl(managementCenterUrl) + "events.do"); OutputStream outputStream = null; OutputStreamWriter writer = null; try { String groupName = instance.getConfig().getGroupConfig().getName(); String address = instance.node.address.getHost() + ":" + instance.node.address.getPort(); JsonObject batch = new EventBatch(groupName, address, eventList).toJson(); HttpURLConnection connection = openJsonConnection(url); outputStream = connection.getOutputStream(); writer = new OutputStreamWriter(outputStream, "UTF-8"); batch.writeTo(writer); writer.flush(); outputStream.flush(); boolean success = post(connection); if (eventSendFailed && success) { logger.info("Sent events to Management Center successfully."); eventSendFailed = false; } } catch (Exception e) { if (!eventSendFailed) { eventSendFailed = true; log("Failed to send events to Management Center.", e); } } finally { closeResource(writer); closeResource(outputStream); } }
Source:
<code>public boolean hasNextFor(int consumer) { <START> if (consumer >= numProducers) <END> throw new ND4JIllegalStateException("Non-existent consumer was requested"); return asyncIterators.get(consumer).hasNext(); }</code><technical_language>Again, pedantic, if checking, consumer < 0 || consumer >= numProducers)</technical_language>

Target:
public boolean hasNextFor(int consumer) { if (consumer >= numProducers || consumer < 0) throw new ND4JIllegalStateException("Non-existent consumer was requested"); return asyncIterators.get(consumer).hasNext(); }
Source:
<code>private RegistryAuth parseDockerConfig(final Path configPath, final String serverAddress) throws IOException { checkNotNull(configPath); final Map<String, RegistryAuth> configs = parseDockerConfig(configPath).configs(); if (isNullOrEmpty(serverAddress)) { if (configs.isEmpty()) { return RegistryAuth.builder().build(); } LOG.warn("Returning first entry from docker config file - use fromConfig(Path) instead, " + "this behavior is deprecated and will soon be removed"); return configs.values().iterator().next(); } if (configs.containsKey(serverAddress)) { return configs.get(serverAddress); } try { final URI serverAddressUri = new URI(serverAddress); if (serverAddressUri.getScheme() == null) { <START> final String addrWithProto = "https://" + serverAddress; <END> if (configs.containsKey(addrWithProto)) { return configs.get(addrWithProto); } } } catch (URISyntaxException e) { } throw new IllegalArgumentException( "serverAddress=" + serverAddress + " does not appear in config file at " + configPath); }</code><technical_language>check http://</technical_language>

Target:
private RegistryAuth parseDockerConfig(final Path configPath, final String serverAddress) throws IOException { checkNotNull(configPath); final Map<String, RegistryAuth> configs = parseDockerConfig(configPath).configs(); if (isNullOrEmpty(serverAddress)) { if (configs.isEmpty()) { return RegistryAuth.builder().build(); } LOG.warn("Returning first entry from docker config file - use fromConfig(Path) instead, " + "this behavior is deprecated and will soon be removed"); return configs.values().iterator().next(); } if (configs.containsKey(serverAddress)) { return configs.get(serverAddress); } try { final URI serverAddressUri = new URI(serverAddress); if (serverAddressUri.getScheme() == null) { for (String proto : Arrays.asList("https://", "http://")) { final String addrWithProto = proto + serverAddress; if (configs.containsKey(addrWithProto)) { return configs.get(addrWithProto); } } } } catch (URISyntaxException e) { } throw new IllegalArgumentException( "serverAddress=" + serverAddress + " does not appear in config file at " + configPath); }
Source:
<code>public ExecuteCliParsersJob(CliCommandLine commandLine) { super("Executing CLI parser"); <START> setSystem(true); <END> fCommandLine = commandLine; }</code><technical_language>System jobs cancelled users. I if user job cancelled progress view</technical_language>

Target:
public ExecuteCliParsersJob(CliCommandLine commandLine) { super("Executing CLI parser"); fCommandLine = commandLine; }
Source:
<code>private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); <START> switch (stateValue.getType()) { <END> case LONG: fSymbol = stateValue.unboxLong(); break; case STRING: fSymbol = stateValue.unboxStr(); break; case INTEGER: fSymbol = stateValue.unboxInt(); break; case DOUBLE: case NULL: case CUSTOM: default: break; } CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, fSymbol, depth); fRootFunctions.add(segment); if (!findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor)) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }</code><technical_language>pass statevalue</technical_language>

Target:
private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue, depth); fRootFunctions.add(segment); if (!findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor)) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }
Source:
<code>public void queryIntentActivities_DisabledComponentImplicitIntent() throws Exception { Uri uri = Uri.parse("content://testhost1.com:1/testPath/test.jpeg"); Intent i = new Intent(Intent.ACTION_VIEW); i.addCategory(Intent.CATEGORY_DEFAULT); i.setDataAndType(uri, "image/jpeg"); ComponentName componentToDisable = new ComponentName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); packageManager.setComponentEnabledSetting(componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(i, 0); assertThat(resolveInfos).isNotNull(); <START> assertThat(resolveInfos).hasSize(0); <END> }</code><technical_language>isEmpty() I do hasSize(0)</technical_language>

Target:
public void queryIntentActivities_DisabledComponentImplicitIntent() throws Exception { Uri uri = Uri.parse("content://testhost1.com:1/testPath/test.jpeg"); Intent i = new Intent(Intent.ACTION_VIEW); i.addCategory(Intent.CATEGORY_DEFAULT); i.setDataAndType(uri, "image/jpeg"); ComponentName componentToDisable = new ComponentName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); packageManager.setComponentEnabledSetting( componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(i, 0); assertThat(resolveInfos).isEmpty(); }
Source:
<code>public Long execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup(KieSession.class); ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); if (processInstance == null) { throw new ProcessInstanceNotFoundException("No process instance found with id " + processInstanceId); } CaseEventSupport caseEventSupport = getCaseEventSupport(context); caseEventSupport.fireBeforeDynamicProcessAdded(caseId, processInstanceId, processId, parameters); long subProcessInstanceId = DynamicUtils.addDynamicSubProcess(processInstance, ksession, processId, parameters); if (subProcessInstanceId < 0) { <START> throw new ProcessDefinitionNotFoundException("No process definition found with id: " + processId); <END> } caseEventSupport.fireAfterDynamicProcessAdded(caseId, processInstanceId, processId, parameters, subProcessInstanceId); return subProcessInstanceId; }</code><technical_language>shoul get exception (most if type DynamicUtils is in jbpm-flow ProcessDefinitionNotFoundException is there) wrap ProcessDefinitionNotFoundException rethow</technical_language>

Target:
public Long execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup(KieSession.class); ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); if (processInstance == null) { throw new ProcessInstanceNotFoundException("No process instance found with id " + processInstanceId); } try { CaseEventSupport caseEventSupport = getCaseEventSupport(context); caseEventSupport.fireBeforeDynamicProcessAdded(caseId, processInstanceId, processId, parameters); long subProcessInstanceId = DynamicUtils.addDynamicSubProcess(processInstance, ksession, processId, parameters); caseEventSupport.fireAfterDynamicProcessAdded(caseId, processInstanceId, processId, parameters, subProcessInstanceId); return subProcessInstanceId; } catch (IllegalArgumentException e) { throw new ProcessDefinitionNotFoundException(e.getMessage()); } }
Source:
<code>protected void showPageRec(PageRec pageRec) { super.showPageRec(pageRec); if (pageRec.page == getDefaultPage()) { if (propertiesPage != null) { propertiesPage.selectionChanged(null, <START> new StructuredSelection()); <END> } } }</code><technical_language>a StructuredSelection.EMPTY for cases</technical_language>

Target:
protected void showPageRec(PageRec pageRec) { super.showPageRec(pageRec); if (pageRec.page == getDefaultPage()) { if (propertiesPage != null) { propertiesPage.selectionChanged(null, StructuredSelection.EMPTY); } } }
Source:
<code>public void setDocumentExpiration(String id, Date expiration) throws CouchbaseLiteException { synchronized (lock) { try { if(getC4Database().get(id, true) == null) <START> return; <END> if (expiration == null) { getC4Database().setExpiration(id, 0); } else { long timestamp = expiration.getTime(); getC4Database().setExpiration(id, timestamp); } scheduleDocumentExpiration(0); } catch (LiteCoreException e) { throw CBLStatus.convertException(e); } } }</code><technical_language>I throw NotFound Exception</technical_language>

Target:
public void setDocumentExpiration(String id, Date expiration) throws CouchbaseLiteException { synchronized (lock) { try { if (expiration == null) { getC4Database().setExpiration(id, 0); } else { long timestamp = expiration.getTime(); getC4Database().setExpiration(id, timestamp); } scheduleDocumentExpiration(0); } catch (LiteCoreException e) { throw CBLStatus.convertException(e); } } }
Source:
<code>public void testStartEmptyCaseUsingLoggedInOwner() { assertNotNull(deploymentService); DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION); deploymentService.deploy(deploymentUnit); <START> units.add(deploymentUnit); <END> identityProvider.setName("mary"); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); try { CaseInstance cInstance = caseService.getCaseInstance(caseId); assertNotNull(cInstance); assertEquals("mary", cInstance.getOwner()); assertEquals(deploymentUnit.getIdentifier(), cInstance.getDeploymentId()); caseService.cancelCase(caseId); try { caseService.getCaseInstance(caseId); fail("Case was aborted so it should not be found any more"); } catch (CaseNotFoundException e) { } caseId = null; } catch (Exception e) { logger.error("Unexpected error {}", e.getMessage(), e); fail("Unexpected exception " + e.getMessage()); } finally { if (caseId != null) { caseService.cancelCase(caseId); } } }</code><technical_language>@cristianonicolai good, thanks</technical_language>

Target:
public void testStartEmptyCaseUsingLoggedInOwner() { identityProvider.setName("mary"); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); try { CaseInstance cInstance = caseService.getCaseInstance(caseId); assertNotNull(cInstance); assertEquals("mary", cInstance.getOwner()); assertEquals(deploymentUnit.getIdentifier(), cInstance.getDeploymentId()); caseService.cancelCase(caseId); try { caseService.getCaseInstance(caseId); fail("Case was aborted so it should not be found any more"); } catch (CaseNotFoundException e) { } caseId = null; } catch (Exception e) { logger.error("Unexpected error {}", e.getMessage(), e); fail("Unexpected exception " + e.getMessage()); } finally { if (caseId != null) { caseService.cancelCase(caseId); } } }
Source:
<code>public synchronized String format(long value) { long date = value / 1000000; long sec = value / 1000000000; <START> long ms = Math.abs(value % 1000000000 / 1000000); END> long cs = Math.abs(value % 1000000 / 1000); long ns = Math.abs(value % 1000); if (value < 0 && ms + cs + ns > 0 && !super.toPattern().contains(fOpenBracket + "T")) { date -= 1; long nanosec = 1000000000 - (1000000 * ms + 1000 * cs + ns); ms = nanosec / 1000000; cs = nanosec % 1000000 / 1000; ns = nanosec % 1000; } StringBuffer result = new StringBuffer(super.format(date)); result.append(fSubSecPattern); for (String pattern : fSupplPatterns) { int length = pattern.length(); StringBuffer fmt = new StringBuffer(length); for (int i = 0; i < length; i++) { fmt.append("0"); } DecimalFormat dfmt = new DecimalFormat(fmt.toString()); String fmtVal = ""; switch (pattern.charAt(0)) { case 'T': if (value < 0 && sec == 0) { result.insert(0, '-'); } fmtVal = dfmt.format(sec); break; case 'S': fmtVal = dfmt.format(ms); break; case 'C': fmtVal = dfmt.format(cs); break; case 'N': fmtVal = dfmt.format(ns); break; default: break; } String ph = new StringBuffer(fOpenBracket + pattern + fCloseBracket).toString(); int loc = result.indexOf(ph); result.replace(loc, loc + length + fOpenBracket.length() + fCloseBracket.length(), fmtVal); } return result.toString(); }</code><technical_language>add () please</technical_language>

Target:
public synchronized String format(long value) { long date = value / 1000000; long sec = value / 1000000000; long ms = Math.abs((value % 1000000000) / 1000000); long cs = Math.abs((value % 1000000) / 1000); long ns = Math.abs(value % 1000); if (value < 0 && ms + cs + ns > 0 && !super.toPattern().contains(fOpenBracket + "T")) { date -= 1; long nanosec = 1000000000 - (1000000 * ms + 1000 * cs + ns); ms = nanosec / 1000000; cs = (nanosec % 1000000) / 1000; ns = nanosec % 1000; } StringBuffer result = new StringBuffer(super.format(date)); result.append(fSubSecPattern); for (String pattern : fSupplPatterns) { int length = pattern.length(); StringBuffer fmt = new StringBuffer(length); for (int i = 0; i < length; i++) { fmt.append("0"); } DecimalFormat dfmt = new DecimalFormat(fmt.toString()); String fmtVal = ""; switch (pattern.charAt(0)) { case 'T': if (value < 0 && sec == 0) { result.insert(0, '-'); } fmtVal = dfmt.format(sec); break; case 'S': fmtVal = dfmt.format(ms); break; case 'C': fmtVal = dfmt.format(cs); break; case 'N': fmtVal = dfmt.format(ns); break; default: break; } String ph = new StringBuffer(fOpenBracket + pattern + fCloseBracket).toString(); int loc = result.indexOf(ph); result.replace(loc, loc + length + fOpenBracket.length() + fCloseBracket.length(), fmtVal); } return result.toString(); }
Source:
<code>public RowExpressionDomainTranslator(FunctionManager functionManager) { <START> this.functionManager = functionManager; <END> this.logicalRowExpressions = new LogicalRowExpressions(functionManager); this.functionResolution = new StandardFunctionResolution(functionManager); }</code><technical_language>requireNonNull</technical_language>

Target:
public RowExpressionDomainTranslator(FunctionManager functionManager) { this.functionManager = requireNonNull(functionManager, "functionManager is null"); this.logicalRowExpressions = new LogicalRowExpressions(functionManager); this.functionResolution = new StandardFunctionResolution(functionManager); }
Source:
<code>public void testAddTransfer_Anon(){ Map<String, String> transferRequest = new HashMap<>(); transferRequest.put("ticketKey", ticket.getKey()); transferRequest.put("goalUsername", ticketReciever.getUsername()); given() .when() .content(transferRequest).contentType(ContentType.JSON) .post(TRANSFER_ENDPOINT) .then() .statusCode(HttpStatus.SC_FORBIDDEN); ticket = ticketRepository.findByKey(ticket.getKey()).orElse(null); <START> if(ticket == null) Assert.fail("Could not refresh ticket"); <END> Assert.assertTrue(ticket.isLockedForTransfer()); }</code><technical_language>Is this possible? created stored this ticket</technical_language>

Target:
public void testAddTransfer_Anon(){ given(). when(). content(ticketReceiver.getUsername()).contentType(ContentType.TEXT). post(TRANSFER_ENDPOINT + "/" + ticket.getId()). then(). statusCode(HttpStatus.SC_FORBIDDEN); Assert.assertTrue(tttRepository.count() == 0); }
Source:
<code>public void test(TestHarness th) { Object o = new ClassC(); Interface iface = (Interface)o; <START> th.check(true); <END> }</code><technical_language>useful note test fails (presumably exception)</technical_language>

Target:
public void test(TestHarness th) { Object o = new ClassC(); try { Interface iface = (Interface)o; th.check(true); } catch (ClassCastException e) { th.fail("Unexpected exception: " + e); } }