auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void validateInputFields(Schema inputSchema) { <START> if (!inputSchema.getFields().toString().contains(conf.getKeyField())) { <END> throw new IllegalArgumentException( String.format("Cannot denormalize using this field '%s' as it does not exist in input schema %s", conf.getKeyField(), inputSchema)); } else if (!inputSchema.getFields().toString().contains(conf.getFieldName())) { throw new IllegalArgumentException( String.format("Cannot find field '%s' in input schema %s", conf.getFieldName(), inputSchema)); } else if (!inputSchema.getFields().toString().contains(conf.getFieldValue())) { throw new IllegalArgumentException( String.format("Cannot find field '%s' in input schema %s", conf.getFieldValue(), inputSchema)); } }</code><technical_language>checking if a field exists in schema .toString() a list checking key field is part of string, get false positives way. Instead, need iterate list check configured key field matches of field names</technical_language>

Target:
private void validateInputFields(Schema inputSchema) { if (inputSchema.getField(conf.getKeyField()) == null) { throw new IllegalArgumentException( String.format("Keyfield '%s' does not exist in input schema %s", conf.getKeyField(), inputSchema)); } else if (inputSchema.getField(conf.getNameField()) == null) { throw new IllegalArgumentException( String.format("Namefield '%s' does not exist in input schema %s", conf.getNameField(), inputSchema)); } else if (inputSchema.getField(conf.getValueField()) == null) { throw new IllegalArgumentException( String.format("Valuefield '%s' does not exist in input schema %s", conf.getValueField(), inputSchema)); } Schema keyFieldSchema = inputSchema.getField(conf.getKeyField()).getSchema(); Schema nameFieldSchema = inputSchema.getField(conf.getNameField()).getSchema(); Schema valueFieldSchema = inputSchema.getField(conf.getValueField()).getSchema(); if (!((keyFieldSchema.isNullable() ? keyFieldSchema.getNonNullable().getType() : keyFieldSchema .getType()).equals(Schema.Type.STRING))) { throw new IllegalArgumentException( String.format("Keyfield '%s' in the input record must be of type String or Nullable String", conf.getKeyField())); } else if (!((nameFieldSchema.isNullable() ? nameFieldSchema.getNonNullable().getType() : nameFieldSchema .getType()).equals(Schema.Type.STRING))) { throw new IllegalArgumentException( String.format("Namefield '%s' in the input record must be of type String or Nullable String", conf.getNameField())); } else if (!((valueFieldSchema.isNullable() ? valueFieldSchema.getNonNullable().getType() : valueFieldSchema .getType()).equals(Schema.Type.STRING))) { throw new IllegalArgumentException( String.format("Valuefield '%s' in the input record must be of type String or Nullable String", conf.getValueField())); } }
Source:
<code><START> private void execute(TopicPartition topicPart) throws IOException { <END> Queue<SinkRecord> records = buffer.get(topicPart); while(!records.isEmpty()) { try { switch (states.get(topicPart)) { case RECOVERY_STARTED: pause(topicPart); nextState(topicPart); case RECOVERY_PARTITION_PAUSED: createWAL(topicPart); nextState(topicPart); case WAL_CREATED: applyWAL(topicPart); nextState(topicPart); case WAL_APPLIED: truncateWAL(topicPart); nextState(topicPart); case WAL_TRUNCATED: resetOffsets(topicPart); nextState(topicPart); case OFFSET_RESET: resume(topicPart); nextState(topicPart); case WRITE_STARTED: pause(topicPart); nextState(topicPart); case WRITE_PARTITION_PAUSED: writeRecord(topicPart, records.peek()); records.poll(); if (shouldRotate(topicPart)) { nextState(topicPart); } else { break; } case SHOULD_ROTATE: closeTempfile(topicPart); nextState(topicPart); case TEMP_FILE_CLOSED: appendToWAL(topicPart); nextState(topicPart); case WAL_APPENDED: commitFile(topicPart); nextState(topicPart); case FILE_COMMITTED: setState(topicPart, State.WRITE_PARTITION_PAUSED); } resume(topicPart); } catch (IllegalWorkerStateException e) { throw e; } catch (IOException | CopycatException e) { log.error("Exception on {}", topicPart); setRetryBackoff(backOffMs); break; } } }</code><technical_language>This turned out great, I easy understand get retries work properly this code</technical_language>

Target:
private void execute(TopicPartition topicPart) throws IOException { Queue<SinkRecord> records = buffer.get(topicPart); if (states.get(topicPart).compareTo(State.WRITE_STARTED) < 0) { recover(topicPart); } while(!records.isEmpty()) { try { switch (states.get(topicPart)) { case WRITE_STARTED: pause(topicPart); nextState(topicPart); case WRITE_PARTITION_PAUSED: writeRecord(topicPart, records.peek()); records.poll(); if (shouldRotate(topicPart)) { nextState(topicPart); } else { break; } case SHOULD_ROTATE: closeTempfile(topicPart); nextState(topicPart); case TEMP_FILE_CLOSED: appendToWAL(topicPart); nextState(topicPart); case WAL_APPENDED: commitFile(topicPart); nextState(topicPart); case FILE_COMMITTED: setState(topicPart, State.WRITE_PARTITION_PAUSED); break; default: log.error("{} is not a valid state to write record.", states.get(topicPart)); } } catch (IllegalWorkerStateException e) { throw e; } catch (IOException | CopycatException e) { log.error("Exception on {}", topicPart); recordFailureTime(topicPart); setRetryBackoff(backOffMs); break; } } if (records.isEmpty()) { resume(topicPart); setState(topicPart, State.WRITE_STARTED); } }
Source:
<code>public void testAuditLogTypeValueUniqueness() { BitSet bitset = new BitSet(bitSetSize); Set<Integer> nonUniqueValues = new TreeSet<>(); for (ActionType <START> vat : <END> ActionType.values()) { if (bitset.get(vat.getValue())) { nonUniqueValues.add(vat.getValue()); } else { bitset.set(vat.getValue()); } } assertTrue("ActionType contains the following non unique values: " + nonUniqueValues, nonUniqueValues.isEmpty()); }</code><technical_language>vat is longer acronym of tested class. please rename vat 'at' 'actionType'</technical_language>

