auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void performDefaults() { for (int i= 0; i < fCheckBoxes.size(); i++) { Button button= fCheckBoxes.get(i); String key= (String) button.getData(); IPreferenceStore <START> nextStore = <END> (IPreferenceStore) button.getData(PREFERENCE_STORE_KEY); button.setSelection(nextStore.getDefaultBoolean(key)); } IPreferenceStore store= getPreferenceStore(); for (int i= 0; i < fRadioButtons.size(); i++) { Button button= fRadioButtons.get(i); String[] info= (String[]) button.getData(); button.setSelection(info[1].equals(store.getDefaultString(info[0]))); } for (int i= 0; i < fTextControls.size(); i++) { Text text= fTextControls.get(i); String key= (String) text.getData(); text.setText(store.getDefaultString(key)); } super.performDefaults(); }</code><technical_language>"next"</technical_language>

Target:
protected void performDefaults() { for (int i= 0; i < fCheckBoxes.size(); i++) { Button button= fCheckBoxes.get(i); String key= (String) button.getData(); IPreferenceStore buttonPreferenceStore = (IPreferenceStore) button.getData(PREFERENCE_STORE_KEY); button.setSelection(buttonPreferenceStore.getDefaultBoolean(key)); } IPreferenceStore store= getPreferenceStore(); for (int i= 0; i < fRadioButtons.size(); i++) { Button button= fRadioButtons.get(i); String[] info= (String[]) button.getData(); button.setSelection(info[1].equals(store.getDefaultString(info[0]))); } for (int i= 0; i < fTextControls.size(); i++) { Text text= fTextControls.get(i); String key= (String) text.getData(); text.setText(store.getDefaultString(key)); } super.performDefaults(); }
Source:
<code>public void copyPortGroupsFromHost(HostMO srcHost) throws Exception { if (srcHost == null) { return; } List<HostPortGroupSpec> portGroupSpecs = srcHost.getHostPortGroupSpecs(); <START> if (portGroupSpecs == null || portGroupSpecs.isEmpty()) { <END> s_logger.debug("No port groups in the host: " + srcHost.getName()); return; } for (HostPortGroupSpec spec : portGroupSpecs) { s_logger.debug("Creating port group: " + spec.getName() + " in the host: " + getName()); createPortGroup(spec); } }</code><technical_language>@sureshanaparti, please CollectionUtils.isEmpty? checks if List is empty, returning true in case of null. (<LINK_0> Thanks</technical_language>

Target:
public void copyPortGroupsFromHost(HostMO srcHost) throws Exception { if (srcHost == null) { return; } List<HostPortGroupSpec> portGroupSpecs = srcHost.getHostPortGroupSpecs(); if (CollectionUtils.isEmpty(portGroupSpecs)) { s_logger.debug("No port groups in the host: " + srcHost.getName()); return; } for (HostPortGroupSpec spec : portGroupSpecs) { s_logger.debug("Creating port group: " + spec.getName() + " in the host: " + getName()); createPortGroup(spec); } }
Source:
<code>private void validateFieldStatus(Path.PathElement currentElement) { String currentField = currentElement.getFieldName(); Class<?> currentClass = currentElement.getType(); if (schema.getMetrics().stream().anyMatch(m -> m.getName().contains(currentField))) { if (metricMap.keySet().stream().noneMatch(m -> m.getName().equals(currentField))) { throw new InvalidOperationException("Can't sort on metric that is not present in query"); } } <START> if (dictionary.getIdFieldName(currentClass).equals(currentField)) { <END> throw new InvalidOperationException("Sorting on id field is not permitted"); } }</code><technical_language>reject query for field name **id** is a reserved keyword for id fields</technical_language>

Target:
private void validateFieldStatus(Path.PathElement currentElement) { String currentField = currentElement.getFieldName(); Class<?> currentClass = currentElement.getType(); if (schema.getMetrics().stream().anyMatch(m -> m.getName().contains(currentField))) { if (metricMap.keySet().stream().noneMatch(m -> m.getName().equals(currentField))) { throw new InvalidOperationException("Can't sort on metric that is not present in query"); } } if (dictionary.getIdFieldName(currentClass).equals(currentField) || currentField.equals("id")) { throw new InvalidOperationException("Sorting on id field is not permitted"); } }
Source:
<code>private CallInformation(Tuple actualParameters, PQuery referredQuery, final Set<Integer> bindings, Map<PVariable, Integer> variableMapping) { this.referredQuery = referredQuery; int keySize = actualParameters.getSize(); <START> int[] parameterMaskIndeces = new int[keySize]; <END> for (int i = 0; i < keySize; i++) { PParameter symbolicParameter = referredQuery.getParameters().get(i); PVariable parameter = (PVariable) actualParameters.get(i); mapping.put(symbolicParameter, variableMapping.get(parameter)); parameterMaskIndeces[i] = variableMapping.get(parameter); if (bindings.contains(variableMapping.get(parameter))) { adornment.add(symbolicParameter); } } frameMask = TupleMask.fromSelectedIndices(bindings.size(), parameterMaskIndeces); boundParameterIndices = new int[adornment.size()]; int boundIndex = 0; freeParameterIndices = new int[keySize - adornment.size()]; int freeIndex = 0; for (int i = 0; i < keySize; i++) { if (bindings.contains(variableMapping.get(actualParameters.get(i)))) { boundParameterIndices[boundIndex] = i; boundIndex++; } else { freeParameterIndices[freeIndex] = i; freeIndex++; } } parameterMask = TupleMask.fromSelectedIndices(keySize, boundParameterIndices); matcherReference = new MatcherReference(referredQuery, adornment); }</code><technical_language>indices, indeces</technical_language>

Target:
private CallInformation(Tuple actualParameters, PQuery referredQuery, final Set<Integer> bindings, Map<PVariable, Integer> variableMapping) { this.referredQuery = referredQuery; int keySize = actualParameters.getSize(); List<Integer> parameterMaskIndices = new ArrayList<>(); int[] fullParameterMaskIndices = new int[keySize]; for (int i = 0; i < keySize; i++) { PParameter symbolicParameter = referredQuery.getParameters().get(i); PVariable parameter = (PVariable) actualParameters.get(i); Integer originalFrameIndex = variableMapping.get(parameter); mapping.put(symbolicParameter, originalFrameIndex); fullParameterMaskIndices[i] = originalFrameIndex; if (bindings.contains(originalFrameIndex)) { parameterMaskIndices.add(originalFrameIndex); adornment.add(symbolicParameter); } } thinFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), parameterMaskIndices); fullFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), fullParameterMaskIndices); int[] boundParameterIndices = new int[adornment.size()]; int boundIndex = 0; freeParameterIndices = new int[keySize - adornment.size()]; int freeIndex = 0; for (int i = 0; i < keySize; i++) { if (bindings.contains(variableMapping.get(actualParameters.get(i)))) { boundParameterIndices[boundIndex] = i; boundIndex++; } else { freeParameterIndices[freeIndex] = i; freeIndex++; } } parameterMask = TupleMask.fromSelectedIndices(thinFrameMask.getSize(), boundParameterIndices); matcherReference = new MatcherReference(referredQuery, adornment); }
Source:
<code>public java.lang.Boolean executeAction() throws Exception { this.destination = __destination == null ? null : system.proxies.FileDocument.initialize(getContext(), __destination); <START> StringUtils.stringToFile(getContext(), value, destination, encoding); <END> return true; END USER CODE }</code><technical_language>Here, do Charset.forName(encoding) trick</technical_language>

