auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean next(K key, V value) throws IOException { if (eof) { return false; } if (firstRecord) { firstRecord = false; return true; } <START> if (realReader instanceof MapredInputFormatCompatible) { <END> ((MapredInputFormatCompatible) realReader).setKeyValue(key, value); } try { if (realReader.nextKeyValue()) { if (key != realReader.getCurrentKey()) { if (realReader instanceof MapredInputFormatCompatible) { throw new IOException("The RecordReader returned a key and value that do not match " + "the key and value sent to it. This means the RecordReader did not properly implement " + "com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } else { throw new IOException("DeprecatedInputFormatWrapper only " + "supports RecordReaders that return the same key & value " + "objects or implement com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } } if (value != realReader.getCurrentValue()) { if (null != valueCopier) valueCopier.copyValue(value, realReader.getCurrentValue()); else { throw new IOException("DeprecatedInputFormatWrapper - value is different " + "and no value copier provided. " + "Current reader class : " + realReader.getClass()); } } return true; } } catch (InterruptedException e) { throw new IOException(e); } eof = true; return false; }</code><technical_language>avoid this in next() -- cost of reflection is high do this call. instanceof check reader is set, a boolean in other places below</technical_language>

Target:
public boolean next(K key, V value) throws IOException { if (eof) { return false; } if (firstRecord) { firstRecord = false; return true; } if (mifcReader != null) { mifcReader.setKeyValue(key, value); } try { if (realReader.nextKeyValue()) { if (key != realReader.getCurrentKey()) { if (mifcReader != null) { throw new IOException("The RecordReader returned a key and value that do not match " + "the key and value sent to it. This means the RecordReader did not properly implement " + "com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } else { throw new IOException("DeprecatedInputFormatWrapper only " + "supports RecordReaders that return the same key & value " + "objects or implement com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } } if (value != realReader.getCurrentValue()) { if (null != valueCopier) valueCopier.copyValue(value, realReader.getCurrentValue()); else { throw new IOException("DeprecatedInputFormatWrapper - value is different " + "and no value copier provided. " + "Current reader class : " + realReader.getClass()); } } return true; } } catch (InterruptedException e) { throw new IOException(e); } eof = true; return false; }
Source:
<code><START> public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { <END> return "Alrighty!"; }</code><technical_language>This creates a deprecated warning. non-deprecated API</technical_language>

Target:
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { return null; }
Source:
<code>public WorkspaceConfigDto buildDefaultWorkspaceConfig(String name) { Map<String, String> attributes = new HashMap<>(); <START> attributes.put(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE, "org.eclipse.che.editor.theia:1.0.0"); <END> attributes.put(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, "che-machine-exec-plugin:0.0.1"); return newDto(WorkspaceConfigDto.class).withName(name).withAttributes(attributes); }</code><technical_language>hello, is grab latest version registry instead of 1.0.0 ? for machine exec plug-in</technical_language>

Target:
public WorkspaceConfigDto buildDefaultWorkspaceConfig(String name) { Map<String, String> attributes = new HashMap<>(); attributes.put(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE, defaultCheEditor); attributes.put(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, defaultChePlugins); return newDto(WorkspaceConfigDto.class).withName(name).withAttributes(attributes); }
Source:
<code>private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; List allStatuses = new ArrayList(); collectTargetElements(rootStatus, new HashSet(), allStatuses); for (Iterator it = allStatuses.iterator(); it.hasNext();) { IConstraintStatus nextStatus = (IConstraintStatus) it.next(); DSemanticDecorator dSemanticDecorator = getDSemanticDecorator(nextStatus.getTarget(), diagramEditPart); if (dSemanticDecorator != null) { <START> View view = SiriusGMFHelper.getGmfView(dSemanticDecorator); <END> String qualifiedName = EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true); if (nextStatus instanceof RuleWrappingStatus) { createValidationRuleMarker((RuleWrappingStatus) nextStatus, diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } else { addMarker(diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } } } }</code><technical_language>issue happen code refactored in way</technical_language>

Target:
private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; List allStatuses = new ArrayList(); collectTargetElements(rootStatus, new HashSet(), allStatuses); for (Iterator it = allStatuses.iterator(); it.hasNext();) { IConstraintStatus nextStatus = (IConstraintStatus) it.next(); DSemanticDecorator dSemanticDecorator = getDSemanticDecorator(nextStatus.getTarget(), diagramEditPart); View view = null; if (dSemanticDecorator != null) { view = SiriusGMFHelper.getGmfView(dSemanticDecorator); } if (view == null) { view = diagramEditPart.getDiagramView(); } String qualifiedName = EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true); if (nextStatus instanceof RuleWrappingStatus) { createValidationRuleMarker((RuleWrappingStatus) nextStatus, diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } else { addMarker(diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } } }
Source:
<code>public void testSetWithUTF8Key(Method m) throws InterruptedException, ExecutionException, TimeoutException { <START> OperationFuture<Boolean> f = client.set(k(m, "你好-"), 0, v(m)); <END> assertTrue(f.get(timeout, TimeUnit.SECONDS)); assertEquals(v(m), client.get(k(m, "你好-"))); }</code><technical_language>prefer of unicode escapes instead of actual characters</technical_language>

Target:
public void testSetWithUTF8Key(Method m) throws InterruptedException, ExecutionException, TimeoutException { String key = "\u4f60\u597d-"; OperationFuture<Boolean> f = client.set(k(m, key), 0, v(m)); assertTrue(f.get(timeout, TimeUnit.SECONDS)); assertEquals(v(m), client.get(k(m, key))); }
Source:
<code>public void run() { <START> LOG.info("Kill signal recieved, trying to shutdown tailer gracefully"); <END> manager.stopPipes(); }</code><technical_language>logger in shutdown thread, call sequence of shutdown is unknown, logger stopped already, logger stops throw exception</technical_language>

Target:
public void run() { manager.stopAsync(); }
Source:
<code><START> public void putWithMerge(REF_DO refDo, AR_DO arDo) { <END> ChannelAccess channelAccess = mapArDo2ChannelAccess(arDo); putWithMerge(refDo, channelAccess); }</code><technical_language>move added code here; public void putWithMerge(REF_DO refDo, AR_DO arDo) { + if (refDo.isCarrierPrivilegeRefDo()) { + // Ignore Carrier Privilege Rules + return; + } ChannelAccess channelAccess = mapArDo2ChannelAccess(arDo); putWithMerge(refDo, channelAccess); } Or, adding dummy AR-DO a solution</technical_language>

Target:
public void putWithMerge(REF_DO refDo, AR_DO arDo) { if (refDo.isCarrierPrivilegeRefDo()) { return; } ChannelAccess channelAccess = mapArDo2ChannelAccess(arDo); putWithMerge(refDo, channelAccess); }
Source:
<code>public void validateConnectionTest() throws Exception { TestUtils.assertException(IllegalArgumentException.class, () -> serverSecurityService.validateConnection(null).get(), null); EmbeddedChannel channel = new EmbeddedChannel(); ChannelHandlerContext ctx = new MockChannelHandlerContext(channel); try { serverSecurityService.validateConnection(ctx, (r, e) -> { Assert.assertNull("result not null", r); Assert.assertNull("exception not null", e); }); } catch (Exception e) { <START> Assert.fail("unexpected exception happened" + e); <END> } serverSecurityService.close(); ThrowingConsumer<ExecutionException> errorAction = e -> { Assert.assertTrue("Exception should have been an instance of RestServiceException", e.getCause() instanceof RestServiceException); RestServiceException re = (RestServiceException) e.getCause(); Assert.assertEquals("Unexpected RestServerErrorCode (Future)", RestServiceErrorCode.ServiceUnavailable, re.getErrorCode()); }; TestUtils.assertException(ExecutionException.class, () -> serverSecurityService.validateConnection(ctx).get(), errorAction); }</code><technical_language>I some ambry test cases this assert.fail pattern, I is generally exception thrown in test cases instead of catching wrapping in assert. Throwing exception full stack trace (and fails test) helpful in tracing issue if test fail</technical_language>

Target:
public void validateConnectionTest() throws Exception { TestUtils.assertException(IllegalArgumentException.class, () -> serverSecurityService.validateConnection(null).get(), null); SSLSession sslSession = Mockito.mock(SSLSession.class); serverSecurityService.validateConnection(sslSession, (r, e) -> { Assert.assertNull("result not null", r); Assert.assertNull("exception not null", e); }); serverSecurityService.close(); ThrowingConsumer<ExecutionException> errorAction = e -> { Assert.assertTrue("Exception should have been an instance of RestServiceException", e.getCause() instanceof RestServiceException); RestServiceException re = (RestServiceException) e.getCause(); Assert.assertEquals("Unexpected RestServerErrorCode (Future)", RestServiceErrorCode.ServiceUnavailable, re.getErrorCode()); }; TestUtils.assertException(ExecutionException.class, () -> serverSecurityService.validateConnection(sslSession).get(), errorAction); }
Source:
<code>public void testIsStringLiteral() { Set<ASTLiteral> literals = getNodes(ASTLiteral.class, TEST1); ASTLiteral literal = literals.iterator().next(); assertTrue(literal.isStringLiteral()); <START> assertEquals("String", literal.getTypeImage()); <END> }</code><technical_language>This java.lang.String</technical_language>

Target:
public void testIsStringLiteral() { Set<ASTLiteral> literals = getNodes(ASTLiteral.class, TEST1); assertTrue((literals.iterator().next()).isStringLiteral()); }
Source:
<code>public String handleCallBack(HttpMessage msg) throws ApiException { try { String query = msg.getRequestHeader().getURI().getQuery(); if (query == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } Map<String, String> parameters = Stream.of(query.split("&")) .map(paramAndValue -> paramAndValue.split("=")) .collect(Collectors.toMap( <START> e -> e[0], <END> e -> e[1] )); String action = parameters.get("action"); if (action == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } LOGGER.debug("action = " + action); switch (action) { case "getFile": return getFileFromParameters(msg, parameters); case "createAlert": return createAlertFromMessage(msg); default: throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "action"); } } catch (ApiException e) { throw e; } catch (Exception e) { throw new ApiException (ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString()); } }</code><technical_language>Ideally this getEscapedQuery() instead (to properly parse later)</technical_language>

Target:
public String handleCallBack(HttpMessage msg) throws ApiException { try { String query = msg.getRequestHeader().getURI().getQuery(); if (query == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } Map<String, String> parameters = parameterParser .getParams(msg, HtmlParameter.Type.url); String action = parameters.get("action"); if (action == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } LOGGER.debug("action = " + action); switch (action) { case "getFile": return getFileFromParameters(msg, parameters); case "createAlert": return createAlertFromMessage(msg); default: throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "action"); } } catch (ApiException e) { throw e; } catch (Exception e) { throw new ApiException (ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString()); } }
Source:
<code>public long intern(String string, int quark) throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { Map<String, Long> stringPool = fStringPools.computeIfAbsent(quark, unused -> HashBiMap.<String, Long> create()); Long index = stringPool.get(string); if (index == null) { <START> long size = stringPool.size() + getStartTime(); <END> stringPool.put(string, size); modifyAttribute(size, string, quark); return size; } return index; }</code><technical_language>This variable name is confusing, a size start time + pool size. internalValue</technical_language>

Target:
public long intern(String string, int quark) throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { Map<String, Long> stringPool = fStringPools.computeIfAbsent(quark, unused -> HashBiMap.<String, Long> create()); Long index = stringPool.get(string); if (index == null) { long internValue = stringPool.size() + getStartTime(); stringPool.put(string, internValue); modifyAttribute(internValue, string, quark); return size; } return index; }
Source:
<code>private void createLdapContext() throws NamingException { Hashtable<Object, Object> connProp = getConnectionProperties(ldapConfig); if (!LDAPConstants.AUTH_TYPE_NONE.equals(ldapConfig.getAuthType())) { vaultCharSecret = getVaultSecret(); if (vaultCharSecret != null && !ldapConfig.isStartTls()) { connProp.put(SECURITY_CREDENTIALS, vaultCharSecret.getAsArray() .orElse(ldapConfig.getBindCredential().toCharArray())); } } ldapContext = new InitialLdapContext(connProp, null); if (ldapConfig.isStartTls()) { SSLSocketFactory sslSocketFactory = null; String useTruststoreSpi = ldapConfig.getUseTruststoreSpi(); if (useTruststoreSpi != null && useTruststoreSpi.equals(LDAPConstants.USE_TRUSTSTORE_ALWAYS)) { <START> TruststoreProviderFactory truststoreFactory = (TruststoreProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(TruststoreProvider.class, "file"); <END> TruststoreProvider provider = truststoreFactory.create(session); sslSocketFactory = provider.getSSLSocketFactory(); } tlsResponse = startTLS(ldapContext, ldapConfig.getAuthType(), ldapConfig.getBindDN(), vaultCharSecret.getAsArray().orElse(ldapConfig.getBindCredential().toCharArray()), sslSocketFactory); if (tlsResponse == null) { throw new NamingException("Wasn't able to establish LDAP connection through StartTLS"); } } }</code><technical_language>I lines 86-87 replaced with: TruststoreProvider provider = session.getProvider(TruststoreProvider.class); This is more proper of KeycloakSession SPI time, is hardcoded "file" provider - users in theory replace "file" provider else</technical_language>

Target:
private void createLdapContext() throws NamingException { Hashtable<Object, Object> connProp = getConnectionProperties(ldapConfig); if (!LDAPConstants.AUTH_TYPE_NONE.equals(ldapConfig.getAuthType())) { vaultCharSecret = getVaultSecret(); if (vaultCharSecret != null && !ldapConfig.isStartTls()) { connProp.put(SECURITY_CREDENTIALS, vaultCharSecret.getAsArray() .orElse(ldapConfig.getBindCredential().toCharArray())); } } ldapContext = new InitialLdapContext(connProp, null); if (ldapConfig.isStartTls()) { SSLSocketFactory sslSocketFactory = null; String useTruststoreSpi = ldapConfig.getUseTruststoreSpi(); if (useTruststoreSpi != null && useTruststoreSpi.equals(LDAPConstants.USE_TRUSTSTORE_ALWAYS)) { TruststoreProvider provider = session.getProvider(TruststoreProvider.class); sslSocketFactory = provider.getSSLSocketFactory(); } tlsResponse = startTLS(ldapContext, ldapConfig.getAuthType(), ldapConfig.getBindDN(), vaultCharSecret.getAsArray().orElse(ldapConfig.getBindCredential().toCharArray()), sslSocketFactory); if (tlsResponse == null) { throw new NamingException("Wasn't able to establish LDAP connection through StartTLS"); } } }
Source:
<code>private void checkUnreadyConnectionsStatus() { Iterator<Map.Entry<String, Long>> iterator = connectionPendingHandshakeTimer.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, Long> entry = iterator.next(); if (isChannelReady(entry.getKey())) { connected.add(entry.getKey()); metrics.selectorConnectionCreated.inc(); <START> metrics.selectorPerceivedSslHandshakeTime.update(System.currentTimeMillis() - entry.getValue()); <END> iterator.remove(); connectionsPendingHandshakeCount.decrementAndGet(); } } }</code><technical_language>in SSLTransmission this handshaking time is reported. metrics.sslHandshakeTime.update(time.milliseconds() - handshakeStartTime); some difference in if compared selectorPerceivedSslHandshakeTime, I guess big. Do want this</technical_language>

Target:
private void checkUnreadyConnectionsStatus() { Iterator<String> iterator = unreadyConnections.iterator(); while (iterator.hasNext()) { String connId = iterator.next(); if (isChannelReady(connId)) { connected.add(connId); iterator.remove(); metrics.selectorConnectionCreated.inc(); } } }
Source:
<code>public HiOrgServerProfile extractUserProfile(String body) { final HiOrgServerProfile profile = newProfile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { logger.debug("Extracting user profile from JSON node " + json); profile.setId(ProfileHelper.sanitizeIdentifier(profile, JsonHelper.getElement(json, USER_ID))); for (final String attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { <START> logger.debug("No JSON node to extract user profile was created"); <END> } extractRoles(profile); return profile; }</code><technical_language>I want build empy profile, a bad idea me. throw a TechnicalExceptioninstead</technical_language>

Target:
public HiOrgServerProfile extractUserProfile(String body) { final HiOrgServerProfile profile = newProfile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { logger.debug("Extracting user profile from JSON node " + json); profile.setId(ProfileHelper.sanitizeIdentifier(profile, JsonHelper.getElement(json, USER_ID))); for (final String attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { logger.error("Unable to extract user profile as no JSON node was found in body: {}", body); throw new TechnicalException("No JSON node to extract user profile from"); } extractRoles(profile); return profile; }
Source:
<code>public void getMostRecentElementsIncludeDeleted() { when(mockMapper.batchLoad(any(List.class))).thenReturn(appConfigElementMapId1And2()); List<AppConfigElement> returned = dao.getMostRecentElements(TestConstants.TEST_STUDY, true); assertEquals(2, returned.size()); assertIdAndRevision(returned.get(0), ID_1, 3L); <START> assertIdAndRevision(returned.get(1), ID_2, 3L); <END> }</code><technical_language>Test verify DDB query. Also, return "real" DDB query pass batchLoad() verify data flow is working correctly</technical_language>

Target:
public void getMostRecentElementsIncludeDeleted() { when(mockMapper.batchLoad(any(List.class))).thenReturn(appConfigElementMapId1And2()); List<AppConfigElement> returned = dao.getMostRecentElements(TestConstants.TEST_STUDY, true); assertEquals(2, returned.size()); assertIdAndRevision(returned.get(0), ID_1, 3L); assertIdAndRevision(returned.get(1), ID_2, 3L); verify(mockMapper).query(eq(DynamoAppConfigElement.class), queryCaptor.capture()); DynamoDBQueryExpression<DynamoAppConfigElement> query = queryCaptor.getValue(); assertEquals(DynamoAppConfigElementDao.STUDY_ID_INDEX_NAME, query.getIndexName()); assertFalse(query.isConsistentRead()); assertFalse(query.isScanIndexForward()); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, query.getHashKeyValues().getStudyId()); assertNull(query.getHashKeyValues().getId()); }
Source:
<code>public Polygon(double[] lat, double[] lon) { if (lat.length != lon.length) { throw new IllegalArgumentException("Points must be of equal length but was " + lat.length + " vs. " + lon.length); } if (lat.length == 0) { throw new IllegalArgumentException("Points must not be empty"); } this.lat = lat; this.lon = lon; for (int i = 0; i < lat.length; i++) { if (i == 0) { minLat = lat[i]; maxLat = lat[i]; minLon = lon[i]; maxLon = lon[i]; } else { if (lat[i] < minLat) { minLat = lat[i]; } else if (lat[i] > maxLat) { maxLat = lat[i]; } if (lon[i] < minLon) { minLon = lon[i]; } else if (lon[i] > maxLon) { maxLon = lon[i]; } } } minLat -= GROWN_FACTOR; minLon -= GROWN_FACTOR; maxLat += GROWN_FACTOR; <START> maxLon += GROWN_FACTOR; <END> epsilon = (maxLat - minLat) / 10; }</code><technical_language>if default constructor (without touching minLat etc) create a public Polygon(double[] lat, double[] lon, double growFactor)</technical_language>

Target:
public Polygon(double[] lat, double[] lon) { this(lat, lon, 0); }
Source:
<code>public Optional<UsernamePasswordCredentials> extract(WebContext context) { final Optional<TokenCredentials> credentials = this.extractor.extract(context); <START> return credentials.flatMap( c -> { <END> final byte[] decoded = Base64.getDecoder().decode(c.getToken()); String token; try { token = new String(decoded, "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new CredentialsException("Bad format of the basic auth header"); } final int delim = token.indexOf(":"); if (delim < 0) { throw new CredentialsException("Bad format of the basic auth header"); } return Optional.of( new UsernamePasswordCredentials( token.substring(0, delim), token.substring(delim + 1) ) ); }); }</code><technical_language>flatMap if end returning a non-empty optional in lambda</technical_language>

Target:
public Optional<UsernamePasswordCredentials> extract(WebContext context) { final Optional<TokenCredentials> credentials = this.extractor.extract(context); return credentials.map(c -> { final byte[] decoded = Base64.getDecoder().decode(c.getToken()); String token; try { token = new String(decoded, "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new CredentialsException("Bad format of the basic auth header"); } final int delim = token.indexOf(":"); if (delim < 0) { throw new CredentialsException("Bad format of the basic auth header"); } return new UsernamePasswordCredentials( token.substring(0, delim), token.substring(delim + 1) ); }); }
Source:
<code>public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { <START> IResource[] toScan = resources; <END> for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, monitor); cache.merge(newCache); super.refresh(resources, depth, monitor); return; } } List<String> paths = new ArrayList<String>(); for (IResource resource : toScan) { IProject project = resource.getProject(); if (gsds.contains(project)) { GitSynchronizeData data = gsds.getData(project); if (data != null) { paths.add(RepositoryMapping.getMapping(project) .getRepoRelativePath(resource)); } } } if (!paths.isEmpty()) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, paths, monitor); cache.merge(newCache); } super.refresh(resources, depth, monitor); }</code><technical_language>is this needed</technical_language>

Target:
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, monitor); cache.merge(newCache); super.refresh(resources, depth, monitor); return; } } List<String> paths = new ArrayList<String>(); for (IResource resource : resources) { IProject project = resource.getProject(); if (gsds.contains(project)) { String path = RepositoryMapping.getMapping(project) .getRepoRelativePath(resource); if (!path.equals("")) { paths.add(path); } } } if (!paths.isEmpty()) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, paths, monitor); cache.merge(newCache); } super.refresh(resources, depth, monitor); }
Source:
<code>public String process(String input, Class<?> scope, String name) { RequestCycle cycle = RequestCycle.get(); Url cssUrl = Url.parse(name); Matcher matcher = URL_PATTERN.matcher(input); StringBuffer output = new StringBuffer(); while (matcher.find()) { Url imageCandidateUrl = Url.parse(matcher.group(1)); CharSequence processedUrl; boolean embedded = false; if (imageCandidateUrl.isFull()) { processedUrl = imageCandidateUrl.toString(Url.StringMode.FULL); <START> <END> } else if (imageCandidateUrl.isContextAbsolute()) { processedUrl = imageCandidateUrl.toString(); } else { Url cssUrlCopy = new Url(cssUrl); cssUrlCopy.resolveRelative(imageCandidateUrl); if (cssUrlCopy.getQueryString() != null && cssUrlCopy.getQueryString().contains(EMBED_BASE64)) { embedded = true; PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString().replace("?" + EMBED_BASE64, "")); try { processedUrl = createBase64EncodedImage(imageReference); } catch (Exception e) { throw new WicketRuntimeException( "Error while embedding an image into the css: " + imageReference.toString(), e); } } else { PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString()); processedUrl = cycle.urlFor(imageReference, null); } } matcher.appendReplacement(output, embedded ? "url(" + processedUrl + ")" : "url('" + processedUrl + "')"); } matcher.appendTail(output); return output.toString(); }</code><technical_language>need of new extra line</technical_language>

Target:
public String process(String input, Class<?> scope, String name) { RequestCycle cycle = RequestCycle.get(); Url cssUrl = Url.parse(name); Matcher matcher = URL_PATTERN.matcher(input); StringBuffer output = new StringBuffer(); while (matcher.find()) { Url imageCandidateUrl = Url.parse(matcher.group(1)); CharSequence processedUrl; boolean embedded = false; if (imageCandidateUrl.isFull()) { processedUrl = imageCandidateUrl.toString(Url.StringMode.FULL); } else if (imageCandidateUrl.isContextAbsolute()) { processedUrl = imageCandidateUrl.toString(); } else { Url cssUrlCopy = new Url(cssUrl); cssUrlCopy.resolveRelative(imageCandidateUrl); if (cssUrlCopy.getQueryString() != null && cssUrlCopy.getQueryString().contains(EMBED_BASE64)) { embedded = true; PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString().replace("?" + EMBED_BASE64, "")); try { processedUrl = createBase64EncodedImage(imageReference); } catch (Exception e) { throw new WicketRuntimeException( "Error while embedding an image into the css: " + imageReference, e); } } else { PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString()); processedUrl = cycle.urlFor(imageReference, null); } } matcher.appendReplacement(output, embedded ? "url(" + processedUrl + ")" : "url('" + processedUrl + "')"); } matcher.appendTail(output); return output.toString(); }
Source:
<code>public void checkIncrementalCompilationWithMultipleKieBases() throws Exception { String rule = "package org.kie.scanner\n" + "rule R1 when\n" + "then\n" + "end\n"; String invalidRule = "package org.kie.scanner\n" + "rule R2 when\n" + " Cheese" + "then\n" + "end\n"; KieServices ks = KieServices.Factory.get(); KieFileSystem kfs = createKieFileSystemWithTwoKBases(ks); kfs.write("src/main/resources/org/kie/scanner/rule.drl", rule); KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll(); assertEquals(0, kieBuilder.getResults().getMessages().size()); kfs.write("src/main/resources/org/kie/scanner/invalidRule.drl", invalidRule); IncrementalResults addResults = ((InternalKieBuilder) kieBuilder).createFileSet("src/main/resources/org/kie/scanner/invalidRule.drl").build(); <START> assertFalse(addResults.getAddedMessages().isEmpty()); <END> addResults .getAddedMessages() .stream() .map(m -> (MessageImpl) m ) .forEach(m -> assertNotNull(m.getKieBaseName())); }</code><technical_language>count added messages please? count of issues equals count of KBases in this simple case. I think</technical_language>

