auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
for (int i = -12; i <= 14; i++) { TimeZone timeZone; String pgZoneName; if (i == 0) { timeZone = TimeZone.getTimeZone("GMT"); pgZoneName = "GMT"; } else { timeZone = TimeZone.getTimeZone("GMT" + (i <= 0 ? "+" : "-") + Math.abs(i)); pgZoneName = "GMT" + (i >= 0 ? "+" : "-"); } if (i == 0) { GMT_ZONES.put(pgZoneName, timeZone); continue; } GMT_ZONES.put(pgZoneName + Math.abs(i), timeZone); GMT_ZONES.put(pgZoneName + Arrays.toString(NUMBERS[Math.abs(i)]), timeZone); }

Target:
for (int i = -12; i <= 14; i++) { TimeZone timeZone; String pgZoneName; if (i == 0) { timeZone = TimeZone.getTimeZone("GMT"); pgZoneName = "GMT"; } else { timeZone = TimeZone.getTimeZone("GMT" + (i <= 0 ? "+" : "-") + Math.abs(i)); pgZoneName = "GMT" + (i >= 0 ? "+" : "-"); } if (i == 0) { GMT_ZONES.put(pgZoneName, timeZone); continue; } GMT_ZONES.put(pgZoneName + Math.abs(i), timeZone); GMT_ZONES.put(pgZoneName + new String(NUMBERS[Math.abs(i)]), timeZone); }
Source:
public void setCcJudgment(CommonCourtJudgment ccJudgment) { this.ccJudgment = ccJudgment; }

Target:
void setCcJudgment(CommonCourtJudgment ccJudgment) { this.ccJudgment = ccJudgment; }
Source:
public static Test suite() { final TestSuite suite = new TestSuite("Sirius tests"); String testClassQualifiedName = System.getenv("TEST_CLASS_NAME"); if (testClassQualifiedName != null && testClassQualifiedName.length() > 0) { try { Class<?> testToLaunch = Class.forName(testClassQualifiedName); if (TestCase.class.isAssignableFrom(testToLaunch)) { suite.addTestSuite((Class<? extends TestCase>) testToLaunch); } } catch (ClassNotFoundException e) { fail("The class " + testClassQualifiedName + ", to launch for test specific case, has not been found."); } } else { addGerritPart(suite); AllCommonPluginTests.addNonGerritPart(suite); AllDiagramPluginsTests.addNonGerritPart(suite); } return suite; }

Target:
public static Test suite() { final TestSuite suite = new TestSuite("Sirius tests"); String testClassQualifiedName = System.getenv("TEST_CLASS_NAME"); if (testClassQualifiedName != null && testClassQualifiedName.length() > 0) { try { Class<?> testToLaunch = SiriusTestsPlugin.getDefault().getBundle().loadClass(testClassQualifiedName); if (TestCase.class.isAssignableFrom(testToLaunch)) { suite.addTestSuite((Class<? extends TestCase>) testToLaunch); } } catch (ClassNotFoundException e) { fail("The class " + testClassQualifiedName + ", to launch for test specific case, has not been found."); } } else { addGerritPart(suite); AllCommonPluginTests.addNonGerritPart(suite); AllDiagramPluginsTests.addNonGerritPart(suite); } return suite; }
Source:
public void doRss( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { Jenkins.get().checkPermission(Jenkins.SYSTEM_READ); LogRecorderManager.doRss(req,rsp,getLogRecords()); }

Target:
public void doRss( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { LogRecorderManager.doRss(req,rsp,getLogRecords()); }
Source:
public void testComputeTask() throws Exception { CyclicBarrier barrier = new CyclicBarrier(2); try (IgniteEx g1 = startGrid(0)) { SystemView<ComputeTaskView> tasks = g1.context().systemView().view(TASKS_VIEW); IgniteCache<Integer, Integer> cache = g1.createCache("test-cache"); cache.put(1, 1); g1.compute().executeAsync(new ComputeTask<Object, Object>() { @Override public @NotNull Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) throws IgniteException { return Collections.singletonMap(new ComputeJob() { @Override public void cancel() { System.out.println("SystemViewSelfTest.cancel"); } @Override public Object execute() throws IgniteException { System.out.println("SystemViewSelfTest.execute"); return 1; } }, subgrid.get(0)); } @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) throws IgniteException { try { barrier.await(); barrier.await(); } catch (InterruptedException | BrokenBarrierException e) { throw new RuntimeException(e); } return null; } @Nullable @Override public Object reduce(List<ComputeJobResult> results) throws IgniteException { return 1; } }, 1); barrier.await(); assertEquals(1, tasks.size()); ComputeTaskView t = tasks.iterator().next(); assertFalse(t.internal()); assertNull(t.affinityCacheName()); assertEquals(-1, t.affinityPartitionId()); assertTrue(t.taskClassName().startsWith(getClass().getName())); assertTrue(t.taskName().startsWith(getClass().getName())); assertEquals(g1.localNode().id(), t.taskNodeId()); assertEquals("0", t.userVersion()); barrier.await(); } }

Target:
public void testComputeTask() throws Exception { CyclicBarrier barrier = new CyclicBarrier(2); try (IgniteEx g1 = startGrid(0)) { SystemView<ComputeTaskView> tasks = g1.context().systemView().view(TASKS_VIEW); IgniteCache<Integer, Integer> cache = g1.createCache("test-cache"); cache.put(1, 1); g1.compute().executeAsync(new ComputeTask<Object, Object>() { @Override public @NotNull Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) throws IgniteException { return Collections.singletonMap(new ComputeJob() { @Override public void cancel() { } @Override public Object execute() throws IgniteException { return 1; } }, subgrid.get(0)); } @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) throws IgniteException { try { barrier.await(); barrier.await(); } catch (InterruptedException | BrokenBarrierException e) { throw new RuntimeException(e); } return null; } @Nullable @Override public Object reduce(List<ComputeJobResult> results) throws IgniteException { return 1; } }, 1); barrier.await(); assertEquals(1, tasks.size()); ComputeTaskView t = tasks.iterator().next(); assertFalse(t.internal()); assertNull(t.affinityCacheName()); assertEquals(-1, t.affinityPartitionId()); assertTrue(t.taskClassName().startsWith(getClass().getName())); assertTrue(t.taskName().startsWith(getClass().getName())); assertEquals(g1.localNode().id(), t.taskNodeId()); assertEquals("0", t.userVersion()); barrier.await(); } }
Source:
public void tick(Level level) { this.motion = this.motion.add(newMotion); this.newMotion = new Point(0, 0); double x = this.motion.getX(); this.motion.setX( Math.max(Math.min(x, GameConstants.MAX_X_SPEED), -GameConstants.MAX_X_SPEED) * this.getUnitSpeedMultiplier()); Point movement = motion.divide(GameConstants.TICKS_PER_SEC); this.handler = new CollisionHandler(level); this.handler.checkUnitsAABB(this); this.location = handler.findNextPosition(this).getPoint(); if (!movement.equals(new Point(0, 0))) { addToLog("[MOVER]\tMoved to " + this.location.toString()); } applyGravity(); ArtificialIntelligence artificialintelligence = new ArtificialIntelligence(level); artificialintelligence.aiMover(); }

