auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void initSocket(String host, String port) throws IOException { if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } char <START> firstDigit = <END> port.charAt(0); if (firstDigit == '+' || firstDigit == '-') { throw new IllegalArgumentException("Illegal port argument " + port); } int p = 0; try { p = Integer.parseInt(port); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument " + port); } try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }</code><technical_language>this is a lot, add a public static method Integer Long: parseIntStrict() / parseLongStrict(), do charAt() check add @hide internal? get messy else if add necessary port.length() > 0 check avoid "" well. Depending want finesse it, message want fail (although this code demonstrates ok throw NumberFormatException)</technical_language>

Target:
private void initSocket(String host, String port) throws IOException { if (host == null || host.isEmpty()) { throw new IllegalArgumentException("host == null || host.isEmpty()"); } int p = 0; try { p = Integer.parsePositiveInt(port, 10); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal port argument " + port); } try { this.socket = new Socket(host, p); } catch (IOException e) { getErrorManager().error("Failed to establish the network connection", e, ErrorManager.OPEN_FAILURE); throw e; } super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); }
Source:
<code>private VideoView showVideoView(final boolean show, boolean wait) { final PhoneApp app = PhoneApp.getInstance(); InCallScreen screen = app.getInCallScreenInstance(); <START> VideoView view = (VideoView)(screen==null? null : screen.findViewById(R.id.video)); <END> if (wait & show) { if ((screen == null) || (view == null)) { for (int i = 0; i < 10; i++) { try { Thread.sleep(100); } catch (java.lang.InterruptedException e) { } screen = app.getInCallScreenInstance(); view = (VideoView)(screen==null? null : screen.findViewById(R.id.video)); if (view != null) { break; } } } } if (view != null) { final VideoView viewf = view; screen.runOnUiThread(new Runnable() { public void run() { viewf.setVisibility(show? View.VISIBLE : View.GONE); } }); } return (show? view : null); }</code><technical_language>Please add a space cast Please add spaces == Please add a space</technical_language>

Target:
private VideoView showVideoView(final boolean show, boolean wait) { final PhoneApp app = PhoneApp.getInstance(); InCallScreen screen = app.getInCallScreenInstance(); VideoView view = (VideoView) (screen == null ? null : screen.findViewById(R.id.video)); if (wait && show) { if ((screen == null) || (view == null)) { for (int i = 0; i < 10; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { } screen = app.getInCallScreenInstance(); view = (VideoView)(screen==null? null : screen.findViewById(R.id.video)); if (view != null) { break; } } } } if (view != null) { final VideoView viewf = view; screen.runOnUiThread(new Runnable() { public void run() { viewf.setVisibility(show? View.VISIBLE : View.GONE); } }); } return (show? view : null); }
Source:
<code>public void testConvertIfTheAttemptOfObtainingBaseFileSystemConfigurationsViewThrowsIOExceptionThenCloudbreakServiceExceptionShouldComeOutside() throws IOException { String ioExceptionMessage = "Unable to obtain BaseFileSystemConfigurationsView"; IOException invokedException = new IOException(ioExceptionMessage); FileSystem sourceFileSystem = new FileSystem(); FileSystem clusterServiceFileSystem = new FileSystem(); ConfigQueryEntries configQueryEntries = new ConfigQueryEntries(); when(sourceCluster.getFileSystem()).thenReturn(sourceFileSystem); when(cluster.getFileSystem()).thenReturn(clusterServiceFileSystem); when(stackMock.getEnvironmentCrn()).thenReturn("envCredentialCRN"); when(fileSystemConfigurationProvider.fileSystemConfiguration(eq(clusterServiceFileSystem), eq(stackMock), any(), eq(new Json("")), eq(configQueryEntries))).thenThrow(invokedException); when(cmCloudStorageConfigProvider.getConfigQueryEntries()).thenReturn(configQueryEntries); <START> assertThatCode(() -> underTest.convert(stackMock)) <END> .isInstanceOf(CloudbreakServiceException.class) .hasMessage(ioExceptionMessage) .hasCause(invokedException); }</code><technical_language>**praise:** I this of exception testing. move CB AssertJ</technical_language>

Target:
public void testConvertIfTheAttemptOfObtainingBaseFileSystemConfigurationsViewThrowsIOExceptionThenCloudbreakServiceExceptionShouldComeOutside() throws IOException { String ioExceptionMessage = "Unable to obtain BaseFileSystemConfigurationsView"; IOException invokedException = new IOException(ioExceptionMessage); FileSystem sourceFileSystem = new FileSystem(); FileSystem clusterServiceFileSystem = new FileSystem(); ConfigQueryEntries configQueryEntries = new ConfigQueryEntries(); when(sourceCluster.getFileSystem()).thenReturn(sourceFileSystem); when(cluster.getFileSystem()).thenReturn(clusterServiceFileSystem); when(stackMock.getEnvironmentCrn()).thenReturn("envCredentialCRN"); when(fileSystemConfigurationProvider.fileSystemConfiguration(eq(clusterServiceFileSystem), eq(stackMock), any(), eq(new Json("")), eq(configQueryEntries))).thenThrow(invokedException); when(cmCloudStorageConfigProvider.getConfigQueryEntries()).thenReturn(configQueryEntries); CloudbreakServiceException cloudbreakServiceException = assertThrows(CloudbreakServiceException.class, () -> underTest.convert(stackMock)); assertThat(cloudbreakServiceException).hasMessage(ioExceptionMessage).hasCause(invokedException); }
Source:
<code>public void bind(String portalName, String statementName, List<Object> params, @Nullable FormatCodes.FormatCode[] resultFormatCodes) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("method=bind portalName={} statementName={} params={}", portalName, statementName, params); } PreparedStmt preparedStmt; try { preparedStmt = getSafeStmt(statementName); } catch (Throwable t) { jobsLogs.logPreExecutionFailure(UUID.randomUUID(), null, SQLExceptions.messageOf(t), sessionContext.user()); throw t; } <START> AnalyzedStatement analyzedStatement = analyzer.unboundAnalyze( <END> preparedStmt.parsedStatement(), sessionContext, preparedStmt.paramTypes()); Portal portal = new Portal( portalName, preparedStmt, params, analyzedStatement, resultFormatCodes); Portal oldPortal = portals.put(portalName, portal); if (oldPortal != null) { oldPortal.closeActiveConsumer(); } }</code><technical_language>I is analyzed statement part of a describe request. In case preparedStmt.unboundStatement() set. Is avoid additional analyze call, problems</technical_language>

Target:
public void bind(String portalName, String statementName, List<Object> params, @Nullable FormatCodes.FormatCode[] resultFormatCodes) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("method=bind portalName={} statementName={} params={}", portalName, statementName, params); } PreparedStmt preparedStmt; try { preparedStmt = getSafeStmt(statementName); } catch (Throwable t) { jobsLogs.logPreExecutionFailure(UUID.randomUUID(), null, SQLExceptions.messageOf(t), sessionContext.user()); throw t; } AnalyzedStatement unboundStatement = preparedStmt.unboundStatement(); AnalyzedStatement analyzedStatement; if (unboundStatement == null) { try { analyzedStatement = analyzer.unboundAnalyze( preparedStmt.parsedStatement(), sessionContext, preparedStmt.paramTypes()); } catch (Throwable t) { jobsLogs.logPreExecutionFailure( UUID.randomUUID(), preparedStmt.rawStatement(), SQLExceptions.messageOf(t), sessionContext.user()); throw t; } } else { analyzedStatement = unboundStatement; } Portal portal = new Portal( portalName, preparedStmt, params, analyzedStatement, resultFormatCodes); Portal oldPortal = portals.put(portalName, portal); if (oldPortal != null) { oldPortal.closeActiveConsumer(); } }
Source:
<code>public void deletedMarker() throws Exception { OrganizationFolder top = r.jenkins.createProject(OrganizationFolder.class, "top"); List<MultiBranchProjectFactory> projectFactories = top.getProjectFactories(); assertEquals(1, projectFactories.size()); assertEquals(MockFactory.class, projectFactories.get(0).getClass()); <START> projectFactories.add(new MockFactory()); <END> top.getNavigators().add(new SingleSCMNavigator("stuff", Collections.<SCMSource>singletonList(new SingleSCMSource("id", "stuffy", new NullSCM())))); top.scheduleBuild2(0).getFuture().get(); top.getComputation().writeWholeLogTo(System.out); assertEquals(1, top.getItems().size()); r.waitUntilNoActivity(); MockFactory.live = false; try { top.scheduleBuild2(0).getFuture().get(); top.getComputation().writeWholeLogTo(System.out); assertEquals(0, top.getItems().size()); } finally { MockFactory.live = true; } }</code><technical_language>adding factory if previous line checked there</technical_language>

