auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void maximize(final MUIElement element) { if (!element.isToBeRendered()) return; List<MUIElement> elementsToMinimize = getElementsToMinimize(element); Shell hostShell = (Shell) modelService.getTopLevelWindowFor(element).getWidget(); MWindow win = getWindowFor(element); FaderAnimationFeedback fader = new FaderAnimationFeedback(hostShell); AnimationEngine engine = new AnimationEngine(win.getContext(), fader, 300); engine.schedule(); restoreMaximizedElement(element, win); for (MUIElement toMinimize : elementsToMinimize) { toMinimize.getTags().add(MINIMIZED); toMinimize.getTags().add(MINIMIZED_BY_ZOOM); } adjustCTFButtons(element); if (MPartStack.class.isInstance(element)) { MArea area = getAreaFor(MPartStack.class.cast(element)); if (area != null && area.getTags().contains(MAXIMIZEABLE_CHILDREN_TAG)) { MPlaceholder placeholder = area.getCurSharedRef(); <START> ignoreTagChanges = true; <END> placeholder.getTags().add(MAXIMIZED); ignoreTagChanges = false; adjustCTFButtons(placeholder); } } }</code><technical_language>ignoreTagChanges needs in a try/finally tag add removal trigger a lot of code</technical_language>

Target:
void maximize(final MUIElement element) { if (!element.isToBeRendered()) return; List<MUIElement> elementsToMinimize = getElementsToMinimize(element); Shell hostShell = (Shell) modelService.getTopLevelWindowFor(element).getWidget(); MWindow win = getWindowFor(element); FaderAnimationFeedback fader = new FaderAnimationFeedback(hostShell); AnimationEngine engine = new AnimationEngine(win.getContext(), fader, 300); engine.schedule(); restoreMaximizedElement(element, win); for (MUIElement toMinimize : elementsToMinimize) { toMinimize.getTags().add(MINIMIZED); toMinimize.getTags().add(MINIMIZED_BY_ZOOM); } adjustCTFButtons(element); if (element instanceof MPartStack) { MArea area = getAreaFor((MPartStack) element); if (area != null && area.getTags().contains(MAXIMIZEABLE_CHILDREN_TAG)) { MPlaceholder placeholder = area.getCurSharedRef(); ignoreTagChanges = true; try { placeholder.getTags().add(MAXIMIZED); } finally { ignoreTagChanges = false; } adjustCTFButtons(placeholder); } } }
Source:
<code>public void compare(List<JsonObject> expectedEventList, List<JsonObject> trackedEventList) { for (JsonObject expectedEvent : expectedEventList) { <START> Boolean equals = false; <END> for (JsonObject currentEvent : trackedEventList) { equals = currentEvent.equals(expectedEvent); if (equals) { PageObjectLogging.log("compare", "match for expected event found: \n" + "expected event: " + expectedEvent.toString() + "\n" + "compared event: " + currentEvent.toString(), true); trackedEventList.remove(currentEvent); break; } } if (!equals) { PageObjectLogging.log("compare", "didn't find match for expected event: " + expectedEvent.toString(), false); } Assertion.assertTrue(equals); } }</code><technical_language>This is redundant, 2 line overwrite value</technical_language>

Target:
public void compare(List<JsonObject> expectedEventList, List<JsonObject> trackedEventList) { for (JsonObject expectedEvent : expectedEventList) { Boolean equals = false; for (JsonObject trackedEvent : trackedEventList) { equals = trackedEvent.equals(expectedEvent); if (equals) { PageObjectLogging.log("compare", "match for expected event found: \n" + "expected event: " + expectedEvent.toString() + "\n" + "compared event: " + trackedEvent.toString(), true); trackedEventList.remove(trackedEvent); break; } } Assertion.assertTrue(equals, "didn't match expected event: " + expectedEvent.toString()); } }
Source:
<code>E doIt() throws IOException; } protected <E> E doShared( final Work<E> work ) { if ( timelineLock.readLock().tryLock() ) { <START> if ( started && !indexerIsDead ) <END> { try { return work.doIt(); } catch ( final IOException e ) { try { timelineLock.readLock().unlock(); doExclusively( new Work<Void>() { @Override public Void doIt() throws IOException { try { markIndexerDead( e ); } finally { timelineLock.readLock().lock(); } return null; } } ); } catch ( final IOException ee ) { getLogger().warn( "Unable to cleanly disable Timeline indexer.", e ); } } finally { timelineLock.readLock().unlock(); } } } return null; }</code><technical_language>Lock is unlocked if "started && !indexerIsDead" evaluates false</technical_language>

Target:
E doIt() throws IOException; } protected <E> E doShared( final Work<E> work ) { if ( timelineLock.readLock().tryLock() ) { try { if ( started && !indexerIsDead ) { try { return work.doIt(); } catch ( IOException e ) { markIndexerDead( e ); } } } finally { timelineLock.readLock().unlock(); } } return null; }
Source:
<code>private TypeDefinition parseSubType(String id, Range cardinality) throws IOException, ParserException { NativeType nativeType = readNativeType(); <START> TypeDefinition subType = null; <END> if ( nativeType == null ) { subType = new TypeDefinitionLink( getContext(), id, cardinality, token.content() ); getToken(); } else { getToken(); if ( token.is(Scanner.TokenType.LPAREN)){ getToken(); subType = new TypeInlineDefinition(getContext(), id, nativeType, token.content(), cardinality); getToken(); eat(Scanner.TokenType.RPAREN, "expected right parenthesis"); } else { subType = new TypeInlineDefinition( getContext(), id, nativeType, cardinality); } if ( token.is( Scanner.TokenType.LCURLY ) ) { parseSubTypes((TypeInlineDefinition) subType); } } if ( token.is( Scanner.TokenType.PARALLEL ) ) { getToken(); TypeDefinition secondSubType = parseSubType(id, cardinality); TypeChoiceDefinition choiceSubType = new TypeChoiceDefinition( getContext(), id, cardinality, subType, secondSubType); return choiceSubType; } return subType; }</code><technical_language>add = null</technical_language>

