auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected R setUpdateTasks(BoxArray<BoxMetadataUpdateTask> updateTasks) { mBodyMap.put(BoxArray.PUT_ARRAY, updateTasks); return (R) this; }

Target:
protected R setUpdateTasks(BoxArray<BoxMetadataUpdateTask> updateTasks) { mBodyMap.put(BoxRequest.JSON_OBJECT, updateTasks); return (R) this; }
Source:
private void cleanupTimedOutTransactions() { List<TransactionEdit> invalidEdits = null; this.logReadLock.lock(); try { synchronized (this) { if (!isRunning()) { return; } long currentTime = System.currentTimeMillis(); List<Long> timedOut = Lists.newArrayList(); for (Map.Entry<Long, InProgressTx> tx : inProgress.entrySet()) { long expiration = tx.getValue().getExpiration(); if (expiration >= 0L && currentTime > expiration) { timedOut.add(tx.getKey()); LOG.info("Tx invalid list: added tx because of timeout", tx.getKey()); } else if (expiration < 0) { LOG.warn("Transaction has negative expiration time {}. " + "Likely cause is the transaction was not migrated correctly, this transaction cannot be expired", tx.getKey(), expiration); } } if (!timedOut.isEmpty()) { invalidEdits = Lists.newArrayListWithCapacity(timedOut.size()); invalid.addAll(timedOut); for (long tx : timedOut) { committingChangeSets.remove(tx); inProgress.remove(tx); invalidEdits.add(TransactionEdit.createInvalid(tx)); } Collections.sort(invalid); invalidArray = invalid.toLongArray(); LOG.info("Invalidated transactions due to timeout.", timedOut.size()); } } if (invalidEdits != null) { appendToLog(invalidEdits); } } finally { this.logReadLock.unlock(); } }

Target:
private void cleanupTimedOutTransactions() { List<TransactionEdit> invalidEdits = null; this.logReadLock.lock(); try { synchronized (this) { if (!isRunning()) { return; } long currentTime = System.currentTimeMillis(); List<Long> timedOut = Lists.newArrayList(); for (Map.Entry<Long, InProgressTx> tx : inProgress.entrySet()) { long expiration = tx.getValue().getExpiration(); if (expiration >= 0L && currentTime > expiration) { timedOut.add(tx.getKey()); LOG.info("Tx invalid list: added tx because of timeout", tx.getKey()); } else if (expiration < 0) { LOG.warn("Transaction has negative expiration time {}. Likely cause is the transaction was not " + "migrated correctly, this transaction will be expired immediately", tx.getKey(), expiration); timedOut.add(tx.getKey()); } } if (!timedOut.isEmpty()) { invalidEdits = Lists.newArrayListWithCapacity(timedOut.size()); invalid.addAll(timedOut); for (long tx : timedOut) { committingChangeSets.remove(tx); inProgress.remove(tx); invalidEdits.add(TransactionEdit.createInvalid(tx)); } Collections.sort(invalid); invalidArray = invalid.toLongArray(); LOG.info("Invalidated transactions due to timeout.", timedOut.size()); } } if (invalidEdits != null) { appendToLog(invalidEdits); } } finally { this.logReadLock.unlock(); } }
Source:
public String readString() throws IOException { int len = readLength(); if (len == 0) { log.info("flush packet"); return END; } len -= 4; if (len == 0) { log.info(""); return ""; } byte[] raw; if (len <= lineBuffer.length) raw = lineBuffer; else raw = new byte[len]; IO.readFully(in, raw, 0, len); if (raw[len - 1] == '\n') len--; String decodedBuffer = RawParseUtils.decode(Constants.CHARSET, raw, 0, len); log.info(decodedBuffer); return decodedBuffer; }

Target:
public String readString() throws IOException { int len = readLength(); if (len == 0) { log.debug("flush-pkt"); return END; } len -= 4; if (len == 0) { log.debug(""); return ""; } byte[] raw; if (len <= lineBuffer.length) raw = lineBuffer; else raw = new byte[len]; IO.readFully(in, raw, 0, len); if (raw[len - 1] == '\n') len--; String decodedBuffer = RawParseUtils.decode(Constants.CHARSET, raw, 0, len); log.debug(decodedBuffer); return decodedBuffer; }
Source:
private Node getSourceNode(Diagram diagram, String edgeUuid) { final Iterator<Node> nodes = diagram.getGraph().nodes().iterator(); Node<?, ? extends Edge> sourceNode; while (nodes.hasNext()) { sourceNode = nodes.next(); if (sourceNode.getOutEdges().stream() .filter(edge -> edge.getUUID().equals(edgeUuid)).findFirst() .isPresent()) { return sourceNode; } } return null; }

Target:
private Node getSourceNode(Diagram diagram, String edgeUuid) { final Iterator<Node> nodes = diagram.getGraph().nodes().iterator(); Node<?, ? extends Edge> sourceNode; while (nodes.hasNext()) { sourceNode = nodes.next(); if (sourceNode.getOutEdges().stream() .anyMatch(edge -> edge.getUUID().equals(edgeUuid))) { return sourceNode; } } return null; }
Source:
public Status delete(String keyspace, String key) { try { ClientResponse response = mclient.callProcedure("STORE.delete", key, keyspace.getBytes(UTF8)); return response.getStatus() == ClientResponse.SUCCESS ? Status.OK : Status.ERROR; } catch (Exception e) { e.printStackTrace(); return Status.ERROR; } }

Target:
public Status delete(String keyspace, String key) { try { ClientResponse response = mclient.callProcedure("STORE.delete", key, keyspace.getBytes(UTF8)); return response.getStatus() == ClientResponse.SUCCESS ? Status.OK : Status.ERROR; } catch (Exception e) { logger.error("Error while deleting row", e); return Status.ERROR; } }
Source:
public void validate(Element element, ElementValidation validation) { injectHelper.validate(RootFragment.class, element, validation); if (!validation.isValid()) { return; } validatorHelper.isNotPrivate(element, validation); }

