auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean hasDeploymentSubModel(final String subsystemName, final PathElement address) { final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE); final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName); <START> return root.hasChild(subsystem) && root.getChild(subsystem).hasChild(address); <END> }</code><technical_language>this support a null address? other one, support a null empty address</technical_language>

Target:
public boolean hasDeploymentSubModel(final String subsystemName, final PathElement address) { final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE); final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName); return root.hasChild(subsystem) && (address == null || root.getChild(subsystem).hasChild(address)); }
Source:
<code>void scheduleKeepAliveHeartbeat() { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { boolean sessionInUse = restApiSessionId != null; if (sessionInUse && refreshRestApiSession) { <START> sendRequest(createRequest(engineAuthToken), new RestApiRequestCallback()); <END> refreshRestApiSession = false; } return sessionInUse; } }, SESSION_HEARTBEAT_MS); }</code><technical_language>this is followup of above, required</technical_language>

Target:
void scheduleKeepAliveHeartbeat() { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { boolean sessionInUse = restApiSessionId != null; if (sessionInUse && refreshRestApiSession) { sendRequest(createRequest(), new RestApiRequestCallback()); refreshRestApiSession = false; } return sessionInUse; } }, SESSION_HEARTBEAT_MS); }
Source:
<code>public void marriedKeychainBloomFilter() throws Exception { wallet = new Wallet(params); blockStore = new MemoryBlockStore(params); chain = new BlockChain(params, wallet, blockStore); String XPUB = "xpub68KFnj3bqUx1s7mHejLDBPywCAKdJEu1b49uniEEn2WSbHmZ7xbLqFTjJbtx1LUcAt1DwhoqWHmo2s5WMJp6wi38CiF2hYD49qVViKVvAoi"; <START> wallet.addFollowingAccounts(ImmutableList.of(DeterministicKey.deserializeB58(null, XPUB))); <END> Address address = wallet.currentReceiveAddress(); assertTrue(wallet.getBloomFilter(1e-12).contains(address.getHash160())); Transaction t1 = createFakeTx(params, CENT, address); StoredBlock b1 = createFakeBlock(blockStore, t1).storedBlock; TransactionOutPoint outPoint = new TransactionOutPoint(params, 0, t1); assertFalse(wallet.getBloomFilter(1e-12).contains(outPoint.bitcoinSerialize())); wallet.receiveFromBlock(t1, b1, BlockChain.NewBlockType.BEST_CHAIN, 0); assertTrue(wallet.getBloomFilter(1e-12).contains(outPoint.bitcoinSerialize())); }</code><technical_language>I asked this in previous review, "addFollowingAccounts"? talk accounts in other parts of code. ambiguous BIP32 feature of name</technical_language>