Target:
public void tick(Level level) { this.motion = this.motion.add(newMotion); this.newMotion = new Point(0, 0); double x = this.motion.getX(); this.motion.setX( Math.max(Math.min(x, GameConstants.MAX_X_SPEED), -GameConstants.MAX_X_SPEED) * this.getSpeedMultiplier()); Point movement = motion.divide(GameConstants.TICKS_PER_SEC); this.handler = new CollisionHandler(level); this.handler.checkUnitsAABB(this); this.location = handler.findNextPosition(this).getPoint(); if (!movement.equals(new Point(0, 0))) { addToLog("[MOVER]\tMoved to " + this.location.toString()); } applyGravity(); ArtificialIntelligence artificialintelligence = new ArtificialIntelligence(level); artificialintelligence.aiMover(); }
Source:
private void logQueryKill(QueryId killedQueryId, List<MemoryInfo> nodes) { if (!log.isDebugEnabled()) { return; } log.debug("Query Kill Decision: Killed %s", killedQueryId); for (MemoryInfo node : nodes) { MemoryPoolInfo memoryPoolInfo = node.getPools().get(GENERAL_POOL); if (memoryPoolInfo == null) { continue; } StringBuilder nodeDescription = new StringBuilder(); nodeDescription.append("Query Kill Scenario: "); nodeDescription.append("MaxBytes ").append(memoryPoolInfo.getMaxBytes()); nodeDescription.append("FreeBytes ").append(memoryPoolInfo.getFreeBytes() + memoryPoolInfo.getReservedRevocableBytes()); nodeDescription.append("Queries "); for (Map.Entry<QueryId, Long> entry : memoryPoolInfo.getQueryMemoryReservations().entrySet()) { nodeDescription.append(entry.getKey()).append('=').append(entry.getValue()).append(','); } nodeDescription.setLength(nodeDescription.length() - 1); log.debug(nodeDescription.toString()); } }

Target:
private void logQueryKill(QueryId killedQueryId, List<MemoryInfo> nodes) { if (!log.isInfoEnabled()) { return; } StringBuilder nodeDescription = new StringBuilder(); nodeDescription.append("Query Kill Decision: Killed ").append(killedQueryId).append("\n"); for (MemoryInfo node : nodes) { MemoryPoolInfo memoryPoolInfo = node.getPools().get(GENERAL_POOL); if (memoryPoolInfo == null) { continue; } nodeDescription.append("Query Kill Scenario: "); nodeDescription.append("MaxBytes ").append(memoryPoolInfo.getMaxBytes()).append(' '); nodeDescription.append("FreeBytes ").append(memoryPoolInfo.getFreeBytes() + memoryPoolInfo.getReservedRevocableBytes()).append(' '); nodeDescription.append("Queries "); Joiner.on(",").withKeyValueSeparator("=").appendTo(nodeDescription, memoryPoolInfo.getQueryMemoryReservations()); nodeDescription.append('\n'); } log.info(nodeDescription.toString()); }
Source:
private void dropOrLogOrphanViews(PhoenixConnection phoenixConnection, Configuration configuration, Key key) throws Exception { if (outputPath != null) { writer[VIEW].write(key.serialize()); writer[VIEW].newLine(); } else if (!clean) { System.out.println(key.serialize()); return; } if (!clean) { return; } gracefullyDropView(phoenixConnection, configuration, key); }

Target:
private void dropOrLogOrphanViews(PhoenixConnection phoenixConnection, Configuration configuration, Key key) throws Exception { if (outputPath != null) { writer[VIEW].write(key.getSerializedValue()); writer[VIEW].newLine(); } else if (!clean) { System.out.println(key.getSerializedValue()); return; } if (!clean) { return; } gracefullyDropView(phoenixConnection, configuration, key); }
Source:
public ImportVmParameters( Collection<ExternalVnicProfileMapping> externalVnicProfileMappings, boolean reassignBadMacs) { this(); this.externalVnicProfileMappings = Objects.requireNonNull(externalVnicProfileMappings); this.reassignBadMacs = reassignBadMacs; }

Target:
public ImportVmParameters( Collection<ExternalVnicProfileMapping> externalVnicProfileMappings, boolean reassignBadMacs) { this.sourceDomainId = Guid.Empty; this.destDomainId = Guid.Empty; this.externalVnicProfileMappings = Objects.requireNonNull(externalVnicProfileMappings); this.reassignBadMacs = reassignBadMacs; }
Source:
public void testDisableReverseDNSProcessor() throws Exception { try { filter.monitor.config.props.put("ignorePostProcessors", "reverseDNS"); Object principal = new User("username", "", Collections.<GrantedAuthority>emptyList()); RequestData data = testRemoteUser(principal); assertNull(data.getRemoteHost()); } finally { filter.monitor.config.props.remove("ignorePostProcessors"); } }

