auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Object execute(ExecutionEvent aEvent) throws ExecutionException { GerritTask item = null; GerritTableView reviewTableView = GerritTableView .getActiveView(); TableViewer viewer = reviewTableView.getTableViewer(); ISelection tableSelection = viewer.getSelection(); if (tableSelection.isEmpty()) { GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY " ); } else { if (tableSelection instanceof IStructuredSelection ) { Object obj = ((IStructuredSelection) tableSelection).getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; item.toggleStarred(GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)))); try { reviewTableView.setStarred(item.getTaskId(), item.getStarred()); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e.getStatus().getException().getMessage()); <START> item.toggleStarred(GerritTask.IS_STARRED, <END> Boolean.toString(!Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)))); } viewer.update(item, null); } } } return item; }</code><technical_language>Isnt done above, in line 62</technical_language>

Target:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { GerritTask item = null; GerritTableView reviewTableView = GerritTableView .getActiveView(); TableViewer viewer = reviewTableView.getTableViewer(); ISelection tableSelection = viewer.getSelection(); if (tableSelection.isEmpty()) { GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY " ); } else { if (tableSelection instanceof IStructuredSelection ) { Object obj = ((IStructuredSelection) tableSelection).getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; item.toggleStarred(GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)))); try { reviewTableView.setStarred(item.getTaskId(), item.getStarred(), new NullProgressMonitor() {}); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e.getStatus().getException().getMessage()); item.toggleStarred(GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)))); } viewer.update(item, null); } } } return item; }
Source:
<code>public Integer saveLot(final LotGeneratorInputDto lotGeneratorInputDto) { final WorkbenchUser loggedInUser = this.securityService.getCurrentlyLoggedInUser(); lotGeneratorInputDto.setUserId(loggedInUser.getUserid()); lotInputValidator.validate(lotGeneratorInputDto); <START> final String nextStockIDPrefix; <END> if (lotGeneratorInputDto.getGenerateStock()) { if (lotGeneratorInputDto.getStockPrefix() == null || lotGeneratorInputDto.getStockPrefix().isEmpty()) { nextStockIDPrefix = this.stockService.calculateNextStockIDPrefix(DEFAULT_STOCKID_PREFIX, "-"); } else { nextStockIDPrefix = this.stockService.calculateNextStockIDPrefix(lotGeneratorInputDto.getStockPrefix(), "-"); } lotGeneratorInputDto.setStockId(nextStockIDPrefix + "1"); } return lotService.saveLot(lotGeneratorInputDto); }</code><technical_language>@vmaletta this var need declared if? I is outside, right</technical_language>

Target:
public Integer saveLot( final LotGeneratorInputDto lotGeneratorInputDto) { final WorkbenchUser loggedInUser = this.securityService.getCurrentlyLoggedInUser(); lotGeneratorInputDto.setUserId(loggedInUser.getUserid()); lotInputValidator.validate(lotGeneratorInputDto); if (lotGeneratorInputDto.getGenerateStock()) { final String nextStockIDPrefix; if (lotGeneratorInputDto.getStockPrefix() == null || lotGeneratorInputDto.getStockPrefix().isEmpty()) { nextStockIDPrefix = this.stockService.calculateNextStockIDPrefix(DEFAULT_STOCKID_PREFIX, "-"); } else { nextStockIDPrefix = this.stockService.calculateNextStockIDPrefix(lotGeneratorInputDto.getStockPrefix(), "-"); } lotGeneratorInputDto.setStockId(nextStockIDPrefix + "1"); } return lotService.saveLot(lotGeneratorInputDto, this.contextUtil.getProjectInContext().getCropType()); }
Source:
<code>private <R> CompletionStage<PublisherResult<R>> handleSpecificKeys(boolean parallelPublisher, Set<K> keysToInclude, Set<K> keysToExclude, DeliveryGuarantee deliveryGuarantee, Function<? super Publisher<K>, ? extends CompletionStage<R>> collator, Function<? super Publisher<R>, ? extends CompletionStage<R>> finalizer) { AdvancedCache<K, V> cache = deliveryGuarantee == DeliveryGuarantee.AT_MOST_ONCE ? this.cache : remoteCache; return handleSpecificObjects(parallelPublisher, keysToInclude, keysToExclude, keyFlowable -> keyFlowable.concatMapMaybe(key -> RxJavaInterop.completionStageToMaybe(cache.getAsync(key) <START> .thenApply(value -> value == null ? null : key)) <END> ) , collator, finalizer); }</code><technical_language>containsKeyAsync</technical_language>

Target:
private <R> CompletionStage<PublisherResult<R>> handleSpecificKeys(boolean parallelPublisher, Set<K> keysToInclude, Set<K> keysToExclude, DeliveryGuarantee deliveryGuarantee, Function<? super Publisher<K>, ? extends CompletionStage<R>> collator, Function<? super Publisher<R>, ? extends CompletionStage<R>> finalizer) { AdvancedCache<K, V> cache = deliveryGuarantee == DeliveryGuarantee.AT_MOST_ONCE ? this.cache : remoteCache; return handleSpecificObjects(parallelPublisher, keysToInclude, keysToExclude, keyFlowable -> keyFlowable.concatMapMaybe(key -> RxJavaInterop.completionStageToMaybe(cache.containsKeyAsync(key) .thenApply(contains -> contains ? key : null)) ) , collator, finalizer); }
Source:
<code>public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(BUNDLE_LAST_SEARCH, mLastSearch); <START> mSavedInstanceState = outState; <END> saveState(outState); }</code><technical_language>a reference Bundle here</technical_language>

Target:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); saveState(outState); }
Source:
<code>public static boolean evaluateNoexceptSpecifier(ICPPEvaluation noexceptSpecifier) { if (noexceptSpecifier != null) { <START> IntegralValue v = (IntegralValue) noexceptSpecifier.getValue(); <END> if (v.numberValue() != null) return v.numberValue().longValue() == 1; } return false; }</code><technical_language>Do IntegralValue? (Could get if dependent, in case a DependentValue?)</technical_language>

Target:
public static boolean evaluateNoexceptSpecifier(ICPPEvaluation noexceptSpecifier) { if (noexceptSpecifier != null && noexceptSpecifier.getValue() instanceof IntegralValue) { IntegralValue v = (IntegralValue) noexceptSpecifier.getValue(); if (v.numberValue() != null) return v.numberValue().longValue() == 1; } return false; }
Source:
<code>public void testMergeOnRepo() throws Exception { Activator.getDefault().getRepositoryUtil().addConfiguredRepository( clonedRepositoryFile); SWTBotTree tree = getOrOpenView().bot().tree(); myRepoViewUtil.getRootItem(tree, clonedRepositoryFile).select(); ContextMenuHelper.clickContextMenu(tree, myUtil .getPluginLocalizedValue("RepoViewMerge.label")); String title = NLS.bind( UIText.MergeTargetSelectionDialog_TitleMergeWithBranch, <START> new RepositoryBuilder().setGitDir(clonedRepositoryFile).build() <END> .getBranch()); SWTBotShell mergeDialog = bot.shell(title); mergeDialog.close(); }</code><technical_language>FileRepositoryBuilder.create</technical_language>

Target:
public void testMergeOnRepo() throws Exception { Activator.getDefault().getRepositoryUtil().addConfiguredRepository( clonedRepositoryFile); SWTBotTree tree = getOrOpenView().bot().tree(); myRepoViewUtil.getRootItem(tree, clonedRepositoryFile).select(); ContextMenuHelper.clickContextMenu(tree, myUtil .getPluginLocalizedValue("RepoViewMerge.label")); String title = NLS.bind( UIText.MergeTargetSelectionDialog_TitleMergeWithBranch, FileRepositoryBuilder.create(clonedRepositoryFile).getBranch()); SWTBotShell mergeDialog = bot.shell(title); mergeDialog.close(); }
Source:
<code>void rollLog(LastLogMark lastMark) throws NoWritableLedgerDirException { byte buff[] = new byte[16]; ByteBuffer bb = ByteBuffer.wrap(buff); lastMark.getCurMark().writeLogMark(bb); LOG.info("RollLog to persist last marked log : {}", lastMark.getCurMark()); List<File> writableLedgerDirs = ledgerDirsManager .getWritableLedgerDirsForNewLog(); for (File dir : writableLedgerDirs) { <START> File file = new File(dir, lastMarkFileName); <END> FileOutputStream fos = null; try { fos = new FileOutputStream(file); fos.write(buff); fos.getChannel().force(true); fos.close(); fos = null; } catch (IOException e) { LOG.error("Problems writing to " + file, e); } finally { IOUtils.close(LOG, fos); } } }</code><technical_language>I this is crucial fix. reflect in commit summary</technical_language>

Target:
void rollLog(LastLogMark lastMark) throws NoWritableLedgerDirException { byte buff[] = new byte[16]; ByteBuffer bb = ByteBuffer.wrap(buff); lastMark.getCurMark().writeLogMark(bb); if (LOG.isDebugEnabled()) { LOG.debug("RollLog to persist last marked log : {}", lastMark.getCurMark()); } List<File> writableLedgerDirs = ledgerDirsManager .getWritableLedgerDirsForNewLog(); for (File dir : writableLedgerDirs) { File file = new File(dir, lastMarkFileName); FileOutputStream fos = null; try { fos = new FileOutputStream(file); fos.write(buff); fos.getChannel().force(true); fos.close(); fos = null; } catch (IOException e) { LOG.error("Problems writing to " + file, e); } finally { IOUtils.close(LOG, fos); } } }
Source:
<code>public void testWithInvalidAuthorizationCode(String host, String opHost, String redirectUrl, String userId, String userSecret) throws Exception { final ClientInterface client = Tester.newClient(host); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final String state = CoreUtils.secureRandomString(); final String authorizationStr = Tester.getAuthorization(); <START> final String code = codeRequest(client, site.getOxdId(), userId, userSecret, state, CoreUtils.secureRandomString()); <END> final String invalidCode = code.concat("blah"); final GetTokensByCodeParams params = new GetTokensByCodeParams(); params.setOxdId(site.getOxdId()); params.setCode(invalidCode); params.setState(state); try { client.getTokenByCode(authorizationStr, params); } catch (Exception e) { assertErrorResponse(400, INVALID_AUTHORIZATION_CODE_BAD_CODE, e); } }</code><technical_language>redundant line, need valid code if request invalid one</technical_language>

Target:
public void testWithInvalidAuthorizationCode(String host, String opHost, String redirectUrl, String userId, String userSecret) throws Exception { final ClientInterface client = Tester.newClient(host); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final String state = CoreUtils.secureRandomString(); final String authorizationStr = Tester.getAuthorization(); final String code = codeRequest(client, site.getOxdId(), userId, userSecret, state, CoreUtils.secureRandomString()); final String invalidCode = code.concat("blah"); final GetTokensByCodeParams params = new GetTokensByCodeParams(); params.setOxdId(site.getOxdId()); params.setCode(invalidCode); params.setState(state); try { client.getTokenByCode(authorizationStr, params); fail("Test should throw an exception"); } catch (Exception e) { assertErrorResponse(400, INVALID_AUTHORIZATION_CODE_BAD_CODE, e); } }
Source:
<code>public DiscreteVolatilityFunction from(final DoublesPair[] expiryStrikePoints) { ArgumentChecker.notNull(expiryStrikePoints, "strikeExpiryPoints"); final int n = expiryStrikePoints.length; return new DiscreteVolatilityFunction() { @Override <START> public DoubleMatrix1D evaluate(final DoubleMatrix1D x) { <END> final double[] res = new double[n]; final VolatilitySurface vs = _volatilitySurfacePro.getVolSurface(x); for (int i = 0; i < n; i++) { res[i] = vs.getVolatility(expiryStrikePoints[i]); } return new DoubleMatrix1D(res); } @Override public DoubleMatrix2D calculateJacobian(final DoubleMatrix1D x) { final Surface<Double, Double, DoubleMatrix1D> volSurfaceAdjoint = _volatilitySurfacePro.getParameterSensitivitySurface(x); final DoubleMatrix2D res = new DoubleMatrix2D(n, _volatilitySurfacePro.getNumModelParameters()); for (int i = 0; i < n; i++) { res.getData()[i] = volSurfaceAdjoint.getZValue(expiryStrikePoints[i]).getData(); } return res; } @Override public int getLengthOfDomain() { return _volatilitySurfacePro.getNumModelParameters(); } @Override public int getLengthOfRange() { return n; } }; }</code><technical_language>Check args</technical_language>

Target:
public DiscreteVolatilityFunction from(final DoublesPair[] expiryStrikePoints) { ArgumentChecker.notNull(expiryStrikePoints, "strikeExpiryPoints"); final int n = expiryStrikePoints.length; return new DiscreteVolatilityFunction() { @Override public DoubleMatrix1D evaluate(final DoubleMatrix1D x) { ArgumentChecker.notNull(x, "x"); DoubleMatrix1D res = new DoubleMatrix1D(n); double[] data = res.getData(); final VolatilitySurface vs = _volatilitySurfacePro.getVolSurface(x); for (int i = 0; i < n; i++) { data[i] = vs.getVolatility(expiryStrikePoints[i]); } return res; } @Override public DoubleMatrix2D calculateJacobian(final DoubleMatrix1D x) { ArgumentChecker.notNull(x, "x"); final Surface<Double, Double, DoubleMatrix1D> volSurfaceAdjoint = _volatilitySurfacePro.getParameterSensitivitySurface(x); final DoubleMatrix2D res = new DoubleMatrix2D(n, _volatilitySurfacePro.getNumModelParameters()); for (int i = 0; i < n; i++) { res.getData()[i] = volSurfaceAdjoint.getZValue(expiryStrikePoints[i]).getData(); } return res; } @Override public int getLengthOfDomain() { return _volatilitySurfacePro.getNumModelParameters(); } @Override public int getLengthOfRange() { return n; } }; }
Source:
<code>public void testRecovery2() throws URISyntaxException { startContainer(null); URI longLRA = lraClient.startLRA(null, "Long Timeout Recovery Test", LONG_TIMEOUT, ChronoUnit.MILLIS); <START> URI shortLRA = lraClient.startLRA(null, "Long Timeout Recovery Test", SHORT_TIMEOUT, ChronoUnit.MILLIS); <END> try (Response ignore = ClientBuilder.newClient().target(lraListenerURL).path(LRA_LISTENER_KILL) .request() .get()) { fail(testName + ": the container should have halted"); } catch (RuntimeException e) { LRALogger.logger.infof("%s: the container halted", testName); } restartContainer(); int sc = recover(); if (sc != 0) { recover(); } LRAStatus longStatus = getStatus(longLRA); LRAStatus shortStatus = getStatus(shortLRA); Assert.assertEquals("LRA with long timeout should still be active", LRAStatus.Active.name(), longStatus.name()); Assert.assertTrue("LRA with short timeout should not be active", shortStatus == null || LRAStatus.Cancelled.equals(shortStatus)); try (Response response = ClientBuilder.newClient().target(lraListenerURL).path(LRA_LISTENER_UNTIMED_ACTION) .request() .header(LRA_HTTP_CONTEXT_HEADER, longLRA) .put(null)) { Assert.assertEquals("LRA participant action", 200, response.getStatus()); } lraClient.closeLRA(longLRA); String listenerStatus = getStatusFromListener(); assertEquals("LRA listener should have been told that the final state of the LRA was closed", LRAStatus.Closed.name(), listenerStatus); }</code><technical_language>clientId debugging in future</technical_language>

Target:
public void testRecovery2() throws URISyntaxException { startContainer(null); URI longLRA = lraClient.startLRA(null, "Long Timeout Recovery Test", LONG_TIMEOUT, ChronoUnit.MILLIS); URI shortLRA = lraClient.startLRA(null, "Short Timeout Recovery Test", SHORT_TIMEOUT, ChronoUnit.MILLIS); try (Response ignore = client.target(lraListenerURL).path(LRA_LISTENER_KILL) .request() .get()) { fail(testName + ": the container should have halted"); } catch (RuntimeException e) { LRALogger.logger.infof("%s: the container halted", testName); } restartContainer(); int sc = recover(); if (sc != 0) { recover(); } LRAStatus longStatus = getStatus(longLRA); LRAStatus shortStatus = getStatus(shortLRA); Assert.assertEquals("LRA with long timeout should still be active", LRAStatus.Active.name(), longStatus.name()); Assert.assertTrue("LRA with short timeout should not be active", shortStatus == null || LRAStatus.Cancelled.equals(shortStatus)); try (Response response = client.target(lraListenerURL).path(LRA_LISTENER_UNTIMED_ACTION) .request() .header(LRA_HTTP_CONTEXT_HEADER, longLRA) .put(null)) { Assert.assertEquals("LRA participant action", 200, response.getStatus()); } lraClient.closeLRA(longLRA); String listenerStatus = getStatusFromListener(); assertEquals("LRA listener should have been told that the final state of the LRA was closed", LRAStatus.Closed.name(), listenerStatus); }
Source:
<code>public void completedServerStartup() { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()) { <START> if (gatewayArtifactSynchronizerProperties.getGatewayStartup() <END> .equals(APIConstants.GatewayArtifactSynchronizer.GATEWAY_STARTUP_SYNC)) { deployAPIsInSyncMode(); } else { deployAPIsInAsyncMode(); } } jmsTransportHandlerForTrafficManager .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_THROTTLE_DATA, new JMSMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_TOKEN_REVOCATION, new GatewayTokenRevocationMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_CACHE_INVALIDATION, new APIMgtGatewayCacheMessageListener()); jmsTransportHandlerForEventHub .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_NOTIFICATION, new GatewayJMSMessageListener()); }</code><technical_language>equals otherway</technical_language>