Target:
public void deletedMarker() throws Exception { OrganizationFolder top = r.jenkins.createProject(OrganizationFolder.class, "top"); List<MultiBranchProjectFactory> projectFactories = top.getProjectFactories(); assertEquals(1, projectFactories.size()); assertEquals(MockFactory.class, projectFactories.get(0).getClass()); top.getNavigators().add(new SingleSCMNavigator("stuff", Collections.<SCMSource>singletonList(new SingleSCMSource("id", "stuffy", new NullSCM())))); top.scheduleBuild2(0).getFuture().get(); top.getComputation().writeWholeLogTo(System.out); assertEquals(1, top.getItems().size()); r.waitUntilNoActivity(); MockFactory.live = false; try { top.scheduleBuild2(0).getFuture().get(); top.getComputation().writeWholeLogTo(System.out); assertEquals(0, top.getItems().size()); } finally { MockFactory.live = true; } }
Source:
<code>public boolean involvesOnlyFilteredEClasses(ModelElementIdToEObjectMapping idToEObjectMapping, AbstractOperation operation) { if (operation instanceof CompositeOperation) { return compositeOperationInvolvesOnlyFilteredEClasses(idToEObjectMapping, operation); } if (isCreateDelete(operation)) { return createDeleteOperationInvolvesOnlyFilteredEClasses(operation); } final ModelElementId id = operation.getModelElementId(); final EObject modelElement = idToEObjectMapping.get(id); if (modelElement == null) { return false; } if (!isFilteredEClass(modelElement.eClass())) { return false; } if <START> (FeatureOperation.class.isInstance(operation)) <END> { try { final EStructuralFeature feature = FeatureOperation.class.cast(operation).getFeature(modelElement); return isFiltered(modelElement.eClass(), feature); } catch (final UnkownFeatureException ex) { return true; } } return true; }</code><technical_language>flavours for checking instance here, agree :)</technical_language>

Target:
public boolean involvesOnlyFilteredEClasses(ModelElementIdToEObjectMapping idToEObjectMapping, AbstractOperation operation) { if (isComposite(operation)) { return compositeOperationInvolvesOnlyFilteredEClasses(idToEObjectMapping, operation); } if (isCreateDelete(operation)) { return createDeleteOperationInvolvesOnlyFilteredEClasses(operation); } final ModelElementId id = operation.getModelElementId(); final EObject modelElement = idToEObjectMapping.get(id); if (modelElement == null) { return false; } if (!isFilteredEClass(modelElement.eClass())) { return false; } if (isFeature(operation)) { try { final EStructuralFeature feature = FeatureOperation.class.cast(operation).getFeature(modelElement); return isFiltered(modelElement.eClass(), feature); } catch (final UnkownFeatureException ex) { ModelUtil.log( MessageFormat.format("{0} could not access feature of a feature operation", getClass().getName()), ex, IStatus.WARNING); return true; } } return true; }
Source:
<code>Map.Entry<Boolean, TestSuiteSummary> processSupportiveArtifacts(SynapseTestCase synapseTestCase, TestSuiteSummary testSuiteSummary) { boolean isArtifactDeployed = true; for (int x = 0; x < synapseTestCase.getArtifacts().getSupportiveArtifactCount(); x++) { if (isArtifactDeployed) { try { isArtifactDeployed = processForArtifactTypes(synapseTestCase, x); } catch (Exception e) { log.error("Supportive test artifact deployment failed", e); exception = CommonUtils.stackTraceToString(e); testSuiteSummary.setDeploymentStatus(Constants.FAILED_KEY); testSuiteSummary.setDeploymentException(exception); } } else { log.error(synapseTestCase.getArtifacts().getSupportiveArtifact(x).getArtifactType() <START> + " main test artifact deployment failed"); <END> break; } } return new AbstractMap.SimpleEntry<>(isArtifactDeployed, testSuiteSummary); }</code><technical_language>"Main" -> "Primary" aswell</technical_language>

