auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void find() { Path venv = baseDir.resolve(venvDirectoryName); if(Files.isDirectory(venv)) { LOG.info(String.format("Looking for a Python environment in %s", venv)); Path config = venv.resolve(configName); Path binary = venv.resolve(binaryName); if(Files.isRegularFile(config) && Files.isRegularFile(binary)) { try { version = Files.lines(config) .filter(l -> l.startsWith(versionPrefix)) .map(l -> l.substring(versionPrefix.length())) .findFirst(); } catch (IOException e) { <START> LOG.warn(String.format("An error occurred while reading %s", config), e); <END> } LOG.info(String.format("Found Python version %s at %s", version.orElse("unknown"), venv)); PythonInterpreterInfo result = new PythonInterpreterInfo(); result.setBinary(venv.resolve(binaryName).toString()); result.setChroot(venv.toString()); environment = Optional.of(result); } } }</code><technical_language>this Log.error</technical_language>

Target:
private void find() { Path venv = baseDir.resolve(venvDirectoryName); if(Files.isDirectory(venv)) { LOG.info(String.format("Looking for a Python environment in %s", venv)); Path config = venv.resolve(configName); Path binary = venv.resolve(binaryName); if(Files.isRegularFile(config) && Files.isRegularFile(binary)) { try { version = Files.lines(config) .filter(l -> l.startsWith(versionPrefix)) .map(l -> l.substring(versionPrefix.length())) .findFirst(); } catch (IOException e) { LOG.error(String.format("An error occurred while reading %s", config), e); } LOG.info(String.format("Found Python version %s at %s", version.orElse("unknown"), venv)); PythonInterpreterInfo result = new PythonInterpreterInfo(); result.setBinary(venv.resolve(binaryName).toString()); result.setChroot(venv.toString()); environment = Optional.of(result); } } }
Source:
<code>ItemDefinition getItemDefinitionWithItemComponent(final ItemDefinition itemDefinition) { if (itemDefinition.getTypeRef() != null) { final Optional<ItemDefinition> definition = findByName(itemDefinition.getTypeRef().getLocalPart()); if (definition.isPresent()) { return getItemDefinitionWithItemComponent(definition.get()); <START> } <END> } return itemDefinition; }</code><technical_language>I update itemDefinitionType() itemDefinition argument reuse as: java findByName(itemDefinitionType(itemDefinition))</technical_language>

Target:
ItemDefinition getItemDefinitionWithItemComponent(final ItemDefinition itemDefinition) { if (itemDefinition.getTypeRef() != null) { final Optional<ItemDefinition> definition = findByName(itemDefinitionType(itemDefinition)); if (definition.isPresent()) { return getItemDefinitionWithItemComponent(definition.get()); } } return itemDefinition; }
Source:
<code>public static void loginOnBehalf(HttpServletRequest request, String username) throws Exception { log.debug("Entered AuthenticationUtils.loginOnBehalf"); int index = username.lastIndexOf("@"); String profile = null; if (index != -1) { profile = username.substring(index + 1); username = username.substring(0, index); } if (StringUtils.isEmpty(username) || StringUtils.isEmpty(profile)) { throw new AuthenticationException("Please provide username and profile."); } ObjectMapper mapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false) .enableDefaultTyping(ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE); mapper.getDeserializationConfig().addMixInAnnotations(ExtMap.class, JsonExtMapMixIn.class); login(request, new Credentials(username, null, profile, SSOUtils.getSsoContext(request).getSsoProfiles().contains(profile)), <START> mapper.readValue(SSOUtils.getRequestParameter(request, SSOConstants.HTTP_PARAM_AUTH_RECORD), ExtMap.class)); <END> }</code><technical_language>if is auth record need create user</technical_language>

Target:
public static void loginOnBehalf(HttpServletRequest request, String username) throws Exception { log.debug("Entered AuthenticationUtils.loginOnBehalf"); int index = username.lastIndexOf("@"); String profile = null; if (index != -1) { profile = username.substring(index + 1); username = username.substring(0, index); } if (StringUtils.isEmpty(username) || StringUtils.isEmpty(profile)) { throw new AuthenticationException("Please provide username and profile."); } ObjectMapper mapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false) .enableDefaultTyping(ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE); mapper.getDeserializationConfig().addMixInAnnotations(ExtMap.class, JsonExtMapMixIn.class); String authRecordJson = SSOUtils.getRequestParameter(request, SSOConstants.HTTP_PARAM_AUTH_RECORD, ""); ExtMap authRecord; if (StringUtils.isNotEmpty(authRecordJson)) { authRecord = mapper.readValue(authRecordJson, ExtMap.class); } else { authRecord = new ExtMap().mput(Authn.AuthRecord.PRINCIPAL, username); } SSOSession ssoSession = login(request, new Credentials(username, null, profile, SSOUtils.getSsoContext(request).getSsoProfiles().contains(profile)), authRecord); log.info("User {}@{} successfully logged in using login-on-behalf with client id : and scopes : {}", username, profile, ssoSession.getClientId(), ssoSession.getScope()); }
Source:
<code>public AdbQrcodeScannerFragment() { super(); <START> mIntentFilter = new IntentFilter(AdbManager.WIRELESS_DEBUG_PAIRING_RESULT_ACTION); <END> }</code><technical_language>initialize in onCreate()</technical_language>

Target:
public AdbQrcodeScannerFragment() { super(); }
Source:
<code><START> public int getFinishedMappersCount() { <END> return finishedMappers; }</code><technical_language>for consistency, please rename internal variables match names of getter setter methods. This is convention for "java bean properties": <LINK_1> <LINK_0></technical_language>

Target:
public int getFinishedMappersCount() { return finishedMappersCount; }
Source:
<code>public void close() { <START> selector.close(); <END> }</code><technical_language>is other cleanup required w.r.t connections? TCP connections, disconnect</technical_language>