Target:
public void completedServerStartup() { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()) { if (APIConstants.GatewayArtifactSynchronizer.GATEWAY_STARTUP_SYNC .equals(gatewayArtifactSynchronizerProperties.getGatewayStartup())) { deployAPIsInSyncMode(); } else { deployAPIsInAsyncMode(); } } jmsTransportHandlerForTrafficManager .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_THROTTLE_DATA, new JMSMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_TOKEN_REVOCATION, new GatewayTokenRevocationMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_CACHE_INVALIDATION, new APIMgtGatewayCacheMessageListener()); jmsTransportHandlerForEventHub .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_NOTIFICATION, new GatewayJMSMessageListener()); }
Source:
<code>public List<ItemStackSnapshot> getRemainingItems() { <START> return remainingItems; <END> }</code><technical_language>this</technical_language>

Target:
public List<ItemStackSnapshot> getRemainingItems() { return this.remainingItems; }
Source:
<code>private void testWithSchemaSearchPath() throws SQLException { deleteDb(getTestName()); final JdbcConnection conn = getJdbcConnection(); <START> final Session session = (Session) conn.getSession(); session.setSchemaSearchPath(new String[]{ "PUBLIC" }); <END> final Statement stat = conn.createStatement(); stat.execute("CREATE TABLE T1 ( ID INT IDENTITY )"); try { stat.executeQuery("SELECT 1 FROM t1"); fail("Table `t1` was accessible but should not have been."); } catch (SQLException e) { final String message = e.getMessage(); assertContains(message, "Table \"t1\" not found (candidates are: \"T1\")"); } conn.close(); deleteDb(getTestName()); }</code><technical_language>SQL command here. <LINK_0></technical_language>

