auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void testRemoveNonUniqueCaches() throws Exception { <END> lists1.add(LIST_ID1); lists1.add(LIST_ID2); lists2.add(LIST_ID1); lists3.add(LIST_ID2); lists3.add(LIST_ID3); final Set<Geocache> toBeRemoved = RemoveNotUniqueHelper.removeNonUniqueCaches(geoCaches); assertThat(toBeRemoved.size()).isEqualTo(2); assertThat(toBeRemoved.contains(gc1)).isTrue(); assertThat(toBeRemoved.contains(gc2)).isFalse(); assertThat(toBeRemoved.contains(gc3)).isTrue(); }</code><technical_language>Is throws Exception needed for test methods</technical_language>

Target:
public void testRemoveNonUniqueCaches() { lists1.add(LIST_ID1); lists1.add(LIST_ID2); lists2.add(LIST_ID1); lists3.add(LIST_ID2); lists3.add(LIST_ID3); final Set<Geocache> toBeRemoved = RemoveNotUniqueHelper.removeNonUniqueCaches(geoCaches); assertThat(toBeRemoved.size()).isEqualTo(2); assertThat(toBeRemoved.contains(gc1)).isTrue(); assertThat(toBeRemoved.contains(gc2)).isFalse(); assertThat(toBeRemoved.contains(gc3)).isTrue(); }
Source:
<code>void forColon() { <START> ArrayList<Integer> ll = new ArrayList<Integer>(); <END> for (int x:ll) for (int x : ll) }</code><technical_language>Please int[] instead of list avoid unnecessary import large diff in test</technical_language>

Target:
void forColon() { int ll[] = new int[10]; for (int x:ll) for (int x :ll) for (int x: ll) for (int x : ll) }
Source:
<code>public Iterable<Bout> search(final String term) throws IOException { <START> throw new UnsupportedOperationException("#search()"); <END> }</code><technical_language>@komaz for return empty iterable, is need react strongly missing implementation</technical_language>

Target:
public Iterable<Bout> search(final String term) throws IOException { final List<Bout> result = new ArrayList<>(16); for (final Bout bout : this.iterate()) { if (bout.messages().search(term).iterator().hasNext()) { result.add(bout); } } return result; }
Source:
<code>public static org.jboss.jbossts.txbridge.outbound.OutboundBridge getOutboundBridge() { txbridgeLogger.logger.trace("OutboundBridgeManager.getOutboundBridge()"); try { Transaction transaction = (Transaction)TransactionManager.transactionManager(new InitialContext()).getTransaction(); <START> Uid outboundMappingUid = new Uid(); <END> if(!outboundBridgeMappings.containsKey(outboundMappingUid)) { createMapping(transaction, outboundMappingUid); } return outboundBridgeMappings.get(outboundMappingUid); } catch(SystemException | NamingException e) { txbridgeLogger.logger.error(e); } return null; }</code><technical_language>I this is wrong txId is important for ensuring outbound bridge once. a new uid time find in map in outboundBridgeMappings. get Uid a WFTC tx client following: Uid externalTxId = new Uid(((org.wildfly.transaction.client.LocalTransaction)transaction).getXid().getGlobalTransactionId()) reason I spotted this I noticed renamed variable names, I revert variable name changes. Also, check circumstances get a org.wildfly.transaction.client.RemoteTransaction obvious get Xid allow enlisting resources I expect is rare get happen in this code path</technical_language>

Target:
public static org.jboss.jbossts.txbridge.outbound.OutboundBridge getOutboundBridge() { txbridgeLogger.logger.trace("OutboundBridgeManager.getOutboundBridge()"); try { Transaction transaction = (Transaction)TransactionManager.transactionManager(new InitialContext()).getTransaction(); transctionToUidMappings.putIfAbsent(transaction, new Uid()); Uid outboundMappingUid = transctionToUidMappings.get(transaction); if(!outboundBridgeMappings.containsKey(outboundMappingUid)) { createMapping(transaction, outboundMappingUid); } return outboundBridgeMappings.get(outboundMappingUid); } catch(SystemException | NamingException e) { txbridgeLogger.logger.error(e); } return null; }
Source:
<code>public void testSimplePush(GitConnectionFactory connectionFactory) throws IOException, ServerException, URISyntaxException, UnauthorizedException { GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository); GitConnection remoteConnection = connectionFactory.getConnection(remoteRepo.getAbsolutePath()); remoteConnection.clone(newDto(CloneRequest.class).withRemoteUri(connection.getWorkingDir().getAbsolutePath()) .withWorkingDir(remoteConnection.getWorkingDir().getAbsolutePath())); addFile(remoteConnection, "newfile", "content"); remoteConnection.add(newDto(AddRequest.class).withFilepattern(Arrays.asList("."))); remoteConnection.commit(newDto(CommitRequest.class).withMessage("Fake commit")); PushResponse pushResponse = remoteConnection.push(newDto(PushRequest.class) <START> .withRefSpec(Arrays.asList("refs/heads/master:refs/heads/test")) <END> .withRemote("origin") .withTimeout(-1)); assertEquals(connection.branchList(newDto(BranchListRequest.class)).size(), 1); connection.checkout(newDto(CheckoutRequest.class).withName("test")); assertTrue(new File(connection.getWorkingDir(), "newfile").exists()); assertTrue(pushResponse.getCommandOutput().contains(connection.getWorkingDir().getAbsolutePath())); }</code><technical_language>ImmutableList.of</technical_language>

