auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Collision findWithMotion(Mover mover, Point start, Point motion, double part) { <START> Point wh = mover.getAABBDimensions(); <END> int steps = getSteps(mover, part, wh); if(steps == 0) { return new Collision(start, motion, false, null); } Point delta = motion.multiply(part).divide(steps); Collision collision = sweep(mover, start, null, delta, mover.getAABBDimensions(), mover.getMotion(), steps, 0); double newXLocation = Math.round(collision.getPoint().getX() * ONE_DEV_PRECISION) * PRECISION; double newYLocation = Math.round(collision.getPoint().getY() * ONE_DEV_PRECISION) * PRECISION; Point newLocation = new Point(newXLocation, newYLocation); newLocation = checkLevelBounds(mover, newLocation); return new Collision(newLocation, collision.getCurrent(), collision.isCollided(), collision.getCell()); }</code><technical_language>Please abbreviations <naming</technical_language>

Target:
public Collision findWithMotion(Mover mover, Point start, Point motion, double part) { Point widthHeight = mover.getAABBDimensions(); int steps = getSteps(mover, part, widthHeight); if(steps == 0) { return new Collision(start, motion, false, null); } Point delta = motion.multiply(part).divide(steps); Collision collision = sweep(start, null, delta, mover.getAABBDimensions(), mover.getMotion(), steps, 0); double newXLocation = Math.round(collision.getPoint().getX() * ONE_DEV_PRECISION) * PRECISION; double newYLocation = Math.round(collision.getPoint().getY() * ONE_DEV_PRECISION) * PRECISION; Point newLocation = new Point(newXLocation, newYLocation); newLocation = checkLevelBounds(mover, newLocation); return new Collision(newLocation, collision.getCurrent(), collision.isCollided(), collision.getCell()); }
Source:
<code>public String toString() { <START> return name().toLowerCase(); <END> }</code><technical_language>names in constructor (SKIP("skip")) modifying toString() accident break parsing</technical_language>

Target:
public String toString() { return name; }
Source:
<code>public void testGetUriByFilenameFindsAbsoluteResourceOnClasspath() throws Exception { final String filename = <START> "/" + PACKAGE_DIR_NAME + "/commonutil/Input" + SIMPLE_CLASS_NAME + "_empty_checks.xml"; <END> final URI uri = CommonUtil.getUriByFilename(filename); assertThat("URI is null for: " + filename, uri, is(not(nullValue()))); }</code><technical_language>this test extend AbstractPathTestSupport replace part of this getPackageLocation</technical_language>

Target:
public void testGetUriByFilenameFindsAbsoluteResourceOnClasspath() throws Exception { final String filename = "/" + getPackageLocation() + "/InputCommonUtilTest_empty_checks.xml"; final URI uri = CommonUtil.getUriByFilename(filename); assertThat("URI is null for: " + filename, uri, is(not(nullValue()))); }
Source:
<code>public void stop(String workspaceId) throws NotFoundException, ServerException, ConflictException { ensurePreDestroyIsNotExecuted(); acquireWriteLock(workspaceId); final WorkspaceRuntimeImpl runtime; try { ensurePreDestroyIsNotExecuted(); final RuntimeDescriptor descriptor = descriptors.get(workspaceId); if (descriptor == null) { throw new NotFoundException("Workspace with id '" + workspaceId + "' is not running."); } if (descriptor.getRuntimeStatus() != WorkspaceStatus.RUNNING) { <START> throw new ConflictException(format("Couldn't stop '%s' workspace because its status is '%s'. " + <END> "Workspace can be stopped only if it is 'RUNNING'", workspaceId, descriptor.getRuntimeStatus())); } descriptor.setRuntimeStatus(WorkspaceStatus.STOPPING); startQueues.remove(workspaceId); runtime = new WorkspaceRuntimeImpl(descriptor.getRuntime()); } finally { releaseWriteLock(workspaceId); } destroyRuntime(workspaceId, runtime); }</code><technical_language>String concatenation</technical_language>

Target:
public void stop(String workspaceId) throws NotFoundException, ServerException, ConflictException { ensurePreDestroyIsNotExecuted(); acquireWriteLock(workspaceId); final WorkspaceRuntimeImpl runtime; try { ensurePreDestroyIsNotExecuted(); final RuntimeDescriptor descriptor = descriptors.get(workspaceId); if (descriptor == null) { throw new NotFoundException("Workspace with id '" + workspaceId + "' is not running."); } if (descriptor.getRuntimeStatus() != WorkspaceStatus.RUNNING) { throw new ConflictException( format("Couldn't stop '%s' workspace because its status is '%s'. Workspace can be stopped only if it is 'RUNNING'", workspaceId, descriptor.getRuntimeStatus())); } descriptor.setRuntimeStatus(WorkspaceStatus.STOPPING); startQueues.remove(workspaceId); runtime = new WorkspaceRuntimeImpl(descriptor.getRuntime()); } finally { releaseWriteLock(workspaceId); } destroyRuntime(workspaceId, runtime); }
Source:
<code>public static void runFromServlet() { <START> isRunFromServlet.compareAndSet(false, true); <END> }</code><technical_language>If return of compareAndSet, set do fine</technical_language>

Target:
public static void runFromServlet() { isRunningFromServlet.set(true); }
Source:
<code>public void testCanStartAndStopAReplicaSet() { final MongoDBReplicaSet replicaSet = makeAndStartReplicaSet(3, "can-start-and-stop"); for (MongoDBServer s : replicaSet.getSecondaries()) { <START> System.err.println(s); <END> } }</code><technical_language>log syserr</technical_language>

Target:
public void testCanStartAndStopAReplicaSet() { final MongoDBReplicaSet replicaSet = makeAndStartReplicaSet(3, "can-start-and-stop"); replicaSet.stop(); assertFalse(replicaSet.getAttribute(Startable.SERVICE_UP)); }
Source:
<code>public void index(List<KObject> elements) { <START> elements.stream() <END> .forEach(ko -> this.index(ko)); }</code><technical_language>elements.stream().forEach(..) -> elements.forEach(..)</technical_language>

