auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testShowColumnsFromPartitions() { String tableName = "test_show_columns_from_partitions"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(" + " foo VARCHAR," + " part1 BIGINT," + " part2 VARCHAR" + ") " + "WITH (" + "partitioned_by = ARRAY[ 'part1', 'part2' ]" + ") "; assertUpdate(getSession(), createTable); TableMetadata tableMetadata = getTableMetadata(catalog, TPCH_SCHEMA, tableName); assertEquals(tableMetadata.getMetadata().getProperties().get(PARTITIONED_BY_PROPERTY), ImmutableList.of("part1", "part2")); assertQuery( getSession(), "SHOW COLUMNS FROM \"" + tableName + "$partitions\"", "VALUES ('part1', 'bigint', '', ''), ('part2', 'varchar', '', '')"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"$partitions\"", ".*Table 'hive.tpch.\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"orders$partitions\"", ".*Table 'hive.tpch.orders\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"blah$partitions\"", ".*Table 'hive.tpch.blah\\$partitions' does not exist"); }

Target:
public void testShowColumnsFromPartitions() { String tableName = "test_show_columns_from_partitions"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(" + " foo VARCHAR," + " part1 BIGINT," + " part2 VARCHAR" + ") " + "WITH (" + "partitioned_by = ARRAY[ 'part1', 'part2' ]" + ") "; assertUpdate(getSession(), createTable); assertQuery( getSession(), "SHOW COLUMNS FROM \"" + tableName + "$partitions\"", "VALUES ('part1', 'bigint', '', ''), ('part2', 'varchar', '', '')"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"$partitions\"", ".*Table 'hive.tpch.\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"orders$partitions\"", ".*Table 'hive.tpch.orders\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"blah$partitions\"", ".*Table 'hive.tpch.blah\\$partitions' does not exist"); }
Source:
protected void setSplitterPosition(int leftWidth, int rightWidth) { try { if (lockSplitter.acquire()) { double total = leftWidth + rightWidth; if (total > 0) { double d = leftWidth / total; getSwingContainer().setDividerLocation(d); getSwingContainer().setResizeWeight(d); } } } finally { lockSplitter.release(); } }

Target:
protected void setSplitterPosition(int leftWidth, int rightWidth) { if (leftWidth < 0 || rightWidth < 0) { return; } try { if (lockSplitter.acquire()) { double total = leftWidth + rightWidth; if (total > 0) { double d = leftWidth / total; getSwingContainer().setDividerLocation(d); getSwingContainer().setResizeWeight(d); } } } finally { lockSplitter.release(); } }
Source:
public void setReader(final Reader reader) { if(! closed.get()) { if (reader == null) { readerCaller = null; } else { synchronized(readerLock) { readerCaller = () -> reader.onRead(this); if (this.getReadBufferSize() > 0) { callReader(false); } else { callReader(false); } } } } }

Target:
public void setReader(final Reader reader) { if(! closed.get()) { if (reader == null) { readerCaller = null; } else { synchronized(readerLock) { readerCaller = () -> reader.onRead(this); if (this.getReadBufferSize() > 0) { callReader(false); } } } } }
Source:
public int hashCode() { return Objects.hash( id, hostName, consoleAddress, name, otpValidity, pmEnabled, pmKdumpDetection, port, protocol, sshPort, sshUsername, serverSslEnabled, uniqueId, clusterId, vdsStrength, vdsType, disablePowerManagementPolicy, hostProviderId, hostProviderId, currentKernelCmdline, kernelCmdlineParsable, lastStoredKernelCmdline, kernelCmdlineIommu, kernelCmdlineKvmNested, kernelCmdlinePciRealloc, kernelCmdlineUnsafeInterrupts ); }

Target:
public int hashCode() { return Objects.hash( id, hostName, consoleAddress, name, otpValidity, pmEnabled, pmKdumpDetection, port, protocol, sshPort, sshUsername, serverSslEnabled, uniqueId, clusterId, vdsStrength, vdsType, disablePowerManagementPolicy, hostProviderId, currentKernelCmdline, kernelCmdlineParsable, lastStoredKernelCmdline, kernelCmdlineIommu, kernelCmdlineKvmNested, kernelCmdlinePciRealloc, kernelCmdlineUnsafeInterrupts ); }
Source:
public void open(final ProjectDiagram diagram) { final Graph graph = diagram.getGraph(); final AutomaticLayoutService.Layout layout = layoutService.getLayout(graph); this.graphLayout.applyLayout(layout, graph); super.open(diagram); }

Target:
public void open(final ProjectDiagram diagram) { this.layoutHelper.applyLayout(diagram.getGraph()); super.open(diagram); }
Source:
public DataStallDetectionStats build() { return new DataStallDetectionStats(mCellularInfo, mWifiInfo, mDnsReturnCode.stream().mapToInt(i -> i).toArray(), mDnsTimeStamp.stream().mapToLong(i -> i).toArray(), mEvaluationType, mNetworkType, mSeqNo); }

Target:
public DataStallDetectionStats build() { return new DataStallDetectionStats(mCellularInfo, mWifiInfo, NetworkStackUtils.convertToIntArray(mDnsReturnCode), NetworkStackUtils.convertToLongArray(mDnsTimeStamp), mEvaluationType, mNetworkType); }
Source:
private void createEmptyFolderUntracked() throws Exception { File path = new File(db.getWorkTree(), UNTRACKED_FOLDER); assertTrue(path.mkdir()); assertTrue(path.isDirectory()); }

