auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public GroupRebalanceConfig(AbstractConfig config, ProtocolType protocolType) { this.sessionTimeoutMs = config.getInt(CommonClientConfigs.SESSION_TIMEOUT_MS_CONFIG); if (protocolType == ProtocolType.Consumer) { this.rebalanceTimeoutMs = config.getInt(CommonClientConfigs.MAX_POLL_INTERVAL_MS_CONFIG); } else { this.rebalanceTimeoutMs = config.getInt(CommonClientConfigs.REBALANCE_TIMEOUT_MS_CONFIG); } this.heartbeatIntervalMs = config.getInt(CommonClientConfigs.HEARTBEAT_INTERVAL_MS_CONFIG); this.groupId = config.getString(CommonClientConfigs.GROUP_ID_CONFIG); if (protocolType == ProtocolType.Consumer) { String groupInstanceId = config.getString(CommonClientConfigs.GROUP_INSTANCE_ID_CONFIG); if (groupInstanceId != null) { JoinGroupRequest.validateGroupInstanceId(groupInstanceId); this.groupInstanceId = Optional.of(groupInstanceId); } else { this.groupInstanceId = Optional.empty(); } } else { this.groupInstanceId = Optional.empty(); } this.retryBackoffMs = config.getLong(CommonClientConfigs.RETRY_BACKOFF_MS_CONFIG); if (protocolType == ProtocolType.Consumer) { this.leaveGroupOnClose = config.getBoolean("internal.leave.group.on.close"); } else { this.leaveGroupOnClose = true; } }

Target:
public GroupRebalanceConfig(AbstractConfig config, ProtocolType protocolType) { this.sessionTimeoutMs = config.getInt(CommonClientConfigs.SESSION_TIMEOUT_MS_CONFIG); if (protocolType == ProtocolType.CONSUMER) { this.rebalanceTimeoutMs = config.getInt(CommonClientConfigs.MAX_POLL_INTERVAL_MS_CONFIG); } else { this.rebalanceTimeoutMs = config.getInt(CommonClientConfigs.REBALANCE_TIMEOUT_MS_CONFIG); } this.heartbeatIntervalMs = config.getInt(CommonClientConfigs.HEARTBEAT_INTERVAL_MS_CONFIG); this.groupId = config.getString(CommonClientConfigs.GROUP_ID_CONFIG); if (protocolType == ProtocolType.CONSUMER) { String groupInstanceId = config.getString(CommonClientConfigs.GROUP_INSTANCE_ID_CONFIG); if (groupInstanceId != null) { JoinGroupRequest.validateGroupInstanceId(groupInstanceId); this.groupInstanceId = Optional.of(groupInstanceId); } else { this.groupInstanceId = Optional.empty(); } } else { this.groupInstanceId = Optional.empty(); } this.retryBackoffMs = config.getLong(CommonClientConfigs.RETRY_BACKOFF_MS_CONFIG); if (protocolType == ProtocolType.CONSUMER) { this.leaveGroupOnClose = config.getBoolean("internal.leave.group.on.close"); } else { this.leaveGroupOnClose = true; } }
Source:
public static boolean isInstanceSetup(RealmAwareZkClient zkclient, String clusterName, String instanceName, InstanceType type) { if (type == InstanceType.PARTICIPANT || type == InstanceType.CONTROLLER_PARTICIPANT) { List<String> requiredPaths = new ArrayList<>(); requiredPaths.add(PropertyPathBuilder.instanceConfig(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceMessage(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceCurrentState(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceTaskCurrentState(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceStatusUpdate(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceError(clusterName, instanceName)); boolean isValid = true; for (String path : requiredPaths) { if (!zkclient.exists(path)) { isValid = false; logger.info("Invalid instance setup, missing znode path: {}", path); } } if (isValid) { String historyPath = PropertyPathBuilder.instanceHistory(clusterName, instanceName); if (!zkclient.exists(historyPath)) { zkclient.createPersistent(historyPath, true); } } return isValid; } return true; }

Target:
public static boolean isInstanceSetup(RealmAwareZkClient zkclient, String clusterName, String instanceName, InstanceType type) { if (type == InstanceType.PARTICIPANT || type == InstanceType.CONTROLLER_PARTICIPANT) { List<String> requiredPaths = new ArrayList<>(); requiredPaths.add(PropertyPathBuilder.instanceConfig(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceMessage(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceCurrentState(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceStatusUpdate(clusterName, instanceName)); requiredPaths.add(PropertyPathBuilder.instanceError(clusterName, instanceName)); boolean isValid = true; for (String path : requiredPaths) { if (!zkclient.exists(path)) { isValid = false; logger.info("Invalid instance setup, missing znode path: {}", path); } } if (isValid) { String historyPath = PropertyPathBuilder.instanceHistory(clusterName, instanceName); if (!zkclient.exists(historyPath)) { zkclient.createPersistent(historyPath, true); } } return isValid; } return true; }
Source:
public void close() { clientPool.shutdown(); try { log.info("Trying to close a CQL client"); cqlClient.close(); } catch (Exception e) { log.info("Closing of CQL client failed"); } super.close(); }

Target:
public void close() { clientPool.shutdown(); try { log.info("Trying to close a CQL client"); cqlClient.close(); } catch (Exception e) { log.info("Closing of CQL client failed", e); } super.close(); }
Source:
public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.IMPORT: final String importClassPath = FullIdent.createFullIdentBelow(token).getText(); final String className = importClassPath.substring(importClassPath.lastIndexOf(".") + 1); simpleClassNameToQualifiedNameMap.put(className, importClassPath); break; case TokenTypes.CLASS_DEF: final DetailAST modifiersToken = token.findFirstToken(TokenTypes.MODIFIERS); isPublicClass = modifiersToken.branchContains(TokenTypes.LITERAL_PUBLIC); break; case TokenTypes.METHOD_DEF: if (!isPublicClass) { return; } checkNoExternalDependencyExposed(token); break; default: break; } }

Target:
public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.IMPORT: final String importClassPath = FullIdent.createFullIdentBelow(token).getText(); final String className = importClassPath.substring(importClassPath.lastIndexOf(".") + 1); simpleClassNameToQualifiedNameMap.put(className, importClassPath); break; case TokenTypes.CLASS_DEF: final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken( token.findFirstToken(TokenTypes.MODIFIERS)); isPublicClass = accessModifier.equals(AccessModifier.PUBLIC); break; case TokenTypes.METHOD_DEF: if (!isPublicClass) { return; } checkNoExternalDependencyExposed(token); break; default: break; } }
Source:
public String allocate(Network network, VmNetworkInterface nic) { deallocate(nic); try { org.openstack.quantum.model.Network quantumNetwork = getQuantumClient().execute(new ShowNetwork(network.getProvidedBy().getExternalId())); PortForCreate port = new PortForCreate(); port.setAdminStateUp(true); port.setName(nic.getName()); port.setTenantId(quantumNetwork.getTenantId()); port.setMacAddress(nic.getMacAddress()); port.setNetworkId(quantumNetwork.getId()); port.setDeviceOwner(DEVICE_OWNER); port.setDeviceId(nic.getId().toString()); Port createdPort = getQuantumClient().execute(new CreatePort(port)); return createdPort.getId(); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, new RuntimeException(e)); } }

Target:
public String allocate(Network network, VmNetworkInterface nic) { deallocate(nic); try { org.openstack.quantum.model.Network quantumNetwork = getQuantumClient().networks().show(network.getProvidedBy().getExternalId()).execute(); PortForCreate port = new PortForCreate(); port.setAdminStateUp(true); port.setName(nic.getName()); port.setTenantId(quantumNetwork.getTenantId()); port.setMacAddress(nic.getMacAddress()); port.setNetworkId(quantumNetwork.getId()); port.setDeviceOwner(DEVICE_OWNER); port.setDeviceId(nic.getId().toString()); Port createdPort = getQuantumClient().ports().create(port).execute(); return createdPort.getId(); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, new RuntimeException(e)); } }
Source:
public void testListAllLibrarySelectionTypes() throws Exception { List<LibrarySelectionType> librarySelectionTypes = dao.listAllLibrarySelectionTypes(); assertTrue(librarySelectionTypes.size() > 0); }

Target:
public void testListAllLibrarySelectionTypes() throws Exception { List<LibrarySelectionType> librarySelectionTypes = dao.listAllLibrarySelectionTypes(); assertEquals(2, librarySelectionTypes.size()); }
Source:
public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final JurisDetail jurisDetail = (JurisDetail) o; if (description != null ? !description.equals(jurisDetail.description) : jurisDetail.description != null) { return false; } if (jurisdiction != null ? !jurisdiction.equals(jurisDetail.jurisdiction) : jurisDetail.jurisdiction != null) { return false; } if (jurisdictionName != null ? !jurisdictionName.equals(jurisDetail.jurisdictionName) : jurisDetail.jurisdictionName != null) { return false; } if (taxInCents != null ? !taxInCents.equals(jurisDetail.taxInCents) : jurisDetail.taxInCents != null) { return false; } if (rate != null ? !rate.equals(jurisDetail.rate) : jurisDetail.rate != null) { return false; } if (subType != null ? !subType.equals(jurisDetail.subType) : jurisDetail.subType != null) { return false; } return true; }

Target:
public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final JurisDetail jurisDetail = (JurisDetail) o; if (description != null ? !description.equals(jurisDetail.description) : jurisDetail.description != null) { return false; } if (jurisdiction != null ? !jurisdiction.equals(jurisDetail.jurisdiction) : jurisDetail.jurisdiction != null) { return false; } if (jurisdictionName != null ? !jurisdictionName.equals(jurisDetail.jurisdictionName) : jurisDetail.jurisdictionName != null) { return false; } if (taxInCents != null ? !taxInCents.equals(jurisDetail.taxInCents) : jurisDetail.taxInCents != null) { return false; } if (rate != null ? rate.compareTo(jurisDetail.rate) != 0 : jurisDetail.rate != null) { return false; } if (subType != null ? !subType.equals(jurisDetail.subType) : jurisDetail.subType != null) { return false; } return true; }
Source:
public ReadOnlyGraph<URI> getResourcesGraph() { return (ReadOnlyGraph<URI>)EMFCompareRCPPlugin.getDefault().getGraphView( "org.eclipse.emf.compare"); }