Target:
public void testDisableReverseDNSProcessor() throws Exception { Object principal = new User("username", "", Collections.<GrantedAuthority>emptyList()); RequestData data = testRemoteUser(principal); assertNotNull(data.getRemoteHost()); try { filter = new MonitorFilter(new Monitor(dao), new MonitorRequestFilter()); filter.monitor.config.props.put("ignorePostProcessors", "reverseDNS"); chain = new MockFilterChain( new HttpServlet() { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { req.getInputStream().read(new byte[LONG_BODY_SIZE]); res.getOutputStream().write(new byte[0]); } }); principal = new User("username", "", Collections.<GrantedAuthority>emptyList()); data = testRemoteUser(principal); assertNull(data.getRemoteHost()); } finally { filter.monitor.config.props.remove("ignorePostProcessors"); } }
Source:
public void testDelayWithToken() throws InterruptedException { CancellationTokenSource cts = new CancellationTokenSource(); final Task<Void> delayed = Task.delay(200, cts.getToken()); cts.cancel(); Thread.sleep(250); assertTrue(delayed.isCancelled()); }

Target:
public void testDelayWithToken() throws InterruptedException { CancellationTokenSource cts = new CancellationTokenSource(); final Task<Void> delayed = Task.delay(200, cts.getToken()); assertFalse(delayed.isCancelled()); cts.cancel(); assertTrue(delayed.isCancelled()); }
Source:
protected void doMove(FeatureMapChange diff, Comparison comparison, EObject expectedContainer, FeatureMap.Entry expectedValue, boolean rightToLeft) { final EStructuralFeature attribute = diff.getAttribute(); if (attribute.isMany()) { int insertionIndex = findInsertionIndex(comparison, diff, rightToLeft); final List<Object> targetList = (List<Object>)safeEGet(expectedContainer, attribute); final int currentIndex = targetList.indexOf(expectedValue); if (insertionIndex > currentIndex && currentIndex >= 0) { insertionIndex--; } if (currentIndex == -1) { if (insertionIndex < 0 || insertionIndex > targetList.size()) { ((BasicFeatureMap)(Object)targetList).addUnique(expectedValue); } else { ((BasicFeatureMap)(Object)targetList).addUnique(insertionIndex, expectedValue); } } else { if (insertionIndex < 0 && insertionIndex > targetList.size()) { ((BasicFeatureMap)(Object)targetList).move(targetList.size() - 1, expectedValue); } else { ((BasicFeatureMap)(Object)targetList).move(insertionIndex, expectedValue); } } } else { safeESet(expectedContainer, attribute, expectedValue); } }

Target:
protected void doMove(FeatureMapChange diff, Comparison comparison, EObject expectedContainer, FeatureMap.Entry expectedValue, boolean rightToLeft) { final EStructuralFeature attribute = diff.getAttribute(); if (attribute.isMany()) { int insertionIndex = findInsertionIndex(comparison, diff, rightToLeft); final List<Object> targetList = (List<Object>)safeEGet(expectedContainer, attribute); final int currentIndex = targetList.indexOf(expectedValue); if (insertionIndex > currentIndex && currentIndex >= 0) { insertionIndex--; } if (currentIndex == -1) { if (insertionIndex < 0 || insertionIndex > targetList.size()) { ((BasicFeatureMap)(Object)targetList).addUnique(expectedValue); } else { ((BasicFeatureMap)(Object)targetList).addUnique(insertionIndex, expectedValue); } } else { if (insertionIndex < 0 || insertionIndex > targetList.size()) { ((BasicFeatureMap)(Object)targetList).move(targetList.size() - 1, expectedValue); } else { ((BasicFeatureMap)(Object)targetList).move(insertionIndex, expectedValue); } } } else { safeESet(expectedContainer, attribute, expectedValue); } }
Source:
public void waitSelectedElementInFindUsagesPanel(String nameElement) { webDriverWaitFactory .get(LOAD_PAGE_TIMEOUT_SEC) .until( (ExpectedCondition<Boolean>) driver -> getHighlightedItem(nameElement) .getCssValue("background-image") .contains(HIGHLIGHTED_IMAGE)); }

Target:
public void waitSelectedElementInFindUsagesPanel(String nameElement) { seleniumWebDriverHelper.waitSuccessCondition( driver -> getHighlightedItem(nameElement) .getCssValue("background-image") .contains(HIGHLIGHTED_IMAGE)); }
Source:
public ProduceResponse(Struct struct) { responses = new HashMap<>(); for (Object topicResponse : struct.getArray(RESPONSES_KEY_NAME)) { Struct topicRespStruct = (Struct) topicResponse; String topic = topicRespStruct.get(TOPIC_NAME); for (Object partResponse : topicRespStruct.getArray(PARTITION_RESPONSES_KEY_NAME)) { Struct partRespStruct = (Struct) partResponse; int partition = partRespStruct.get(PARTITION_ID); Errors error = Errors.forCode(partRespStruct.get(ERROR_CODE)); long offset = partRespStruct.getLong(BASE_OFFSET_KEY_NAME); long logAppendTime = partRespStruct.getLong(LOG_APPEND_TIME_KEY_NAME); long logStartOffset = partRespStruct.getOrElse(LOG_START_OFFSET_FIELD, INVALID_OFFSET); List<ErrorRecord> errorRecords = new ArrayList<>(); if (partRespStruct.hasField(ERROR_RECORDS_KEY_NAME)) { for (Object recordOffsetAndMessage : partRespStruct.getArray(ERROR_RECORDS_KEY_NAME)) { Struct recordOffsetAndMessageStruct = (Struct) recordOffsetAndMessage; errorRecords.add(new ErrorRecord( recordOffsetAndMessageStruct.getInt(RELATIVE_OFFSET_KEY_NAME), recordOffsetAndMessageStruct.getOrElse(RELATIVE_OFFSET_ERROR_MESSAGE_FIELD, ""))); } } String errorMessage = partRespStruct.getOrElse(ERROR_MESSAGE_FIELD, ""); TopicPartition tp = new TopicPartition(topic, partition); responses.put(tp, new PartitionResponse(error, offset, logAppendTime, logStartOffset, errorRecords, errorMessage)); } } this.throttleTimeMs = struct.getOrElse(THROTTLE_TIME_MS, DEFAULT_THROTTLE_TIME); }