Target:
private void createEmptyFolderUntracked() throws Exception { File path = new File(db.getWorkTree(), UNTRACKED_FOLDER); FileUtils.mkdir(path); }
Source:
public List<JudgmentData.Judge> toJudges(List<Judge> judges) { if(judges == null) judges = Collections.emptyList(); List<JudgmentData.Judge> judgesView = new ArrayList<>(); for(Judge judge : judges){ List<Judge.JudgeRole> judgeRoles = judge.getSpecialRoles(); if(judgeRoles == null) { judgeRoles = Collections.emptyList(); } List<String> rolesNames = judgeRoles.stream() .map(role -> role.name()) .collect(Collectors.toList()); JudgmentData.Judge judgeView = new JudgmentData.Judge(); judgeView.setName(judge.getName()); judgeView.setSpecialRoles(rolesNames); judgesView.add(judgeView); } return judgesView; }

Target:
public List<JudgmentData.Judge> toJudges(List<Judge> judges) { if(judges == null) { judges = Collections.emptyList(); } List<JudgmentData.Judge> judgesView = new ArrayList<>(); for(Judge judge : judges){ List<Judge.JudgeRole> judgeRoles = judge.getSpecialRoles(); if(judgeRoles == null) { judgeRoles = Collections.emptyList(); } List<String> rolesNames = judgeRoles.stream() .map(role -> role.name()) .collect(Collectors.toList()); JudgmentData.Judge judgeView = new JudgmentData.Judge(); judgeView.setName(judge.getName()); judgeView.setSpecialRoles(rolesNames); judgesView.add(judgeView); } return judgesView; }
Source:
protected void initQcowVersionForDisks(Guid imageGroupId) { try { List<DiskImage> diskVolumes = diskImageDao.getAllSnapshotsForImageGroup(imageGroupId); for (DiskImage volume : diskVolumes) { setQcowCompat(volume); } } catch (Exception e) { log.error("Could not set qcow compat version for imported disk"); } }

Target:
protected void initQcowVersionForDisks(Guid imageGroupId) { List<DiskImage> diskVolumes = diskImageDao.getAllSnapshotsForImageGroup(imageGroupId); diskVolumes.stream().forEach(volume -> { try { setQcowCompat(volume); } catch (Exception e) { log.error("Could not set qcow compat version for disk '{} with id '{}/{}'", volume.getDiskAlias(), volume.getId(), volume.getImageId()); } }); }
Source:
private void updateBricksFromHost() { VDS selectedServer = getServers().getSelectedItem(); AsyncDataProvider.getInstance().getUnusedBricksFromServer(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<StorageDevice> bricks = (List<StorageDevice>) returnValue; List<String> lvNames = new ArrayList<String>(); for (StorageDevice brick : bricks) { if (brick.getMountPoint() != null && !brick.getMountPoint().isEmpty()) { lvNames.add(brick.getMountPoint()); } else { lvNames.add("None - " + brick.getName()); } } getBricksFromServer().setItems(lvNames); } }), selectedServer.getId()); }

Target:
private void updateBricksFromHost() { VDS selectedServer = getServers().getSelectedItem(); AsyncDataProvider.getInstance().getUnusedBricksFromServer(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<StorageDevice> bricks = (List<StorageDevice>) returnValue; List<String> lvNames = new ArrayList<String>(); for (StorageDevice brick : bricks) { if (brick.getMountPoint() != null && !brick.getMountPoint().isEmpty()) { lvNames.add(brick.getMountPoint()); } } getBricksFromServer().setItems(lvNames); } }), selectedServer.getId()); }
Source:
public Map<String, String> getSchema(GetSchemaRequest request, EndpointPluginContext pluginContext) throws SQLException, InstantiationException, IllegalAccessException { JDBCDriverShim driverShim = loadPluginClassAndGetDriver(request, pluginContext); try { Connection connection = getConnection(request.connectionString, request.user, request.password); Map<String, String> resultSchema = new HashMap<>(); try { Statement statement = connection.createStatement(); String query = request.importQuery; statement.setMaxRows(1); ResultSetMetaData resultSetMetaData = statement.executeQuery(query).getMetaData(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { resultSchema.put(resultSetMetaData.getColumnName(i), resultSetMetaData.getColumnTypeName(i)); } } finally { connection.close(); } return resultSchema; } catch (SQLException e) { LOG.error("Exception while trying to get schema in a database for query {}.", request.importQuery, e); throw Throwables.propagate(e); } finally { DBUtils.deregisterShim(driverShim); } }

Target:
public Schema getSchema(GetSchemaRequest request, EndpointPluginContext pluginContext) throws SQLException, InstantiationException, IllegalAccessException, BadRequestException { DriverCleanup driverCleanup = loadPluginClassAndGetDriver(request, pluginContext); try { try (Connection connection = getConnection(request.connectionString, request.user, request.password)) { Statement statement = connection.createStatement(); statement.setMaxRows(1); ResultSet resultSet = statement.executeQuery(request.query); return Schema.recordOf("outputSchema", DBUtils.getSchemaFields(resultSet)); } } catch (SQLSyntaxErrorException e) { throw new BadRequestException(e.getMessage()); } finally { driverCleanup.destroy(); } }
Source:
public String processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String executeBefore = element.getTextContent(); return executeBefore; }

Target:
public String processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String executeBefore = element.getTextContent(); if(executeBefore == null || executeBefore.equals("")) { throw new WindupXMLRulesetParsingException("The '" + EXECUTE_BEFORE_ELEMENT + "' must contain non-empty text value"); } return executeBefore; }
Source:
@Override Bitmap decode(Request data) throws IOException { String part = data.uri.getSchemeSpecificPart(); if(!part.startsWith(MIME_PREFIX)) throw new IOException("Malformed data uri"); part = part.substring(MIME_PREFIX.length()); if(!part.matches("^(gif|jpe?g|png);base64,.[A-Za-z0-9+/=]*$")) throw new IOException("Unsupported content type"); part = part.substring(part.indexOf(SPLITTER) + SPLITTER.length()); return decodeBase64(part); }