Target:
public void checkIncrementalCompilationWithMultipleKieBases() throws Exception { String rule = "package org.kie.scanner\n" + "rule R1 when\n" + "then\n" + "end\n"; String invalidRule = "package org.kie.scanner\n" + "rule R2 when\n" + " Cheese()\n" + "then\n" + "end\n"; KieServices ks = KieServices.Factory.get(); KieFileSystem kfs = createKieFileSystemWithTwoKBases(ks); kfs.write("src/main/resources/org/kie/scanner/rule.drl", rule); KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll(); assertEquals(0, kieBuilder.getResults().getMessages().size()); kfs.write("src/main/resources/org/kie/scanner/invalidRule.drl", invalidRule); IncrementalResults addResults = ((InternalKieBuilder) kieBuilder).createFileSet("src/main/resources/org/kie/scanner/invalidRule.drl").build(); assertEquals(2, addResults.getAddedMessages().size()); addResults .getAddedMessages() .stream() .map(m -> (MessageImpl) m ) .forEach(m -> assertNotNull(m.getKieBaseName())); }
Source:
<code>public void before() throws UnknownHostException { db = fongo.getDB(); identityManager = new IdentityManager(db); try { AuthenticationHelper.setMockPermissions(authChecker, null, null, null, null, Authentication.AuthResponse.PermissionLevel.NO_PERMISSION); when(optionChecker.authenticateDate(any(AuthenticationDataCreator.class), anyLong())) .thenReturn(false); when(optionChecker.isItemPublished(any(AuthenticationDataCreator.class))) .thenReturn(false); when(optionChecker.isItemRegistrationRequired(any(AuthenticationDataCreator.class))) .thenReturn(true); <START> } catch (DatabaseAccessException e) { <END> e.printStackTrace(); } catch (AuthenticationException e) { e.printStackTrace(); } dbAuthChecker = new Authenticator(authChecker, optionChecker); }</code><technical_language>chance to: } catch (DatabaseAccessException | AuthenticationException e) {..} do exact in</technical_language>