Target:
public void close() { isOpen = false; }
Source:
<code>public List<Attribute> getAttributes(PerunSession sess, Member member, Group group) throws InternalErrorException { try { <START> return jdbc.query("select " + getAttributeMappingSelectQuery("mem") + " from attr_names " + <END> "left join member_group_attr_values mem on attr_names.id=mem.attr_id and mem.group_id=? and member_id=? " + "where namespace in (?,?) and (mem.attr_value is not null or mem.attr_value_text is not null)", new AttributeRowMapper(sess, this, null), group.getId(), member.getId(), AttributesManager.NS_MEMBER_GROUP_ATTR_DEF, AttributesManager.NS_MEMBER_GROUP_ATTR_OPT); } catch(EmptyResultDataAccessException ex) { log.debug("No attribute for member-group combination exists."); return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }</code><technical_language>In getAttributeMappingSelectQuery i prefer mem_gr table is member_group. update this name in rest of SQL query</technical_language>

Target:
public List<Attribute> getAttributes(PerunSession sess, Member member, Group group) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("mem_gr") + " from attr_names " + "left join member_group_attr_values mem_gr on attr_names.id=mem_gr.attr_id and mem_gr.group_id=? and member_id=? " + "where namespace in (?,?) and (mem_gr.attr_value is not null or mem_gr.attr_value_text is not null)", new AttributeRowMapper(sess, this, null), group.getId(), member.getId(), AttributesManager.NS_MEMBER_GROUP_ATTR_DEF, AttributesManager.NS_MEMBER_GROUP_ATTR_OPT); } catch(EmptyResultDataAccessException ex) { log.debug("No attribute for member-group combination exists."); return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
<code>private synchronized StreamObserver<QueryProviderOutbound> getSubscriberObserver() { if (outboundStreamObserver == null) { logger.info("Create new subscriber"); StreamObserver<QueryProviderInbound> queryProviderInboundStreamObserver = new StreamObserver<QueryProviderInbound>() { @Override public void onNext(QueryProviderInbound inboundRequest) { RequestCase requestCase = inboundRequest.getRequestCase(); queryHandlers.getOrDefault(requestCase, Collections.emptySet()) .forEach(consumer -> consumer.accept(inboundRequest)); switch (requestCase) { case CONFIRMATION: break; case QUERY: queryQueue.add(inboundRequest.getQuery()); break; } } @Override public void onError(Throwable throwable) { logger.warn("Received error from server: {}", throwable.getMessage()); outboundStreamObserver = null; <START> resubscribe(); <END> } @Override public void onCompleted() { logger.debug("Received completed from server"); outboundStreamObserver = null; } }; StreamObserver<QueryProviderOutbound> stream = platformConnectionManager.getQueryStream(queryProviderInboundStreamObserver, interceptors); outboundStreamObserver = new FlowControllingStreamObserver<>(stream, configuration, flowControl -> QueryProviderOutbound.newBuilder().setFlowControl(flowControl).build(), t -> t.getRequestCase().equals(QueryProviderOutbound.RequestCase.QUERYRESPONSE)).sendInitialPermits(); } return outboundStreamObserver; }</code><technical_language>Do resubscribe error is StatusRuntimeException Error code UNAVAILABLE. In this case AxonServer is gone, is handled PlatformConnectionManager</technical_language>

Target:
private synchronized StreamObserver<QueryProviderOutbound> getSubscriberObserver() { if (outboundStreamObserver == null) { logger.info("Create new subscriber"); StreamObserver<QueryProviderInbound> queryProviderInboundStreamObserver = new StreamObserver<QueryProviderInbound>() { @Override public void onNext(QueryProviderInbound inboundRequest) { RequestCase requestCase = inboundRequest.getRequestCase(); queryHandlers.getOrDefault(requestCase, Collections.emptySet()) .forEach(consumer -> consumer.accept(inboundRequest)); switch (requestCase) { case CONFIRMATION: break; case QUERY: queryQueue.add(inboundRequest.getQuery()); break; } } @Override public void onError(Throwable ex){ logger.warn("Received error from server: {}", ex.getMessage()); outboundStreamObserver = null; if (ex instanceof StatusRuntimeException && ((StatusRuntimeException) ex).getStatus().getCode().equals(Status.UNAVAILABLE.getCode())) { return; } resubscribe(); } @Override public void onCompleted() { logger.debug("Received completed from server"); outboundStreamObserver = null; } }; StreamObserver<QueryProviderOutbound> stream = platformConnectionManager.getQueryStream(queryProviderInboundStreamObserver, interceptors); outboundStreamObserver = new FlowControllingStreamObserver<>(stream, configuration, flowControl -> QueryProviderOutbound.newBuilder().setFlowControl(flowControl).build(), t -> t.getRequestCase().equals(QueryProviderOutbound.RequestCase.QUERYRESPONSE)).sendInitialPermits(); } return outboundStreamObserver; }
Source:
<code>protected byte[] json2fleece(String json) throws LiteCoreException { boolean commit = false; db.beginTransaction(); FLSliceResult body = null; try { body = db.encodeJSON(json5(json).getBytes()); byte[] bytes = body.getBuf(); commit = true; return bytes; } finally { <START> if (body != null) body.free();; <END> db.endTransaction(commit); } }</code><technical_language>multiple semi colons;;</technical_language>

Target:
protected byte[] json2fleece(String json) throws LiteCoreException { boolean commit = false; db.beginTransaction(); FLSliceResult body = null; try { body = db.encodeJSON(json5(json).getBytes()); byte[] bytes = body.getBuf(); commit = true; return bytes; } finally { if (body != null) body.free(); db.endTransaction(commit); } }
Source:
<code>private void showSelectTagsDialog() { final List<String> checkedTags = new ArrayList<>(); final String[] availableTags = tags.toArray(new String[tags.size()]); new AlertDialog.Builder(this) .setTitle(R.string.upload_tag_dialog_title) .setMultiChoiceItems(availableTags, null, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) { if (isChecked) { <START> if (checkedTags.size() >= MAX_NUMBER_OF_TAGS_CHECKED) { <END> ((AlertDialog) dialog).getListView().setItemChecked(indexSelected, false); } else { checkedTags.add(availableTags[indexSelected]); } } else { checkedTags.remove(availableTags[indexSelected]); } } }) .setPositiveButton(getText(R.string.next), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { project.setTags(checkedTags); showProgressDialogAndUploadProject(); } }) .setNegativeButton(getText(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Utils.invalidateLoginTokenIfUserRestricted(ProjectUploadActivity.this); setShowProgressBar(false); setNextButtonEnabled(true); } }) .setCancelable(false) .show(); }</code><technical_language>this function is long</technical_language>