Target:
public void marriedKeychainBloomFilter() throws Exception { wallet = new Wallet(params); blockStore = new MemoryBlockStore(params); chain = new BlockChain(params, wallet, blockStore); String XPUB = "xpub68KFnj3bqUx1s7mHejLDBPywCAKdJEu1b49uniEEn2WSbHmZ7xbLqFTjJbtx1LUcAt1DwhoqWHmo2s5WMJp6wi38CiF2hYD49qVViKVvAoi"; wallet.addFollowingAccountKeys(ImmutableList.of(DeterministicKey.deserializeB58(null, XPUB))); Address address = wallet.currentReceiveAddress(); assertTrue(wallet.getBloomFilter(0.001).contains(address.getHash160())); Transaction t1 = createFakeTx(params, CENT, address); StoredBlock b1 = createFakeBlock(blockStore, t1).storedBlock; TransactionOutPoint outPoint = new TransactionOutPoint(params, 0, t1); assertFalse(wallet.getBloomFilter(0.001).contains(outPoint.bitcoinSerialize())); wallet.receiveFromBlock(t1, b1, BlockChain.NewBlockType.BEST_CHAIN, 0); assertTrue(wallet.getBloomFilter(0.001).contains(outPoint.bitcoinSerialize())); }
Source:
<code>public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { IMonitorControl monitor = null; if (receiver instanceof IMonitorControl) { monitor = (IMonitorControl) receiver; <START> } <END> else { if (selectedMonitorId != null) { monitor = MonitorControlManager.getInstance().getMonitorControl(selectedMonitorId); } } if (monitor != null) { if (IS_ACTIVE.equals(property)) { return monitor.isActive() == toBoolean(expectedValue); } } return false; }</code><technical_language>Please this is properly formatted. "else" line }</technical_language>

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { IMonitorControl monitor = null; if (receiver instanceof IMonitorControl) { monitor = (IMonitorControl) receiver; } else if (selectedMonitorId != null) { monitor = MonitorControlManager.getInstance().getMonitorControl(selectedMonitorId); } if (monitor != null && IS_ACTIVE.equals(property)) { return monitor.isActive() == toBoolean(expectedValue); } return false; }
Source:
<code><START> public void testGetTaskRawFormViaUIClient() throws Exception { <END> long processInstanceId = processClient.startProcess(CONTAINER_ID, HIRING_2_PROCESS_ID); assertThat(processInstanceId).isGreaterThan(0); try { List<TaskSummary> tasks = taskClient.findTasksByStatusByProcessInstanceId(processInstanceId, null, 0, 10); assertThat(tasks).isNotNull().hasSize(1); Long taskId = tasks.get(0).getId(); String result = uiServicesClient.getTaskRawForm( CONTAINER_ID, taskId ); logger.debug("Form content is '{}'", result); assertThat(result).isNotNull().isNotEmpty(); } finally { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }</code><technical_language>Please change user USER_YODA here</technical_language>

Target:
public void testGetTaskRawFormViaUIClient() throws Exception { long processInstanceId = processClient.startProcess(CONTAINER_ID, HIRING_2_PROCESS_ID); assertThat(processInstanceId).isGreaterThan(0); try { List<TaskSummary> tasks = taskClient.findTasksByStatusByProcessInstanceId(processInstanceId, null, 0, 10); assertThat(tasks).isNotNull().hasSize(1); Long taskId = tasks.get(0).getId(); changeUser(USER_JOHN); String result = uiServicesClient.getTaskRawForm(CONTAINER_ID, taskId); logger.debug("Form content is '{}'", result); assertThat(result).isNotNull().isNotEmpty(); } finally { changeUser(USER_YODA); processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }
Source:
<code><START> private void buyCard(GameUserBean gameUser, GameBean game, Map<String, String> returnedParams) throws PlayException, GameException { <END> DevelopmentCards availableDevelopmentCards = game.getAvailableDevelopmentCards(); DevelopmentCard obtainedDevelopmentCard = cardUtil.pullDevelopmentCard(availableDevelopmentCards); DevelopmentCards usersDevelopmentCards = gameUser.getDevelopmentCards(); usersDevelopmentCards.increaseQuantityByOne(obtainedDevelopmentCard); availableDevelopmentCards.decreaseQuantityByOne(obtainedDevelopmentCard); returnedParams.put("card", obtainedDevelopmentCard.name()); }</code><technical_language>resourcees player buying dev card</technical_language>

Target:
private void buyCard(GameUserBean gameUser, GameBean game, Map<String, String> returnedParams) throws PlayException, GameException { DevelopmentCards availableDevelopmentCards = game.getAvailableDevelopmentCards(); DevelopmentCard chosenDevelopmentCard = cardUtil.chooseDevelopmentCard(availableDevelopmentCards); log.debug("Card " + chosenDevelopmentCard + " was chosen from the list: " + availableDevelopmentCards); DevelopmentCards usersDevelopmentCards = gameUser.getDevelopmentCards(); usersDevelopmentCards.increaseQuantityByOne(chosenDevelopmentCard); availableDevelopmentCards.decreaseQuantityByOne(chosenDevelopmentCard); returnedParams.put("card", chosenDevelopmentCard.name()); }
Source:
<code>public void returnsCorrectInputWithStream() throws Exception { final byte[] bytes = new Utf8String("Stream returnsCorrectInput!").asBytes(); MatcherAssert.assertThat( <START> "Stream doesn't provide correct bytes", <END> new BytesOf( new Body.Stream(new InputOf(bytes).stream()) ).asBytes(), new IsEqual<>(bytes) ); }</code><technical_language>@Serranya here. above</technical_language>

Target:
public void returnsCorrectInputWithStream() throws Exception { final byte[] bytes = new Utf8String("Stream returnsCorrectInput!").asBytes(); MatcherAssert.assertThat( "Body content of Body.Stream doesn't provide the correct bytes", new BytesOf( new Body.Stream(new InputOf(bytes).stream()) ).asBytes(), new IsEqual<>(bytes) ); }
Source:
<code>private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { <START> long handleSelectorEventsStartTimeMs = System.currentTimeMillis(); <END> for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } List<String> disconnectedList = selector.disconnected(); networkMetrics.connectionsDisconnectedCount.mark(disconnectedList.size()); for (String connId : disconnectedList) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); requestMetadata.onResponseReceive(); } networkMetrics.handleSelectorEventsTime.update(System.currentTimeMillis() - handleSelectorEventsStartTimeMs); }</code><technical_language>is of this metric? I/O cpu intensive stuff done this method</technical_language>

Target:
private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } for (String connId : selector.disconnected()) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); requestMetadata.onResponseReceive(); } }
Source:
<code>public Void visitInstanceOf(InstanceOfTree node, Void p) { if (node.getType().getKind() == Kind.ANNOTATED_TYPE) { <START> AnnotatedTypeMirror type = atypeFactory.fromExpression((ExpressionTree) node.getType()); <END> if (type.hasAnnotation(Nullable.class)) { checker.reportError(node, "instanceof.nullable.error"); } if (type.hasAnnotation(NonNull.class)) { checker.reportWarning(node, "instanceof.nonnull.redundant"); } } return super.visitInstanceOf(node, p); }</code><technical_language>you: - call TreeUtils.annotationsFromTree() - AnnotationUtils.containsSame for annotations need change visibility below</technical_language>

Target:
public Void visitInstanceOf(InstanceOfTree node, Void p) { Tree refTypeTree = node.getType(); if (refTypeTree.getKind() == Kind.ANNOTATED_TYPE) { List<? extends AnnotationMirror> annotations = TreeUtils.annotationsFromTree((AnnotatedTypeTree) refTypeTree); if (AnnotationUtils.containsSame(annotations, NULLABLE)) { checker.reportError(node, "instanceof.nullable"); } if (AnnotationUtils.containsSame(annotations, NONNULL)) { checker.reportWarning(node, "instanceof.nonnull.redundant"); } } return super.visitInstanceOf(node, p); }
Source:
<code>public void onStartup(ServletContext servletContext) { LongTaskTimer longTaskTimer = LongTaskTimer <START> .builder("spring.cloud.dataflow.server").description("DataFlow duration timer") <END> .tags(Tags.empty()).register(Metrics.globalRegistry); this.longTaskSample = longTaskTimer.start(); if (StringUtils.hasText(dataSourceUrl) && dataSourceUrl.startsWith("jdbc:h2:tcp://localhost:")) { logger.info("Start Embedded H2"); initH2TCPServer(); } }</code><technical_language>if this description displayed anywhere. If displayed, please change name DataFlow Spring Cloud Data Flow</technical_language>