Target:
Map.Entry<Boolean, TestSuiteSummary> processSupportiveArtifacts(SynapseTestCase synapseTestCase, TestSuiteSummary testSuiteSummary) { boolean isArtifactDeployed = true; for (int x = 0; x < synapseTestCase.getArtifacts().getSupportiveArtifactCount(); x++) { if (isArtifactDeployed) { try { isArtifactDeployed = processForArtifactTypes(synapseTestCase, x); } catch (Exception e) { log.error("Supportive test artifact deployment failed", e); exception = CommonUtils.stackTraceToString(e); testSuiteSummary.setDeploymentStatus(Constants.FAILED_KEY); testSuiteSummary.setDeploymentException(exception); } } else { log.error(synapseTestCase.getArtifacts().getSupportiveArtifact(x).getArtifactType() + " primary test artifact deployment failed"); break; } } return new AbstractMap.SimpleEntry<>(isArtifactDeployed, testSuiteSummary); }
Source:
<code>public List<CloudBlobMetadata> findEntriesSince(String partitionPath, CloudFindToken findToken, long maxTotalSizeOfEntries) throws CloudStorageException { SqlQuerySpec entriesSinceQuery = new SqlQuerySpec(ENTRIES_SINCE_QUERY_TEMPLATE, <START> new SqlParameterCollection(new SqlParameter(LIMIT_PARAM, 1000), <END> new SqlParameter(TIME_SINCE_PARAM, findToken.getLatestUploadTime()))); try { List<CloudBlobMetadata> results = cosmosDataAccessor.queryMetadata(partitionPath, entriesSinceQuery, azureMetrics.findSinceQueryTime); if (results.isEmpty()) { return results; } long totalSize = 0; List<CloudBlobMetadata> cappedResults = new ArrayList<>(); boolean foundLastBlob = (findToken.getLatestBlobId() == null); for (CloudBlobMetadata metadata : results) { if (!foundLastBlob) { foundLastBlob = metadata.getId().equals(findToken.getLatestBlobId()); continue; } if (totalSize + metadata.getSize() > maxTotalSizeOfEntries) { if (cappedResults.isEmpty()) { cappedResults.add(metadata); } break; } cappedResults.add(metadata); totalSize += metadata.getSize(); } return cappedResults; } catch (DocumentClientException dex) { throw new CloudStorageException("Failed to query blobs for partition " + partitionPath, dex); } }</code><technical_language>1000 a static final variable</technical_language>

Target:
public List<CloudBlobMetadata> findEntriesSince(String partitionPath, CloudFindToken findToken, long maxTotalSizeOfEntries) throws CloudStorageException { SqlQuerySpec entriesSinceQuery = new SqlQuerySpec(ENTRIES_SINCE_QUERY_TEMPLATE, new SqlParameterCollection(new SqlParameter(LIMIT_PARAM, findSinceQueryLimit), new SqlParameter(TIME_SINCE_PARAM, findToken.getLatestUploadTime()))); try { List<CloudBlobMetadata> results = cosmosDataAccessor.queryMetadata(partitionPath, entriesSinceQuery, azureMetrics.findSinceQueryTime); if (results.isEmpty()) { return results; } long totalSize = 0; List<CloudBlobMetadata> cappedResults = new ArrayList<>(); for (CloudBlobMetadata metadata : results) { if (metadata.getId().equals(findToken.getLatestBlobId())) { continue; } if (totalSize + metadata.getSize() > maxTotalSizeOfEntries) { if (cappedResults.isEmpty()) { cappedResults.add(metadata); } break; } cappedResults.add(metadata); totalSize += metadata.getSize(); } return cappedResults; } catch (DocumentClientException dex) { throw new CloudStorageException("Failed to query blobs for partition " + partitionPath, dex); } }
Source:
<code>public NewHostModel() { super(); <START> setExternalHostName(new ListModel()); <END> getExternalHostName().getSelectedItemChangedEvent().addListener(this); getExternalHostName().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); setExternalHostProviderEnabled(new EntityModel()); setProviders(new ListModel()); getProviders().getSelectedItemChangedEvent().addListener(this); getProviders().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); IEventListener externalHostsListener = new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { UpdateExternalHostModels(); } }; getExternalHostProviderEnabled().getEntityChangedEvent().addListener(externalHostsListener); getExternalHostProviderEnabled().setEntity(false); getExternalHostName().setIsChangable(false); }</code><technical_language>redundant- done in HostModel</technical_language>

Target:
public NewHostModel() { super(); getExternalHostName().getSelectedItemChangedEvent().addListener(this); getExternalHostName().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getExternalHostProviderEnabled().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getProviders().getSelectedItemChangedEvent().addListener(this); getProviders().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); IEventListener externalHostsListener = new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { UpdateExternalHostModels(); } }; getExternalHostProviderEnabled().getEntityChangedEvent().addListener(externalHostsListener); getExternalHostProviderEnabled().setEntity(false); getExternalHostName().setIsChangable(false); }
Source:
<code>protected KitodoOutputHandler() { <START> super(beforeParentConstructor(), null, new int[] {1970, 1, 1 }, null, null); <END> }</code><technical_language>this magic values 1970, 1, 1? Please add a description explains this values used</technical_language>