Target:
public void before() throws UnknownHostException { db = fongo.getDB(); identityManager = new IdentityManager(db); try { AuthenticationHelper.setMockPermissions(authChecker, null, null, null, null, Authentication.AuthResponse.PermissionLevel.NO_PERMISSION); when(optionChecker.authenticateDate(any(AuthenticationDataCreator.class), anyLong())) .thenReturn(false); when(optionChecker.isItemPublished(any(AuthenticationDataCreator.class))) .thenReturn(false); when(optionChecker.isItemRegistrationRequired(any(AuthenticationDataCreator.class))) .thenReturn(true); } catch (DatabaseAccessException | AuthenticationException e) { e.printStackTrace(); } dbAuthChecker = new Authenticator(authChecker, optionChecker); }
Source:
<code>public Page deserialize(SerializedPage serializedPage) { checkArgument(serializedPage != null, "serializedPage is null"); <START> <END> if (!decompressor.isPresent() || !PageCodecMarker.COMPRESSED.check(serializedPage.getPageCodecMarkings())) { return readRawPage(serializedPage.getPositionCount(), serializedPage.getSlice().getInput(), blockEncodingSerde); } int uncompressedSize = serializedPage.getUncompressedSizeInBytes(); byte[] decompressed = new byte[uncompressedSize]; int actualUncompressedSize = decompressor.get().decompress(serializedPage.getSlice().getBytes(), 0, serializedPage.getSlice().length(), decompressed, 0, uncompressedSize); checkState(uncompressedSize == actualUncompressedSize); return readRawPage(serializedPage.getPositionCount(), Slices.wrappedBuffer(decompressed, 0, uncompressedSize).getInput(), blockEncodingSerde); }</code><technical_language>else return is needed</technical_language>