Target:
public void validate(Element element, ElementValidation validation) { injectHelper.validate(RootFragment.class, element, validation); if (!validation.isValid()) { return; } Element param = injectHelper.getParam(element); validatorHelper.extendsFragment(param, validation); validatorHelper.isNotPrivate(element, validation); }
Source:
public void testTableNames() throws IOException { String[] goodNames = { "a", "1", "_", "_x", "a-._5x", "_a-._5x", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi", "jklmnopqrstuvwxyz1234567890_-." }; String[] badNames = { "-x", ".x", "a!", "a@", "a#", "a$", "a%", "a^", "a&", "a*", "a(", "a+", "a=", "a~", "a`", "a{", "a[", "a|", "a\\", "a/", "a<", "a,", "a?", "a" + RandomStringUtils.random(10, false, false) }; Admin admin = getConnection().getAdmin(); for (String badName : badNames) { boolean failed = false; try { HTableDescriptor descriptor = new HTableDescriptor(TableName.valueOf(badName)); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); admin.createTable(descriptor); } catch (IllegalArgumentException e) { failed = true; } Assert.assertTrue("Should fail as table name: '" + badName + "'", failed); } for(String goodName : goodNames) { TableName tableName = TableName.valueOf(goodName); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); try { admin.createTable(descriptor); } finally { try { admin.disableTable(tableName); admin.deleteTable(tableName); } catch (Throwable t) { t.printStackTrace(); } } } }

Target:
public void testTableNames() throws IOException { String[] goodNames = { "a", "1", "_", "_x", "a-._5x", "_a-._5x", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi", "jklmnopqrstuvwxyz1234567890_-." }; String[] badNames = { "-x", ".x", "a!", "a@", "a#", "a$", "a%", "a^", "a&", "a*", "a(", "a+", "a=", "a~", "a`", "a{", "a[", "a|", "a\\", "a/", "a<", "a,", "a?", "a" + RandomStringUtils.random(10, false, false) }; Admin admin = getConnection().getAdmin(); for (String badName : badNames) { boolean failed = false; try { HTableDescriptor descriptor = new HTableDescriptor(TableName.valueOf(badName)); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); admin.createTable(descriptor); } catch (IllegalArgumentException e) { failed = true; } Assert.assertTrue("Should fail as table name: '" + badName + "'", failed); } for(String goodName : goodNames) { TableName tableName = TableName.valueOf(goodName); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); try { if (admin.tableExists(tableName)) { LOG.warn("Not creating the table since it exists: %s", tableName); } else { admin.createTable(descriptor); } } finally { try { admin.disableTable(tableName); admin.deleteTable(tableName); } catch (Throwable t) { LOG.warn("Error cleaning up the table", t); } } } }
Source:
private boolean isValidTransactionEntry(@NonNull OpaqueEntry entry) { Set<UUID> txEntryStreamIds = new HashSet<>(entry.getEntries().keySet()); if (txEntryStreamIds.isEmpty()) { log.info("Log Entry Reader, TX stream Opaque entry is EMPTY, streams_to_replicate={}, empty entry ts={}", streamUUIDs.size(), entry.getVersion()); return false; } if (Collections.disjoint(streamUUIDs, txEntryStreamIds)) { log.debug("Log Entry Reader, TX entry[{}] contains none of the streams of interest, streams={}", entry.getVersion(), txEntryStreamIds); return false; } else { log.debug("Log Entry Reader, valid TX entry[{}] streams={}, ignored streams={}, ", entry.getVersion(), txEntryStreamIds, txEntryStreamIds.removeAll(streamUUIDs)); return true; } }

Target:
private boolean isValidTransactionEntry(@NonNull OpaqueEntry entry) { Set<UUID> txEntryStreamIds = new HashSet<>(entry.getEntries().keySet()); if (txEntryStreamIds.isEmpty()) { log.debug("TX Stream entry[{}] :: EMPTY [ignored]", entry.getVersion()); return false; } if (Collections.disjoint(streamUUIDs, txEntryStreamIds)) { log.trace("TX Stream entry[{}] :: contains none of the streams of interest, streams={} [ignored]", entry.getVersion(), txEntryStreamIds); return false; } else { Set<UUID> ignoredTxStreams = txEntryStreamIds.stream().filter(id -> !streamUUIDs.contains(id)) .collect(Collectors.toSet()); txEntryStreamIds.removeAll(ignoredTxStreams); log.debug("TX Stream entry[{}] :: replicate[{}]={}, ignore[{}]={} [valid]", entry.getVersion(), txEntryStreamIds.size(), txEntryStreamIds, ignoredTxStreams.size(), ignoredTxStreams); return true; } }
Source:
public Concat_ws() { super(new Column[] { new Column("org/apache/tajo/storage/text", TajoDataTypes.Type.TEXT), new Column("org/apache/tajo/storage/text", TajoDataTypes.Type.TEXT), new Column("org/apache/tajo/storage/text", TajoDataTypes.Type.TEXT), }); }

Target:
public Concat_ws() { super(new Column[] { new Column("text", TajoDataTypes.Type.TEXT), new Column("text", TajoDataTypes.Type.TEXT), new Column("text", TajoDataTypes.Type.TEXT), }); }
Source:
private List<RowGroup> createRowGroups( int rowsInStripe, Map<StreamId, Stream> streams, Map<StreamId, ValueInputStream<?>> valueStreams, Map<Integer, List<RowGroupIndex>> columnIndexes, Set<Integer> selectedRowGroups, List<ColumnEncoding> encodings) throws InvalidCheckpointException { ImmutableList.Builder<RowGroup> rowGroupBuilder = ImmutableList.builder(); for (int rowGroupId : selectedRowGroups) { Map<StreamId, StreamCheckpoint> checkpoints = getStreamCheckpoints(includedOrcColumns, types, decompressor.isPresent(), rowGroupId, encodings, streams, columnIndexes); int rowOffset = rowGroupId * rowsInRowGroup; int rowsInGroup = Math.min(rowsInStripe - rowOffset, rowsInRowGroup); rowGroupBuilder.add(createRowGroup(rowGroupId, rowOffset, rowsInGroup, columnIndexes.entrySet().stream().mapToLong(e -> e.getValue().get(rowGroupId).getColumnStatistics().getMinAverageValueSizeInBytes()).sum(), valueStreams, checkpoints)); } return rowGroupBuilder.build(); }

Target:
private List<RowGroup> createRowGroups( int rowsInStripe, Map<StreamId, Stream> streams, Map<StreamId, ValueInputStream<?>> valueStreams, Map<Integer, List<RowGroupIndex>> columnIndexes, Set<Integer> selectedRowGroups, List<ColumnEncoding> encodings) throws InvalidCheckpointException { ImmutableList.Builder<RowGroup> rowGroupBuilder = ImmutableList.builder(); for (int rowGroupId : selectedRowGroups) { Map<StreamId, StreamCheckpoint> checkpoints = getStreamCheckpoints(includedOrcColumns, types, decompressor.isPresent(), rowGroupId, encodings, streams, columnIndexes); int rowOffset = rowGroupId * rowsInRowGroup; int rowsInGroup = Math.min(rowsInStripe - rowOffset, rowsInRowGroup); long minAverageRowBytes = columnIndexes .entrySet() .stream() .mapToLong(e -> e.getValue() .get(rowGroupId) .getColumnStatistics() .getMinAverageValueSizeInBytes()) .sum(); rowGroupBuilder.add(createRowGroup(rowGroupId, rowOffset, rowsInGroup, minAverageRowBytes, valueStreams, checkpoints)); } return rowGroupBuilder.build(); }
Source:
public GameDetails getGameDetails(@RequestParam(value = "token", required = false) String token, @RequestParam("gameId") String gameId) throws AuthenticationException, GameException { UserBean user = authenticationService.authenticateUserByToken(token); GameBean game = gameService.getGameByGameIdWithJoinedUser(user, gameId); int userId = user.getId(); return new GameDetails(game, userId); }

Target:
public GameDetails getGameDetails(@RequestParam(value = "token", required = false) String token, @RequestParam("gameId") String gameId) throws AuthenticationException, GameException { UserBean detailsRequester = authenticationService.authenticateUserByToken(token); GameBean game = gameService.getGameByGameIdWithJoinedUser(detailsRequester, gameId); return new GameDetails(game, detailsRequester.getId()); }
Source:
public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) { if (!testIdentifier.isContainer()) { final Status status = testExecutionResult.getStatus(); switch (status) { case SUCCESSFUL: listener.onTestPassed(); break; case FAILED: case ABORTED: listener.onTestFailed(); break; } listener.onTestEnd(); } }

Target:
public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) { if (testIdentifier.isContainer()) { return; } final Status status = testExecutionResult.getStatus(); switch (status) { case SUCCESSFUL: listener.onTestPassed(); break; case FAILED: case ABORTED: listener.onTestFailed(); break; } listener.onTestEnd(); }
Source:
private void performAquire(Subscriber<? super ObservableConnection<I, O>> subscriber) { logger.trace("Started to aquire connection"); long startTimeMillis = Clock.newStartTimeMillis(); try { metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_START); PooledConnection<I, O> idleConnection = getAnIdleConnection(true); if (null != idleConnection) { idleConnection.beforeReuse(); channelFactory.onNewConnection(idleConnection, subscriber); long endTime = Clock.onEndMillis(startTimeMillis); metricEventsSubject.onEvent(ClientMetricsEvent.POOLED_CONNECTION_REUSE, endTime); metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_SUCCESS, endTime); logger.trace("Returned reused connection"); aquiredConnectionsCounter.incrementAndGet(); } else if (limitDeterminationStrategy.acquireCreationPermit(startTimeMillis, TimeUnit.MILLISECONDS)) { logger.trace("Start to create new connection"); connectionsInCreation.incrementAndGet(); Subscriber<? super ObservableConnection<I, O>> newConnectionSubscriber = newConnectionSubscriber(subscriber, startTimeMillis); try { channelFactory.connect(newConnectionSubscriber, serverInfo, connectionFactory); } catch (Throwable throwable) { newConnectionSubscriber.onError(throwable); } } else { PoolExhaustedException e = new PoolExhaustedException(); metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_FAILED, Clock.onEndMillis(startTimeMillis), e); subscriber.onError(e); } } catch (Throwable throwable) { metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_FAILED, Clock.onEndMillis(startTimeMillis), throwable); subscriber.onError(throwable); } }