Target:
public void onStartup(ServletContext servletContext) { LongTaskTimer longTaskTimer = LongTaskTimer .builder("spring.cloud.dataflow.server").description("Spring Cloud Data Flow duration timer") .tags(Tags.empty()).register(Metrics.globalRegistry); this.longTaskSample = longTaskTimer.start(); if (StringUtils.hasText(dataSourceUrl) && dataSourceUrl.startsWith("jdbc:h2:tcp://localhost:")) { logger.info("Start Embedded H2"); initH2TCPServer(); } }
Source:
<code>public String getJournalKeyFromDoi(String doi, Site site) { Map<String, Object> journalDoiRegexList = getJournalDoiRegexList(site); for (Map.Entry<String, Object> entry : journalDoiRegexList.entrySet()) { <START> if (doi.matches(entry.getValue().toString())) { <END> return entry.getKey(); } } return null; }</code><technical_language>String.matches expensive. If caching list of pattern Site, cache compiled java.util.regex.Pattern objects</technical_language>

Target:
public String getJournalKeyFromDoi(String doi, Site site) { ImmutableList<DoiJournalRegex> doiJournalRegices = patternCache.computeIfAbsent(site, this::getFromConfig); for (DoiJournalRegex doiJournalRegex : doiJournalRegices) { Pattern pattern = doiJournalRegex.pattern; Matcher matcher = pattern.matcher(doi); if (matcher.matches()) { return doiJournalRegex.journalKey; } } return null; }
Source:
<code>@Override public void draw(Canvas canvas) { if (!animating) { image.draw(canvas); } else { if (placeholder != null) { placeholder.draw(canvas); } float normalized = (SystemClock.uptimeMillis() - startTimeMillis) / FADE_DURATION; int alpha = (int) (0xFF * normalized); if (normalized >= 1f) { animating = false; placeholder = null; image.setAlpha(0xFF); image.draw(canvas); } else { image.setAlpha(alpha); <START> image.draw(canvas); <END> invalidateSelf(); } } if (debugging) { drawDebugIndicator(canvas); } }</code><technical_language>need reset alpha here? Drawables share a global state</technical_language>

Target:
@Override public void draw(Canvas canvas) { if (!animating) { image.draw(canvas); } else { if (placeholder != null) { placeholder.draw(canvas); } float normalized = (SystemClock.uptimeMillis() - startTimeMillis) / FADE_DURATION; int alpha = (int) (0xFF * normalized); if (normalized >= 1f) { animating = false; placeholder = null; image.draw(canvas); } else { image.setAlpha(alpha); image.draw(canvas); image.setAlpha(0xFF); invalidateSelf(); } } if (debugging) { drawDebugIndicator(canvas); } }
Source:
<code>public void addingAStudentAddsThemToTheSortedRoster() { school = new School(); school.add("Aimee", 2); List<String> expected = Arrays.asList("Aimee"); <START> assertEquals(expected,school.roster()); <END> }</code><technical_language>a space expected school.roster()</technical_language>

Target:
public void addingAStudentAddsThemToTheSortedRoster() { school.add("Aimee", 2); List<String> expected = Arrays.asList("Aimee"); assertEquals(expected, school.roster()); }
Source:
<code>public static <T extends RemoteJsonService> T create(Class<T> serviceClass, GerritHttpClient gerritHttpClient, Version version) { <START> String uri = GerritVersion.isVersion26OrLater(version) ? "/gerrit_ui/rpc/" : "/gerrit/rpc/"; END> InvocationHandler handler = new GerritService(gerritHttpClient, uri + serviceClass.getSimpleName()); return serviceClass.cast(Proxy.newProxyInstance(GerritService.class.getClassLoader(), new Class<?>[] { serviceClass }, handler)); }</code><technical_language>put URL fragments static vars in a common file select based version in place scatterred code</technical_language>

Target:
public static <T extends RemoteJsonService> T create(Class<T> serviceClass, GerritHttpClient gerritHttpClient, Version version) { String uri = GerritVersion.getGerritRpcUri(version); InvocationHandler handler = new GerritService(gerritHttpClient, uri + serviceClass.getSimpleName()); return serviceClass.cast(Proxy.newProxyInstance(GerritService.class.getClassLoader(), new Class<?>[] { serviceClass }, handler)); }
Source:
<code>public V replace(K key, V value) { V v = delegate.replace(key, value); if (v != null) { stats.incrementCacheHits(); } else { stats.incrementCacheMisses(); } <START> stats.incrementCachePuts(); <END> return v; }</code><technical_language>This in if(v != null) check I thinking</technical_language>

Target:
public V replace(K key, V value) { V v = delegate.replace(key, value); if (v != null) { stats.incrementCacheHits(); stats.incrementCachePuts(); } else { stats.incrementCacheMisses(); } return v; }
Source:
<code>public JCloudsSlave( @Nonnull ProvisioningActivity.Id id, @Nonnull Server metadata, @Nonnull String labelString, @Nonnull SlaveOptions slaveOptions ) throws IOException, Descriptor.FormException { super( metadata.getName(), null, slaveOptions.getFsRoot(), slaveOptions.getNumExecutors(), Mode.NORMAL, labelString, null, new JCloudsRetentionStrategy(), Collections.singletonList(new EnvironmentVariablesNodeProperty( new EnvironmentVariablesNodeProperty.Entry("OPENSTACK_PUBLIC_IP", Openstack.getPublicAddress(metadata)) )) ); this.cloudName = id.getCloudName(); this.provisioningId = id; this.options = slaveOptions; this.nodeId = metadata.getId(); final Map<String, String> instanceMetaData = metadata.getMetadata(); if (instanceMetaData != null && !instanceMetaData.isEmpty()) { this.openstackMetaData = new TreeMap<>(instanceMetaData); } else { <START> this.openstackMetaData = null; <END> } setLauncher(new JCloudsLauncher(getLauncherFactory().createLauncher(this))); }</code><technical_language>Initialize Collections.emptyMap() right forget null in getOpenstackMetaData(). save some unneeded allocations</technical_language>