Target:
public ReadOnlyGraph<URI> getResourcesGraph() { return (ReadOnlyGraph<URI>)EMFCompareRCPPlugin.getDefault().getGraphView( ResourceUIUtil.RESOURCES_GRAPH_ID); }
Source:
private Collection<String> getRootAndContextScopes(Map<String, ?> map) { List<String> extractedScopes = new ArrayList<>(Collections.emptyList()); try { if (map.containsKey(CONTEXT)) { val context = (Map<String, Object>) map.get("context"); extractedScopes.addAll((Collection<String>) context.get("scope")); } if (map.containsKey(SCOPE)) { extractedScopes.addAll((Collection<String>) map.get(SCOPE)); } } catch (Exception e) { log.error("Failed to extract scopes from JWT"); } return extractedScopes; }

Target:
private Collection<String> getRootAndContextScopes(Map<String, ?> map) { List<String> extractedScopes = new ArrayList<>(Collections.emptyList()); try { if (map.containsKey(CONTEXT)) { val context = (Map<String, Object>) map.get(CONTEXT); extractedScopes.addAll((Collection<String>) context.get(SCOPE)); } if (map.containsKey(SCOPE)) { extractedScopes.addAll((Collection<String>) map.get(SCOPE)); } } catch (Exception e) { log.error("Failed to extract scopes from JWT"); } return extractedScopes; }
Source:
private void setArgument(PreparedStatement pstmt, String argument, int targetSqlType, int index) throws SQLException { switch (targetSqlType) { case Types.INTEGER: pstmt.setInt(index, Integer.parseInt(argument)); break; case Types.DOUBLE: case Types.DECIMAL: pstmt.setDouble(index, Double.parseDouble(argument)); break; case Types.VARCHAR: pstmt.setString(index, argument); break; case Types.BOOLEAN: pstmt.setBoolean(index, Boolean.parseBoolean(argument)); break; case Types.BIGINT: pstmt.setLong(index, Long.parseLong(argument)); break; case Types.DATE: pstmt.setDate(index, Date.valueOf(argument)); break; case Types.FLOAT: pstmt.setFloat(index, Float.parseFloat(argument)); break; case Types.TIMESTAMP: pstmt.setTimestamp(index, Timestamp.valueOf(argument)); break; case Types.TIME: pstmt.setTime(index, Time.valueOf(argument)); break; case Types.NULL: pstmt.setNull(index, targetSqlType); break; default: pstmt.setObject(index, argument, targetSqlType); } }