Target:
public ProduceResponse(Struct struct) { responses = new HashMap<>(); for (Object topicResponse : struct.getArray(RESPONSES_KEY_NAME)) { Struct topicRespStruct = (Struct) topicResponse; String topic = topicRespStruct.get(TOPIC_NAME); for (Object partResponse : topicRespStruct.getArray(PARTITION_RESPONSES_KEY_NAME)) { Struct partRespStruct = (Struct) partResponse; int partition = partRespStruct.get(PARTITION_ID); Errors error = Errors.forCode(partRespStruct.get(ERROR_CODE)); long offset = partRespStruct.getLong(BASE_OFFSET_KEY_NAME); long logAppendTime = partRespStruct.getLong(LOG_APPEND_TIME_KEY_NAME); long logStartOffset = partRespStruct.getOrElse(LOG_START_OFFSET_FIELD, INVALID_OFFSET); List<RecordError> recordErrors = Collections.emptyList(); if (partRespStruct.hasField(RECORD_ERRORS_KEY_NAME)) { Object[] recordErrorsArray = partRespStruct.getArray(RECORD_ERRORS_KEY_NAME); if (recordErrorsArray.length > 0) { recordErrors = new ArrayList<>(recordErrorsArray.length); for (Object indexAndMessage : recordErrorsArray) { Struct indexAndMessageStruct = (Struct) indexAndMessage; recordErrors.add(new RecordError( indexAndMessageStruct.getInt(BATCH_INDEX_KEY_NAME), indexAndMessageStruct.get(BATCH_INDEX_ERROR_MESSAGE_FIELD) )); } } } String errorMessage = partRespStruct.getOrElse(ERROR_MESSAGE_FIELD, null); TopicPartition tp = new TopicPartition(topic, partition); responses.put(tp, new PartitionResponse(error, offset, logAppendTime, logStartOffset, recordErrors, errorMessage)); } } this.throttleTimeMs = struct.getOrElse(THROTTLE_TIME_MS, DEFAULT_THROTTLE_TIME); }
Source:
public void postTrackBlock(BlockSnapshot snapshot, BlockTickContext context) { if (false) { TrackingUtil.processBlockCaptures(context.getCapturedBlockSupplier(), this, context); context.getCapturedBlockSupplier().prune(snapshot); } }

Target:
public void postTrackBlock(BlockSnapshot snapshot, BlockTickContext context) { }
Source:
private DbException getSingleSortKeyException() { String sql = getSQL(); return DbException.getSyntaxError(sql, sql.length() - 1, "single sort key is required for RANGE units"); }

Target:
private DbException getSingleSortKeyException() { String sql = getSQL(); return DbException.getSyntaxError(sql, sql.length() - 1, "exactly one sort key is required for RANGE units"); }
Source:
public synchronized void save() throws IOException { if (BulkChange.contains(this)) { return; } getStateFile().write(this); SaveableListener.fireOnChange(this, getStateFile()); }

Target:
public void save() throws IOException { synchronized (this) { if (BulkChange.contains(this)) { return; } getStateFile().write(this); } SaveableListener.fireOnChange(this, getStateFile()); }
Source:
public boolean hasKafkaKey() { return this.mKafkaKey.length != 0; }

Target:
public boolean hasKafkaKey() { return this.mKafkaKey != null && this.mKafkaKey.length != 0; }
Source:
private void replaceFile(Path from, Path to) throws IOException { try { Files.move(from, to, StandardCopyOption.ATOMIC_MOVE); } catch (AtomicMoveNotSupportedException e) { Files.move(from, to, StandardCopyOption.REPLACE_EXISTING); } }

