auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int size() { FeatureReader<SimpleFeatureType,SimpleFeature> fr = null; if (featureCache != null) { return featureCache.size(); } try { int size = featureSource.getCount(query); if(size >= 0) { return size; } else { List<SimpleFeature> tempFeatureCache = new ArrayList<SimpleFeature>(); fr = featureSource.getReader(query); int count = 0; while(fr.hasNext()) { SimpleFeature feature = fr.next(); if (tempFeatureCache.size() < FEATURE_CACHE_LIMIT) tempFeatureCache.add(feature); count++; } if (count <= FEATURE_CACHE_LIMIT) { featureCache = tempFeatureCache; } else { tempFeatureCache.clear(); } return count; } } catch (IOException e) { throw new RuntimeException(e); } finally { if(fr != null) { try { fr.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }

Target:
public int size() { FeatureReader<SimpleFeatureType,SimpleFeature> fr = null; if (featureCache != null) { return featureCache.size(); } try { int size = featureSource.getCount(query); if(size >= 0) { return size; } else if (FEATURE_CACHE_LIMIT <= 0) { AttributeDescriptor chosen = getSmallAttributeInSchema(); Query q = new Query(query); if(chosen != null) { q.setPropertyNames(Collections.singletonList(chosen.getLocalName())); } fr = featureSource.getReader(q); int count = 0; while(fr.hasNext()) { fr.next(); count++; } return count; } else { List<SimpleFeature> tempFeatureCache = new ArrayList<SimpleFeature>(); fr = featureSource.getReader(query); int count = 0; while(fr.hasNext()) { SimpleFeature feature = fr.next(); if (tempFeatureCache.size() < FEATURE_CACHE_LIMIT) tempFeatureCache.add(feature); count++; } if (count <= FEATURE_CACHE_LIMIT) { featureCache = tempFeatureCache; } else { tempFeatureCache.clear(); } return count; } } catch (IOException e) { throw new RuntimeException(e); } finally { if(fr != null) { try { fr.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }
Source:
private void fireRefreshAsync(final IConnectionWrapper wrapper) { Display.getDefault().asyncExec(new Runnable() { public void run() { refreshViewer(wrapper); if (viewer instanceof TreeViewer) { TreeViewer treeViewer = (TreeViewer) viewer; treeViewer.expandToLevel(wrapper, 1); } } }); }

Target:
private void fireRefreshAsync(final IConnectionWrapper wrapper) { Display.getDefault().asyncExec(new Runnable() { public void run() { refreshViewer(wrapper); if (viewer instanceof TreeViewer && !((TreeViewer) viewer).getTree().isDisposed()) { TreeViewer treeViewer = (TreeViewer) viewer; treeViewer.expandToLevel(wrapper, 1); } } }); }
Source:
public void networkExists() throws Exception { assertEquals(ValidationResult.VALID.getMessage(), validator.networkExists().getMessage()); }

Target:
public void networkExists() throws Exception { assertEquals(ValidationResult.VALID, validator.networkExists()); }
Source:
@Override public List<Type> getStateType(AggContext info) { return Collections.singletonList(HashMap.class); }

Target:
@Override public List<Type> getStateType(AggContext info) { return Collections.singletonList(Map.class); }
Source:
private static List<ITmfStateInterval> queryAttributeRange(ITmfStateSystem ss, long t1, long t2, int baseQuark, String featureString) throws AttributeNotFoundException, TimeRangeException { Pair<Long, Long> timeRange = new Pair<Long, Long>(t1, t2); int mipmapQuark = -1; List<ITmfStateInterval> intervals = new ArrayList<ITmfStateInterval>(); try { try { mipmapQuark = ss.getQuarkRelative(baseQuark, featureString); } catch (AttributeNotFoundException e) { if (t1 == t2) { ITmfStateInterval interval = ss.querySingleState(t1, baseQuark); if (!interval.getStateValue().isNull()) { intervals.add(interval); } } else { for (ITmfStateInterval interval : ss.queryHistoryRange(baseQuark, t1, t2)) { if (!interval.getStateValue().isNull()) { intervals.add(interval); } } } return intervals; } ITmfStateInterval maxLevelInterval = ss.querySingleState(timeRange.getSecond(), mipmapQuark); int levelMax = maxLevelInterval.getStateValue().unboxInt(); queryMipmapAttributeRange(ss, 0, levelMax, baseQuark, mipmapQuark, timeRange, intervals); return intervals; } catch (StateValueTypeException e) { Activator.logError("State system advertises mipmaps," + " but doesn't actually have them."); } catch (StateSystemDisposedException e) { } return intervals; }

Target:
private static List<ITmfStateInterval> queryAttributeRange(ITmfStateSystem ss, long t1, long t2, int baseQuark, String featureString) throws AttributeNotFoundException, TimeRangeException, StateValueTypeException { Pair<Long, Long> timeRange = new Pair<Long, Long>(t1, t2); int mipmapQuark = -1; List<ITmfStateInterval> intervals = new ArrayList<ITmfStateInterval>(); try { try { mipmapQuark = ss.getQuarkRelative(baseQuark, featureString); } catch (AttributeNotFoundException e) { if (t1 == t2) { ITmfStateInterval interval = ss.querySingleState(t1, baseQuark); if (!interval.getStateValue().isNull()) { intervals.add(interval); } } else { for (ITmfStateInterval interval : ss.queryHistoryRange(baseQuark, t1, t2)) { if (!interval.getStateValue().isNull()) { intervals.add(interval); } } } return intervals; } ITmfStateInterval maxLevelInterval = ss.querySingleState(timeRange.getSecond(), mipmapQuark); int levelMax = maxLevelInterval.getStateValue().unboxInt(); queryMipmapAttributeRange(ss, 0, levelMax, baseQuark, mipmapQuark, timeRange, intervals); return intervals; } catch (StateValueTypeException e) { throw new StateValueTypeException("State system advertises mipmaps," + " but doesn't actually have them.", e); } catch (StateSystemDisposedException e) { } return intervals; }
Source:
private void invokeTestInstancePreDestroyCallback(JupiterEngineExecutionContext context) { if (isPerClassLifecycle(context)) { ExtensionContext extensionContext = context.getExtensionContext(); ThrowableCollector throwableCollector = context.getThrowableCollector(); Object testInstance = extensionContext.getTestInstance().orElse(null); context.getExtensionRegistry().stream(TestInstancePreDestroyCallback.class).forEach( extension -> throwableCollector.execute( () -> extension.preDestroyTestInstance(testInstance, extensionContext))); } }

Target:
private void invokeTestInstancePreDestroyCallback(JupiterEngineExecutionContext context) { ExtensionContext extensionContext = context.getExtensionContext(); ThrowableCollector throwableCollector = context.getThrowableCollector(); context.getExtensionRegistry().stream(TestInstancePreDestroyCallback.class).forEach( extension -> throwableCollector.execute(() -> extension.preDestroyTestInstance(extensionContext))); }
Source:
protected String getMimeType() throws IOException { return Files.probeContentType(path); }

Target:
protected String getMimeType() throws IOException { String mimeType = null; if (Application.exists()) { mimeType = Application.get().getMimeType(path.getFileName().toString()); } if (mimeType == null) { mimeType = Files.probeContentType(path); } return mimeType; }
Source:
public List<Comment> getAllComments(String uuid, PaginationRequest request) throws CommentManagementException, SQLException, DBConnectionException { if (log.isDebugEnabled()) { log.debug("Getting comment of the application release (" + uuid + ") from the database"); } Connection conn; PreparedStatement stmt = null; ResultSet rs = null; List<Comment> comments = new ArrayList<>(); String sql = ""; try { conn = this.getDBConnection(); sql += "SELECT COMMENT_TEXT FROM AP_APP_COMMENT, AP_APP_RELEASE WHERE AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID " + "AND AP_APP_RELEASE.UUID =? LIMIT ? OFFSET ?;"; stmt = conn.prepareStatement(sql); stmt.setString(1, uuid); stmt.setInt(2, request.getLimit()); stmt.setInt(3, request.getOffSet()); rs = stmt.executeQuery(); while (rs.next()) { Comment comment = new Comment(); comment.setId(rs.getInt("ID")); comment.setTenantId(rs.getInt("TENANT_ID")); comment.setComment(rs.getString("COMMENT_TEXT")); comment.setCreatedAt(rs.getTimestamp("CREATED_AT")); comment.setCreatedBy(rs.getString("CREATED_BY")); comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT")); comment.setModifiedBy(rs.getString("MODEFIED_BY")); comment.setParent(rs.getInt("PARENT_ID")); comments.add(comment); } } finally { Util.cleanupResources(stmt, rs); } return comments; }

Target:
public List<Comment> getAllComments(String uuid, PaginationRequest request) throws CommentManagementException, SQLException, DBConnectionException { if (log.isDebugEnabled()) { log.debug("Getting comment of the application release (" + uuid + ") from the database"); } Connection conn; PreparedStatement statement = null; ResultSet rs = null; List<Comment> comments = new ArrayList<>(); try { conn = this.getDBConnection(); sql = "SELECT COMMENT_TEXT FROM AP_APP_COMMENT, AP_APP_RELEASE WHERE AP_APP_COMMENT.AP_APP_RELEASE_ID=AP_APP_RELEASE.ID " + "AND AP_APP_RELEASE.UUID =? LIMIT ? OFFSET ?;"; statement = conn.prepareStatement(sql); statement.setString(1, uuid); statement.setInt(2, request.getLimit()); statement.setInt(3, request.getOffSet()); rs = statement.executeQuery(); while (rs.next()) { Comment comment = new Comment(); comment.setId(rs.getInt("ID")); comment.setTenantId(rs.getInt("TENANT_ID")); comment.setComment(rs.getString("COMMENT_TEXT")); comment.setCreatedAt(rs.getTimestamp("CREATED_AT")); comment.setCreatedBy(rs.getString("CREATED_BY")); comment.setModifiedAt(rs.getTimestamp("MODEFIED_AT")); comment.setModifiedBy(rs.getString("MODEFIED_BY")); comment.setParent(rs.getInt("PARENT_ID")); comments.add(comment); } } finally { Util.cleanupResources(statement, rs); } return comments; }
Source:
private void bindTriggerIfPresent(Class<? extends Annotation> annotationClass, AccessibleObject fieldOrMethod) { if (fieldOrMethod instanceof Method && fieldOrMethod.isAnnotationPresent(annotationClass)) { Annotation trigger = fieldOrMethod.getAnnotation(annotationClass); String value; try { value = (String) annotationClass.getMethod("value").invoke(trigger); } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { value = ""; } Method method = (Method) fieldOrMethod; LifeCycleHook callback = (entity, scope, changes) -> { try { if (changes.isPresent() && method.getParameterCount() == 2 && method.getParameterTypes()[0].isInstance(scope) && method.getParameterTypes()[1].isInstance(changes.get())) { method.invoke(entity, scope, changes.get()); } else if (method.getParameterCount() == 1 && method.getParameterTypes()[0].isInstance(scope)) { method.invoke(entity, scope); } else { method.invoke(entity); } } catch (ReflectiveOperationException e) { Throwables.propagateIfPossible(e.getCause()); throw new IllegalArgumentException(e); } }; fieldsToTriggers.put(Pair.of(annotationClass, value), callback); } }

Target:
private void bindTriggerIfPresent(Class<? extends Annotation> annotationClass, AccessibleObject fieldOrMethod) { if (fieldOrMethod instanceof Method && fieldOrMethod.isAnnotationPresent(annotationClass)) { Annotation trigger = fieldOrMethod.getAnnotation(annotationClass); String value; try { value = (String) annotationClass.getMethod("value").invoke(trigger); } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { value = ""; } Method method = (Method) fieldOrMethod; int paramCount = method.getParameterCount(); Class<?> paramTypes = method.getParameterTypes(); LifeCycleHook callback = (entity, scope, changes) -> { try { if (changes.isPresent() && paramCount == 2 && paramTypes[0].isInstance(scope) && paramTypes[1].isInstance(changes.get())) { method.invoke(entity, scope, changes.get()); } else if (paramCount == 1 && paramTypes[0].isInstance(scope)) { method.invoke(entity, scope); } else { method.invoke(entity); } } catch (ReflectiveOperationException e) { Throwables.propagateIfPossible(e.getCause()); throw new IllegalArgumentException(e); } }; bindTrigger(annotationClass, value, callback); } }
Source:
protected void execute(final RebaseOperation rebase) throws ExecutionException { final Repository repository = rebase.getRepository(); if (repository == null) return; final RebaseCommand.Operation operation = rebase.getOperation(); JobUtil.scheduleUserJob(rebase, jobname, JobFamilies.REBASE, new JobChangeAdapter() { @Override public void aboutToRun(IJobChangeEvent event) { if (operation == Operation.BEGIN && !repository.getRepositoryState().equals( RepositoryState.SAFE)) { throw new IllegalStateException( "Can't start rebase if repository state isn't SAFE"); } super.aboutToRun(event); } @Override public void done(IJobChangeEvent cevent) { IStatus result = cevent.getJob().getResult(); if (operation == Operation.BEGIN && result.getSeverity() == IStatus.ERROR) { handleBeginError(repository, result); } else if (result.getSeverity() == IStatus.CANCEL) Display.getDefault().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getShell(); MessageDialog .openInformation( shell, UIText.AbstractRebaseCommand_DialogTitle, dialogMessage); } }); else if (result.isOK()) RebaseResultDialog.show(rebase.getResult(), repository); } }); return; }

Target:
protected void execute(final RebaseOperation rebase) throws ExecutionException { final Repository repository = rebase.getRepository(); if (repository == null) return; final RebaseCommand.Operation operation = rebase.getOperation(); JobUtil.scheduleUserJob(rebase, jobname, JobFamilies.REBASE, new JobChangeAdapter() { @Override public void aboutToRun(IJobChangeEvent event) { if (operation == Operation.BEGIN && !repository.getRepositoryState().equals( RepositoryState.SAFE)) { throw new IllegalStateException( "Can't start rebase if repository state isn't SAFE"); } super.aboutToRun(event); } @Override public void done(IJobChangeEvent cevent) { IStatus result = cevent.getJob().getResult(); if (operation == Operation.BEGIN && result.getSeverity() == IStatus.ERROR) { handleBeginError(repository, result); } else if (result.getSeverity() == IStatus.CANCEL) Display.getDefault().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getShell(); MessageDialog .openInformation( shell, UIText.AbstractRebaseCommand_DialogTitle, dialogMessage); } }); else if (result.isOK()) RebaseResultDialog.show(rebase.getResult(), repository); } }); }
Source:
public void shouldHandleNullValueFromExpectObjectFormatInSchemaVisitor() throws JsonProcessingException { final MonetaryAmountSerializer monetaryAmountSerializer = new MonetaryAmountSerializer(FieldNames.defaults(), new AmountWriter<BigDecimal>() { @Override public Class<BigDecimal> getType() { return BigDecimal.class; } @Override public BigDecimal write(final MonetaryAmount amount) { return amount.getNumber().numberValueExact(BigDecimal.class).stripTrailingZeros(); } }, new NoopMonetaryAmountFormatFactory()); final JsonFormatVisitorWrapper jsonFormatVisitorWrapperMock = mock(JsonFormatVisitorWrapper.class); try { monetaryAmountSerializer.acceptJsonFormatVisitor(jsonFormatVisitorWrapperMock, SimpleType.constructUnsafe(javax.money.MonetaryAmount.class)); } catch (NullPointerException ex) { fail(); } }

Target:
public void shouldHandleNullValueFromExpectObjectFormatInSchemaVisitor() throws Exception { final MonetaryAmountSerializer monetaryAmountSerializer = new MonetaryAmountSerializer(FieldNames.defaults(), new AmountWriter<BigDecimal>() { @Override public Class<BigDecimal> getType() { return BigDecimal.class; } @Override public BigDecimal write(final MonetaryAmount amount) { return amount.getNumber().numberValueExact(BigDecimal.class).stripTrailingZeros(); } }, new NoopMonetaryAmountFormatFactory()); final JsonFormatVisitorWrapper jsonFormatVisitorWrapperMock = mock(JsonFormatVisitorWrapper.class); monetaryAmountSerializer.acceptJsonFormatVisitor(jsonFormatVisitorWrapperMock, SimpleType.constructUnsafe(javax.money.MonetaryAmount.class)); }
Source:
public RenderTank() { parts.add(new RenderPartElement<>((tile, part) -> { part.sizeY = ((double)tile.tank.getFluidAmount() / tile.tank.getCapacity()) * 16.0 / 16.0; if(part.sizeY != 0) { part.sizeX = part.sizeZ = 10.0 / 16.0; } else { part.sizeX = part.sizeZ = 0; } part.center.positiond(0.5, part.sizeY / 2, 0.5); if(tile.tank.getFluidType() == null) { return; } part.topTexture = part.bottomTexture = part.northTexture = part.southTexture = part.eastTexture = part.westTexture = tile.tank.getFluidType().getStill(); part.shouldSideBeRendered = side -> { if(side.getAxis() == EnumFacing.Axis.Y) { if(Minecraft.getMinecraft().theWorld.getBlockState(tile.getPos().offset(side)).getBlock() instanceof BlockTank) { TileTank tileSide = (TileTank) Minecraft.getMinecraft().theWorld.getTileEntity(tile.getPos().offset(side)); return tileSide.tank.isEmpty(); } return true; } return true; }; })); }

Target:
public RenderTank() { parts.add(new RenderPartElement<>((tile, part) -> { part.sizeY = ((double)tile.tank.getFluidAmount() / tile.tank.getCapacity()) * 16.0 / 16.0; if(part.sizeY != 0) { part.sizeX = part.sizeZ = 12.0 / 16.0 * 0.99; } else { part.sizeX = part.sizeZ = 0; } part.center.positiond(0.5, part.sizeY / 2, 0.5); if(tile.tank.getFluidType() == null) { return; } part.topTexture = part.bottomTexture = part.northTexture = part.southTexture = part.eastTexture = part.westTexture = tile.tank.getFluidType().getStill(); part.shouldSideBeRendered = side -> { if(side.getAxis() == EnumFacing.Axis.Y) { if(Minecraft.getMinecraft().theWorld.getBlockState(tile.getPos().offset(side)).getBlock() instanceof BlockTank) { TileTank tileSide = (TileTank) Minecraft.getMinecraft().theWorld.getTileEntity(tile.getPos().offset(side)); return tileSide.tank.isEmpty(); } return true; } return true; }; })); }
Source:
public static File[] getHadoopDependencyFilesToLoad( List<String> hadoopDependencyCoordinates, ExtensionsConfig extensionsConfig ) { final File[] hadoopDependenciesToLoad = new File[hadoopDependencyCoordinates.size()]; final File rootHadoopDependenciesDir = new File(extensionsConfig.getHadoopDependenciesDir()); int i = 0; for (final String coordinate : hadoopDependencyCoordinates) { final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion()); if (!hadoopDependencyDir.exists() || !versionDir.exists()) { throw new RuntimeException( String.format("Hadoop dependency [%s] didn't exist!?", versionDir.getAbsolutePath()) ); } hadoopDependenciesToLoad[i++] = versionDir; } return hadoopDependenciesToLoad; }

Target:
public static File[] getHadoopDependencyFilesToLoad( List<String> hadoopDependencyCoordinates, ExtensionsConfig extensionsConfig ) { final File rootHadoopDependenciesDir = new File(extensionsConfig.getHadoopDependenciesDir()); if (rootHadoopDependenciesDir.exists() && !rootHadoopDependenciesDir.isDirectory()) { throw new ISE("Root Hadoop dependencies directory [%s] is not a directory!?", rootHadoopDependenciesDir); } final File[] hadoopDependenciesToLoad = new File[hadoopDependencyCoordinates.size()]; int i = 0; for (final String coordinate : hadoopDependencyCoordinates) { final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion()); if (!hadoopDependencyDir.isDirectory() || !versionDir.isDirectory()) { throw new ISE( String.format("Hadoop dependency [%s] didn't exist!?", versionDir.getAbsolutePath()) ); } hadoopDependenciesToLoad[i++] = versionDir; } return hadoopDependenciesToLoad; }
Source:
protected ParentTopTeamColumn() { }

Target:
private ParentTopTeamColumn() { }
Source:
public void deleteUser(SessionId sessionId, ACOrgUnitId userId) throws ESException { checkForNulls(sessionId, userId); final ESAuthorizationService authorizationService = getAccessControl().getAuthorizationService(); authorizationService.checkProjectAdminAccessForOrgUnit( sessionId.toAPI(), userId.toAPI()); authorizationService.checkProjectAdminAccess( sessionId.toAPI(), null, ESProjectAdminPrivileges.DeleteOrgUnit); ACUser userToDelete = null; for (final Iterator<ACUser> iter = getUsers().iterator(); iter.hasNext();) { final ACUser user = iter.next(); if (user.getCreatedBy() != null && user.getCreatedBy().equals(userId.getId())) { user.setCreatedBy(null); save(); } if (user.getId().equals(userId)) { userToDelete = user; } } for (final ACGroup group : getGroups()) { if (group.getCreatedBy() != null && group.getCreatedBy().equals(userId.getId())) { group.setCreatedBy(null); save(); } } if (userToDelete != null) { final List<ACGroup> groups = getGroups(sessionId, userId); for (final ACGroup acGroup : groups) { removeMember(sessionId, acGroup.getId(), userId); } getAccessControl().getOrgUnitProviderService().removeUser(userToDelete.toAPI()); EcoreUtil.delete(userToDelete); save(); } }

Target:
public void deleteUser(SessionId sessionId, ACOrgUnitId userId) throws ESException { checkForNulls(sessionId, userId); final ESAuthorizationService authorizationService = getAccessControl().getAuthorizationService(); authorizationService.checkProjectAdminAccessForOrgUnit( sessionId.toAPI(), userId.toAPI()); authorizationService.checkProjectAdminAccess( sessionId.toAPI(), null, ESProjectAdminPrivileges.DeleteOrgUnit); ACUser userToDelete = null; for (final Iterator<ACUser> iter = getUsers().iterator(); iter.hasNext();) { final ACUser user = iter.next(); if (user.getCreatedBy() != null && user.getCreatedBy().equals(userId.getId())) { user.setCreatedBy(null); } if (user.getId().equals(userId)) { userToDelete = user; } } for (final ACGroup group : getGroups()) { if (group.getCreatedBy() != null && group.getCreatedBy().equals(userId.getId())) { group.setCreatedBy(null); } } if (userToDelete != null) { final List<ACGroup> groups = getGroups(sessionId, userId); for (final ACGroup acGroup : groups) { removeMember(sessionId, acGroup.getId(), userId); } getAccessControl().getOrgUnitProviderService().removeUser(userToDelete.toAPI()); EcoreUtil.delete(userToDelete); save(); } }
Source:
public Builder withProjectId(String projectId) { return withProjectId(ValueProvider.StaticValueProvider.of(projectId)); }

Target:
public Builder withProjectId(String projectId) { return withProjectId(StaticValueProvider.of(projectId)); }
Source:
private static PRINTER_INFO_2[] getPrinterInfo2(int flags) { IntByReference pcbNeeded = new IntByReference(); IntByReference pcReturned = new IntByReference(); Winspool.INSTANCE.EnumPrinters(flags, null, 2, null, 0, pcbNeeded, pcReturned); if (pcbNeeded.getValue() <= 0) { return new PRINTER_INFO_2[0]; } PRINTER_INFO_2 pPrinterEnum = new PRINTER_INFO_2(pcbNeeded.getValue()); if (!Winspool.INSTANCE.EnumPrinters(flags, null, 2, pPrinterEnum.getPointer(), pcbNeeded.getValue(), pcbNeeded, pcReturned)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } pPrinterEnum.read(); return (PRINTER_INFO_2[]) pPrinterEnum.toArray(pcReturned.getValue()); }

Target:
private static PRINTER_INFO_2[] getPrinterInfo2(int flags) { IntByReference pcbNeeded = new IntByReference(); IntByReference pcReturned = new IntByReference(); Winspool.INSTANCE.EnumPrinters(flags, null, 2, null, 0, pcbNeeded, pcReturned); if (pcbNeeded.getValue() <= 0) return new PRINTER_INFO_2[0]; PRINTER_INFO_2 pPrinterEnum = new PRINTER_INFO_2(pcbNeeded.getValue()); if (!Winspool.INSTANCE.EnumPrinters(flags, null, 2, pPrinterEnum.getPointer(), pcbNeeded.getValue(), pcbNeeded, pcReturned)) throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); pPrinterEnum.read(); return (PRINTER_INFO_2[]) pPrinterEnum.toArray(pcReturned.getValue()); }
Source:
private PersistenceService createServiceInstance() { String storage = this.configurationService.getConfiguration().getStorage(); switch (storage) { case "h2": this.sqlProvider = new H2PersistenceProvider(this.configurationService); setTimerForDBCleanUpTask(); return new SqlPersistenceServiceImpl(this.sqlProvider, this.configurationService); case "redis": return new RedisPersistenceService(this.configurationService.getConfiguration()); case "jdbc": this.sqlProvider = new JDBCPersistenceProvider(this.configurationService); setTimerForDBCleanUpTask(); return new SqlPersistenceServiceImpl(this.sqlProvider, this.configurationService); case "gluu_server_configuration": setTimerForDBCleanUpTask(); return new GluuPersistenceService(this.configurationService.getConfiguration()); case "ldap": setTimerForDBCleanUpTask(); return new GluuPersistenceService(this.configurationService.getConfiguration(), storage); case "couchbase": setTimerForDBCleanUpTask(); return new GluuPersistenceService(this.configurationService.getConfiguration(), storage); } throw new RuntimeException("Failed to create persistence provider. Unrecognized storage specified: " + storage + ", full configuration: " + this.configurationService.get()); }