Target:
private void performAquire(Subscriber<? super ObservableConnection<I, O>> subscriber) { long startTimeMillis = Clock.newStartTimeMillis(); try { metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_START); PooledConnection<I, O> idleConnection = getAnIdleConnection(true); if (null != idleConnection) { idleConnection.beforeReuse(); channelFactory.onNewConnection(idleConnection, subscriber); long endTime = Clock.onEndMillis(startTimeMillis); metricEventsSubject.onEvent(ClientMetricsEvent.POOLED_CONNECTION_REUSE, endTime); metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_SUCCESS, endTime); aquiredConnectionsCounter.incrementAndGet(); } else if (limitDeterminationStrategy.acquireCreationPermit(startTimeMillis, TimeUnit.MILLISECONDS)) { aquiredConnectionsCounter.incrementAndGet(); Subscriber<? super ObservableConnection<I, O>> newConnectionSubscriber = newConnectionSubscriber(subscriber, startTimeMillis); try { channelFactory.connect(newConnectionSubscriber, serverInfo, connectionFactory); } catch (Throwable throwable) { newConnectionSubscriber.onError(throwable); } } else { PoolExhaustedException e = new PoolExhaustedException(); metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_FAILED, Clock.onEndMillis(startTimeMillis), e); subscriber.onError(e); } } catch (Throwable throwable) { metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_FAILED, Clock.onEndMillis(startTimeMillis), throwable); subscriber.onError(throwable); } }
Source:
protected boolean check(final WebContext context, final U profile, final String element) throws HttpAction { if (!profile.containsAttribute(element)) { return false; } if (StringUtils.isEmpty(this.valueToMatch)) { return true; } final Object attributeValues = profile.getAttribute(element); if (attributeValues instanceof Collection) { return Collection.class.cast(attributeValues) .stream() .filter(v -> v.toString().matches(this.valueToMatch)) .findAny() .isPresent(); } return attributeValues.toString().matches(this.valueToMatch); }