Target:
public void testAuditLogTypeValueUniqueness() { BitSet bitset = new BitSet(bitSetSize); Set<Integer> nonUniqueValues = new TreeSet<>(); for (ActionType at : ActionType.values()) { if (bitset.get(at.getValue())) { nonUniqueValues.add(at.getValue()); } else { bitset.set(at.getValue()); } } assertTrue("ActionType contains the following non unique values: " + nonUniqueValues, nonUniqueValues.isEmpty()); }
Source:
<code>public void visit(NodeTraversal t, Node n, Node parent) { if (NodeUtil.isNameDeclaration(n)) { Node node = n.getFirstFirstChild(); if (node == null) { return; } if (node.isCall() && node.getFirstChild().matchesQualifiedName("goog.require")) { Node callNode = node; String requiredNamespace = callNode.getLastChild().getString(); String localName = n.getFirstChild().getQualifiedName(); convertRequireToImportStatements( n, Collections.singletonList(localName), requiredNamespace, false); return; } if (node.isObjectPattern() && node.getNext().getFirstChild() != null && node.getNext().getFirstChild().matchesQualifiedName("goog.require")) { Node importedNode = node.getFirstChild(); List<String> namedExports = new ArrayList(); while (importedNode != null) { namedExports.add(importedNode.getString()); importedNode = importedNode.getNext(); } String requiredNamespace = node.getNext().getFirstChild().getNext().getString(); <START> requiredNamespace += "." + namedExports.get(0); <END> convertRequireToImportStatements(n, namedExports, requiredNamespace, true); return; } } else if (n.isExprResult()) { Node callNode = n.getFirstChild(); if (callNode == null || !callNode.isCall()) { return; } if (callNode.getFirstChild().matchesQualifiedName("goog.require")) { String requiredNamespace = callNode.getLastChild().getString(); convertRequireToImportStatements( n, Collections.singletonList(requiredNamespace), requiredNamespace, false); return; } } }</code><technical_language>is safe element here</technical_language>

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (NodeUtil.isNameDeclaration(n)) { Node node = n.getFirstFirstChild(); if (node == null) { return; } if (node.isCall() && node.getFirstChild().matchesQualifiedName("goog.require")) { Node callNode = node; String requiredNamespace = callNode.getLastChild().getString(); String localName = n.getFirstChild().getQualifiedName(); convertRequireToImportStatements( n, Collections.singletonList(localName), requiredNamespace, false); return; } if (node.isObjectPattern() && node.getNext().getFirstChild() != null && node.getNext().getFirstChild().matchesQualifiedName("goog.require")) { Node importedNode = node.getFirstChild(); List<String> namedExports = new ArrayList(); while (importedNode != null) { namedExports.add(importedNode.getString()); importedNode = importedNode.getNext(); } String requiredNamespace = node.getNext().getFirstChild().getNext().getString(); convertRequireToImportStatements(n, namedExports, requiredNamespace, true); return; } } else if (n.isExprResult()) { Node callNode = n.getFirstChild(); if (callNode == null || !callNode.isCall()) { return; } if (callNode.getFirstChild().matchesQualifiedName("goog.require")) { String requiredNamespace = callNode.getLastChild().getString(); convertRequireToImportStatements( n, Collections.singletonList(requiredNamespace), requiredNamespace, false); return; } } }
Source:
<code>public int concurrencyKey() { <START> return (int) key; <END> }</code><technical_language>This needs changed return long value</technical_language>

Target:
public long concurrencyKey() { return key; }
Source:
<code>static String applyModifiers(final String label, final List<String> parts, final int offset) { String resultingLabel = label; for (int j = offset; j < parts.size(); j++) { String modifier = parts.get(j); if ("abbr".equals(modifier)) { StringBuilder abbreviateSB = new StringBuilder(); String[] words = resultingLabel.replaceAll("[\\{\\}']", "") .split("[\\(\\) \r\n\"]"); for (String word : words) { if (!word.isEmpty()) { abbreviateSB.append(word.charAt(0)); } } resultingLabel = abbreviateSB.toString(); } else if (modifier.matches("truncate[\\d]+")) { <START> int N = Integer.parseInt(modifier.substring(8)); <END> N = Math.min(N, resultingLabel.length()); resultingLabel = resultingLabel.substring(0, N).stripTrailing(); } else { Optional<Formatter> formatter = Formatters.getFormatterForModifier(modifier); if (formatter.isPresent()) { resultingLabel = formatter.get().format(resultingLabel); } else if (!modifier.isEmpty() && (modifier.length() >= 2) && (modifier.charAt(0) == '(') && modifier.endsWith(")")) { if (label.isEmpty() && (modifier.length() > 2)) { resultingLabel = modifier.substring(1, modifier.length() - 1); } } else { LOGGER.warn("Key generator warning: unknown modifier '" + modifier + "'."); } } } return resultingLabel; }</code><technical_language>Check style complain in Java, variables camel case</technical_language>