Target:
public java.lang.Boolean executeAction() throws Exception { this.destination = __destination == null ? null : system.proxies.FileDocument.initialize(getContext(), __destination); Charset charset = StandardCharsets.UTF_8; if (this.encoding != null) charset = Charset.forName(this.encoding.name().replace('_', '-')); StringUtils.stringToFile(getContext(), value, destination, charset); return true; END USER CODE }
Source:
<code><START> public static void removeFile(String sourceFile) throws IOException { <END> File file = new File(sourceFile); if (file.delete()) { LOGGER.log(Level.INFO, file.getName() + " is deleted!"); } else { LOGGER.log(Level.WARNING, file.getName() + "deletion is failed."); } }</code><technical_language>nitpick: this class public method: upgradeStorageConfig</technical_language>

Target:
private static void removeFile(String sourceFile) throws IOException { File file = new File(sourceFile); if (file.delete()) { LOGGER.log(Level.INFO, file.getName() + " is deleted!"); } else { LOGGER.log(Level.WARNING, file.getName() + "deletion is failed."); } }
Source:
<code>public Boolean doNotThrowAnyException(boolean bo) { class ClassWithBooleanField { Boolean b; } ClassWithBooleanField objWithBooleanField = new ClassWithBooleanField(); Boolean aBoolean = Boolean.TRUE; <START> return bo ? objWithBooleanField.b : aBoolean; <END> }</code><technical_language>Please change code match is replaced. I wanted exception thrown here</technical_language>

Target:
public Boolean doNotThrowAnyException(boolean bo) { class ClassWithBooleanField { Boolean b; } ClassWithBooleanField objWithBooleanField = new ClassWithBooleanField(); return bo ? objWithBooleanField.b : Boolean.TRUE; }
Source:
<code>public void should_fail_if_one_entry_does_not_satisfy_the_given_requirements() { AssertionError error = expectAssertionError(() -> maps.assertAllSatisfy(someInfo(), greatPlayers, (team, player) -> { assertThat(team).isIn("Lakers", "Bulls", "Spurs"); assertThat(player.getPointsPerGame()).as("%s %s ppg", player.getName().first, player.getName().getLast()) .isGreaterThanOrEqualTo(30); })); <START> assertThat(error).isNotNull(); <END> assertThat(error).hasMessage(elementsShouldSatisfy(greatPlayers, list(failOnPpg("Spurs", duncan, 30), failOnPpg("Lakers", magic, 30))).create()); }</code><technical_language>removed expectAssertionError checks</technical_language>

Target:
public void should_fail_if_one_entry_does_not_satisfy_the_given_requirements() { AssertionError error = expectAssertionError(() -> maps.assertAllSatisfy(someInfo(), greatPlayers, (team, player) -> { assertThat(team).isIn("Lakers", "Bulls", "Spurs"); assertThat(player.getPointsPerGame()).as("%s %s ppg", player.getName().first, player.getName().getLast()) .isLessThan(30); })); assertThat(error).hasMessage(elementsShouldSatisfy(greatPlayers, list(failOnPpgLessThan("Bulls", jordan, 30))).create()); }
Source:
<code>protected Object getHandlerInternal(HttpServletRequest request) throws Exception { BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext(); if (context != null && context.getRequestURIWithoutContext() != null) { String requestUri = URLDecoder.decode(context.getRequestURIWithoutContext(), charEncoding); Boolean internalValidateFindPreviouslySet = false; PageDTO page; try { if (!BroadleafRequestContext.getBroadleafRequestContext().getInternalValidateFind()) { BroadleafRequestContext.getBroadleafRequestContext().setInternalValidateFind(true); internalValidateFindPreviouslySet = true; } page = pageService.findPageByURI(context.getLocale(), requestUri, buildMvelParameters(request), context.isSecure()); } finally { if (internalValidateFindPreviouslySet) { <START> BroadleafRequestContext.getBroadleafRequestContext().setInternalValidateFind(true); <END> } } if (page != null && ! (page instanceof NullPageDTO)) { context.getRequest().setAttribute(PAGE_ATTRIBUTE_NAME, page); return controllerName; } } return null; }</code><technical_language>methinks this false true</technical_language>

Target:
protected Object getHandlerInternal(HttpServletRequest request) throws Exception { BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext(); if (context != null && context.getRequestURIWithoutContext() != null) { String requestUri = URLDecoder.decode(context.getRequestURIWithoutContext(), charEncoding); Boolean internalValidateFindPreviouslySet = false; PageDTO page; try { if (!BroadleafRequestContext.getBroadleafRequestContext().getInternalValidateFind()) { BroadleafRequestContext.getBroadleafRequestContext().setInternalValidateFind(true); internalValidateFindPreviouslySet = true; } page = pageService.findPageByURI(context.getLocale(), requestUri, buildMvelParameters(request), context.isSecure()); } finally { if (internalValidateFindPreviouslySet) { BroadleafRequestContext.getBroadleafRequestContext().setInternalValidateFind(false); } } if (page != null && ! (page instanceof NullPageDTO)) { context.getRequest().setAttribute(PAGE_ATTRIBUTE_NAME, page); return controllerName; } } return null; }
Source:
<code>public void apply(OnlineCommandContext ctx) throws Exception { Operations ops = new Operations(ctx.client); Address address = Address.subsystem("resource-adapters").and("resource-adapter", id); ops.add(address, Values.of("transaction-support", transactions).and("module", module)); <START> <END> }</code><technical_language>Empty lines..</technical_language>