Target:
protected boolean check(final WebContext context, final U profile, final String element) throws HttpAction { if (!profile.containsAttribute(element)) { return false; } if (CommonHelper.isBlank(this.valueToMatch)) { return true; } final Object attributeValues = profile.getAttribute(element); if (attributeValues instanceof Collection) { return Collection.class.cast(attributeValues) .stream() .filter(v -> v.toString().matches(this.valueToMatch)) .findAny() .isPresent(); } return attributeValues.toString().matches(this.valueToMatch); }
Source:
public List<Sample> getLast24hours( @Scope({OAuthScope.SENSORS_BASIC}) final AccessToken accessToken, @PathParam("sensor") String sensor, @QueryParam("from_utc") Long queryEndTimestampUTC) { if (hiddenSensors.contains(sensor)) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); } validateQueryRange(queryEndTimestampUTC, DateTime.now(), accessToken.accountId, allowedRangeInSeconds); final int slotDurationInMinutes = 5; final long queryStartTimeUTC = new DateTime(queryEndTimestampUTC, DateTimeZone.UTC).minusHours(24).getMillis(); final Optional<DeviceAccountPair> deviceIdPair = deviceDAO.getMostRecentSensePairByAccountId(accessToken.accountId); if(!deviceIdPair.isPresent()) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); } Optional<Device.Color> color = Optional.absent(); if (this.hasColorCompensationEnabled(accessToken.accountId)) { color = senseColorDAO.getColorForSense(deviceIdPair.get().externalDeviceId); } final Optional<Calibration> calibrationOptional = getCalibrationStrict(deviceIdPair.get().externalDeviceId); final List<Sample> timeSeries = deviceDataDAO.generateTimeSeriesByUTCTime(queryStartTimeUTC, queryEndTimestampUTC, accessToken.accountId, deviceIdPair.get().internalDeviceId, slotDurationInMinutes, sensor, missingDataDefaultValue(accessToken.accountId), color, calibrationOptional); if (this.hasDustSmoothEnabled(deviceIdPair.get().externalDeviceId)){ }; return timeSeries; }

Target:
public List<Sample> getLast24hours( @Scope({OAuthScope.SENSORS_BASIC}) final AccessToken accessToken, @PathParam("sensor") String sensor, @QueryParam("from_utc") Long queryEndTimestampUTC) { if (hiddenSensors.contains(sensor)) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); } validateQueryRange(queryEndTimestampUTC, DateTime.now(), accessToken.accountId, allowedRangeInSeconds); final int slotDurationInMinutes = 5; final long queryStartTimeUTC = new DateTime(queryEndTimestampUTC, DateTimeZone.UTC).minusHours(24).getMillis(); final Optional<DeviceAccountPair> deviceIdPair = deviceDAO.getMostRecentSensePairByAccountId(accessToken.accountId); if(!deviceIdPair.isPresent()) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); } Optional<Device.Color> color = Optional.absent(); if (this.hasColorCompensationEnabled(accessToken.accountId)) { color = senseColorDAO.getColorForSense(deviceIdPair.get().externalDeviceId); } final Optional<Calibration> calibrationOptional = getCalibrationStrict(deviceIdPair.get().externalDeviceId); final List<Sample> timeSeries = deviceDataDAO.generateTimeSeriesByUTCTime(queryStartTimeUTC, queryEndTimestampUTC, accessToken.accountId, deviceIdPair.get().internalDeviceId, slotDurationInMinutes, sensor, missingDataDefaultValue(accessToken.accountId), color, calibrationOptional); return adjustTimeSeries(timeSeries, sensor, deviceIdPair.get().externalDeviceId); }
Source:
public String getUrl() { String sql = ((customSQL != null) && (!customSQL.isEmpty())) ? getCustomSQL() : getSql(); return "/orientdb/query/db/sql/"+ UrlEncoder.PATH_INSTANCE.encode(sql, "UTF-8")+ "/99999?rnd="+ noCacheRnd; }

Target:
public String getUrl() { String sql = getSql(); return "/orientdb/query/db/sql/"+ UrlEncoder.PATH_INSTANCE.encode(sql, "UTF-8")+ "/99999?rnd="+ noCacheRnd; }
Source:
public static void actionDelete(PageContext pc, Resource dir, boolean forceDelete, String serverPassword) throws PageException { SecurityManager securityManager = pc.getConfig().getSecurityManager(); securityManager.checkFileLocation(pc.getConfig(), dir, serverPassword); if (!dir.exists()) { if (dir.isDirectory()) throw new ApplicationException("directory [" + dir.toString() + "] doesn't exist"); else if (dir.isFile()) throw new ApplicationException("file [" + dir.toString() + "] doesn't exist and isn't a directory"); } if (dir.isFile()) throw new ApplicationException("can't delete [" + dir.toString() + "], it isn't a directory, it's a file"); if (dir.listResources() != null && dir.listResources().length > 0 && forceDelete == false) throw new ApplicationException("directory [" + dir.toString() + "] is not empty","Enable recurse to delete sub-directories and files too"); try { dir.remove(forceDelete); } catch (IOException e) { throw Caster.toPageException(e); } }

Target:
public static void actionDelete(PageContext pc, Resource dir, boolean forceDelete, String serverPassword) throws PageException { SecurityManager securityManager = pc.getConfig().getSecurityManager(); securityManager.checkFileLocation(pc.getConfig(), dir, serverPassword); if (!dir.exists()) { if (dir.isDirectory()) throw new ApplicationException("directory [" + dir.toString() + "] doesn't exist"); else if (dir.isFile()) throw new ApplicationException("file [" + dir.toString() + "] doesn't exist and isn't a directory"); } if (dir.isFile()) throw new ApplicationException("can't delete [" + dir.toString() + "], it isn't a directory, it's a file"); Resource[] dirList = dir.listResources(); if (dirList != null && dirList.length > 0 && forceDelete == false) throw new ApplicationException("directory [" + dir.toString() + "] is not empty","set recurse=true to delete sub-directories and files too"); try { dir.remove(forceDelete); } catch (IOException e) { throw Caster.toPageException(e); } }
Source:
public ListenableFuture<?> execute(CreateFunction statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Analyzer analyzer = new Analyzer(stateMachine.getSession(), metadata, sqlParser, accessControl, Optional.empty(), parameters, stateMachine.getWarningCollector()); Analysis analysis = analyzer.analyze(statement); if (analysis.getFunctionHandles().values().stream() .anyMatch(SqlFunctionHandle.class::isInstance)) { throw new PrestoException(NOT_SUPPORTED, "Invoking a SQL function in SQL function body is not yet supported"); } metadata.getFunctionManager().createFunction(createSqlInvokedFunction(statement), statement.isReplace()); return immediateFuture(null); }