Target:
private PersistenceService createServiceInstance() { String storage = this.configurationService.getConfiguration().getStorage(); switch (storage) { case "h2": this.sqlProvider = new H2PersistenceProvider(this.configurationService); setTimerForDBCleanUpTask(); return new SqlPersistenceServiceImpl(this.sqlProvider, this.configurationService); case "redis": return new RedisPersistenceService(this.configurationService.getConfiguration()); case "jdbc": this.sqlProvider = new JDBCPersistenceProvider(this.configurationService); setTimerForDBCleanUpTask(); return new SqlPersistenceServiceImpl(this.sqlProvider, this.configurationService); case "gluu_server_configuration": setTimerForDBCleanUpTask(); return new GluuPersistenceService(this.configurationService.getConfiguration()); case "ldap": setTimerForDBCleanUpTask(); return new GluuPersistenceService(this.configurationService.getConfiguration(), storage); case "couchbase": return new GluuPersistenceService(this.configurationService.getConfiguration(), storage); } throw new RuntimeException("Failed to create persistence provider. Unrecognized storage specified: " + storage + ", full configuration: " + this.configurationService.get()); }
Source:
private List<ITheme> getCSSThemes(boolean highContrastMode) { List<ITheme> themes = new ArrayList<ITheme>(); for (ITheme theme : engine.getThemes()) { if (!highContrastMode && theme.getId().equals(E4Application.HIGH_CONTRAST_THEME_ID)) { continue; } themes.add(theme); } return themes; }