Target:
private TypeDefinition parseSubType(String id, Range cardinality) throws IOException, ParserException { NativeType nativeType = readNativeType(); TypeDefinition subType; if ( nativeType == null ) { subType = new TypeDefinitionLink( getContext(), id, cardinality, token.content() ); getToken(); } else { getToken(); if ( token.is(Scanner.TokenType.LPAREN)){ getToken(); subType = new TypeInlineDefinition(getContext(), id, (StringType) nativeType, token.content(), cardinality); getToken(); eat(Scanner.TokenType.RPAREN, "expected right parenthesis"); } else { subType = new TypeInlineDefinition( getContext(), id, nativeType, cardinality); } if ( token.is( Scanner.TokenType.LCURLY ) ) { parseSubTypes((TypeInlineDefinition) subType); } } if ( token.is( Scanner.TokenType.PARALLEL ) ) { getToken(); TypeDefinition secondSubType = parseSubType(id, cardinality); TypeChoiceDefinition choiceSubType = new TypeChoiceDefinition( getContext(), id, cardinality, subType, secondSubType); return choiceSubType; } return subType; }
Source:
<code>protected void <START> logTimeoutException(TimeoutException <END> e, VDSNetworkException ex) { logException(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); }</code><technical_language>do need double logging here? logException is called in 101-102</technical_language>

Target:
protected void logTimeoutException(TimeoutException e, VDSNetworkException ex) { log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); }
Source:
<code>public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); String expectedAudiences = filterConfig.getInitParameter(KNOX_TOKEN_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } String queryParamName = filterConfig.getInitParameter(KNOX_TOKEN_QUERY_PARAM_NAME); if (queryParamName != null) { paramName = queryParamName; } String verificationPEM = filterConfig.getInitParameter(TOKEN_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } String oidcjwksurl = filterConfig.getInitParameter(JWKS_URL); if (oidcjwksurl != null) { expectedJWKSUrl = oidcjwksurl; } String oidcPartyPclaim = filterConfig.getInitParameter(TOKEN_PRINCIPAL_CLAIM); if (oidcPartyPclaim != null) { <START> expectedPrincipalClaim = oidcPartyPclaim; <END> } configureExpectedParameters(filterConfig); }</code><technical_language>a new validateJWTToken method instead of making of existing validateToken method</technical_language>

Target:
public void init( FilterConfig filterConfig ) throws ServletException { super.init(filterConfig); String expectedAudiences = filterConfig.getInitParameter(KNOX_TOKEN_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } String queryParamName = filterConfig.getInitParameter(KNOX_TOKEN_QUERY_PARAM_NAME); if (queryParamName != null) { paramName = queryParamName; } String oidcjwksurl = filterConfig.getInitParameter(JWKS_URL); if (oidcjwksurl != null) { expectedJWKSUrl = oidcjwksurl; } String oidcPrincipalclaim = filterConfig.getInitParameter(TOKEN_PRINCIPAL_CLAIM); if (oidcPrincipalclaim != null) { expectedPrincipalClaim = oidcPrincipalclaim; } String verificationPEM = filterConfig.getInitParameter(TOKEN_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } configureExpectedParameters(filterConfig); }
Source:
<code>public void testDefault() throws Exception { checkConfig.addAttribute("allowLineBreaks", "false"); final String[] expected = { "5:14: " + getCheckMessage(MSG_KEY, "."), "6:12: " + getCheckMessage(MSG_KEY, "."), "29:14: " + getCheckMessage(MSG_KEY, "-"), "29:21: " + getCheckMessage(MSG_KEY, "+"), "31:15: " + getCheckMessage(MSG_KEY, "++"), "31:22: " + getCheckMessage(MSG_KEY, "--"), "111:22: " + getCheckMessage(MSG_KEY, "!"), "112:23: " + getCheckMessage(MSG_KEY, "~"), "129:24: " + getCheckMessage(MSG_KEY, "."), "132:11: " + getCheckMessage(MSG_KEY, "."), "136:12: " + getCheckMessage(MSG_KEY, "."), "264:2: " + getCheckMessage(MSG_KEY, "."), }; <START> verify(checkConfig, getPath("InputNoWhitespaceAfterWhitespace.java"), expected); <END> }</code><technical_language>Name "NoWhitespaceAfterWhitespace" is confusing me. InputNoWhitespaceAfter.java in this folder yet. Please rename file. Other changes good for</technical_language>

Target:
public void testDefault() throws Exception { checkConfig.addAttribute("allowLineBreaks", "false"); final String[] expected = { "5:14: " + getCheckMessage(MSG_KEY, "."), "6:12: " + getCheckMessage(MSG_KEY, "."), "29:14: " + getCheckMessage(MSG_KEY, "-"), "29:21: " + getCheckMessage(MSG_KEY, "+"), "31:15: " + getCheckMessage(MSG_KEY, "++"), "31:22: " + getCheckMessage(MSG_KEY, "--"), "111:22: " + getCheckMessage(MSG_KEY, "!"), "112:23: " + getCheckMessage(MSG_KEY, "~"), "129:24: " + getCheckMessage(MSG_KEY, "."), "132:11: " + getCheckMessage(MSG_KEY, "."), "136:12: " + getCheckMessage(MSG_KEY, "."), "264:2: " + getCheckMessage(MSG_KEY, "."), }; verify(checkConfig, getPath("InputNoWhitespaceAfter.java"), expected); }
Source:
<code>public GroupsRemovedFromContactGroupOfFacility(List<Integer> groupsId, ContactGroup contactGroup) { this.groupsId = groupsId; this.contactGroup = contactGroup; <START> this.message = formatMessage("Groups (%s) successfully removed from contact groups %s.", groupsId, contactGroup); <END> }</code><technical_language>Replace 'contact groups' for 'contact group'</technical_language>