Target:
public ListenableFuture<?> execute(CreateFunction statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Analyzer analyzer = new Analyzer(stateMachine.getSession(), metadata, sqlParser, accessControl, Optional.empty(), parameters, stateMachine.getWarningCollector()); Analysis analysis = analyzer.analyze(statement); if (analysis.getFunctionHandles().values().stream() .anyMatch(SqlFunctionHandle.class::isInstance)) { throw new PrestoException(NOT_SUPPORTED, "Invoking a dynamically registered function in SQL function body is not supported"); } metadata.getFunctionManager().createFunction(createSqlInvokedFunction(statement), statement.isReplace()); return immediateFuture(null); }
Source:
private void setItemEnabled(final Class<? extends ClientSessionCommand> type, final boolean enabled) { menuItems.get(type).setEnabled(enabled); }

Target:
public void setItemEnabled(final Class<? extends ClientSessionCommand> type, final boolean enabled) { menuItems.get(type).setEnabled(enabled); }
Source:
public String toString() { return "EvalExprNode (" + StringUtils.join(exprs.toArray(new Target[exprs.size()])) + ")"; }

Target:
public String toString() { return "EvalExprNode (" + StringUtils.join(exprs) + ")"; }
Source:
public static void toJSON(OutputWriter outputWriter, JobInstance jobInstance) { outputWriter.add("name", jobInstance.getName()); if (jobInstance.getState() != null) { outputWriter.add("state", jobInstance.getState().toString()); } if (jobInstance.getResult() != null) { outputWriter.add("result", jobInstance.getResult().toString()); } if (jobInstance.isNull()) { renderNullJobInstance(outputWriter); return; } if (jobInstance.getOriginalJobId() == null) { outputWriter.renderNull("original_job_id"); } else { outputWriter.add("original_job_id", jobInstance.getOriginalJobId()); } outputWriter.addIfNotNull("scheduled_date", jobInstance.getScheduledDate()) .add("rerun", jobInstance.isRerun()) .add("agent_uuid", jobInstance.getAgentUuid()) .add("pipeline_name", jobInstance.getPipelineName()) .add("pipeline_counter", jobInstance.getPipelineCounter()) .add("stage_name", jobInstance.getStageName()) .add("stage_counter", jobInstance.getStageCounter()) .addChildList("job_state_transitions", outputListWriter -> jobInstance.getTransitions().forEach(jobStateTransition -> outputListWriter.addChild(itemWriter -> JobStateTransitionRepresenter.toJSON(itemWriter, jobStateTransition)))); }

Target:
public static void toJSON(OutputWriter outputWriter, JobInstance jobInstance) { outputWriter.add("name", jobInstance.getName()); if (jobInstance.getState() != null) { outputWriter.add("state", jobInstance.getState().toString()); } if (jobInstance.getResult() != null) { outputWriter.add("result", jobInstance.getResult().toString()); } if (jobInstance.getOriginalJobId() == null) { outputWriter.renderNull("original_job_id"); } else { outputWriter.add("original_job_id", jobInstance.getOriginalJobId()); } outputWriter.addIfNotNull("scheduled_date", jobInstance.getScheduledDate()) .add("rerun", jobInstance.isRerun()) .add("agent_uuid", jobInstance.getAgentUuid()) .add("pipeline_name", jobInstance.getPipelineName()) .add("pipeline_counter", jobInstance.getPipelineCounter()) .add("stage_name", jobInstance.getStageName()) .add("stage_counter", jobInstance.getStageCounter()) .addChildList("job_state_transitions", outputListWriter -> jobInstance.getTransitions().forEach(jobStateTransition -> outputListWriter.addChild(itemWriter -> JobStateTransitionRepresenter.toJSON(itemWriter, jobStateTransition)))); }
Source:
public void loadAttachmentFailureTest() throws ExecutionException, IOException { String[] expectedValues = {"1", "testResume/Test Resume.doc", "0"}; Result expectedResult = new Result(Result.Status.FAILURE, Result.Action.NOT_SET, -1, "Test"); task = new LoadAttachmentTask(Method.LOADATTACHMENTS, "Candidate", dataMap, csvFileWriter, propertyFileUtil, bullhornData, printUtil, actionTotals); List<Candidate> candidates = new ArrayList<>(); candidates.add(new Candidate(1)); ListWrapper<Candidate> listWrapper = new CandidateListWrapper(); listWrapper.setData(candidates); FileContent mockedFileContent = Mockito.mock(FileContent.class); FileMeta mockedFileMeta = Mockito.mock(FileMeta.class); StandardFileWrapper fileWrapper = new StandardFileWrapper(mockedFileContent, mockedFileMeta); when(bullhornData.search(anyObject(), anyString(), anySet(), anyObject())).thenReturn(listWrapper); when(bullhornData.addFile(anyObject(), anyInt(), any(File.class), anyString(), anyObject(), anyBoolean())).thenThrow(new RestApiException("Test")); task.run(); verify(csvFileWriter).writeAttachmentRow(eq(expectedValues), resultArgumentCaptor.capture()); Result actualResult = resultArgumentCaptor.getValue(); Assert.assertThat(expectedResult, new ReflectionEquals(actualResult)); }

Target:
public void loadAttachmentFailureTest() throws ExecutionException, IOException { String[] expectedValues = {"1", "testResume/Test Resume.doc", "0"}; Result expectedResult = Result.Failure(new RestApiException("Test").toString()); task = new LoadAttachmentTask(Method.LOADATTACHMENTS, "Candidate", dataMap, csvFileWriter, propertyFileUtil, bullhornData, printUtil, actionTotals); List<Candidate> candidates = new ArrayList<>(); candidates.add(new Candidate(1)); ListWrapper<Candidate> listWrapper = new CandidateListWrapper(); listWrapper.setData(candidates); FileContent mockedFileContent = Mockito.mock(FileContent.class); FileMeta mockedFileMeta = Mockito.mock(FileMeta.class); StandardFileWrapper fileWrapper = new StandardFileWrapper(mockedFileContent, mockedFileMeta); when(bullhornData.search(anyObject(), anyString(), anySet(), anyObject())).thenReturn(listWrapper); when(bullhornData.addFile(anyObject(), anyInt(), any(File.class), anyString(), anyObject(), anyBoolean())).thenThrow(new RestApiException("Test")); task.run(); verify(csvFileWriter).writeRow(eq(expectedValues), resultArgumentCaptor.capture()); Result actualResult = resultArgumentCaptor.getValue(); Assert.assertThat(expectedResult, new ReflectionEquals(actualResult)); }
Source:
public DocumentModel publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override) { RenditionService rs = Framework.getService(RenditionService.class); Rendition rendition = StringUtils.isEmpty(renditionName) ? rs.getDefaultRendition(doc, "publish", true, null) : rs.getRendition(doc, renditionName, true); if (rendition == null) { throw new NuxeoException("Unable to render the document"); } DocumentModel renditionDocument = rendition.getHostDocument(); DocumentModel publishedDocument = doc.getCoreSession().publishDocument(renditionDocument, target, override); if (override) { RenditionsRemover remover = new RenditionsRemover(publishedDocument); remover.runUnrestricted(); } return publishedDocument; }