Target:
private List<ITheme> getCSSThemes(boolean highContrastMode) { List<ITheme> themes = new ArrayList<ITheme>(); for (ITheme theme : engine.getThemes()) { if (!highContrastMode && !Util.isGtk() && theme.getId().equals(E4Application.HIGH_CONTRAST_THEME_ID)) { continue; } themes.add(theme); } return themes; }
Source:
public void testWorkManagerRunWorkInFailureOperation() throws InterruptedException, OperationException { Work failWork = new FailingWork(10); WorkManager wm = Framework.getService(WorkManager.class); wm.schedule(failWork); assertTrue(wm.awaitCompletion(2000, TimeUnit.MILLISECONDS)); Map<String, Serializable> params = new HashMap<>(); JSONBlob result = (JSONBlob) service.run(ctx, WorkManagerRunWorkInFailure.ID, params); assertNotNull(result); assertEquals("[{\"total\":1,\"success\":0}]", result.getString()); result = (JSONBlob) service.run(ctx, WorkManagerRunWorkInFailure.ID, params); assertNotNull(result); assertEquals("[{\"total\":0,\"success\":0}]", result.getString()); }

Target:
public void testWorkManagerRunWorkInFailureOperation() throws Exception { Work failWork = new FailingWork(10); WorkManager wm = Framework.getService(WorkManager.class); wm.schedule(failWork); assertTrue(wm.awaitCompletion(2000, TimeUnit.MILLISECONDS)); Map<String, Serializable> params = new HashMap<>(); JSONBlob result = (JSONBlob) service.run(ctx, WorkManagerRunWorkInFailure.ID, params); assertNotNull(result); JSONAssert.assertEquals("{\"total\":1,\"success\":0}", result.getString(), true); result = (JSONBlob) service.run(ctx, WorkManagerRunWorkInFailure.ID, params); assertNotNull(result); JSONAssert.assertEquals("{\"total\":0,\"success\":0}", result.getString(), true); }
Source:
public void startLoading(final boolean forceLoad) { super.startLoading(forceLoad); initTabs(); currentInfo = null; if (currentWorker != null) { currentWorker.dispose(); } currentWorker = ExtractorHelper.getStreamInfo(serviceId, url, forceLoad) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((@NonNull StreamInfo result) -> { isLoading.set(false); if (result.getAgeLimit() != NO_AGE_LIMIT) { onError(new RestrictedVideoException()); } else { currentInfo = result; handleResult(result); showContent(); } }, (@NonNull Throwable throwable) -> { isLoading.set(false); onError(throwable); }); }