Target:
private void showSelectTagsDialog() { final List<String> checkedTags = new ArrayList<>(); final String[] availableTags = tags.toArray(new String[tags.size()]); new AlertDialog.Builder(this) .setTitle(R.string.upload_tag_dialog_title) .setMultiChoiceItems(availableTags, null, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) { if (isChecked) { if (checkedTags.size() >= MAX_NUMBER_OF_TAGS_CHECKED) { ((AlertDialog) dialog).getListView().setItemChecked(indexSelected, false); } else { checkedTags.add(availableTags[indexSelected]); } } else { checkedTags.remove(availableTags[indexSelected]); } } }) .setPositiveButton(getText(R.string.next), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { project.setTags(checkedTags); showProgressDialogAndUploadProject(); } }) .setNegativeButton(getText(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Utils.invalidateLoginTokenIfUserRestricted(ProjectUploadActivity.this); setShowProgressBar(false); setNextButtonEnabled(true); } }) .setCancelable(false) .show(); }
Source:
<code>public String docs() { <START> return "void {[world], name, array(locationArrayPos1, locationArrayPos2, [[locationArrayPosN]...])} Update position of a given region. Don't change anything else like owners, members, priority etc."; <END> }</code><technical_language>change this "Updates location of a region new location. Other properties of region, owners, members, priority, unaffected."</technical_language>

Target:
public String docs() { return "void {[world], name, array(locationArrayPos1, locationArrayPos2, [[locationArrayPosN]...])} Updates the location of a given region to the new location. Other properties of the region, like owners, members, priority, etc are unaffected."; }
Source:
<code>public void handleMessage(Message theMessage) throws MessagingException { if (!(theMessage.getPayload() instanceof ResourceDeliveryMessage)) { ourLog.warn("Unexpected payload type: {}", theMessage.getPayload()); return; } ResourceDeliveryMessage msg = (ResourceDeliveryMessage) theMessage.getPayload(); <START> String subscriptionId = msg.getSubscription().getIdElement(myFhirContext).getValue(); <END> ActiveSubscription updatedSubscription = mySubscriptionRegistry.get(msg.getSubscription().getIdElement(myFhirContext).getIdPart()); if (updatedSubscription != null) { msg.setSubscription(updatedSubscription.getSubscription()); } try { if (!myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_BEFORE_DELIVERY, msg, msg.getSubscription())) { return; } handleMessage(msg); myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_AFTER_DELIVERY, msg, msg.getSubscription()); } catch (Exception e) { if (!myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_AFTER_DELIVERY_FAILED, msg, msg.getSubscription(), e)) { return; } String errorMsg = "Failure handling subscription payload for subscription: " + subscriptionId; ourLog.error(errorMsg, e); throw new MessagingException(theMessage, errorMsg, e); } }</code><technical_language>getSubscription().getIdElement(myFhirContext).getValue() a helper method ResourceDeliveryMessage</technical_language>

Target:
public void handleMessage(Message theMessage) throws MessagingException { if (!(theMessage.getPayload() instanceof ResourceDeliveryMessage)) { ourLog.warn("Unexpected payload type: {}", theMessage.getPayload()); return; } ResourceDeliveryMessage msg = (ResourceDeliveryMessage) theMessage.getPayload(); String subscriptionId = msg.getSubscriptionId(myFhirContext); ActiveSubscription updatedSubscription = mySubscriptionRegistry.get(msg.getSubscription().getIdElement(myFhirContext).getIdPart()); if (updatedSubscription != null) { msg.setSubscription(updatedSubscription.getSubscription()); } try { if (!myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_BEFORE_DELIVERY, msg, msg.getSubscription())) { return; } handleMessage(msg); myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_AFTER_DELIVERY, msg, msg.getSubscription()); } catch (Exception e) { String errorMsg = "Failure handling subscription payload for subscription: " + subscriptionId; ourLog.error(errorMsg, e); if (!myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_AFTER_DELIVERY_FAILED, msg, msg.getSubscription(), e)) { return; } throw new MessagingException(theMessage, errorMsg, e); } }
Source:
<code>public ConjureStartTransactionsResponse startTransactions(AuthHeader authHeader, String namespace, ConjureStartTransactionsRequest request) { <START> long timeCreated = System.currentTimeMillis(); <END> ConjureStartTransactionsResponse response = dialogueDelegate.startTransactions(authHeader, namespace, request); long microsSinceCreation = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis() - timeCreated); this.conjureTimelockServiceBlockingMetrics.startTransactions().update(microsSinceCreation, TimeUnit.MICROSECONDS); return response; }</code><technical_language>if a request takes 3.7 ms? suggest Instant.now() instead</technical_language>

Target:
public ConjureStartTransactionsResponse startTransactions(AuthHeader authHeader, String namespace, ConjureStartTransactionsRequest request) { return executeInTimerContext(() -> dialogueDelegate.startTransactions(authHeader, namespace, request)); }
Source:
<code>protected long getTimeStampFutureTTL() { try { return PropertyAccessor.getInstance().getPropertyLong(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.TIMESTAMP_FUTURE_TIME_TO_LIVE); } catch (PropertyAccessException pae) { <START> LOG.warn("Failed to determine timestamp future TTL in gateway.properties, will use default value: {}", <END> pae.getLocalizedMessage()); LOG.trace("Get Timestamp future TTL exception: {}", pae.getLocalizedMessage(), pae); } return INVALID_LONG_VALUE; }</code><technical_language>consider warn trace. sense log message</technical_language>