Target:
public void apply(OnlineCommandContext ctx) throws Exception { Operations ops = new Operations(ctx.client); Address address = Address.subsystem("resource-adapters").and("resource-adapter", id); ops.add(address, Values.of("transaction-support", transactions).and("module", module).and("slot", "main")); }
Source:
<code>public void replaceNodeName() throws Exception { final String replacement = "replacement"; Document document = DOMParserUtil.getDocument(XML); DOMParserUtil.replaceNodeName(document, MAIN_NODE, TEST_NODE, replacement); final Map<Node, List<Node>> retrieved = DOMParserUtil.getChildrenNodesMap(document, MAIN_NODE, replacement); assertNotNull(retrieved); assertEquals(1, retrieved.size()); List<Node> testNodes = retrieved.values().iterator().next(); assertNotNull(testNodes); <START> assertEquals(1, testNodes.size()); <END> }</code><technical_language>miss assertion retrieved node name is "replacement"</technical_language>

Target:
public void replaceNodeName() throws Exception { final String replacement = "replacement"; Document document = DOMParserUtil.getDocument(XML); DOMParserUtil.replaceNodeName(document, MAIN_NODE, TEST_NODE, replacement); final Map<Node, List<Node>> retrieved = DOMParserUtil.getChildrenNodesMap(document, MAIN_NODE, replacement); assertNotNull(retrieved); assertEquals(1, retrieved.size()); List<Node> testNodes = retrieved.values().iterator().next(); assertNotNull(testNodes); assertEquals(1, testNodes.size()); assertEquals("replacement", testNodes.get(0).getNodeName()); }
Source:
<code><START> public static ElasticsearchConnection getConnection() throws Exception { <END> ElasticsearchContainerHolder.loadContainer = 1; ElasticsearchConnection elasticsearchConnection = new ElasticsearchConnection( ElasticsearchContainerHolder.getElasticsearchConfig()); elasticsearchConnection.start(); return elasticsearchConnection; }</code><technical_language>this synchronized, in case</technical_language>