Target:
private void replaceFile(Path from, Path to) throws IOException { try { Files.move(from, to, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); } catch (AtomicMoveNotSupportedException e) { Files.move(from, to, StandardCopyOption.REPLACE_EXISTING); } }
Source:
public void deleteFromTableTest0() throws InterruptedException { log.info("deleteFromTableTest1"); SiddhiManager siddhiManager = new SiddhiManager(); String streams = "" + "define stream StockStream (symbol string, price float, volume long); " + "define stream DeleteStockStream (symbol string, price float, volume long); " + "define table StockTable (symbol string, price float, volume long); "; String query = "" + "@info(name = 'query1') " + "from StockStream " + "insert into StockTable ;" + "" + "@info(name = 'query2') " + "from DeleteStockStream " + "delete StockTable " + " on symbol=='IBM' ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query); InputHandler stockStream = siddhiAppRuntime.getInputHandler("StockStream"); InputHandler deleteStockStream = siddhiAppRuntime.getInputHandler("DeleteStockStream"); siddhiAppRuntime.start(); stockStream.send(new Object[]{"WSO2", 55.6f, 100L}); stockStream.send(new Object[]{"IBM", 75.6f, 100L}); stockStream.send(new Object[]{"WSO2", 57.6f, 100L}); Event[] events = new Event[2]; events[0] = new Event(System.currentTimeMillis(), new Object[]{"WSO2", 55.6f, 100L}); events[1] = new Event(System.currentTimeMillis(), new Object[]{"IBM", 75.6f, 100L}); deleteStockStream.send(events); Thread.sleep(500); siddhiAppRuntime.shutdown(); }

Target:
public void deleteFromTableTest0() throws InterruptedException { log.info("deleteFromTableTest0"); SiddhiManager siddhiManager = new SiddhiManager(); String streams = "" + "define stream StockStream (symbol string, price float, volume long); " + "define stream DeleteStockStream (symbol string, price float, volume long); " + "define table StockTable (symbol string, price float, volume long); "; String query = "" + "@info(name = 'query1') " + "from StockStream " + "insert into StockTable ;" + "" + "@info(name = 'query2') " + "from DeleteStockStream " + "delete StockTable " + " on symbol=='IBM' ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query); InputHandler stockStream = siddhiAppRuntime.getInputHandler("StockStream"); InputHandler deleteStockStream = siddhiAppRuntime.getInputHandler("DeleteStockStream"); siddhiAppRuntime.start(); stockStream.send(new Object[]{"WSO2", 55.6f, 100L}); stockStream.send(new Object[]{"IBM", 75.6f, 100L}); stockStream.send(new Object[]{"WSO2", 57.6f, 100L}); Event[] events = new Event[2]; events[0] = new Event(System.currentTimeMillis(), new Object[]{"WSO2", 55.6f, 100L}); events[1] = new Event(System.currentTimeMillis(), new Object[]{"IBM", 75.6f, 100L}); deleteStockStream.send(events); Thread.sleep(500); siddhiAppRuntime.shutdown(); }
Source:
public boolean isSessionInUse(long sessionSeqId) { CommandStatus cmdStatus; for (Guid cmdId : CommandCoordinatorUtil.getCommandIdsBySessionSeqId(sessionSeqId)) { cmdStatus = CommandCoordinatorUtil.getCommandStatus(cmdId); if (cmdStatus == CommandStatus.NOT_STARTED || cmdStatus == CommandStatus.ACTIVE) { return true; } } if (!jobDao.getJobsBySessionSeqIdAndStatus(sessionSeqId, JobExecutionStatus.STARTED).isEmpty()) { return true; } return false; }

Target:
public boolean isSessionInUse(long sessionSeqId) { CommandStatus cmdStatus; for (Guid cmdId : CommandCoordinatorUtil.getCommandIdsBySessionSeqId(sessionSeqId)) { cmdStatus = CommandCoordinatorUtil.getCommandStatus(cmdId); if (cmdStatus == CommandStatus.NOT_STARTED || cmdStatus == CommandStatus.ACTIVE) { return true; } } return !jobDao.getJobsBySessionSeqIdAndStatus(sessionSeqId, JobExecutionStatus.STARTED).isEmpty(); }
Source:
public EventConsumer createEventConsumer(final String topic, final Map<String, String> cursors) throws ServiceUnavailableException { final List<KafkaCursor> kafkaCursors = Lists.newArrayListWithCapacity(cursors.size()); for (Map.Entry<String, String> entry : cursors.entrySet()) { final String offset = entry.getValue(); final String partition = entry.getKey(); final long kafkaOffset; if (Cursor.BEFORE_OLDEST_OFFSET.equals(offset)) { final TopicPartition tp = getPartition(topic, partition); kafkaOffset = toKafkaOffset(tp.getOldestAvailableOffset()); } else { kafkaOffset = toKafkaOffset(offset) + 1L; } final KafkaCursor kafkaCursor = kafkaCursor(toKafkaPartition(partition), kafkaOffset); kafkaCursors.add(kafkaCursor); } return kafkaFactory.createNakadiConsumer(topic, kafkaCursors, settings.getKafkaPollTimeoutMs()); }

Target:
public EventConsumer createEventConsumer(final String topic, final Map<String, String> cursors) throws ServiceUnavailableException { final List<KafkaCursor> kafkaCursors = Lists.newArrayListWithCapacity(cursors.size()); for (final Map.Entry<String, String> entry : cursors.entrySet()) { final String offset = entry.getValue(); final String partition = entry.getKey(); final long kafkaOffset; if (Cursor.BEFORE_OLDEST_OFFSET.equals(offset)) { final TopicPartition tp = getPartition(topic, partition); kafkaOffset = toKafkaOffset(tp.getOldestAvailableOffset()); } else { kafkaOffset = toKafkaOffset(offset) + 1L; } final KafkaCursor kafkaCursor = kafkaCursor(toKafkaPartition(partition), kafkaOffset); kafkaCursors.add(kafkaCursor); } return kafkaFactory.createNakadiConsumer(topic, kafkaCursors, settings.getKafkaPollTimeoutMs()); }
Source:
public List<NetInterface<? extends NetInterfaceAddress>> getActiveNetworkInterfaces() throws KuraException { List<NetInterface<? extends NetInterfaceAddress>> interfaces = getNetworkInterfaces(); int i = 0; while (i < interfaces.size()) { NetInterface<? extends NetInterfaceAddress> iface = interfaces.get(i); if (LinuxNetworkUtil.hasAddress(iface.getName())) { i++; } else { logger.debug("removing interface because it is not up", iface.getName()); interfaces.remove(i); } } return interfaces; }

Target:
public List<NetInterface<? extends NetInterfaceAddress>> getActiveNetworkInterfaces() throws KuraException { List<NetInterface<? extends NetInterfaceAddress>> activeInterfaces = new ArrayList<>(); List<NetInterface<? extends NetInterfaceAddress>> interfaces = getNetworkInterfaces(); for (NetInterface<? extends NetInterfaceAddress> iface : interfaces) { if (LinuxNetworkUtil.hasAddress(iface.getName())) { activeInterfaces.add(iface); } } return activeInterfaces; }
Source:
public static Uri buildSearchUri(List<Attribute> attributes) { AttributeMap metadataMap = new AttributeMap(); metadataMap.addAll(attributes); Uri.Builder searchUri = new Uri.Builder() .scheme("search") .authority("hentoid"); for (Map.Entry<AttributeType,List<Attribute>> entry : metadataMap.entrySet()) { AttributeType attrType = entry.getKey(); List<Attribute> list = entry.getValue(); for (Attribute attr : list) searchUri.appendQueryParameter(attrType.name(), attr.getId() + ";" + attr.getName()); } return searchUri.build(); }

Target:
public static Uri buildSearchUri(List<Attribute> attributes) { AttributeMap metadataMap = new AttributeMap(); metadataMap.addAll(attributes); Uri.Builder searchUri = new Uri.Builder() .scheme("search") .authority("hentoid"); for (AttributeType attrType : metadataMap.keySet()) { List<Attribute> attrs = metadataMap.get(attrType); for (Attribute attr : attrs) searchUri.appendQueryParameter(attrType.name(), attr.getId() + ";" + attr.getName()); } return searchUri.build(); }
Source:
public void fill() { Set<String> matched; try { matched = getMatchedStores(); } catch ( IndyDataException e ) { logger.error( "Failed to get matched stores", e ); return; } if ( matched.isEmpty() ) { logger.info( "No matched stores" ); return; } logger.info( "Fill cache, matched stores: {}", matched ); Set<String> scanned = getScannedStores(); List<String> notScanned = new ArrayList<>( matched ); notScanned.removeAll( scanned ); if ( !notScanned.isEmpty() ) { List<List<String>> batches = Lists.partition( notScanned, 100 ); batches.forEach( batch -> { boolean success = scanAndUpdate( batch ); if ( !success ) { logger.warn( "Scan failed for: {}", batch ); } } ); scanned = getScannedStores(); } Set<String> deleted = new HashSet<>( scanned ); deleted.removeAll( matched ); if ( !deleted.isEmpty() ) { logger.info( "Find deleted stores, deleted: {}", deleted ); reduce( SCANNED_STORES, deleted ); } }

Target:
public void fill() { Set<String> matched; try { matched = getMatchedStores(); } catch ( IndyDataException e ) { logger.error( "Failed to get matched stores", e ); return; } if ( matched.isEmpty() ) { logger.info( "No matched stores" ); return; } logger.info( "Fill cache, matched stores: {}", matched ); Set<String> scanned = getScannedStores(); List<String> notScanned = new ArrayList<>( matched ); notScanned.removeAll( scanned ); if ( !notScanned.isEmpty() ) { List<List<String>> batches = Lists.partition( notScanned, SCAN_BATCH_SIZE ); batches.forEach( batch -> { boolean success = scanAndUpdate( batch ); if ( !success ) { logger.warn( "Scan failed for: {}", batch ); } } ); scanned = getScannedStores(); } Set<String> deleted = new HashSet<>( scanned ); deleted.removeAll( matched ); if ( !deleted.isEmpty() ) { logger.info( "Find deleted stores, deleted: {}", deleted ); reduce( SCANNED_STORES, deleted ); } }
Source:
private void onDone(boolean enabled) { setTabEnabled(tabInfo, enabled); outstandingCallbacks--; if (outstandingCallbacks == 0 || (enabled && tabInfo == Tab.RELATED_CHANGES)) { outstandingCallbacks = 0; boolean show = false; for (int i = 0; i < getTabBar().getTabCount(); i++) { if (getTabBar().isTabEnabled(i)) { selectTab(i); show = true; break; } } if (show && !isVisible()) { setVisible(true); applyMaxHeight(); } } }

Target:
private void onDone(boolean enabled) { setTabEnabled(tabInfo, enabled); outstandingCallbacks--; if (outstandingCallbacks == 0 || (enabled && tabInfo == Tab.RELATED_CHANGES)) { outstandingCallbacks = 0; for (int i = 0; i < getTabBar().getTabCount(); i++) { if (getTabBar().isTabEnabled(i)) { selectTab(i); setVisible(true); applyMaxHeight(); break; } } } }
Source:
public void testDelete() { boolean result = api().deleteVault(vaultName); assertTrue(result); Object[] args = { resourceGroupName, vaultName, true }; checkState(deletedVaultStatus.create(resourceGroupName, true).apply(vaultName), "vault was not deleted before timeout"); }

Target:
public void testDelete() { boolean result = api().deleteVault(vaultName); assertTrue(result); checkState(deletedVaultStatus.create(resourceGroupName, true).apply(vaultName), "vault was not deleted before timeout"); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof CouponIborFxReset)) { return false; } CouponIborFxReset other = (CouponIborFxReset) obj; if (Double.doubleToLongBits(_fixingAccrualFactor) != Double.doubleToLongBits(other._fixingAccrualFactor)) { return false; } if (Double.doubleToLongBits(_fixingPeriodEndTime) != Double.doubleToLongBits(other._fixingPeriodEndTime)) { return false; } if (Double.doubleToLongBits(_fixingPeriodStartTime) != Double.doubleToLongBits(other._fixingPeriodStartTime)) { return false; } if (Double.doubleToLongBits(_fixingTime) != Double.doubleToLongBits(other._fixingTime)) { return false; } if (Double.doubleToLongBits(_fxDeliveryTime) != Double.doubleToLongBits(other._fxDeliveryTime)) { return false; } if (Double.doubleToLongBits(_fxFixingTime) != Double.doubleToLongBits(other._fxFixingTime)) { return false; } if (_index == null) { if (other._index != null) { return false; } } else if (!_index.equals(other._index)) { return false; } if (_referenceCurrency == null) { if (other._referenceCurrency != null) { return false; } } else if (!_referenceCurrency.equals(other._referenceCurrency)) { return false; } if (Double.doubleToLongBits(_spread) != Double.doubleToLongBits(other._spread)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof CouponIborFxReset)) { return false; } CouponIborFxReset other = (CouponIborFxReset) obj; if (Double.doubleToLongBits(_iborIndexFixingAccrualFactor) != Double .doubleToLongBits(other._iborIndexFixingAccrualFactor)) { return false; } if (Double.doubleToLongBits(_iborIndexFixingPeriodEndTime) != Double .doubleToLongBits(other._iborIndexFixingPeriodEndTime)) { return false; } if (Double.doubleToLongBits(_iborIndexFixingPeriodStartTime) != Double .doubleToLongBits(other._iborIndexFixingPeriodStartTime)) { return false; } if (Double.doubleToLongBits(_iborIndexFixingTime) != Double.doubleToLongBits(other._iborIndexFixingTime)) { return false; } if (Double.doubleToLongBits(_fxDeliveryTime) != Double.doubleToLongBits(other._fxDeliveryTime)) { return false; } if (Double.doubleToLongBits(_fxFixingTime) != Double.doubleToLongBits(other._fxFixingTime)) { return false; } if (!ObjectUtils.equals(_index, other._index)) { return false; } if (!ObjectUtils.equals(_referenceCurrency, other._referenceCurrency)) { return false; } if (Double.doubleToLongBits(_spread) != Double.doubleToLongBits(other._spread)) { return false; } return true; }
Source:
public MessageHandler getMessageHandler() { this.dlvWorkerLock(); try { return msgHandler; } finally { this.dlvWorkerUnlock(); } }