Target:
private void testWithSchemaSearchPath() throws SQLException { deleteDb(getTestName()); Connection conn = getConnection(); Statement stat = conn.createStatement(); stat.execute("SET SCHEMA_SEARCH_PATH PUBLIC"); stat.execute("CREATE TABLE T1 ( ID INT IDENTITY )"); try { stat.executeQuery("SELECT 1 FROM t1"); fail("Table `t1` was accessible but should not have been."); } catch (SQLException e) { String message = e.getMessage(); assertContains(message, "Table \"t1\" not found (candidates are: \"T1\")"); } conn.close(); deleteDb(getTestName()); }
Source:
<code>public void onSuccess() { if (!vmStatic.isHostedEngine()) { return; } <START> vmStatic.getDiskList().stream() <END> .map(DiskImage::getStoragePoolId) .distinct() .forEach((storagePoolId) -> Backend.getInstance().runInternalAction(VdcActionType.ProcessOvfUpdateForStoragePool, new ProcessOvfUpdateForStoragePoolParameters(storagePoolId))); }</code><technical_language>this verified? asking vm disk list populated default, if call VmHandler.updateDisksFromDb() i called. If (and regardless) - note VM disks of a data center. if passed VM object instead of VmStatic vm.getStoragePoolId() instead of iterating vm disks</technical_language>