Target:
public static synchronized ElasticsearchConnection getConnection() throws Exception { ElasticsearchContainerHolder.containerLoaded = true; ElasticsearchConnection elasticsearchConnection = new ElasticsearchConnection( ElasticsearchContainerHolder.getElasticsearchConfig()); elasticsearchConnection.start(); return elasticsearchConnection; }
Source:
<code>public void testRollingRestartWithoutMembershipChange() throws Exception { int serverCount = 3; String config = generateNewQuorumConfig(serverCount); List<String> joiningServers = new ArrayList<>(); List<String> leavingServers = new ArrayList<>(); QuorumPeerTestBase.MainThread mt[] = new QuorumPeerTestBase.MainThread[serverCount]; for (int i = 0; i < serverCount; ++i) { mt[i] = new QuorumPeerTestBase.MainThread(i, clientPorts.get(i), config, false); mt[i].start(); joiningServers.add(serverAddress.get(i)); } for (int i = 0; i < serverCount; ++i) { Assert.assertTrue("waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts.get(i), CONNECTION_TIMEOUT)); } for (int i = 0; i < serverCount; ++i) { mt[i].shutdown(); mt[i].start(); <START> verifyQuorumConfig(i, joiningServers, leavingServers); <END> verifyQuorumMembers(mt[i]); } for (int i = 0; i < serverCount; i++) { mt[i].shutdown(); } }</code><technical_language>remove leavingServers variable pass null here. in other test</technical_language>

Target:
public void testRollingRestartWithoutMembershipChange() throws Exception { int serverCount = 3; String config = generateNewQuorumConfig(serverCount); List<String> joiningServers = new ArrayList<>(); QuorumPeerTestBase.MainThread mt[] = new QuorumPeerTestBase.MainThread[serverCount]; for (int i = 0; i < serverCount; ++i) { mt[i] = new QuorumPeerTestBase.MainThread(i, clientPorts.get(i), config, false); mt[i].start(); joiningServers.add(serverAddress.get(i)); } for (int i = 0; i < serverCount; ++i) { Assert.assertTrue("waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts.get(i), CONNECTION_TIMEOUT)); } for (int i = 0; i < serverCount; ++i) { mt[i].shutdown(); mt[i].start(); verifyQuorumConfig(i, joiningServers, null); verifyQuorumMembers(mt[i]); } for (int i = 0; i < serverCount; i++) { mt[i].shutdown(); } }
Source:
<code>private void initSqlTypes() { logger.debug("JDBC::initSqlTypes: Initialize the type array"); sqlTypes.put("CALLITEM", "VARCHAR(200)"); sqlTypes.put("COLORITEM", "VARCHAR(70)"); sqlTypes.put("CONTACTITEM", "VARCHAR(6)"); <START> sqlTypes.put("DATETIMEITEM", "TIMESTAMP"); <END> sqlTypes.put("DIMMERITEM", "TINYINT"); sqlTypes.put("LOCATIONITEM", "VARCHAR(30)"); sqlTypes.put("NUMBERITEM", "DOUBLE"); sqlTypes.put("ROLLERSHUTTERITEM", "TINYINT"); sqlTypes.put("STRINGITEM", "VARCHAR(65500)"); sqlTypes.put("SWITCHITEM", "VARCHAR(6)"); sqlTypes.put("TABLEPRIMARYKEY", "TIMESTAMP"); sqlTypes.put("TABLEPRIMARYVALUE", "NOW()"); }</code><technical_language>change default SQL type for DateTime items in this PR</technical_language>

Target:
private void initSqlTypes() { logger.debug("JDBC::initSqlTypes: Initialize the type array"); sqlTypes.put("CALLITEM", "VARCHAR(200)"); sqlTypes.put("COLORITEM", "VARCHAR(70)"); sqlTypes.put("CONTACTITEM", "VARCHAR(6)"); sqlTypes.put("DATETIMEITEM", "TIMESTAMP"); sqlTypes.put("DIMMERITEM", "TINYINT"); sqlTypes.put("LOCATIONITEM", "VARCHAR(30)"); sqlTypes.put("NUMBERITEM", "DOUBLE"); sqlTypes.put("ROLLERSHUTTERITEM", "TINYINT"); sqlTypes.put("STRINGITEM", "VARCHAR(65500)"); sqlTypes.put("SWITCHITEM", "VARCHAR(6)"); sqlTypes.put("tablePrimaryKey", "TIMESTAMP"); sqlTypes.put("tablePrimaryValue", "NOW()"); }
Source:
<code>public void testGetExecutorPoolSize() { <START> System.out.println("getExecutorPoolSize"); <END> int expResult = 100; int result = instance.getExecutorPoolSize(); assertEquals(expResult, result); }</code><technical_language>Optional: replace System out LOG statements</technical_language>

Target:
public void testGetExecutorPoolSize() { int expResult = 100; int result = instance.getExecutorPoolSize(); assertEquals(expResult, result); }
Source:
<code>private void indexURLs(URL url) { try { if (!"file".equals(url.getProtocol())) { throw new RuntimeException("Classpath element is not a file: " + url); } File root = new File(url.getPath()); URL[] args = {url}; URLClassPath delegate = new URLClassPath(args); if (root.isDirectory()) { String rootPath = root.getPath(); if (!rootPath.endsWith(File.separator)) { rootPath = rootPath + File.separator; } <START> addFilesToIndex(rootPath.length(), root, delegate); <END> } else if (root.isFile() && root.getName().endsWith(".jar")) { JarFile jarFile = new JarFile(root); try { Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); maybeIndexResource(name, delegate); } } finally { jarFile.close(); } } } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>Whats urlclasspath definition for file archive? In .zip accepted. Years check urlclassloader</technical_language>

Target:
private void indexURLs(URL url) { try { if (!"file".equals(url.getProtocol())) { throw new RuntimeException("Classpath element is not a file: " + url); } File root = new File(url.getPath()); if (root.isDirectory()) { String rootPath = root.getPath(); if (!rootPath.endsWith(File.separator)) { rootPath = rootPath + File.separator; } addFilesToIndex(rootPath.length(), root, url); } else if (root.isFile() && root.getName().endsWith(".jar")) { JarFile jarFile = new JarFile(root); try { Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); maybeIndexResource(name, url); } } finally { jarFile.close(); } } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public void setMergeState(MergeInfo info, MergeState state) throws KeeperException, InterruptedException { synchronized (mergeLock) { String path = getZooKeeperRoot() + Constants.ZTABLES + "/" + info.getExtent().getTableId() + "/merge"; info.setState(state); if (state.equals(MergeState.NONE)) { context.getZooReaderWriter().recursiveDelete(path, NodeMissingPolicy.SKIP); } else { DataOutputBuffer out = new DataOutputBuffer(); try { info.write(out); } catch (IOException ex) { <START> throw new UncheckedIOException("Unlikely", ex); <END> } context.getZooReaderWriter().putPersistentData(path, out.getData(), state.equals(MergeState.STARTED) ? ZooUtil.NodeExistsPolicy.FAIL : ZooUtil.NodeExistsPolicy.OVERWRITE); } mergeLock.notifyAll(); } nextEvent.event("Merge state of %s set to %s", info.getExtent(), state); }</code><technical_language>this is impossible, based implementation. If so, this AssertionError, represents programmer's assertion of possible, assumption code is written correctly</technical_language>

Target:
public void setMergeState(MergeInfo info, MergeState state) throws KeeperException, InterruptedException { synchronized (mergeLock) { String path = getZooKeeperRoot() + Constants.ZTABLES + "/" + info.getExtent().getTableId() + "/merge"; info.setState(state); if (state.equals(MergeState.NONE)) { context.getZooReaderWriter().recursiveDelete(path, NodeMissingPolicy.SKIP); } else { DataOutputBuffer out = new DataOutputBuffer(); try { info.write(out); } catch (IOException ex) { throw new AssertionError("Unlikely", ex); } context.getZooReaderWriter().putPersistentData(path, out.getData(), state.equals(MergeState.STARTED) ? ZooUtil.NodeExistsPolicy.FAIL : ZooUtil.NodeExistsPolicy.OVERWRITE); } mergeLock.notifyAll(); } nextEvent.event("Merge state of %s set to %s", info.getExtent(), state); }
Source:
<code>public synchronized void pingServerIfNecessary() { final int DELTA = 1000; final int TRIES = 3; final XMPPConnection connection = connection(); if (connection == null) { return; } if (pingInterval <= 0) { return; } <START> <END> if (connection.isAuthenticated()) { boolean res = false; for (int i = 0; i < TRIES; i++) { { long lastStanzaReceived = connection.getLastStanzaReceived(); if (lastStanzaReceived > 0) { long now = System.currentTimeMillis(); int deltaInSeconds = (int) ((now - lastStanzaReceived) / 1000); if (deltaInSeconds < pingInterval) { maybeSchedulePingServerTask(deltaInSeconds); return; } } } if (i != 0) { try { Thread.sleep(DELTA); } catch (InterruptedException e) { return; } } try { res = pingMyServer(false); } catch (InterruptedException | SmackException e) { LOGGER.log(Level.WARNING, "Exception while pinging server of " + connection, e); res = false; } if (res) { break; } } if (!res) { for (PingFailedListener l : pingFailedListeners) { l.pingFailed(); } } else { maybeSchedulePingServerTask(); } } else { LOGGER.warning("XMPPConnection was not authenticated"); } }</code><technical_language>This line whitespace symbols</technical_language>

Target:
public void pingServerIfNecessary() { final XMPPConnection connection = connection(); if (connection == null) { return; } if (pingInterval <= 0) { return; } long lastStanzaReceived = connection.getLastStanzaReceived(); if (lastStanzaReceived > 0) { long now = System.currentTimeMillis(); int deltaInSeconds = (int) ((now - lastStanzaReceived) / 1000); if (deltaInSeconds < pingInterval) { maybeSchedulePingServerTask(deltaInSeconds); return; } } if (!connection.isAuthenticated()) { LOGGER.warning(connection + " was not authenticated"); return; } final long minimumTimeout = TimeUnit.MINUTES.toMillis(2); final long connectionReplyTimeout = connection.getReplyTimeout(); final long timeout = connectionReplyTimeout > minimumTimeout ? connectionReplyTimeout : minimumTimeout; SmackFuture<Boolean, Exception> pingFuture = pingAsync(connection.getXMPPServiceDomain(), timeout); pingFuture.onSuccess(new SuccessCallback<Boolean>() { @Override public void onSuccess(Boolean result) { maybeSchedulePingServerTask(); } }); pingFuture.onError(new ExceptionCallback<Exception>() { @Override public void processException(Exception exception) { long lastStanzaReceived = connection.getLastStanzaReceived(); if (lastStanzaReceived > 0) { long now = System.currentTimeMillis(); int deltaInSeconds = (int) ((now - lastStanzaReceived) / 1000); if (deltaInSeconds < pingInterval) { maybeSchedulePingServerTask(deltaInSeconds); return; } } for (PingFailedListener l : pingFailedListeners) { l.pingFailed(); } } }); }
Source:
<code>public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 2) { <START> throw new IllegalArgumentException("function '" + name() + "' needs 2 argument"); <END> } Expr expr1 = args.get(0); Expr expr2 = args.get(1); return eval(expr1.eval(bindings), expr2.eval(bindings)); }</code><technical_language>'needs 2 _arguments_', plural</technical_language>

Target:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 2) { throw new IAE("function '%s' needs 2 arguments", name()); } Expr expr1 = args.get(0); Expr expr2 = args.get(1); return eval(expr1.eval(bindings), expr2.eval(bindings)); }
Source:
<code>public void doSave(IProgressMonitor monitor) { commitPages(true); <START> genericEditor.doSave(monitor); <END> try { fInputHandler.saveTargetDefinition(); } catch (CoreException e) { PDEPlugin.log(e); showError(PDEUIMessages.TargetEditor_3, e); } }</code><technical_language>next line is fInputHandler.save(...) text model synchronized, is a need save textual editor well</technical_language>

Target:
public void doSave(IProgressMonitor monitor) { fInputHandler.setSaving(true); if (getActivePage() != getPageCount() - 1) { updateTargetDocumentEditor(); } fEditor.doSave(monitor); fDirty = false; editorDirtyStateChanged(); fInputHandler.setSaving(false); }
Source:
<code>public void checkCategories(Set<ProductItemCategory> categories) { for (ProductItemCategory category : categories) { assert category.getId() > 0 : category; assert category.getName() != null : category; <START> assert category.getCategoryCode() != null : category; <END> } }</code><technical_language>assert</technical_language>

Target:
public void checkCategories(Set<ProductItemCategory> categories) { for (ProductItemCategory category : categories) { assertTrue(category.getId() > 0, "category id must be more than 0"); assertNotNull(category.getName(), "category name must be not null"); assertNotNull(category.getCategoryCode(), "category code must be not null"); } }
Source:
<code>public void waitUntilAllTasksFinish() { drainExecutor.shutdown(); try { if (!drainExecutor.awaitTermination(TERMINATION_WAIT_TIME.getSeconds(), TimeUnit.SECONDS)) { <START> drainExecutor.shutdownNow(); <END> } } catch (InterruptedException ex) { drainExecutor.shutdownNow(); log.error("Encounter interruption exception when is await termination", drainExecutor, ex); throw new UnrecoverableCorfuInterruptedError(ex); } }</code><technical_language>put ShutdownNow() finally block</technical_language>

Target:
public void waitUntilAllTasksFinish() { while (getGarbageReceivingQueue().size() > 0) { gcUnsafe(); } drainExecutor.shutdown(); try { drainExecutor.awaitTermination(TERMINATION_WAIT_TIME.getSeconds(), TimeUnit.SECONDS); } catch (InterruptedException ex) { log.error("Encounter interruption exception when is await termination", drainExecutor, ex); throw new UnrecoverableCorfuInterruptedError(ex); } finally { drainExecutor.shutdownNow(); } }
Source:
<code>private static void addModuleTasks(@NotNull DataNode<ModuleData> moduleInfo, @NotNull IdeaModule module, @NotNull DataNode<ProjectData> projectInfo) { String rootProjectPath = projectInfo.getData().getLinkedExternalProjectPath(); String moduleConfigPath = GradleUtil.getConfigPath(module.getGradleProject(), rootProjectPath); DataNode<?> target = moduleConfigPath.equals(rootProjectPath) ? projectInfo : moduleInfo; for (GradleTask task : module.getGradleProject().getTasks()) { String taskName = task.getName(); <START> if (taskName == null || taskName.trim().isEmpty() || taskName.toLowerCase().contains("idea")) { <END> continue; } TaskData taskData = new TaskData(GradleConstants.SYSTEM_ID, taskName, moduleConfigPath, task.getDescription()); target.createChild(ProjectKeys.TASK, taskData); } }</code><technical_language>some examples of task names ignored? Contains "idea" (any capitalization) match unintended stuff, "semidead" "mideast" :-)</technical_language>