Target:
public MessageHandler getMessageHandler() { this.dlvWorkerLock(); MessageHandler mh = msgHandler; this.dlvWorkerUnlock(); return mh; }
Source:
public long calculateEndTime() { if (endTime == 0) { return TimeUnit.NANOSECONDS.toMicros(System.nanoTime()); } else if (endTime < 0) { return TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - endTime; } return endTime; }

Target:
public long calculateEndTime() { if (endTime == 0) { return System.currentTimeMillis(); } else if (endTime < 0) { return System.currentTimeMillis() - endTime; } return endTime; }
Source:
Next invoke(Env caller, SourceLocation loc, Object receiver, List<?> args, Continuation k) { Env e = new ClosureCallEnv(caller, k, loc, capture, self, args.size()); assignArguments(args, e); if (e instanceof DepthTrackingEnv && ((DepthTrackingEnv)e).getDepth() > DepthTrackingEnv.MAX_LEGAL_DEPTH) { StackOverflowError err; int depth = ((DepthTrackingEnv) e).getDepth(); if (loc != null) { err = new StackOverflowError("Excessively nested closures/functions at "+loc+" - look for unbounded recursion - call depth: "+depth); } else { err = new StackOverflowError("Excessively nested closures/functions - look for unbounded recursion - call depth: "+depth); } return e.getExceptionHandler(StackOverflowError.class).receive(err); } return new Next(body, e, k); }