Target:
public void testSimplePush(GitConnectionFactory connectionFactory) throws IOException, ServerException, URISyntaxException, UnauthorizedException { GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository); GitConnection remoteConnection = connectionFactory.getConnection(remoteRepo.getAbsolutePath()); remoteConnection.clone(newDto(CloneRequest.class).withRemoteUri(connection.getWorkingDir().getAbsolutePath()) .withWorkingDir(remoteConnection.getWorkingDir().getAbsolutePath())); addFile(remoteConnection, "newfile", "content"); remoteConnection.add(newDto(AddRequest.class).withFilepattern(Collections.singletonList("."))); remoteConnection.commit(newDto(CommitRequest.class).withMessage("Fake commit")); remoteConnection.push(newDto(PushRequest.class) .withRefSpec(Collections.singletonList("refs/heads/master:refs/heads/test")) .withRemote("origin") .withTimeout(-1)); assertEquals(connection.branchList(newDto(BranchListRequest.class)).size(), 1); connection.checkout(newDto(CheckoutRequest.class).withName("test")); assertTrue(new File(connection.getWorkingDir(), "newfile").exists()); }
Source:
<code>public Span buildAndStartSpan(String name, SpanContext spanContext) { <START> if(getTracer() == null) { <END> m_tracer = GlobalTracer.get(); } if (spanContext == null) { return getTracer().buildSpan("Provisiond-" + name).start(); } else { return getTracer().buildSpan("Provisiond-" + name).asChildOf(spanContext).start(); } }</code><technical_language>odd mix calls getTracer() direct access m_tracer in this method</technical_language>

Target:
public Span buildAndStartSpan(String name, SpanContext spanContext) { if(m_tracer == null) { m_tracer = GlobalTracer.get(); } if (spanContext == null) { return m_tracer.buildSpan("Provisiond-" + name).start(); } else { return m_tracer.buildSpan("Provisiond-" + name).asChildOf(spanContext).start(); } }
Source:
<code>protected boolean validateExtensionElement(IConfigurationElement element) { final boolean ret; if (TAG_ENGINE_FACTORY.equals(element.getName())) { if (element.getAttribute(ATT_CLASS) == null) { logMissingAttribute(element, ATT_CLASS); ret = false; } else if (element.getAttribute(ATT_RANKING) == null) { String rankingStr = element.getAttribute(ATT_RANKING); try { <START> Integer.parseInt(rankingStr); <END> } catch (NumberFormatException nfe) { log(IStatus.ERROR, element, EMFCompareRCPMessages.getString( "malformed.extension.attribute", ATT_RANKING)); } logMissingAttribute(element, ATT_RANKING); ret = false; } else { ret = true; } } else { ret = false; } return ret; }</code><technical_language>rankingStr is null, this fail in NPE. Split another if for postProcessors extension point</technical_language>

Target:
protected boolean validateExtensionElement(IConfigurationElement element) { final boolean ret; if (TAG_ENGINE_FACTORY.equals(element.getName())) { if (element.getAttribute(ATT_CLASS) == null) { logMissingAttribute(element, ATT_CLASS); ret = false; } else if (element.getAttribute(ATT_RANKING) == null) { logMissingAttribute(element, ATT_RANKING); ret = false; } else if (element.getAttribute(ATT_RANKING) != null) { String rankingStr = element.getAttribute(ATT_RANKING); try { Integer.parseInt(rankingStr); } catch (NumberFormatException nfe) { log(IStatus.ERROR, element, EMFCompareRCPMessages.getString( "malformed.extension.attribute", ATT_RANKING)); return false; } ret = true; } else { ret = true; } } else { ret = false; } return ret; }
Source:
<code>short getCurrentTimeMillis() { <START> return (short) System.currentTimeMillis(); <END> }</code><technical_language>proper bitmasking usage of timestamp bytes more obvious</technical_language>

Target:
long getCurrentTimeMillis() { return System.currentTimeMillis(); }
Source:
<code>static PermissionManager getInstance(SyncUser syncUser) { synchronized (cacheLock) { String userId = syncUser.getIdentity(); ThreadLocal<Cache> threadLocalCache = cache.get(userId); if (threadLocalCache == null) { threadLocalCache = new ThreadLocal<>(); threadLocalCache.set(new Cache()); cache.put(userId, threadLocalCache); } <START> Cache c = threadLocalCache.get(); <END> if (c.instanceCounter == 0) { c.pm = new PermissionManager(syncUser); } c.instanceCounter++; return c.pm; } }</code><technical_language>c is null if getInstance() is called other threads allocated threadLocalCache. override ThreadLocal#initialValue() instead of setting initial calling set()</technical_language>

Target:
static PermissionManager getInstance(SyncUser syncUser) { synchronized (cacheLock) { String userId = syncUser.getIdentity(); ThreadLocal<Cache> threadLocalCache = cache.get(userId); if (threadLocalCache == null) { threadLocalCache = new ThreadLocal<Cache>() { @Override protected Cache initialValue() { return new Cache(); } }; cache.put(userId, threadLocalCache); } Cache c = threadLocalCache.get(); if (c.instanceCounter == 0) { c.pm = new PermissionManager(syncUser); } c.instanceCounter++; return c.pm; } }
Source:
<code>private void processReferenceInstances(Object entity, Consumer<BaseEntity<?>> handler) { BaseEntity<?> referenceInstance = (BaseEntity<?>) getDescriptor().getReferenceInstance(); <START> if (entity instanceof MongoBlob) { <END> referenceInstance.getMapper() .select(referenceInstance.getClass()) .eq(nameAsMapping, ((MongoBlob) entity).getBlobKey()) .iterateAll(handler); } if (entity instanceof SQLBlob) { referenceInstance.getMapper() .select(referenceInstance.getClass()) .eq(nameAsMapping, ((SQLBlob) entity).getBlobKey()) .iterateAll(handler); } }</code><technical_language>need cast DB impl - Blob.getBlobKey() is abstract</technical_language>