Target:
public JCloudsSlave( @Nonnull ProvisioningActivity.Id id, @Nonnull Server metadata, @Nonnull String labelString, @Nonnull SlaveOptions slaveOptions ) throws IOException, Descriptor.FormException { super( metadata.getName(), null, slaveOptions.getFsRoot(), slaveOptions.getNumExecutors(), Mode.NORMAL, labelString, null, new JCloudsRetentionStrategy(), Collections.singletonList(new EnvironmentVariablesNodeProperty( new EnvironmentVariablesNodeProperty.Entry("OPENSTACK_PUBLIC_IP", Openstack.getPublicAddress(metadata)) )) ); this.cloudName = id.getCloudName(); this.provisioningId = id; this.options = slaveOptions; this.nodeId = metadata.getId(); this.cache = makeCache(); setLauncher(new JCloudsLauncher(getLauncherFactory().createLauncher(this))); }
Source:
<code>protected List<SurveyGroupDto> parseSurveyGroups(String response) throws Exception { List<SurveyGroupDto> dtoList = new ArrayList<SurveyGroupDto>(); JSONArray jsonArray = getJsonArray(response); if (jsonArray == null) { return dtoList; } for (int i = 0; i < jsonArray.length(); i++) { JSONObject o = jsonArray.getJSONObject(i); if (o != null) { try { SurveyGroupDto dto = new SurveyGroupDto(); <START> if (o.has("name") && o.isNull("name")) { <END> dto.setName(o.getString("name")); } if (!o.has("monitoringGroup") || o.isNull("monitoringGroup")) { dto.setMonitoringGroup(false); } else { dto.setMonitoringGroup(o.getBoolean("monitoringGroup")); } dtoList.add(dto); } catch (Exception e) { System.out.println("Error in json parsing: " + e.getMessage()); e.printStackTrace(); } } } return dtoList; }</code><technical_language>I guess !o.isNull("name")? enough. need for o.has("name")</technical_language>