Target:
public void index(List<KObject> elements) { elements.forEach(ko -> this.index(ko)); }
Source:
<code>private void clear(final int noOfRecordsToKeep) { final String sqlTableName = this.dbHelper <START> .sanitizeSqlTableAndColumnName(this.wireRecordStoreOptions.getTableName()); <END> Connection conn = null; try { conn = this.dbHelper.getConnection(); final String catalog = conn.getCatalog(); final DatabaseMetaData dbMetaData = conn.getMetaData(); final ResultSet rsTbls = dbMetaData.getTables(catalog, null, this.wireRecordStoreOptions.getTableName(), TABLE_TYPE); if (rsTbls.next()) { if (noOfRecordsToKeep == 0) { logger.info(message.truncatingTable(sqlTableName)); this.dbHelper.execute(MessageFormat.format(SQL_TRUNCATE_TABLE, sqlTableName)); } else { this.dbHelper .execute(MessageFormat.format(SQL_DELETE_RANGE_TABLE, sqlTableName, noOfRecordsToKeep)); } } } catch (final SQLException sqlException) { logger.error(message.errorTruncatingTable(sqlTableName), sqlException); } finally { if (nonNull(conn)) { this.dbHelper.close(conn); } } }</code><technical_language>extract table name a local var</technical_language>

Target:
private void clear(final int noOfRecordsToKeep) { final String tableName = this.wireRecordStoreOptions.getTableName(); final String sqlTableName = this.dbHelper.sanitizeSqlTableAndColumnName(tableName); Connection conn = null; try { conn = this.dbHelper.getConnection(); final String catalog = conn.getCatalog(); final DatabaseMetaData dbMetaData = conn.getMetaData(); final ResultSet rsTbls = dbMetaData.getTables(catalog, null, tableName, TABLE_TYPE); if (rsTbls.next()) { if (noOfRecordsToKeep == 0) { logger.info(message.truncatingTable(sqlTableName)); this.dbHelper.execute(MessageFormat.format(SQL_TRUNCATE_TABLE, sqlTableName)); } else { this.dbHelper .execute(MessageFormat.format(SQL_DELETE_RANGE_TABLE, sqlTableName, noOfRecordsToKeep)); } } } catch (final SQLException sqlException) { logger.error(message.errorTruncatingTable(sqlTableName), sqlException); } finally { if (nonNull(conn)) { this.dbHelper.close(conn); } } }
Source:
<code>public WizardPage getRepositorySearchPage() throws CoreException { if (repositorySearchPageELement == null) return null; Object object = repositorySearchPageELement .createExecutableExtension("class"); WizardPage page = null; if (object instanceof WizardPage <START> && object instanceof IRepositorySearchResult) { <END> page = (WizardPage) object; } return page; }</code><technical_language>style nit: curly brackets</technical_language>

Target:
public WizardPage getRepositorySearchPage() throws CoreException { if (repositorySearchPageELement == null) return null; Object object = repositorySearchPageELement .createExecutableExtension("class"); WizardPage page = null; if (object instanceof WizardPage && object instanceof IRepositorySearchResult) page = (WizardPage) object; return page; }
Source:
<code>private void updateUndefinedSize() { assert !definedSize : "This method should never be called when using defined size"; int previousAssumedSize = assumedSize; if (resendEntireRange || sizeReset) { assumedSize = getRowCountEstimate(); } else { if (requestedRange.getEnd() + pageSize > assumedSize) { <START> assumedSize += getRowCountEstimateIncrease(); <END> } } getLogger(DataCommunicator.class).info( "Requested range: old size: new size: {}", requestedRange, previousAssumedSize, assumedSize); }</code><technical_language>if rowCountEstimateIncrease < pageSize? in case assumedSize requestedRange.getEnd() + pageSize, is fine</technical_language>

Target:
private void updateUndefinedSize() { assert !definedSize : "This method should never be called when using defined size"; int previousAssumedSize = assumedSize; if (resendEntireRange || sizeReset) { assumedSize = getRowCountEstimate(); } while (requestedRange.getEnd() + pageSize > assumedSize) { assumedSize += getRowCountEstimateIncrease(); } getLogger(DataCommunicator.class).info( "Requested range: old size: new size: {}", requestedRange, previousAssumedSize, assumedSize); }
Source:
<code>public void init() throws APIManagerIntegrationTestException { apiPublisher = new APIPublisherRestClient(publisherURL); <START> apiPublisher.login("admin", "admin"); <END> }</code><technical_language>Avoid admin credentials</technical_language>

Target:
public void init() throws Exception { createUsers(); apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login(APICreator, pw); }
Source:
<code>public boolean start() { if (stopping()) return false; try { if (!started.compareAndSet(false, true)) return false; tmpSnpDir = U.resolveWorkDirectory(tmpTaskWorkDir.getAbsolutePath(), databaseRelativePath(cctx.kernalContext().pdsFolderResolver().resolveFolders().folderName()), false); for (Integer grpId : parts.keySet()) { <START> CacheGroupContext gctx = cctx.cache().cacheGroup(grpId); <END> if (gctx == null) throw new IgniteCheckedException("Cache group context has not found. Cache group is stopped: " + grpId); if (!CU.isPersistentCache(gctx.config(), cctx.kernalContext().config().getDataStorageConfiguration())) throw new IgniteCheckedException("In-memory cache groups are not allowed to be snapshot: " + grpId); if (gctx.config().isEncryptionEnabled()) throw new IgniteCheckedException("Encrypted cache groups are not allowed to be snapshot: " + grpId); U.ensureDirectory(cacheWorkDir(tmpSnpDir, cacheDirName(gctx.config())), "directory for snapshotting cache group", log); } startedFut.listen(f -> ((GridCacheDatabaseSharedManager)cctx.database()).removeCheckpointListener(this) ); ((GridCacheDatabaseSharedManager)cctx.database()).addCheckpointListener(this); if (log.isInfoEnabled()) { log.info("Snapshot operation is scheduled on local node and will be handled by the checkpoint " + "listener [sctx=" + this + ", topVer=" + cctx.discovery().topologyVersionEx() + ']'); } } catch (IgniteCheckedException e) { acceptException(e); return false; } return true; }</code><technical_language>Cache context is absent some nodes (if NodeFilter used). I safer skip groups if find context for fail if partitions for groups ware requested explicitly. Also, cover this behavior test (check restore a snapshot)</technical_language>