Target:
protected KitodoOutputHandler() { super(beforeParentConstructor(), null, EPOCH_ZERO, null, null); }
Source:
<code>static Duration getFsTimestampResolution(Path file) { Path dir = Files.isDirectory(file) ? file : file.getParent(); if (!dir.toFile().canWrite()) { return FALLBACK_TIMESTAMP_RESOLUTION; } FileStore s; try { s = Files.getFileStore(dir); FileStoreAttributeCache c = attributeCache.get(s); if (c != null) { return c.getFsTimestampResolution(); } <START> CompletableFuture<FileStoreAttributeCache> f = CompletableFuture <END> .supplyAsync(() -> new FileStoreAttributeCache(s, dir)); f.thenAccept(cache -> attributeCache.put(s, cache)); if (!background) { FileStoreAttributeCache e = f.get(); if (LOG.isDebugEnabled()) { LOG.debug(e.toString()); } return e.getFsTimestampResolution(); } else if (LOG.isDebugEnabled()) { f.thenAccept(cache -> LOG.debug(cache.toString())); } return FALLBACK_TIMESTAMP_RESOLUTION; } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return FALLBACK_TIMESTAMP_RESOLUTION; } }</code><technical_language>if perform operations this future is completed put result attributeCache map, start futures? this is good</technical_language>

Target:
private static Duration getFsTimestampResolution(Path file) { Path dir = Files.isDirectory(file) ? file : file.getParent(); if (!dir.toFile().canWrite()) { return FALLBACK_TIMESTAMP_RESOLUTION; } FileStore s; try { s = Files.getFileStore(dir); FileStoreAttributeCache c = attributeCache.get(s); if (c != null) { return c.getFsTimestampResolution(); } Lock lock = locks.computeIfAbsent(s, l -> new ReentrantLock()); if (lock.tryLock()) { try { CompletableFuture<FileStoreAttributeCache> f = CompletableFuture .supplyAsync(() -> new FileStoreAttributeCache( s, dir)); f.exceptionally(e -> { Throwable cause = e.getCause(); if (!(cause instanceof NoSuchFileException)) { LOG.error(e.getLocalizedMessage(), e); } return null; }); f.thenAccept(cache -> { if (cache != null) { attributeCache.put(s, cache); } }); if (background.get()) { if (LOG.isDebugEnabled()) { f.thenAccept( cache -> LOG.debug(cache.toString())); } } else { FileStoreAttributeCache cache = f.get(); if (LOG.isDebugEnabled()) { LOG.debug(cache.toString()); } return cache.getFsTimestampResolution(); } } finally { lock.unlock(); locks.remove(s); } } return FALLBACK_TIMESTAMP_RESOLUTION; } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return FALLBACK_TIMESTAMP_RESOLUTION; } }
Source:
<code>private void handleAssignmentStatement(AssignmentStatement assignmentStatement, SubscriptionContext ctx) { ExpressionList lhs = assignmentStatement.lhsExpressions().get(0); Expression expression = lhs.expressions().get(0); <START> if (expression.is(Tree.Kind.NAME) && isCredential(((Name) expression).name(), variablePatterns())) { <END> checkAssignedValue(assignmentStatement, ctx); } if (expression.is(Tree.Kind.QUALIFIED_EXPR) && isCredential(((QualifiedExpression) expression).name().name(), variablePatterns())) { checkAssignedValue(assignmentStatement, ctx); } if (expression.is(Tree.Kind.SUBSCRIPTION)) { SubscriptionExpression subscriptionExpression = (SubscriptionExpression) expression; if (subscriptionExpression.subscripts().expressions().stream().anyMatch(e -> e.is(Tree.Kind.STRING_LITERAL) && isCredential(((StringLiteral) e).trimmedQuotesValue(), variablePatterns()))) { checkAssignedValue(assignmentStatement, ctx); } } }</code><technical_language>here, symbol name instead of checking if a name if a qualified expression</technical_language>

Target:
private void handleAssignmentStatement(AssignmentStatement assignmentStatement, SubscriptionContext ctx) { ExpressionList lhs = assignmentStatement.lhsExpressions().get(0); Expression expression = lhs.expressions().get(0); if (expression instanceof HasSymbol) { Symbol symbol = ((HasSymbol) expression).symbol(); if (isSymbolCredential(symbol)) { checkAssignedValue(assignmentStatement, ctx); } } if (expression.is(Kind.SUBSCRIPTION)) { SubscriptionExpression subscriptionExpression = (SubscriptionExpression) expression; if (subscriptionExpression.subscripts().expressions().stream().anyMatch(e -> e.is(Kind.STRING_LITERAL) && isCredential(((StringLiteral) e).trimmedQuotesValue(), variablePatterns()))) { checkAssignedValue(assignmentStatement, ctx); } } }
Source:
<code>public void testGenerateDroolsTestOption() { ScoreDirectorFactoryConfig config = new ScoreDirectorFactoryConfig(); assertThat(config.isGenerateDroolsTestOnError()).isNull(); config.setGenerateDroolsTestOnError(true); <START> assertThat((boolean) config.isGenerateDroolsTestOnError()).isTrue(); <END> config.setGenerateDroolsTestOnError(Boolean.FALSE); assertThat((boolean) config.isGenerateDroolsTestOnError()).isFalse(); config.setGenerateDroolsTestOnError(null); assertThat(config.isGenerateDroolsTestOnError()).isNull(); }</code><technical_language>Redundant cast</technical_language>

Target:
public void testGenerateDroolsTestOption() { ScoreDirectorFactoryConfig config = new ScoreDirectorFactoryConfig(); assertThat(config.isGenerateDroolsTestOnError()).isNull(); config.setGenerateDroolsTestOnError(true); assertThat(config.isGenerateDroolsTestOnError()).isTrue(); config.setGenerateDroolsTestOnError(Boolean.FALSE); assertThat(config.isGenerateDroolsTestOnError()).isFalse(); config.setGenerateDroolsTestOnError(null); assertThat(config.isGenerateDroolsTestOnError()).isNull(); }
Source:
<code>public RadioButtonItem(String name, ToggleGroup group, int <START> i) { <END> nameOfButton = name; but = new RadioButton(name); but.setToggleGroup(group); but.setCursor(Cursor.CLOSED_HAND); but.setText(name); but.setFont(Font.font(" ", FontWeight.BOLD, 14)); but.setTextFill(Color.ANTIQUEWHITE); but.setTextAlignment(TextAlignment.LEFT); if (i == 1) { but.setSelected(true); } getChildren().addAll(but); }</code><technical_language>bad name</technical_language>