Target:
protected List<SurveyGroupDto> parseSurveyGroups(String response) throws Exception { List<SurveyGroupDto> dtoList = new ArrayList<SurveyGroupDto>(); JSONArray jsonArray = getJsonArray(response); if (jsonArray == null) { return dtoList; } for (int i = 0; i < jsonArray.length(); i++) { JSONObject o = jsonArray.getJSONObject(i); if (o != null) { try { SurveyGroupDto dto = new SurveyGroupDto(); if (!o.isNull("name")) { dto.setName(o.getString("name")); } if (o.isNull("monitoringGroup")) { dto.setMonitoringGroup(false); } else { dto.setMonitoringGroup(o.getBoolean("monitoringGroup")); } dtoList.add(dto); } catch (Exception e) { System.out.println("Error in json parsing: " + e.getMessage()); e.printStackTrace(); } } } return dtoList; }
Source:
<code>public Factory build() { BitSet redacted = new BitSet(); List<String> fields = new ArrayList<>(), keys = new ArrayList<>(); List<Integer> keyToFieldList = new ArrayList<>(); int i = 0; for (String fieldName : fieldNames) { if (redactedFieldNames.contains(fieldName)) redacted.set(i); fields.add(fieldName); keys.add(fieldName); keyToFieldList.add(i++); } for (Map.Entry<String, String[]> entry : prefixedNames.entrySet()) { String nextPrefix = entry.getKey(); String[] nextFieldNames = entry.getValue(); for (i = 0; i < nextFieldNames.length; i++) { String nextFieldName = nextFieldNames[i]; int index = fields.indexOf(nextFieldName); if (index == -1) { index = fields.size(); fields.add(nextFieldName); } keys.add(nextPrefix + nextFieldName); keyToFieldList.add(index); } } int[] keyToField = new int[keys.size()]; for (i = 0; i < keyToField.length; i++) { keyToField[i] = keyToFieldList.get(i); } <START> String[] validated = fields.toArray(new String[0]); <END> if (validated.length == 0) return new Factory(delegate); return new RealFactory(delegate, validated, keys.toArray(new String[0]), keyToField, redacted); }</code><technical_language>extra validation this is confusing me. java if (fields.isEmpty()) return new Factory(delegate); return new RealFactory(delegate, fields.toArray(..</technical_language>

Target:
public Factory build() { BitSet redacted = new BitSet(); List<String> fields = new ArrayList<>(), keys = new ArrayList<>(); List<Integer> keyToFieldList = new ArrayList<>(); int i = 0; for (String fieldName : fieldNames) { if (redactedFieldNames.contains(fieldName)) redacted.set(i); fields.add(fieldName); keys.add(fieldName); keyToFieldList.add(i++); } for (Map.Entry<String, String[]> entry : prefixedNames.entrySet()) { String nextPrefix = entry.getKey(); String[] nextFieldNames = entry.getValue(); for (i = 0; i < nextFieldNames.length; i++) { String nextFieldName = nextFieldNames[i]; int index = fields.indexOf(nextFieldName); if (index == -1) { index = fields.size(); fields.add(nextFieldName); } keys.add(nextPrefix + nextFieldName); keyToFieldList.add(index); } } int[] keyToField = new int[keys.size()]; for (i = 0; i < keyToField.length; i++) { keyToField[i] = keyToFieldList.get(i); } if (fields.isEmpty()) return new Factory(delegate); return new RealFactory(delegate, fields.toArray(new String[0]), keys.toArray(new String[0]), keyToField, redacted); }
Source:
<code>public static String minimalEscape(Object content) { <START> if (content == null) { <END> return null; } String str = String.valueOf(content); StringBuilder result = new StringBuilder((int) (str.length() * 1.1)); int length = str.length(); char c; for (int i = 0; i < length; ++i) { c = str.charAt(i); switch (c) { case '&': result.append(AMP); break; case '<': result.append(LT); break; default: result.append(c); } } return result.toString(); }</code><technical_language>Missing Unstable attribute</technical_language>

Target:
public static String minimalEscape(Object content) { if (content == null) { return null; } String str = String.valueOf(content); int contentLength = str.length(); StringBuilder result = new StringBuilder((int) (contentLength * 1.1)); for (int i = 0; i < contentLength; ++i) { char c = str.charAt(i); switch (c) { case '&': result.append(AMP); break; case '<': result.append(LT); break; default: result.append(c); } } return result.toString(); }
Source:
<code>public void overloadedMethodsGetResolved() throws Exception { <START> provider = new ExtensionAwareEvaluationContextProvider( <END> Collections.singletonList(new DummyExtension("_first", "first") { @Override public Object getRootObject() { return new RootWithOverloads(); } })); assertThat(evaluateExpression("method()")).isEqualTo("zero"); assertThat(evaluateExpression("method(23)")).isEqualTo("single-int"); assertThat(evaluateExpression("method('hello')")).isEqualTo("single-string"); assertThat(evaluateExpression("method('one', 'two')")).isEqualTo("two"); assertThat(evaluateExpression("method(1, 2)")).isEqualTo("two-ints"); assertThat(evaluateExpression("method(1, 'two')")).isEqualTo("int-and-string"); }</code><technical_language>extract setup step? repeated in test below</technical_language>

Target:
public void overloadedMethodsGetResolved() throws Exception { provider = createContextProviderWithOverloads(); assertThat(evaluateExpression("method()")).isEqualTo("zero"); assertThat(evaluateExpression("method(23)")).isEqualTo("single-int"); assertThat(evaluateExpression("method('hello')")).isEqualTo("single-string"); assertThat(evaluateExpression("method('one', 'two')")).isEqualTo("two"); assertThat(evaluateExpression("method(1, 2)")).isEqualTo("two-ints"); assertThat(evaluateExpression("method(1, 'two')")).isEqualTo("int-and-string"); }
Source:
<code>public static String getPreferredVariable(IPath[] paths, IContainer target) { IPath commonRoot = null; for (IPath path : paths) { if (path != null) { if (commonRoot == null) commonRoot = path; else { int count = commonRoot.matchingFirstSegments(path); int remainingSegments = commonRoot.segmentCount() - count; if (remainingSegments <= 0) return null; commonRoot = commonRoot.removeLastSegments(remainingSegments); } } } String mostAppropriate = null; String mostAppropriateToParent = null; int mostAppropriateCount = Integer.MAX_VALUE; int mostAppropriateCountToParent = Integer.MAX_VALUE; IPathVariableManager pathVariableManager = target.getPathVariableManager(); for (String <START> variable : <END> pathVariableManager.getPathVariableNames()) { if (isPreferred(variable)) { URI rawValue = pathVariableManager.getURIValue(variable); URI value = pathVariableManager.resolveURI(rawValue); if (value != null) { IPath path = URIUtil.toPath(value); if (path != null) { int difference = path.matchingFirstSegments(commonRoot); if (difference > 0) { if (difference < mostAppropriateCount) { mostAppropriateCount = difference; mostAppropriate = variable; } } else { difference = commonRoot.matchingFirstSegments(path); if (difference > 0) { if (difference < mostAppropriateCountToParent) { mostAppropriateCountToParent = difference; mostAppropriateToParent = variable; } } } } } } } if (mostAppropriate == null) { if (mostAppropriateToParent == null) return "PROJECT_LOC"; return mostAppropriateToParent; } return mostAppropriate; }</code><technical_language>rename 'variableName'</technical_language>

Target:
public static String getPreferredVariable(IPath[] paths, IContainer target) { IPath commonRoot = null; for (IPath path : paths) { if (path != null) { if (commonRoot == null) commonRoot = path; else { int count = commonRoot.matchingFirstSegments(path); int remainingSegments = commonRoot.segmentCount() - count; if (remainingSegments <= 0) return null; commonRoot = commonRoot.removeLastSegments(remainingSegments); } } } String mostAppropriate = null; String mostAppropriateToParent = null; int mostAppropriateCount = Integer.MAX_VALUE; int mostAppropriateCountToParent = Integer.MAX_VALUE; IPathVariableManager pathVariableManager = target.getPathVariableManager(); for (String variableName : pathVariableManager.getPathVariableNames()) { if (isPreferred(variableName)) { URI rawValue = pathVariableManager.getURIValue(variableName); URI value = pathVariableManager.resolveURI(rawValue); if (value != null) { IPath path = URIUtil.toPath(value); if (path != null) { int difference = path.matchingFirstSegments(commonRoot); if (difference > 0) { if (difference < mostAppropriateCount) { mostAppropriateCount = difference; mostAppropriate = variableName; } } else { difference = commonRoot.matchingFirstSegments(path); if (difference > 0) { if (difference < mostAppropriateCountToParent) { mostAppropriateCountToParent = difference; mostAppropriateToParent = variableName; } } } } } } } if (mostAppropriate == null) { if (mostAppropriateToParent == null) return "PROJECT_LOC"; return mostAppropriateToParent; } return mostAppropriate; }
Source:
<code>public void deleteStorage(final String id, final Optional<String> user) throws DbWriteOperationsBlockedException, NoSuchStorageException, StorageIsUsedException, InternalNakadiException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot delete storage: write operations on DB " + "are blocked by feature flag."); } try { final Optional<Object> storageOrNone = storageDbRepository.getStorage(id) .map(Function.identity()); storageDbRepository.deleteStorage(id); auditLogPublisher.publish( <START> Optional.empty(), <END> storageOrNone, NakadiAuditLogPublisher.ResourceType.STORAGE, NakadiAuditLogPublisher.ActionType.DELETED, id, user); } catch (final RepositoryProblemException e) { LOG.error("DB error occurred when deleting storage", e); throw new InternalNakadiException(e.getMessage()); } catch (final TransactionException e) { LOG.error("Error with transaction handling when deleting storage", e); throw new InternalNakadiException("Transaction error occurred when deleting storage"); } }</code><technical_language>Good catch, thanks. Fixed <LINK_0></technical_language>

Target:
public void deleteStorage(final String id, final Optional<String> user) throws DbWriteOperationsBlockedException, NoSuchStorageException, StorageIsUsedException, InternalNakadiException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot delete storage: write operations on DB " + "are blocked by feature flag."); } try { final Optional<Object> storageOrNone = storageDbRepository.getStorage(id) .map(Function.identity()); storageDbRepository.deleteStorage(id); auditLogPublisher.publish( storageOrNone, Optional.empty(), NakadiAuditLogPublisher.ResourceType.STORAGE, NakadiAuditLogPublisher.ActionType.DELETED, id, user); } catch (final RepositoryProblemException e) { LOG.error("DB error occurred when deleting storage", e); throw new InternalNakadiException(e.getMessage()); } catch (final TransactionException e) { LOG.error("Error with transaction handling when deleting storage", e); throw new InternalNakadiException("Transaction error occurred when deleting storage"); } }
Source:
<code>private static String loadFile(String fileName) { String content = ""; fileName = ConfigUtil.resolvePath(getSysprepDir(), fileName); <START> File file = new File(fileName); if (file.exists()) { <END> try { content = new String(Files.readAllBytes(file.toPath())); } catch (Exception e) { log.error("Failed to read sysprep template '{}': {}", fileName, e.getMessage()); log.debug("Exception", e); } } else { log.error("Sysprep template: '{}' not found", fileName); } return content; }</code><technical_language>cleaner nio classes only: Path path = Paths.get(fileName); if (Files.exists(path)) { // yada yada</technical_language>

Target:
private static String loadFile(String fileName) { String content = ""; fileName = ConfigUtil.resolvePath(getSysprepDir(), fileName); Path path = Paths.get(fileName); if (Files.exists(path)) { try { content = new String(Files.readAllBytes(path)); } catch (Exception e) { log.error("Failed to read sysprep template '{}': {}", fileName, e.getMessage()); log.debug("Exception", e); } } else { log.error("Sysprep template: '{}' not found", fileName); } return content; }
Source:
<code>public boolean invalidateIfNecessary(BaragonRequest request) { <START> if (request.getLoadBalancerService().getOptions().get("edgeCacheDNS") == null) { <END> return false; } try { String edgeCacheDNS = ((String) request.getLoadBalancerService().getOptions().get("edgeCacheDNS")); Optional<CloudflareZone> matchingZone = getCloudflareZone(edgeCacheDNS); if (!matchingZone.isPresent()) { LOG.warn("`edgeCacheDNS` was defined on the request, but no matching Cloudflare Zone was found!"); return false; } String zoneId = matchingZone.get().getId(); Optional<CloudflareDnsRecord> matchingDnsRecord = getCloudflareDnsRecord(edgeCacheDNS, zoneId); if (!matchingDnsRecord.isPresent()) { LOG.warn("`edgeCacheDNS` was defined on the request, but no matching Cloudflare DNS Record was found!"); return false; } if (!matchingDnsRecord.get().isProxied()) { LOG.warn("`edgeCacheDNS` was defined on the request, but is not a proxied DNS record!", edgeCacheDNS); return false; } return cf.purgeCache( zoneId, Collections.singletonList( String.format(CACHE_TAG_FORMAT, request.getLoadBalancerService().getServiceId(), environment.getName()) ) ); } catch (CloudflareClientException e) { LOG.error("Unable to invalidate Cloudflare cache for request {}", request, e); return false; } }</code><technical_language>edgeCacheDNS a static variable a times</technical_language>

Target:
public boolean invalidateIfNecessary(BaragonRequest request) { if (!request.getLoadBalancerService().getEdgeCacheDNS().isPresent()) { return false; } try { String edgeCacheDNS = request.getLoadBalancerService().getEdgeCacheDNS().get(); Optional<CloudflareZone> matchingZone = getCloudflareZone(edgeCacheDNS); if (!matchingZone.isPresent()) { LOG.warn("`edgeCacheDNS` was defined on the request, but no matching Cloudflare Zone was found!"); return false; } String zoneId = matchingZone.get().getId(); Optional<CloudflareDnsRecord> matchingDnsRecord = getCloudflareDnsRecord(edgeCacheDNS, zoneId); if (!matchingDnsRecord.isPresent()) { LOG.warn("`edgeCacheDNS` was defined on the request, but no matching Cloudflare DNS Record was found!"); return false; } if (!matchingDnsRecord.get().isProxied()) { LOG.warn("`edgeCacheDNS` was defined on the request, but is not a proxied DNS record!", edgeCacheDNS); return false; } String cacheTag = String.format( edgeCacheConfiguration.getIntegrationSettings().get("cacheTagFormat"), request.getLoadBalancerService().getServiceId() ); LOG.debug("Sending cache purge request against for to Cloudflare...", matchingDnsRecord.get().getName(), cacheTag); return cf.purgeEdgeCache(zoneId, Collections.singletonList(cacheTag)); } catch (CloudflareClientException e) { LOG.error("Unable to invalidate Cloudflare cache for request {}", request, e); return false; } }
Source:
<code>private <V> void addCallback(CompletableFuture<V> cfuture, CommitData cd, OnSuccessInterface<V> onSuccessInterface) { cfuture.handleAsync((result, exception) -> { if (result != null) { try { onSuccessInterface.onSuccess(cd, result); return null; } catch (Exception e) { cd.commitObserver.failed(e); return null; } <START> } else { <END> cd.commitObserver.failed(exception); return null; } }, env.getSharedResources().getAsyncCommitExecutor()); }</code><technical_language>If a future completes successfully returns null, do want exception handling path. code do : java if(exception != null) { //handle exception } else { //handle result }</technical_language>

Target:
private <V> void addCallback(CompletableFuture<V> cfuture, CommitData cd, OnSuccessInterface<V> onSuccessInterface) { cfuture.handleAsync((result, exception) -> { if (exception != null) { cd.commitObserver.failed(exception); return null; } else { try { onSuccessInterface.onSuccess(result); return null; } catch (Exception e) { cd.commitObserver.failed(e); return null; } } }, env.getSharedResources().getAsyncCommitExecutor()); }
Source:
<code>public Collection<AsyncQuery> deleteAsyncQueryAndResultCollection(FilterExpression filterExpression) { log.debug("deleteAsyncQueryAndResultCollection"); Collection<AsyncQuery> asyncQueryList = null; try { asyncQueryList = (Collection<AsyncQuery>) executeInTransaction(dataStore, (tx, scope) -> { EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQuery.class) .filterExpression(filterExpression) .build(); Iterable<Object> loaded = tx.loadObjects(asyncQueryCollection, scope); Iterator<Object> itr = loaded.iterator(); while (itr.hasNext()) { AsyncQuery query = (AsyncQuery) itr.next(); if (query != null) { tx.delete(query, scope); } } return loaded; }); <START> } catch (Exception e) { <END> log.error("Exception: {}", e); } return asyncQueryList; }</code><technical_language>DAO swallow exceptions. Utilities need propagate exceptions calling code handle (or utility limited reuse in limited contexts)</technical_language>

Target:
public Collection<AsyncQuery> deleteAsyncQueryAndResultCollection(FilterExpression filterExpression) { log.debug("deleteAsyncQueryAndResultCollection"); Collection<AsyncQuery> asyncQueryList = null; asyncQueryList = (Collection<AsyncQuery>) executeInTransaction(dataStore, (tx, scope) -> { EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQuery.class) .filterExpression(filterExpression) .build(); Iterable<Object> loaded = tx.loadObjects(asyncQueryCollection, scope); Iterator<Object> itr = loaded.iterator(); while (itr.hasNext()) { AsyncQuery query = (AsyncQuery) itr.next(); if (query != null) { tx.delete(query, scope); } } return loaded; }); return asyncQueryList; }
Source:
<code>public static void markNoteAsRead(final Note note) { if (note == null) { return; } if (note.isUnread()) { <START> WordPress.getRestClientUtilsV1_1().decrementUnreadCount(note.getId(), "10", new RestRequest.Listener() { <END> @Override public void onResponse(JSONObject response) { note.setRead(); NotificationsTable.saveNote(note); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.e(AppLog.T.NOTIFS, "Could not mark note as read via API."); } }); } }</code><technical_language>do @jleandroperez iOS <LINK_0></technical_language>

Target:
public static void markNoteAsRead(final Note note) { if (note == null) { return; } if (note.isUnread()) { WordPress.getRestClientUtilsV1_1().decrementUnreadCount(note.getId(), "9999", new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { note.setRead(); NotificationsTable.saveNote(note); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.e(AppLog.T.NOTIFS, "Could not mark note as read via API."); } }); } }
Source:
<code>public Set<String> map(Set<String> genres) { Set<String> tags = Sets.newHashSet(); for (String genre : genres) { if (genre.contains("<LINK_0>")) { <START> tags.add(paTagMap.get(genre)); <END> } } if (tags.size() == 1 && tags.contains("film")) { tags.add("action"); } return tags; }</code><technical_language>PA genres a mapping for? i.e. is this exhaustive mapping? gunna get nulls in Set</technical_language>

Target:
public Set<TopicRef> map(Set<String> genres) { Set<String> tags = Sets.newHashSet(); for (String genre : genres) { if (genre.contains("<LINK_0>")) { String tag = paTagMap.get(genre); if (tag != null) { tags.add(tag); } } } if (tags.size() == 1 && tags.contains("film")) { tags.add("action"); } return getTopicRefFromTags(tags); }
Source:
<code>public void checkWebJavaSpringCommands() { consoles.startCommandAndCheckResult(WEB_JAVA_SPRING, BUILD, "build", BUILD_SUCCESS); consoles.startCommandAndCheckResult( WEB_JAVA_SPRING, BUILD, "web-java-spring:build", BUILD_SUCCESS); consoles.startCommandAndCheckResult( WEB_JAVA_SPRING, RUN, "web-java-spring:build and run", "Server startup in"); consoles.startCommandAndCheckApp(currentWindow, " consoles.closeProcessTabWithAskDialog("web-java-spring:build and run"); consoles.startCommandAndCheckResult( WEB_JAVA_SPRING, RUN, "web-java-spring:run tomcat", "Server startup in"); consoles.startCommandAndCheckApp(currentWindow, " projectExplorer.invokeCommandWithContextMenu( <START> RUN, WEB_JAVA_SPRING, "web-java-spring:stop tomcat"); <END> consoles.selectProcessInProcessConsoleTreeByName("Terminal"); terminal.typeIntoTerminal("ps ax"); terminal.typeIntoTerminal(ENTER.toString()); terminal.waitExpectedTextNotPresentTerminal("/bin/bash -c $TOMCAT_HOME/bin/catalina.sh"); consoles.startCommandAndCheckResult( WEB_JAVA_SPRING, DEBUG, "web-java-spring:debug", "Listening for transport dt_socket at address: 8000"); }</code><technical_language>constant "web-java-spring:stop tomcat" command: STOP_TOMCAT_COMMAND_ITEM_NAME</technical_language>

Target:
public void checkWebJavaSpringCommands() { consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, BUILD_GOAL, BUILD_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, RUN_GOAL, BUILD_AND_RUN_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), SERVER_STARTUP_IN); consoles.checkWebElementVisibilityAtPreviewPage(By.xpath(" consoles.closeProcessTabWithAskDialog(BUILD_AND_RUN_COMMAND_ITEM.getItem(WEB_JAVA_SPRING)); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, RUN_GOAL, RUN_TOMCAT_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), SERVER_STARTUP_IN); consoles.checkWebElementVisibilityAtPreviewPage(By.xpath(" projectExplorer.invokeCommandWithContextMenu( RUN_GOAL, WEB_JAVA_SPRING, STOP_TOMCAT_COMMAND_ITEM.getItem(WEB_JAVA_SPRING)); consoles.selectProcessInProcessConsoleTreeByName("Terminal"); terminal.typeIntoTerminal("ps ax"); terminal.typeIntoTerminal(ENTER.toString()); terminal.waitExpectedTextNotPresentTerminal("/bin/bash -c $TOMCAT_HOME/bin/catalina.sh"); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, DEBUG_GOAL, DEBUG_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), LISTENING_AT_ADDRESS_8000); }
Source:
<code>public abstract BufferedSink valueSink() throws IOException; public final JsonWriter jsonValue(@Nullable Object value) throws IOException { if (value instanceof Map<?, ?>) { beginObject(); for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet()) { Object key = entry.getKey(); if (!(key instanceof String)) { <START> throw new IllegalArgumentException( <END> "Map keys must be of type String: " + key.getClass().getName()); } name(((String) key)); jsonValue(entry.getValue()); } endObject(); } else if (value instanceof List<?>) { beginArray(); for (Object element : ((List<?>) value)) { jsonValue(element); } endArray(); } else if (value instanceof String) { value(((String) value)); } else if (value instanceof Boolean) { value(((Boolean) value).booleanValue()); } else if (value instanceof Double) { value(((Double) value).doubleValue()); } else if (value instanceof Long) { value(((Long) value).longValue()); } else if (value instanceof Number) { value(((Number) value)); } else if (value == null) { nullValue(); } else { throw new IllegalArgumentException("Unsupported type: " + value.getClass().getName()); } return this; }</code><technical_language>this do if key is null</technical_language>