Target:
static String applyModifiers(final String label, final List<String> parts, final int offset) { String resultingLabel = label; for (int j = offset; j < parts.size(); j++) { String modifier = parts.get(j); if ("abbr".equals(modifier)) { StringBuilder abbreviateSB = new StringBuilder(); String[] words = resultingLabel.replaceAll("[\\{\\}']", "") .split("[\\(\\) \r\n\"]"); for (String word : words) { if (!word.isEmpty()) { abbreviateSB.append(word.charAt(0)); } } resultingLabel = abbreviateSB.toString(); } else { Optional<Formatter> formatter = Formatters.getFormatterForModifier(modifier); if (formatter.isPresent()) { resultingLabel = formatter.get().format(resultingLabel); } else if (!modifier.isEmpty() && (modifier.length() >= 2) && (modifier.charAt(0) == '(') && modifier.endsWith(")")) { if (label.isEmpty() && (modifier.length() > 2)) { resultingLabel = modifier.substring(1, modifier.length() - 1); } } else { LOGGER.warn("Key generator warning: unknown modifier '" + modifier + "'."); } } } return resultingLabel; }
Source:
<code>public void prefixTrim(final Token address) { log.info("PrefixTrim[{}]", address); final int numRetries = 3; for (int x = 0; x < numRetries; x++) { try { layoutHelper(e -> { e.getLayout().getPrefixSegments(address.getSequence()).stream() .flatMap(seg -> seg.getStripes().stream()) .flatMap(stripe -> stripe.getLogServers().stream()) .map(e::getLogUnitClient) .map(client -> client.prefixTrim(address)) .forEach(CFUtils::getUninterruptibly); return null; }, true); runtime.getSequencerView().trimCache(address.getSequence()); break; } catch (NetworkException | TimeoutException e) { log.warn("prefixTrim: encountered a network error on try {}", x, e); Duration retryRate = runtime.getParameters().getConnectionRetryRate(); Sleep.sleepUninterruptibly(retryRate); <START> } catch (RuntimeException re) { <END> if (re.getCause().getClass().equals(WrongEpochException.class)) { log.warn("prefixTrim[{}]: wrongEpochException", address); long runtimeEpoch = runtime.getLayoutView().getLayout().getEpoch(); long serverEpoch = ((WrongEpochException)re.getCause()).getCorrectEpoch(); if (runtimeEpoch != serverEpoch) { log.warn("prefixTrim[{}]: wrongEpochException, runtime is in epoch {}, " + "while server is in epoch {}. Invalidate layout for this client and retry.", address, runtimeEpoch, serverEpoch); runtime.invalidateLayout(); } else { throw re; } } else { throw re; } } } }</code><technical_language>I catch RuntimeException WrongEpochException server return correct error message, fails "uncaught exception handler" wraps throwable in a RuntimeException sends need unwrap such. I fix server side catch WrongEpochException</technical_language>

Target:
public void prefixTrim(final Token address) { log.info("PrefixTrim[{}]", address); final int numRetries = 3; for (int x = 0; x < numRetries; x++) { try { layoutHelper(e -> { e.getLayout().getPrefixSegments(address.getSequence()).stream() .flatMap(seg -> seg.getStripes().stream()) .flatMap(stripe -> stripe.getLogServers().stream()) .map(e::getLogUnitClient) .map(client -> client.prefixTrim(address)) .forEach(cf -> {CFUtils.getUninterruptibly(cf, NetworkException.class, TimeoutException.class, WrongEpochException.class); }); return null; }, true); runtime.getSequencerView().trimCache(address.getSequence()); break; } catch (NetworkException | TimeoutException e) { log.warn("prefixTrim: encountered a network error on try {}", x, e); Duration retryRate = runtime.getParameters().getConnectionRetryRate(); Sleep.sleepUninterruptibly(retryRate); } catch (WrongEpochException wee) { long serverEpoch = wee.getCorrectEpoch(); if (address.getEpoch() == serverEpoch) { long runtimeEpoch = runtime.getLayoutView().getLayout().getEpoch(); log.warn("prefixTrim[{}]: wrongEpochException, runtime is in epoch {}, " + "while server is in epoch {}. Invalidate layout for this client " + "and retry, attempt: {}/{}", address, runtimeEpoch, serverEpoch, x+1, numRetries); runtime.invalidateLayout(); } else { log.error("prefixTrim[{}]: stale prefix trim. Prefix trim on wrong epoch {}, " + "while server on epoch {}", address, address.getEpoch(), serverEpoch); throw wee; } } } }
Source:
<code>private void flushReplicationStream(FlushAction action) throws Exception { action.reset(); replicationStream.execute(action); <START> if (!action.await(this.timeout, TimeUnit.MILLISECONDS)) { <END> throw ActiveMQMessageBundle.BUNDLE.replicationSynchronizationTimeout(timeout); } }</code><technical_language>I typo other around? action.await(initialReplicationSynctimeout) ??</technical_language>

Target:
private void flushReplicationStream(FlushAction action) throws Exception { action.reset(); replicationStream.execute(action); if (!action.await(this.initialReplicationSyncTimeout, TimeUnit.MILLISECONDS)) { throw ActiveMQMessageBundle.BUNDLE.replicationSynchronizationTimeout(initialReplicationSyncTimeout); } }
Source:
<code><START> protected void updatePlayer(Server server, CommandSource sender, User user, String[] args) throws NotEnoughArgumentsException, PlayerExemptException, ChargeException, MaxMoneyException { <END> }</code><technical_language>prefer keeping this abstract, in places, cases unused implement empty method</technical_language>

Target:
protected abstract void updatePlayer(Server server, CommandSource sender, User user, String[] args) throws NotEnoughArgumentsException, PlayerExemptException, ChargeException, MaxMoneyException; @Override protected List<String> getPlayers(final Server server, final CommandSource interactor) { List<String> players = super.getPlayers(server, interactor); players.add("**"); players.add("*"); return players; }
Source:
<code>public static void parseAndReact(@NonNull Activity activity, @NonNull JSONObject paramsJson) throws JSONException { logger.debug("DeepLink received. JSON Details:\n" + paramsJson); final Router router = new Router(); final boolean isLoggedIn = new LoginPrefs(activity).getUsername() != null; if (!isLoggedIn) { activity.startActivity(router.getLogInIntent()); } else { @ScreenDef final String screenName = paramsJson.getString(KEY_SCREEN_NAME); switch (screenName) { case Screen.COURSE_DASHBOARD: { final String courseId = paramsJson.getString(KEY_COURSE_ID); router.showCourseDashboardTabs(activity, null, courseId, false); break; } case Screen.COURSE_VIDEOS: { final String courseId = paramsJson.getString(KEY_COURSE_ID); router.showCourseDashboardTabs(activity, null, courseId, false, screenName); break; } <START> <END> case Screen.PROGRAM: { router.showMainDashboard(activity, screenName); break; } } } }</code><technical_language>need for this new line</technical_language>