Target:
public void startLoading(final boolean forceLoad) { super.startLoading(forceLoad); initTabs(); currentInfo = null; if (currentWorker != null) { currentWorker.dispose(); } final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity); currentWorker = ExtractorHelper.getStreamInfo(serviceId, url, forceLoad) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((@NonNull final StreamInfo result) -> { isLoading.set(false); if (result.getAgeLimit() != NO_AGE_LIMIT && !prefs.getBoolean( getString(R.string.show_age_restricted_content), false)) { hideAgeRestrictedContent(); } else { currentInfo = result; handleResult(result); showContent(); } }, (@NonNull final Throwable throwable) -> { isLoading.set(false); onError(throwable); }); }
Source:
public boolean matches(Descriptor other) { if (!mode.equals(other.mode) || (argCount != other.argCount)) { return false; } for (int i = 0; i < argCount; i++) { if (!argTypes[i].isSameTypeOrFamily(other.argTypes[i])) { return false; } if (!exprTypes[i].equals(other.exprTypes[i])) { return false; } } if (unscaled != other.unscaled) { return false; } return true; }

Target:
public boolean matches(Descriptor other) { if (!mode.equals(other.mode) || (argCount != other.argCount)) { return false; } if (unscaled != other.unscaled) { return false; } for (int i = 0; i < argCount; i++) { if (!argTypes[i].isSameTypeOrFamily(other.argTypes[i])) { return false; } if (!exprTypes[i].equals(other.exprTypes[i])) { return false; } } return true; }
Source:
public void testUserPrivacyConsentNotRequired_UserConfigurationOverrideByRemoteParams() throws Exception { JSONObject remoteParams = new JSONObject(); remoteParams.put("requires_user_privacy_consent", false); ShadowOneSignalRestClient.setRemoteParamsGetHtmlResponse(remoteParams); OneSignal.setRequiresUserPrivacyConsent(true); OneSignalInit(); threadAndTaskWait(); assertFalse(OneSignal.requiresUserPrivacyConsent()); }