Target:
@Override Bitmap decode(Request data) throws IOException { String part = data.uri.getSchemeSpecificPart(); if (!part.startsWith(MIME_PREFIX)) { throw new IOException("Malformed data uri"); } part = part.substring(MIME_PREFIX.length()); if (!part.matches("^(gif|jpe?g|png);base64,.[A-Za-z0-9+/=]*$")) { throw new IOException("Unsupported content type"); } part = part.substring(part.indexOf(SPLITTER) + SPLITTER.length()); return decodeBase64(part); }
Source:
public <T extends Annotation> T getConfig(FrameworkMethod method, Class<T> type) { if (method != null) { T config = method.getAnnotation(type); if (config != null) { return config; } } return getConfig(type); }

Target:
public <T extends Annotation> T getConfig(FrameworkMethod method, Class<T> type) { T config = method.getAnnotation(type); if (config != null) { return config; } return getConfig(type); }
Source:
private void printUsingRegex(String regex) { for (Enumeration<Logger> logger = LogManager.getCurrentLoggers(); logger .hasMoreElements();) { Logger log = logger.nextElement(); if (log.getName().matches(regex)) { stdout.println(log.getName() + " : " + log.getEffectiveLevel()); } } }

Target:
private void printUsingRegex(String regex) { if (regex.startsWith("^")) { regex = regex.substring(1); if (regex.endsWith("$") && !regex.endsWith("\\$")) { regex = regex.substring(0, regex.length() - 1); } } final RunAutomaton a = new RunAutomaton(new RegExp(regex).toAutomaton()); for (Enumeration<Logger> logger = LogManager.getCurrentLoggers(); logger .hasMoreElements();) { Logger log = logger.nextElement(); if (a.run(log.getName())) { stdout.println(log.getName() + ": " + log.getEffectiveLevel()); } } }
Source:
public void byStatusPrefix() throws Exception { TestRepository<InMemoryRepository> repo = createProject("repo"); ChangeInserter ins1 = newChange(repo, null, null, null, null); Change change1 = ins1.getChange(); change1.setStatus(Change.Status.NEW); ins1.insert(); ChangeInserter ins2 = newChange(repo, null, null, null, null); Change change2 = ins2.getChange(); change2.setStatus(Change.Status.MERGED); ins2.insert(); assertResultEquals(change1, queryOne("status:n")); assertResultEquals(change1, queryOne("status:ne")); assertResultEquals(change1, queryOne("status:new")); assertResultEquals(change1, queryOne("status:N")); assertResultEquals(change1, queryOne("status:nE")); assertResultEquals(change1, queryOne("status:neW")); try { query("status:newx"); } catch (BadRequestException e) { } }

Target:
public void byStatusPrefix() throws Exception { TestRepository<InMemoryRepository> repo = createProject("repo"); ChangeInserter ins1 = newChange(repo, null, null, null, null); Change change1 = ins1.getChange(); change1.setStatus(Change.Status.NEW); ins1.insert(); ChangeInserter ins2 = newChange(repo, null, null, null, null); Change change2 = ins2.getChange(); change2.setStatus(Change.Status.MERGED); ins2.insert(); assertResultEquals(change1, queryOne("status:n")); assertResultEquals(change1, queryOne("status:ne")); assertResultEquals(change1, queryOne("status:new")); assertResultEquals(change1, queryOne("status:N")); assertResultEquals(change1, queryOne("status:nE")); assertResultEquals(change1, queryOne("status:neW")); assertBadQuery("status:nx"); assertBadQuery("status:newx"); }
Source:
public Content readme(final String branch) { return new MkContent(); }

Target:
public Content readme(final String branch) { throw new UnsupportedOperationException("Readme not yet implemented."); }
Source:
private synchronized void loadInfo(MBeanServerConnection mbsc) { Root root = getRoot(parent); IConnectionWrapper connectionWrapper = root.getConnection(); final MBeanInfoWrapper[] array = new MBeanInfoWrapper[1]; final ObjectName on2 = on; try { if( mbsc != null ) { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } else { connectionWrapper.run(new IJMXRunnable() { public void run(MBeanServerConnection mbsc) throws Exception { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } }); } } catch( Exception e ) { JMXActivator.getDefault().getLog().log(new Status(IStatus.ERROR, JMXActivator.PLUGIN_ID, "Error loading object name details", e)); loadError = e; } wrapper = array[0]; }

Target:
private synchronized void loadInfo(MBeanServerConnection mbsc) { Root root = getRoot(parent); IConnectionWrapper connectionWrapper = root.getConnection(); final MBeanInfoWrapper[] array = new MBeanInfoWrapper[1]; final ObjectName on2 = on; try { if( mbsc != null ) { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } else { connectionWrapper.run(new IJMXRunnable() { public void run(MBeanServerConnection mbsc) throws Exception { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } }); } } catch( Exception e ) { JMXActivator.getDefault().getLog().log(new Status(IStatus.ERROR, JMXActivator.PLUGIN_ID, "Error loading object name details for JMX object: " + on.toString(), e)); loadError = e; } wrapper = array[0]; }
Source:
public void test() { Resource vgql = getResource(PROJECT_NAME, fileName); VqlCodeGenerator vqlGenerator = new VqlCodeGenerator(); EObject root = vgql.getContents().get(0); String vql = vqlGenerator.generate((PatternPackage) root); printVQL(vql); vql = removeWhitespace(vql); String cleanExpectedOutput = removeWhitespace(expectedOutput); assertEquals(cleanExpectedOutput, vql); }

Target:
public void test() { Resource vgql = getResource(PROJECT_NAME, fileName); VqlCodeGenerator vqlGenerator = new VqlCodeGenerator(); EObject root = vgql.getContents().get(0); String vql = vqlGenerator.generate((PatternPackage) root); vql = removeWhitespace(vql); String cleanExpectedOutput = removeWhitespace(expectedOutput); assertEquals(cleanExpectedOutput, vql); }
Source:
public Set<CapabilityDTO> getCapabilities() { return this.capabilities; }