Target:
public DocumentModel publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override) { Rendition rendition = StringUtils.isEmpty(renditionName) ? getDefaultRendition(doc, Constants.DEFAULT_RENDTION_PUBLISH_REASON, true, null) : getRendition(doc, renditionName, true); if (rendition == null) { throw new NuxeoException("Unable to render the document"); } DocumentModel renditionDocument = rendition.getHostDocument(); DocumentModel publishedDocument = doc.getCoreSession().publishDocument(renditionDocument, target, override); if (override) { RenditionsRemover remover = new RenditionsRemover(publishedDocument); remover.runUnrestricted(); } return publishedDocument; }
Source:
private LwM2mNode decodeCoapResponse(LwM2mPath path, Response coapResponse, LwM2mRequest<?> request, String endpoint) { ContentFormat contentFormat = null; if (coapResponse.getOptions().hasContentFormat()) { contentFormat = ContentFormat.fromCode(coapResponse.getOptions().getContentFormat()); } else { throw new InvalidResponseException( String.format("ContentFormat is mandatory for request [%s] from client [%s]", request, endpoint)); } try { return decoder.decode(coapResponse.getPayload(), contentFormat, path, model); } catch (final CodecException e) { byte[] payload = coapResponse.getPayload() == null ? new byte[0] : coapResponse.getPayload(); throw new InvalidResponseException( String.format("Unable do decode response payload [%s] of request [%s] from client [%s]", Hex.encodeHexString(payload), request, endpoint), e); } }

Target:
private LwM2mNode decodeCoapResponse(LwM2mPath path, Response coapResponse, LwM2mRequest<?> request, String endpoint) { ContentFormat contentFormat = null; if (coapResponse.getOptions().hasContentFormat()) { contentFormat = ContentFormat.fromCode(coapResponse.getOptions().getContentFormat()); } try { return decoder.decode(coapResponse.getPayload(), contentFormat, path, model); } catch (final CodecException e) { if (LOG.isDebugEnabled()) { byte[] payload = coapResponse.getPayload() == null ? new byte[0] : coapResponse.getPayload(); LOG.debug( String.format("Unable do decode response payload of request [%s] from client [%s] [payload:%s]", request, endpoint, Hex.encodeHexString(payload))); } throw new InvalidResponseException(String.format( "Unable do decode response payload of request [%s] from client [%s]", request, endpoint), e); } }
Source:
private static Properties readProperties(URL url) { log.debug("Testcontainers configuration overrides will be loaded from {}", url); Properties properties = new Properties(); try (InputStream inputStream = url.openStream()) { properties.load(inputStream); } catch (FileNotFoundException e) { log.warn("Testcontainers config override was found on but the file was not found", url, e); } catch (IOException e) { log.warn("Testcontainers config override was found on but could not be loaded", url, e); } return properties; }

Target:
private static Properties readProperties(URL url) { log.debug("Testcontainers configuration overrides will be loaded from {}", url); Properties properties = new Properties(); try (InputStream inputStream = url.openStream()) { properties.load(inputStream); } catch (FileNotFoundException e) { log.warn("Testcontainers config override was found on but the file was not found. Exception message: {}", url, ExceptionUtils.getRootCauseMessage(e)); } catch (IOException e) { log.warn("Testcontainers config override was found on but could not be loaded. Exception message: {}", url, ExceptionUtils.getRootCauseMessage(e)); } return properties; }
Source:
private WatermarkTracker( BlockingQueue<E> queue, long lowerWatermark, long upperWatermark, Runnable onLowerWatermarkCrossed, Runnable onUpperWatermarkCrossed) { assert lowerWatermark >= 0 && lowerWatermark < upperWatermark; this.queue = queue; this.lowerWatermark = lowerWatermark; this.upperWatermark = upperWatermark; this.classifier = x -> null; this.onLowerWatermarkCrossed = x -> onLowerWatermarkCrossed.run(); this.onUpperWatermarkCrossed = x -> onUpperWatermarkCrossed.run(); final StreamTracker streamTracker = new StreamTracker(null); this.trackerSupplier = key -> streamTracker; }

Target:
private WatermarkTracker( BlockingQueue<E> queue, long lowerWatermark, long upperWatermark, Runnable onLowerWatermarkCrossed, Runnable onUpperWatermarkCrossed) { this.queue = queue; this.lowerWatermark = lowerWatermark; this.upperWatermark = upperWatermark; this.classifier = x -> null; this.onLowerWatermarkCrossed = x -> onLowerWatermarkCrossed.run(); this.onUpperWatermarkCrossed = x -> onUpperWatermarkCrossed.run(); final StreamTracker streamTracker = new StreamTracker(null); this.trackerSupplier = key -> streamTracker; }
Source:
private void extractHiddenItems(Map<String, String> infraParams, Map<String, String> infraFileParams, String formFieldValue) { for (String row : formFieldValue.split(ROW_SEPARATOR)) { String[] fields = row.split(FIELD_SEPARATOR); boolean isFile = fields[0].equals(FILE); String name = fields[1]; String value = fields.length > 2 ? fields[2] : ""; if (isFile) { infraFileParams.put(name, value); } else { infraParams.put(name, value); } } }