Target:
public Page deserialize(SerializedPage serializedPage) { checkArgument(serializedPage != null, "serializedPage is null"); Slice slice = serializedPage.getSlice(); if (ENCRYPTED.isSet(serializedPage.getPageCodecMarkers())) { checkState(spillCipher.isPresent(), "Page is encrypted, but spill cipher is missing"); slice = Slices.wrappedBuffer(spillCipher.get().decrypt(slice.toByteBuffer())); } if (COMPRESSED.isSet(serializedPage.getPageCodecMarkers())) { checkState(decompressor.isPresent(), "Page is compressed, but decompressor is missing"); int uncompressedSize = serializedPage.getUncompressedSizeInBytes(); ByteBuffer decompressionBuffer = ByteBuffer.allocate(uncompressedSize); decompressor.get().decompress(slice.toByteBuffer(), decompressionBuffer); decompressionBuffer.flip(); checkState(decompressionBuffer.remaining() == uncompressedSize); slice = Slices.wrappedBuffer(decompressionBuffer); } return readRawPage(serializedPage.getPositionCount(), slice.getInput(), blockEncodingSerde); }
Source:
<code>public static CVSTag[] fetchTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException { Set<CVSTag> tagSet = new HashSet<>(); for (ILogEntry <START> entrie : <END> file.getLogEntries(monitor)) { for (CVSTag tag : entrie.getTags()) { tagSet.add(tag); } } return tagSet.toArray(new CVSTag[tagSet.size()]); }</code><technical_language>entry</technical_language>