Target:
public Set<CapabilityDTO> getCapabilities() { return this.capabilities != null ? new SetView<CapabilityDTO>(capabilities) : null; }
Source:
public String shortify(final String shortStr) { try { return UtilMethods.isSet(shortStr)? shortStr.trim().replaceAll("-", "").substring(0, MINIMUM_SHORTY_ID_LENGTH): shortStr; } catch (Exception se) { throw new ShortyException("shorty " + shortStr + " is not a short id. Short Ids should be " + MINIMUM_SHORTY_ID_LENGTH + " alphanumeric chars in length", se); } }

Target:
public String shortify(final String shortStr) { try { if (UtilMethods.isSet(shortStr)) { final String trimmedShortStr = shortStr.trim().replaceAll("-", ""); final int min = Math.min(trimmedShortStr.length(), MINIMUM_SHORTY_ID_LENGTH); return trimmedShortStr.substring(0, min); } return shortStr; } catch (Exception se) { throw new ShortyException("shorty " + shortStr + " is not a short id. Short Ids should be " + MINIMUM_SHORTY_ID_LENGTH + " alphanumeric chars in length", se); } }
Source:
public void shutdown() { if (!isShutdownRequested.compareAndSet(false, true)) { return; } boolean shutdownPerformed = performShutdownIfPossible(); if (!shutdownPerformed) { ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, "rx-netty-shutdown-"); } }); executorService.scheduleWithFixedDelay(new ShutdownTask(executorService), 100, 100, TimeUnit.MILLISECONDS); } }

Target:
public void shutdown() { if (!isShutdownRequested.compareAndSet(false, true)) { return; } Observable.just(1L).subscribe(createShutdownAction()); }
Source:
public String toString() { return "TmfCheckpoint [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]"; }

Target:
public String toString() { return getClass().getSimpleName() + " [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]"; }
Source:
public void waitForEmptyLeaderInformation(long timeout) throws Exception { final LeaderInformation leader = leaderQueue.poll(timeout, TimeUnit.MILLISECONDS); if (exception != null) { throw exception; } else if (leader == null || !leader.equals(LeaderInformation.empty())) { throw new TimeoutException("Listener was not notified about an empty leader within " + timeout + "ms"); } }

Target:
public void waitForEmptyLeaderInformation(long timeout) throws Exception { throwExceptionIfNotNull(); final String errorMsg = "Listener was not notified about an empty leader within " + timeout + "ms"; CommonTestUtils.waitUntilCondition( () -> { leader = leaderEventQueue.poll(timeout, TimeUnit.MILLISECONDS); return leader != null && leader.isEmpty(); }, Deadline.fromNow(Duration.ofMillis(timeout)), errorMsg); oldAddress = null; }
Source:
private List<Map<String, String>> readPartitionsAndPrune( RexBuilder rexBuilder, FlinkContext context, TableSourceTable tableSourceTable, Function<List<Map<String, String>>, List<Map<String, String>>> pruner, Seq<RexNode> partitionPredicate, List<String> inputFieldNames) { Optional<Catalog> catalogOptional = context.getCatalogManager().getCatalog(tableSourceTable.tableIdentifier().getCatalogName()); List<Map<String, String>> remainingPartitions; DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); ObjectIdentifier identifier = tableSourceTable.tableIdentifier(); Optional<List<Map<String, String>>> optionalPartitions = ((SupportsPartitionPushDown) dynamicTableSource).listPartitions(); if (optionalPartitions.isPresent()) { return pruner.apply(optionalPartitions.get()); } else { if (!catalogOptional.isPresent()) { throw new TableException( String.format("Table %s must from a catalog, but %s is not a catalog", identifier.asSummaryString(), identifier.getCatalogName())); } try { return readPartitionFromCatalogAndPrune( rexBuilder, context, catalogOptional.get(), identifier, inputFieldNames, partitionPredicate, pruner); } catch (TableNotExistException tableNotExistException) { throw new TableException(String.format("Table %s is not found in catalog.", identifier.asSummaryString())); } catch (TableNotPartitionedException tableNotPartitionedException) { throw new TableException( String.format("Table %s is not a partitionable source. Validator should have checked it.", identifier.asSummaryString()), tableNotPartitionedException); } } }

Target:
private List<Map<String, String>> readPartitionsAndPrune( RexBuilder rexBuilder, FlinkContext context, TableSourceTable tableSourceTable, Function<List<Map<String, String>>, List<Map<String, String>>> pruner, Seq<RexNode> partitionPredicate, List<String> inputFieldNames) { Optional<Catalog> catalogOptional = context.getCatalogManager().getCatalog(tableSourceTable.tableIdentifier().getCatalogName()); DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); ObjectIdentifier identifier = tableSourceTable.tableIdentifier(); Optional<List<Map<String, String>>> optionalPartitions = ((SupportsPartitionPushDown) dynamicTableSource).listPartitions(); if (optionalPartitions.isPresent()) { return pruner.apply(optionalPartitions.get()); } else { if (!catalogOptional.isPresent()) { throw new TableException( String.format("Table %s must from a catalog, but %s is not a catalog", identifier.asSummaryString(), identifier.getCatalogName())); } try { return readPartitionFromCatalogAndPrune( rexBuilder, context, catalogOptional.get(), identifier, inputFieldNames, partitionPredicate, pruner); } catch (TableNotExistException tableNotExistException) { throw new TableException(String.format("Table %s is not found in catalog.", identifier.asSummaryString())); } catch (TableNotPartitionedException tableNotPartitionedException) { throw new TableException( String.format("Table %s is not a partitionable source. Validator should have checked it.", identifier.asSummaryString()), tableNotPartitionedException); } } }
Source:
protected void handleWidgetSelected(TypeNameMatch[] selection) { IStatus status= null; if (selection.length == 0) { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, "",null); } else { if (fValidator != null) { List jElements= new ArrayList(); for (TypeNameMatch s : selection) { IType type= s.getType(); if (type != null) { jElements.add(type); } else { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, Messages.format(JavaUIMessages.TypeSelectionDialog_error_type_doesnot_exist, s.getFullyQualifiedName()), null); break; } } if (status == null) { status= fValidator.validate(jElements.toArray()); } } else { status= new Status(IStatus.OK, JavaPlugin.getPluginId(), IStatus.OK, "",null); } } updateStatus(status); }