Target:
protected long getTimeStampFutureTTL() { try { return PropertyAccessor.getInstance().getPropertyLong(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.TIMESTAMP_FUTURE_TIME_TO_LIVE); } catch (PropertyAccessException pae) { LOG.error("Failed to determine timestamp future TTL in gateway.properties, will use default value: {}", pae.getLocalizedMessage(), pae); } return INVALID_LONG_VALUE; }
Source:
<code><START> public void canReturnTheCassandraMetricsFromTheCassandraMetricService() throws Exception { <END> when(healthMetricSupplier.get()).thenReturn(ImmutableList.of( getCassandraMetric(METRIC_TYPE_1, METRIC_NAME_1, METRIC_ATTRIBUTE_1), getCassandraMetric(METRIC_TYPE_2, METRIC_NAME_2, METRIC_ATTRIBUTE_2))); when(cassandraMetricClient.getMetric(METRIC_TYPE_1, METRIC_NAME_1, METRIC_ATTRIBUTE_1, ImmutableMap.of())) .thenReturn(METRIC_VALUE_1); when(cassandraMetricClient.getMetric(METRIC_TYPE_2, METRIC_NAME_2, METRIC_ATTRIBUTE_2, ImmutableMap.of())) .thenReturn(METRIC_VALUE_2); scheduledExecutorService.tick(3, TimeUnit.SECONDS); List<CassandraHealthMetricMeasurement> cassandraHealthMetricMeasurements = cassandraMetricMeasurementsLoader.getCassandraHealthMetricMeasurements(); List<CassandraHealthMetricMeasurement> expectedCassandraHealthMetricMeasurements = ImmutableList.of(getCassandraMetricMeasurement(METRIC_VALUE_1), getCassandraMetricMeasurement(METRIC_VALUE_2)); assertThat(expectedCassandraHealthMetricMeasurements).isEqualTo(cassandraHealthMetricMeasurements); }</code><technical_language>worth verifying behavior if a call for cassandra metrics fails metric exist</technical_language>

Target:
public void canReturnTheCassandraMetricsFromTheCassandraMetricService() throws Exception { scheduledExecutorService.tick(3, TimeUnit.SECONDS); List<CassandraHealthMetricMeasurement> cassandraHealthMetricMeasurements = cassandraMetricMeasurementsLoader.getCassandraHealthMetricMeasurements(); List<CassandraHealthMetricMeasurement> expectedCassandraHealthMetricMeasurements = ImmutableList.of(getCassandraMetricMeasurement(METRIC_VALUE_1), getCassandraMetricMeasurement(METRIC_VALUE_2)); assertThat(expectedCassandraHealthMetricMeasurements).isEqualTo(cassandraHealthMetricMeasurements); }
Source:
<code>private LookupSourceFactory benchmarkBuildHash(BuildContext buildContext, List<Integer> outputChannels) { DriverContext driverContext = buildContext.createTaskContext().addPipelineContext(0, true, true).addDriverContext(); HashBuilderOperatorFactory hashBuilderOperatorFactory = new HashBuilderOperatorFactory( HASH_BUILD_OPERATOR_ID, TEST_PLAN_NODE_ID, buildContext.getTypes(), outputChannels, ImmutableMap.of(), buildContext.getHashChannels(), buildContext.getHashChannel(), false, Optional.empty(), 10_000, 1, new PagesIndex.TestingFactory()); Operator operator = hashBuilderOperatorFactory.createOperator(driverContext); for (Page page : buildContext.getBuildPages()) { operator.addInput(page); } operator.finish(); ListenableFuture<LookupSourceProvider> lookupSourceProvider = hashBuilderOperatorFactory.getLookupSourceFactory().createLookupSourceProvider(); if (!lookupSourceProvider.isDone()) { <START> throw new AssertionError("Expected lookup source to be done"); <END> } getFutureValue(lookupSourceProvider).close(); return hashBuilderOperatorFactory.getLookupSourceFactory(); }</code><technical_language>change "Expected lookup source done" "Expected lookup source provider ready"</technical_language>

Target:
private LookupSourceFactory benchmarkBuildHash(BuildContext buildContext, List<Integer> outputChannels) { DriverContext driverContext = buildContext.createTaskContext().addPipelineContext(0, true, true).addDriverContext(); HashBuilderOperatorFactory hashBuilderOperatorFactory = new HashBuilderOperatorFactory( HASH_BUILD_OPERATOR_ID, TEST_PLAN_NODE_ID, buildContext.getTypes(), outputChannels, ImmutableMap.of(), buildContext.getHashChannels(), buildContext.getHashChannel(), false, Optional.empty(), 10_000, 1, new PagesIndex.TestingFactory(), false, SingleStreamSpillerFactory.unsupportedSingleStreamSpillerFactory()); Operator operator = hashBuilderOperatorFactory.createOperator(driverContext); for (Page page : buildContext.getBuildPages()) { operator.addInput(page); } operator.finish(); ListenableFuture<LookupSourceProvider> lookupSourceProvider = hashBuilderOperatorFactory.getLookupSourceFactory().createLookupSourceProvider(); if (!lookupSourceProvider.isDone()) { throw new AssertionError("Expected lookup source provider to be ready"); } getFutureValue(lookupSourceProvider).close(); return hashBuilderOperatorFactory.getLookupSourceFactory(); }
Source:
<code><START> public void handleTag(final boolean opening, final String tag, Editable output, <END> final XMLReader xmlReader) { if (tag.equals("ul") || tag.equals("ol") || tag.equals("dd")) { if (opening) { mListParents.add(tag); } else { mListParents.remove(tag); } mListItemCount = 0; } else if (tag.equals("li") && !opening) { handleListTag(output); } }</code><technical_language>I nitpicking - sorry! in this method, line 24 comparing tag.equals("ul") other similar expressions, I this part of changes se reviewing code I realize is a possiblity tag==null, preferrable check tag != null or, least, change expression "ul".equals(tag), .equals() accessed throw a NPE in circumstance</technical_language>