Target:
private void processReferenceInstances(Object entity, Consumer<BaseEntity<?>> handler) { BaseEntity<?> referenceInstance = (BaseEntity<?>) getDescriptor().getReferenceInstance(); referenceInstance.getMapper() .select(referenceInstance.getClass()) .eq(nameAsMapping, ((Blob) entity).getBlobKey()) .iterateAll(handler); }
Source:
<code>public void testFillNodes() { try { long startTime = 1; File historyTreeFile = NonNullUtils.checkNotNull(File.createTempFile("HistoryTreeBackendTest", ".ht")); HistoryTreeBackendStub backend = new HistoryTreeBackendStub(SSID, historyTreeFile, PROVIDER_VERSION, startTime, BLOCK_SIZE, MAX_CHILDREN); <START> final int nbAttr = 5; <END> int duration = nbAttr; int quarkTest = nbAttr; long time = startTime + duration; HTInterval interval = new HTInterval(startTime, time, quarkTest, TmfStateValue.newValueLong(time)); backend.insertPastState(interval.getStartTime(), interval.getEndTime(), interval.getAttribute(), interval.getStateValue()); while (backend.getHistoryTree().getDepth() < 3) { backend.insertPastState( Math.max(startTime, time - duration), time - 1, (int) time % nbAttr, TmfStateValue.newValueLong(time)); time++; } HTNode latestLeaf = backend.getHistoryTree().getLatestLeaf(); while (interval.getSizeOnDisk() <= latestLeaf.getNodeFreeSpace() || latestLeaf.isOnDisk()) { backend.insertPastState( Math.max(startTime, time - duration), time - 1, (int) time % nbAttr, TmfStateValue.newValueLong(time)); time++; } backend.insertPastState(interval.getEndTime() + 1, time, quarkTest, TmfStateValue.newValueLong(time)); backend.getHistoryTree().assertIntegrity(); } catch (IOException e) { fail(e.getMessage()); } }</code><technical_language>this part of static final definitions top</technical_language>

Target:
public void testFillNodes() { try { final int nbAttr = 5; final int depthToRead = 3; long startTime = 1; File historyTreeFile = NonNullUtils.checkNotNull(File.createTempFile("HistoryTreeBackendTest", ".ht")); HistoryTreeBackendStub backend = new HistoryTreeBackendStub(SSID, historyTreeFile, PROVIDER_VERSION, startTime, BLOCK_SIZE, MAX_CHILDREN); int duration = nbAttr; int quarkTest = nbAttr; long time = startTime + duration; HTInterval interval = new HTInterval(startTime, time, quarkTest, TmfStateValue.newValueLong(time)); backend.insertPastState(interval.getStartTime(), interval.getEndTime(), interval.getAttribute(), interval.getStateValue()); while (backend.getHistoryTree().getDepth() < depthToRead) { backend.insertPastState( Math.max(startTime, time - duration), time - 1, (int) time % nbAttr, TmfStateValue.newValueLong(time)); time++; } HTNode latestLeaf = backend.getHistoryTree().getLatestLeaf(); while (interval.getSizeOnDisk() <= latestLeaf.getNodeFreeSpace() || latestLeaf.isOnDisk()) { backend.insertPastState( Math.max(startTime, time - duration), time - 1, (int) time % nbAttr, TmfStateValue.newValueLong(time)); time++; } backend.insertPastState(interval.getEndTime() + 1, time, quarkTest, TmfStateValue.newValueLong(time)); backend.getHistoryTree().assertIntegrity(); } catch (IOException e) { fail(e.getMessage()); } }
Source:
<code>public void scaleDownDelay() throws Exception { createSessionFactory(); ClientSession session = createSession(sf, true, true); session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); sendMessages(session, producer, 1000); crash(session); <START> Thread.sleep(100); <END> ClientConsumer consumer = session.createConsumer(ADDRESS); session.start(); receiveDurableMessages(consumer); session.close(); sf.close(); Assert.assertEquals(0, sf.numSessions()); Assert.assertEquals(0, sf.numConnections()); }</code><technical_language>nice if instead a class called Wait, a condition reached in server. This type of sleep eventually fail. for a case test pass.. this eventually a failure</technical_language>

Target:
public void scaleDownDelay() throws Exception { createSessionFactory(); ClientSession session = createSession(sf, true, true); session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); sendMessages(session, producer, 1000); crash(session); Queue serverQueue = backupServer.getServer().locateQueue(ADDRESS); Wait.assertEquals(1000, serverQueue::getMessageCount); ClientConsumer consumer = session.createConsumer(ADDRESS); session.start(); receiveDurableMessages(consumer); session.close(); sf.close(); Assert.assertEquals(0, sf.numSessions()); Assert.assertEquals(0, sf.numConnections()); }
Source:
<code>private TechnologyTreePanel getTechTree() { if (techPanel == null) { techPanel = new TechnologyTreePanel( Constant.messages.getString("context.technology.tree.root")); } else { <START> techPanel.refresh(); <END> } return techPanel; }</code><technical_language>This prevents techs saved</technical_language>

Target:
private TechnologyTreePanel getTechTree() { if (techPanel == null) { techPanel = new TechnologyTreePanel( Constant.messages.getString("context.technology.tree.root")); } return techPanel; }
Source:
<code>private ClassLoader getClassLoaderForShell(Long definitionId) throws SClassLoaderException { ClassLoader classLoader; if (definitionId == null) { <START> throw new SClassLoaderException("Unable to execute groovy outside of a process classloader, no definitionId is given"); <END> } else { classLoader = classLoaderService.getLocalClassLoader(DEFINITION_TYPE, definitionId); classLoaderService.addListener(DEFINITION_TYPE, definitionId, this); } return classLoader; }</code><technical_language>in a "normal" case</technical_language>

Target:
private ClassLoader getClassLoaderForShell(Long definitionId) throws SClassLoaderException { ClassLoader classLoader; if (definitionId == null) { classLoader = Thread.currentThread().getContextClassLoader(); if (debugEnabled) { IllegalStateException illegalStateException = new IllegalStateException(); logger.log(this.getClass(), TechnicalLogSeverity.DEBUG, "Creating a shell without definition id, might cause issue when reloading classes", illegalStateException); } } else { classLoader = classLoaderService.getLocalClassLoader(DEFINITION_TYPE, definitionId); classLoaderService.addListener(DEFINITION_TYPE, definitionId, this); } return classLoader; }
Source:
<code>private void handleDispatchExceptionCase(ExecutionReference reference, ExecutableFlow exflow, Executor lastSelectedExecutor, Set<Executor> remainingExecutors) throws ExecutorManagerException { <START> reference.setNumErrors(reference.getNumErrors() + 1); <END> reference.setExecutor(null); if (reference.getNumErrors() >= MAX_DISPATCHING_ERRORS_PERMITTED || remainingExecutors.size() <= 1) { logger.error("Failed to process queued flow"); finalizeFlows(exflow); } else { remainingExecutors.remove(lastSelectedExecutor); processFlow(reference, exflow, remainingExecutors); } }</code><technical_language>add logging this condition</technical_language>