Target:
public static CVSTag[] fetchTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException { Set<CVSTag> tagSet = new HashSet<>(); for (ILogEntry entry : file.getLogEntries(monitor)) { for (CVSTag tag : entry.getTags()) { tagSet.add(tag); } } return tagSet.toArray(new CVSTag[tagSet.size()]); }
Source:
<code>public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE))) { return; } <START> <END> if (parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE)) && !COMMON_STRATEGY.equals(strategy)) { String message = format( "Workspace configuration not valid: Asynchronous storage available only for 'common' PVC strategy, but got %s", strategy); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } if (parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE)) && !isEphemeral(osEnv.getAttributes())) { String message = format( "Workspace configuration not valid: Asynchronous storage available only if '%s' attribute set to false", ASYNC_PERSIST_ATTRIBUTE); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } String namespace = identity.getInfrastructureNamespace(); String userId = identity.getOwnerId(); KubernetesClient oc = clientFactory.create(identity.getWorkspaceId()); String configMapName = namespace + ASYNC_STORAGE_CONFIG; createPvcIfNotExist(oc, namespace, userId); createConfigMapIfNotExist(oc, namespace, configMapName, userId, osEnv); createAsyncStoragePodIfNotExist(oc, namespace, configMapName, userId); createStorageServiceIfNotExist(oc, namespace, userId); }</code><technical_language>do need (parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE) condition here</technical_language>