Target:
public void handleTag(final boolean opening, final String tag, Editable output, final XMLReader xmlReader) { if (tag != null) { if (tag.equals("ul") || tag.equals("ol") || tag.equals("dd")) { if (opening) { mListParents.add(tag); } else { mListParents.remove(tag); } mListItemCount = 0; } else if (tag.equals("li") && !opening) { handleListTag(output); } } }
Source:
<code>String getDescription() { <START> return "Cannot exceed max partitions on node"; <END> }</code><technical_language>maximum number of partitions</technical_language>

Target:
String getDescription() { return "Cannot exceed the maximum number of partitions limitation on node"; }
Source:
<code>public void clearCache() { <START> cacheManager.getCache().clear(); <END> TestingUtil.recursiveFileRemove(indexDir); }</code><technical_language>check cacheManager != null</technical_language>

Target:
public void clearCache() { if (cacheManager != null) { cacheManager.getCache().clear(); } TestingUtil.recursiveFileRemove(indexDir); }
Source:
<code>protected String normalizePattern( String pattern, String wildcard, String singleChar, String escapeChar) { StringBuilder sb = new StringBuilder(pattern.length()); for (int i = 0; i < pattern.length(); i++) { char c = pattern.charAt(i); if (c == escapeChar.charAt(0)) { if (i + 1 < pattern.length()) { i++; String next = Character.toString(pattern.charAt(i)); <START> if ("*".equals(next) || "?".equals(next) || "\\".equals(next)) { <END> sb.append("\\"); sb.append(next); } else { sb.append(next); } } } else if (c == singleChar.charAt(0)) { sb.append("?"); } else if (c == wildcard.charAt(0)) { sb.append("*"); } else { sb.append(c); } } return sb.toString(); }</code><technical_language>perform character comparison skip Character.toString call</technical_language>

Target:
protected String normalizePattern( String pattern, String wildcard, String singleChar, String escapeChar) { StringBuilder sb = new StringBuilder(pattern.length()); for (int i = 0; i < pattern.length(); i++) { char c = pattern.charAt(i); if (c == escapeChar.charAt(0)) { if (i + 1 < pattern.length()) { i++; char next = pattern.charAt(i); if ('*' == next || '?' == next || '\\' == next) { sb.append("\\"); sb.append(next); } else { sb.append(next); } } } else if (c == singleChar.charAt(0)) { sb.append("?"); } else if (c == wildcard.charAt(0)) { sb.append("*"); } else { sb.append(c); } } return sb.toString(); }
Source:
<code>private String createAndGetLockPath() throws InterruptedException, KeeperException { <START> if (zk.exists(lockPath.toString(), false) == null) { <END> try { Util.mkdir(zk, lockPath.toString(), ZooDefs.Ids.OPEN_ACL_UNSAFE); } catch (CloudnameException e) { log.log( java.util.logging.Level.INFO, "CloudnameException while trying to get lock path " + absoluteLockPath, e); } } return lockPath + "/" + lockName; }</code><technical_language>lockPath is field I suggested above</technical_language>