Target:
private void setArgument(PreparedStatement pstmt, String argument, int targetSqlType, int index) throws SQLException { switch (targetSqlType) { case Types.INTEGER: pstmt.setInt(index, Integer.parseInt(argument)); break; case Types.DECIMAL: case Types.NUMERIC: pstmt.setBigDecimal(index, new BigDecimal(argument)); break; case Types.DOUBLE: case Types.FLOAT: pstmt.setDouble(index, Double.parseDouble(argument)); break; case Types.CHAR: case Types.LONGVARCHAR: case Types.VARCHAR: pstmt.setString(index, argument); break; case Types.BIT: case Types.BOOLEAN: pstmt.setBoolean(index, Boolean.parseBoolean(argument)); break; case Types.BIGINT: pstmt.setLong(index, Long.parseLong(argument)); break; case Types.DATE: pstmt.setDate(index, Date.valueOf(argument)); break; case Types.REAL: pstmt.setFloat(index, Float.parseFloat(argument)); break; case Types.TINYINT: pstmt.setByte(index, Byte.parseByte(argument)); break; case Types.SMALLINT: pstmt.setShort(index, Short.parseShort(argument)); break; case Types.TIMESTAMP: pstmt.setTimestamp(index, Timestamp.valueOf(argument)); break; case Types.TIME: pstmt.setTime(index, Time.valueOf(argument)); break; case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: pstmt.setBytes(index, argument.getBytes()); break; case Types.NULL: pstmt.setNull(index, targetSqlType); break; default: pstmt.setObject(index, argument, targetSqlType); } }
Source:
public boolean isSystemUser(@NonNull final UserId userId) { return Services.get(IQueryBL.class) .createQueryBuilder(I_AD_User.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_AD_User.COLUMNNAME_AD_User_ID, userId) .create() .listDistinct(I_AD_User.COLUMNNAME_IsSystemUser, Boolean.class) .stream() .findFirst() .orElse(false); }

Target:
public boolean isSystemUser(@NonNull final UserId userId) { return Services.get(IQueryBL.class) .createQueryBuilder(I_AD_User.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_AD_User.COLUMNNAME_AD_User_ID, userId) .addEqualsFilter(I_AD_User.COLUMNNAME_IsSystemUser, true) .create() .anyMatch(); }
Source:
protected boolean isSessionInvalid(HiveSQLException exc, SessionHandle sessionHandle) { if (exc.getMessage().contains("Invalid SessionHandle") && exc.getMessage().contains(sessionHandle.toString())) { return true; } if (exc.getCause() != null && exc.getCause() instanceof HiveSQLException) { isSessionInvalid((HiveSQLException) exc.getCause(), sessionHandle); } return false; }

Target:
protected boolean isSessionInvalid(HiveSQLException exc, SessionHandle sessionHandle) { if (exc.getMessage().contains("Invalid SessionHandle") && exc.getMessage().contains(sessionHandle.toString())) { return true; } if (exc.getCause() instanceof HiveSQLException) { isSessionInvalid((HiveSQLException) exc.getCause(), sessionHandle); } return false; }
Source:
private byte[] signData(byte[] data) throws Exception { Signature signer = Signature.getInstance(SIGNATURE_ALGORITHM_NAME); signer.initSign(privateKey); signer.update(data); return signer.sign(); }

Target:
private byte[] signData(byte[] data) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException { Signature signer = Signature.getInstance(SIGNATURE_ALGORITHM_NAME); signer.initSign(privateKey); signer.update(data); return signer.sign(); }
Source:
private IgniteEx startGridWithCache(CacheConfiguration<Integer, Integer> ccfg, int range) throws Exception { defaultCacheCfg = ccfg; IgniteEx ig = startGrid(0); ig.cluster().baselineAutoAdjustEnabled(false); ig.cluster().active(true); for (int i = 0; i < range; i++) ig.cache(DEFAULT_CACHE_NAME).put(i, i); CheckpointProgress cpFut = ig.context() .cache() .context() .database() .forceCheckpoint("the next one"); cpFut.futureFor(CheckpointState.FINISHED).get(); return ig; }

Target:
private IgniteEx startGridWithCache(CacheConfiguration<Integer, Integer> ccfg, int range) throws Exception { dfltCacheCfg = ccfg; IgniteEx ig = startGrid(0); ig.cluster().baselineAutoAdjustEnabled(false); ig.cluster().state(ClusterState.ACTIVE); for (int i = 0; i < range; i++) ig.cache(DEFAULT_CACHE_NAME).put(i, i); forceCheckpoint(ig); return ig; }
Source:
public Set<Change.Id> getStarredChanges() { return null; }