Target:
Next invoke(Env caller, SourceLocation loc, Object receiver, List<?> args, Continuation k) { ClosureCallEnv e = new ClosureCallEnv(caller, k, loc, capture, self, args.size()); assignArguments(args, e); if (e.getDepth() > DepthTrackingEnv.MAX_LEGAL_DEPTH) { StackOverflowError err; if (loc != null) { err = new StackOverflowError("Excessively nested closures/functions at "+loc+" - look for unbounded recursion - call depth: "+e.getDepth()); } else { err = new StackOverflowError("Excessively nested closures/functions - look for unbounded recursion - call depth: "+e.getDepth()); } return e.getExceptionHandler(StackOverflowError.class).receive(err); } return new Next(body, e, k); }
Source:
public int[] execute() { if (parts.size() == 0) { return new int[] {}; } Statement stmt; try { try { stmt = getHandle().getStatementBuilder().create(getHandle().getConnection(), getContext()); addCleanable(stmt::close); } catch (SQLException e) { throw new UnableToCreateStatementException(e, getContext()); } LOG.trace("Execute batch ["); try { for (String part : parts) { final String sql = getConfig(SqlStatements.class).getTemplateEngine().render(part, getContext()); LOG.trace(" {}", sql); stmt.addBatch(sql); } } catch (SQLException e) { throw new UnableToExecuteStatementException("Unable to configure JDBC statement", e, getContext()); } try { getConfig(SqlStatements.class).getSqlLogger().logBeforeExecution(getContext()); final long start = System.nanoTime(); final int[] rs = stmt.executeBatch(); final long elapsedTime = System.nanoTime() - start; LOG.trace("] executed in {}ms", elapsedTime / 1000000L); getConfig(SqlStatements.class).getTimingCollector().collect(elapsedTime, getContext()); getConfig(SqlStatements.class).getSqlLogger().logAfterExecution(getContext(), elapsedTime); return rs; } catch (SQLException e) { getConfig(SqlStatements.class).getSqlLogger().logException(getContext(), e); throw new UnableToExecuteStatementException(mungeBatchException(e), getContext()); } } finally { close(); } }

Target:
public int[] execute() { if (parts.size() == 0) { return new int[] {}; } Statement stmt; try { try { stmt = getHandle().getStatementBuilder().create(getHandle().getConnection(), getContext()); addCleanable(stmt::close); } catch (SQLException e) { throw new UnableToCreateStatementException(e, getContext()); } LOG.trace("Execute batch ["); try { for (String part : parts) { final String sql = getConfig(SqlStatements.class).getTemplateEngine().render(part, getContext()); LOG.trace(" {}", sql); stmt.addBatch(sql); } } catch (SQLException e) { throw new UnableToExecuteStatementException("Unable to configure JDBC statement", e, getContext()); } try { return getConfig(SqlStatements.class).getSqlLogger().wrap(stmt::executeBatch, getContext()); } catch (SQLException e) { throw new UnableToExecuteStatementException(mungeBatchException(e), getContext()); } } finally { close(); } }
Source:
public I18nEmailMgtConfigServiceClient(String cookie, String url, ConfigurationContext configContext) throws Exception { try { stub = new I18NEmailMgtConfigServiceStub(configContext, url + "I18nEmailMgtConfigService"); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (java.lang.Exception e) { handleException(e.getMessage(), e); } }

Target:
public I18nEmailMgtConfigServiceClient(String cookie, String url, ConfigurationContext configContext) throws Exception { try { stub = new I18NEmailMgtConfigServiceStub(configContext, url + "I18nEmailMgtConfigService"); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (Exception e) { handleException(e.getMessage(), e); } }
Source:
public Collection<BinaryFile> getAllBinaries() { waitForCompletion(); ITmfStateSystem ss = checkNotNull(getStateSystem()); Set<BinaryFile> files = new TreeSet<>(); try { ImmutableList.Builder<Integer> builder = ImmutableList.builder(); List<Integer> vpidQuarks = ss.getSubAttributes(-1, false); for (Integer vpidQuark : vpidQuarks) { builder.addAll(ss.getSubAttributes(vpidQuark, false)); } List<Integer> baddrQuarks = builder.build(); for (Integer baddrQuark : baddrQuarks) { List<Integer> buildIdQuarks = ss.getSubAttributes(baddrQuark, false); for (Integer buildIdQuark : buildIdQuarks) { String buildId = ss.getAttributeName(buildIdQuark); ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, buildIdQuark, ss.getStartTime(), Long.MAX_VALUE); if (interval == null) { throw new IllegalStateException(); } String filePath = interval.getStateValue().unboxStr(); files.add(new BinaryFile(filePath, buildId)); } } } catch (AttributeNotFoundException e) { throw new IllegalStateException(e); } return files; }

Target:
public Collection<UstDebugInfoBinaryFile> getAllBinaries() { waitForCompletion(); ITmfStateSystem ss = checkNotNull(getStateSystem()); Set<UstDebugInfoBinaryFile> files = new TreeSet<>(); try { ImmutableList.Builder<Integer> builder = ImmutableList.builder(); List<Integer> vpidQuarks = ss.getSubAttributes(-1, false); for (Integer vpidQuark : vpidQuarks) { builder.addAll(ss.getSubAttributes(vpidQuark, false)); } List<Integer> baddrQuarks = builder.build(); for (Integer baddrQuark : baddrQuarks) { List<Integer> buildIdQuarks = ss.getSubAttributes(baddrQuark, false); for (Integer buildIdQuark : buildIdQuarks) { String buildId = ss.getAttributeName(buildIdQuark); ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, buildIdQuark, ss.getStartTime(), Long.MAX_VALUE); if (interval == null) { throw new IllegalStateException(); } String filePath = interval.getStateValue().unboxStr(); files.add(new UstDebugInfoBinaryFile(filePath, buildId)); } } } catch (AttributeNotFoundException e) { throw new IllegalStateException(e); } return files; }
Source:
public void default_telemetry_properties() { assertThat(underTest.getBoolean("sonar.telemetry.enable")).contains(true); assertThat(underTest.getInt("sonar.telemetry.frequencyInSeconds")).contains(6 * 60 * 60); assertThat(underTest.get("sonar.telemetry.url")).contains("<LINK_0>"); }