Target:
private String createAndGetLockPath() throws InterruptedException, KeeperException { if (zk.exists(lockPath, false) == null) { try { Util.mkdir(zk, lockPath, ZooDefs.Ids.OPEN_ACL_UNSAFE); } catch (CloudnameException e) { log.log( java.util.logging.Level.INFO, "CloudnameException while trying to get lock path " + absoluteLockPath, e); } } return lockPath + "/" + lockName; }
Source:
<code>String getFullRemoteReference() { <START> if (!remoteBranchNameText.getText().startsWith(Constants.R_REFS)) { <END> return Constants.R_HEADS + remoteBranchNameText.getText(); } else { return remoteBranchNameText.getText(); } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
String getFullRemoteReference() { if (!remoteBranchNameText.getText().startsWith(Constants.R_REFS)) return Constants.R_HEADS + remoteBranchNameText.getText(); else return remoteBranchNameText.getText(); }
Source:
<code>public void init() { try (InputStream inputStream = new FileInputStream(profilesFilePath)) { <START> String json = IOUtils.toString(inputStream, StandardCharsets.UTF_8); <END> this.profiles = GSON.fromJson(json, new TypeToken<Map<String, Object>>() {}.getType()); } catch (IOException e) { LOGGER.debug("Could not find profiles.json during installation: ", e); this.profiles = new HashMap<>(); } availableClaimsMap = propertiesFileReader.loadSinglePropertiesFile(availableClaimsFile); }</code><technical_language>forced read a string Boon. advantage of Gson parse a stream directly</technical_language>

Target:
public void init() { try (InputStream inputStream = new FileInputStream(profilesFilePath)) { this.profiles = GSON.fromJson(new InputStreamReader(inputStream), MAP_STRING_TO_OBJECT_TYPE); } catch (IOException e) { LOGGER.debug("Could not find profiles.json during installation: ", e); this.profiles = new HashMap<>(); } availableClaimsMap = propertiesFileReader.loadSinglePropertiesFile(availableClaimsFile); }
Source:
<code><START> static public void printIndexStats(final File inputBamFile) { <END> try { final BAMFileReader bam = new BAMFileReader(inputBamFile, null, false, false, ValidationStringency.SILENT, new DefaultSAMRecordFactory()); if (!bam.hasIndex() || bam.getIndexType() == null) { throw new SAMException("No index for bam file " + inputBamFile); } BAMIndexMetaData[] data = null; if (bam.getIndexType().equals(SamIndexes.BAI) || bam.getIndexType().equals(SamIndexes.CSI)) { data = getIndexStats(bam); } if (data == null) { throw new SAMException("Exception in getting index statistics"); } int nRefs = bam.getFileHeader().getSequenceDictionary().size(); for (int i = 0; i < nRefs; i++) { final SAMSequenceRecord seq = bam.getFileHeader().getSequence(i); if (seq == null) continue; final String sequenceName = seq.getSequenceName(); final int sequenceLength = seq.getSequenceLength(); System.out.print(sequenceName + ' ' + "length=\t" + sequenceLength); if (data[i] == null) { System.out.println(); continue; } System.out.println("\tAligned= " + data[i].getAlignedRecordCount() + "\tUnaligned= " + data[i].getUnalignedRecordCount()); } System.out.println("NoCoordinateCount= " + data[0].getNoCoordinateRecordCount()); } catch (IOException e) { throw new SAMException("Exception in getting index statistics", e); } }</code><technical_language>this tested ever, I intended for debugging fine</technical_language>

Target:
static public void printIndexStats(final File inputBamFile) { try { final BAMFileReader bam = new BAMFileReader(inputBamFile, null, false, false, ValidationStringency.SILENT, new DefaultSAMRecordFactory()); if (!bam.hasIndex() || bam.getIndexType() == null) { throw new SAMException("No index for bam file " + inputBamFile); } BAMIndexMetaData[] data = getIndexStats(bam); if (data == null) { throw new SAMException("Exception in getting index statistics"); } int nRefs = bam.getFileHeader().getSequenceDictionary().size(); for (int i = 0; i < nRefs; i++) { final SAMSequenceRecord seq = bam.getFileHeader().getSequence(i); if (seq == null) continue; final String sequenceName = seq.getSequenceName(); final int sequenceLength = seq.getSequenceLength(); System.out.print(sequenceName + ' ' + "length=\t" + sequenceLength); if (data[i] == null) { System.out.println(); continue; } System.out.println("\tAligned= " + data[i].getAlignedRecordCount() + "\tUnaligned= " + data[i].getUnalignedRecordCount()); } System.out.println("NoCoordinateCount= " + data[0].getNoCoordinateRecordCount()); } catch (IOException e) { throw new SAMException("Exception in getting index statistics", e); } }
Source:
<code>public void shouldNotCreate_withItem() { final ItemId itemId = new ItemId(randomId()); final StubItem stubItem = generateRandomStubItem(itemId); final ItemConfiguration itemConfiguration = new ItemConfiguration(StubItem.class, tableName); final Collection<ItemConfiguration> itemConfigurations = Arrays.asList(itemConfiguration); when(mockDatabaseSchemaHolder.itemConfigurations()).thenReturn(itemConfigurations); final Table mockTable = mock(Table.class); when(mockDynamoDBClient.getTable(any(String.class))).thenReturn(mockTable); final DynamoDocumentStoreTemplate dynamoDocumentStoreTemplate = new DynamoDocumentStoreTemplate( mockDatabaseSchemaHolder); dynamoDocumentStoreTemplate.initialize(mockAmazonDynamoDbClient); final Item mockTableItem = mock(Item.class); when(mockTableItem.toJSON()).thenReturn(dynamoDocumentStoreTemplate.itemToString(stubItem)); doThrow(RuntimeException.class).when(mockTable).putItem(any(PutItemSpec.class)); <START> exception.expect(RuntimeException.class); <END> dynamoDocumentStoreTemplate.create(stubItem); }</code><technical_language>in Cheddar a convention for verifying exceptions. is slightly more verbose, favoured this approach for clarity: java // ... // MyException thrownException = null; try { obj.method(); // method test } catch (MyException e) { thrownException = e; } // assertNotNull(thrownException); ..</technical_language>

Target:
public void shouldNotCreate_withItem() { final ItemId itemId = new ItemId(randomId()); final StubItem stubItem = generateRandomStubItem(itemId); final ItemConfiguration itemConfiguration = new ItemConfiguration(StubItem.class, tableName); final Collection<ItemConfiguration> itemConfigurations = Arrays.asList(itemConfiguration); when(mockDatabaseSchemaHolder.itemConfigurations()).thenReturn(itemConfigurations); final Table mockTable = mock(Table.class); when(mockDynamoDBClient.getTable(any(String.class))).thenReturn(mockTable); final DynamoDocumentStoreTemplate dynamoDocumentStoreTemplate = new DynamoDocumentStoreTemplate( mockDatabaseSchemaHolder); dynamoDocumentStoreTemplate.initialize(mockAmazonDynamoDbClient); final Item mockTableItem = mock(Item.class); when(mockTableItem.toJSON()).thenReturn(dynamoDocumentStoreTemplate.itemToString(stubItem)); doThrow(RuntimeException.class).when(mockTable).putItem(any(PutItemSpec.class)); RuntimeException thrownException = null; try { dynamoDocumentStoreTemplate.create(stubItem); } catch (final RuntimeException runtimeException) { thrownException = runtimeException; } assertNotNull(thrownException); }
Source:
<code>public static <T extends Model> List<T> processCursor(Class<? extends Model> type, Cursor cursor) { final List<T> entities = new ArrayList<T>(); try { Constructor<?> entityConstructor = type.getConstructor(); if (cursor.moveToFirst()) { do { Model entity = Cache.getEntity(type, cursor.getLong(cursor.getColumnIndex("Id"))); if (entity == null) { entity = (T) entityConstructor.newInstance(); } entity.loadFromCursor(cursor); entities.add((T) entity); } while (cursor.moveToNext()); } } catch (NoSuchMethodException e) { <START> throw new NoDefaultConstructorOnModelException(type.getName()); <END> } catch (Exception e) { Log.e("Failed to process cursor.", e); } return entities; }</code><technical_language>Instead of defining a new Exception once, throw a RuntimeException here? easier read imho</technical_language>

Target:
public static <T extends Model> List<T> processCursor(Class<? extends Model> type, Cursor cursor) { final List<T> entities = new ArrayList<T>(); try { Constructor<?> entityConstructor = type.getConstructor(); if (cursor.moveToFirst()) { do { Model entity = Cache.getEntity(type, cursor.getLong(cursor.getColumnIndex("Id"))); if (entity == null) { entity = (T) entityConstructor.newInstance(); } entity.loadFromCursor(cursor); entities.add((T) entity); } while (cursor.moveToNext()); } } catch (NoSuchMethodException e) { throw new RuntimeException( "Your model " + type.getName() + " does not define a default " + "constructor. The default constructor is required for " + "now in ActiveAndroid models, as the process to " + "populate the ORM model is : " + "1. instantiate default model " + "2. populate fields" ); } catch (Exception e) { Log.e("Failed to process cursor.", e); } return entities; }
Source:
<code>public static void main(String[] args) { if (args.length < 1) { System.out.println("Please specify your access key."); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0], "<LINK_0>"); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); PurchasedNumbersFilter filter = new PurchasedNumbersFilter(); filter.addFeature(PhoneNumberFeature.SMS); filter.setType(PhoneNumberType.MOBILE); filter.setLimit(25); try { System.out.println(messageBirdClient.listPurchasedNumbers(filter)); <START> return; <END> } catch (UnauthorizedException | NotFoundException | GeneralException exception) { if (exception.getErrors() != null) { System.out.println(exception.getErrors().toString()); } exception.printStackTrace(); } }</code><technical_language>need return in</technical_language>