Target:
public GroupsRemovedFromContactGroupOfFacility(List<Integer> groupsId, ContactGroup contactGroup) { this.groupsId = groupsId; this.contactGroup = contactGroup; this.message = formatMessage("Groups (%s) successfully removed from contact group %s.", groupsId, contactGroup); }
Source:
<code>private List<IResource> computeRelated(List<? extends IResource> selection) { <START> if (selection.stream().filter(r -> r.getType() == IResource.ROOT).count() > 0) { <END> return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { set.removeSet(resource); } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }</code><technical_language>this easier: if(selection.contains(ResourcesPlugin.getWorkspace().getRoot())</technical_language>

Target:
private List<IResource> computeRelated(List<? extends IResource> selection) { if (selection.contains(ResourcesPlugin.getWorkspace().getRoot())) { return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { set.removeSet(resource); } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }
Source:
<code>private void enableCoordinatesFormattingGml32() { FeatureTypeInfo info = getGeoServer() .getCatalog() .getResourceByName( new NameImpl( StationsMockData.STATIONS_PREFIX_GML32, "Station_gml32"), <START> FeatureTypeInfo.class); <END> info.setNumDecimals(8); info.setForcedDecimal(true); info.setPadWithZeros(true); getGeoServer().getCatalog().save(info); }</code><technical_language>A lot of _avoidable_ code duplication enableCoordinatesFormattingGml31 enableCoordinatesFormattingGml32. A generic method receives a name created for GML31 GML32</technical_language>

Target:
private void enableCoordinatesFormattingGml32() { enableCoordinateFormatting( new NameImpl(StationsMockData.STATIONS_PREFIX_GML32, "Station_gml32")); }
Source:
<code>public byte[] getCacheKey() { final byte[] filterBytes = dimFilter == null ? new byte[]{} : dimFilter.getCacheKey(); final byte[] boundBytes = StringUtils.toUtf8(bound); <START> return ByteBuffer.allocate(1 + boundBytes.length) <END> .put(CACHE_TYPE_ID) .put(boundBytes) .put(filterBytes) .array(); }</code><technical_language>Couple points here: 1. This ByteBuffer needs larger accommodate filterBytes. 2. Typically put 0xff a string boundBytes in cache key delimit other parts of key</technical_language>

Target:
public byte[] getCacheKey() { final byte[] filterBytes = dimFilter == null ? new byte[]{} : dimFilter.getCacheKey(); final byte[] boundBytes = StringUtils.toUtf8(bound); final byte delimiter = (byte) 0xff; return ByteBuffer.allocate(2 + boundBytes.length + filterBytes.length) .put(CACHE_TYPE_ID) .put(boundBytes) .put(delimiter) .put(filterBytes) .array(); }
Source:
<code>public int hashCode() { int result = combination != null ? combination.hashCode() : 0; for (String field : combination) { try { Field declaredField = pojo.getClass().getDeclaredField(field); declaredField.setAccessible(true); result = 31 * result + declaredField.get(this.pojo).hashCode(); } catch (NoSuchFieldException e) { <START> e.printStackTrace(); <END> return 0; } catch (IllegalAccessException e) { e.printStackTrace(); return 0; } } return result; }</code><technical_language>Log instead of printStackTrace</technical_language>

Target:
public int hashCode() { int result = combination != null ? combination.hashCode() : 0; for (String field : combination) { try { Field declaredField = pojo.getClass().getDeclaredField(field); declaredField.setAccessible(true); result = 31 * result + declaredField.get(this.pojo).hashCode(); } catch (NoSuchFieldException e) { logger.error("No such field: found in pojo. NoSuchFieldException: {}", field, e); return 0; } catch (IllegalAccessException e) { logger.error("Illegal access to field: found in pojo. IllegalAccessException: {}", field, e); return 0; } } return result; }
Source:
<code>public QueryResult query(final Query query) { return execute(query.requiresPost() <START> ? this.influxDBService.postQuery(this.username, this.password, query.getDatabase(), query.getCommand()) <END> : this.influxDBService.query(this.username, this.password, query.getDatabase(), query.getCommand())); }</code><technical_language>Please do ternary form, convert more readable if else form</technical_language>

Target:
public QueryResult query(final Query query) { Call<QueryResult> call; if (query.requiresPost()) { call = this.influxDBService.postQuery(this.username, this.password, query.getDatabase(), query.getCommand()); } else { call = this.influxDBService.query(this.username, this.password, query.getDatabase(), query.getCommand()); } return execute(call); }
Source:
<code>void addIngredientsImage() { if (imagePath != null) { Intent intent = new Intent(getActivity(), FullScreenImageRotate.class); Bundle bundle = new Bundle(); if (edit_product && !newImageSelected) { bundle.putString("imageurl", imagePath); bundle.putString("code", product.getCode()); bundle.putString("id", "ingredients_en"); } else { bundle.putString("imageurl", "file://" + imagePath); bundle.putString("code", product.getCode()); <START> bundle.putString("id", "ingredients_en"); <END> } intent.putExtras(bundle); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptionsCompat options = ActivityOptionsCompat. makeSceneTransitionAnimation(activity, imageIngredients, activity.getString(R.string.product_transition)); startActivityForResult(intent,ROTATE_RESULT, options.toBundle()); } else { startActivityForResult(intent, ROTATE_RESULT); } } else { if (ContextCompat.checkSelfPermission(activity, CAMERA) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(activity, new String[]{CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA); } else { EasyImage.openCamera(this, 0); } } }</code><technical_language>Please remove redundant code, change like: Intent intent = new Intent(getActivity(), FullScreenImageRotate.class); Bundle bundle = new Bundle(); if (edit_product && !newImageSelected) { bundle.putString("imageurl", imagePath); } else { bundle.putString("imageurl", "file://" + imagePath); } bundle.putString("code", product.getCode()); bundle.putString("id", "ingredients_en");</technical_language>

Target:
void addIngredientsImage() { if (imagePath != null) { Intent intent = new Intent(getActivity(), FullScreenImageRotate.class); Bundle bundle = new Bundle(); if (edit_product && !newImageSelected) { bundle.putString("imageurl", imagePath); } else { bundle.putString("imageurl", "file://" + imagePath); } bundle.putString("code", product.getCode()); bundle.putString("id", "ingredients_en"); intent.putExtras(bundle); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptionsCompat options = ActivityOptionsCompat. makeSceneTransitionAnimation(activity, imageIngredients, activity.getString(R.string.product_transition)); startActivityForResult(intent,ROTATE_RESULT, options.toBundle()); } else { startActivityForResult(intent, ROTATE_RESULT); } } else { if (ContextCompat.checkSelfPermission(activity, CAMERA) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(activity, new String[]{CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA); } else { EasyImage.openCamera(this, 0); } } }
Source:
<code>private Put getMegaByteMillisPut(Long mbMillis, JobKey jobKey) { <START> JobKeyConverter jobKeyConv = new JobKeyConverter(); <END> Put pMb = new Put(jobKeyConv.toBytes(jobKey)); pMb.add(Constants.INFO_FAM_BYTES, Constants.MEGABYTEMILLIS_BYTES, Bytes.toBytes(mbMillis)); return pMb; }</code><technical_language>minor: appears JobKeyConverter singleton</technical_language>

Target:
private Put getMegaByteMillisPut(Long mbMillis, JobKey jobKey) { Put pMb = new Put(jobKeyConv.toBytes(jobKey)); pMb.add(Constants.INFO_FAM_BYTES, Constants.MEGABYTEMILLIS_BYTES, Bytes.toBytes(mbMillis)); return pMb; }
Source:
<code>public static Region getRepresentedRegion(Diagram diagram) { Optional<View> mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> StateMachineEditPart.VISUAL_ID.equals(((View) e).getType())).findAny(); if (mainView.isPresent()) { EObject main = mainView.get().getElement(); if (main instanceof StateMachine) { return UMLRTExtensionUtil.getRootDefinition((StateMachine) main).getRegions().get(0); } } else { mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> RTStateEditPartTN.VISUAL_ID.equals(((View) e).getType())).findAny(); EObject main = <START> mainView.get().getElement(); <END> if (main instanceof State) { return UMLRTExtensionUtil.getRootDefinition((State) main).getRegions().get(0); } } return null; }</code><technical_language>This throw NoSuchElementException if mainView is empty</technical_language>

Target:
public static Region getRepresentedRegion(Diagram diagram) { Optional<View> mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> StateMachineEditPart.VISUAL_ID.equals(((View) e).getType())).findAny(); if (mainView.isPresent()) { EObject main = mainView.get().getElement(); if (main instanceof StateMachine) { return UMLRTExtensionUtil.getRootDefinition((StateMachine) main).getRegions().get(0); } } else { mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> RTStateEditPartTN.VISUAL_ID.equals(((View) e).getType())).findAny(); if (mainView.isPresent()) { EObject main = mainView.get().getElement(); if (main instanceof State) { return UMLRTExtensionUtil.getRootDefinition((State) main).getRegions().get(0); } } } return null; }
Source:
<code>TransportHttp(final Repository local, final URIish uri) throws NotSupportedException { super(local, uri); try { String uriString = uri.toString(); if (!uriString.endsWith("/")) uriString += "/"; baseUrl = new URL(uriString); objectsUrl = new URL(baseUrl, "objects/"); } catch (MalformedURLException e) { throw new NotSupportedException(MessageFormat.format(JGitText.get().invalidURL, uri), e); } http = local.getConfig().get(HTTP_KEY); proxySelector = ProxySelector.getDefault(); <START> if (getCredentialsProvider() == null) { <END> setCredentialsProvider(new NetRCCredentialsProvider()); } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
TransportHttp(final Repository local, final URIish uri) throws NotSupportedException { super(local, uri); try { String uriString = uri.toString(); if (!uriString.endsWith("/")) uriString += "/"; baseUrl = new URL(uriString); objectsUrl = new URL(baseUrl, "objects/"); } catch (MalformedURLException e) { throw new NotSupportedException(MessageFormat.format(JGitText.get().invalidURL, uri), e); } http = local.getConfig().get(HTTP_KEY); proxySelector = ProxySelector.getDefault(); if (getCredentialsProvider() == null) setCredentialsProvider(new NetRCCredentialsProvider()); }
Source:
<code>public void testExportWithTransform() throws Exception { DocumentModel root = createSomethingToExport(session); DocumentModelList versions = session.query("select * from Document where ecm:isCheckedInVersion = 1"); assertEquals(2, versions.size()); File out = getExportDirectory(); try { runExport(root, out, skipBlobs); StringBuffer sb = new StringBuffer(); dump(sb, out); String listing = sb.toString(); assertTrue(listing.contains( "ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "__versions__" + File.separator + "1.0" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "invoice" + File.separator + "document.xml")); String xml = FileUtils.readFileToString( <<<<<<< Upstream, based on origin/master new File(out, "ws1" + File.separator + "invoice" + File.separator + "document.xml"), UTF_8); <START> ======= <END> new File(out, "ws1" + File.separator + "invoice" + File.separator + "document.xml")); >>>>>>> 26a768b NXP-22544: fix failing tests assertTrue(xml.contains("<type>File</type>")); assertTrue(xml.contains("<facet>Invoice</facet>")); assertTrue(xml.contains("name=\"invoiceNew\">")); assertTrue(xml.contains("<iv:A>")); assertTrue(xml.contains("<iv:B>XYZ")); assertFalse(xml.contains("deprecated")); assertTrue(xml.contains("<schema name=\"new\"")); assertTrue(xml.contains("<Y>foo</Y>")); assertTrue(xml.contains("<lockInfo")); assertTrue(xml.contains("<owner>Administrator</owner>")); } finally { FileUtils.deleteQuietly(out); } }</code><technical_language>is ? branch rebased master TP</technical_language>

Target:
public void testExportWithTransform() throws Exception { DocumentModel root = createSomethingToExport(session); DocumentModelList versions = session.query("select * from Document where ecm:isCheckedInVersion = 1"); assertEquals(2, versions.size()); File out = getExportDirectory(); try { runExport(root, out, skipBlobs); StringBuffer sb = new StringBuffer(); dump(sb, out); String listing = sb.toString(); assertTrue(listing.contains( "ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "__versions__" + File.separator + "1.0" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "invoice" + File.separator + "document.xml")); String xml = FileUtils.readFileToString( new File(out, "ws1" + File.separator + "invoice" + File.separator + "document.xml"), UTF_8); assertTrue(xml.contains("<type>File</type>")); assertTrue(xml.contains("<facet>Invoice</facet>")); assertTrue(xml.contains("name=\"invoiceNew\">")); assertTrue(xml.contains("<iv:A>")); assertTrue(xml.contains("<iv:B>XYZ")); assertFalse(xml.contains("deprecated")); assertTrue(xml.contains("<schema name=\"new\"")); assertTrue(xml.contains("<Y>foo</Y>")); assertTrue(xml.contains("<lockInfo")); assertTrue(xml.contains("<owner>Administrator</owner>")); } finally { FileUtils.deleteQuietly(out); } }
Source:
<code>public Color getHeaderBackground () { checkWidget (); return headerBackground != null ? headerBackground : <START> defaultBackground(); <END> }</code><technical_language>Compilation error: convert GdkColor Color</technical_language>

Target:
public Color getHeaderBackground () { checkWidget (); return headerBackground != null ? headerBackground : display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); }
Source:
<code>public void testListenerRemoval() { cache.put("x", "y"); AtomicInteger i = new AtomicInteger(0); <START> assert 1 == cache.getListeners().size(); <END> CacheListener l = new CacheListener(i); cache.addListener(l); assert 2 == cache.getListeners().size(); assert cache.getListeners().contains(l); assert 0 == i.get(); cache.get("x"); assert 1 == i.get(); cache.removeListener(l); assert 1 == cache.getListeners().size(); i.set(0); assert 0 == i.get(); cache.get("x"); assert 0 == i.get(); }</code><technical_language>a listener if x-site configured</technical_language>