Target:
public void testUserPrivacyConsentNotRequired_UserConfigurationOverrideByRemoteParams() throws Exception { ShadowOneSignalRestClient.setRemoteParamsRequirePrivacyConsent(false); OneSignal.setRequiresUserPrivacyConsent(true); OneSignalInit(); threadAndTaskWait(); assertFalse(OneSignal.requiresUserPrivacyConsent()); }
Source:
public static ICElementHandle[] findAllDefinitions(IIndex index, IBinding binding) throws CoreException { if (binding != null) { IIndexName[] defs= index.findNames(binding, IIndex.FIND_DEFINITIONS | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES); Set<ICElementHandle> result = new HashSet<>(); for (IIndexName in : defs) { ICElementHandle definition= getCElementForName((ICProject) null, index, in); if (definition != null) { result.add(definition); } } return result.toArray(new ICElementHandle[result.size()]); } return EMPTY_ELEMENT_ARRAY; }

Target:
public static ICElementHandle[] findAllDefinitions(IIndex index, IBinding binding) throws CoreException { if (binding != null) { IIndexName[] defs= index.findNames(binding, IIndex.FIND_DEFINITIONS | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES); Set<ICElementHandle> result = new LinkedHashSet<>(); for (IIndexName in : defs) { ICElementHandle definition= getCElementForName((ICProject) null, index, in); if (definition != null) { result.add(definition); } } return result.toArray(new ICElementHandle[result.size()]); } return EMPTY_ELEMENT_ARRAY; }
Source:
public KubernetesLeaderElector( NamespacedKubernetesClient kubernetesClient, String namespace, KubernetesLeaderElectionConfiguration leaderConfig, LeaderCallbackHandler leaderCallbackHandler) { super(kubernetesClient, new LeaderElectionConfigBuilder() .withName(leaderConfig.getConfigMapName()) .withLeaseDuration(leaderConfig.getLeaseDuration()) .withLock(new ConfigMapLock(namespace, leaderConfig.getConfigMapName(), LOCK_IDENTITY)) .withRenewDeadline(leaderConfig.getRenewDeadline()) .withRetryPeriod(leaderConfig.getRetryPeriod()) .withLeaderCallbacks(new LeaderCallbacks( leaderCallbackHandler::isLeader, leaderCallbackHandler::notLeader, newLeader -> LOG.info("New leader elected {}.", newLeader) )) .build()); LOG.info("Create KubernetesLeaderElector with lock identity {}.", leaderConfig.getConfigMapName(), LOCK_IDENTITY); }