Target:
public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE))) { return; } if (!COMMON_STRATEGY.equals(pvcStrategy)) { String message = format( "Workspace configuration not valid: Asynchronous storage available only for 'common' PVC strategy, but got %s", pvcStrategy); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } if (!isEphemeral(osEnv.getAttributes())) { String message = format( "Workspace configuration not valid: Asynchronous storage available only if '%s' attribute set to false", ASYNC_PERSIST_ATTRIBUTE); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } String namespace = identity.getInfrastructureNamespace(); String userId = identity.getOwnerId(); KubernetesClient oc = clientFactory.create(identity.getWorkspaceId()); String configMapName = namespace + ASYNC_STORAGE_CONFIG; createPvcIfNotExist(oc, namespace, userId); createConfigMapIfNotExist(oc, namespace, configMapName, userId, osEnv); createAsyncStoragePodIfNotExist(oc, namespace, configMapName, userId); createStorageServiceIfNotExist(oc, namespace, userId); }
Source:
<code>public void parseRemote(String remoteFilePath) { String[] elements = remoteFilePath.split(String.valueOf(S3BackupPath.PATH_SEP)); List<String> pieces = Lists.newArrayList(); for (String ele : elements) { if (ele.equals("")) continue; pieces.add(ele); } assert pieces.size() >= 7 : "Too few elements in path " + remoteFilePath; if (pieces.size() == NUM_PATH_ELEMENTS_CASS_1_0) setCassandra1_0(true); baseDir = pieces.get(0); region = pieces.get(1); clusterName = pieces.get(2); token = pieces.get(3); time = parseDate(pieces.get(4)); type = BackupFileType.valueOf(pieces.get(5)); <START> if (type != BackupFileType.META && type != BackupFileType.META_V2 && type != BackupFileType.CL) { <END> keyspace = pieces.get(6); if (!isCassandra1_0) columnFamily = pieces.get(7); } fileName = pieces.get(pieces.size() - 1); }</code><technical_language>nit: extract this a method (maybe isDataFile()) this is in multiple places</technical_language>