Target:
private void handleDispatchExceptionCase(ExecutionReference reference, ExecutableFlow exflow, Executor lastSelectedExecutor, Set<Executor> remainingExecutors) throws ExecutorManagerException { logger .info(String .format( "Reached handleDispatchExceptionCase stage for exec %d with error count %d", exflow.getExecutionId(), reference.getNumErrors())); reference.setNumErrors(reference.getNumErrors() + 1); reference.setExecutor(null); if (reference.getNumErrors() >= MAX_DISPATCHING_ERRORS_PERMITTED || remainingExecutors.size() <= 1) { logger.error("Failed to process queued flow"); finalizeFlows(exflow); } else { remainingExecutors.remove(lastSelectedExecutor); processFlow(reference, exflow, remainingExecutors); } }
Source:
<code>private long getComplexStateRetainedSize(TestComplexState state) { long retainedSize = ClassLayout.parseClass(state.getClass()).instanceSize(); Field[] fields = state.getClass().getDeclaredFields(); try { for (Field field : fields) { Class type = field.getType(); field.setAccessible(true); if (type.equals(BlockBigArray.class) || type.equals(BooleanBigArray.class) || type.equals(SliceBigArray.class) || <START> type.equals(ByteBigArray.class) || type.equals(DoubleBigArray.class) || type.equals(LongBigArray.class)) { <END> MethodHandle sizeOf = MethodHandles.lookup().findVirtual(type, "sizeOf", MethodType.methodType(long.class)); retainedSize += (long) sizeOf.invokeWithArguments(field.get(state)); } } } catch (Throwable t) { throw new RuntimeException(t); } return retainedSize; }</code><technical_language>generally == for equals comparison Class</technical_language>

Target:
private long getComplexStateRetainedSize(TestComplexState state) { long retainedSize = ClassLayout.parseClass(state.getClass()).instanceSize(); Field[] fields = state.getClass().getDeclaredFields(); try { for (Field field : fields) { Class type = field.getType(); field.setAccessible(true); if (type == BlockBigArray.class || type == BooleanBigArray.class || type == SliceBigArray.class || type == ByteBigArray.class || type == DoubleBigArray.class || type == LongBigArray.class) { MethodHandle sizeOf = Reflection.methodHandle(type, "sizeOf", null); retainedSize += (long) sizeOf.invokeWithArguments(field.get(state)); } } } catch (Throwable t) { throw new RuntimeException(t); } return retainedSize; }
Source:
<code>private void handleOpenPageIntent(Intent intent) { String pagePosition = intent.getStringExtra(ARG_OPEN_PAGE); if (!TextUtils.isEmpty(pagePosition)) { switch (pagePosition) { case ARG_MY_SITE: mBottomNav.setCurrentSelectedPage(PageType.MY_SITE); break; case ARG_NOTIFICATIONS: mBottomNav.setCurrentSelectedPage(PageType.NOTIFS); break; case ARG_READER: mBottomNav.setCurrentSelectedPage(PageType.READER); break; case ARG_EDITOR: if (mSelectedSite == null) { initSelectedSite(); } onNewPostButtonClicked(); break; case ARG_STATS: if (mSelectedSite == null) { initSelectedSite(); } ActivityLauncher.viewBlogStats(this, mSelectedSite); break; case ARG_PAGES: if (mSelectedSite == null) { initSelectedSite(); } <START> Log.d(WPMainActivity.class.getSimpleName(), "***=> ARGS PAGES"); <END> ActivityLauncher.viewCurrentBlogPages(this, mSelectedSite); break; } } else { AppLog.e(T.MAIN, "WPMainActivity.handleOpenIntent called with an invalid argument."); } }</code><technical_language>double checking if added log purpose forgot remove debugging</technical_language>

Target:
private void handleOpenPageIntent(Intent intent) { String pagePosition = intent.getStringExtra(ARG_OPEN_PAGE); if (!TextUtils.isEmpty(pagePosition)) { switch (pagePosition) { case ARG_MY_SITE: mBottomNav.setCurrentSelectedPage(PageType.MY_SITE); break; case ARG_NOTIFICATIONS: mBottomNav.setCurrentSelectedPage(PageType.NOTIFS); break; case ARG_READER: mBottomNav.setCurrentSelectedPage(PageType.READER); break; case ARG_EDITOR: if (mSelectedSite == null) { initSelectedSite(); } onNewPostButtonClicked(); break; case ARG_STATS: if (mSelectedSite == null) { initSelectedSite(); } ActivityLauncher.viewBlogStats(this, mSelectedSite); break; case ARG_PAGES: if (mSelectedSite == null) { initSelectedSite(); } ActivityLauncher.viewCurrentBlogPages(this, mSelectedSite); break; } } else { AppLog.e(T.MAIN, "WPMainActivity.handleOpenIntent called with an invalid argument."); } }
Source:
<code>protected void dig(Block b, BlockMenu menu, Block block) { Collection<ItemStack> drops = block.getDrops(effectivePickaxe); if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) { OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))); if (SlimefunPlugin.getProtectionManager().hasPermission(owner, block.getLocation(), ProtectableAction.BREAK_BLOCK)) { AndroidMineEvent event = new AndroidMineEvent(block, new AndroidInstance(this, b)); <START> String blockId = BlockStorage.checkID(block); if (blockId != null) { event.setCancelled(true); <END> } Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { for (ItemStack drop : drops) { if (menu.fits(drop, getOutputSlots())) { menu.pushItem(drop, getOutputSlots()); } } block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); block.setType(Material.AIR); } } } }</code><technical_language>This simplified suggestion if (BlockStorage.hasBlockInfo(block)) { event.setCancelled(true);</technical_language>

Target:
protected void dig(Block b, BlockMenu menu, Block block) { Collection<ItemStack> drops = block.getDrops(effectivePickaxe); if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) { OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))); if (SlimefunPlugin.getProtectionManager().hasPermission(owner, block.getLocation(), ProtectableAction.BREAK_BLOCK)) { AndroidMineEvent event = new AndroidMineEvent(block, new AndroidInstance(this, b)); if (BlockStorage.hasBlockInfo(block)) { event.setCancelled(true); } Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { for (ItemStack drop : drops) { if (menu.fits(drop, getOutputSlots())) { menu.pushItem(drop, getOutputSlots()); } } block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); block.setType(Material.AIR); } } } }
Source:
<code>public void storeCommand() throws PersistenceException { if (FilenameUtils.getExtension(dirPath).equals("") && !dirPath.endsWith(File.separator)) { dirPath += File.separator; } final File dumpDir = new File(dirPath); if (!dumpDir.exists()) { console.println( "Directory does not exist. If the directory does indeed exist, try putting the path in quotes."); return; } if (!dumpDir.isDirectory()) { console.println("Specified path is not a directory."); return; } cql = createCql(user, cql); List<Map<String, Object>> storeResults = getResults(); console.println("Results found: " + storeResults.size() + "\n"); int count = storeResults .stream() .map(PersistentItem.class::cast) .map( persistentItem -> { persistentItem.encodeBinaryProperties(); return persistentItem; }) .map(gson::toJson) <START> .map(json -> writeRecordToFile(json, dumpDir)) <END> .reduce(0, (sub, item) -> sub + item); console.println("Exported " + count + " records\n"); }</code><technical_language>pencil2: nice print out progress bar. <LINK_0></technical_language>