Target:
public void default_telemetry_properties() { assertThat(underTest.getBoolean("sonar.telemetry.enable")).hasValue(true); assertThat(underTest.getInt("sonar.telemetry.frequencyInSeconds")).hasValue(6 * 60 * 60); assertThat(underTest.get("sonar.telemetry.url")).hasValue("<LINK_0>"); }
Source:
public AsyncFuture<FetchData> fetch( final FetchData.Request request, final FetchQuotaWatcher watcher ) { if (!watcher.mayReadData()) { throw new IllegalArgumentException("query violated data limit"); } final int limit = watcher.getReadDataQuota(); return connection.doto(c -> { final QueryTrace.Watch w = QueryTrace.watch(); final List<PreparedFetch> prepared = c.schema.ranges(request.getSeries(), request.getRange()); if (request.getType() == MetricType.POINT) { List<AsyncFuture<FetchData>> fetches = fetchDataPoints(w, limit, request.getOptions(), prepared, c); return async.collect(fetches, FetchData.collect(FETCH)); } return async.resolved(FetchData.error(w.end(FETCH), QueryError.fromMessage("unsupported source: " + request.getType()))); }); }

Target:
public AsyncFuture<FetchData> fetch( final FetchData.Request request, final FetchQuotaWatcher watcher ) { if (!watcher.mayReadData()) { throw new IllegalArgumentException("query violated data limit"); } final int limit = watcher.getReadDataQuota(); return connection.doto(c -> { final QueryTrace.Watch w = QueryTrace.watch(); final List<PreparedFetch> prepared = c.schema.ranges(request.getSeries(), request.getRange()); if (request.getType() == MetricType.POINT) { final List<AsyncFuture<FetchData>> fetches = fetchDataPoints(w, limit, request.getOptions(), prepared, c); return async.collect(fetches, FetchData.collect(FETCH)); } return async.resolved(FetchData.error(w.end(FETCH), QueryError.fromMessage("unsupported source: " + request.getType()))); }); }
Source:
public void customizeDocumentCommand(IDocument document, DocumentCommand command) { String text= command.text; if (text == null) return; if (text.isEmpty()) { deleteSpaces(document, command); } else if (text.indexOf('\t') > -1) { StringBuilder buffer= new StringBuilder(); fLineTracker.set(command.text); int lines= fLineTracker.getNumberOfLines(); try { for (int i= 0; i < lines; i++) { int offset= fLineTracker.getLineOffset(i); int endOffset= offset + fLineTracker.getLineLength(i); String line= text.substring(offset, endOffset); int position= 0; if (i == 0) { IRegion firstLine= document.getLineInformationOfOffset(command.offset); position= command.offset - firstLine.getOffset(); } int length= line.length(); for (int j= 0; j < length; j++) { char c= line.charAt(j); if (c == '\t') { position += insertTabString(buffer, position); } else { buffer.append(c); ++ position; } } } command.text= buffer.toString(); } catch (BadLocationException x) { } } }

Target:
public void customizeDocumentCommand(IDocument document, DocumentCommand command) { String text= command.text; if (text == null) return; if (text.isEmpty()) { replaceDeleteSpaceByDeleteTab(document, command); } else if (text.indexOf('\t') > -1) { StringBuilder buffer= new StringBuilder(); fLineTracker.set(command.text); int lines= fLineTracker.getNumberOfLines(); try { for (int i= 0; i < lines; i++) { int offset= fLineTracker.getLineOffset(i); int endOffset= offset + fLineTracker.getLineLength(i); String line= text.substring(offset, endOffset); int position= 0; if (i == 0) { IRegion firstLine= document.getLineInformationOfOffset(command.offset); position= command.offset - firstLine.getOffset(); } int length= line.length(); for (int j= 0; j < length; j++) { char c= line.charAt(j); if (c == '\t') { position += insertTabString(buffer, position); } else { buffer.append(c); ++ position; } } } command.text= buffer.toString(); } catch (BadLocationException x) { throw new IllegalArgumentException("should never happen", x); } } }
Source:
public Element getSelect(Hook hook, int index) throws CandybeanException { logger.info("Getting select: " + hook.toString() + " from element: " + this.toString() + " with index: " + index); return new WebDriverSelector(hook, this.wd); }

Target:
public Element getSelect(Hook hook, int index) throws CandybeanException { logger.info("Getting select: " + hook.toString() + " from element: " + this.toString() + " with index: " + index); WebElement childWe = this.we.findElements(WebDriverSelector.By(hook)).get(index); return new WebDriverSelector(hook, index, this.wd, childWe); }
Source:
public void testDropPKColumn() throws Exception { long ts = nextTimestamp(); String tenantId = getOrganizationId(); initATableValues("aTable", tenantId, getDefaultSplits(tenantId), null, ts, getUrl()); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5)); Connection conn1 = DriverManager.getConnection(getUrl(), props); try { conn1.createStatement().executeUpdate("ALTER TABLE " + ATABLE_NAME + " DROP COLUMN entity_id"); fail(); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("ERROR 506 (42817): Primary key column may not be dropped.")); } conn1.close(); }

Target:
public void testDropPKColumn() throws Exception { long ts = nextTimestamp(); String tenantId = getOrganizationId(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), null, ts, getUrl()); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5)); Connection conn1 = DriverManager.getConnection(getUrl(), props); try { conn1.createStatement().executeUpdate("ALTER TABLE " + ATABLE_NAME + " DROP COLUMN entity_id"); fail(); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("ERROR 506 (42817): Primary key column may not be dropped.")); } conn1.close(); }