Target:
public RadioButtonItem(String name, ToggleGroup group, int i) { nameOfButton = name; butItem = new RadioButton(name); butItem.setToggleGroup(group); butItem.setCursor(Cursor.CLOSED_HAND); butItem.setText(name); butItem.setFont(Font.font(" ", FontWeight.BOLD, 14)); butItem.setTextFill(Color.ANTIQUEWHITE); butItem.setTextAlignment(TextAlignment.LEFT); if (i == 1) { butItem.setSelected(true); } getChildren().addAll(butItem); }
Source:
<code>protected boolean canDoAction() { if (getNic() == null) { return failCanDoAction(VdcBllMessages.HOST_NETWORK_INTERFACE_NOT_EXIST); } if (getNic().getLabels() != null && getNic().getLabels().contains(getLabel())) { return failCanDoAction(VdcBllMessages.INTERFACE_ALREADY_LABELED); } if (!ValidationUtils.validateInputs(getValidationGroups(), getNic()).isEmpty()) { return failCanDoAction(VdcBllMessages.IMPROPER_INTERFACE_IS_LABELED); } for (VdsNetworkInterface nic : getHostInterfaces()) { if (!StringUtils.equals(nic.getName(), getNicName()) && nic.getLabels() != null && nic.getLabels().contains(getLabel())) { return failCanDoAction(VdcBllMessages.OTHER_INTERFACE_ALREADY_LABELED, "$LabeledNic " + nic.getName()); } } List<String> assignedNetworks = validateNetworksNotAssignedToIncorrectNics(); if (!assignedNetworks.isEmpty()) { return failCanDoAction(VdcBllMessages.LABELED_NETWORK_ATTACHED_TO_WRONG_INTERFACE, "$AssignedNetworks " <START> + StringUtils.join(assignedNetworks.toArray(new String[assignedNetworks.size()]), ", ")); <END> } return true; }</code><technical_language>is a join method accepts Collection this code simpler.</technical_language>

Target:
protected boolean canDoAction() { if (getNic() == null) { return failCanDoAction(VdcBllMessages.HOST_NETWORK_INTERFACE_NOT_EXIST); } if (getNic().getLabels() != null && getNic().getLabels().contains(getLabel())) { return failCanDoAction(VdcBllMessages.INTERFACE_ALREADY_LABELED); } if (!ValidationUtils.validateInputs(getValidationGroups(), getNic()).isEmpty()) { return failCanDoAction(VdcBllMessages.IMPROPER_INTERFACE_IS_LABELED); } for (VdsNetworkInterface nic : getHostInterfaces()) { if (!StringUtils.equals(nic.getName(), getNicName()) && nic.getLabels() != null && nic.getLabels().contains(getLabel())) { return failCanDoAction(VdcBllMessages.OTHER_INTERFACE_ALREADY_LABELED, "$LabeledNic " + nic.getName()); } } List<String> assignedNetworks = validateNetworksNotAssignedToIncorrectNics(); if (!assignedNetworks.isEmpty()) { return failCanDoAction(VdcBllMessages.LABELED_NETWORK_ATTACHED_TO_WRONG_INTERFACE, "$AssignedNetworks " + StringUtils.join(assignedNetworks, ", ")); } return true; }
Source:
<code>public void close(Throwable error) { if(setClose()) { se.setClientOperations(this); this.getClientsThreadExecutor().execute(new Runnable() { @Override public void run() { synchronized(writerLock) { if(writeFutures.size() > 0) { final ClosedChannelException cce = new ClosedChannelException(); for(final Pair<Long, SettableListenableFuture<Long>> p: writeFutures) { p.getRight().setFailure(cce); } } writeFutures.clear(); writeBuffers.discard(writeBuffers.remaining()); } <START> if(!connectionFuture.isDone()) { <END> connectionFuture.setFailure(error); } if(sslProcessor != null) { sslProcessor.failHandshake(error); } }}); this.callClosers(error); } }</code><technical_language>constructed ignoring results complete, this check is unnecessary (and confusing IMO)</technical_language>

Target:
public void close(Throwable error) { if(setClose()) { se.setClientOperations(this); this.getClientsThreadExecutor().execute(new Runnable() { @Override public void run() { synchronized(writerLock) { if(writeFutures.size() > 0) { final ClosedChannelException cce = new ClosedChannelException(); for(final Pair<Long, SettableListenableFuture<Long>> p: writeFutures) { p.getRight().setFailure(cce); } } writeFutures.clear(); writeBuffers.discard(writeBuffers.remaining()); } connectionFuture.setFailure(error); if(sslProcessor != null) { sslProcessor.failHandshake(error); } }}); this.callClosers(error); } }
Source:
<code>public void testFooNoInterceptors(@Produced("empty") Foo foo) { assertEquals(Foo.class, foo.getClass());; <START> assertEquals("pong", foo.ping()); <END> }</code><technical_language>assertEquals(Foo.class, foo.getClass()). produced Foo is @Dependent is client proxy instance is result of producer method</technical_language>

Target:
public void testFooNoInterceptors(@Produced("empty") Foo foo) { assertEquals(Foo.class, foo.getClass()); assertEquals("pong", foo.ping()); }
Source:
<code>private ContentValues ensureAfter() { ContentValues values = mAfterContentValues; if (values == null) { values = new ContentValues(); mAfterContentValues = values; <START> mAfterKeys = new HashSet<>(); <END> } return values; }</code><technical_language>Please remove mAfterKeys while it. a workaround for absence of ContentValues.keySet() Android 2.x. support Android 2 more remove in places replace mAfterContentValues.keySet() read</technical_language>

Target:
private ContentValues ensureAfter() { ContentValues values = mAfterContentValues; if (values == null) { values = new ContentValues(); mAfterContentValues = values; } return values; }
Source:
<code>public static Client init(@NonNull Context androidContext) { <START> synchronized (lock) { <END> if (client == null) { client = new Client(androidContext); NativeInterface.configureClientObservers(client); } else { logClientInitWarning(); } } return client; }</code><technical_language>choose a synchronized (lock) block label entire static method public static synchronized Client init()</technical_language>