Target:
public static void main(String[] args) { if (args.length < 1) { System.out.println("Please specify your access key."); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); PurchasedNumbersFilter filter = new PurchasedNumbersFilter(); filter.setLimit(25); try { System.out.println(messageBirdClient.listPurchasedNumbers(filter)); } catch (UnauthorizedException | NotFoundException | GeneralException exception) { if (exception.getErrors() != null) { System.out.println(exception.getErrors().toString()); } exception.printStackTrace(); } }
Source:
<code>public void traverse(String ... paths) throws IOException { BufferedWriter writer = null; final AtomicInteger count = new AtomicInteger(); boolean threw = true; System.out.println("Starting dump of blob references by traversing"); Stopwatch watch = createStarted(); try { writer = Files.newWriter(references, Charsets.UTF_8); if (paths.length == 0) { traverseChildren(nodeStore.getRoot(), PATH_DELIM, writer, count); } else { for (String path: paths ) { <START> String[] nodeList = path.split(PATH_DELIM); <END> NodeState state = nodeStore.getRoot(); for (String node: nodeList) { if (node.isEmpty()) continue; state = state.getChildNode(node); } traverseChildren(state, path, writer, count); } } writer.flush(); sort(references, idComparator); System.out.println(count.get() + " blob references found"); System.out.println("Finished in " + watch.elapsed(TimeUnit.SECONDS) + " seconds"); threw = false; } finally { Closeables.close(writer, threw); } }</code><technical_language>org.apache.jackrabbit.oak.commons PathUtils.elements instead</technical_language>

Target:
public void traverse(String ... paths) throws IOException { BufferedWriter writer = null; final AtomicInteger count = new AtomicInteger(); boolean threw = true; System.out.println("Starting dump of blob references by traversing"); Stopwatch watch = createStarted(); try { writer = Files.newWriter(references, Charsets.UTF_8); if (paths.length == 0) { traverseChildren(nodeStore.getRoot(), "/", writer, count); } else { for (String path: paths ) { Iterable<String> nodeList = PathUtils.elements(path); NodeState state = nodeStore.getRoot(); for (String node: nodeList) { state = state.getChildNode(node); } traverseChildren(state, path, writer, count); } } writer.flush(); sort(references, idComparator); System.out.println(count.get() + " blob references found"); System.out.println("Finished in " + watch.elapsed(TimeUnit.SECONDS) + " seconds"); threw = false; } finally { Closeables.close(writer, threw); } }
Source:
<code>private Void deleteOldSegments() { removeTaskFuture(m_pbd.getNonce()); try { while (m_pbd.isCursorOpen(CURSOR_NAME) && m_reader.skipToNextSegmentIfOlder(m_retainMillis)); } catch(IOException e) { m_pbd.getUsageSpecificLog().warn("Unexpected error trying to check for PBD segments to be deleted", e); return null; } if (m_pbd.isCursorOpen(CURSOR_NAME) && !m_reader.isCurrentSegmentActive()) { long recordTime = m_reader.getSegmentLastRecordTimestamp(); if (recordTime == 0) { m_pbd.getUsageSpecificLog().rateLimitedLog(60, Level.WARN, null, "Could not get last record time for segment in PBD %s. This may prevent enforcing time-based retention", m_pbd.getNonce()); return null; } long timerDelay = m_retainMillis - (System.currentTimeMillis() - recordTime); try { if (m_pbd.getUsageSpecificLog().isDebugEnabled()) { m_pbd.getUsageSpecificLog().rateLimitedLog(60, Level.DEBUG, null, "Scheduling time-based retention for %s in %d milliseconds", m_pbd.getNonce(), Math.max(timerDelay, MIN_DELAY)); } <START> scheduleTaskFor(m_pbd.getNonce(), ()->deleteOldSegments(), Math.max(timerDelay, MIN_DELAY)); <END> } catch(RejectedExecutionException e) { } } return null; }</code><technical_language>do this::deleteOldSegments for callable</technical_language>