Target:
public void onSuccess() { if (!vm.isHostedEngine()) { return; } Backend.getInstance().runInternalAction(VdcActionType.ProcessOvfUpdateForStoragePool, new ProcessOvfUpdateForStoragePoolParameters(vm.getStoragePoolId())); }
Source:
<code><START> private List<Row> getKeyHeads() <END> { List<Row> keyHeads = new ArrayList<Row>(rows.size()); for (Row row : rows) { final List<Cell> cells = row.getCellsCopy(); keyHeads.add(new Row(cells.get(0), cells.get(1), new Cell(cells.get(2).getTimestamp()))); } return keyHeads; }</code><technical_language>static</technical_language>

Target:
private static List<Row> getKeyHeads() { List<Row> keyHeads = new ArrayList<Row>(rows.size()); for (Row row : rows) { final List<Cell> cells = row.getCellsCopy(); keyHeads.add(new Row(cells.get(0), cells.get(1), cells.get(2))); } return keyHeads; }
Source:
<code><START> public static Object deepToOrgJson(JsonValue v) { <END> if (v instanceof JsonObject) { JSONObject obj = new JSONObject(); ((JsonObject)v).forEach((key, value) -> obj.put(key, deepToOrgJson(value))); return obj; } else if (v instanceof JsonArray) { JSONArray array = new JSONArray(); ((JsonArray)v).forEach((index, value) -> array.put(deepToOrgJson(value))); return array; } else return v.unwrap(); }</code><technical_language>Please this package-private. I is this necessary for now, is a bit redundant JsonValue#value() JsonValue#unwrap() (and overrides in JsonObject JsonArray) this cleaned in future (and if this public deleted in 1.x versions)</technical_language>

Target:
protected static Object deepToOrgJson(JsonValue v) { if (v.unwrap() == null) { return JSONObject.NULL; } if (v instanceof JsonObject) { JSONObject obj = new JSONObject(); ((JsonObject)v).forEach((key, value) -> obj.put(key, deepToOrgJson(value))); return obj; } else if (v instanceof JsonArray) { JSONArray array = new JSONArray(); ((JsonArray)v).forEach((index, value) -> array.put(deepToOrgJson(value))); return array; } else return v.unwrap(); }
Source:
<code>public void updateData(ByteBuffer data){ <START> if (!data.isDirect()) <END> throw new IllegalArgumentException("Currently only direct buffers are allowed"); this.audioData = data; updateNeeded = true; }</code><technical_language>personal opinion/style want {}s for one-line statements, I know: - jme desired standard - current code right</technical_language>