Target:
public Set<Change.Id> getStarredChanges() { return Collections.emptySet(); }
Source:
public boolean perform(final Build<?,?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { final Timer timer = new Timer("Timer-" + build.getDisplayName().replace(" ", "_"), true); final AtomicBoolean stopped = new AtomicBoolean(false); try { final long delay = getTimeout(build, listener); timer.schedule(new TimerTask() { @Override public void run() { if (operationList.isEmpty()) { new AbortOperation().perform(build, listener, delay); } for (BuildTimeOutOperation op : operationList) { op.perform(build, listener, delay); } stopped.set(true); timer.cancel(); } }, delay); return buildStep.perform((AbstractBuild) build, launcher, listener); } catch(InterruptedException e) { if (!stopped.get()) { throw e; } } return false; }

Target:
public boolean perform(final Build<?,?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { final Timer timer = Trigger.timer; final long delay = getTimeout(build, listener); final TimerTask task = new SafeTimerTask() { @Override public void doRun() { if (operationList.isEmpty()) { new AbortOperation().perform(build, listener, delay); } for (BuildTimeOutOperation op : operationList) { op.perform(build, listener, delay); } } }; try { timer.schedule(task, delay); return buildStep.perform(build, launcher, listener); } finally { task.cancel(); } }
Source:
public List<String> getSourceFolders(String projectPath) { if (!findInitializedLanguageServer().isPresent()) { throw new IllegalStateException("Language server isn't initialized"); } String projectUri = prefixURI(projectPath); Type type = new TypeToken<ArrayList<String>>() {}.getType(); return doGetList(GET_SOURCE_FOLDERS, projectUri, type); }

Target:
public List<String> getSourceFolders(String projectPath) { checkLanguageServerInitialized(); String projectUri = prefixURI(projectPath); Type type = new TypeToken<ArrayList<String>>() {}.getType(); return doGetList(GET_SOURCE_FOLDERS, projectUri, type); }
Source:
private static boolean isVisibleEventColumn(TableColumn column) { if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) { return false; } return (!column.getResizable() && column.getWidth() == 0); }

Target:
private static boolean isVisibleEventColumn(TableColumn column) { if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) { return false; } return !(!column.getResizable() && column.getWidth() == 0); }
Source:
private void populateFieldInfosFromPojo(ColumnDefinitions rsMetaData) { fieldInfos = Lists.newArrayList(); Field[] fields = pojoClass.getDeclaredFields(); for (int i = 0; i < rsMetaData.size(); i++) { String columnName = rsMetaData.getName(i); String pojoField = getMatchingField(fields, columnName); if (pojoField != null && pojoField.length() != 0) { fieldInfos.add(new FieldInfo(columnName, pojoField, null)); } else { LOG.error("Couldn't find corrosponding pojo field for column: " + columnName); } } }

Target:
private void populateFieldInfosFromPojo(ColumnDefinitions rsMetaData) { fieldInfos = Lists.newArrayList(); Field[] fields = pojoClass.getDeclaredFields(); for (int i = 0; i < rsMetaData.size(); i++) { String columnName = rsMetaData.getName(i); String pojoField = getMatchingField(fields, columnName); if (pojoField != null && pojoField.length() != 0) { fieldInfos.add(new FieldInfo(columnName, pojoField, null)); } else { LOG.warn("Couldn't find corrosponding pojo field for column: " + columnName); } } }
Source:
public void checkUser(User user) throws BadRequestException { if (user == null) { throw new BadRequestException("User required"); } if (isNullOrEmpty(user.getName())) { throw new BadRequestException("User name required"); } if (user.getName().length() > 39) { throw new BadRequestException("Username should contain less then 39 characters"); } if (!isValidName(user.getName())) { throw new BadRequestException("Username may only contain alphanumeric characters or single hyphens inside"); } if (isNullOrEmpty(user.getEmail())) { throw new BadRequestException("User email required"); } if (user.getPassword() != null) { checkPassword(user.getPassword()); } }

Target:
public void checkUser(User user) throws BadRequestException { if (user == null) { throw new BadRequestException("User required"); } if (isNullOrEmpty(user.getName())) { throw new BadRequestException("User name required"); } if (user.getName().length() > 39) { throw new BadRequestException("Username should contain less than 39 characters"); } if (!isValidName(user.getName())) { throw new BadRequestException("Username may only contain alphanumeric characters or single hyphens inside"); } if (isNullOrEmpty(user.getEmail())) { throw new BadRequestException("User email required"); } if (user.getPassword() != null) { checkPassword(user.getPassword()); } }
Source:
private void verifyIsUserOfCourse(String courseId, String commentGiver, FeedbackParticipantType commentGiverType, boolean isCommentFromFeedbackParticipant) throws EntityDoesNotExistException { if (isCommentFromFeedbackParticipant) { switch (commentGiverType) { case STUDENTS: StudentAttributes student = studentsLogic.getStudentForEmail(courseId, commentGiver); if (student == null) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered student for course " + courseId + "."); } break; case INSTRUCTORS: InstructorAttributes instructor = instructorsLogic.getInstructorForEmail(courseId, commentGiver); if (instructor == null) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered instructor for course " + courseId + "."); } break; case TEAMS: List<TeamDetailsBundle> teams = coursesLogic.getTeamsForCourse(courseId); boolean isTeamPresentInCourse = false; for (TeamDetailsBundle team : teams) { if (team.name.equals(commentGiver)) { isTeamPresentInCourse = true; break; } } if (!isTeamPresentInCourse) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered team for course " + courseId + "."); } break; default: throw new EntityDoesNotExistException("Unknown giver type: " + commentGiverType); } } else { InstructorAttributes instructor = instructorsLogic.getInstructorForEmail(courseId, commentGiver); if (instructor == null) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered instructor for course " + courseId + "."); } } }

Target:
private void verifyIsUserOfCourse(String courseId, String commentGiver, FeedbackParticipantType commentGiverType, boolean isCommentFromFeedbackParticipant) throws EntityDoesNotExistException { if (!isCommentFromFeedbackParticipant) { InstructorAttributes instructor = instructorsLogic.getInstructorForEmail(courseId, commentGiver); if (instructor == null) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered instructor for course " + courseId + "."); } return; } switch (commentGiverType) { case STUDENTS: StudentAttributes student = studentsLogic.getStudentForEmail(courseId, commentGiver); if (student == null) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered student for course " + courseId + "."); } break; case INSTRUCTORS: InstructorAttributes instructor = instructorsLogic.getInstructorForEmail(courseId, commentGiver); if (instructor == null) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered instructor for course " + courseId + "."); } break; case TEAMS: List<TeamDetailsBundle> teams = coursesLogic.getTeamsForCourse(courseId); boolean isTeamPresentInCourse = false; for (TeamDetailsBundle team : teams) { if (team.name.equals(commentGiver)) { isTeamPresentInCourse = true; break; } } if (!isTeamPresentInCourse) { throw new EntityDoesNotExistException("User " + commentGiver + " is not a registered team for course " + courseId + "."); } break; default: throw new EntityDoesNotExistException("Unknown giver type: " + commentGiverType); } }
Source:
public void run(TimelockBenchmarkClientConfig configuration, Environment environment) throws Exception { FeignOkHttpClients.globalClientSetttings = client -> client.hostnameVerifier((ig, nored) -> true); environment.jersey().register(new BenchmarksResource(configuration.getAtlas())); environment.jersey().register( HttpRemotingJerseyFeature.with(HttpRemotingJerseyFeature.StacktracePropagation.PROPAGATE)); }