Target:
private static void addModuleTasks(@NotNull DataNode<ModuleData> moduleInfo, @NotNull IdeaModule module, @NotNull DataNode<ProjectData> projectInfo) { String rootProjectPath = projectInfo.getData().getLinkedExternalProjectPath(); String moduleConfigPath = GradleUtil.getConfigPath(module.getGradleProject(), rootProjectPath); DataNode<?> target = moduleConfigPath.equals(rootProjectPath) ? projectInfo : moduleInfo; for (GradleTask task : module.getGradleProject().getTasks()) { String taskName = task.getName(); if (taskName == null || taskName.trim().isEmpty() || taskName.startsWith("idea") || taskName.endsWith("Idea")) { continue; } TaskData taskData = new TaskData(GradleConstants.SYSTEM_ID, taskName, moduleConfigPath, task.getDescription()); target.createChild(ProjectKeys.TASK, taskData); } }
Source:
<code>public synchronized void setContainerAccess(String container, ContainerAccess access) { Path path = new File(buildPathStartingFromBaseDir(container)).toPath(); if ( System.getProperty("os.name", "").toLowerCase().contains("windows") ) { UserPrincipal everyone = null; UserPrincipal me = null; try { everyone = getDefault().getUserPrincipalLookupService() .lookupPrincipalByName("Everyone"); } catch (IOException e) { <START> e.printStackTrace(); <END> return; } AclFileAttributeView aclFileAttributes = java.nio.file.Files.getFileAttributeView( path, AclFileAttributeView.class); try { if (access == ContainerAccess.PRIVATE) { CopyOnWriteArrayList<AclEntry> aclList = new CopyOnWriteArrayList(aclFileAttributes.getAcl()); for (AclEntry aclEntry : aclList) { if (aclEntry.principal().equals(everyone) && aclEntry.type().equals(AclEntryType.ALLOW)) { aclList.remove(aclEntry); } } aclFileAttributes.setAcl(aclList); } else { List<AclEntry> list = aclFileAttributes.getAcl(); list.add(AclEntry.newBuilder().setPrincipal(everyone).setPermissions( AclEntryPermission.READ_DATA, AclEntryPermission.READ_ACL, AclEntryPermission.READ_ATTRIBUTES, AclEntryPermission.READ_NAMED_ATTRS) .setType(AclEntryType.ALLOW) .build()); aclFileAttributes.setAcl(list); } } catch (IOException e) { e.printStackTrace(); return; } } else { Set<PosixFilePermission> permissions; try { permissions = getPosixFilePermissions(path); if (access == ContainerAccess.PRIVATE) { permissions.remove(PosixFilePermission.OTHERS_READ); } else if (access == ContainerAccess.PUBLIC_READ) { permissions.add(PosixFilePermission.OTHERS_READ); } setPosixFilePermissions(path, permissions); } catch (IOException ioe) { throw Throwables.propagate(ioe); } } }</code><technical_language>a logger remove this</technical_language>