Target:
protected void handleWidgetSelected(TypeNameMatch[] selection) { IStatus status= null; if (selection.length == 0) { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, "",null); } else { if (fValidator != null) { List jElements= new ArrayList(); for (TypeNameMatch typeInfo : selection) { IType type= typeInfo.getType(); if (type != null) { jElements.add(type); } else { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, Messages.format(JavaUIMessages.TypeSelectionDialog_error_type_doesnot_exist, typeInfo.getFullyQualifiedName()), null); break; } } if (status == null) { status= fValidator.validate(jElements.toArray()); } } else { status= new Status(IStatus.OK, JavaPlugin.getPluginId(), IStatus.OK, "",null); } } updateStatus(status); }
Source:
private boolean isEmptyUserTune() { if (this.artist == null && this.length == null && this.rating == null && this.source == null && this.title == null && this.track == null && this.uri == null) { return true; } return false; }

Target:
private boolean isEmptyUserTune() { return this.equals(EMPTY_USER_TUNE); }
Source:
public String getBaseTypeName() throws SQLException { return baseType.name(); }

Target:
public String getBaseTypeName() throws SQLException { return baseType.getSqlTypeName(); }
Source:
public void test() { sandbox = SqlSandboxUtils.getStaticStorage(username); Case readCase = sandbox.getCaseStorage().read(1); Ledger readLedger = sandbox.getLedgerStorage().read(1); FormInstance readFixture = sandbox.getUserFixtureStorage().read(1); User readUser = sandbox.getUserStorage().read(1); }

Target:
public void test() { sandbox = SqlSandboxUtils.getStaticStorage(username); assertEquals(sandbox.getCaseStorage().getNumRecords(), 6); assertEquals(sandbox.getLedgerStorage().getNumRecords(), 3); assertEquals(sandbox.getUserFixtureStorage().getNumRecords(), 4); User loggedInUser = sandbox.getLoggedInUser(); assertEquals(loggedInUser.getUsername(), "test"); }
Source:
public void theRetrieveAdministrativeStatusRequestIsReceived(final Map<String, String> requestData) throws Throwable { final Map<String, String> settings = new HashMap<>(); settings.put(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION, requestData.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION)); final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory .fromParameterMap(settings); final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient .getAdministrativeStatus(getAdministrativeStatusRequest); LOGGER.info("Get administrative status asyncResponse is received {}", getAdministrativeStatusAsyncResponse); assertNotNull("Get administrative status asyncResponse should not be null", getAdministrativeStatusAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, getAdministrativeStatusAsyncResponse.getCorrelationUid()); }

Target:
public void theRetrieveAdministrativeStatusRequestIsReceived(final Map<String, String> requestData) throws Throwable { final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory .fromParameterMap(requestData); final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient .getAdministrativeStatus(getAdministrativeStatusRequest); LOGGER.info("Get administrative status asyncResponse is received {}", getAdministrativeStatusAsyncResponse); assertNotNull("Get administrative status asyncResponse should not be null", getAdministrativeStatusAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, getAdministrativeStatusAsyncResponse.getCorrelationUid()); }
Source:
public boolean resultSet(Player p, Environment env) { PreparedStatement statement = null; ResultSet rs = null; String query = "SELECT * FROM " + prefix + "traveled_to WHERE uuid = ?"; try { service.testConnection(connection); statement = connection.prepareStatement(query); statement.setString(1, p.getUniqueId().toString()); rs = statement.executeQuery(); if (rs.isBeforeFirst()) { rs.next(); return rs.getInt(env.toString().toLowerCase()) == 1; } else { return false; } } catch (SQLException e) { plugin.debug("ResultSet error for traveled_to table! " + e.getMessage()); return false; } finally { try { if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } } catch (SQLException e) { plugin.debug("Error closing traveled_to table! " + e.getMessage()); } } }

Target:
public boolean resultSet(Player p, Environment env) { PreparedStatement statement = null; ResultSet rs = null; String query = "SELECT * FROM " + prefix + "traveled_to WHERE uuid = ? AND environment = ?"; try { service.testConnection(connection); statement = connection.prepareStatement(query); statement.setString(1, p.getUniqueId().toString()); statement.setString(2, env.toString()); rs = statement.executeQuery(); return rs.isBeforeFirst(); } catch (SQLException e) { plugin.debug("ResultSet error for traveled_to table! " + e.getMessage()); return false; } finally { try { if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } } catch (SQLException e) { plugin.debug("Error closing traveled_to table! " + e.getMessage()); } } }
Source:
public void testThrowOnNullQueue() { assertThrows(IllegalArgumentException.class, () -> { try (NatsTestServer ts = new NatsTestServer(false); Connection nc = Nats.connect(ts.getURI())) { nc.subscribe("subject", (String)null); assertFalse(true); } }); }

Target:
public void testThrowOnNullQueue() { assertThrows(IllegalArgumentException.class, () -> { try (NatsTestServer ts = new NatsTestServer(false); Connection nc = Nats.connect(ts.getURI())) { nc.subscribe("subject", null); assertFalse(true); } }); }
Source:
public CompactionPlan getCompactionPlan(MajorCompactionRequest request) { CompactionPlan plan = super.getCompactionPlan(request); plan.writeParameters = new WriteParameters(); Map<String,String> tableProperties = request.getTableProperties(); verifyRequiredProperties(tableProperties); String largeFileCompressionType = tableProperties.get(TABLE_LARGE_FILE_COMPRESSION_TYPE); String threshold = tableProperties.get(TABLE_LARGE_FILE_COMPRESSION_THRESHOLD); verifyRequiredProperties(largeFileCompressionType, threshold); Long largeFileCompressionThreshold = AccumuloConfiguration.getMemoryInBytes(threshold); long totalSize = 0; for (Entry<FileRef,DataFileValue> entry : request.getFiles().entrySet()) { totalSize += entry.getValue().getSize(); } if (totalSize > largeFileCompressionThreshold) { plan.writeParameters.setCompressType(largeFileCompressionType); } return plan; }