Target:
public void run(TimelockBenchmarkClientConfig configuration, Environment environment) throws Exception { FeignOkHttpClients.globalClientSettings = client -> client.hostnameVerifier((ig, nored) -> true); environment.jersey().register(new BenchmarksResource(configuration.getAtlas())); environment.jersey().register(HttpRemotingJerseyFeature.INSTANCE); }
Source:
public void accept(Object rv, Throwable throwable) { if (trace) log.tracef("Resuming invocation of command %s with %d handlers", command, queueSize()); Stages.pushInvocationIdNDC(command, trace); try { invokeQueuedHandlers(rv, throwable); } finally { Stages.popInvocationIdNDC(command, trace); } }

Target:
public void accept(Object rv, Throwable throwable) { invokeQueuedHandlers(rv, throwable); }
Source:
PlanNodeStatsEstimate calculateJoinComplementStats( Optional<Expression> filter, List<JoinNode.EquiJoinClause> criteria, PlanNodeStatsEstimate leftStats, PlanNodeStatsEstimate rightStats) { if (criteria.isEmpty()) { if (rightStats.getOutputRowCount() > 0) { return leftStats.mapOutputRowCount(rowCount -> 0.0); } if (rightStats.getOutputRowCount() == 0) { return leftStats; } return UNKNOWN_STATS; } int numberOfFilterClauses = filter.map( exression -> ExpressionUtils.extractConjuncts(exression).size()) .orElse(0); return IntStream.range(0, criteria.size()) .mapToObj(drivingClauseId -> { EquiJoinClause drivingClause = criteria.get(drivingClauseId); return calculateJoinComplementStats(leftStats, rightStats, drivingClause, criteria.size() - 1 + numberOfFilterClauses); }) .max(comparingDouble(PlanNodeStatsEstimate::getOutputRowCount)) .get(); }

Target:
PlanNodeStatsEstimate calculateJoinComplementStats( Optional<Expression> filter, List<JoinNode.EquiJoinClause> criteria, PlanNodeStatsEstimate leftStats, PlanNodeStatsEstimate rightStats) { if (rightStats.getOutputRowCount() == 0) { return leftStats; } if (criteria.isEmpty()) { if (filter.isPresent()) { return UNKNOWN_STATS; } return leftStats.mapOutputRowCount(rowCount -> 0.0); } int numberOfFilterClauses = filter.map( exression -> ExpressionUtils.extractConjuncts(exression).size()) .orElse(0); return IntStream.range(0, criteria.size()) .mapToObj(drivingClauseId -> { EquiJoinClause drivingClause = criteria.get(drivingClauseId); return calculateJoinComplementStats(leftStats, rightStats, drivingClause, criteria.size() - 1 + numberOfFilterClauses); }) .max(comparingDouble(PlanNodeStatsEstimate::getOutputRowCount)) .get(); }
Source:
public NettyServer(BaseServerOptions options, HttpHandler handler) throws SSLException, CertificateException { Objects.requireNonNull(options, "Server options must be set."); Objects.requireNonNull(handler, "Handler to use must be set."); Boolean secure = options.isSecure(); if (secure) { sslCtx = SslContextBuilder.forServer(options.getCertificate(), options.getPrivateKey()) .build(); } else { sslCtx = null; } this.handler = handler.with(new WrapExceptions().andThen(new AddWebDriverSpecHeaders())); bossGroup = new NioEventLoopGroup(1); workerGroup = new NioEventLoopGroup(); port = options.getPort(); try { externalUrl = options.getExternalUri().toURL(); } catch (MalformedURLException e) { throw new UncheckedIOException("Server URI is not a valid URL: " + options.getExternalUri(), e); } }

Target:
public NettyServer(BaseServerOptions options, HttpHandler handler) { Objects.requireNonNull(options, "Server options must be set."); Objects.requireNonNull(handler, "Handler to use must be set."); Boolean secure = options.isSecure(); if (secure) { try { sslCtx = SslContextBuilder.forServer(options.getCertificate(), options.getPrivateKey()) .build(); } catch (SSLException e) { throw new UncheckedIOException(new IOException("Certificate problem.", e)); } } else { sslCtx = null; } this.handler = handler.with(new WrapExceptions().andThen(new AddWebDriverSpecHeaders())); bossGroup = new NioEventLoopGroup(1); workerGroup = new NioEventLoopGroup(); port = options.getPort(); try { externalUrl = options.getExternalUri().toURL(); } catch (MalformedURLException e) { throw new UncheckedIOException("Server URI is not a valid URL: " + options.getExternalUri(), e); } }
Source:
private void removeEmptySerialExecutor(Object stripe, SerialExecutor ser_ex) { assert lock.isHeldByCurrentThread(); assert ser_ex.isEmpty(); SerialExecutor removed = executors.remove(stripe); assert ser_ex == removed || (executor.isShutdown() && removed == null); if (ser_ex == removed); { terminating.signalAll(); if (state == State.SHUTDOWN && executors.isEmpty()) { executor.shutdown(); } } }

Target:
private void removeEmptySerialExecutor(Object stripe, SerialExecutor ser_ex) { assert ser_ex == executors.get(stripe); assert lock.isHeldByCurrentThread(); assert ser_ex.isEmpty(); executors.remove(stripe); if (state == State.SHUTDOWN && executors.isEmpty()) { executor.shutdown(); terminating.signalAll(); } }
Source:
public void runCucumber(CucumberFeature cucumberFeature) { runtime = new cucumber.runtime.Runtime(resourceLoader, classFinder, classLoader, runtimeOptions); cucumberFeature.run( runtimeOptions.formatter(classLoader), runtimeOptions.reporter(classLoader), runtime); if (!runtime.getErrors().isEmpty()) { throw new CucumberException(runtime.getErrors().get(0)); } if (runtime.exitStatus() != 0) { throw new CucumberException("There are undefined steps"); } }