Target:
public void parseRemote(String remoteFilePath) { String[] elements = remoteFilePath.split(String.valueOf(S3BackupPath.PATH_SEP)); List<String> pieces = Lists.newArrayList(); for (String ele : elements) { if (ele.equals("")) continue; pieces.add(ele); } assert pieces.size() >= 7 : "Too few elements in path " + remoteFilePath; if (pieces.size() == NUM_PATH_ELEMENTS_CASS_1_0) setCassandra1_0(true); baseDir = pieces.get(0); region = pieces.get(1); clusterName = pieces.get(2); token = pieces.get(3); time = parseDate(pieces.get(4)); type = BackupFileType.valueOf(pieces.get(5)); if (BackupFileType.isDataFile(type)) { keyspace = pieces.get(6); if (!isCassandra1_0) columnFamily = pieces.get(7); } fileName = pieces.get(pieces.size() - 1); }
Source:
<code>protected RecordedRequest assertSent(MockWebServer server, String method, String path) throws InterruptedException { RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), method); assertEquals(request.getPath(), path); assertEquals(request.getHeader("Accept"), "application/json"); <START> assertEquals(request.getHeader("Authorization"), "Bearer " + MOCK_BEARER_TOKEN); <END> return request; }</code><technical_language>need change this auth accept type completing teh request verification in mock tests</technical_language>

Target:
protected RecordedRequest assertSent(MockWebServer server, String method, String path) throws InterruptedException { RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), method); assertEquals(request.getPath(), path); assertEquals(request.getHeader("Authorization"), authHeader); return request; }
Source:
<code>private @Nullable ITmfFilter extractSearchFilter(VirtualTableQueryFilter queryFilter) { if (queryFilter instanceof EventTableQueryFilter) { EventTableQueryFilter eventTableQueryFilter = (EventTableQueryFilter) queryFilter; Map<Long, String> searchMap = eventTableQueryFilter.getSearchFilter(); if (searchMap == null || searchMap.isEmpty()) { return null; } TmfFilterRootNode rootFilter = new TmfFilterRootNode(); for (Entry<Long, String> searchEntry : searchMap.entrySet()) { TmfFilterMatchesNode searchNode = new <START> TmfFilterMatchesNode(null); <END> searchNode.setEventAspect(fAspectMap.get(searchEntry.getKey())); searchNode.setRegex(searchEntry.getValue()); rootFilter.addChild(searchNode); } return rootFilter; } return null; }</code><technical_language>rootFilter</technical_language>

Target:
private static @Nullable ITmfFilter extractSearchFilter(VirtualTableQueryFilter queryFilter) { if (queryFilter instanceof EventTableQueryFilter) { EventTableQueryFilter eventTableQueryFilter = (EventTableQueryFilter) queryFilter; Map<Long, String> searchMap = eventTableQueryFilter.getSearchFilter(); if (searchMap == null || searchMap.isEmpty()) { return null; } TmfFilterRootNode rootFilter = new TmfFilterRootNode(); for (Entry<Long, String> searchEntry : searchMap.entrySet()) { TmfFilterMatchesNode searchNode = new TmfFilterMatchesNode(rootFilter); ITmfEventAspect<?> aspect = fAspectMap.get(searchEntry.getKey()); if (aspect == null) { return null; } searchNode.setEventAspect(aspect); searchNode.setRegex(searchEntry.getValue()); } return rootFilter; } return null; }
Source:
<code>protected List<HostConfigEntry> reloadHostConfigEntries(Path path, String host, int port, String username) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadHostConfigEntries({}@{}:{}) check permissions of {}", username, host, port, path); } PosixFilePermission violation = validateStrictConfigFilePermissions(path); if (violation != null) { throw new IOException("String permission violation (" + violation + ") for " + path); } String ownerViolation = validateStrictConfigFileOwner(path); if (ownerViolation != null) { throw new IOException("String owner violation (" + ownerViolation + ") for " + path); } } <START> return super.reloadHostConfigEntries(path, host, port, username); <END> }</code><technical_language>I prefer: java if (GenericUtils.length(owner) > 0) { throw ... } assumption is is "empty" owner - if is, assume violation determine user</technical_language>

Target:
protected List<HostConfigEntry> reloadHostConfigEntries(Path path, String host, int port, String username) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadHostConfigEntries({}@{}:{}) check permissions of {}", username, host, port, path); } Pair<String, Object> violation = validateStrictConfigFilePermissions(path); if (violation != null) { throw new IOException(String.format("%s for %s", violation.getFirst(), path)); } } return super.reloadHostConfigEntries(path, host, port, username); }
Source:
<code>Image getDragSourceImage(DragSourceEvent event) { if (dragSourceImage != null) dragSourceImage.dispose(); dragSourceImage = null; NSPoint point = new NSPoint(); long ptr = OS.malloc(NSPoint.sizeof); OS.memmove(ptr, point, NSPoint.sizeof); NSEvent nsEvent = NSApplication.sharedApplication().currentEvent(); NSTableView widget = (NSTableView)control.view; NSImage nsImage = widget.dragImageForRowsWithIndexes(widget.selectedRowIndexes(), widget.tableColumns(), nsEvent, ptr); <START> if(nsImage==null) return null; <END> OS.memmove(point, ptr, NSPoint.sizeof); OS.free(ptr); Image image = Image.cocoa_new(control.getDisplay(), SWT.BITMAP, nsImage); dragSourceImage = image; nsImage.retain(); event.offsetX = (int)point.x; event.offsetY = (int)point.y; return image; }</code><technical_language>Returning null a memory leak ptr's memory freed. Also, blank spaces sides for equality check if parentheses, match SWT coding style</technical_language>