Target:
private void extractHiddenItems(Map<String, String> infraParams, Map<String, String> infraFileParams, String formFieldValue) { for (String row : formFieldValue.split(ROW_SEPARATOR)) { String[] fields = row.split(FIELD_SEPARATOR); if (fields.length != 2 && fields.length != 3) { LOGGER.warn("Failed extract hidden value from: " + row); continue; } boolean isFile = fields[0].equals(FILE); String name = fields[1]; String value = fields.length > 2 ? fields[2] : ""; if (isFile) { infraFileParams.put(name, value); } else { infraParams.put(name, value); } } }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; SymbolMetadata classMetadata = classTree.symbol().metadata(); Optional<AnnotationTree> sessionAttributesAnnotation = classTree.modifiers().annotations() .stream() .filter(a -> a.annotationType().symbolType().fullyQualifiedName().equals("org.springframework.web.bind.annotation.SessionAttributes")) .findFirst(); if (classMetadata.isAnnotatedWith("org.springframework.stereotype.Controller") && sessionAttributesAnnotation.isPresent() && classTree.members().stream().noneMatch(ControllerWithSessionAttributesCheck::methodCompletesSessionStatus)) { reportIssue(sessionAttributesAnnotation.get().annotationType(), "Add a call to \"setComplete()\" on the SessionStatus object in a \"@RequestMapping\" method that handles \"POST\"."); } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; SymbolMetadata classMetadata = classTree.symbol().metadata(); Optional<AnnotationTree> sessionAttributesAnnotation = classTree.modifiers().annotations() .stream() .filter(a -> a.annotationType().symbolType().is("org.springframework.web.bind.annotation.SessionAttributes")) .findFirst(); if (sessionAttributesAnnotation.isPresent() && classMetadata.isAnnotatedWith("org.springframework.stereotype.Controller")) { MethodInvocationVisitor methodInvocationVisitor = new MethodInvocationVisitor(); classTree.accept(methodInvocationVisitor); if (!methodInvocationVisitor.setCompleteIsCalled) { reportIssue(sessionAttributesAnnotation.get().annotationType(), "Add a call to \"setComplete()\" on the SessionStatus object in a \"@RequestMapping\" method."); } } }
Source:
private void readFromParcel(Parcel source) { source.readTypedList(users, User.CREATOR); startTime = source.readLong(); endTime = source.readLong(); source.readTypedList(orders, null); sessToken = source.readInt(); tableID = source.readInt(); }

Target:
private void readFromParcel(Parcel source) { source.readTypedList(users, UserInfo.CREATOR); startTime = source.readLong(); endTime = source.readLong(); source.readTypedList(orders, Order.CREATOR); sessToken = source.readInt(); tableID = source.readInt(); }
Source:
public static void e(String tag, String message) { SalesforceLogger.getLogger(COMPONENT_NAME, SalesforceSDKManager.getInstance().getAppContext()).e( tag, message); }

Target:
public static void e(String tag, String message) { getLogger().e(tag, message); }
Source:
public long countTriggers() { try (Connection conn = DBConnectionManager.getInstance().getConnection(sqlProperties.getProperty(DATA_SOURCE)); Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery(buildCountTriggersQuery()); if (rs.next()) { return rs.getInt(1); } return 0; } catch (Exception e) { throw new TriggerRetrievalException("Couldn't count triggers for Scheduler channel", e); } }

Target:
public long countTriggers() { try { return motechSchedulerDatabaseService.countTriggers(); } catch (SQLException e) { throw new TriggerRetrievalException("Couldn't count triggers for Scheduler channel", e); } }
Source:
private boolean isUsingSPDMFlow() { return isDataOperationsByHSM() && (getParameters().getParentCommand() == ActionType.MoveOrCopyDisk || (getParameters().getParentCommand() == ActionType.CloneVm || getParameters().getParentCommand() == ActionType.CloneVmNoCollapse)); }

Target:
private boolean isUsingSPDMFlow() { return isDataOperationsByHSM() && (getParameters().getParentCommand() == ActionType.MoveOrCopyDisk || getParameters().getParentCommand() == ActionType.CloneVm || getParameters().getParentCommand() == ActionType.CloneVmNoCollapse); }
Source:
synchronized void doSynchronizationWithPrimary(InternalDistributedMember primary, InternalCache cache) { if (hasSynchronizedWithPrimary.get()) { return; } synchronizeWithPrimaryInProgress.set(true); int maxChunkSize = 1000; try { List<EventID> giiEvents = getGIIEvents(); if (giiEvents.size() == 0) { hasSynchronizedWithPrimary.set(true); return; } Collection<List<EventID>> chunks = null; if (giiEvents.size() > maxChunkSize) { chunks = getChunks(giiEvents, maxChunkSize); } if (chunks == null) { if (!removeDispatchedEvents(primary, cache, giiEvents)) { return; } } else { for (List<EventID> chunk : chunks) { if (!removeDispatchedEvents(primary, cache, chunk)) { return; } } } if (logger.isDebugEnabled()) { logger.debug("hasSynchronizedWithPrimary has synced with primary on queue: ", primary, regionName); } hasSynchronizedWithPrimary.set(true); } finally { synchronizeWithPrimaryInProgress.set(false); } }

Target:
synchronized void doSynchronizationWithPrimary(InternalDistributedMember primary, InternalCache cache) { int maxChunkSize = 1000; try { List<EventID> giiEvents = getGIIEvents(); if (giiEvents.size() == 0) { hasSynchronizedWithPrimary.set(true); return; } Collection<List<EventID>> chunks = null; if (giiEvents.size() > maxChunkSize) { chunks = getChunks(giiEvents, maxChunkSize); } if (chunks == null) { if (!removeDispatchedEvents(primary, cache, giiEvents)) { return; } } else { for (List<EventID> chunk : chunks) { if (!removeDispatchedEvents(primary, cache, chunk)) { return; } } } if (logger.isDebugEnabled()) { logger.debug("HARegionQueue has synced with primary on {}", regionName, primary); } hasSynchronizedWithPrimary.set(true); } finally { scheduleSynchronizationWithPrimaryInProgress.set(false); } }
Source:
private void updateDiskImage(DiskImage diskImage) { VdcReturnValueBase returnValue = Backend.getInstance().runInternalAction( VdcActionType.UpdateVolume, buildUpdateVolumeCommandParameters(diskImage), ExecutionHandler.createDefaultContextForTasks(getContext())); if (!returnValue.getSucceeded()) { throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage()); } }