Target:
public static Client init(@NonNull Context androidContext) { return init(androidContext, null, true); }
Source:
<code>public void shutdown() { <START> synchronized (this) { <END> log.info("Scheduled shutdown for {}", this); stopping = true; notify(); } }</code><technical_language>if endup locking method, reason a block, synchronized method. Applies similar method</technical_language>

Target:
public synchronized void shutdown() { log.info("Scheduled shutdown for {}", this); stopping = true; notify(); }
Source:
<code>public void testExactMatchBeforeCoercion() { TypeRegistry typeManager = new TypeRegistry(); <START> FunctionManager functionManager = new FunctionManager(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); <END> boolean foundOperator = false; for (SqlFunction function : functionManager.listOperators()) { OperatorType operatorType = tryGetOperatorType(function.getSignature().getName()).get(); if (operatorType == CAST || operatorType == SATURATED_FLOOR_CAST) { continue; } if (!function.getSignature().getTypeVariableConstraints().isEmpty()) { continue; } if (function.getSignature().getArgumentTypes().stream().anyMatch(TypeSignature::isCalculated)) { continue; } BuiltInFunctionHandle exactOperator = (BuiltInFunctionHandle) functionManager.resolveOperator(operatorType, fromTypeSignatures(function.getSignature().getArgumentTypes())); assertEquals(exactOperator.getSignature(), function.getSignature()); foundOperator = true; } assertTrue(foundOperator); }</code><technical_language>is this change about</technical_language>

Target:
public void testExactMatchBeforeCoercion() { TypeRegistry typeManager = new TypeRegistry(); FunctionManager functionManager = createFunctionManager(typeManager); boolean foundOperator = false; for (SqlFunction function : functionManager.listOperators()) { OperatorType operatorType = tryGetOperatorType(function.getSignature().getName()).get(); if (operatorType == CAST || operatorType == SATURATED_FLOOR_CAST) { continue; } if (!function.getSignature().getTypeVariableConstraints().isEmpty()) { continue; } if (function.getSignature().getArgumentTypes().stream().anyMatch(TypeSignature::isCalculated)) { continue; } BuiltInFunctionHandle exactOperator = (BuiltInFunctionHandle) functionManager.resolveOperator(operatorType, fromTypeSignatures(function.getSignature().getArgumentTypes())); assertEquals(exactOperator.getSignature(), function.getSignature()); foundOperator = true; } assertTrue(foundOperator); }
Source:
<code>private Entry<String, org.eclipse.emf.common.command.Command> getCommandToActivateLayerShowingElementAndPArents(DDiagram parentDiagram, final Set<DDiagramElement> elementSet) { CompoundCommand layerCompoundCommand = new CompoundCommand(); Optional<Session> optionalSession = Session.of(parentDiagram); Set<String> layersToActivateList = new <START> HashSet<>(); <END> if (optionalSession.isPresent()) { DiagramMappingsManager mappingManager = DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(optionalSession.get(), parentDiagram); for (DDiagramElement dDiagramElement : elementSet) { if (mappingManager.getActiveParentLayers(dDiagramElement.getDiagramElementMapping()).size() <= 0) { Layer layerToActivate = getLayerToActivate(parentDiagram, dDiagramElement, mappingManager); if (layerToActivate != null) { final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(parentDiagram); if (!layersToActivateList.contains(layerToActivate.getName())) { layerCompoundCommand.append(new ChangeLayerActivationCommand(domain, parentDiagram, layerToActivate, new NullProgressMonitor())); layersToActivateList.add(layerToActivate.getName()); } } } } } return layerCompoundCommand.getCommandList().size() > 0 ? new SimpleEntry<String, org.eclipse.emf.common.command.Command>(layersToActivateList.stream().collect(Collectors.joining(", ")), layerCompoundCommand) : null; }</code><technical_language>a linkedHashSet guarantee order of activated viewpoints reproductibility of activation</technical_language>

Target:
private Entry<String, org.eclipse.emf.common.command.Command> getCommandToActivateLayerShowingElementAndPArents(DDiagram parentDiagram, final Set<DDiagramElement> elementSet) { CompoundCommand layerCompoundCommand = new CompoundCommand(); Optional<Session> optionalSession = Session.of(parentDiagram); Collection<String> layersToActivate = new LinkedHashSet<>(); if (optionalSession.isPresent()) { DiagramMappingsManager mappingManager = DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(optionalSession.get(), parentDiagram); for (DDiagramElement dDiagramElement : elementSet) { if (mappingManager.getActiveParentLayers(dDiagramElement.getDiagramElementMapping()).size() <= 0) { Layer layerToActivate = getLayerToActivate(parentDiagram, dDiagramElement, mappingManager); if (layerToActivate != null) { final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(parentDiagram); if (!layersToActivate.contains(layerToActivate.getName())) { layerCompoundCommand.append(new ChangeLayerActivationCommand(domain, parentDiagram, layerToActivate, new NullProgressMonitor())); layersToActivate.add(layerToActivate.getName()); } } } } } return layerCompoundCommand.getCommandList().size() > 0 ? new SimpleEntry<String, org.eclipse.emf.common.command.Command>(layersToActivate.stream().collect(Collectors.joining(", ")), layerCompoundCommand) : null; }
Source:
<code>private void editNodeSourceAndCheckOutput(String nodeSourceName) { String nodeSourceInfrastructureClass = "org.ow2.proactive.resourcemanager.nodesource.infrastructure.LocalInfrastructure"; <START> String nodeSourcePolicyClass = "org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy"; <END> System.out.println(LOG_HEADER + " Test editns command"); this.clearAndTypeLine("editns( '" + nodeSourceName + "', ['" + nodeSourceInfrastructureClass + "', '" + rmCredentialPath + "', " + MODIFIED_NB_NODES + ", 60000, ''], ['" + nodeSourcePolicyClass + "', 'ALL', 'ALL'], 'false')"); this.runCli(); String out = this.capturedOutput.toString(); System.setOut(this.stdOut); System.out.println(out); assertThat(out).contains("Node source successfully edited."); }</code><technical_language>this String nodeSourcePoliceClass = StaticPolicy.getClass().getName()</technical_language>