Target:
Image getDragSourceImage(DragSourceEvent event) { if (dragSourceImage != null) dragSourceImage.dispose(); dragSourceImage = null; NSPoint point = new NSPoint(); long ptr = OS.malloc(NSPoint.sizeof); OS.memmove(ptr, point, NSPoint.sizeof); NSEvent nsEvent = NSApplication.sharedApplication().currentEvent(); NSTableView widget = (NSTableView)control.view; NSImage nsImage = widget.dragImageForRowsWithIndexes(widget.selectedRowIndexes(), widget.tableColumns(), nsEvent, ptr); OS.memmove(point, ptr, NSPoint.sizeof); OS.free(ptr); if (nsImage == null) return null; Image image = Image.cocoa_new(control.getDisplay(), SWT.BITMAP, nsImage); dragSourceImage = image; nsImage.retain(); event.offsetX = (int)point.x; event.offsetY = (int)point.y; return image; }
Source:
<code>public FilesWatcher(long pollTime) { <START> watchers = new ConcurrentHashMap<>(); <END> executorPollTime = pollTime; init(); }</code><technical_language>Create ConcurrentHashMap declared instead</technical_language>

Target:
public FilesWatcher(long pollTime) { executorPollTime = pollTime; init(); }
Source:
<code>private boolean isNoNewlineAtEndOfFile(FileHeader fh) { <START> if (fh.getHunks() != null && fh.getHunks().size() > 0) { <END> HunkHeader lastHunk = fh.getHunks().get(fh.getHunks().size() - 1); RawText lhrt = new RawText(lastHunk.getBuffer()); return lhrt.getString(lhrt.size() - 1) .equals("\\ No newline at end of file"); } return false; }</code><technical_language>calling 2 times fh.getHunks().size() more times fh.getHunks(). I suggest introduce variables for fh.getHunks() fh.getHunks().size()</technical_language>

Target:
private boolean isNoNewlineAtEndOfFile(FileHeader fh) { List<? extends HunkHeader> hunks = fh.getHunks(); if (hunks == null || hunks.isEmpty()) { return false; } HunkHeader lastHunk = hunks.get(hunks.size() - 1); RawText lhrt = new RawText(lastHunk.getBuffer()); return lhrt.getString(lhrt.size() - 1) .equals("\\ No newline at end of file"); }
Source:
<code>private PrimaryKey dbTablePK(DatabaseMetaData meta, String tableName) throws SQLException { if (meta.storesUpperCaseIdentifiers()) { tableName = tableName.toUpperCase(); } else if (meta.storesLowerCaseIdentifiers()) { tableName = tableName.toLowerCase(); } ResultSet cols = meta.getPrimaryKeys(null, null, tableName); try { PrimaryKey pk = new PrimaryKey(); Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); <START> if (pk.oldNameInDb == null) { pk.oldNameInDb = cols.getString("PK_NAME"); } <END> } pk.cols = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.cols.add(name.toLowerCase(Locale.US)); } return pk; } finally { cols.close(); } }</code><technical_language>pk name for PostgreSQL dialect below, i expect, retrieve for it: if (dialect instanceof DialectPostgreSQL) { pk.oldNameInDb = cols.getString("PK_NAME"); }</technical_language>

Target:
private PrimaryKey dbTablePK(DatabaseMetaData meta, String tableName) throws SQLException { if (meta.storesUpperCaseIdentifiers()) { tableName = tableName.toUpperCase(); } else if (meta.storesLowerCaseIdentifiers()) { tableName = tableName.toLowerCase(); } ResultSet cols = meta.getPrimaryKeys(null, null, tableName); try { PrimaryKey pk = new PrimaryKey(); Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); if (dialect instanceof DialectPostgreSQL && pk.oldNameInDb == null) { pk.oldNameInDb = cols.getString("PK_NAME"); } } pk.cols = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.cols.add(name.toLowerCase(Locale.US)); } return pk; } finally { cols.close(); } }
Source:
<code>private void validateRoutingTypes(SimpleString addressName, Collection<RoutingType> routingTypes) { final Bindings bindings = this.mappings.get(addressName); if (bindings != null) { for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { final QueueBinding queueBinding = (QueueBinding) binding; final RoutingType routingType = queueBinding.getQueue().getRoutingType(); <START> System.out.println("got a queue binding........... " + queueBinding.getQueue().getName() + " rt: " + routingType); <END> if (!routingTypes.contains(routingType) && binding.getAddress().equals(addressName)) { throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeDelete(routingType, addressName.toString()); } } } } }</code><technical_language>removed</technical_language>

Target:
private void validateRoutingTypes(SimpleString addressName, Collection<RoutingType> routingTypes) { final Bindings bindings = this.mappings.get(addressName); if (bindings != null) { for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { final QueueBinding queueBinding = (QueueBinding) binding; final RoutingType routingType = queueBinding.getQueue().getRoutingType(); if (!routingTypes.contains(routingType) && binding.getAddress().equals(addressName)) { throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeDelete(routingType, addressName.toString()); } } } } }