Target:
public CompactionPlan getCompactionPlan(MajorCompactionRequest request) { CompactionPlan plan = super.getCompactionPlan(request); plan.writeParameters = new WriteParameters(); Long totalSize = calculateTotalSize(request, plan); if (totalSize > largeFileCompressionThreshold) { if (log.isDebugEnabled()) { log.debug("Changed compressType to " + largeFileCompressionType + ": totalSize(" + totalSize + ") was greater than threshold " + largeFileCompressionThreshold); } plan.writeParameters.setCompressType(largeFileCompressionType); } return plan; }
Source:
public void getInterpreterBindings(NotebookSocket conn, Message fromMessage) throws IOException { String noteID = (String) fromMessage.data.get("noteID"); List<InterpreterSettingsList> settingList = InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID); broadcastInterpreterBindings(noteID, settingList); }

Target:
public void getInterpreterBindings(NotebookSocket conn, Message fromMessage) throws IOException { String noteID = (String) fromMessage.data.get("noteID"); List<InterpreterSettingsList> settingList = InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID); conn.send(serializeMessage(new Message(OP.INTERPRETER_BINDINGS) .put("interpreterBindings", settingList))); }
Source:
public void onReplayCompletion() { if (!m_hasRestored && !m_replayAgent.hasReplayedSegments() && m_action.doesRecover()) { VoltDB.crashGlobalVoltDB("Nothing to recover from", false, null); } else if (!m_clEnabled && !m_replayAgent.hasReplayedTxns()) { m_state = State.TRUNCATE; } changeState(); if (m_isLeader && m_action.doesRecover()) { VoltDBInterface instance = VoltDB.instance(); if (!instance.getCatalogContext().database.getIsactiveactivedred() && instance.getReplicationRole() == ReplicationRole.NONE) { ByteBuffer params = ByteBuffer.allocate(4); params.putInt(ExecutionEngine.TaskType.RESET_DR_APPLIED_TRACKER.ordinal()); try { instance.getClientInterface().callExecuteTask(30000, params.array()); } catch (IOException | InterruptedException e) { e.printStackTrace(); } } } if (m_clEnabled || m_replayAgent.hasReplayedTxns()) { if (m_isLeader) { try { try { m_zk.create(VoltZK.truncation_snapshot_path, m_clSnapshotPath.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) m_zk.create(VoltZK.request_truncation_snapshot_node, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } catch (Exception e) { VoltDB.crashGlobalVoltDB("Requesting a truncation snapshot " + "via ZK should always succeed", false, e); } } } }

Target:
public void onReplayCompletion() { if (!m_hasRestored && !m_replayAgent.hasReplayedSegments() && m_action.doesRecover()) { VoltDB.crashGlobalVoltDB("Nothing to recover from", false, null); } else if (!m_clEnabled && !m_replayAgent.hasReplayedTxns()) { m_state = State.TRUNCATE; } changeState(); if (m_isLeader && m_action.doesRecover()) { VoltDBInterface instance = VoltDB.instance(); if (!instance.getCatalogContext().database.getIsactiveactivedred() && instance.getReplicationRole() == ReplicationRole.NONE) { ByteBuffer params = ByteBuffer.allocate(4); params.putInt(ExecutionEngine.TaskType.RESET_DR_APPLIED_TRACKER.ordinal()); try { instance.getClientInterface().callExecuteTask(MAX_RESET_DR_APPLIED_TRACKER_TIMEOUT_MILLIS, params.array()); } catch (IOException e) { LOG.warn("Failed to reset DR applied tracker due to an IOException", e); } catch (InterruptedException e) { LOG.warn("Failed to reset DR applied tracker due to an InterruptedException", e); } } } if (m_clEnabled || m_replayAgent.hasReplayedTxns()) { if (m_isLeader) { try { try { m_zk.create(VoltZK.truncation_snapshot_path, m_clSnapshotPath.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) m_zk.create(VoltZK.request_truncation_snapshot_node, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } catch (Exception e) { VoltDB.crashGlobalVoltDB("Requesting a truncation snapshot " + "via ZK should always succeed", false, e); } } } }
Source:
public int run(final Namespace options, final List<Target> targets, final PrintStream out, final PrintStream err, final String username, final boolean json) throws IOException, InterruptedException { boolean successful = true; boolean isFirst = true; Iterator<Target> targetIterator = targets.iterator(); while (targetIterator.hasNext()) { Target target = targetIterator.next(); if (targets.size() > 1) { if (!json) { final List<URI> endpoints = target.getEndpointSupplier().get(); final String header = format("%s (%s)", target.getName(), endpoints); out.println(header); out.println(repeat("-", header.length())); out.flush(); } else { if (isFirst) { out.println("{"); isFirst = false; } out.println("\"" + target.toString() + "\": "); } } successful &= run(options, target, out, err, username, json); if (targets.size() > 1) { if (!json) { out.println(); } else { if (targetIterator.hasNext()) { out.println(",\n"); } else { out.println("}"); } } } } return successful ? 0 : 1; }

Target:
public int run(final Namespace options, final List<Target> targets, final PrintStream out, final PrintStream err, final String username, final boolean json) throws IOException, InterruptedException { boolean successful = true; boolean isFirst = true; Iterator<Target> targetIterator = targets.iterator(); while (targetIterator.hasNext()) { Target target = targetIterator.next(); if (targets.size() > 1) { if (!json) { final List<URI> endpoints = target.getEndpointSupplier().get(); final String header = format("%s (%s)", target.getName(), endpoints); out.println(header); out.println(repeat("-", header.length())); out.flush(); } else { if (isFirst) { out.println("{"); isFirst = false; } out.println("\"" + target.getName() + "\": "); } } successful &= run(options, target, out, err, username, json); if (targets.size() > 1) { if (!json) { out.println(); } else { if (targetIterator.hasNext()) { out.println(",\n"); } else { out.println("}"); } } } } return successful ? 0 : 1; }
Source:
public void after() { fViewBot.toolbarButton(SHOW_LEGEND).click(); SWTWorkbenchBot bot = fBot; SWTBotShell legendShell = bot.shell(LEGEND_NAME); SWTBot legendBot = legendShell.bot(); for (int i = 0; i < StubPresentationProvider.STATES.length; i++) { legendBot.button(i).click(); } legendBot.button(OK_BUTTON).click(); TmfTraceStub trace = fTrace; assertNotNull(trace); TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace)); bot.waitUntil(Conditions.shellCloses(legendShell)); fViewBot.close(); bot.waitUntil(ConditionHelpers.ViewIsClosed(fViewBot)); fTrace.dispose(); }

Target:
public void after() { fViewBot.toolbarButton(SHOW_LEGEND).click(); SWTBotShell legendShell = fBot.shell(LEGEND_NAME); SWTBot legendBot = legendShell.bot(); for (int i = 0; i < StubPresentationProvider.STATES.length; i++) { legendBot.button(i).click(); } legendBot.button(OK_BUTTON).click(); TmfTraceStub trace = fTrace; assertNotNull(trace); TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace)); fBot.waitUntil(Conditions.shellCloses(legendShell)); fViewBot.close(); fBot.waitUntil(ConditionHelpers.ViewIsClosed(fViewBot)); fTrace.dispose(); }
Source:
public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) { if (SnapshotOperation.REVERT.equals(op)) { return StrategyPriority.CANT_HANDLE; } long volumeId = snapshot.getVolumeId(); VolumeVO volumeVO = _volumeDao.findByIdIncludingRemoved(volumeId); long storagePoolId = volumeVO.getPoolId(); DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); if (dataStore != null) { Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); Boolean supportsStorageSystemSnapshots = new Boolean(value); if (supportsStorageSystemSnapshots) { return StrategyPriority.HIGHEST; } } } return StrategyPriority.CANT_HANDLE; }