Target:
private void deleteOldSegments() { try { removeTaskFuture(m_pbd.getNonce()); try { while (m_pbd.isCursorOpen(CURSOR_NAME) && m_reader.skipToNextSegmentIfOlder(m_retainMillis)); } catch(IOException e) { m_pbd.getUsageSpecificLog().warn("Unexpected error trying to check for PBD segments to be deleted", e); return; } if (m_pbd.isCursorOpen(CURSOR_NAME) && !m_reader.isCurrentSegmentActive()) { long recordTime = m_reader.getSegmentLastRecordTimestamp(); if (recordTime == 0) { m_pbd.getUsageSpecificLog().rateLimitedLog(60, Level.WARN, null, "Could not get last record time for segment in PBD %s. This may prevent enforcing time-based retention", m_pbd.getNonce()); return; } long timerDelay = m_retainMillis - (System.currentTimeMillis() - recordTime); try { if (m_pbd.getUsageSpecificLog().isDebugEnabled()) { m_pbd.getUsageSpecificLog().rateLimitedLog(60, Level.DEBUG, null, "Scheduling time-based retention for %s in %d milliseconds", m_pbd.getNonce(), Math.max(timerDelay, MIN_DELAY)); } scheduleTaskFor(m_pbd.getNonce(), this::deleteOldSegments, Math.max(timerDelay, MIN_DELAY)); } catch(RejectedExecutionException e) { } } } catch(Exception e) { m_pbd.getUsageSpecificLog().error("Unexpected error running deleteOldSegements for pbd " + m_pbd.getNonce(), e); } }
Source:
<code>public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { <START> CompletableFuture<Exception> eFuture = new CompletableFuture<>(); eFuture.thenAccept(e -> showError(user.getBase(), e, commandLabel)); <END> switch (args.length) { case 0: throw new NotEnoughArgumentsException(); case 1: final User player = getPlayer(server, user, args, 0); if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + player.getWorld().getName())) { throw new Exception(tl("noPerm", "essentials.worlds." + player.getWorld().getName())); } user.getAsyncTeleport().now(player.getBase(), false, TeleportCause.COMMAND, eFuture, new CompletableFuture<>()); break; default: if (!user.isAuthorized("essentials.tp.others")) { throw new Exception(tl("noPerm", "essentials.tp.others")); } final User target = getPlayer(server, user, args, 0); final User toPlayer = getPlayer(server, user, args, 1); if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + toPlayer.getWorld().getName())) { throw new Exception(tl("noPerm", "essentials.worlds." + toPlayer.getWorld().getName())); } CompletableFuture<Boolean> future = new CompletableFuture<>(); future.thenAccept(success -> { if (success) { target.sendMessage(tl("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); } }); target.getAsyncTeleport().now(toPlayer.getBase(), false, TeleportCause.COMMAND, eFuture, future); break; } }</code><technical_language>functional difference lines calling getNewExceptionFuture()</technical_language>

Target:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { switch (args.length) { case 0: throw new NotEnoughArgumentsException(); case 1: final User player = getPlayer(server, user, args, 0); if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + player.getWorld().getName())) { throw new Exception(tl("noPerm", "essentials.worlds." + player.getWorld().getName())); } user.getAsyncTeleport().now(player.getBase(), false, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel)); break; default: if (!user.isAuthorized("essentials.tp.others")) { throw new Exception(tl("noPerm", "essentials.tp.others")); } final User target = getPlayer(server, user, args, 0); final User toPlayer = getPlayer(server, user, args, 1); if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + toPlayer.getWorld().getName())) { throw new Exception(tl("noPerm", "essentials.worlds." + toPlayer.getWorld().getName())); } CompletableFuture<Boolean> future = getNewExceptionFuture(user.getSource(), commandLabel); target.getAsyncTeleport().now(toPlayer.getBase(), false, TeleportCause.COMMAND, future); future.thenAccept(success -> { if (success) { target.sendMessage(tl("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); } }); break; } }
Source:
<code>private void checkFragmentConstraints(ResolverBundle bundle) { ResolverBundle[] fragments = bundle.getFragments(); for (ResolverBundle <START> fragment1 <END> : fragments) { BundleDescription fragment = fragment1.getBundleDescription(); if (bundle.constraintsConflict(fragment, fragment.getImportPackages(), fragment.getRequiredBundles(), fragment.getGenericRequires()) && !developmentMode) { bundle.detachFragment(fragment1, null); } } }</code><technical_language>fragment? I a duplicate fragment below. Call resolverFragment then. I want var names 1 tacked end</technical_language>

Target:
private void checkFragmentConstraints(ResolverBundle bundle) { ResolverBundle[] fragments = bundle.getFragments(); for (ResolverBundle resolverFragment : fragments) { BundleDescription fragment = resolverFragment.getBundleDescription(); if (bundle.constraintsConflict(fragment, fragment.getImportPackages(), fragment.getRequiredBundles(), fragment.getGenericRequires()) && !developmentMode) { bundle.detachFragment(resolverFragment, null); } } }
Source:
<code>public BlobHolder convertToMimeType(String destinationMimeType, BlobHolder blobHolder, Map<String, Serializable> parameters) throws ConversionException { <START> String srcMt = blobHolder.getBlob().getMimeType(); <END> String converterName = translationHelper.getConverterName(srcMt, destinationMimeType); if (converterName == null) { return convertThroughHTML(blobHolder, destinationMimeType); } else { return convert(converterName, blobHolder, parameters); } }</code><technical_language>While editing this file, is rename srcMt srcMimeType improve readability</technical_language>

Target:
public BlobHolder convertToMimeType(String destinationMimeType, BlobHolder blobHolder, Map<String, Serializable> parameters) throws ConversionException { String srcMimeType = blobHolder.getBlob().getMimeType(); String converterName = translationHelper.getConverterName(srcMimeType, destinationMimeType); if (converterName == null) { return convertThroughHTML(blobHolder, destinationMimeType); } else { return convert(converterName, blobHolder, parameters); } }
Source:
<code>public boolean updateNoSqlConnection(Connection connection) throws Exception{ if (isNoSQLConnection(connection)) { NoSQLConnection noSqlConn = (NoSQLConnection)connection; String pass = noSqlConn.getAttributes().get(ICassandraAttributies.PASSWORD); if(pass != null) { pass = PasswordMigrationUtil.encryptPasswordIfNeeded(pass); <START> noSqlConn.getAttributes().put(ICassandraAttributies.PASSWORD, noSqlConn.getValue(pass, true)); <END> return true; } } return false; }</code><technical_language>Please IMongoDBAttributes.PASSWORD instead</technical_language>

Target:
public boolean updateNoSqlConnection(Connection connection) throws Exception{ if (isNoSQLConnection(connection)) { NoSQLConnection noSqlConn = (NoSQLConnection)connection; String pass = noSqlConn.getAttributes().get(IMongoDBAttributes.PASSWORD); if(pass != null) { pass = PasswordMigrationUtil.encryptPasswordIfNeeded(pass); noSqlConn.getAttributes().put(IMongoDBAttributes.PASSWORD, noSqlConn.getValue(pass, true)); return true; } } return false; }