Target:
public void updateData(ByteBuffer data){ if (!data.isDirect()) { throw new IllegalArgumentException( "Currently only direct buffers are allowed"); } this.audioData = data; updateNeeded = true; }
Source:
<code>protected void onAddRequestStart(Channel channel) { if (addsSemaphore != null) { if (!addsSemaphore.tryAcquire()) { final long throttlingStartTimeNanos = MathUtils.nowInNano(); channel.config().setAutoRead(false); addsBlocked.incrementAndGet(); addsSemaphore.acquireUninterruptibly(); <START> channel.config().setAutoRead(true); <END> addEntryBlockedStats.registerSuccessfulEvent(MathUtils.elapsedNanos(throttlingStartTimeNanos), TimeUnit.NANOSECONDS); addsBlocked.decrementAndGet(); } } final int curr = addsInProgress.incrementAndGet(); maxAddsInProgress.accumulateAndGet(curr, Integer::max); }</code><technical_language>Info/Debug message helpful</technical_language>

Target:
protected void onAddRequestStart(Channel channel) { if (addsSemaphore != null) { if (!addsSemaphore.tryAcquire()) { final long throttlingStartTimeNanos = MathUtils.nowInNano(); channel.config().setAutoRead(false); LOG.info("Too many add requests in progress, disabling autoread on channel {}", channel); addsBlocked.incrementAndGet(); addsSemaphore.acquireUninterruptibly(); channel.config().setAutoRead(true); final long delayNanos = MathUtils.elapsedNanos(throttlingStartTimeNanos); LOG.info("Re-enabled autoread on channel after AddRequest delay of nanos", channel, delayNanos); addEntryBlockedStats.registerSuccessfulEvent(delayNanos, TimeUnit.NANOSECONDS); addsBlocked.decrementAndGet(); } } final int curr = addsInProgress.incrementAndGet(); maxAddsInProgress.accumulateAndGet(curr, Integer::max); }
Source:
<code>private Mono<Void> sendIterable(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transaction) { if (Objects.isNull(messages)) { return monoError(logger, new NullPointerException("'messages' cannot be null.")); } return createMessageBatch().flatMap(messageBatch -> { messages.forEach(message -> messageBatch.tryAddMessage(message)); return sendInternal(messageBatch, transaction); <START> }).onErrorMap(throwable -> { <END> if (throwable instanceof AmqpException) { return new ServiceBusException((AmqpException) throwable, ServiceBusErrorSource.SEND); } else { return throwable; } }); }</code><technical_language>This mapping logic is in places. a static method this calls maps a throwable ServiceBusErrorSource</technical_language>