Target:
private void editNodeSourceAndCheckOutput(String nodeSourceName) { System.out.println(LOG_HEADER + " Test editns command"); this.clearAndTypeLine("editns( '" + nodeSourceName + "', " + modifiedInfrastructureParametersString + ", " + policyParametersString + ", 'false')"); this.runCli(); String out = this.capturedOutput.toString(); System.setOut(this.stdOut); System.out.println(out); assertThat(out).contains("Node source successfully edited."); }
Source:
<code>private Module bindAutoBindSingletons(BootstrapBinder binder) { List<Module> modules = Lists.newArrayList(); for (final Class<?> clazz : classpathScanner.getClasses()) { if (ignoreClasses.contains(clazz) || !clazz.isAnnotationPresent(AutoBindSingleton.class)) { continue; } AutoBindSingleton annotation = clazz.getAnnotation(AutoBindSingleton.class); if (Module.class.isAssignableFrom(clazz)) { Preconditions.checkState( annotation.value() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( annotation.baseClass() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( !annotation.multiple(), "@AutoBindSingleton(multiple=true) value cannot be set for Modules"); LOG.info("Found @AutoBindSingleton annotated module : ", clazz.getName()); <START> LOG.info("***** @AutoBindSingleton for module is deprecated as of 10/10/2015. Modules should be added directly to the injector or via install({}.class). See <LINK_0>", clazz.getName(), clazz.getSimpleName()); <END> binder.include((Class<? extends Module>) clazz); } } return Modules.combine(modules); }</code><technical_language>For warning, application owner needs explicitly install module library owner needs remove AutoBindSingleton annotation. primary consumer for warning application owner long right notice</technical_language>

Target:
private Module bindAutoBindSingletons(BootstrapBinder binder) { List<Module> modules = Lists.newArrayList(); for (final Class<?> clazz : classpathScanner.getClasses()) { if (ignoreClasses.contains(clazz) || !clazz.isAnnotationPresent(AutoBindSingleton.class)) { continue; } AutoBindSingleton annotation = clazz.getAnnotation(AutoBindSingleton.class); if (Module.class.isAssignableFrom(clazz)) { Preconditions.checkState( annotation.value() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( annotation.baseClass() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( !annotation.multiple(), "@AutoBindSingleton(multiple=true) value cannot be set for Modules"); LOG.info("Found @AutoBindSingleton annotated module : ", clazz.getName()); LOG.info("***** @AutoBindSingleton use for module is deprecated as of 2015-10-10. Modules should be added directly to the injector or via install({}.class). See <LINK_0>", clazz.getName(), clazz.getSimpleName()); binder.include((Class<? extends Module>) clazz); } } return Modules.combine(modules); }
Source:
<code>public void testGetResponseInvalidAction() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME); groupRequest.setNesting(Arrays.asList("os", "device", "version")); AsyncDataToken dataToken = getQueryExecutor().executeAsync(groupRequest); Thread.sleep(1000); try { <START> resources.client().target(String.format("/foxtrot/v1/async/distinct/%s", dataToken.getKey())).request().get(GroupResponse.class); <END> } catch (WebApplicationException ex) { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), ex.getResponse().getStatus()); } }</code><technical_language>add fail() catch statement</technical_language>

Target:
public void testGetResponseInvalidAction() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME); groupRequest.setNesting(Arrays.asList("os", "device", "version")); AsyncDataToken dataToken = getQueryExecutor().executeAsync(groupRequest); Thread.sleep(1000); GroupResponse response = resources.client().target(String.format("/foxtrot/v1/async/distinct/%s", dataToken.getKey())).request().get(GroupResponse.class); assertNull(response); }
Source:
<code>byte[] getPrototypeClassBytecode() throws IOException { if (prototypeClassBytecode == null) { ClassLoader cl = prototypeClass.getClassLoader(); <START> InputStream prototypeClassBytecodeStream = cl.getResourceAsStream(prototypeClassBytecodeName + ".class"); <END> prototypeClassBytecode = ByteStreams.toByteArray(prototypeClassBytecodeStream); } return prototypeClassBytecode; }</code><technical_language>Need close stream</technical_language>

Target:
byte[] getPrototypeClassBytecode() throws IOException { if (prototypeClassBytecode == null) { ClassLoader cl = prototypeClass.getClassLoader(); try (InputStream prototypeClassBytecodeStream = cl.getResourceAsStream(prototypeClassBytecodeName + ".class")) { prototypeClassBytecode = ByteStreams.toByteArray(prototypeClassBytecodeStream); } } return prototypeClassBytecode; }
Source:
<code>public boolean isValid() { if (getOperationMode() == OperationModeType.STANDBY) { return true; } <START> if (itemName == null || source == null || itemName.equals("") || source.equals("")) { <END> return false; } else { return true; } }</code><technical_language>While it, change .equals("") .isEmpty()</technical_language>

Target:
public boolean isValid() { if (getOperationMode() == OperationModeType.STANDBY) { return true; } if (itemName == null || source == null || itemName.isEmpty() || source.isEmpty()) { return false; } else { return true; } }
Source:
<code>private CepSink(final CepSinkType cepSinkType, final Map<String, Object> sinkConfigs, final String separator) { this.cepSinkType = cepSinkType; this.sinkConfigs = sinkConfigs; <START> if(separator == null) { <END> this.separator = ","; } else { this.separator = separator; } }</code><technical_language>Please create a constructor receive separator a parameter</technical_language>

Target:
private CepSink(final CepSinkType cepSinkType, final Map<String, Object> sinkConfigs, final String separator) { this.cepSinkType = cepSinkType; this.sinkConfigs = sinkConfigs; this.separator = separator; }
Source:
<code>public String getLog() { <START> switch (typeValue) { <END> case DATA: return condition.getLog(value) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; case EVENT: default: return condition.getLog(event) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; } }</code><technical_language>If event existence a discriminator</technical_language>