Target:
public KubernetesLeaderElector( NamespacedKubernetesClient kubernetesClient, String namespace, KubernetesLeaderElectionConfiguration leaderConfig, LeaderCallbackHandler leaderCallbackHandler) { final LeaderElectionConfig leaderElectionConfig = new LeaderElectionConfigBuilder() .withName(leaderConfig.getConfigMapName()) .withLeaseDuration(leaderConfig.getLeaseDuration()) .withLock(new ConfigMapLock(namespace, leaderConfig.getConfigMapName(), leaderConfig.getLockIdentity())) .withRenewDeadline(leaderConfig.getRenewDeadline()) .withRetryPeriod(leaderConfig.getRetryPeriod()) .withLeaderCallbacks(new LeaderCallbacks( leaderCallbackHandler::isLeader, leaderCallbackHandler::notLeader, newLeader -> LOG.info("New leader elected for {}.", newLeader, leaderConfig.getConfigMapName()) )) .build(); internalLeaderElector = new LeaderElector<>(kubernetesClient, leaderElectionConfig); LOG.info("Create KubernetesLeaderElector with lock identity {}.", leaderConfig.getConfigMapName(), leaderConfig.getLockIdentity()); }
Source:
public boolean accept(final ExecutableElement beanGetter, final MethodModel methodModel, final String contextType) { final Optional<DeclaredType> returnTypeOptional = collectionTypeReturnType(beanGetter); if (returnTypeOptional.isPresent()) { final DeclaredType x = returnTypeOptional.get(); final String uncheckedType = x.asElement().getSimpleName().toString(); final boolean isCollection = asList("Set", "List").contains(uncheckedType) && x.getTypeArguments().size() == 1; if (isCollection) { final DeclaredType declaredType = (DeclaredType) x.getTypeArguments().get(0); final TypeElement classInList = (TypeElement) declaredType.asElement(); final boolean isSphereEnumeration = classInList.getInterfaces().stream() .map(i -> (DeclaredType) i) .map(i -> (TypeElement) i.asElement()) .filter(i -> i.getQualifiedName().toString().equals(SphereEnumeration.class.getCanonicalName())).findFirst() .map(xs -> true).orElse(false); if (isSphereEnumeration) { final String typeParameterName = declaredType.asElement().getSimpleName().toString(); methodModel.setReturnType("SphereEnumerationCollectionQueryModel<" + contextType + ", " + typeParameterName + ">"); builder.addImport("io.sphere.sdk.queries.SphereEnumerationCollectionQueryModel"); return true; } } } return false; }