Target:
private Mono<Void> sendIterable(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transaction) { if (Objects.isNull(messages)) { return monoError(logger, new NullPointerException("'messages' cannot be null.")); } return createMessageBatch().flatMap(messageBatch -> { messages.forEach(message -> messageBatch.tryAddMessage(message)); return sendInternal(messageBatch, transaction); }); }
Source:
<code>protected RouteBuilder createRouteBuilder() throws Exception { final Namespaces ns = new Namespaces("sparql", "<LINK_0>"); final XPathBuilder xpath = new XPathBuilder( " xpath.namespaces(ns); final XPathBuilder uriResult = new XPathBuilder( "/sparql:binding/sparql:uri"); uriResult.namespaces(ns); final XPathBuilder literalResult = new XPathBuilder( "/sparql:binding/sparql:literal"); literalResult.namespaces(ns); return new RouteBuilder() { public void configure() throws IOException { <START> final String fuseki_url = "localhost:" + System.getProperty("fuseki.dynamic.test.port", "3030"); <END> from("direct:start") .process(new AuditSparqlProcessor()) .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); from("direct:query") .to("http4:" + fuseki_url + "/test/query") .split(xpath) .choice() .when().xpath("/sparql:binding/sparql:uri", String.class, ns) .transform().xpath("/sparql:binding/sparql:uri/text()", String.class, ns) .to("mock:sparql.query") .when().xpath("/sparql:binding/sparql:literal", String.class, ns) .transform().xpath("/sparql:binding/sparql:literal/text()", String.class, ns) .to("mock:sparql.query"); from("direct:clear") .transform().constant("update=DELETE WHERE { ?s ?o ?p }") .setHeader(Exchange.CONTENT_TYPE).constant("application/x-www-form-urlencoded") .setHeader(Exchange.HTTP_METHOD).constant("POST") .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); } }; }</code><technical_language>System.getProperty("fuseki.dynamic.test.port", "3030") is FUSEKI_PORT defined top of this class, no</technical_language>

Target:
protected RouteBuilder createRouteBuilder() throws Exception { final Namespaces ns = new Namespaces("sparql", "<LINK_0>"); final XPathBuilder xpath = new XPathBuilder( " xpath.namespaces(ns); final XPathBuilder uriResult = new XPathBuilder( "/sparql:binding/sparql:uri"); uriResult.namespaces(ns); final XPathBuilder literalResult = new XPathBuilder( "/sparql:binding/sparql:literal"); literalResult.namespaces(ns); return new RouteBuilder() { public void configure() throws IOException { final String fuseki_url = "localhost:" + Integer.toString(FUSEKI_PORT); from("direct:start") .process(new AuditSparqlProcessor()) .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); from("direct:query") .to("http4:" + fuseki_url + "/test/query") .split(xpath) .choice() .when().xpath("/sparql:binding/sparql:uri", String.class, ns) .transform().xpath("/sparql:binding/sparql:uri/text()", String.class, ns) .to("mock:sparql.query") .when().xpath("/sparql:binding/sparql:literal", String.class, ns) .transform().xpath("/sparql:binding/sparql:literal/text()", String.class, ns) .to("mock:sparql.query"); from("direct:clear") .transform().constant("update=DELETE WHERE { ?s ?o ?p }") .setHeader(Exchange.CONTENT_TYPE).constant("application/x-www-form-urlencoded") .setHeader(Exchange.HTTP_METHOD).constant("POST") .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); } }; }
Source:
<code>public void queueListeningTestCase() { try { jmsQueueTransportListener.start(queueListeningParameters); logger.info("JMS Transport Listener is starting to listen to the queue " + JMSTestConstants.QUEUE_NAME_2); jmsServer.publishMessagesToQueue(JMSTestConstants.QUEUE_NAME_2); Assert.assertTrue(queueTestMessageProcessor.getCount() > 10, "Expected message count is not received when " + "listening to queue " + JMSTestConstants.QUEUE_NAME_2); jmsQueueTransportListener.stop(); } catch (Exception e) { <START> Assert.fail("Error while listening to queue"); <END> } }</code><technical_language>Simply throwing error test case fail it. catch Assert fail</technical_language>

Target:
public void queueListeningTestCase() throws ServerConnectorException, InterruptedException, JMSException { jmsQueueTransportListener.start(queueListeningParameters); logger.info("JMS Transport Listener is starting to listen to the queue " + JMSTestConstants.QUEUE_NAME_2); jmsServer.publishMessagesToQueue(JMSTestConstants.QUEUE_NAME_2); Assert.assertTrue(queueTestMessageProcessor.getCount() > 10, "Expected message count is not received when " + "listening to queue " + JMSTestConstants.QUEUE_NAME_2); jmsQueueTransportListener.stop(); }
Source:
<code>public void registerDatasources(){ Object obj = get(DATASOURCES_KEY); if (obj != null && obj instanceof GenericConfiguration) { ConcurrentHashMap<String, GenericConfiguration> datasources = ((GenericConfiguration) obj).getSubConfigs(); for(Entry<String, GenericConfiguration> e : datasources.entrySet()){ String dsKey = e.getKey(); GenericConfiguration dsConfig = e.getValue(); Properties dsProps = ((GenericConfiguration) dsConfig).getRebuiltPropertyTree(); Properties dsProperties = new Properties(); for (Entry<Object, Object> entry : dsProps.entrySet()) { String key = (String) entry.getKey(); dsProperties.put(key.toLowerCase(), entry.getValue()); } if(dsProperties.get(HANDLE_KEY.toLowerCase()) != null){ <START> String[] handleNames = ((String)dsProperties.get(HANDLE_KEY.toLowerCase())).toUpperCase().split(","); <END> try { boolean mccr = ObjectTransformer.getBoolean(dsProperties.get("mccr"), false); log.debug("register one datasource "+dsKey); if (mccr) { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.mccr, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } else { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.contentrepository, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } } catch (NodeException exception) { log.error("Error while register datasource: "+dsKey, exception); } } } } }</code><technical_language>trim handle names</technical_language>

Target:
public void registerDatasources() { log.debug("register datasources"); Object obj = get(DATASOURCES_KEY); if (obj != null && obj instanceof GenericConfiguration) { Map<String, GenericConfiguration> datasources = ((GenericConfiguration) obj) .getSubConfigs(); for (Entry<String, GenericConfiguration> e : datasources.entrySet()) { String dsKey = e.getKey(); GenericConfiguration dsConfig = e.getValue(); Properties dsProps = dsConfig.getRebuiltPropertyTree(); Properties dsProperties = new Properties(); for (Entry<Object, Object> entry : dsProps.entrySet()) { String key = (String) entry.getKey(); dsProperties.put(key.toLowerCase(), entry.getValue()); } if (dsProperties.get(HANDLE_KEY.toLowerCase()) != null) { String[] handleNames = ((String) dsProperties .get(HANDLE_KEY.toLowerCase())).split(","); for (int i = 0; i < handleNames.length; i++) { handleNames[i] = convertKey(handleNames[i].trim()); } try { boolean mccr = ObjectTransformer.getBoolean( dsProperties.get("mccr"), false); log.debug("register one datasource " + dsKey); if (mccr) { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.mccr, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } else { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.contentrepository, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } } catch (NodeException exception) { log.error("Error while register datasource: " + dsKey, exception); } } } } }
Source:
<code><START> public ByteBuffer encode(ByteBuffer bb) { <END> int size = 0; for (DataHolder dataHolder : data) { size += dataHolder.size(true); } bb.putInt(size); for (DataHolder dataHolder : data) { dataHolder.encode(bb, true); } return bb; }</code><technical_language>methods identical for ByteBuffer from. a strategy pattern (a bit guava's Supplier) factor out commonality</technical_language>

Target:
public ByteBuffer encode(ByteBuffer bb) { int size = 0; for (DataHolder dataHolder : data) { size += dataHolder.size(true); } WriteBuffer writeBuffer = new WriteBuffer(bb); writeBuffer.putVlqInt(size); for (DataHolder dataHolder : data) { dataHolder.encode(writeBuffer, true); } return bb; }
Source:
<code>public void updateState() { if (AccountUtil.isLoggedIn()) { accountNameView.setText(AccountUtil.getUserName()); accountNameView.setVisibility(VISIBLE); loginLogoutButton.setText(getContext().getString(R.string.preference_title_logout)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorError)); accountAvatar.setVisibility(View.VISIBLE); accountWikiGlobe.setVisibility(View.GONE); notificationsContainer.setVisibility(View.VISIBLE); if (ReleaseUtil.isPreBetaRelease() && Prefs.getTotalUserDescriptionsEdited() >= ACTION_DESCRIPTION_EDIT_UNLOCK_THRESHOLD) { editTasksContainer.setVisibility(VISIBLE); <START> maybeShowIndicatorDots(); <END> } } else { accountNameView.setVisibility(GONE); loginLogoutButton.setText(getContext().getString(R.string.main_drawer_login)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorAccent)); accountAvatar.setVisibility(View.GONE); accountWikiGlobe.setVisibility(View.VISIBLE); notificationsContainer.setVisibility(View.GONE); editTasksContainer.setVisibility(GONE); } }</code><technical_language>This is a good idea, I this called unconditionally (i.e. of outer if block, of logged in)</technical_language>

Target:
public void updateState() { if (AccountUtil.isLoggedIn()) { accountNameView.setText(AccountUtil.getUserName()); accountNameView.setVisibility(VISIBLE); loginLogoutButton.setText(getContext().getString(R.string.preference_title_logout)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorError)); accountAvatar.setVisibility(View.VISIBLE); accountWikiGlobe.setVisibility(View.GONE); notificationsContainer.setVisibility(View.VISIBLE); if (ReleaseUtil.isPreBetaRelease() && Prefs.getTotalUserDescriptionsEdited() >= ACTION_DESCRIPTION_EDIT_UNLOCK_THRESHOLD) { editTasksContainer.setVisibility(VISIBLE); } maybeShowIndicatorDots(); } else { accountNameView.setVisibility(GONE); loginLogoutButton.setText(getContext().getString(R.string.main_drawer_login)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorAccent)); accountAvatar.setVisibility(View.GONE); accountWikiGlobe.setVisibility(View.VISIBLE); notificationsContainer.setVisibility(View.GONE); editTasksContainer.setVisibility(GONE); } }
Source:
<code>private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { <START> PathMatcher jarMatcher = FileSystems.getDefault() <END> .getPathMatcher("glob:*.jar"); @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(jarMatcher.matches(n1), jarMatcher.matches(n2)) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }</code><technical_language>I prefer avoid dependencies FileSystems.getDefault() (although in this case safe, this PathMather depend filesystem separator)</technical_language>

Target:
private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(n1.toString().endsWith(".jar"), n2.toString().endsWith(".jar")) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }
Source:
<code>@Override public void parseArguments(CommandArgIterator argIter) { String s = argIter.nextArg("New cluster state not found."); try { state = ClusterState.valueOf(s.toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Can't parse new cluster state. State: " + s, e); } <START> force = false; <END> if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { force = true; argIter.nextArg(""); } } }</code><technical_language>Do need this line? Default force is false already</technical_language>

Target:
@Override public void parseArguments(CommandArgIterator argIter) { String s = argIter.nextArg("New cluster state not found."); try { state = ClusterState.valueOf(s.toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Can't parse new cluster state. State: " + s, e); } forceDeactivation = false; if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { forceDeactivation = true; argIter.nextArg(""); } } }
Source:
<code>public String getActiveStateTxnName(){ <START> return "PAST_TRANSACTION"; <END> }</code><technical_language>include timestamp of time travel</technical_language>

Target:
public String getActiveStateTxnName(){ return "PAST_TRANSACTION@"+txn.getTxnId(); }
Source:
<code>public GrillDriver select(Collection<GrillDriver> drivers, final Map<GrillDriver, String> driverQueries, final Configuration conf) { return Collections.min(drivers, new Comparator<GrillDriver>() { @Override public int compare(GrillDriver d1, GrillDriver d2) { DriverQueryPlan c1 = null; DriverQueryPlan c2 = null; conf.setBoolean(GrillConfConstants.PREPARE_ON_EXPLAIN, false); if(driverQueries.get(d1) == null) { return 1; } if(driverQueries.get(d2) == null) { return -1; } try { c1 = d1.explain(driverQueries.get(d1), conf); } catch (GrillException e) { <START> LOG.warn("Explain on Driver:" + d1.getClass().getSimpleName() + " failed", e); <END> } try { c2 = d2.explain(driverQueries.get(d2), conf); } catch (GrillException e) { LOG.warn("Explain on Driver" + d2.getClass().getSimpleName() + " failed", e); } if (c1 == null && c2 == null) { return 0; } else if (c1 == null && c2 != null) { return 1; } else if (c1 != null && c2 == null) { return -1; } return c1.getCost().compareTo(c2.getCost()); } }); }</code><technical_language>log query handle</technical_language>

Target:
public GrillDriver select(Collection<GrillDriver> drivers, final Map<GrillDriver, String> driverQueries, final Configuration conf) { return Collections.min(drivers, new Comparator<GrillDriver>() { @Override public int compare(GrillDriver d1, GrillDriver d2) { DriverQueryPlan c1 = null; DriverQueryPlan c2 = null; conf.setBoolean(GrillConfConstants.PREPARE_ON_EXPLAIN, false); if(driverQueries.get(d1) == null) { return 1; } if(driverQueries.get(d2) == null) { return -1; } try { c1 = d1.explain(driverQueries.get(d1), conf); } catch (GrillException e) { LOG.warn("Explain query:" + driverQueries.get(d1) + " on Driver:" + d1.getClass().getSimpleName() + " failed", e); } try { c2 = d2.explain(driverQueries.get(d2), conf); } catch (GrillException e) { LOG.warn("Explain query:" + driverQueries.get(d2) + " on Driver:" + d2.getClass().getSimpleName() + " failed", e); } if (c1 == null && c2 == null) { return 0; } else if (c1 == null && c2 != null) { return 1; } else if (c1 != null && c2 == null) { return -1; } return c1.getCost().compareTo(c2.getCost()); } }); }
Source:
<code>public void verifyLatestDateInDatePicker() { String currentDate = datePickerInput.getAttribute("value"); String latestDate = DateTimeFormat.forPattern("MMMM d, yyyy").withLocale(Locale.ENGLISH) .print(DateTime.now().minus(Period.days(2)).withZone(DateTimeZone.UTC)); <START> Assertion.assertEquals(latestDate, currentDate, "Current date and the latest possible date are not the same"); <END> }</code><technical_language>I latestDate passed param, doc: assertEquals(Object actual, Object expected, String message)</technical_language>

Target:
public void verifyLatestDateInDatePicker() { String currentDate = datePickerInput.getAttribute("value"); String latestDate = DateTimeFormat.forPattern("MMMM d, yyyy").withLocale(Locale.ENGLISH) .print(DateTime.now().minus(Period.days(2)).withZone(DateTimeZone.UTC)); Assertion.assertEquals(currentDate, latestDate, "Current date and the latest possible date are not the same"); }
Source:
<code>public boolean doMonitor(ServiceEmitter emitter) { for (FireDepartment fireDepartment : fireDepartments) { FireDepartmentMetrics metrics = fireDepartment.getMetrics().snapshot(); FireDepartmentMetrics previous = previousValues.get(fireDepartment); if (previous == null) { previous = new FireDepartmentMetrics(); } final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder() .setUser2(fireDepartment.getDataSchema().getDataSource()); long thrownAway = metrics.thrownAway() - previous.thrownAway(); if (thrownAway > 0) { <START> log.warn("[%,d] events thrown away because they are outside the window period!"); <END> } emitter.emit(builder.build("events/thrownAway", thrownAway)); final long unparseable = metrics.unparseable() - previous.unparseable(); if (unparseable > 0) { log.error("[%,d] Unparseable events! Turn on debug logging to see exception stack trace.", unparseable); } emitter.emit(builder.build("events/unparseable", unparseable)); emitter.emit(builder.build("events/processed", metrics.processed() - previous.processed())); emitter.emit(builder.build("rows/output", metrics.rowOutput() - previous.rowOutput())); emitter.emit(builder.build("persists/num", metrics.numPersists() - previous.numPersists())); emitter.emit(builder.build("persists/time", metrics.persistTimeMillis() - previous.persistTimeMillis())); emitter.emit( builder.build( "persists/backPressure", metrics.persistBackPressureMillis() - previous.persistBackPressureMillis() ) ); previousValues.put(fireDepartment, metrics); } return true; }</code><technical_language>pass in thrownAway parameter :)</technical_language>

Target:
public boolean doMonitor(ServiceEmitter emitter) { for (FireDepartment fireDepartment : fireDepartments) { FireDepartmentMetrics metrics = fireDepartment.getMetrics().snapshot(); FireDepartmentMetrics previous = previousValues.get(fireDepartment); if (previous == null) { previous = new FireDepartmentMetrics(); } final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder() .setUser2(fireDepartment.getDataSchema().getDataSource()); final long thrownAway = metrics.thrownAway() - previous.thrownAway(); if (thrownAway > 0) { log.warn("[%,d] events thrown away because they are outside the window period!", thrownAway); } emitter.emit(builder.build("events/thrownAway", thrownAway)); final long unparseable = metrics.unparseable() - previous.unparseable(); if (unparseable > 0) { log.error("[%,d] Unparseable events! Turn on debug logging to see exception stack trace.", unparseable); } emitter.emit(builder.build("events/unparseable", unparseable)); emitter.emit(builder.build("events/processed", metrics.processed() - previous.processed())); emitter.emit(builder.build("rows/output", metrics.rowOutput() - previous.rowOutput())); emitter.emit(builder.build("persists/num", metrics.numPersists() - previous.numPersists())); emitter.emit(builder.build("persists/time", metrics.persistTimeMillis() - previous.persistTimeMillis())); emitter.emit( builder.build( "persists/backPressure", metrics.persistBackPressureMillis() - previous.persistBackPressureMillis() ) ); previousValues.put(fireDepartment, metrics); } return true; }
Source:
<code>protected IStatus validateItem(Object item) { <START> if (fdisabledModels != null && fdisabledModels.contains(item)) { <END> return new Status(IStatus.CANCEL, IPDEUIConstants.PLUGIN_ID, 0, "", null); } return new Status(IStatus.OK, IPDEUIConstants.PLUGIN_ID, 0, "", null); }</code><technical_language>null checks avoided</technical_language>

Target:
protected IStatus validateItem(Object item) { if (fdisabledModels.contains(item)) { return new Status(IStatus.CANCEL, IPDEUIConstants.PLUGIN_ID, 0, "", null); } return new Status(IStatus.OK, IPDEUIConstants.PLUGIN_ID, 0, "", null); }
Source:
<code>private StilPlotter setUpTests(ExtSed sed) throws Exception { preferences = new VisualizerComponentPreferences(ws); preferences.update(sed); <START> preferences.getDataModel().setSelectedSed(sed); <END> StilPlotter plot = new StilPlotter(preferences); plot.resetPlot(false, false); return plot; }</code><technical_language>I surprised need call methods underlying class (preference.update delegates datastore, preferences.getDataModel in order set SED. I be</technical_language>

Target:
private StilPlotter setUpTests(ExtSed sed) throws Exception { preferences = new VisualizerComponentPreferences(ws); preferences.getDataStore().update(sed); preferences.getDataModel().setSelectedSed(sed); StilPlotter plot = new StilPlotter(preferences); return plot; }
Source:
<code>protected String[] customCommandLineValidation() { final List<String> errors = new ArrayList<String>(); if (PROBABILITY < 0 || PROBABILITY > 1) { errors.add("PROBABILITY must be a value between 0 and 1, found: " + PROBABILITY); } <START> IOUtil.assertFileIsReadable(INPUT); <END> IOUtil.assertFileIsWritable(OUTPUT); if (errors.isEmpty()) { return null; } else { return errors.toArray(new String[errors.size()]); } }</code><technical_language>put in doWork method, others want instance of this class do work</technical_language>

Target:
protected String[] customCommandLineValidation() { final List<String> errors = new ArrayList<String>(); if (FRACTION < 0 || FRACTION > 1) { errors.add("FRACTION must be a value between 0 and 1, found: " + FRACTION); } if (errors.isEmpty()) { return null; } else { return errors.toArray(new String[errors.size()]); } }
Source:
<code>protected boolean isTransientException(Throwable e) { if(e instanceof SQLException) { final String sqlState = ((SQLException) e).getSQLState(); <START> return sqlState.startsWith("08") || sqlState.startsWith("53"); <END> } return false; }</code><technical_language>Of "53" class of errors, I "53300" transient, no</technical_language>

Target:
protected boolean isTransientException(Throwable e) { if(e instanceof SQLException) { final String sqlState = ((SQLException) e).getSQLState(); return sqlState != null && (sqlState.startsWith("08") || sqlState.startsWith("53")); } return false; }