Target:
public boolean start() { if (stopping()) return false; try { if (!started.compareAndSet(false, true)) return false; tmpConsIdDir = U.resolveWorkDirectory(tmpSnpWorkDir.getAbsolutePath(), databaseRelativePath(cctx.kernalContext().pdsFolderResolver().resolveFolders().folderName()), false); for (Integer grpId : parts.keySet()) { CacheGroupContext gctx = cctx.cache().cacheGroup(grpId); if (gctx == null) throw new IgniteCheckedException("Cache group context not found: " + grpId); if (!CU.isPersistentCache(gctx.config(), cctx.kernalContext().config().getDataStorageConfiguration())) throw new IgniteCheckedException("In-memory cache groups are not allowed to be snapshot: " + grpId); if (gctx.config().isEncryptionEnabled()) throw new IgniteCheckedException("Encrypted cache groups are not allowed to be snapshot: " + grpId); U.ensureDirectory(cacheWorkDir(tmpConsIdDir, cacheDirName(gctx.config())), "directory for snapshotting cache group", log); } startedFut.listen(f -> ((GridCacheDatabaseSharedManager)cctx.database()).removeCheckpointListener(this) ); ((GridCacheDatabaseSharedManager)cctx.database()).addCheckpointListener(this); if (log.isInfoEnabled()) { log.info("Snapshot operation is scheduled on local node and will be handled by the checkpoint " + "listener [sctx=" + this + ", topVer=" + cctx.discovery().topologyVersionEx() + ']'); } } catch (IgniteCheckedException e) { acceptException(e); return false; } return true; }
Source:
<code>protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { try { ob.reset(abvs); TaggedValuePointable tvp; TaggedValuePointable tempKey = ppool.takeOne(TaggedValuePointable.class); TaggedValuePointable tempValue = ppool.takeOne(TaggedValuePointable.class); tvp = args[0]; if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { tvp.getValue(seqp); int len = seqp.getEntryCount(); pointables = new TaggedValuePointable[len / 2]; for (int i = 0; i < len; i += 2) { seqp.getEntry(i, tempKey); seqp.getEntry(i + 1, tempValue); if (!isDuplicate(tempKey)) { pointables[i / 2] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); tempKey.getValue(pointables[i / 2]); sp.set(vp); ob.addItem(sp, tempValue); } else { throw new SystemException(ErrorCode.JNDY0003); } } <START> ppool.giveBack(tempKey); <END> ppool.giveBack(tempValue); } ob.finish(); result.set(abvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } }</code><technical_language>Move giveBack statement a try's finally block</technical_language>

Target:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp; TaggedValuePointable tempKey = ppool.takeOne(TaggedValuePointable.class); TaggedValuePointable tempValue = ppool.takeOne(TaggedValuePointable.class); try { ob.reset(abvs); tvp = args[0]; if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { tvp.getValue(seqp); int len = seqp.getEntryCount(); pointables = new TaggedValuePointable[len / 2]; for (int i = 0; i < len; i += 2) { seqp.getEntry(i, tempKey); seqp.getEntry(i + 1, tempValue); if (!isDuplicate(tempKey)) { pointables[i / 2] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); tempKey.getValue(pointables[i / 2]); sp.set(vp); ob.addItem(sp, tempValue); } else { throw new SystemException(ErrorCode.JNDY0003); } } } ob.finish(); result.set(abvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } finally { ppool.giveBack(tempKey); ppool.giveBack(tempValue); } }
Source:
<code>public Response getTiers( @DefaultValue("false") @QueryParam("discover") boolean discover ) { try { if (discover) { return Response.ok().entity(lookupCoordinatorManager.discoverTiers()).build(); } <START> final Map<String, Map<String, Map<String, Object>>> knownNamespaces = lookupCoordinatorManager.getKnownLookups(); <END> if (knownNamespaces == null) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.ok().entity(knownNamespaces.keySet()).build(); } } catch (Exception e) { LOG.error(e, "Error getting list of lookups"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } }</code><technical_language>rename knownLookups</technical_language>

Target:
public Response getTiers( @DefaultValue("false") @QueryParam("discover") boolean discover ) { try { if (discover) { return Response.ok().entity(lookupCoordinatorManager.discoverTiers()).build(); } final Map<String, Map<String, Map<String, Object>>> knownLookups = lookupCoordinatorManager.getKnownLookups(); if (knownLookups == null) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.ok().entity(knownLookups.keySet()).build(); } } catch (Exception e) { LOG.error(e, "Error getting list of lookups"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } }
Source:
<code>public void testConvertProfileEntryValueDto() { final ProfileEntryValue result = this.mapper.map(this.profileEntryDtoDate(), ProfileEntryValue.class); <START> Assert.assertTrue(result != null && result instanceof ProfileEntryValue); <END> }</code><technical_language>use: import static org.hamcrest.CoreMatchers.instanceOf; ... assertNotNull(result); assertThat(result, instanceOf(ClassName.class));</technical_language>

Target:
public void testConvertProfileEntryValueDto() { final ProfileEntryValue result = this.mapper.map(this.profileEntryDtoDate(), ProfileEntryValue.class); assertNotNull("mapping ProfileEntryValueDto should not return null", result); assertThat("mapping ProfileEntryValueDto should return correct type", result, instanceOf(ProfileEntryValue.class)); }
Source:
<code>public static void injectDruidProperties(Configuration configuration, List<String> listOfAllowedPrefix) { String mapJavaOpts = configuration.get(MRJobConfig.MAP_JAVA_OPTS); String reduceJavaOpts = configuration.get(MRJobConfig.REDUCE_JAVA_OPTS); for (String propName: System.getProperties().stringPropertyNames()){ for (String prefix : listOfAllowedPrefix) { if (propName.startsWith(prefix)) { mapJavaOpts = String.format("%s -D%s=%s", mapJavaOpts, propName, System.getProperty(propName)); reduceJavaOpts = String.format("%s -D%s=%s", reduceJavaOpts, propName, System.getProperty(propName)); <START> } <END> } } if (!Strings.isNullOrEmpty(mapJavaOpts)) { configuration.set(MRJobConfig.MAP_JAVA_OPTS, mapJavaOpts); } if (!Strings.isNullOrEmpty(reduceJavaOpts)) { configuration.set(MRJobConfig.REDUCE_JAVA_OPTS, reduceJavaOpts); } }</code><technical_language>put a break in if get a match add property multiple times if multiple prefixes match</technical_language>