Target:
public void setContainerAccess(String container, ContainerAccess access) { Path path = new File(buildPathStartingFromBaseDir(container)).toPath(); if ( isWindows() ) { try { if (access == ContainerAccess.PRIVATE) { setPrivate(path); } else { setPublic(path); } } catch (IOException e) { throw new RuntimeException(e); } } else { Set<PosixFilePermission> permissions; try { permissions = getPosixFilePermissions(path); if (access == ContainerAccess.PRIVATE) { permissions.remove(PosixFilePermission.OTHERS_READ); } else if (access == ContainerAccess.PUBLIC_READ) { permissions.add(PosixFilePermission.OTHERS_READ); } setPosixFilePermissions(path, permissions); } catch (IOException ioe) { throw Throwables.propagate(ioe); } } }
Source:
<code>public List<HarmonizationDataset> findAllDatasetsByHarmonizationStudy(@NotNull String studyId) { <START> Assert.isTrue(!Strings.isNullOrEmpty("Harmonization Study ID cannot be null or empty")); <END> return harmonizationDatasetRepository.findByHarmonizationTableStudyId(studyId); }</code><technical_language>Euh ... do test if "Harmonization Study ID null empty" is null empty ? test code ? ..</technical_language>

Target:
public List<HarmonizationDataset> findAllDatasetsByHarmonizationStudy(@NotNull String studyId) { Assert.isTrue(!Strings.isNullOrEmpty(studyId), "Harmonization Study ID cannot be null or empty"); return harmonizationDatasetRepository.findByHarmonizationTableStudyId(studyId); }
Source:
<code><START> protected void beforeExecute(Thread t, Runnable r) { <END> try { executingListener.beforeExecute(r); } finally { } super.beforeExecute(t, r); inProgress.put(r, Boolean.TRUE); startTime.set(new Long(System.currentTimeMillis())); }</code><technical_language>Add @Override. afterExecute</technical_language>

Target:
protected void beforeExecute(Thread t, Runnable r) { try { executingListener.beforeExecute(r); } catch (Throwable e) { logger.warn("Listener threw exception", e); } super.beforeExecute(t, r); inProgress.put(r, Boolean.TRUE); startTime.set(new Long(System.currentTimeMillis())); }
Source:
<code>public CRBuildTask buildTaskToCRBuildTask(BuildTask buildTask) { CRBuildTask crBuildTask; if (buildTask instanceof RakeTask) { <START> RakeTask rake = (RakeTask) buildTask; <END> crBuildTask = CRBuildTask.rake(); } else if (buildTask instanceof AntTask) { crBuildTask = CRBuildTask.ant(); } else if (buildTask instanceof NantTask) { crBuildTask = CRBuildTask.nant(((NantTask) buildTask).getNantPath()); } else { throw new RuntimeException( String.format("unknown type of build task '%s'", buildTask)); } crBuildTask.setBuild_file(buildTask.getBuildFile()); crBuildTask.setTarget(buildTask.getTarget()); crBuildTask.setWorking_directory(buildTask.workingDirectory()); commonCRTaskMembers(crBuildTask, buildTask); return crBuildTask; }</code><technical_language>This line/var is unused</technical_language>

Target:
private CRBuildTask buildTaskToCRBuildTask(BuildTask buildTask) { CRBuildTask crBuildTask; if (buildTask instanceof RakeTask) { crBuildTask = CRBuildTask.rake(); } else if (buildTask instanceof AntTask) { crBuildTask = CRBuildTask.ant(); } else if (buildTask instanceof NantTask) { crBuildTask = CRBuildTask.nant(((NantTask) buildTask).getNantPath()); } else { throw new RuntimeException( String.format("unknown type of build task '%s'", buildTask)); } crBuildTask.setBuild_file(buildTask.getBuildFile()); crBuildTask.setTarget(buildTask.getTarget()); crBuildTask.setWorking_directory(buildTask.workingDirectory()); commonCRTaskMembers(crBuildTask, buildTask); return crBuildTask; }
Source:
<code>private Version readProductVersionRecord(DataInput dis, File f) throws IOException { short ver = VersioningIO.readOrdinal(dis); final Version recoveredGFVersion = Versioning.getKnownVersion( <START> Versioning.getVersionOrdinal(ver), null); <END> if (recoveredGFVersion == null) { throw new DiskAccessException( String.format("Unknown version ordinal %s found when recovering Oplogs", ver), getParent()); } if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY_VERBOSE)) { logger.trace(LogMarker.PERSIST_RECOVERY_VERBOSE, "version={}", recoveredGFVersion); } readEndOfRecord(dis); return recoveredGFVersion; }</code><technical_language>this pattern a lot. Versioning.getVersionOrdinal() is possibly create unknown version object getKnownVersion() is throw away. Is a do this w/o creating object? Versioning.getKnownVersion(short, default)</technical_language>