Target:
public abstract BufferedSink valueSink() throws IOException; public final JsonWriter jsonValue(@Nullable Object value) throws IOException { if (value instanceof Map<?, ?>) { beginObject(); for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet()) { Object key = entry.getKey(); if (!(key instanceof String)) { throw new IllegalArgumentException(key == null ? "Map keys must be non-null" : "Map keys must be of type String: " + key.getClass().getName()); } name(((String) key)); jsonValue(entry.getValue()); } endObject(); } else if (value instanceof List<?>) { beginArray(); for (Object element : ((List<?>) value)) { jsonValue(element); } endArray(); } else if (value instanceof String) { value(((String) value)); } else if (value instanceof Boolean) { value(((Boolean) value).booleanValue()); } else if (value instanceof Double) { value(((Double) value).doubleValue()); } else if (value instanceof Long) { value(((Long) value).longValue()); } else if (value instanceof Number) { value(((Number) value)); } else if (value == null) { nullValue(); } else { throw new IllegalArgumentException("Unsupported type: " + value.getClass().getName()); } return this; }
Source:
<code>void process(Content dataSource, IngestJobContext context, DataSourceIngestModuleProgress progressBar) { this.context = context; String modOutPath = Case.getCurrentCase().getModuleDirectory() + File.separator + PREFETCH_DIR_NAME; File dir = new File(modOutPath); if (dir.exists() == false) { <START> dir.mkdirs(); <END> } extractPrefetchFiles(dataSource); final String prefetchDumper = getPathForPrefetchDumper(); if (prefetchDumper == null) { logger.log(Level.SEVERE, "Error finding parse_prefetch program"); return; } if (context.dataSourceIngestIsCancelled()) { return; } String modOutFile = modOutPath + File.separator + PREFETCH_PARSER_DB_FILE; try { String tempDirPath = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), PREFETCH_DIR_NAME ); parsePrefetchFiles(prefetchDumper, tempDirPath, modOutFile, modOutPath); createAppExecArtifacts(modOutFile); } catch (IOException ex) { logger.log(Level.WARNING, "Error runing parse_prefetch or creating artifacts.", ex); } }</code><technical_language>output of this call checked if false I bail</technical_language>