Target:
public static void injectDruidProperties(Configuration configuration, List<String> listOfAllowedPrefix) { String mapJavaOpts = configuration.get(MRJobConfig.MAP_JAVA_OPTS); String reduceJavaOpts = configuration.get(MRJobConfig.REDUCE_JAVA_OPTS); for (String propName : System.getProperties().stringPropertyNames()) { for (String prefix : listOfAllowedPrefix) { if (propName.startsWith(prefix)) { mapJavaOpts = String.format("%s -D%s=%s", mapJavaOpts, propName, System.getProperty(propName)); reduceJavaOpts = String.format("%s -D%s=%s", reduceJavaOpts, propName, System.getProperty(propName)); break; } } } if (!Strings.isNullOrEmpty(mapJavaOpts)) { configuration.set(MRJobConfig.MAP_JAVA_OPTS, mapJavaOpts); } if (!Strings.isNullOrEmpty(reduceJavaOpts)) { configuration.set(MRJobConfig.REDUCE_JAVA_OPTS, reduceJavaOpts); } }
Source:
<code>public void consistentNormalBatchesAfterFullBatchesGravitatesTowardsInitialPause() { for (int i = 0; i < 20; i++) { delay.getNextPause(SUCCESS_TOO_SLOW); } for (int i = 0; i < 20; i++) { delay.getNextPause(SUCCESS); <START> } <END> long nextPause = delay.getNextPause(SUCCESS); assertThat(nextPause).isGreaterThanOrEqualTo((long) (INITIAL_DELAY * 0.95)); assertThat(nextPause).isLessThanOrEqualTo((long) (INITIAL_DELAY * 1.05)); }</code><technical_language>this point worth a sweepTwentyBatchesWithOutcome(long)</technical_language>

Target:
public void consistentNormalBatchesAfterFullBatchesGravitatesTowardsInitialPause() { sweepTwentyIterationsWithResult(SUCCESS_TOO_SLOW); sweepTwentyIterationsWithResult(SUCCESS); long nextPause = delay.getNextPause(SUCCESS); assertThat(nextPause).isGreaterThanOrEqualTo((long) (INITIAL_DELAY * 0.95)); assertThat(nextPause).isLessThanOrEqualTo((long) (INITIAL_DELAY * 1.05)); }
Source:
<code>protected String decryptBytes(@NonNull final Key key, @NonNull final byte[] bytes, @Nullable final DecryptBytesHandler handler) throws GeneralSecurityException, IOException { final Cipher cipher = getCachedInstance(); try (ByteArrayInputStream in = new ByteArrayInputStream(bytes); ByteArrayOutputStream output = new ByteArrayOutputStream()) { if (null != handler) { <START> handler.initialize(cipher, key, in); <END> } byte[] decryptedBytes = cipher.doFinal(bytes, IV.IV_LENGTH, bytes.length - IV.IV_LENGTH); return new String(decryptedBytes, UTF8); } catch (Throwable fail) { Log.w(LOG_TAG, fail.getMessage(), fail); throw fail; } }</code><technical_language>suggestion handler.initialize(cipher, key, bytes); decrypt process works byte arrays, change DecryptBytesHandler input a byte array, instead of input stream. This change requires DecryptBytesHandler interface input parameter changed byte[], require other changes parameter is passed overloaded methods handle byte arrays InputStreams</technical_language>

Target:
protected String decryptBytes(@NonNull final Key key, @NonNull final byte[] bytes, @Nullable final DecryptBytesHandler handler) throws GeneralSecurityException, IOException { final Cipher cipher = getCachedInstance(); try (ByteArrayInputStream in = new ByteArrayInputStream(bytes); ByteArrayOutputStream output = new ByteArrayOutputStream()) { if (null != handler) { handler.initialize(cipher, key, in); } try (CipherInputStream decrypt = new CipherInputStream(in, cipher)) { copy(decrypt, output); } return new String(output.toByteArray(), UTF8); } catch (Throwable fail) { Log.w(LOG_TAG, fail.getMessage(), fail); throw fail; } }
Source:
<code>public static void proceedLUNInDb(final LUNs lun, StorageType storageType, String volumeGroupId) { if (DbFacade.getInstance().getLunDao().get(lun.getLUN_id()) == null) { DbFacade.getInstance().getLunDao().save(lun); } else if (!volumeGroupId.isEmpty()){ <START> DbFacade.getInstance().getLunDao().updateLUNsVolumeGroupId(lun.getLUN_id(), volumeGroupId); <END> } for (storage_server_connections connection : lun.getLunConnections()) { List<storage_server_connections> connections = DbFacade.getInstance() .getStorageServerConnectionDao().getAllForConnection(connection); if (connections.isEmpty()) { connection.setid(Guid.NewGuid().toString()); connection.setstorage_type(storageType); DbFacade.getInstance().getStorageServerConnectionDao().save(connection); } else { connection.setid(connections.get(0).getid()); } if (DbFacade.getInstance() .getStorageServerConnectionLunMapDao() .get(new LUN_storage_server_connection_map_id(lun.getLUN_id(), connection.getid())) == null) { DbFacade.getInstance().getStorageServerConnectionLunMapDao().save( new LUN_storage_server_connection_map(lun.getLUN_id(), connection.getid())); } } }</code><technical_language>Consider refactoring DbFacade.getInstance().getLunDao() StorageHandlingCommandBase</technical_language>