Target:
public void runCucumber(CucumberFeature cucumberFeature) { Runtime runtime = createRuntime(); cucumberFeature.run( runtimeOptions.formatter(classLoader), runtimeOptions.reporter(classLoader), runtime); if (!runtime.getErrors().isEmpty()) { throw new CucumberException(runtime.getErrors().get(0)); } if (runtime.exitStatus() != 0) { throw new CucumberException("There are undefined steps"); } }
Source:
private static InputStream getStream(URL url) { if (url != null) { try { if (InternalPolicy.OSGI_AVAILABLE) { URL platformURL = FileLocator.find(url); if (platformURL != null) { url = platformURL; } } return new BufferedInputStream(url.openStream()); } catch (IOException e) { if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) { String path = url.getPath(); if (path.endsWith("@2x.png") || path.endsWith("@1.5x.png")) { String message = "High-resolution image missing: " + url; Policy.getLog().log(new Status(IStatus.WARNING, Policy.JFACE, message, e)); } } } } return null; }

Target:
private static InputStream getStream(URL url) { if (url == null) { return null; } try { if (InternalPolicy.OSGI_AVAILABLE) { URL platformURL = FileLocator.find(url); if (platformURL != null) { url = platformURL; } } return new BufferedInputStream(url.openStream()); } catch (IOException e) { if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) { String path = url.getPath(); if (path.endsWith("@2x.png") || path.endsWith("@1.5x.png")) { String message = "High-resolution image missing: " + url; Policy.getLog().log(new Status(IStatus.WARNING, Policy.JFACE, message, e)); } } return null; } }
Source:
public String placeLimitOrder(LimitOrder limitOrder) throws IOException { return placeBithumbLimitOrder(limitOrder).getOrderId(); }

Target:
public String placeLimitOrder(LimitOrder limitOrder) throws IOException { try { return placeBithumbLimitOrder(limitOrder).getOrderId(); } catch (BithumbException e) { throw BithumbErrorAdapter.adapt(e); } }
Source:
public boolean containsThread(@NonNull DiscussionThread discussionThread) { if (isAllType() || isFollowingType()) { return true; } else if (identifier != null && identifier.equals(discussionThread.getTopicId())) { return true; } for (DiscussionTopic child : children) { if (child.containsThread(discussionThread)) { return true; } } return false; }

Target:
public boolean containsThread(@NonNull DiscussionThread discussionThread) { if (isAllType() || (isFollowingType() && discussionThread.isFollowing())) { return true; } else if (identifier != null && identifier.equals(discussionThread.getTopicId())) { return true; } for (DiscussionTopic child : children) { if (child.containsThread(discussionThread)) { return true; } } return false; }
Source:
protected void resetCurrentContentViewWorkingList() { if (currentContentViewName != null) { ContentView contentView = contentViewActions.getContentView(currentContentViewName); if(contentView != null){ String selectionListName = contentView.getSelectionListName(); documentsListsManager.resetWorkingList(selectionListName); } } }

Target:
protected void resetCurrentContentViewWorkingList() { if (currentContentViewName != null) { ContentView contentView = contentViewActions.getContentView(currentContentViewName); if (contentView != null) { documentsListsManager.resetWorkingList(contentView.getSelectionListName()); } } }
Source:
public AuthenticationConfiguration useBearerTokenCredential(BearerTokenCredential credential) { return useCredentials(IdentityCredentials.NONE.withCredential(credential)); }

Target:
public final AuthenticationConfiguration useBearerTokenCredential(BearerTokenCredential credential) { return credential == null ? this : useCredentials(getCredentialSource().with(IdentityCredentials.NONE.withCredential(credential))); }
Source:
public void onSyncQueueFinishedEvent(SyncQueueFinishedEvent event) { Log.d(TAG, "onSyncQueueFinishedEvent() started"); checkOperationID(event); getNotificationManager().cancel(TAG, NOTIFICATION_ID_SYNC_QUEUE_ONGOING); ActionResult result = event.getResult(); if(result != null && !result.isSuccess() || event.getQueueLength() == null || event.getQueueLength() > 0) { enableConnectivityChangeReceiver(true); } emptyOperationID(); }

Target:
public void onSyncQueueFinishedEvent(SyncQueueFinishedEvent event) { Log.d(TAG, "onSyncQueueFinishedEvent() started"); checkOperationID(event); getNotificationManager().cancel(TAG, NOTIFICATION_ID_SYNC_QUEUE_ONGOING); ActionResult result = event.getResult(); if((result != null && !result.isSuccess()) || (event.getQueueLength() == null || event.getQueueLength() > 0)) { enableConnectivityChangeReceiver(true); } emptyOperationID(); }
Source:
private void checkMultipleRPFs(ServletContext ctx, ConfigurationProperties props, StartupStatus ss) { String rpfStatus = props.getProperty(MULTIPLE_RPFS); if (rpfStatus == "both") { ss.warning(this, "Deprecation warning: Files matching the name 'runtime.properties' " + "were found in both vivo.home and vivo.home/config. Using " + "the file in vivo.home. Future releases may require " + "runtime.properties be placed in vivo.home/config."); } if (rpfStatus == "home") { ss.warning(this, "Deprecation warning: runtime.properties was found in the " + "vivo.home directory. The recommended directory for " + "runtime.properties is now vivo.home/config. Future releases " + "may require runtime.properties be placed in " + "vivo.home/config."); } }

Target:
private void checkMultipleRPFs(ServletContext ctx, ConfigurationProperties props, StartupStatus ss) { String rpfStatus = props.getProperty(ConfigurationPropertiesSetup.RP_MULTIPLE); if (rpfStatus.equals("both")) { ss.warning(this, "Deprecation warning: Files matching the name 'runtime.properties' " + "were found in both vivo.home and vivo.home/config. Using " + "the file in vivo.home. Future releases may require " + "runtime.properties be placed in vivo.home/config."); } if (rpfStatus.equals("home")) { ss.warning(this, "Deprecation warning: runtime.properties was found in the " + "vivo.home directory. The recommended directory for " + "runtime.properties is now vivo.home/config. Future releases " + "may require runtime.properties be placed in " + "vivo.home/config."); } }
Source:
void restore(IMemento memento) throws ClassNotFoundException { IMemento type = memento.getChild(KEY_TYPE); synchronized (fType) { fType = (Class<V>)Class.forName(type.getTextData()); } IMemento[] list = memento.getChildren(KEY_NAME); Map<String, V> values = Collections.synchronizedMap(new TreeMap<String, V>()); for (IMemento elem : list) { values.put(elem.getID(), getValue(elem)); } synchronized (fValues) { fValues = values; } }