Target:
public void storeCommand() throws PersistenceException { if (dirPath == null) { console.println("Export directory is not specified"); return; } if (FilenameUtils.getExtension(dirPath).equals("") && !dirPath.endsWith(File.separator)) { dirPath += File.separator; } final File dumpDir = new File(dirPath); if (!dumpDir.exists()) { console.println( "Directory does not exist. If the directory does indeed exist, try putting the path in quotes."); return; } if (!dumpDir.isDirectory()) { console.println("Specified path is not a directory."); return; } cql = addUserConstraintToCql(user, cql); Function<List<Map<String, Object>>, Integer> exportFunction = results -> { return results .stream() .map(gson::toJson) .map(json -> writeRecordToFile(json, dumpDir)) .reduce(0, (a, b) -> a + b); }; long count = getResults(exportFunction); console.println("Exported: " + count + " records\n"); }
Source:
<code>public NameContextGenerator createContextGenerator() { AdaptiveFeatureGenerator featureGenerator = createFeatureGenerators(); if (featureGenerator == null) { <START> featureGenerator = createFeatureGenerators(); <END> } return new DefaultNameContextGenerator(featureGenerator); }</code><technical_language>This suspicious. If work in lines before, work here</technical_language>

Target:
public NameContextGenerator createContextGenerator() { AdaptiveFeatureGenerator featureGenerator = createFeatureGenerators(); if (featureGenerator == null) { featureGenerator = new CachedFeatureGenerator( new WindowFeatureGenerator(new TokenFeatureGenerator(), 2, 2), new WindowFeatureGenerator(new TokenClassFeatureGenerator(true), 2, 2), new OutcomePriorFeatureGenerator(), new PreviousMapFeatureGenerator(), new BigramNameFeatureGenerator(), new SentenceFeatureGenerator(true, false)); } return new DefaultNameContextGenerator(featureGenerator); }
Source:
<code><START> protected void sendJsonMessage(ChatRoom chatRoom, T jsonMessage) <END> { if (chatRoom == null || !(chatRoom instanceof ChatRoomJabberImpl)) { logger.error("Cannot sent message as chatRoom is null " + "or is not an instance of ChatRoomJabberImpl"); return; } String messageString = jsonMessage.toString(); try { ((ChatRoomJabberImpl)chatRoom).sendJsonMessage(messageString); if (logger.isTraceEnabled()) logger.trace("Sending json message: \"" + messageString + "\""); } catch (OperationFailedException e) { logger.warn("Failed to send json message " + messageString, e); } }</code><technical_language>This code in this PR</technical_language>

Target:
protected void sendJsonMessage(ChatRoom chatRoom, T jsonMessage) { if (chatRoom == null) { logger.error("Cannot sent message as chatRoom is null"); return; } if (!(chatRoom instanceof ChatRoomJabberImpl)) { logger.error("Cannot sent message as chatRoom is not an" + "instance of ChatRoomJabberImpl"); return; } String messageString = jsonMessage.toString(); try { ((ChatRoomJabberImpl)chatRoom).sendJsonMessage(messageString); if (logger.isTraceEnabled()) logger.trace("Sending json message: \"" + messageString + "\""); } catch (OperationFailedException e) { logger.warn("Failed to send json message " + messageString, e); } }
Source:
<code>public void testConfirmPattern() { DispatchCallback callback = new DispatchCallback(); SqlLine line = new SqlLine(); assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); line.runCommands( <START> Collections.singletonList("!set confirmPattern " <END> + "\"^(?i:(TRUNCATE|ALTER))\""), callback); assertEquals("^(?i:(TRUNCATE|ALTER))", line.getOpts() .getConfirmPattern()); line.runCommands( Collections.singletonList("!set confirmPattern default"), callback); assertEquals("default", line.getOpts().getConfirmPattern()); }</code><technical_language>please custom output stream here, e.g. sqlline.SqlLineArgsTest#testSetWrongColorScheme output clearer in case of success tests</technical_language>