Target:
public static void parseAndReact(@NonNull Activity activity, @NonNull JSONObject paramsJson) throws JSONException { logger.debug("DeepLink received. JSON Details:\n" + paramsJson); final Router router = new Router(); final boolean isLoggedIn = new LoginPrefs(activity).getUsername() != null; if (!isLoggedIn) { activity.startActivity(router.getLogInIntent()); } else { @ScreenDef final String screenName = paramsJson.getString(KEY_SCREEN_NAME); switch (screenName) { case Screen.COURSE_DASHBOARD: case Screen.COURSE_VIDEOS: { final String courseId = paramsJson.getString(KEY_COURSE_ID); router.showCourseDashboardTabs(activity, null, courseId, false, screenName); break; } case Screen.PROGRAM: { router.showMainDashboard(activity, screenName); break; } } } }
Source:
<code>public FileSystemSecurityRealm(final Path root, final NameRewriter nameRewriter, final int levels, final boolean encoded, final Encoding hashEncoding, final Charset hashCharset) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(CREATE_SECURITY_REALM); } this.root = root; this.nameRewriter = nameRewriter; this.levels = levels; this.encoded = encoded; this.hashCharset = hashCharset; <START> this.hashEncoding = hashEncoding; <END> }</code><technical_language>check for null for of set default if null</technical_language>

Target:
public FileSystemSecurityRealm(final Path root, final NameRewriter nameRewriter, final int levels, final boolean encoded, final Encoding hashEncoding, final Charset hashCharset) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(CREATE_SECURITY_REALM); } this.root = root; this.nameRewriter = nameRewriter; this.levels = levels; this.encoded = encoded; this.hashCharset = hashCharset != null ? hashCharset : StandardCharsets.UTF_8; this.hashEncoding = hashEncoding != null ? hashEncoding : Encoding.BASE64; }
Source:
<code>public Response add(VM vm) { validateParameters(vm, "name", "cluster.id|name"); validateEnums(VM.class, vm); Response response = null; if (isCreateFromSnapshot(vm)) { response = createVmFromSnapshot(vm); } else { validateParameters(vm, "template.id|name"); Guid templateId = getTemplateId(vm); VmStatic staticVm = getMapper(VM.class, VmStatic.class).map(vm, getMapper(VmTemplate.class, VmStatic.class).map(lookupTemplate(templateId), null)); if (namedCluster(vm)) { staticVm.setvds_group_id(getClusterId(vm)); } UsbPolicy usbPolicy = UsbResourceUtils.getUsbPolicy(vm.getUsb(), lookupCluster(staticVm.getvds_group_id())); if (usbPolicy != null) { staticVm.setusb_policy(usbPolicy); } if (!isFiltered()) { if (vm.isSetPlacementPolicy() && vm.getPlacementPolicy().isSetHost() && vm.getPlacementPolicy().getHost().isSetName() && !vm.getPlacementPolicy().getHost().isSetId()) { <START> staticVm.setdedicated_vm_for_vds(createGuidFromString(getHostId(vm.getPlacementPolicy().getHost().getName()))); <END> } } else { vm.setPlacementPolicy(null); } Guid storageDomainId = (vm.isSetStorageDomain() && vm.getStorageDomain().isSetId()) ? asGuid(vm.getStorageDomain().getId()) : Guid.Empty; if (vm.isSetDisks() && vm.getDisks().isSetClone() && vm.getDisks().isClone()) { response = cloneVmFromTemplate(staticVm, vm, templateId); } else if (Guid.Empty.equals(templateId)) { response = addVmFromScratch(staticVm, vm, storageDomainId); } else { response = addVm(staticVm, vm, storageDomainId, templateId); } } return removeRestrictedInfoFromResponse(response); }</code><technical_language>please asGuid() instead</technical_language>

Target:
public Response add(VM vm) { validateParameters(vm, "name", "cluster.id|name"); validateEnums(VM.class, vm); Response response = null; if (isCreateFromSnapshot(vm)) { response = createVmFromSnapshot(vm); } else { validateParameters(vm, "template.id|name"); Guid templateId = getTemplateId(vm); VmStatic staticVm = getMapper(VM.class, VmStatic.class).map(vm, getMapper(VmTemplate.class, VmStatic.class).map(lookupTemplate(templateId), null)); if (namedCluster(vm)) { staticVm.setvds_group_id(getClusterId(vm)); } UsbPolicy usbPolicy = UsbResourceUtils.getUsbPolicy(vm.getUsb(), lookupCluster(staticVm.getvds_group_id())); if (usbPolicy != null) { staticVm.setusb_policy(usbPolicy); } if (!isFiltered()) { if (vm.isSetPlacementPolicy() && vm.getPlacementPolicy().isSetHost() && vm.getPlacementPolicy().getHost().isSetName() && !vm.getPlacementPolicy().getHost().isSetId()) { staticVm.setdedicated_vm_for_vds(asGuid(getHostId(vm.getPlacementPolicy().getHost().getName()))); } } else { vm.setPlacementPolicy(null); } Guid storageDomainId = (vm.isSetStorageDomain() && vm.getStorageDomain().isSetId()) ? asGuid(vm.getStorageDomain().getId()) : Guid.Empty; if (vm.isSetDisks() && vm.getDisks().isSetClone() && vm.getDisks().isClone()) { response = cloneVmFromTemplate(staticVm, vm, templateId); } else if (Guid.Empty.equals(templateId)) { response = addVmFromScratch(staticVm, vm, storageDomainId); } else { response = addVm(staticVm, vm, storageDomainId, templateId); } } return removeRestrictedInfoFromResponse(response); }
Source:
<code>private static void saveHighlights(InputFile file, SensorContext context, AnalysisResponseHighlight[] highlights) { NewHighlighting highlighting = context.newHighlighting().onFile(file); for (AnalysisResponseHighlight highlight : highlights) { highlighting.highlight(highlight.startLine, highlight.startCol, highlight.endLine, highlight.endCol, <START> TypeOfText.valueOf(highlight.textType.toUpperCase(Locale.ENGLISH))); <END> } highlighting.save(); }</code><technical_language>avoid this conversion sending uppercase constants in response</technical_language>