Target:
public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) { if (SnapshotOperation.REVERT.equals(op)) { return StrategyPriority.CANT_HANDLE; } long volumeId = snapshot.getVolumeId(); VolumeVO volumeVO = volumeDao.findByIdIncludingRemoved(volumeId); long storagePoolId = volumeVO.getPoolId(); DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); if (dataStore != null) { Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); Boolean supportsStorageSystemSnapshots = Boolean.valueOf(value); if (supportsStorageSystemSnapshots) { return StrategyPriority.HIGHEST; } } } return StrategyPriority.CANT_HANDLE; }
Source:
public final SafeHtml getLineReplaceHTML() { SafeHtmlBuilder out = new SafeHtmlBuilder(); if (!StringUtil.isNullOrEmpty(getErrors())) { out.appendHtmlConstant("<mark>"); out.appendEscaped(getErrors()); out.appendHtmlConstant("</mark>"); } else { ArrayList<Integer> onReplace = getReplaceMatchOns(); ArrayList<Integer> offReplace = getReplaceMatchOffs(); ArrayList<Pair<Boolean, Integer>> parts = new ArrayList<Pair<Boolean, Integer>>(); while (onReplace.size() + offReplace.size() > 0) { int onReplaceVal = onReplace.size() == 0 ? Integer.MAX_VALUE : onReplace.get(0); int offReplaceVal = offReplace.size() == 0 ? Integer.MAX_VALUE : offReplace.get(0); if (onReplaceVal <= offReplaceVal) parts.add(new Pair<Boolean, Integer>(true, onReplace.remove(0))); else parts.add(new Pair<Boolean, Integer>(false, offReplace.remove(0))); } String line = getLineValue(); int openEmTags = 0; int openMarkTags = 0; for (int i = 0; i < line.length(); i++) { while (parts.size() > 0 && parts.get(0).second == i) { if (parts.remove(0).first) { out.appendHtmlConstant("<em>"); openEmTags++; } else if (openEmTags > 0) { out.appendHtmlConstant("</em>"); openEmTags--; } } out.append(line.charAt(i)); } while (openEmTags > 0) { openEmTags--; out.appendHtmlConstant("</em>"); } } return out.toSafeHtml(); }