Target:
private Version readProductVersionRecord(DataInput dis, File f) throws IOException { short ver = VersioningIO.readOrdinal(dis); final Version recoveredGFVersion = Versioning.getKnownVersionOrDefault( Versioning.getVersionOrdinal(ver), null); if (recoveredGFVersion == null) { throw new DiskAccessException( String.format("Unknown version ordinal %s found when recovering Oplogs", ver), getParent()); } if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY_VERBOSE)) { logger.trace(LogMarker.PERSIST_RECOVERY_VERBOSE, "version={}", recoveredGFVersion); } readEndOfRecord(dis); return recoveredGFVersion; }
Source:
<code>public CrateHttpService(CrateState crateState, ApiConfiguration config) { ResourceConfig httpConf = new ResourceConfig() .register(new CrateRestResource(crateState)) .packages("io.crate.frameworks.mesos.api"); <START> int http_port = config.apiPort(); <END> URI http_uri = URI.create(String.format("<LINK_0>", http_port)); server = GrizzlyHttpServerFactory.createHttpServer(http_uri, httpConf); }</code><technical_language>camel case variable names</technical_language>

Target:
public CrateHttpService(CrateState crateState, ApiConfiguration config) { ResourceConfig httpConf = new ResourceConfig() .register(new CrateRestResource(crateState)) .packages("io.crate.frameworks.mesos.api"); int http_port = config.apiPort(); URI httpUri = URI.create(String.format("<LINK_0>", http_port)); server = GrizzlyHttpServerFactory.createHttpServer(httpUri, httpConf); }
Source:
<code>public void getPropertiesUpdatePlace(final TrendsPlace place){ CommonDataService.Async.getInstance().getWebClientProperties(new AsyncCallback<WebClientProperties>() { @Override public void onFailure(Throwable caught) { new ExceptionPanel("Default properties will be used. Exception while properties retrieving: " + caught.getMessage()); updatePlace(place); } @Override public void onSuccess(WebClientProperties result) { webClientProperties = result; <START> updateTagFilter(); <END> updatePlace(place); } }); }</code><technical_language>this is incorrect place for command</technical_language>

Target:
public void getPropertiesUpdatePlace(final TrendsPlace place){ CommonDataService.Async.getInstance().getWebClientProperties(new AsyncCallback<WebClientProperties>() { @Override public void onFailure(Throwable caught) { new ExceptionPanel("Default properties will be used. Exception while properties retrieving: " + caught.getMessage()); updatePlace(place); } @Override public void onSuccess(WebClientProperties result) { webClientProperties = result; updatePlace(place); } }); }
Source:
<code>private void createReviewedPanel(){ reviewedPanel = new FlowPanel(); <START> reviewedCheckBox = new CheckBox(PatchUtil.C.reviewed() + " & "); <END> reviewedCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setReviewedByCurrentUser(event.getValue()); } }); reviewedPanel.add(reviewedCheckBox); reviewedPanel.add(getReviewedAnchor()); }</code><technical_language>Hmm, I honestly if "&" in reviewed constant</technical_language>

Target:
private void createReviewedPanel(){ reviewedPanel = new FlowPanel(); reviewedCheckBox = new CheckBox(PatchUtil.C.reviewedAnd() + " "); reviewedCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setReviewedByCurrentUser(event.getValue()); } }); reviewedPanel.add(reviewedCheckBox); reviewedPanel.add(getReviewedAnchor()); }
Source:
<code>public void shouldCreateMappingWithMappingAnnotationAtFieldLevel() { Map mapping = elasticsearchTemplate.getMapping(FieldDynamicMappingEntity.class); Map properties = (Map) mapping.get("properties"); <START> assertThat(mapping, is(notNullValue())); <END> assertThat(properties, is(notNullValue())); assertThat(properties.containsKey("file"), is(true)); Map file = (Map) properties.get("file"); assertThat(file, is(notNullValue())); assertThat(((String) file.get("type")), is("string")); assertThat(file.containsKey("fields"), is(true)); Map fields = (Map) file.get("fields"); assertThat(fields, is(notNullValue())); assertThat(fields.containsKey("content"), is(true)); Map content = (Map) fields.get("content"); assertThat(content, is(notNullValue())); assertThat((String)content.get("type"), is("string")); assertThat((String)content.get("term_vector"), is("with_positions_offsets")); assertThat((Boolean)content.get("store"), is(Boolean.TRUE)); }</code><technical_language>mapping null time is line</technical_language>

Target:
public void shouldCreateMappingWithMappingAnnotationAtFieldLevel() { Map mapping = elasticsearchTemplate.getMapping(FieldDynamicMappingEntity.class); assertThat(mapping, is(notNullValue())); Map properties = (Map) mapping.get("properties"); assertThat(properties, is(notNullValue())); assertThat(properties.containsKey("file"), is(true)); Map file = (Map) properties.get("file"); assertThat(file, is(notNullValue())); assertThat(((String) file.get("type")), is("string")); assertThat(file.containsKey("fields"), is(true)); Map fields = (Map) file.get("fields"); assertThat(fields, is(notNullValue())); assertThat(fields.containsKey("content"), is(true)); Map content = (Map) fields.get("content"); assertThat(content, is(notNullValue())); assertThat((String)content.get("type"), is("string")); assertThat((String)content.get("term_vector"), is("with_positions_offsets")); assertThat((Boolean)content.get("store"), is(Boolean.TRUE)); }
Source:
<code>public void typeBorderSize(int border) { tablePropertiesInputs.get(2).clear(); tablePropertiesInputs.get(2).sendKeys(Integer.toString(border)); <START> PageObjectLogging.log("typeBorderSize", "border size was typed", true, driver); <END> }</code><technical_language>1. add border size log 2. need of screenshot in methods</technical_language>

Target:
public void typeBorderSize(int border) { tablePropertiesInputs.get(2).clear(); tablePropertiesInputs.get(2).sendKeys(Integer.toString(border)); PageObjectLogging.log("typeBorderSize", "border size was typed: " + border, true); }
Source:
<code>private void run() { VM entity = (VM) getItem().getEntity(); <START> boolean reinitialize = !entity.isInitialized() && AsyncDataProvider.isWindowsOsType(entity.getVmOsId()); <END> RunVmParams tempVar = new RunVmParams(entity.getId()); tempVar.setInitializationType(InitializationType.Sysprep); Frontend.RunAction(VdcActionType.RunVm, tempVar); }</code><technical_language>fishy - 'reinitialize' field is redundant</technical_language>