Target:
public boolean accept(final ExecutableElement beanGetter, final MethodModel methodModel, final String contextType) { final Optional<DeclaredType> returnTypeOptional = collectionTypeReturnType(beanGetter); if (returnTypeOptional.isPresent()) { final DeclaredType returnType = returnTypeOptional.get(); final DeclaredType declaredType = (DeclaredType) returnType.getTypeArguments().get(0); final TypeElement classInList = (TypeElement) declaredType.asElement(); if (isSphereEnumeration(classInList)) { applyEnumerationRule(methodModel, contextType, declaredType); return true; } } return false; }
Source:
public void testIsThreadActiveRange() { KernelAnalysisModule module = checkNotNull(fModule); final long start = 45L; final long end = 65L; Set<Integer> tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, start, end); assertNotNull(tids); assertEquals(ImmutableSet.of(11, 21, 30), tids); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 0, 0); assertTrue(tids.isEmpty()); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 123456789L, 1234567890L); assertTrue(tids.isEmpty()); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 0, 10L); assertNotNull(tids); assertTrue(tids.isEmpty()); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 70, 123456L); assertNotNull(tids); assertEquals(ImmutableSet.of(11, 20, 21), tids); }

Target:
public void testIsThreadActiveRange() { KernelAnalysisModule module = checkNotNull(fModule); final long start = 45L; final long end = 65L; Set<Integer> tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, start, end); assertEquals(ImmutableSet.of(11, 21, 30), tids); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 0, 0); assertTrue(tids.isEmpty()); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 123456789L, 1234567890L); assertTrue(tids.isEmpty()); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 0, 10L); assertTrue(tids.isEmpty()); tids = KernelThreadInformationProvider.getActiveThreadsForRange(module, 70, 123456L); assertEquals(ImmutableSet.of(11, 20, 21), tids); }
Source:
public void initialize(Analyzer analyzer) { if ( this.analyzer != null ) { throw new AssertionFailure( "An analyzer reference has been initialized more than once." ); } this.analyzer = analyzer; }

Target:
public void initialize(Analyzer analyzer) { if ( this.analyzer != null ) { throw new AssertionFailure( "An analyzer reference has been initialized more than once:" + this ); } this.analyzer = analyzer; }
Source:
public boolean accepts( Event<?> evt ) { return applicationStatusSource.getSystemStatus().isNexusStarted() && ( evt instanceof RepositoryRegistryRepositoryEvent ) || ( evt instanceof RepositoryConfigurationUpdatedEvent ); }

Target:
public boolean accepts( Event<?> evt ) { return ( ( evt instanceof RepositoryRegistryRepositoryEvent ) || ( evt instanceof RepositoryConfigurationUpdatedEvent ) ) && applicationStatusSource.getSystemStatus().isNexusStarted(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent launch_piano_activity = new Intent(SplashScreen.this, PianoActivity.class); startActivity(launch_piano_activity); finish(); } }, SPLASH_TIME_OUT); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent launchpianoactivity = new Intent(SplashScreen.this, PianoActivity.class); startActivity(launchpianoactivity); finish(); } }, SPLASH_TIME_OUT); }
Source:
public void testConnectionFailed() throws Exception { boolean expected = false; NettyClientBase client = null; try { int port = server.getListenAddress().getPort() + 1; RpcConnectionPool.RpcConnectionKey rpcConnectionKey = new RpcConnectionPool.RpcConnectionKey( RpcUtils.getConnectAddress(new InetSocketAddress("127.0.0.1", port)), DummyProtocol.class, false); client = new BlockingRpcClient(rpcConnectionKey, retries); client.close(); fail("Connection should be failed."); } catch (ConnectException ce) { expected = true; } catch (Throwable ce){ if (client != null) { client.close(); } fail(); } assertTrue(expected); }

Target:
public void testConnectionFailed() throws Exception { NettyClientBase client = null; try { int port = server.getListenAddress().getPort() + 1; RpcConnectionPool.RpcConnectionKey rpcConnectionKey = new RpcConnectionPool.RpcConnectionKey( RpcUtils.getConnectAddress(new InetSocketAddress("127.0.0.1", port)), DummyProtocol.class, false); client = new BlockingRpcClient(rpcConnectionKey, retries); assertFalse(client.acquire(RpcConnectionPool.DEFAULT_TIMEOUT)); client.close(); } catch (Throwable ce){ if (client != null) { client.close(); } fail(); } }
Source:
public Collection<String> call() throws JGitInternalException { checkCallable(); try { SubmoduleWalk generator = SubmoduleWalk.forIndex(repo); if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); List<String> initialized = new ArrayList<String>(); while (generator.next()) { if (generator.getConfigUrl() != null) continue; String path = generator.getPath(); String url = generator.getModulesUrl(); if (new URIish(url).getScheme() == null) { url = resolveRelativeModulePath(url); } String update = generator.getModulesUpdate(); if (url != null) config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_URL, url); if (update != null) config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_UPDATE, update); if (url != null || update != null) initialized.add(path); } if (!initialized.isEmpty()) config.save(); return initialized; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e); } catch (URISyntaxException e) { throw new JGitInternalException(e.getMessage(), e); } }