Target:
void process(Content dataSource, IngestJobContext context, DataSourceIngestModuleProgress progressBar) { this.context = context; String modOutPath = Case.getCurrentCase().getModuleDirectory() + File.separator + PREFETCH_DIR_NAME; File dir = new File(modOutPath); if (dir.exists() == false) { boolean dirMade = dir.mkdirs(); if (!dirMade) { logger.log(Level.SEVERE, "Error creating directory to store prefetch output database"); return; } } extractPrefetchFiles(dataSource); final String prefetchDumper = getPathForPrefetchDumper(); if (prefetchDumper == null) { logger.log(Level.SEVERE, "Error finding parse_prefetch program"); return; } if (context.dataSourceIngestIsCancelled()) { return; } String modOutFile = modOutPath + File.separator + PREFETCH_PARSER_DB_FILE; try { String tempDirPath = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), PREFETCH_DIR_NAME ); parsePrefetchFiles(prefetchDumper, tempDirPath, modOutFile, modOutPath); createAppExecArtifacts(modOutFile, dataSource); } catch (IOException ex) { logger.log(Level.WARNING, "Error runing parse_prefetch or creating artifacts.", ex); } }
Source:
<code>public void parsesInvalidIdField() throws IOException { <START> final MemberProfileJson memberprofilejson = <END> Mockito.mock(MemberProfileJson.class); Mockito.when( memberprofilejson.fetch( Mockito.anyString(), Mockito.anyString(), Mockito.any(Href.class) ) ).thenReturn( Json.createReader( new FileInputStream( PsLinkedinTest.class.getResource( "linkedinTestUserInvalidId.json" ).getPath() ) ).readObject() ); try { new PsLinkedin(memberprofilejson) .enter(REQUEST); } catch (final ClassCastException ex) { MatcherAssert.assertThat( ex.getMessage(), Matchers.containsString("cannot be cast to") ); throw ex; } }</code><technical_language>@ikhvostenkov please name json</technical_language>

Target:
public void parsesInvalidIdField() throws IOException { try { new PsLinkedin( this.mockRequest( "linkedinTestUserInvalidId.json" ), "appTest", "keyTest" ).enter(REQUEST); } catch (final ClassCastException ex) { MatcherAssert.assertThat( ex.getMessage(), Matchers.containsString("cannot be cast to") ); throw ex; } }