Target:
public void testConfirmPattern() { SqlLine line = new SqlLine(); assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); ByteArrayOutputStream os = new ByteArrayOutputStream(); begin(line, os, false, "-e", "!set confirmPattern \"^(?i:(TRUNCATE|ALTER))\""); assertEquals("^(?i:(TRUNCATE|ALTER))", line.getOpts() .getConfirmPattern()); begin(line, os, false, "-e", "!set confirmPattern default"); assertEquals(line.loc("default-confirm-pattern"), line.getOpts().getConfirmPattern()); }
Source:
<code>public Worker create(WorkerKey key) throws Exception { int workerId = pidCounter.getAndIncrement(); Path logFile = workerBaseDir.getRelative(WorkerKey.makeWorkerTypeName(key.getProxied()) + "-" + workerId + "-" + key.getMnemonic() + ".log"); Worker worker; boolean sandboxed = workerOptions.workerSandboxing || key.mustBeSandboxed(); if (sandboxed) { Path workDir = getSandboxedWorkerPath(key, workerId); worker = new SandboxedWorker(key, workerId, workDir, logFile); } else if (key.getProxied()) { worker = new WorkerProxy( key, workerId, key.getExecRoot(), logFile, WorkerMultiplexerManager.getInstance(key.hashCode())); } else { worker = new Worker(key, workerId, key.getExecRoot(), logFile); } if (workerOptions.workerVerbose) { reporter.handle( Event.info( String.format( "Created new %s %s %s (id %d), logging to %s", sandboxed ? "sandboxed" : "non-sandboxed", key.getMnemonic(), <START> WorkerKey.makeWorkerTypeName(key.getProxied()), <END> workerId, logFile))); } return worker; }</code><technical_language>This is computed in this function. Add a proxiedKey local variable reuse result</technical_language>