Target:
public static void proceedLUNInDb(final LUNs lun, StorageType storageType, String volumeGroupId) { if (getLunDao().get(lun.getLUN_id()) == null) { getLunDao().save(lun); } else if (!volumeGroupId.isEmpty()){ getLunDao().updateLUNsVolumeGroupId(lun.getLUN_id(), volumeGroupId); } for (storage_server_connections connection : lun.getLunConnections()) { List<storage_server_connections> connections = DbFacade.getInstance() .getStorageServerConnectionDao().getAllForConnection(connection); if (connections.isEmpty()) { connection.setid(Guid.NewGuid().toString()); connection.setstorage_type(storageType); DbFacade.getInstance().getStorageServerConnectionDao().save(connection); } else { connection.setid(connections.get(0).getid()); } if (DbFacade.getInstance() .getStorageServerConnectionLunMapDao() .get(new LUN_storage_server_connection_map_id(lun.getLUN_id(), connection.getid())) == null) { DbFacade.getInstance().getStorageServerConnectionLunMapDao().save( new LUN_storage_server_connection_map(lun.getLUN_id(), connection.getid())); } } }
Source:
<code><START> public void pingReturnsErrorIfTheTargetServerIsNotAMember() throws IOException { <END> final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, Collections.singletonList(server1Port)); int notUsedPort = getRandomAvailableTCPPortsForDUnitSite(1)[0]; InternalDistributedMember fakeDistributedMember = new InternalDistributedMember("localhost", notUsedPort); client.invoke(() -> { PoolImpl poolImpl = (PoolImpl) PoolManager.find(poolName); assertThatThrownBy(() -> { PingOp.execute(poolImpl, new ServerLocation("localhost", server1Port), fakeDistributedMember); }).isInstanceOf(ServerOperationException.class) .hasMessageContaining("Unable to ping non-member"); }); }</code><technical_language>exception is thrown in method, removed</technical_language>

Target:
public void pingReturnsErrorIfTheTargetServerIsNotAMember() { final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, Collections.singletonList(server1Port)); int notUsedPort = getRandomAvailableTCPPortsForDUnitSite(1)[0]; InternalDistributedMember fakeDistributedMember = new InternalDistributedMember("localhost", notUsedPort); client.invoke(() -> { PoolImpl poolImpl = (PoolImpl) PoolManager.find(poolName); assertThatThrownBy(() -> { PingOp.execute(poolImpl, new ServerLocation("localhost", server1Port), fakeDistributedMember); }).isInstanceOf(ServerOperationException.class) .hasMessageContaining("Unable to ping non-member"); }); }
Source:
<code>@Override public Appendable write(Appendable appendable, Context context) throws IOException { String sep = ""; <START> for (TypeName className : typeNames) { <END> appendable.append(sep); className.write(appendable, context); sep = " & "; } return appendable; }</code><technical_language>I long loved Joiner's idiom for putting tokens in objects: <LINK_0></technical_language>

Target:
@Override public Appendable write(Appendable appendable, Context context) throws IOException { Iterator<TypeName> iterator = typeNames.iterator(); if (iterator.hasNext()) { iterator.next().write(appendable, context); while (iterator.hasNext()) { appendable.append(" & "); iterator.next().write(appendable, context); } } return appendable; }
Source:
<code>public static boolean validSegments(String[] value) { if (value == null) { return false; } for (String <START> element : <END> value) { if (!validSegment(element)) { return false; } } return true; }</code><technical_language>rename segment</technical_language>

Target:
public static boolean validSegments(String[] value) { if (value == null) { return false; } for (String segment : value) { if (!validSegment(segment)) { return false; } } return true; }
Source:
<code>void release(AssignableReplica assignableReplica) throws IllegalArgumentException { String resourceName = assignableReplica.getResourceName(); String partitionName = assignableReplica.getPartitionName(); if (!_currentAssignments.containsKey(resourceName)) { <START> _logger.warn("Resource " + resourceName + " is not on this node. Ignore the release call."); <END> return; } Set<String> partitions = _currentAssignments.get(resourceName); if (!partitions.contains(partitionName)) { _logger.warn(String .format("Resource %s does not have a replica from partition %s on this node", resourceName, partitionName)); return; } partitions.remove(assignableReplica.getPartitionName()); if (assignableReplica.isReplicaTopState()) { _currentTopStateAssignments.get(resourceName).remove(partitionName); } _totalReplicaAssignmentCount -= 1; _highestCapacityUtilization = 0; assignableReplica.getCapacity().entrySet().stream() .forEach(entry -> updateCapacityAndUtilization(entry.getKey(), -1 * entry.getValue())); }</code><technical_language>node</technical_language>

Target:
void release(AssignableReplica assignableReplica) throws IllegalArgumentException { String resourceName = assignableReplica.getResourceName(); String partitionName = assignableReplica.getPartitionName(); if (!_currentAssignments.containsKey(resourceName)) { LOG.warn("Resource is not on node {}. Ignore the release call.", resourceName, getInstanceName()); return; } Set<String> partitions = _currentAssignments.get(resourceName); if (!partitions.contains(partitionName)) { LOG.warn(String .format("Resource %s does not have a replica from partition %s on node %s", resourceName, partitionName, getInstanceName())); return; } partitions.remove(assignableReplica.getPartitionName()); if (assignableReplica.isReplicaTopState()) { _currentTopStateAssignments.get(resourceName).remove(partitionName); } _highestCapacityUtilization = 0; assignableReplica.getCapacity().entrySet().stream() .forEach(entry -> updateCapacityAndUtilization(entry.getKey(), -1 * entry.getValue())); }
Source:
<code>public ShovingMatch(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); <START> Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost()); <END> ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: Tap target creature.\"") ); }</code><technical_language>This necessary, I constructor I added defaults battlefield activated abilities battlefield anyway. matter, I figured mention it</technical_language>

Target:
public ShovingMatch(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: Tap target creature.\"") ); }
Source:
<code>public CompletableFuture<Void> loadInstalledMods() { try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(modsDirectory, entry -> Files.isDirectory(entry))) { for (Path path : directoryStream) { addMod(path); } } catch (IOException e) { logger.warn("Mods could not be read from: " + modsDirectory, e); } <START> return completedFuture(null); <END> }</code><technical_language>is need/benefit in returning a future execute asynchronous task</technical_language>