Target:
private void run() { VM entity = (VM) getItem().getEntity(); RunVmParams tempVar = new RunVmParams(entity.getId()); if (!entity.isInitialized() && AsyncDataProvider.isWindowsOsType(entity.getVmOsId())) { tempVar.setInitializationType(InitializationType.Sysprep); } else if (!entity.isInitialized() && AsyncDataProvider.isLinuxOsType(entity.getVmOsId())) { tempVar.setInitializationType(InitializationType.CloudInit); } else { tempVar.setInitializationType(InitializationType.None); } Frontend.RunAction(VdcActionType.RunVm, tempVar); }
Source:
<code>public void testCreateAccountMissingLocationURL() throws Exception { server = setupTestCreateAccount(true); AcmeAccount account = populateBasicAccount(ACCOUNT_1_V2); assertNull(account.getAccountUrl()); try { acmeClient.createAccount(account, false); fail("Expected AcmeException not thrown"); } catch(AcmeException e) { <START> assertTrue(e.getMessage().contains("account location URL")); <END> } }</code><technical_language>Instead of contains("account location URL") here, account constant instead (i.e., contains(ACCOUNT))</technical_language>

Target:
public void testCreateAccountMissingLocationURL() throws Exception { server = setupTestCreateAccount(true); AcmeAccount account = populateBasicAccount(ACCOUNT_1_V2); assertNull(account.getAccountUrl()); try { acmeClient.createAccount(account, false); fail("Expected AcmeException not thrown"); } catch(AcmeException e) { assertTrue(e.getMessage().contains(ACCOUNT)); } }
Source:
<code>void onLastOpComplete( Consumer<Integer> cb, Consumer<Consumer<Integer>> newOnLastOp) { <START> assert (onLastOp == null); <END> onLastOp = newOnLastOp; checkOpComplete(cb); }</code><technical_language>checkNotNull java requireNonNull</technical_language>

Target:
void onLastOpComplete( Consumer<Integer> cb, Consumer<Consumer<Integer>> newOnLastOp) { checkState(onLastOp == null); onLastOp = newOnLastOp; checkOpComplete(cb); }
Source:
<code>private Map<String, T> parseOvfs(String stdout) { if (stdout.startsWith("{")) { stdout = stdout.substring(1, stdout.length()-1); return Arrays.stream(stdout.split("::")) <START> .map(str -> { <END> return splitToFileNameAndOvf(str); }) .map(arr -> new Object[] { parseOvf(arr[1]), arr[0]}) .filter(arr -> arr[0] != null) .collect(Collectors.toMap(arr -> (String) arr[1], arr -> (T) arr[0])); } else { String[] splitted = splitToFileNameAndOvf(stdout); T vm = parseOvf(splitted[1]); return new HashMap<>(Collections.singletonMap(splitted[0], vm)); } }</code><technical_language>map(this::splitToFileNameAndOvf)</technical_language>

Target:
private Map<String, T> parseOvfs(String stdout) { if (stdout.startsWith("{")) { stdout = stdout.substring(1, stdout.length()-1); return Arrays.stream(stdout.split("::")) .map(this::splitToFileNameAndOvf) .map(arr -> new Object[] { parseOvf(arr[1]), arr[0] }) .filter(arr -> arr[0] != null) .collect(Collectors.toMap(arr -> (String) arr[1], arr -> (T) arr[0])); } else { String[] splitted = splitToFileNameAndOvf(stdout); T vm = parseOvf(splitted[1]); return new HashMap<>(Collections.singletonMap(splitted[0], vm)); } }
Source:
<code>public List<String> getParentIds() { List<DocumentModel> parents = getCoreSession().getParentDocuments(doc.getRef()); Collections.reverse(parents); <START> List<String> res = new ArrayList<>(); for (DocumentModel doc : parents) { BundleGroup bgroup = doc.getAdapter(BundleGroup.class); if (bgroup != null) { res.add(bgroup.getId()); } } return res; <END> }</code><technical_language>return parents.stream() .map(doc -> doc.getAdapter(BundleGroup.class)) .filter(Objects::nonNull) .map(BundleGroup::getId) .collect(Collectors.toList());</technical_language>

Target:
public List<String> getParentIds() { List<DocumentModel> parents = getCoreSession().getParentDocuments(doc.getRef()); return parents.stream() .sorted(Collections.reverseOrder()) .map(doc -> doc.getAdapter(BundleGroup.class)) .filter(Objects::nonNull) .map(BundleGroup::getId) .collect(Collectors.toList()); }
Source:
<code>public String getConfigurationValue(String servicePid, String propertyName) { String methodName = "getConfigurationValue"; <START> logger.debug( <END> "ENTERING: " + methodName + " servicePid = " + servicePid + ", propertyName = " + propertyName); String value = ""; try { if (this.configurationAdmin != null) { Configuration currentConfiguration = this.configurationAdmin .getConfiguration(servicePid); if (currentConfiguration != null) { Dictionary<String, Object> properties = currentConfiguration.getProperties(); if (properties != null && properties.get(propertyName) != null) { value = (String) properties.get(propertyName); } else { logger.debug("properties for servicePid = " + servicePid + " were NULL or empty"); } } else { logger.debug("configuration for servicePid = " + servicePid + " was NULL"); } } else { logger.debug("configurationAdmin is NULL"); } } catch (IOException e) { logger.warn("Exception while getting configuration value.", e); } logger.debug("EXITING: " + methodName + " value = [" + value + "]"); return value; }</code><technical_language>Is this method called often? surround if (logger.isDebugEnabled())</technical_language>

Target:
public String getConfigurationValue(String servicePid, String propertyName) { String methodName = "getConfigurationValue"; LOGGER.debug("ENTERING: {}, servicePid = {}, propertyName = {}", methodName, servicePid, propertyName); String value = ""; try { if (this.configurationAdmin != null) { Configuration currentConfiguration = this.configurationAdmin .getConfiguration(servicePid); if (currentConfiguration != null) { Dictionary<String, Object> properties = currentConfiguration.getProperties(); if (properties != null && properties.get(propertyName) != null) { value = (String) properties.get(propertyName); } else { LOGGER.debug("properties for servicePid = were NULL or empty", servicePid); } } else { LOGGER.debug("configuration for servicePid = was NULL", servicePid); } } else { LOGGER.debug("configurationAdmin is NULL"); } } catch (IOException e) { LOGGER.warn("Exception while getting configuration value.", e); } LOGGER.debug("EXITING: value = [{}]", methodName, value); return value; }