Target:
private static void saveHighlights(InputFile file, SensorContext context, AnalysisResponseHighlight[] highlights) { NewHighlighting highlighting = context.newHighlighting().onFile(file); for (AnalysisResponseHighlight highlight : highlights) { highlighting.highlight(highlight.startLine, highlight.startCol, highlight.endLine, highlight.endCol, TypeOfText.valueOf(highlight.textType)); } highlighting.save(); }
Source:
<code>private String getAttributeValue(ProjectDescriptor projectDescriptor, String value) { List<String> attributes = projectDescriptor.getAttributes().get(value); <START> if (attributes == null || attributes.isEmpty()) { <END> return ""; } return projectDescriptor.getAttributes().get(value).get(0); }</code><technical_language>I Strings.isNullOrEmpty</technical_language>

Target:
private String getAttributeValue(ProjectDescriptor projectDescriptor, String value) { List<String> attributes = projectDescriptor.getAttributes().get(value); if (attributes == null || attributes.isEmpty()) { return null; } return projectDescriptor.getAttributes().get(value).get(0); }
Source:
<code>public void passesSafeHoursCorrectly() throws InterruptedException { Supplier<Boolean> alternatingSupplier = new Supplier<Boolean>() { Boolean nextValue = true; @Override public Boolean get() { Boolean toReturn = nextValue; nextValue = !nextValue; return toReturn; } <START> }; <END> BackgroundCompactor backgroundCompactor = new BackgroundCompactor(txManager, kvs, mock(LockService.class), alternatingSupplier, priorityCalculator); BackgroundCompactor.CompactionOutcome firstOutcome = backgroundCompactor.grabLockAndRunOnce(lockService); verify(kvs).compactInternally(TABLE, true); BackgroundCompactor.CompactionOutcome secondOutcome = backgroundCompactor.grabLockAndRunOnce(lockService); verify(kvs).compactInternally(TABLE, false); assertThat(firstOutcome).isEqualTo(BackgroundCompactor.CompactionOutcome.SUCCESS); assertThat(secondOutcome).isEqualTo(BackgroundCompactor.CompactionOutcome.SUCCESS); verifyNoMoreInteractions(kvs); }</code><technical_language>nit: This written Stream.iterate(true, bool -> !bool).iterator()::next; I</technical_language>

Target:
public void passesSafeHoursCorrectly() throws InterruptedException { BackgroundCompactor backgroundCompactor = new BackgroundCompactor(txManager, kvs, mock(LockService.class), Stream.iterate(true, bool -> !bool).iterator()::next, priorityCalculator); BackgroundCompactor.CompactionOutcome firstOutcome = backgroundCompactor.grabLockAndRunOnce(lockService); verify(kvs).compactInternally(TABLE, true); BackgroundCompactor.CompactionOutcome secondOutcome = backgroundCompactor.grabLockAndRunOnce(lockService); verify(kvs).compactInternally(TABLE, false); assertThat(firstOutcome).isEqualTo(BackgroundCompactor.CompactionOutcome.SUCCESS); assertThat(secondOutcome).isEqualTo(BackgroundCompactor.CompactionOutcome.SUCCESS); verifyNoMoreInteractions(kvs); }
Source:
<code>String toString(final InputStream inputStream) { try { <START> final ByteArrayOutputStream result = new ByteArrayOutputStream(); <END> final byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } catch (IOException ioe) { } return null; }</code><technical_language>I try resources used</technical_language>