Target:
public Worker create(WorkerKey key) throws Exception { int workerId = pidCounter.getAndIncrement(); String workTypeName = WorkerKey.makeWorkerTypeName(key.getProxied()); Path logFile = workerBaseDir.getRelative(workTypeName + "-" + workerId + "-" + key.getMnemonic() + ".log"); Worker worker; boolean sandboxed = workerOptions.workerSandboxing || key.mustBeSandboxed(); if (sandboxed) { Path workDir = getSandboxedWorkerPath(key, workerId); worker = new SandboxedWorker(key, workerId, workDir, logFile); } else if (key.getProxied()) { worker = new WorkerProxy( key, workerId, key.getExecRoot(), logFile, WorkerMultiplexerManager.getInstance(key.hashCode())); } else { worker = new Worker(key, workerId, key.getExecRoot(), logFile); } if (workerOptions.workerVerbose) { reporter.handle( Event.info( String.format( "Created new %s %s %s (id %d), logging to %s", sandboxed ? "sandboxed" : "non-sandboxed", key.getMnemonic(), workTypeName, workerId, logFile))); } return worker; }
Source:
<code>public Response execute() throws IOException { <START> SettableFuture<Response> future = SettableFuture.create(); <END> enqueue(new Callback() { @Override public void onFailure(Call call, IOException exception) { future.setException(exception); } @Override public void onResponse(Call call, Response response) throws IOException { future.set(response); } }); try { return future.get(timeout.toMillis(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.interrupted(); throw new IOException("Call was interrupted during execution"); } catch (ExecutionException e) { if (e.getCause() instanceof IoRemoteException) { throw ((IoRemoteException) e.getCause()).getWrappedException(); } else if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new IOException("Failed to execute call", e); } } catch (TimeoutException e) { throw new IOException("Call timed out after: " + timeout.toString(), e); } }</code><technical_language>guava SettableFuture java8 CompletableFuture</technical_language>

Target:
public Response execute() throws IOException { SettableFuture<Response> future = SettableFuture.create(); enqueue(new Callback() { @Override public void onFailure(Call call, IOException exception) { future.setException(exception); } @Override public void onResponse(Call call, Response response) throws IOException { future.set(response); } }); try { return future.get(syncCallTimeout.toMillis(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { getDelegate().cancel(); Thread.currentThread().interrupt(); throw new InterruptedIOException("Call was interrupted during execution"); } catch (ExecutionException e) { getDelegate().cancel(); if (e.getCause() instanceof IoRemoteException) { throw ((IoRemoteException) e.getCause()).getWrappedException(); } else if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new IOException("Failed to execute call", e); } } catch (TimeoutException e) { getDelegate().cancel(); throw new IOException("Call timed out after: " + syncCallTimeout.toString(), e); } }
Source:
<code>public static SearchRequest toSearchRequest(Object queryObject, Exchange exchange) { SearchRequest searchRequest = new SearchRequest(exchange.getIn() .getHeader(ElasticsearchConstants.PARAM_INDEX_NAME, String.class)) .types(exchange.getIn().getHeader(ElasticsearchConstants.PARAM_INDEX_TYPE, String.class)); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); String queryText = null; if (queryObject instanceof Map<?, ?>) { Map<String, Object> mapQuery = (Map<String, Object>)queryObject; <START> if (mapQuery.containsKey(ElasticsearchConstants.ES_QUERY_DSL_PREFIX)) { <END> mapQuery = (Map<String, Object>)mapQuery.get(ElasticsearchConstants.ES_QUERY_DSL_PREFIX); } try { XContentBuilder contentBuilder = XContentFactory.contentBuilder(XContentType.JSON); queryText = contentBuilder.map(mapQuery).string(); } catch (IOException e) { LOG.error(e.getMessage()); } } else if (queryObject instanceof String) { queryText = (String)queryObject; ObjectMapper mapper = new ObjectMapper(); try { JsonNode jsonTextObject = mapper.readValue(queryText, JsonNode.class); JsonNode parentJsonNode = jsonTextObject.get(ElasticsearchConstants.ES_QUERY_DSL_PREFIX); if (parentJsonNode != null) { queryText = parentJsonNode.toString(); } } catch (IOException e) { LOG.error(e.getMessage()); } } else { return null; } searchSourceBuilder.query(QueryBuilders.wrapperQuery(queryText)); searchRequest.source(searchSourceBuilder); return searchRequest; }</code><technical_language>ignore exceptions that. fail letting exception thrown</technical_language>

Target:
public static SearchRequest toSearchRequest(Object queryObject, Exchange exchange) throws IOException { SearchRequest searchRequest = new SearchRequest(exchange.getIn() .getHeader(ElasticsearchConstants.PARAM_INDEX_NAME, String.class)) .types(exchange.getIn().getHeader(ElasticsearchConstants.PARAM_INDEX_TYPE, String.class)); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); String queryText = null; if (queryObject instanceof Map<?, ?>) { Map<String, Object> mapQuery = (Map<String, Object>) queryObject; if (mapQuery.containsKey(ES_QUERY_DSL_PREFIX)) { mapQuery = (Map<String, Object>) mapQuery.get(ES_QUERY_DSL_PREFIX); } try { XContentBuilder contentBuilder = XContentFactory.contentBuilder(XContentType.JSON); queryText = contentBuilder.map(mapQuery).string(); } catch (IOException e) { LOG.error(e.getMessage()); } } else if (queryObject instanceof String) { queryText = (String) queryObject; ObjectMapper mapper = new ObjectMapper(); JsonNode jsonTextObject = mapper.readValue(queryText, JsonNode.class); JsonNode parentJsonNode = jsonTextObject.get(ES_QUERY_DSL_PREFIX); if (parentJsonNode != null) { queryText = parentJsonNode.toString(); } } else { return null; } searchSourceBuilder.query(QueryBuilders.wrapperQuery(queryText)); searchRequest.source(searchSourceBuilder); return searchRequest; }
Source:
<code>public static ScoreBoardClock getInstance() { <START> if (instance == null) { <END> instance = new ScoreBoardClock(); } return instance; }</code><technical_language>If this need locking. A static initialiser simpler</technical_language>

Target:
public static ScoreBoardClock getInstance() { return instance; }
Source:
<code>public EclDirectServiceSoapProxy getSoapProxy() { <START> return wsEclDirectServiceSoapProxy; <END> }</code><technical_language>useful a null check call InitWsFileSpraySoapProxy() if null, if null, throw error; places call if (fileSprayServiceSoapProxy == null) throw new Exception("FileSpray Service Soap Proxy available.") call this function. for similar logic in other clients</technical_language>

Target:
public EclDirectServiceSoapProxy getSoapProxy() throws Exception { if (wsEclDirectServiceSoapProxy != null) return wsEclDirectServiceSoapProxy; else throw new Exception("wsECLDirectServiceSoapProxy not available"); }
Source:
<code>protected List<Issue> makeIssues(final Severity severity, final CheckType checkType) { final Issue issue = new Issue(severity, checkType, new HashSet<>(Arrays.asList(ruleInspector.getRowIndex() + 1, other.getRowIndex() + 1)) ); issue.setDebugMessage(new RuleInspectorDumper(ruleInspector).dump() + " ## " + new RuleInspectorDumper(other).dump()); <START> return Arrays.asList(issue); <END> }</code><technical_language>I if Collections.singletonList item list. I read [this](<LINK_0> I fine, do think</technical_language>

Target:
protected List<Issue> makeIssues(final Severity severity, final CheckType checkType) { final Issue issue = new Issue(severity, checkType, new HashSet<>(Arrays.asList(ruleInspector.getRowIndex() + 1, other.getRowIndex() + 1)) ); issue.setDebugMessage(new RuleInspectorDumper(ruleInspector).dump() + " ## " + new RuleInspectorDumper(other).dump()); return Collections.singletonList(issue); }
Source:
<code>public void shutdown() throws InterruptedException { if (statsAggregator != null) { <START> statsAggregator.cancel(true); <END> } scheduler.shutdown(); if (!scheduler.awaitTermination(30, TimeUnit.SECONDS)) { logger.error("Could not terminate aggregator tasks after StatsManager shutdown"); } }</code><technical_language>safely shutdown actual stats job cancelling terminating in middle? If this pushed a central location, cut data abruptly</technical_language>

Target:
public void shutdown() throws InterruptedException { if (statsAggregator != null) { statsAggregator.cancel(); } if (scheduler != null) { scheduler.shutdown(); if (!scheduler.awaitTermination(30, TimeUnit.SECONDS)) { logger.error("Could not terminate aggregator tasks after StatsManager shutdown"); } } }
Source:
<code>public void intializeView() { userId = CurrentUserManager.get(this).getId(); purchaseRequestHistoryAdapter = new PurchaseRequestHistoryAdapter(purchaseList); recyclerView = (RecyclerView) findViewById(R.id.purchase_history_list); recyclerView.setAdapter(purchaseRequestHistoryAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new PurchaseRequestItemDivider(this)); Toolbar toolbar = (Toolbar) findViewById(R.id.purchase_history_toolbar); setSupportActionBar(toolbar); <START> if (getSupportActionBar() != null) { <END> getSupportActionBar().setDisplayHomeAsUpEnabled(true); } fetchPurchaseRequest(); }</code><technical_language>NITPICK: This if-block is repeated in a couple of places. factored out reused a function call</technical_language>

Target:
public void intializeView() { userId = CurrentUserManager.get(this).getId(); purchaseRequestHistoryAdapter = new PurchaseRequestHistoryAdapter(purchaseList); recyclerView = (RecyclerView) findViewById(R.id.purchase_history_list); recyclerView.setAdapter(purchaseRequestHistoryAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new PurchaseRequestItemDivider(this)); Toolbar toolbar = (Toolbar) findViewById(R.id.purchase_history_toolbar); setSupportActionBar(toolbar); ActionBar.enableHomeButton(this); fetchPurchaseRequest(); }
Source:
<code>public Handle plus(@NotNull GrammarAST plusAST, @NotNull Handle blk) { PlusBlockStartState blkStart = (PlusBlockStartState)blk.left; BlockEndState blkEnd = (BlockEndState)blk.right; preventEpsilonClosureBlocks.add(new Triple<Rule, ATNState, ATNState>(currentRule, blkStart, blkEnd)); PlusLoopbackState loop = newState(PlusLoopbackState.class, plusAST); loop.loopStartState = blkStart; loop.nonGreedy = !((QuantifierAST)plusAST).isGreedy(); atn.defineDecisionState(loop); LoopEndState end = newState(LoopEndState.class, plusAST); blkStart.loopBackState = loop; end.loopBackState = loop; <START> plusAST.atnState = loop; <END> epsilon(blkEnd, loop); BlockAST blkAST = (BlockAST)plusAST.getChild(0); if ( ((QuantifierAST)plusAST).isGreedy() ) { if (expectNonGreedy(blkAST)) { g.tool.errMgr.grammarError(ErrorType.EXPECTED_NON_GREEDY_WILDCARD_BLOCK, g.fileName, plusAST.getToken(), plusAST.getToken().getText()); } epsilon(loop, blkStart); epsilon(loop, end); } else { epsilon(loop, end); epsilon(loop, blkStart); } return new Handle(blkStart, end); }</code><technical_language>this effect serialized ATN generated code</technical_language>

Target:
public Handle plus(@NotNull GrammarAST plusAST, @NotNull Handle blk) { PlusBlockStartState blkStart = (PlusBlockStartState)blk.left; BlockEndState blkEnd = (BlockEndState)blk.right; preventEpsilonClosureBlocks.add(new Triple<Rule, ATNState, ATNState>(currentRule, blkStart, blkEnd)); PlusLoopbackState loop = newState(PlusLoopbackState.class, plusAST); loop.nonGreedy = !((QuantifierAST)plusAST).isGreedy(); atn.defineDecisionState(loop); LoopEndState end = newState(LoopEndState.class, plusAST); blkStart.loopBackState = loop; end.loopBackState = loop; plusAST.atnState = blkStart; epsilon(blkEnd, loop); BlockAST blkAST = (BlockAST)plusAST.getChild(0); if ( ((QuantifierAST)plusAST).isGreedy() ) { if (expectNonGreedy(blkAST)) { g.tool.errMgr.grammarError(ErrorType.EXPECTED_NON_GREEDY_WILDCARD_BLOCK, g.fileName, plusAST.getToken(), plusAST.getToken().getText()); } epsilon(loop, blkStart); epsilon(loop, end); } else { epsilon(loop, end); epsilon(loop, blkStart); } return new Handle(blkStart, end); }
Source:
<code>public static void startAdminBlobStorageService() throws InstantiationException, IOException { <START> clusterMap = new MockClusterMap(false); <END> adminBlobStorageService = getAdminBlobStorageService(clusterMap); adminBlobStorageService.start(); }</code><technical_language>default constructor sets this false</technical_language>

Target:
public static void startAdminBlobStorageService() throws InstantiationException, IOException { clusterMap = new MockClusterMap(); adminBlobStorageService = getAdminBlobStorageService(clusterMap); adminBlobStorageService.start(); }
Source:
<code>private URL getPipeUrl(String pipePath) { try { <START> return new URL(new URL(serverUrl), pipePath); <END> } catch (MalformedURLException e) { throw new RuntimeException(e); } }</code><technical_language>a utility for in Pipe UrlUtils.appendToBaseURL(serverUrl, pipePath);</technical_language>

Target:
private URL getPipeUrl(String pipePath) { try { return UrlUtils.appendQueryToBaseURL(new URL(serverUrl), pipePath); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
Source:
<code>public static void portSetup() { <START> backupPort = allocatePort(); <END> }</code><technical_language>Give individual test case port. This means database rule startLazily well</technical_language>

Target:
public void portSetup() { backupPort = allocatePort(); db = (GraphDatabaseAPI) new GraphDatabaseFactory().newEmbeddedDatabaseBuilder( testDirectory.graphDbDir() ) .setConfig( online_backup_enabled,"true" ) .setConfig( online_backup_server, "127.0.0.1:" + backupPort ) .setConfig( bloom_enabled, "true" ) .newGraphDatabase(); }
Source:
<code>public Configuration parseMainConfig(final InputStream input) throws Exception { Reader reader = new InputStreamReader(input); String xml = XMLUtil.readerToString(reader); xml = XMLUtil.replaceSystemProps(xml); Element e = XMLUtil.stringToElement(xml); <START> NodeList children = e.getElementsByTagName("core"); <END> if (children.getLength() > 0) { Node item = children.item(0); XMLUtil.validate(item, "schema/artemis-configuration.xsd"); } Configuration config = new ConfigurationImpl(); parseMainConfig(e, config); return config; }</code><technical_language>get broker.xml fully validated xsd javax.xml.validation.Validator instead of manually individual elements recursing / checking those. Ideally want parse broker.xml if fully valid</technical_language>

Target:
public Configuration parseMainConfig(final InputStream input) throws Exception { Reader reader = new InputStreamReader(input); String xml = XMLUtil.readerToString(reader); xml = XMLUtil.replaceSystemProps(xml); Element e = XMLUtil.stringToElement(xml); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(XMLUtil.findResource("schema/artemis-server.xsd")); Validator validator = schema.newValidator(); try { validator.validate(new DOMSource(e)); } catch (Exception ex) { ActiveMQServerLogger.LOGGER.error(ex.getMessage()); } Configuration config = new ConfigurationImpl(); parseMainConfig(e, config); return config; }
Source:
<code>public void uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions, Duration timeout) { <START> <END> }</code><technical_language>Is this method empty now</technical_language>

Target:
public void uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions, Duration timeout) { this.uploadFromFile(filePath, new BlobUploadFromFileOptions() .setParallelTransferOptions(parallelTransferOptions).setHeaders(headers).setMetadata(metadata) .setTier(tier).setRequestConditions(requestConditions), null); }
Source:
<code>public void online(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { checkArgument(tableName != null, "tableName is null"); String tableId = Tables.getTableId(context.getInstance(), tableName); <START> TableState expectedState = Tables.getTableState(context.getInstance(), tableId); <END> if (expectedState == TableState.ONLINE) { return; } List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8))); Map<String,String> opts = new HashMap<>(); try { doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_ONLINE, args, opts); } catch (TableExistsException e) { throw new AssertionError(e); } if (wait) waitForTableStateTransition(tableId, TableState.ONLINE); }</code><technical_language>implementation of this zoo cache. return stale information. table state, call Tables.clearCache(). This force table state read zookeeper</technical_language>

Target:
public void online(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { checkArgument(tableName != null, "tableName is null"); String tableId = Tables.getTableId(context.getInstance(), tableName); TableState expectedState = Tables.getTableState(context.getInstance(), tableId, true); if (expectedState == TableState.ONLINE) { return; } List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8))); Map<String,String> opts = new HashMap<>(); try { doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_ONLINE, args, opts); } catch (TableExistsException e) { throw new AssertionError(e); } if (wait) waitForTableStateTransition(tableId, TableState.ONLINE); }