Target:
public void loadInstalledMods() { try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(modsDirectory, entry -> Files.isDirectory(entry))) { for (Path path : directoryStream) { addMod(path); } } catch (IOException e) { logger.warn("Mods could not be read from: " + modsDirectory, e); } }
Source:
<code>private IdpConfig(Parcel in) { mProviderId = in.readString(); mScopes = Collections.unmodifiableList(in.createStringArrayList()); <START> mParams = in.readBundle(); <END> }</code><technical_language>This in.readBundle(getClass().getClassLoader()) build pass. passing in strings right need this, ensure future proof (and lint happy)</technical_language>

Target:
private IdpConfig(Parcel in) { mProviderId = in.readString(); mScopes = Collections.unmodifiableList(in.createStringArrayList()); mParams = in.readBundle(getClass().getClassLoader()); }
Source:
<code>private static Strategy chooseStrategy(GraphDatabase graphDatabaseService) { Transaction tx = graphDatabaseService.beginTx(); try { <START> if (isAlreadyIndexed(graphDatabaseService)) return Strategy.Indexed; <END> if (isAlreadySubRef(graphDatabaseService)) return Strategy.SubRef; if (isAlreadyLabeled(graphDatabaseService)) return Strategy.Labeled; return Strategy.Indexed; } finally { tx.success();tx.finish(); } }</code><technical_language>delegate strategy for determining these</technical_language>