Target:
public String getLog() { if (value != null) { return condition.getLog(value) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; } else { return condition.getLog(event) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; } }
Source:
<code>private void gatherItemsFromBarrel(Location l, BlockMenu blockMenu, List<ItemStackAndInteger> items) { try { Config cfg = BlockStorage.getLocationInfo(blockMenu.getLocation()); String data = cfg.getString("storedItems"); if (data == null) { return; } int stored = Integer.parseInt(data); for (int slot : blockMenu.getPreset().getSlotsAccessedByItemTransport((DirtyChestMenu) blockMenu, ItemTransportFlow.WITHDRAW, null)) { ItemStack is = blockMenu.getItemInSlot(slot); <START> if (is != null && CargoUtils.matchesFilter(this, l.getBlock(), is)) { <END> boolean add = true; for (ItemStackAndInteger item : items) { if (SlimefunUtils.isItemSimilar(is, item.getItemStackWrapper(), true, false)) { add = false; item.add(is.getAmount() + stored); } } if (add) { items.add(new ItemStackAndInteger(is, is.getAmount() + stored)); } } } } catch (Exception x) { Slimefun.getLogger().log(Level.SEVERE, "An Exception occurred while trying to read data from a Barrel", x); } }</code><technical_language>Im a fan of name is reading reads like: if is is null this is opinion</technical_language>

Target:
private void gatherItemsFromBarrel(Location l, BlockMenu blockMenu, List<ItemStackAndInteger> items) { try { Config cfg = BlockStorage.getLocationInfo(blockMenu.getLocation()); String data = cfg.getString("storedItems"); if (data == null) { return; } int stored = Integer.parseInt(data); for (int slot : blockMenu.getPreset().getSlotsAccessedByItemTransport((DirtyChestMenu) blockMenu, ItemTransportFlow.WITHDRAW, null)) { ItemStack stack = blockMenu.getItemInSlot(slot); if (stack != null && CargoUtils.matchesFilter(this, l.getBlock(), stack)) { boolean add = true; for (ItemStackAndInteger item : items) { if (SlimefunUtils.isItemSimilar(stack, item.getItemStackWrapper(), true, false)) { add = false; item.add(stack.getAmount() + stored); } } if (add) { items.add(new ItemStackAndInteger(stack, stack.getAmount() + stored)); } } } } catch (Exception x) { Slimefun.getLogger().log(Level.SEVERE, "An Exception occurred while trying to read data from a Barrel", x); } }
Source:
<code>public static void onTossEvent(ItemTossEvent event) { PlayerInventory inventory = event.getPlayer().inventory; if(!event.getEntity().world.isRemote && getData(event.getPlayer()) != null) { EditData data = getData(event.getPlayer()); ItemStack stack = event.getEntityItem().getItem(); DeployEntry entry = DeployList.getEntryForItem(stack, data.connection, event.getEntity().world); if(entry != null && !isBlockItem(stack.getItem())) { GristSet cost = entry.getCurrentCost(data.connection); if(GristHelper.canAfford(PlayerSavedData.getData(data.connection.getClientIdentifier(), event.getPlayer().world).getGristCache(), cost)) { GristHelper.decrease(event.getPlayer().world, data.connection.getClientIdentifier(), cost); <START> GristHelper.notify(event.getPlayer().world.getServer(), data.connection.getClientIdentifier(), cost, false); <END> data.connection.setHasGivenItem(entry); if(!data.connection.isMain()) SkaianetHandler.get(event.getPlayer().getServer()).giveItems(data.connection.getClientIdentifier()); } else event.setCanceled(true); } else { event.setCanceled(true); } if(event.isCanceled()) { event.getEntityItem().remove(); if(!inventory.getItemStack().isEmpty()) inventory.setItemStack(ItemStack.EMPTY); else inventory.setInventorySlotContents(inventory.currentItem, ItemStack.EMPTY); } } }</code><technical_language>this notifyEditPlayer</technical_language>

Target:
public static void onTossEvent(ItemTossEvent event) { PlayerInventory inventory = event.getPlayer().inventory; if(!event.getEntity().world.isRemote && getData(event.getPlayer()) != null) { EditData data = getData(event.getPlayer()); ItemStack stack = event.getEntityItem().getItem(); DeployEntry entry = DeployList.getEntryForItem(stack, data.connection, event.getEntity().world); if(entry != null && !isBlockItem(stack.getItem())) { GristSet cost = entry.getCurrentCost(data.connection); if(GristHelper.canAfford(PlayerSavedData.getData(data.connection.getClientIdentifier(), event.getPlayer().world).getGristCache(), cost)) { GristHelper.decrease(event.getPlayer().world, data.connection.getClientIdentifier(), cost); GristHelper.notifyEditPlayer(event.getPlayer().world.getServer(), data.connection.getClientIdentifier(), cost, false); data.connection.setHasGivenItem(entry); if(!data.connection.isMain()) SkaianetHandler.get(event.getPlayer().getServer()).giveItems(data.connection.getClientIdentifier()); } else event.setCanceled(true); } else { event.setCanceled(true); } if(event.isCanceled()) { event.getEntityItem().remove(); if(!inventory.getItemStack().isEmpty()) inventory.setItemStack(ItemStack.EMPTY); else inventory.setInventorySlotContents(inventory.currentItem, ItemStack.EMPTY); } } }
Source:
<code>public void commit() { <START> ExecutionStatistics.get().begin("GraphService.commit"); <END> this.context.getGraph().getBaseGraph().commit(); ExecutionStatistics.get().end("GraphService.commit"); }</code><technical_language>I love this done wrapping in a callable (where possible): ExecutionStatstics.performBenchmarked(new Callable() { public Void perform() { } }); if problems final variables, etc. idea code a bit cleaner/ensure forget call "end"</technical_language>

Target:
public void commit() { ExecutionStatistics.performBenchmarked("GraphService.commit", new Task<Void>() { @Override public Void execute() { getGraphContext().getGraph().getBaseGraph().commit(); return null; } }); }