Target:
void restore(IMemento memento) throws ClassNotFoundException { IMemento type = memento.getChild(KEY_TYPE); fType = (Class<V>)Class.forName(type.getTextData()); IMemento[] list = memento.getChildren(KEY_NAME); Map<String, V> values = Collections.synchronizedMap(new TreeMap<String, V>()); for (IMemento elem : list) { values.put(elem.getID(), getValue(elem)); } fValues = values; }
Source:
public void rollback() throws XAException { final Transaction transaction = this.transaction; try { final int status = transaction.getStatus(); if (status == Status.STATUS_ROLLING_BACK || status == Status.STATUS_ROLLEDBACK) { return; } } catch (SystemException e) { } if (! (transaction instanceof ImportedTransaction)) { throw Log.log.notImportedXa(XAException.XAER_NOTA); } int oldVal; do { oldVal = completionBits.get(); if ((oldVal & BIT_PREPARE_OR_ROLLBACK) == 0) { throw Log.log.invalidTxStateXa(XAException.XAER_NOTA); } } while (! completionBits.compareAndSet(oldVal, oldVal | BIT_PREPARE_OR_ROLLBACK | BIT_BEFORE_COMP)); final ImportedTransaction importedTransaction = (ImportedTransaction) transaction; if (importedTransaction.activated()) try { importedTransaction.doRollback(); } catch (HeuristicCommitException e) { throw Log.log.heuristicCommitXa(XAException.XA_HEURCOM, e); } catch (HeuristicMixedException e) { throw Log.log.heuristicMixedXa(XAException.XA_HEURMIX, e); } catch (HeuristicRollbackException e) { throw Log.log.heuristicRollbackXa(XAException.XA_HEURRB, e); } catch (IllegalStateException e) { throw Log.log.illegalStateXa(XAException.XAER_NOTA, e); } catch (Throwable e) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMERR, e); } finally { ext.removeImportedTransaction(gtid); } }

Target:
public void rollback() throws XAException { final Transaction transaction = this.transaction; try { final int status = transaction.getStatus(); if (status == Status.STATUS_ROLLING_BACK || status == Status.STATUS_ROLLEDBACK) { return; } } catch (SystemException e) { } if (! (transaction instanceof ImportedTransaction)) { throw Log.log.notImportedXa(XAException.XAER_NOTA); } final ImportedTransaction importedTransaction = (ImportedTransaction) transaction; if (importedTransaction.activated()) try { importedTransaction.doRollback(); } catch (HeuristicCommitException e) { throw Log.log.heuristicCommitXa(XAException.XA_HEURCOM, e); } catch (HeuristicMixedException e) { throw Log.log.heuristicMixedXa(XAException.XA_HEURMIX, e); } catch (HeuristicRollbackException e) { throw Log.log.heuristicRollbackXa(XAException.XA_HEURRB, e); } catch (IllegalStateException e) { throw Log.log.illegalStateXa(XAException.XAER_NOTA, e); } catch (Throwable e) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMERR, e); } finally { ext.removeImportedTransaction(gtid); } }
Source:
SweepOutcome runOnce() { Optional<TableToSweep> tableToSweep = getTableToSweep(); if (!tableToSweep.isPresent()) { log.debug("Skipping sweep because no table has enough new writes to be worth sweeping at the moment."); return SweepOutcome.NOTHING_TO_SWEEP; } else { specificTableSweeper.runOnceAndSaveResults(tableToSweep.get()); return SweepOutcome.SUCCESS; } }

Target:
SweepOutcome runOnce() { Optional<TableToSweep> tableToSweep = getTableToSweep(); if (!tableToSweep.isPresent()) { log.debug("Skipping sweep because no table has enough new writes to be worth sweeping at the moment."); return SweepOutcome.NOTHING_TO_SWEEP; } SweepBatchConfig batchConfig = sweepBatchConfigSource.getAdjustedSweepConfig(); try { specificTableSweeper.runOnceAndSaveResults(tableToSweep.get(), batchConfig); return SweepOutcome.SUCCESS; } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); return SweepOutcome.NOT_ENOUGH_DB_NODES_ONLINE; } catch (RuntimeException e) { specificTableSweeper.getSweepMetrics().sweepError(); return determineCauseOfFailure(e, tableToSweep.get()); } }
Source:
private Figure getGroupFigure(List<Figure> dDiagramElementDecorationFigures, Position position, Rectangle expectedGroupBounds) { Figure groupFigure = null; for (Figure currentGroupFigure : dDiagramElementDecorationFigures) { System.out.println("figure bounds " + currentGroupFigure.getBounds()); if (currentGroupFigure.getBounds().equals(expectedGroupBounds)) { groupFigure = currentGroupFigure; break; } } assertNotNull("Bad group decoration position at " + position.getName(), groupFigure); return groupFigure; }

Target:
private Figure getGroupFigure(List<Figure> dDiagramElementDecorationFigures, Position position, Rectangle expectedGroupBounds) { Figure groupFigure = null; for (Figure currentGroupFigure : dDiagramElementDecorationFigures) { if (currentGroupFigure.getBounds().equals(expectedGroupBounds)) { groupFigure = currentGroupFigure; break; } } assertNotNull("Bad group decoration position at " + position.getName(), groupFigure); return groupFigure; }
Source:
public void testHotReloadSequence() { String storageConf = StorageConfiguration.defaultSystemProperty(StorageConfiguration.CORE_PROPERTY, StorageConfiguration.DEFAULT_CORE); assumeTrue(StorageConfiguration.CORE_VCS.equals(storageConf)); assertEquals(1, getSequence()); assertEquals(2, getSequence()); assertEquals(3, getSequence()); }

Target:
public void testHotReloadSequence() { String storageConf = StorageConfiguration.defaultSystemProperty(StorageConfiguration.CORE_PROPERTY, StorageConfiguration.DEFAULT_CORE); assumeTrue("This test only works with VCS", StorageConfiguration.CORE_VCS.equals(storageConf)); Map<String, Object> parameters = new HashMap<>(); parameters.put("sequenceName", "hibernateSequencer"); RestHelper.operation("javascript.getSequence", parameters); }
Source:
public void processHtmlFile(String htmlFile) throws Exception { String fileContent = FileSystemManager.getFileContents(htmlFile); JerryParser parser = new Jerry.JerryParser(); parser.enableHtmlMode(); Jerry htmlParser = parser.parse(fileContent); htmlParser.$("div[data-vault-guid]").each(new JerryFunction() { @Override public boolean onNode(Jerry $this, int index) { String safety = $this.attr("data-vault-guid"); try { $this.html(loader.getSafety(safety)); } catch(SafetyMissingException e) { safetyMissing = true; } catch(IOException e) { log.error("Failed to process update!", e); error = true; } return true; } }); String newContents = htmlParser.html(); if(newContents != null && newContents.trim().length() > 0 && !fileContent.equals(newContents)) { File htmlFileObj = new File(htmlFile); FileSystemManager.writeStringToFile(htmlFileObj.getParent(), htmlFileObj.getName(), newContents); } }