Target:
private static Strategy chooseStrategy(GraphDatabase graphDatabaseService) { try (Transaction tx = graphDatabaseService.beginTx()) { if (AbstractIndexBasedTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.Indexed; if (SubReferenceNodeTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.SubRef; if (LabelBasedNodeTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.Labeled; tx.success(); return Strategy.Labeled; } }
Source:
<code>private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(JsonReader.class); javaBuffer.addImport(List.class); javaBuffer.addImport(JsonException.class); javaBuffer.addLine("public static List<%1$s> readMany(JsonReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "while (reader.next() != <START> Event.START_ARRAY);"); <END> javaBuffer.addLine( "try {"); javaBuffer.addLine( "for (;;) {"); javaBuffer.addLine( "list.add(readOne(reader));"); javaBuffer.addLine( "}"); javaBuffer.addLine( "}"); javaBuffer.addLine( "catch (JsonException ex) {"); javaBuffer.addLine( " javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }</code><technical_language>is easy rest of method is part of this loop. Try braces, if body is empty: while (...) { // Empty purpose. }</technical_language>

Target:
private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(JsonReader.class); javaBuffer.addImport(List.class); javaBuffer.addImport(JsonException.class); javaBuffer.addImport(JsonParser.Event.class); javaBuffer.addImport(JsonParser.class); javaBuffer.addLine("public static List<%1$s> readMany(JsonReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "while (reader.next() != Event.START_ARRAY) {"); javaBuffer.addLine( " javaBuffer.addLine( "}"); javaBuffer.addLine(); javaBuffer.addLine( "boolean enumArrayEnd = false;"); javaBuffer.addLine( "while (!enumArrayEnd) {"); javaBuffer.addLine( "JsonParser.Event next = reader.next();"); javaBuffer.addLine( "switch (next) {"); javaBuffer.addLine( "case VALUE_STRING:"); javaBuffer.addLine( " String value = reader.getString();"); javaBuffer.addLine( " list.add(%1$s.fromValue(value));", typeName.getSimpleName()); javaBuffer.addLine( " break;"); javaBuffer.addLine( "case END_ARRAY:"); javaBuffer.addLine( " enumArrayEnd = true;"); javaBuffer.addLine( " break;"); javaBuffer.addLine( "default:"); javaBuffer.addLine( " reader.skip();"); javaBuffer.addLine( "}"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
<code>BibStractor(Class c) { BibRecordParser b = null; try { b = (BibRecordParser) c.newInstance(); } catch(Exception e) { log.info("Exception " + e.getStackTrace()); <START> } <END> recParser = b; }</code><technical_language>catch exceptions</technical_language>

Target:
BibStractor(Class c) { BibRecordParser b = null; try { b = (BibRecordParser) c.newInstance(); } catch(final Exception e) { log.warn("Exception while creating BibStractor", e); } recParser = b; }
Source:
<code>private void logBrickStatusChange(GlusterVolumeEntity volume, final GlusterBrickEntity brick, final GlusterStatus fetchedStatus) { log.debug("Detected that status of brick '{}' in volume '{}' changed from '{}' to '{}'", brick.getQualifiedName(), volume.getName(), brick.getStatus(), fetchedStatus); logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_CHANGED, new HashMap<String, String>() { { put(GlusterConstants.BRICK_PATH, brick.getQualifiedName()); put(GlusterConstants.OPTION_OLD_VALUE, brick.getStatus().toString()); put(GlusterConstants.OPTION_NEW_VALUE, fetchedStatus.toString()); <START> put("source", "cli"); <END> } }); if(fetchedStatus == GlusterStatus.DOWN){ logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_DOWN, brick.getId(), brick.getQualifiedName()); }else if(fetchedStatus == GlusterStatus.UP){ AlertDirector.removeAlertsByBrickIdLogType(brick.getId(), AuditLogType.GLUSTER_BRICK_STATUS_DOWN); } }</code><technical_language>declared in GlusterConstants</technical_language>

Target:
private void logBrickStatusChange(GlusterVolumeEntity volume, final GlusterBrickEntity brick, final GlusterStatus fetchedStatus) { log.debug("Detected that status of brick '{}' in volume '{}' changed from '{}' to '{}'", brick.getQualifiedName(), volume.getName(), brick.getStatus(), fetchedStatus); logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_CHANGED, new HashMap<String, String>() { { put(GlusterConstants.BRICK_PATH, brick.getQualifiedName()); put(GlusterConstants.OPTION_OLD_VALUE, brick.getStatus().toString()); put(GlusterConstants.OPTION_NEW_VALUE, fetchedStatus.toString()); put(GlusterConstants.SOURCE, GlusterConstants.SOURCE_CLI); } }); if(fetchedStatus == GlusterStatus.DOWN){ logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_DOWN, brick.getId(), brick.getQualifiedName()); }else if(fetchedStatus == GlusterStatus.UP){ AlertDirector.removeAlertsByBrickIdLogType(brick.getId(), AuditLogType.GLUSTER_BRICK_STATUS_DOWN); } }
Source:
<code>public void testInitAsyncPrettyPrinterForResponseWithRegisteredHeader() { NetworkEventReporter.InspectorResponse mockResponse = mock( <START> NetworkEventReporter.InspectorResponse.class); <END> when(mockResponse.requestId()).thenReturn(TEST_REQUEST_ID); when(mockResponse.headerCount()).thenReturn(1); when(mockResponse.headerName(0)).thenReturn(TEST_HEADER_NAME); when(mockResponse.headerValue(0)).thenReturn(TEST_HEADER_VALUE); NetworkEventReporterImpl.initAsyncPrettyPrinterForResponse(mockResponse, mNetworkPeerManager); verify(mResponseBodyFileManager, times(1)).associateAsyncPrettyPrinterWithId( eq(TEST_REQUEST_ID), any(AsyncPrettyPrinter.class) ); }</code><technical_language>types of simple interfaces poor candidates mock-style testing. Instead, consider making a TestInspectorResponse class returns dummy values. Simpler easier reason about</technical_language>

Target:
public void testInitAsyncPrettyPrinterForResponseWithRegisteredHeader() { ArrayList<String> headerNames = new ArrayList<String>(); ArrayList<String> headerValues = new ArrayList<String>(); headerNames.add(UNREGISTERED_HEADER_NAMES[0]); headerNames.add(UNREGISTERED_HEADER_NAMES[1]); headerNames.add(TEST_HEADER_NAME); headerValues.add(UNREGISTERED_HEADER_VALUES[0]); headerValues.add(UNREGISTERED_HEADER_VALUES[1]); headerValues.add(TEST_HEADER_VALUE); TestInspectorResponse testResponse = new TestInspectorResponse( headerNames, headerValues, TEST_REQUEST_ID ); NetworkEventReporterImpl.initAsyncPrettyPrinterForResponse( testResponse, mNetworkPeerManager); verify(mResponseBodyFileManager, times(1)).associateAsyncPrettyPrinterWithId( eq(TEST_REQUEST_ID), any(AsyncPrettyPrinter.class) ); }
Source:
<code>public NormalizedDateSegmentNameGenerator(String tableName, @Nullable String segmentNamePrefix, boolean excludeSequenceId, @Nullable String pushType, @Nullable String pushFrequency, @Nullable DateTimeFormatSpec dateTimeFormatSpec) { _segmentNamePrefix = segmentNamePrefix != null ? segmentNamePrefix.trim() : tableName; _excludeSequenceId = excludeSequenceId; _appendPushType = "APPEND".equalsIgnoreCase(pushType); END push type if (_appendPushType) { if ("HOURLY".equalsIgnoreCase(pushFrequency)) { _outputSDF = new SimpleDateFormat("yyyy-MM-dd-HH"); } else { _outputSDF = new SimpleDateFormat("yyyy-MM-dd"); } _outputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); Preconditions.checkNotNull(dateTimeFormatSpec); TimeFormat timeFormat = dateTimeFormatSpec.getTimeFormat(); <START> if (timeFormat.equals(TimeFormat.EPOCH)) { <END> _inputTimeUnit = dateTimeFormatSpec.getColumnUnit(); _inputSDF = null; } else { Preconditions.checkNotNull(dateTimeFormatSpec.getSDFPattern(), "Must provide pattern for SIMPLE_DATE_FORMAT"); _inputTimeUnit = null; _inputSDF = new SimpleDateFormat(dateTimeFormatSpec.getSDFPattern()); _inputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); } } else { _outputSDF = null; _inputTimeUnit = null; _inputSDF = null; } }</code><technical_language>suggestion if (timeFormat == TimeFormat.EPOCH) {</technical_language>

Target:
public NormalizedDateSegmentNameGenerator(String tableName, @Nullable String segmentNamePrefix, boolean excludeSequenceId, @Nullable String pushType, @Nullable String pushFrequency, @Nullable DateTimeFormatSpec dateTimeFormatSpec) { _segmentNamePrefix = segmentNamePrefix != null ? segmentNamePrefix.trim() : tableName; _excludeSequenceId = excludeSequenceId; _appendPushType = "APPEND".equalsIgnoreCase(pushType); END push type if (_appendPushType) { if ("HOURLY".equalsIgnoreCase(pushFrequency)) { _outputSDF = new SimpleDateFormat("yyyy-MM-dd-HH"); } else { _outputSDF = new SimpleDateFormat("yyyy-MM-dd"); } _outputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); Preconditions.checkNotNull(dateTimeFormatSpec); TimeFormat timeFormat = dateTimeFormatSpec.getTimeFormat(); if (timeFormat == TimeFormat.EPOCH) { _inputTimeUnit = dateTimeFormatSpec.getColumnUnit(); _inputSDF = null; } else { Preconditions.checkNotNull(dateTimeFormatSpec.getSDFPattern(), "Must provide pattern for SIMPLE_DATE_FORMAT"); _inputTimeUnit = null; _inputSDF = new SimpleDateFormat(dateTimeFormatSpec.getSDFPattern()); _inputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); } } else { _outputSDF = null; _inputTimeUnit = null; _inputSDF = null; } }
Source:
<code>public DiskStore create(String name) { this.attrs.name = name; DiskStore result; try { if (this.cache instanceof GemFireCacheImpl) { ((GemFireCacheImpl) this.cache).lockDiskStore(name); } result = findExisting(name); if (result == null) { if (this.cache instanceof GemFireCacheImpl) { TypeRegistry registry = this.cache.getPdxRegistry(); DiskStoreImpl dsi = new DiskStoreImpl(this.cache, this.attrs); result = dsi; this.cache.getInternalDistributedSystem() .handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi); initializeDiskStore(dsi); this.cache.addDiskStore(dsi); if (registry != null) { registry.creatingDiskStore(dsi); } } else if (this.cache instanceof CacheCreation) { CacheCreation creation = (CacheCreation) this.cache; result = new DiskStoreAttributesCreation(this.attrs); creation.addDiskStore(result); } } } finally { if (this.cache instanceof GemFireCacheImpl) { ((GemFireCacheImpl) this.cache).unlockDiskStore(name); <START> } <END> } if (this.cache instanceof GemFireCacheImpl) { BackupService backup = this.cache.getBackupService(); if (backup != null) { backup.waitForBackup(); } } return result; }</code><technical_language>methods lockDiskStore unlockDiskStore InternalCache interface instead?. cleaner need cast GemFireCacheImpl, besides that, methods in future other parts of code</technical_language>