Target:
public final SafeHtml getLineReplaceHTML() { SafeHtmlBuilder out = new SafeHtmlBuilder(); if (!StringUtil.isNullOrEmpty(getErrors())) out = appendHtmlTaggedString(out, "mark", getErrors()); else { ArrayList<Integer> onReplace = getReplaceMatchOns(); ArrayList<Integer> offReplace = getReplaceMatchOffs(); ArrayList<Pair<Boolean, Integer>> parts = new ArrayList<Pair<Boolean, Integer>>(); while (onReplace.size() + offReplace.size() > 0) { int onIndex = onReplace.size() - 1; int offIndex = offReplace.size() - 1; int onReplaceVal = onReplace.size() == 0 ? Integer.MAX_VALUE : onReplace.get(onIndex); int offReplaceVal = offReplace.size() == 0 ? Integer.MAX_VALUE : offReplace.get(offIndex); if (onReplaceVal < offReplaceVal) parts.add(new Pair<Boolean, Integer>(true, onReplace.remove(onIndex))); else parts.add(new Pair<Boolean, Integer>(false, offReplace.remove(offIndex))); } String line = getLineValue(); int openInsTags = 0; int openMarkTags = 0; for (int i = 0; i < line.length(); i++) { while (parts.size() > 0 && parts.get(0).second == i) { if (parts.remove(0).first) { out.appendHtmlConstant("<ins>"); openInsTags++; } else if (openInsTags > 0) { out.appendHtmlConstant("</ins>"); openInsTags--; } } out.append(line.charAt(i)); } while (openInsTags > 0) { openInsTags--; out.appendHtmlConstant("</ins>"); } } return out.toSafeHtml(); }
Source:
private static void extractTarFileToFolder(File file, File outputDir, boolean isGZipped) { FileInputStream fileInputStream = null; TarInputStream tarArchiveInputStream = null; try { fileInputStream = new FileInputStream(file); tarArchiveInputStream = (isGZipped) ? new TarInputStream(new GZIPInputStream(fileInputStream, BUFFER_SIZE)) : new TarInputStream(new BufferedInputStream(fileInputStream, BUFFER_SIZE)); unTar(tarArchiveInputStream, outputDir); } catch (IOException e) { logger.error(e.getMessage()); } finally { if (tarArchiveInputStream != null) { try { tarArchiveInputStream.close(); } catch (IOException e) { logger.error(e.getMessage()); } } else if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { logger.error(e.getMessage()); } } } }

Target:
private static void extractTarFileToFolder(File file, File outputDir, boolean isGZipped) { try (FileInputStream fileInputStream = new FileInputStream(file); TarInputStream tarArchiveInputStream = (isGZipped) ? new TarInputStream(new GZIPInputStream(fileInputStream, BUFFER_SIZE)) : new TarInputStream(new BufferedInputStream(fileInputStream, BUFFER_SIZE))){ unTar(tarArchiveInputStream, outputDir); } catch (IOException e) { logger.error(e.getMessage()); } }
Source:
public static RSDL loadRsdl(ApplicationMode applicationMode) throws IOException { String fileName = applicationMode == ApplicationMode.AllModes ? RsdlIOManager.RSDL_RESOURCE_NAME : RsdlIOManager.GLUSTER_RSDL_RESOURCE_NAME; InputStream rsdlAsStrem = null; try { rsdlAsStrem = RsdlIOManager.loadAsStream(fileName); return JAXB.unmarshal(rsdlAsStrem, RSDL.class); } finally { rsdlAsStrem.close(); } }

Target:
public static RSDL loadRsdl(ApplicationMode applicationMode) throws IOException { String fileName = applicationMode == ApplicationMode.AllModes ? ("/" + RsdlIOManager.RSDL_RESOURCE_NAME) : ("/" + RsdlIOManager.GLUSTER_RSDL_RESOURCE_NAME); InputStream rsdlAsStrem = null; try { rsdlAsStrem = RsdlIOManager.loadAsStream(fileName); return JAXB.unmarshal(rsdlAsStrem, RSDL.class); } finally { if (rsdlAsStrem != null) { rsdlAsStrem.close(); } } }
Source:
public void clickCollapseExpandButtonAndWaitForPanelsToCollapse() { clickCollapseExpandButton(); waitForPanelsToCollapse(); }

Target:
public void clickCollapseExpandButtonAndWaitForPanelsToCollapse() { click(collapseExpandButton); waitForPanelsToCollapse(); }
Source:
public void testEnoughSpaceToMergeSnapshotsWithMultipleDisk() { ArrayList<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, 4); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(22, STORAGE_DOMAIN_ID); assertTrue("Validation should succeed. Free space minus threshold should be bigger then summarize all disks size", cmd.isEnoughSpaceToMergeSnapshots()); }

Target:
public void testEnoughSpaceToMergeSnapshotsWithMultipleDisk() { List<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, IMAGE_ACTUAL_SIZE_GB); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(22, STORAGE_DOMAIN_ID); assertTrue("Validation should succeed. Free space minus threshold should be bigger then summarize all disks size", cmd.isEnoughSpaceToMergeSnapshots()); }
Source:
public void process(WatchedEvent event) { System.out.println(event); try { switch ( event.getType() ) { case NodeCreated: assert parent == null; wasCreated(); break; case NodeChildrenChanged: refreshChildren(); break; case NodeDataChanged: refreshData(); break; case NodeDeleted: wasDeleted(); break; } } catch ( Exception e ) { handleException(e); } }

Target:
public void process(WatchedEvent event) { try { switch ( event.getType() ) { case NodeCreated: Preconditions.checkState(parent == null, "unexpected NodeCreated on non-root node"); wasCreated(); break; case NodeChildrenChanged: refreshChildren(); break; case NodeDataChanged: refreshData(); break; case NodeDeleted: wasDeleted(); break; } } catch ( Exception e ) { handleException(e); } }
Source:
public Points getDataToRollup(final Locator locator, RollupType rollupType, Range range, String columnFamilyName) throws IOException, CacheException { if( columnFamilyName.equals ( CassandraModel.CF_METRICS_STRING_NAME ) ) { String msg = String.format( String.format( "DBasicMetricsRW.getDataToRollup: %s Attempting to write String/Boolean metric for a method which should not get them.", columnFamilyName ) ); LOG.error( msg ); throw new IOException( msg ); } return super.getDataToRollup( locator, rollupType, range, columnFamilyName ); }

Target:
public Points getDataToRollup(final Locator locator, RollupType rollupType, Range range, String columnFamilyName) throws IOException { if( columnFamilyName.equals ( CassandraModel.CF_METRICS_STRING_NAME ) ) { String msg = String.format( String.format( "DBasicMetricsRW.getDataToRollup: %s Attempting to read String/Boolean metric for a method which should not get them.", columnFamilyName ) ); LOG.error( msg ); throw new IOException( msg ); } return super.getDataToRollup( locator, rollupType, range, columnFamilyName ); }