Target:
String toString(final InputStream inputStream) { try (InputStream inputStreamAutoClosable = inputStream; ByteArrayOutputStream result = new ByteArrayOutputStream()) { final byte[] buffer = new byte[1024]; int length; while ((length = inputStreamAutoClosable.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } catch (IOException ioe) { } return null; }
Source:
<code>public void happyPath() throws Exception { context.checking(new Expectations() {{ oneOf(catalog).isSupported(256); will(returnValue(true)); never(constraintValidator).buildConstraintViolationWithTemplate(with(any(String.class))); }}); <START> boolean isValid = validator.isValid(Sets.newHashSet(256), constraintValidator); <END> assertTrue(isValid); }</code><technical_language>create a variable for set</technical_language>

Target:
public void happyPath() throws Exception { context.checking(new Expectations() {{ oneOf(catalog).isSupported(256); will(returnValue(true)); never(constraintValidator).buildConstraintViolationWithTemplate(with(any(String.class))); }}); List<Integer> ids = Lists.newArrayList(256); boolean isValid = validator.isValid(ids, constraintValidator); assertTrue(isValid); }
Source:
<code>public void testPodServiceAccountName() { <START> assertThat(TASK_MANAGER_SERVICE_ACCOUNT_NAME, is(this.resultPod.getSpec().getServiceAccountName())); <END> }</code><technical_language>suggestion assertThat(this.resultPod.getSpec().getServiceAccountName(), is(TASK_MANAGER_SERVICE_ACCOUNT_NAME)); util method is defined follows. Out-of-ordered arguments lead improper error messages. public static <T> void assertThat(T actual, Matcher<? super T> matcher)</technical_language>

Target:
public void testPodServiceAccountName() { assertThat(this.resultPod.getSpec().getServiceAccountName(), is(TASK_MANAGER_SERVICE_ACCOUNT_NAME)); }
Source:
<code>public void testFileUpdateTestTable() throws Exception { final String xml = loadResource("Update Test Table.gdst"); final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml); final DecisionTableAnalyzer analyzer = getDecisionTableAnalyzer(table52); analyzer.onValidate(new ValidateEvent(new HashMap<Coordinate, List<List<CellValue<? extends Comparable<?>>>>>())); assertContains("RedundantRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(false); update(analyzer, new Coordinate(0, 3)); assertContains("ConflictingRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(true); update(analyzer, new Coordinate(0, 3)); List<Issue> analysisData = analysisReport.getAnalysisData(); for (Issue issue : analysisData) { <START> System.out.println(issue.toString()); <END> } assertContains("RedundantRows", analysisReport); }</code><technical_language>I omit this for cycle System.out.println()</technical_language>

Target:
public void testFileUpdateTestTable() throws Exception { final String xml = loadResource("Update Test Table.gdst"); final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml); final DecisionTableAnalyzer analyzer = getDecisionTableAnalyzer(table52); analyzer.onValidate(new ValidateEvent(new HashMap<Coordinate, List<List<CellValue<? extends Comparable<?>>>>>())); assertContains("RedundantRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(false); update(analyzer, new Coordinate(0, 3)); assertContains("ConflictingRows", analysisReport); table52.getData().get(0).get(3).setBooleanValue(true); update(analyzer, new Coordinate(0, 3)); assertContains("RedundantRows", analysisReport); assertEquals(1, analysisReport.getAnalysisData().size()); }
Source:
<code>protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setClusterId(parameterMasterVm.getClusterId()); if (VmDeviceUtils.shouldOverrideSoundDevice( getParameters().getMasterVm(), <START> CompatibilityVersionUtils.getEffective(parameterMasterVm, getCluster()), <END> getParameters().isSoundDeviceEnabled())) { parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getCluster()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getCluster(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getCluster() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getCluster().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }</code><technical_language>a look, I do this getVm()==null (in import glance flow), user try create a template rest-api custom-compatility version incorrect version. bottom line, done this if getVm()==null</technical_language>

Target:
protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setClusterId(parameterMasterVm.getClusterId()); if (VmDeviceUtils.shouldOverrideSoundDevice( getParameters().getMasterVm(), getVm() == null ? CompatibilityVersionUtils.getEffective(parameterMasterVm, getCluster()) : getVm().getCompatibilityVersion(), getParameters().isSoundDeviceEnabled())) { parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getCluster()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getCluster(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getCluster() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getCluster().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }
Source:
<code>public IdentifierRules identifierRules() { if (identifierRules.get() == null) { if (defaultIdentifierRules != null && connections.peek() == null) { <START> return defaultIdentifierRules; <END> } try (Connection connection = getConnection()) { DatabaseMetaData metaData = connection.getMetaData(); String leadingQuoteStr = metaData.getIdentifierQuoteString(); String trailingQuoteStr = leadingQuoteStr; String separator = metaData.getCatalogSeparator(); if (leadingQuoteStr == null || leadingQuoteStr.isEmpty()) { leadingQuoteStr = defaultIdentifierRules.leadingQuoteString(); trailingQuoteStr = defaultIdentifierRules.trailingQuoteString(); } if (separator == null || separator.isEmpty()) { separator = defaultIdentifierRules.identifierDelimiter(); } identifierRules.set(new IdentifierRules(separator, leadingQuoteStr, trailingQuoteStr)); } catch (SQLException e) { if (defaultIdentifierRules != null) { identifierRules.set(defaultIdentifierRules); log.warn("Unable to get identifier metadata; using default rules", e); } else { throw new ConnectException("Unable to get identifier metadata", e); } } } return identifierRules.get(); }</code><technical_language>a user, strange if identifier rules based a connection is established not. Is a reason throw Exception? least, want log a warning here</technical_language>

Target:
public IdentifierRules identifierRules() { if (identifierRules.get() == null) { try (Connection connection = getConnection()) { DatabaseMetaData metaData = connection.getMetaData(); String leadingQuoteStr = metaData.getIdentifierQuoteString(); String trailingQuoteStr = leadingQuoteStr; String separator = metaData.getCatalogSeparator(); if (leadingQuoteStr == null || leadingQuoteStr.isEmpty()) { leadingQuoteStr = defaultIdentifierRules.leadingQuoteString(); trailingQuoteStr = defaultIdentifierRules.trailingQuoteString(); } if (separator == null || separator.isEmpty()) { separator = defaultIdentifierRules.identifierDelimiter(); } identifierRules.set(new IdentifierRules(separator, leadingQuoteStr, trailingQuoteStr)); } catch (SQLException e) { if (defaultIdentifierRules != null) { identifierRules.set(defaultIdentifierRules); log.warn("Unable to get identifier metadata; using default rules", e); } else { throw new ConnectException("Unable to get identifier metadata", e); } } } return identifierRules.get(); }
Source:
<code>private void add(@NotNull Value value) { Preconditions.checkArgument(value != null, "value cannot be null"); if(summary.empty) summary.empty = false; if(value.isSequence()) { if(value.isNull()) { summary.frequencyDist.addValue(NULL_NAME); } else { for(Value v : value.asSequence().getValue()) { add(v); } } } else { summary.frequencyDist.addValue(value.isNull() ? NULL_NAME : NOT_NULL_NAME); if(!value.isNull()) { if(value.getValueType() == PointType.get()) { coords.add((Coordinate) value.getValue()); } else if(value.getValueType() == LineStringType.get()) { coords.addAll((Collection<Coordinate>) value.getValue()); } else if(value.getValueType() == PolygonType.get()) { Collection<List<Coordinate>> coordinateList = (Collection<java.util.List<Coordinate>>) value.getValue(); for(List<Coordinate> coordinate : coordinateList) { coords.addAll(coordinate); } } } } <START> } <END></code><technical_language>a lot of lines ifs... i a bad findbugs feeling..</technical_language>

Target:
private void add(@NotNull Value value) { Preconditions.checkArgument(value != null, "value cannot be null"); if(summary.empty) summary.empty = false; if(value.isSequence()) { if(value.isNull()) { summary.frequencyDist.addValue(NULL_NAME); } else { for(Value v : value.asSequence().getValue()) { add(v); } } } else { summary.frequencyDist.addValue(value.isNull() ? NULL_NAME : NOT_NULL_NAME); if(!value.isNull()) { getCoordinates(value); } } }
Source:
<code>public void testInsertSortedBucketedTable() { String tableName = "test_insert_sorted_bucketed_table"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(id int, name varchar, ds varchar) " + "WITH (" + "bucketed_by = ARRAY[ 'id' ], " + "bucket_count = 11, " + "sorted_by = ARRAY[ '+name' ]" + ")"; assertUpdate(createTable); try { assertUpdate( "INSERT INTO " + tableName + " " + "VALUES " + " (1, VARCHAR 'b', VARCHAR 'c'), " + " (2, 'bb', 'cc'), " + " (3, 'bbb', 'ccc')", 3); fail("expected failure"); } catch (Exception e) { <START> assertEquals(e.getMessage(), format("Inserting into bucketed sorted tables is not supported. Table 'tpch.%s'", tableName)); <END> } assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }</code><technical_language>If message is expect (e.g. NPE null message), exception raised test useful. org.assertj.core.api.Assertions#assertThatThrownBy: assertThatThrownBy(() -> assertUpdate(...)) .hasMessage(...)</technical_language>

Target:
public void testInsertSortedBucketedTable() { String tableName = "test_insert_sorted_bucketed_table"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(id int, name varchar, ds varchar) " + "WITH (" + "bucketed_by = ARRAY['id'], " + "bucket_count = 11, " + "sorted_by = ARRAY['+name']" + ")"; assertUpdate(createTable); assertThatThrownBy(() -> assertUpdate("INSERT INTO " + tableName + " VALUES (1, VARCHAR 'b', VARCHAR 'c')", 1)) .hasMessage(format("Inserting into bucketed sorted tables is not supported. Table 'tpch.%s'", tableName)); assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }
Source:
<code>public void onDetach() { super.onDetach(); <START> if (EventBus.getDefault().isRegistered(this)) <END> EventBus.getDefault().unregister(this); }</code><technical_language>wrap if condition block brackets</technical_language>

Target:
public void onDetach() { super.onDetach(); if (EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().unregister(this); } }
Source:
<code>public static void loadPropertiesFromResources(String path) throws IOException { if (instance == null) { instance = getConfigInstance(); } ClassLoader loader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = loader.getResources(path); if (!resources.hasMoreElements()) { throw new IOException("Cannot locate " + path + " as a classpath resource."); } while (resources.hasMoreElements()) { URL url = resources.nextElement(); Properties props = new Properties(); InputStream fin = url.openStream(); InputStreamReader reader = new InputStreamReader(fin, "UTF-8"); try { props.load(reader); } finally { if (reader != null) { reader.close(); } <START> if (fin != null) { <END> fin.close(); } } if (instance instanceof AggregatedConfiguration) { String name = getConfigName(url); ConcurrentMapConfiguration config = new ConcurrentMapConfiguration(); config.loadProperties(props); ((AggregatedConfiguration) instance).addConfiguration(config, name); } else { ConfigurationUtils.loadProperties(props, instance); } } }</code><technical_language>fin null</technical_language>

Target:
public static void loadPropertiesFromResources(String path) throws IOException { if (instance == null) { instance = getConfigInstance(); } ClassLoader loader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = loader.getResources(path); if (!resources.hasMoreElements()) { throw new IOException("Cannot locate " + path + " as a classpath resource."); } while (resources.hasMoreElements()) { URL url = resources.nextElement(); InputStream fin = url.openStream(); Properties props = ConfigurationUtils.loadPropertiesFromInputStream(fin); if (instance instanceof AggregatedConfiguration) { String name = getConfigName(url); ConcurrentMapConfiguration config = new ConcurrentMapConfiguration(); config.loadProperties(props); ((AggregatedConfiguration) instance).addConfiguration(config, name); } else { ConfigurationUtils.loadProperties(props, instance); } } }
Source:
<code>public boolean hasVisitDuring(Patient patient, Location location, Date startDatetime, Date stopDatetime) { List<VisitDomainWrapper> visits = getVisits(patient, location, startDatetime, stopDatetime); <START> return visits != null && !visits.isEmpty(); <END> }</code><technical_language>I thought changing visits.size() == 0 visits.isEmpty need change visits == null visits != null</technical_language>

Target:
public boolean hasVisitDuring(Patient patient, Location location, Date startDatetime, Date stopDatetime) { List<VisitDomainWrapper> visits = getVisits(patient, location, startDatetime, stopDatetime); return visits == null || visits.isEmpty() ? false : true; }
Source:
<code>public void testFail() { final boolean[] crFlags = new boolean[4]; TmfCoalescedEventRequest request = setupTestRequest(crFlags); TmfEventRequest subRequest1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); TmfEventRequest subRequest2 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); request.addRequest(subRequest1); request.addRequest(subRequest2); <START> request.fail(null); <END> assertTrue("isCompleted", request.isCompleted()); assertTrue("isFailed", request.isFailed()); assertFalse("isCancelled", request.isCancelled()); assertTrue("handleCompleted", crFlags[0]); assertFalse("handleSuccess", crFlags[1]); assertTrue("handleFailure", crFlags[2]); assertFalse("handleCancel", crFlags[3]); assertTrue("isCompleted", subRequest1.isCompleted()); assertTrue("isFailed", subRequest1.isFailed()); assertFalse("isCancelled", subRequest1.isCancelled()); assertTrue("isCompleted", subRequest2.isCompleted()); assertTrue("isFailed", subRequest2.isFailed()); assertFalse("isCancelled", subRequest2.isCancelled()); }</code><technical_language>Provide exception assert test for it</technical_language>

Target:
public void testFail() { final boolean[] crFlags = new boolean[4]; TmfCoalescedEventRequest request = setupTestRequest(crFlags); TmfEventRequest subRequest1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); TmfEventRequest subRequest2 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200); request.addRequest(subRequest1); request.addRequest(subRequest2); request.fail(new IllformedLocaleException("Hi")); assertTrue("isCompleted", request.isCompleted()); assertTrue("isFailed", request.isFailed()); final Throwable failCause = request.getFailCause(); assertNotNull("Cause of failure", failCause); assertEquals("Cause of failure message", "Hi", failCause.getCause().getMessage()); assertFalse("isCancelled", request.isCancelled()); assertTrue("handleCompleted", crFlags[0]); assertFalse("handleSuccess", crFlags[1]); assertTrue("handleFailure", crFlags[2]); assertFalse("handleCancel", crFlags[3]); assertTrue("isCompleted", subRequest1.isCompleted()); assertTrue("isFailed", subRequest1.isFailed()); assertFalse("isCancelled", subRequest1.isCancelled()); assertTrue("isCompleted", subRequest2.isCompleted()); assertTrue("isFailed", subRequest2.isFailed()); assertFalse("isCancelled", subRequest2.isCancelled()); }
Source:
<code>public ConflictHandler get(TableReference tableReference) { <START> ConflictHandler conflictHandler = cache.getUnchecked(tableReference); <END> if (conflictHandler == null) { return ConflictHandler.RETRY_ON_WRITE_WRITE; } else { return conflictHandler; } }</code><technical_language>worth extracting this a constant (e.g. DEFAULT_CONFLICT_HANDLER) referenced 4 times in this file</technical_language>

Target:
public ConflictHandler get(TableReference tableReference) { return cache.getUnchecked(tableReference); }
Source:
<code>protected boolean applyForSingleAttributeValue(Comparable attributeValue) { Set<Comparable> set = convertedInValues; <START> if (attributeValue == null && set == null) { <END> for (Comparable value : values) { if (isNull(value)) { return true; } } return false; } attributeValue = (Comparable) convertEnumValue(attributeValue); if (set == null) { set = createHashSet(values.length); for (Comparable value : values) { Comparable converted = convert(attributeValue, value); set.add(Comparables.canonicalizeForHashLookup(converted)); } convertedInValues = set; } return set.contains(Comparables.canonicalizeForHashLookup(attributeValue)); }</code><technical_language>if IN (null) predicate is applied a sequences of attribute values, is non-null is null? call result in initialising set iteration set.contains() - isNull() for null items in set</technical_language>

Target:
protected boolean applyForSingleAttributeValue(Comparable attributeValue) { Set<Comparable> set = convertedInValues; if (attributeValue == null && set == null) { Boolean valuesContainNull = this.valuesContainNull; if (valuesContainNull != null) { return valuesContainNull; } for (Comparable value : values) { if (isNull(value)) { this.valuesContainNull = true; return true; } } this.valuesContainNull = false; return false; } attributeValue = (Comparable) convertEnumValue(attributeValue); if (set == null) { set = createHashSet(values.length); for (Comparable value : values) { Comparable converted = convert(attributeValue, value); if (isNull(converted)) { converted = null; } set.add(Comparables.canonicalizeForHashLookup(converted)); } convertedInValues = set; } return set.contains(Comparables.canonicalizeForHashLookup(attributeValue)); }
Source:
<code>private boolean isDMNFactMappingValid(String typeName, FactMapping factMapping, DMNType dmnType) { Type rootType = getRootType((BaseDMNTypeImpl) dmnType); boolean isCoherent = UNKNOWN.equals(rootType) || ScenarioSimulationSharedUtils.isList(typeName) == dmnType.isCollection(); if (!isCoherent) { return false; } String factMappingType = ScenarioSimulationSharedUtils.isList(typeName) ? factMapping.getGenericTypes().get(0) : typeName; if (Objects.equals(factMappingType, dmnType.getName())) { return true; } <START> return false; <END> }</code><technical_language>I [1] is [2] [1] java if (Objects.equals(factMappingType, dmnType.getName())) { return true; } return false; [2] java return Objects.equals(factMappingType, dmnType.getName());</technical_language>

Target:
private boolean isDMNFactMappingValid(String typeName, FactMapping factMapping, DMNType dmnType) { Type rootType = getRootType((BaseDMNTypeImpl) dmnType); boolean isCoherent = UNKNOWN.equals(rootType) || ScenarioSimulationSharedUtils.isList(typeName) == dmnType.isCollection(); if (!isCoherent) { return false; } String factMappingType = ScenarioSimulationSharedUtils.isList(typeName) ? factMapping.getGenericTypes().get(0) : typeName; return Objects.equals(factMappingType, dmnType.getName()); }
Source:
<code>protected void finalize() throws Throwable { try { <START> if(!cm.getStatus().isTerminated()) { <END> Throwable t = log.cacheManagerNotClosed(); t.setStackTrace(allocationStackTrace); log.leakedCacheManager(t); cm.stop(); } } finally { super.finalize(); } }</code><technical_language>I guess checking isClosed flag instead</technical_language>

Target:
protected void finalize() throws Throwable { try { if(!isClosed) { Throwable t = log.cacheManagerNotClosed(); t.setStackTrace(allocationStackTrace); log.leakedCacheManager(t); cm.stop(); } } finally { super.finalize(); } }