Target:
public void processHtmlFile(String htmlFile) throws Exception { String fileContent = FileSystemManager.getFileContents(htmlFile); Jerry htmlParser = jerry().parse(fileContent); Jerry divs = htmlParser.$("div[data-vault-guid]"); if(divs.size() > 0) { divs.each(new JerryFunction() { @Override public boolean onNode(Jerry $this, int index) { String safety = $this.attr("data-vault-guid"); try { $this.html(loader.getSafety(safety)); } catch(SafetyMissingException e) { safetyMissing = true; } catch(IOException e) { log.error("Failed to process update!", e); error = true; } return true; } }); String newContents = htmlParser.html(); if(newContents != null && newContents.trim().length() > 0 && !fileContent.equals(newContents)) { File htmlFileObj = new File(htmlFile); FileSystemManager.writeStringToFile(htmlFileObj.getParent(), htmlFileObj.getName(), newContents); } } }
Source:
public synchronized void save(Note note, AuthenticationInfo subject) throws IOException { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setPrettyPrinting(); Gson gson = gsonBuilder.create(); String json = gson.toJson(note); FileObject rootDir = getRootDir(); FileObject noteDir = rootDir.resolveFile(note.getId(), NameScope.CHILD); if (!noteDir.exists()) { noteDir.createFolder(); } if (!isDirectory(noteDir)) { throw new IOException(noteDir.getName().toString() + " is not a directory"); } FileObject noteJson = noteDir.resolveFile(".note.zpln", NameScope.CHILD); OutputStream out = noteJson.getContent().getOutputStream(false); out.write(json.getBytes(conf.getString(ConfVars.ZEPPELIN_ENCODING))); out.close(); setFileName(note, noteJson, noteDir); }

Target:
public synchronized void save(Note note, AuthenticationInfo subject) throws IOException { String json = note.toJson(); FileObject noteDir = getNoteDir(note.getId()); FileObject noteJson = noteDir.resolveFile(".note.zpln", NameScope.CHILD); OutputStream out = noteJson.getContent().getOutputStream(false); out.write(json.getBytes(conf.getString(ConfVars.ZEPPELIN_ENCODING))); out.close(); String filename = note.getFilename(); if (StringUtils.isBlank(filename)) { filename = Util.convertTitleToFilename(note.getName()); if (StringUtils.isBlank(note.getDirPath())) { note.setDirPath(note.getId() + File.separator); } } noteJson.moveTo(noteDir.resolveFile(filename, NameScope.CHILD)); note.setFilename(filename); String targetFilename = Util.convertTitleToFilename(note.getName()); if (requiresRename(note)) { rename(note.getFilepath(), note.getDirPath() + targetFilename); note.setFilename(targetFilename); } }
Source:
protected byte[] evaluateMessage(int state, final byte[] message) throws SaslException { switch (state) { case INITIAL_STATE: if (message != null && message.length > 0) { throw log.saslInvalidServerMessage(getMechanismName()); } NameCallback nameCallback = new NameCallback("Authentication name"); handleCallbacks(nameCallback); String name = nameCallback.getName(); if (name == null) { throw log.saslNotProvidedUserName(getMechanismName()); } if (name.length() > 255) { throw log.saslAuthenticationNameTooLong(getMechanismName()); } if (name.isEmpty()) { throw log.saslAuthenticationNameIsEmpty(getMechanismName()); } ByteStringBuilder b = new ByteStringBuilder(); StringPrep.encode(name, b, 0 | StringPrep.MAP_TO_NOTHING | StringPrep.MAP_TO_SPACE | StringPrep.FORBID_ASCII_CONTROL | StringPrep.FORBID_NON_ASCII_CONTROL | StringPrep.FORBID_PRIVATE_USE | StringPrep.FORBID_NON_CHARACTER | StringPrep.FORBID_SURROGATE | StringPrep.FORBID_INAPPROPRIATE_FOR_PLAIN_TEXT | StringPrep.FORBID_CHANGE_DISPLAY_AND_DEPRECATED | StringPrep.FORBID_TAGGING | StringPrep.NORMALIZE_KC ); negotiationComplete(); return b.toArray(); } throw new IllegalStateException(); }

Target:
protected byte[] evaluateMessage(int state, final byte[] message) throws SaslException { switch (state) { case INITIAL_STATE: if (message != null && message.length > 0) { throw log.saslInvalidServerMessage(getMechanismName()); } NameCallback nameCallback = new NameCallback("Authentication name"); handleCallbacks(nameCallback); String name = nameCallback.getName(); if (name == null) { throw log.saslNotProvidedUserName(getMechanismName()); } if (name.length() > 255) { throw log.saslAuthenticationNameTooLong(getMechanismName()); } if (name.isEmpty()) { throw log.saslAuthenticationNameIsEmpty(getMechanismName()); } ByteStringBuilder b = new ByteStringBuilder(); StringPrep.encode(name, b, 0 | StringPrep.MAP_TO_NOTHING | StringPrep.MAP_TO_SPACE | StringPrep.FORBID_ASCII_CONTROL | StringPrep.FORBID_NON_ASCII_CONTROL | StringPrep.FORBID_PRIVATE_USE | StringPrep.FORBID_NON_CHARACTER | StringPrep.FORBID_SURROGATE | StringPrep.FORBID_INAPPROPRIATE_FOR_PLAIN_TEXT | StringPrep.FORBID_CHANGE_DISPLAY_AND_DEPRECATED | StringPrep.FORBID_TAGGING | StringPrep.NORMALIZE_KC ); negotiationComplete(); return b.toArray(); } throw Assert.impossibleSwitchCase(state); }