Target:
public Collection<String> call() throws JGitInternalException { checkCallable(); try { SubmoduleWalk generator = SubmoduleWalk.forIndex(repo); if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); List<String> initialized = new ArrayList<String>(); while (generator.next()) { if (generator.getConfigUrl() != null) continue; String path = generator.getPath(); String url = generator.getModulesUrl(); String update = generator.getModulesUpdate(); if (url != null) if (new URIish(url).getScheme() == null) url = resolveRelativeModulePath(url); config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_URL, url); if (update != null) config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_UPDATE, update); if (url != null || update != null) initialized.add(path); } if (!initialized.isEmpty()) config.save(); return initialized; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e); } catch (URISyntaxException e) { throw new JGitInternalException(e.getMessage(), e); } }
Source:
private static void addPlatformMappings( IgniteLogger log, List<Map<Integer, MappedName>> mappings, Function<Byte, ConcurrentMap<Integer, MappedName>> mappedCache, BiPredicate<MappedName, String> cacheAddPred, MarshallerMappingFileStore writer ) { if (mappings == null) return; for (byte platformId = 0; platformId < mappings.size(); platformId++) { Map<Integer, MappedName> attach = mappings.get(platformId); if (attach == null) return; ConcurrentMap<Integer, MappedName> cached = mappedCache.apply(platformId); for (Map.Entry<Integer, MappedName> e : attach.entrySet()) { Integer typeId = e.getKey(); String clsName = e.getValue().className(); if (cacheAddPred.test(cached.get(typeId), clsName)) { try { cached.put(typeId, new MappedName(clsName, true)); writer.mergeAndWriteMapping(platformId, typeId, clsName); } catch (IgniteCheckedException ex) { U.error(log, "Failed to write marshaller mapping data", ex); } } } } }

Target:
private static void addPlatformMappings( IgniteLogger log, List<Map<Integer, MappedName>> mappings, Function<Byte, ConcurrentMap<Integer, MappedName>> mappedCache, BiPredicate<MappedName, String> cacheAddPred, MarshallerMappingFileStore writer ) { if (mappings == null) return; for (byte platformId = 0; platformId < mappings.size(); platformId++) { Map<Integer, MappedName> attach = mappings.get(platformId); if (attach == null) continue; ConcurrentMap<Integer, MappedName> cached = mappedCache.apply(platformId); for (Map.Entry<Integer, MappedName> e : attach.entrySet()) { Integer typeId = e.getKey(); String clsName = e.getValue().className(); if (cacheAddPred.test(cached.get(typeId), clsName)) { try { cached.put(typeId, new MappedName(clsName, true)); writer.mergeAndWriteMapping(platformId, typeId, clsName); } catch (IgniteCheckedException ex) { U.error(log, "Failed to write marshaller mapping data", ex); } } } } }
Source:
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { LOG.trace("CXFSAMLCallbackHandler.handle begin"); for (final Callback callback : callbacks) { if (callback instanceof SAMLCallback) { try { final Message message = getCurrentMessage(); final Object obj = message.get("assertion"); AssertionType custAssertion; custAssertion = getCustAssertion(obj); final SAMLCallback oSAMLCallback = (SAMLCallback) callback; oSAMLCallback.setIssuerKeyName("gateway"); oSAMLCallback.setIssuerKeyPassword("changeit"); oSAMLCallback.setSignAssertion(true); oSAMLCallback.setSendKeyValue(true); issuerCrypto = CryptoFactory.getInstance("signature.properties"); oSAMLCallback.setIssuerCrypto(issuerCrypto); oSAMLCallback.setSamlVersion(Version.SAML_20); oSAMLCallback.setSignatureAlgorithm(SPConstants.SHA1); oSAMLCallback.setSignatureDigestAlgorithm(SPConstants.SHA1); final SamlTokenCreator creator = new SamlTokenCreator(); final CallbackProperties properties = new CallbackMapProperties(addMessageProperties( creator.createRequestContext(custAssertion, getResource(message), null), message)); oSAMLCallback.setAssertionElement(builder.build(properties)); } catch (final Exception e) { LOG.error("Failed to create saml: {}", e.getLocalizedMessage(), e); } } } LOG.trace("CXFSAMLCallbackHandler.handle end"); }

Target:
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { LOG.trace("CXFSAMLCallbackHandler.handle begin"); for (final Callback callback : callbacks) { if (callback instanceof SAMLCallback) { try { final Message message = getCurrentMessage(); final Object obj = message.get("assertion"); AssertionType custAssertion = getCustAssertion(obj); final SAMLCallback oSAMLCallback = (SAMLCallback) callback; oSAMLCallback.setIssuerKeyName("gateway"); oSAMLCallback.setIssuerKeyPassword("changeit"); oSAMLCallback.setSignAssertion(true); oSAMLCallback.setSendKeyValue(true); issuerCrypto = CryptoFactory.getInstance("signature.properties"); oSAMLCallback.setIssuerCrypto(issuerCrypto); oSAMLCallback.setSamlVersion(Version.SAML_20); oSAMLCallback.setSignatureAlgorithm(SPConstants.SHA1); oSAMLCallback.setSignatureDigestAlgorithm(SPConstants.SHA1); final SamlTokenCreator creator = new SamlTokenCreator(); final CallbackProperties properties = new CallbackMapProperties(addMessageProperties( creator.createRequestContext(custAssertion, getResource(message), null), message)); oSAMLCallback.setAssertionElement(builder.build(properties)); } catch (final Exception e) { LOG.error("Failed to create saml: {}", e.getLocalizedMessage(), e); } } } LOG.trace("CXFSAMLCallbackHandler.handle end"); }
Source:
public void loseLife(Player player) { fireEvent(new PlayerEvent(player, PlayerEvent.LIFE_LOST, "Lost a life")); player.loseLife(); if (!player.hasLives()) { endGame("Game over..."); } else { collisionHandler.removeCollidable(Model.getCurrentRoom() .getCollidables()); collisionHandler.removeCollidable(Model.getPlayers().get(0) .getRopes()); restartRoom(); player.setAlive(true); ArrayList<Player> players = Model.getPlayers(); for(Player otherPlayer: players) { if(!otherPlayer.equals(player)) { otherPlayer.loseLife(); } otherPlayer.setAlive(true); } } }

Target:
public void loseLife(Player player) { fireEvent(new PlayerEvent(player, PlayerEvent.LIFE_LOST, "Lost a life")); player.loseLife(); if (!player.hasLives()) { endGame("Game over..."); } else { collisionHandler.removeCollidable(Model.getCurrentRoom().getCollidables()); for(Player otherplayer: Model.getPlayers()) { collisionHandler.removeCollidable(otherplayer.getRopes()); } restartRoom(); player.setAlive(true); for(Player otherPlayer: Model.getPlayers()) { if(!otherPlayer.equals(player)) { otherPlayer.loseLife(); } otherPlayer.setAlive(true); } } }