Target:
public void testListenerRemoval() { cache.put("x", "y"); AtomicInteger i = new AtomicInteger(0); assert 0 == cache.getListeners().size(); CacheListener l = new CacheListener(i); cache.addListener(l); assert 1 == cache.getListeners().size(); assert cache.getListeners().contains(l); assert 0 == i.get(); cache.get("x"); assert 1 == i.get(); cache.removeListener(l); assert 0 == cache.getListeners().size(); i.set(0); assert 0 == i.get(); cache.get("x"); assert 0 == i.get(); }
Source:
<code>public void should_try_next_host_on_connection_error(ClosedConnectionConfig.CloseType closeType) { simulateError(1, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(2, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(3, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); try { query(); <START> Fail.fail("expected a TransportException"); <END> } catch (NoHostAvailableException e) { assertThat(e.getErrors().keySet()).hasSize(3).containsOnlyOnce( host1.getSocketAddress(), host2.getSocketAddress(), host3.getSocketAddress()); assertThat(e.getErrors().values()).hasOnlyElementsOfType(TransportException.class); } assertOnRequestErrorWasCalled(3, TransportException.class); assertThat(errors.getRetries().getCount()).isEqualTo(3); assertThat(errors.getConnectionErrors().getCount()).isEqualTo(3); assertThat(errors.getIgnoresOnConnectionError().getCount()).isEqualTo(0); assertThat(errors.getRetriesOnConnectionError().getCount()).isEqualTo(3); assertQueried(1, 1); assertQueried(2, 1); assertQueried(3, 1); }</code><technical_language>Microscopic nit: this read "expected a NoHostAvailableException"</technical_language>

Target:
public void should_try_next_host_on_connection_error(ClosedConnectionConfig.CloseType closeType) { simulateError(1, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(2, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(3, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); try { query(); Fail.fail("expected a NoHostAvailableException"); } catch (NoHostAvailableException e) { assertThat(e.getErrors().keySet()).hasSize(3).containsOnly( host1.getSocketAddress(), host2.getSocketAddress(), host3.getSocketAddress()); assertThat(e.getErrors().values()).hasOnlyElementsOfType(TransportException.class); } assertOnRequestErrorWasCalled(3, TransportException.class); assertThat(errors.getRetries().getCount()).isEqualTo(3); assertThat(errors.getConnectionErrors().getCount()).isEqualTo(3); assertThat(errors.getIgnoresOnConnectionError().getCount()).isEqualTo(0); assertThat(errors.getRetriesOnConnectionError().getCount()).isEqualTo(3); assertQueried(1, 1); assertQueried(2, 1); assertQueried(3, 1); }
Source:
<code>void shouldSaveAndFindAll() { Airport vie = null; try { vie = new Airport("airports::vie", "vie", "loww"); airportRepository.save(vie); <START> List<Airport> all = StreamSupport.stream(airportRepository.findAll().spliterator(), false) <END> .collect(Collectors.toList()); assertFalse(all.isEmpty()); assertTrue(all.stream().anyMatch(a -> a.getId().equals("airports::vie"))); } finally { airportRepository.delete(vie); } }</code><technical_language>NIT: a suggestion, in case this simpler you: List<Airport> = new ArrayList<>(); airportRepository.findAll().forEach(target::add); if find this a lot: public static <T> List<T> toList(Iterable<T> iterable) { List<T> result = new ArrayList<>(); iterable.forEach(result::add); return result; }</technical_language>

Target:
void shouldSaveAndFindAll() { Airport vie = null; try { vie = new Airport("airports::vie", "vie", "loww"); airportRepository.save(vie); List<Airport> all = new ArrayList<>(); airportRepository.findAll().forEach(all::add); assertFalse(all.isEmpty()); assertTrue(all.stream().anyMatch(a -> a.getId().equals("airports::vie"))); } finally { airportRepository.delete(vie); } }
Source:
<code>private void removeLocationFromCache(HRegionLocation loc) { TableCache tableCache = cache.get(loc.getRegion().getTable()); if (tableCache == null) { return; } byte[] startKey = loc.getRegion().getStartKey(); for (;;) { RegionLocations oldLocs = tableCache.cache.get(startKey); if (oldLocs == null) { return; } HRegionLocation oldLoc = oldLocs.getRegionLocation(loc.getRegion().getReplicaId()); if (!canUpdateOnError(loc, oldLoc)) { return; } if (this.metaReplicaMode == CatalogReplicaMode.LoadBalance) { <START> metaReplicaSelector.onError(loc, RegionInfo.DEFAULT_REPLICA_ID); <END> } RegionLocations newLocs = removeRegionLocation(oldLocs, loc.getRegion().getReplicaId()); if (newLocs == null) { if (tableCache.cache.remove(startKey, oldLocs)) { recordClearRegionCache(); return; } } else { if (tableCache.cache.replace(startKey, oldLocs, newLocs)) { recordClearRegionCache(); return; } } } }</code><technical_language>This is a bit strange? a CatalogReplicaLoadBalanceSelector, a CatalogReplicaLoadBalanceSimpleSelector, I do assume is a simple selector pass default replica id here? spend a bunch of time for developers implement new selectors find out selector work expected. If want do this please declare a CatalogReplicaLoadBalanceSimpleSelector above</technical_language>

Target:
private void removeLocationFromCache(HRegionLocation loc) { TableCache tableCache = cache.get(loc.getRegion().getTable()); if (tableCache == null) { return; } byte[] startKey = loc.getRegion().getStartKey(); for (;;) { RegionLocations oldLocs = tableCache.cache.get(startKey); if (oldLocs == null) { return; } HRegionLocation oldLoc = oldLocs.getRegionLocation(loc.getRegion().getReplicaId()); if (!canUpdateOnError(loc, oldLoc)) { return; } if (this.metaReplicaMode == CatalogReplicaMode.LOAD_BALANCE) { metaReplicaSelector.onError(loc); } RegionLocations newLocs = removeRegionLocation(oldLocs, loc.getRegion().getReplicaId()); if (newLocs == null) { if (tableCache.cache.remove(startKey, oldLocs)) { recordClearRegionCache(); return; } } else { if (tableCache.cache.replace(startKey, oldLocs, newLocs)) { recordClearRegionCache(); return; } } } }
Source:
<code>public void fullMaintenance(@NonNull final IOnStatusListener listener) { mExecutor.execute(() -> { try { if (null == mDb) { listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int result = SUCCESS; try { result = IpMemoryStoreDatabase.dropAllExpiredRecords(mDb); } catch (Exception e) { if (DBG) Log.e(TAG, "Drop all zero relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int i = 0; while (!isDbSizeMetThreshold() && i < 500) { try { result = <START> IpMemoryStoreDatabase.dropLowestRelevanceRecord(mDb); <END> } catch (Exception e) { if (DBG) Log.e(TAG, "Drop lowest relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } i++; } listener.onComplete(makeStatus(result)); } catch (final RemoteException e) { } }); }</code><technical_language>drop 1 time inefficient. 1. estimate record want delete. e.g. want 50MB->30MB drop 2/5 * all_rows_in_db. 2. sort expiry 3. delete n rows of data</technical_language>

Target:
public void fullMaintenance(@NonNull final IOnStatusListener listener) { mExecutor.execute(() -> { try { if (null == mDb) { listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int result = SUCCESS; try { result = IpMemoryStoreDatabase.dropAllExpiredRecords(mDb); } catch (Exception e) { if (DBG) Log.e(TAG, "Drop all zero relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int i = 0; while (!isDbSizeMetThreshold() && i < 500) { try { final int totalNumber = IpMemoryStoreDatabase.getTotalRecordNumber(mDb); final long dbSize = getDbSize(); final float decreaseRate = (float) (dbSize - getDbSizeThreshold()) / (float) dbSize * 0.5f; final int deleteNumber = (int) (totalNumber * decreaseRate); result = IpMemoryStoreDatabase.dropNumberOfRecords(mDb, deleteNumber == 0 ? 1 : deleteNumber); } catch (Exception e) { if (DBG) Log.e(TAG, "Drop lowest relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } i++; } listener.onComplete(makeStatus(result)); } catch (final RemoteException e) { } }); }
Source:
<code>public void addToGroup(String externalId, String groupName) { LOGGER.debug(ADD_TO_GROUP_NAME, externalId, groupName); try { Group group = groupWebService.getGroupByName(groupName); if (group != null) { Contact contact = findByExternalId(externalId); if (contact != null) { contact.getGroupUUIDs().add(group.getUuid()); Contact updated = contactWebService.createOrUpdateContact(contact); eventPublisher.publishContactAddedToGroup(externalId, updated, group); } else { sendContactDoesNotExistMessage(externalId); } } else { sendGroupDoesNotExistMessage(groupName); } } catch (WebServiceException e) { <START> LOGGER.error(e.getMessage()); <END> sendWebserviceFailAddGroupMessage(e, externalId, groupName); } }</code><technical_language>I this log is redundant, method called logging</technical_language>

Target:
public void addToGroup(String externalId, String groupName) { LOGGER.debug(ADD_TO_GROUP_NAME, externalId, groupName); try { Group group = groupWebService.getGroupByName(groupName); if (group != null) { Contact contact = findByExternalId(externalId); if (contact != null) { contact.getGroupUUIDs().add(group.getUuid()); Contact updated = contactWebService.createOrUpdateContact(contact); eventPublisher.publishContactAddedToGroup(externalId, updated, group); } else { sendContactDoesNotExistMessage(externalId); } } else { sendGroupDoesNotExistMessage(groupName); } } catch (WebServiceException e) { sendWebserviceFailAddGroupMessage(e, externalId, groupName); } }
Source:
<code>private void handleConstraintViolation(Long conglomerateId, byte[] key, byte[] value) throws StandardException{ ExecRow execRow; if (isIndex(conglomerateId)) { Pair<ExecRow, KeyDecoder> p = (Pair<ExecRow, KeyDecoder>)decoderMap.get(conglomerateId); execRow = p.getFirst(); KeyDecoder decoder = (KeyDecoder) p.getSecond(); decoder.decode(key, 0, key.length, execRow); }else { PairDecoder decoder = (PairDecoder) decoderMap.get(conglomerateId); execRow = decoder.decode(key, value); } if (operationContext != null && operationContext.isPermissive()) { operationContext.recordBadRecord("Unique constraint violation, row: " + execRow.toString(), null); } else { SpliceLogUtils.error(LOG, "Unique constraint violation, row: %s", execRow.toString()); <START> DataDictionary dd = ah.getActivation().getLanguageConnectionContext().getDataDictionary(); <END> ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomerateId); com.splicemachine.db.catalog.UUID tableID = cd.getTableID(); TableDescriptor td = dd.getTableDescriptor(tableID); String tableName = td.getName(); String indexOrConstraintName; if (isIndex(conglomerateId)) { indexOrConstraintName = cd.getConglomerateName(); } else { ConstraintDescriptor conDesc = dd.getConstraintDescriptor(td, cd.getUUID()); indexOrConstraintName = conDesc.getConstraintName(); } throw StandardException.newException(SQLState.LANG_DUPLICATE_KEY_CONSTRAINT, indexOrConstraintName, tableName); } }</code><technical_language>get activation operationContext passing ActivationHolder</technical_language>

Target:
private void handleConstraintViolation(Long conglomerateId, byte[] key, byte[] value) throws StandardException{ ExecRow execRow; if (isIndex(conglomerateId)) { Pair<ExecRow, KeyDecoder> p = (Pair<ExecRow, KeyDecoder>)decoderMap.get(conglomerateId); execRow = p.getFirst(); KeyDecoder decoder = (KeyDecoder) p.getSecond(); decoder.decode(key, 0, key.length, execRow); }else { PairDecoder decoder = (PairDecoder) decoderMap.get(conglomerateId); execRow = decoder.decode(key, value); } if (operationContext != null && operationContext.isPermissive()) { operationContext.recordBadRecord("Unique constraint violation, row: " + execRow.toString(), null); } else { SpliceLogUtils.error(LOG, "Unique constraint violation, row: %s", execRow.toString()); DataDictionary dd = operationContext.getActivation().getLanguageConnectionContext().getDataDictionary(); ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomerateId); com.splicemachine.db.catalog.UUID tableID = cd.getTableID(); TableDescriptor td = dd.getTableDescriptor(tableID); String tableName = td.getName(); String indexOrConstraintName; if (isIndex(conglomerateId)) { indexOrConstraintName = cd.getConglomerateName(); } else { ConstraintDescriptor conDesc = dd.getConstraintDescriptor(td, cd.getUUID()); indexOrConstraintName = conDesc.getConstraintName(); } throw StandardException.newException(SQLState.LANG_DUPLICATE_KEY_CONSTRAINT, indexOrConstraintName, tableName); } }
Source:
<code>private static Set<HttpCookie> getCookiesFromConfig(HttpConfig config) { if (!StringUtils.isEmptyOrNull(config.getCookieFile())) { Path cookieFile = <START> Paths.get(config.getCookieFile()); <END> if (Files.exists(cookieFile)) { try { return NetscapeCookieFile.read(cookieFile, new Date()); } catch (IllegalArgumentException | IOException e) { LOG.warn("Could not read cookie file '{}'", cookieFile, e); } } } return Collections.emptySet(); }</code><technical_language>This throw InvalidPathException</technical_language>

Target:
private static Set<HttpCookie> getCookiesFromConfig(HttpConfig config) { if (!StringUtils.isEmptyOrNull(config.getCookieFile())) { try { Path cookieFile = Paths.get(config.getCookieFile()); return NetscapeCookieFile.read(cookieFile, new Date()); } catch (IOException | IllegalArgumentException e) { LOG.warn(MessageFormat.format( JGitText.get().couldNotReadCookieFile, config.getCookieFile(), e.getCause()), e); } } return Collections.emptySet(); }
Source:
<code><START> public String getUrl() { <END> final StringBuilder b = new StringBuilder(); b.append("jdbc:mysql://"); b.append(hostname(optional(cfg, "hostname"))); b.append(port(optional(cfg, "port"))); b.append("/"); b.append(required(cfg, "database")); return b.toString(); }</code><technical_language>URLBuilder URLComposer more natural</technical_language>

Target:
public String getUrl() { final StringBuilder b = new StringBuilder(); final ConfigSection dbs = new ConfigSection(cfg, "database"); b.append("jdbc:mysql://"); b.append(hostname(dbs.optional("hostname"))); b.append(port(dbs.optional("port"))); b.append("/"); b.append(dbs.required("database")); return b.toString(); }
Source:
<code>private void processRow(List<String> row) throws Exception { rowNum++; String id = null; try { id = row.get(idColumn); } catch (IndexOutOfBoundsException e) { } String label = null; try { label = row.get(labelColumn); } catch (IndexOutOfBoundsException e) { } String type = null; try { type = row.get(typeColumn); } catch (IndexOutOfBoundsException e) { } if (id == null && label == null) { return; } if (type == null || type.trim().isEmpty()) { type = "class"; } IRI iri = getIRI(id, label); if (iri == null) { return; } <START> switch (type) { <END> case "owl:Class": case "class": addClassAxioms(iri, row); break; case "owl:ObjectProperty": case "object property": addObjectPropertyAxioms(iri, row); break; case "owl:DataProperty": case "data property": addDataPropertyAxioms(iri, row); break; case "owl:AnnotationProperty": case "annotation property": addAnnotationPropertyAxioms(iri, row); break; case "owl:Datatype": case "datatype": addDatatypeAxioms(iri, row); break; case "owl:Individual": case "individual": case "owl:NamedIndividual": case "named individual": default: addIndividualAxioms(iri, row); break; } }</code><technical_language>above: hardcode owl prefix, resolve IRI</technical_language>

Target:
private void processRow(List<String> row) throws Exception { rowNum++; String id = null; try { id = row.get(idColumn); } catch (IndexOutOfBoundsException e) { } String label = null; try { label = row.get(labelColumn); } catch (IndexOutOfBoundsException e) { } String type = null; try { type = row.get(typeColumn); } catch (IndexOutOfBoundsException e) { } if (id == null && label == null) { return; } if (type == null || type.trim().isEmpty()) { if (label != null) { OWLEntity e = checker.getOWLEntity(label); if (e != null) { type = e.getEntityType().getIRI().toString(); } } else { OWLEntity e = checker.getOWLEntity(id); if (e != null) { type = e.getEntityType().getIRI().toString(); } } if (type == null) { type = "class"; } } IRI iri = getIRI(id, label); if (iri == null) { return; } IRI typeIRI = ioHelper.createIRI(type); String typeOrIRI = type; if (typeIRI != null) { typeOrIRI = typeIRI.toString(); } switch (typeOrIRI) { case "<LINK_5>": case "class": addClassAxioms(iri, row); break; case "<LINK_3>": case "object property": addObjectPropertyAxioms(iri, row); break; case "<LINK_4>": case "data property": addDataPropertyAxioms(iri, row); break; case "<LINK_0>": case "annotation property": addAnnotationPropertyAxioms(iri, row); break; case "<LINK_6>": case "datatype": addDatatypeAxioms(iri, row); break; case "<LINK_1>": case "individual": case "<LINK_2>": case "named individual": default: addIndividualAxioms(iri, row); break; } }
Source:
<code>boolean isNonBlocking() { <START> return false; <END> }</code><technical_language>I prefer this == NON_BLOCKING</technical_language>

Target:
boolean isNonBlocking() { return this == NON_BLOCKING; }
Source:
<code>public static void addAttributeToArgs(Attribute<String> attribute, Context context, List<CharSequence> vargs) { if (context.getValue(attribute) != null) { vargs.add(String.format("-D%s=$'%s'", attribute.getLongName(), context.getValue(attribute) <START> .replaceAll("[\\\\]", "\\\\\\\\\\\\\\\\").replaceAll("['\"$]", "\\\\$0"))); <END> } }</code><technical_language>Replacing "\" require regular expression, replace("\\", "\\\\\\\\") replace("\\", "\\x5C") instead of replaceAll()</technical_language>

Target:
public static void addAttributeToArgs(Attribute<String> attribute, Context context, List<CharSequence> vargs) { String value = context.getValue(attribute); if (value != null) { vargs.add(String.format("-D%s=$'%s'", attribute.getLongName(), value.replace("\\", "\\\\\\\\").replaceAll("['\"$]", "\\\\$0"))); } }
Source:
<code>public TopNNumericResultBuilder( DateTime timestamp, DimensionSpec dimSpec, String metricName, int threshold, final Comparator comparator, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.metricName = metricName; <START> this.aggFactories = (String[]) Lists.<AggregatorFactory, String>transform( <END> aggFactories, new Function<AggregatorFactory, String>() { @Nullable @Override public String apply(AggregatorFactory input) { return input.getName(); } } ).toArray(new String[0]); this.postAggs = AggregatorUtil.pruneDependentPostAgg(postAggs, this.metricName); this.threshold = threshold; this.metricComparator = comparator; this.dimValComparator = new Comparator<DimValHolder>() { @Override public int compare(DimValHolder d1, DimValHolder d2) { int retVal = metricComparator.compare(d1.getTopNMetricVal(), d2.getTopNMetricVal()); if (retVal == 0) { retVal = dimNameComparator.compare(d1.getDimName(), d2.getDimName()); } return retVal; } }; pQueue = new PriorityQueue<>(this.threshold + 1, this.dimValComparator); }</code><technical_language>rename aggregatorNames</technical_language>

Target:
public TopNNumericResultBuilder( DateTime timestamp, DimensionSpec dimSpec, String metricName, int threshold, final Comparator comparator, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.metricName = metricName; this.aggFactoryNames = TopNQueryQueryToolChest.extractFactoryName(aggFactories); this.postAggs = AggregatorUtil.pruneDependentPostAgg(postAggs, this.metricName); this.threshold = threshold; this.metricComparator = comparator; this.dimValComparator = new Comparator<DimValHolder>() { @Override public int compare(DimValHolder d1, DimValHolder d2) { int retVal = metricComparator.compare(d1.getTopNMetricVal(), d2.getTopNMetricVal()); if (retVal == 0) { retVal = dimNameComparator.compare(d1.getDimName(), d2.getDimName()); } return retVal; } }; pQueue = new PriorityQueue<>(this.threshold + 1, this.dimValComparator); }
Source:
<code><START> public void erorrResultMapLocation() throws Exception { <END> Configuration configuration = new Configuration(); String resource = "org/apache/ibatis/builder/ProblemResultMapper.xml"; try (InputStream inputStream = Resources.getResourceAsStream(resource)) { XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments()); builder.parse(); MappedStatement mappedStatement = configuration.getMappedStatement("findProblemTypeTest"); } }</code><technical_language>Please verify APIs. * <LINK_1>,org.junit.jupiter.api.function.Executable) * <LINK_0></technical_language>

Target:
public void erorrResultMapLocation() throws Exception { Configuration configuration = new Configuration(); String resource = "org/apache/ibatis/builder/ProblemResultMapper.xml"; try (InputStream inputStream = Resources.getResourceAsStream(resource)) { XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments()); builder.parse(); String resultMapName = "java.lang.String"; String statementId = "org.mybatis.spring.ErrorProblemMapper" + "." + "findProblemResultMapTest"; String message = "Could not find result map '" + resultMapName + "' referenced from '" + statementId + "'"; IncompleteElementException exception = Assertions.assertThrows(IncompleteElementException.class, ()-> configuration.getMappedStatement("findProblemTypeTest")); assertThat(exception.getMessage()).isEqualTo(message); } }