Target:
public DiskStore create(String name) { this.attrs.name = name; DiskStore result; try { this.cache.lockDiskStore(name); result = findExisting(name); if (result == null) { if (this.cache instanceof GemFireCacheImpl) { TypeRegistry registry = this.cache.getPdxRegistry(); DiskStoreImpl dsi = new DiskStoreImpl(this.cache, this.attrs); result = dsi; this.cache.getInternalDistributedSystem() .handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi); initializeDiskStore(dsi); this.cache.addDiskStore(dsi); if (registry != null) { registry.creatingDiskStore(dsi); } } else if (this.cache instanceof CacheCreation) { CacheCreation creation = (CacheCreation) this.cache; result = new DiskStoreAttributesCreation(this.attrs); creation.addDiskStore(result); } } } finally { this.cache.unlockDiskStore(name); } if (this.cache instanceof GemFireCacheImpl) { BackupService backup = this.cache.getBackupService(); if (backup != null) { backup.waitForBackup(); } } return result; }
Source:
<code>public void onEvent(Event event) { Logger.Level level = event.getError() != null ? errorLevel : successLevel; if (logger.isEnabled(level)) { StringBuilder sb = new StringBuilder(); sb.append("type="); sb.append(event.getType()); sb.append(", realmId="); sb.append(event.getRealmId()); sb.append(", clientId="); sb.append(event.getClientId()); sb.append(", userId="); sb.append(event.getUserId()); sb.append(", ipAddress="); sb.append(event.getIpAddress()); if (event.getError() != null) { sb.append(", error="); sb.append(event.getError()); } if(event.getDetails().containsKey(Details.CLIENT_SESSION_STATE)) event.getDetails().remove(Details.CLIENT_SESSION_STATE); if(event.getDetails().containsKey(Details.CLIENT_SESSION_HOST)) <START> event.getDetails().containsKey(Details.CLIENT_SESSION_HOST); <END> if (event.getDetails() != null) { for (Map.Entry<String, String> e : event.getDetails().entrySet()) { sb.append(", "); sb.append(e.getKey()); if (e.getValue() == null || e.getValue().indexOf(' ') == -1) { sb.append("="); sb.append(e.getValue()); } else { sb.append("='"); sb.append(e.getValue()); sb.append("'"); } } } AuthenticationSessionModel authSession = session.getContext().getAuthenticationSession(); if(authSession!=null) { sb.append(", authSessionParentId="); sb.append(authSession.getParentSession().getId()); sb.append(", authSessionTabId="); sb.append(authSession.getTabId()); } if(logger.isTraceEnabled()) { setKeycloakContext(sb); } logger.log(logger.isTraceEnabled() ? Logger.Level.TRACE : level, sb.toString()); } }</code><technical_language>@HabooshHaddad event.getDetails().**remove**(Details.CLIENT_SESSION_HOST);</technical_language>

Target:
public void onEvent(Event event) { Logger.Level level = event.getError() != null ? errorLevel : successLevel; if (logger.isEnabled(level)) { StringBuilder sb = new StringBuilder(); sb.append("type="); sb.append(event.getType()); sb.append(", realmId="); sb.append(event.getRealmId()); sb.append(", clientId="); sb.append(event.getClientId()); sb.append(", userId="); sb.append(event.getUserId()); sb.append(", ipAddress="); sb.append(event.getIpAddress()); if (event.getError() != null) { sb.append(", error="); sb.append(event.getError()); } if(event.getDetails().containsKey(Details.CLIENT_SESSION_STATE)) event.getDetails().remove(Details.CLIENT_SESSION_STATE); if(event.getDetails().containsKey(Details.CLIENT_SESSION_HOST)) event.getDetails().remove(Details.CLIENT_SESSION_HOST); if (event.getDetails() != null) { for (Map.Entry<String, String> e : event.getDetails().entrySet()) { sb.append(", "); sb.append(e.getKey()); if (e.getValue() == null || e.getValue().indexOf(' ') == -1) { sb.append("="); sb.append(e.getValue()); } else { sb.append("='"); sb.append(e.getValue()); sb.append("'"); } } } AuthenticationSessionModel authSession = session.getContext().getAuthenticationSession(); if(authSession!=null) { sb.append(", authSessionParentId="); sb.append(authSession.getParentSession().getId()); sb.append(", authSessionTabId="); sb.append(authSession.getTabId()); } if(logger.isTraceEnabled()) { setKeycloakContext(sb); } logger.log(logger.isTraceEnabled() ? Logger.Level.TRACE : level, sb.toString()); } }
Source:
<code>public void multiWikiFinderTests_001_notExistingPagename() { SpecialUserLoginPageObject login = new SpecialUserLoginPageObject(driver); login.openWikiPage(); <START> login.loginAndVerify(Properties.userNameStaff, Properties.passwordStaff); <END> SpecialMultiWikiFinderPageObject multiWikiFinder = new SpecialMultiWikiFinderPageObject(driver); multiWikiFinder.openSpecialMultiWikiFinderPage(); multiWikiFinder.findPageName(multiWikiFinder.getTimeStamp()); multiWikiFinder.compareResultsCount(0); }</code><technical_language>SpecialMultiWikiFinderPageObject multiWikiFinder = new SpecialMultiWikiFinderPageObject(driver); multiWikiFinder.openSpecialMultiWikiFinderPage(String GLOBAL.DOMAIN); CommonFunction.loginCookie()</technical_language>

Target:
public void multiWikiFinderTests_001_notExistingPagename() { SpecialMultiWikiFinderPageObject multiWikiFinder = new SpecialMultiWikiFinderPageObject(driver); multiWikiFinder.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); multiWikiFinder.openSpecialMultiWikiFinderPage(wikiURL); multiWikiFinder.findPageName(multiWikiFinder.getTimeStamp()); multiWikiFinder.compareResultsCount(0); }