Target:
private void updateDiskImage(DiskImage diskImage) { VdcReturnValueBase returnValue = runInternalActionWithTasksContext( VdcActionType.UpdateVolume, buildUpdateVolumeCommandParameters(diskImage)); if (!returnValue.getSucceeded()) { throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage()); } }
Source:
private void discardRequests() { logger.trace("Discarding requests on account of shutdown"); RestServiceException e = new RestServiceException("Service shutdown", RestServiceErrorCode.ServiceUnavailable); if (requests.size() > 0) { logger.info("There were requests in flight during shutdown", requests.size()); restServerMetrics.residualRequestQueueSize.inc(requests.size()); AsyncRequestInfo residualRequestInfo = requests.poll(); while (residualRequestInfo != null && residualRequestInfo.restRequest != null) { onRequestDequeue(residualRequestInfo); onProcessingFailure(residualRequestInfo.restRequest, residualRequestInfo.restResponseChannel, e); residualRequestInfo = requests.poll(); } } }

Target:
private void discardRequests() { logger.trace("Discarding requests on account of shutdown"); RestServiceException e = new RestServiceException("Service shutdown", RestServiceErrorCode.ServiceUnavailable); AsyncRequestInfo residualRequestInfo = requests.poll(); int discardCount = 0; while (residualRequestInfo != null) { if (residualRequestInfo.restRequest != null) { discardCount++; onRequestDequeue(residualRequestInfo); onProcessingFailure(residualRequestInfo.restRequest, residualRequestInfo.restResponseChannel, e); } residualRequestInfo = requests.poll(); } if(discardCount > 0) { restServerMetrics.residualRequestQueueSize.inc(discardCount); logger.info("There were requests in flight during shutdown", discardCount); } }
Source:
List<IRemoteTest> createIndividualTests(Set<TestInfo> testInfos, String configPath) { List<IRemoteTest> tests = new ArrayList<>(); testInfos = dedupTestInfos(testInfos); for (TestInfo testInfo : testInfos) { super.cleanUpSuiteSetup(); super.cleanModuleArgs(); super.cleanConfigPaths(); super.setConfigPaths(new File(configPath)); parseOptions(testInfo); LinkedHashMap<String, IConfiguration> config = super.loadTests(); for (Map.Entry<String, IConfiguration> entry : config.entrySet()) { tests.addAll(entry.getValue().getTests()); } } return tests; }

Target:
List<IRemoteTest> createIndividualTests(Set<TestInfo> testInfos, String configPath) { List<IRemoteTest> tests = new ArrayList<>(); if (configPath == null) { return tests; } File configFie = new File(configPath); if (!configFie.exists()) { return tests; } testInfos = dedupTestInfos(testInfos); for (TestInfo testInfo : testInfos) { super.cleanUpSuiteSetup(); super.clearModuleArgs(); super.clearConfigPaths(); super.addConfigPaths(configFie); parseOptions(testInfo); LinkedHashMap<String, IConfiguration> config = super.loadTests(); for (Map.Entry<String, IConfiguration> entry : config.entrySet()) { tests.addAll(entry.getValue().getTests()); } } return tests; }
Source:
public static void tearDown() throws InterruptedException, CommandFailedException, TimeoutException, IOException, OperationException { operations.removeIfExists(AJP_LISTENER_ADDRESS); operations.removeIfExists(AJP_LISTENER_ADDRESS_TBA); operations.removeIfExists(AJP_LISTENER_ADDRESS_TBR); operations.removeIfExists(HTTP_SERVER_ADDRESS); undertowOps.removeSocketBinding(REDIRECT_SOCKET_VALUE); undertowOps.removeSocketBinding(SOCKET_BINDING_AJP); undertowOps.removeSocketBinding(SOCKET_BINDING_AJP_TBA); undertowOps.removeSocketBinding(SOCKET_BINDING_AJP_TBR); administration.reloadIfRequired(); administration.restartIfRequired(); }

Target:
public static void tearDown() throws InterruptedException, CommandFailedException, TimeoutException, IOException, OperationException { operations.removeIfExists(AJP_LISTENER_ADDRESS); operations.removeIfExists(AJP_LISTENER_ADDRESS_TBA); operations.removeIfExists(AJP_LISTENER_ADDRESS_TBR); operations.removeIfExists(HTTP_SERVER_ADDRESS); administration.restartIfRequired(); administration.reloadIfRequired(); }
Source:
public void showSurvey(View view) { Wootric.with(this) .user(CLIENT_ID, CLIENT_SECRET, ACCOUNT_TOKEN) .endUser("junkuits@gmail.com", "ORIGIN URL") .forceSurvey() .survey(); }

Target:
public void showSurvey(View view) { Wootric.with(this) .user(CLIENT_ID, CLIENT_SECRET, ACCOUNT_TOKEN) .endUser("END USER EMAIL", "ORIGIN URL") .forceSurvey() .survey(); }
Source:
private void validateThereIsMatchingRuntime(List<ImageInfoV4Response> upgradeCandidates, List<ImageInfoV4Response> imagesWithMatchingRuntime, String runtime) { boolean hasNoCompatbileImageWithRuntime = imagesWithMatchingRuntime.isEmpty(); if (hasNoCompatbileImageWithRuntime) { String availableRuntimes = collectAvailableRuntimes(upgradeCandidates); if (StringUtils.isEmpty(availableRuntimes)) { throw new BadRequestException(String.format("There is no image eligible for the cluster upgrade with runtime: %s.", runtime)); } else { throw new BadRequestException(String.format("There is no image eligible for the cluster upgrade with runtime: %s. " + "Please choose a runtime from the following: %s", runtime, availableRuntimes)); } } }

Target:
private void validateThereIsMatchingRuntime(List<ImageInfoV4Response> upgradeCandidates, List<ImageInfoV4Response> imagesWithMatchingRuntime, String runtime) { if (imagesWithMatchingRuntime.isEmpty()) { String availableRuntimes = collectAvailableRuntimes(upgradeCandidates); if (StringUtils.isEmpty(availableRuntimes)) { throw new BadRequestException(String.format("There is no image eligible for the cluster upgrade with runtime: %s.", runtime)); } else { throw new BadRequestException(String.format("There is no image eligible for the cluster upgrade with runtime: %s. " + "Please choose a runtime from the following: %s", runtime, availableRuntimes)); } } }