auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Map<String, IPageTypeCategoryRole> getTypeNameToCategoryMapIncludeDeprecated() { loadTypeNameToCategoryMap(); ConcurrentMap<String, IPageTypeCategoryRole> completeMap = typeNameToCatCacheDeprecated; completeMap.putAll(typeNameToCatCache); return Collections.unmodifiableMap(completeMap); }

Target:
private Map<String, IPageTypeCategoryRole> getTypeNameToCategoryMapIncludeDeprecated() { loadTypeNameCategoryMaps(); return Collections.unmodifiableMap(typeNameToCatCacheDeprecated); }
Source:
public void testModifyTable() throws IOException { TableName tableName = sharedTestEnv.newTestTableName(); sharedTestEnv.createTable(tableName); try(Admin admin = getConnection().getAdmin(); Table table = getConnection().getTable(tableName)) { byte[] rowKey = dataHelper.randomData("testrow-"); byte[] qual = dataHelper.randomData("qual-"); byte[] value = dataHelper.randomData("value-"); Put put = new Put(rowKey); put.addColumn(COLUMN_FAMILY, qual, 1L, value); put.addColumn(COLUMN_FAMILY, qual, 2L, value); table.put(put); assertTrue(table.exists(new Get(rowKey))); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY2)); modifyTable(descriptor); assertTrue(admin.tableExists(tableName)); assertTrue(admin.getTableDescriptor(tableName).hasFamily(COLUMN_FAMILY2)); admin.disableTable(tableName); admin.deleteTable(tableName); } }

Target:
public void testModifyTable() throws IOException { TableName tableName = sharedTestEnv.newTestTableName(); sharedTestEnv.createTable(tableName); try(Admin admin = getConnection().getAdmin(); Table table = getConnection().getTable(tableName)) { HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY2)); modifyTable(descriptor); assertTrue(admin.tableExists(tableName)); assertTrue(admin.getTableDescriptor(tableName).hasFamily(COLUMN_FAMILY2)); assertEquals(1, admin.getTableDescriptor(tableName).getColumnFamilies().length); admin.disableTable(tableName); admin.deleteTable(tableName); } }
Source:
public void testVerifySignatureFailWhenSignatureDoesntMatch() { NotificationRequestSignatureVerifier impl = new NotificationRequestSignatureVerifier("someApiSecret"); boolean actual = impl.verifySignature( "{}", "0", "notMatchingForSure"); assertFalse(actual); }

Target:
public void testVerifySignatureFailWhenSignatureDoesntMatch() { NotificationRequestSignatureVerifier verifier = new NotificationRequestSignatureVerifier("someApiSecret"); boolean actual = verifier.verifySignature( "{}", "0", "notMatchingForSure"); assertFalse(actual); }
Source:
private void createRecoveryCommand(final UUID jobId) { RecoveryJob recoveryJob = new RecoveryJob(BulkJobType.PUT_BULK); recoveryJob.setBucketName(bucketName); recoveryJob.setId(jobId); recoveryJob.setNumberOfThreads(numberOfThreads); recoveryJob.setDirectory(inputDirectory); if(!Guard.isStringNullOrEmpty(prefix)) { recoveryJob.setPrefix(ImmutableList.of(prefix)); } if (!RecoveryFileManager.writeRecoveryJob(recoveryJob)) { LOG.info("Could not create recovery file in temporary space."); } }

Target:
private void createRecoveryCommand(final UUID jobId) { final RecoveryJob recoveryJob = new RecoveryJob(BulkJobType.PUT_BULK); recoveryJob.setBucketName(bucketName); recoveryJob.setId(jobId); recoveryJob.setNumberOfThreads(numberOfThreads); recoveryJob.setDirectory(inputDirectory); if(!Guard.isStringNullOrEmpty(prefix)) { recoveryJob.setPrefix(ImmutableList.of(prefix)); } if (!RecoveryFileManager.writeRecoveryJob(recoveryJob)) { LOG.info("Could not create recovery file in temporary space."); } }
Source:
private static void decodeObjectSecurity(Message message, Encrypt0Message enc) throws OSException { byte[] total = message.getOptions().getOscore(); byte flagByte = total[0]; int n = flagByte & 0x07; int k = flagByte & 0x08; int h = flagByte & 0xa6; byte[] partialIV = null; byte[] kid = null; int index = 1; if (n > 0) { try { partialIV = Arrays.copyOfRange(total, index, index + n); index += n; } catch (Exception e) { LOGGER.severe("Partial_IV is missing from message when it is expected."); throw new OSException(OSExceptionHandler.FAILED_TO_DECODE_COSE); } } if (h == 16) { int s = total[index]; index += 1; if (s > 0) { LOGGER.severe("Kidcontext is included, but it is not supported. We ignore it and continue processing."); } else { LOGGER.severe("Kid context is missing from message when it is expected."); throw new OSException(OSExceptionHandler.FAILED_TO_DECODE_COSE); } } if (k == 8) { kid = Arrays.copyOfRange(total, index, total.length); } else { if(message instanceof Request){ LOGGER.severe("Kid is missing from message when it is expected."); throw new OSException(OSExceptionHandler.FAILED_TO_DECODE_COSE); } } try { if (partialIV != null) enc.addAttribute(HeaderKeys.PARTIAL_IV, CBORObject.FromObject(partialIV), Attribute.UNPROTECTED); if (kid != null) enc.addAttribute(HeaderKeys.KID, CBORObject.FromObject(kid), Attribute.UNPROTECTED); } catch (CoseException e) { e.printStackTrace(); } }

Target:
private static void decodeObjectSecurity(Message message, Encrypt0Message enc) throws OSException { byte[] total = message.getOptions().getOscore(); byte flagByte = total[0]; int n = flagByte & 0x07; int k = flagByte & 0x08; int h = flagByte & 0xa6; byte[] partialIV = null; byte[] kid = null; int index = 1; if (n > 0) { try { partialIV = Arrays.copyOfRange(total, index, index + n); index += n; } catch (Exception e) { LOGGER.error("Partial_IV is missing from message when it is expected."); throw new OSException(Error.FAILED_TO_DECODE_COSE); } } if (h == 16) { int s = total[index]; index += 1; if (s > 0) { LOGGER.error("Kidcontext is included, but it is not supported. We ignore it and continue processing."); } else { LOGGER.error("Kid context is missing from message when it is expected."); throw new OSException(Error.FAILED_TO_DECODE_COSE); } } if (k == 8) { kid = Arrays.copyOfRange(total, index, total.length); } else { if (message instanceof Request) { LOGGER.error("Kid is missing from message when it is expected."); throw new OSException(Error.FAILED_TO_DECODE_COSE); } } try { if (partialIV != null) enc.addAttribute(HeaderKeys.PARTIAL_IV, CBORObject.FromObject(partialIV), Attribute.UNPROTECTED); if (kid != null) enc.addAttribute(HeaderKeys.KID, CBORObject.FromObject(kid), Attribute.UNPROTECTED); } catch (CoseException e) { e.printStackTrace(); } }
Source:
public URL getResource(String name, Iterable<String> bundleUrlsOrNameVersionString) { for (String bundleUrlOrNameVersionString: bundleUrlsOrNameVersionString) { try { String bundleNameVersion = bundleUrlToNameVersionString.get(bundleUrlOrNameVersionString); if (bundleNameVersion==null) { bundleNameVersion = bundleUrlOrNameVersionString; } Maybe<Bundle> bundle = Osgis.getBundle(framework, bundleNameVersion); if (bundle.isPresent()) { URL result = bundle.get().getResource(name); if (result!=null) return result; } } catch (Throwable e) { Exceptions.propagateIfFatal(e); } } return null; }

Target:
public URL getResource(String name, Iterable<String> bundleUrlsOrNameVersionString) { for (String bundleUrlOrNameVersionString: bundleUrlsOrNameVersionString) { try { String bundleNameVersion = bundleUrlToNameVersionString.get(bundleUrlOrNameVersionString); if (bundleNameVersion==null) { bundleNameVersion = bundleUrlOrNameVersionString; } Maybe<Bundle> bundle = Osgis.getBundle(framework, bundleNameVersion); if (bundle.isPresent()) { URL result = bundle.get().getResource(name); if (result!=null) return result; } } catch (Exception e) { Exceptions.propagateIfFatal(e); } } return null; }
Source:
public UnfoldEntityTraversal<Vertex, Vertex> unfold(User entity) { String storedUserId = Vertices.USER + ":" + UUID.randomUUID().toString(); EntityTraversal<Vertex, Vertex> userRoleTraversal = __.identity(); EntityTraversal<Vertex, Vertex> unfoldTraversal = __.identity(); if (entity.getNativeId() != null) { unfoldTraversal.V(entity.getNativeId()) .sideEffect(__.outE(Edges.USER_HAS_USER_ROLES).drop()); } for (UserRole userRole : entity.getRoles()) { userRoleTraversal = userRoleTraversal.V(userRole) .saveV(userRole.getUuid(), userRoleAdapter.unfold(userRole)); userRoleTraversal = userRoleTraversal.addE(Edges.USER_HAS_USER_ROLES) .from(__.<Vertex, Vertex>select(storedUserId).unfold()) .inV(); userRoleTraversal = userRoleTraversal.inE(Edges.USER_HAS_USER_ROLES).outV(); } unfoldTraversal = unfoldTraversal.map(unfoldUser(entity)) .store(storedUserId) .flatMap(userRoleTraversal) .fold() .map(t -> t.get().iterator().next()); return new UnfoldEntityTraversal<>(Vertices.USER, entity, unfoldTraversal); }

Target:
public UnfoldEntityTraversal<Vertex, Vertex> unfold(User entity) { String storedUserId = Vertices.USER + ":" + UUID.randomUUID().toString(); EntityTraversal<Vertex, Vertex> userRoleTraversal = __.identity(); EntityTraversal<Vertex, Vertex> unfoldTraversal = __.identity(); unfoldTraversal.sideEffect(__.outE(Edges.USER_HAS_SECURITY_ROLES).drop()); for (SecurityRole securityRole : entity.getRoles()) { userRoleTraversal = userRoleTraversal.V(securityRole) .saveV(securityRole.getUuid(), securityRoleAdapter.unfold(securityRole)); userRoleTraversal = userRoleTraversal.addE(Edges.USER_HAS_SECURITY_ROLES) .from(__.<Vertex, Vertex>select(storedUserId).unfold()) .inV(); userRoleTraversal = userRoleTraversal.inE(Edges.USER_HAS_SECURITY_ROLES).outV(); } unfoldTraversal = unfoldTraversal.map(unfoldUser(entity)) .store(storedUserId) .map(userRoleTraversal); return new UnfoldEntityTraversal<>(Vertices.USER, entity, unfoldTraversal); }
Source:
public boolean equals(Object o) { if (o instanceof PermissionSubject) { PermissionSubject other = (PermissionSubject) o; return Objects.equals(other.objectId, objectId) && Objects.equals(other.ObjectType, ObjectType) && Objects.equals(other.actionGroup, actionGroup); } return false; }

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof PermissionSubject) { PermissionSubject other = (PermissionSubject) o; return Objects.equals(other.objectId, objectId) && Objects.equals(other.ObjectType, ObjectType) && Objects.equals(other.actionGroup, actionGroup); } return false; }
Source:
public String createVolume(int sizeGB, String snapshotId) { IaasProvider iaasInfo = getIaasProvider(); ComputeServiceContext context = iaasInfo.getComputeService() .getContext(); String zone = ComputeServiceBuilderUtil.extractZone(iaasInfo); String diskOfferingID = iaasInfo.getTemplate().getOptions().as(CloudStackTemplateOptions.class) .getDiskOfferingId(); if (zone == null && diskOfferingID == null) { log.fatal("Cannot create a new volume in the , [zone] : " + zone + " of Iaas : " + iaasInfo); return null; } VolumeApi volumeApi = context.unwrapApi(CloudStackApi.class).getVolumeApi(); Volume volume; if (StringUtils.isEmpty(snapshotId)) { if (log.isDebugEnabled()) { log.info("Creating a volume in the zone " + zone); } volumeApi.createVolumeFromCustomDiskOfferingInZone(null, diskOfferingID, zone, sizeGB); } else { if (log.isDebugEnabled()) { log.info("Creating a volume in the zone " + zone + " from the snapshot " + snapshotId); } volumeApi.createVolumeFromSnapshotInZone(null, diskOfferingID, zone); } return null; }

Target:
public String createVolume(int sizeGB, String snapshotId) { IaasProvider iaasInfo = getIaasProvider(); ComputeServiceContext context = iaasInfo.getComputeService() .getContext(); String zone = ComputeServiceBuilderUtil.extractZone(iaasInfo); String diskOfferingID = iaasInfo.getTemplate().getOptions().as(CloudStackTemplateOptions.class) .getDiskOfferingId(); if (zone == null && diskOfferingID == null) { log.error("Could not create a volume in the , [zone] : " + zone + " of Iaas : " + iaasInfo); return null; } VolumeApi volumeApi = context.unwrapApi(CloudStackApi.class).getVolumeApi(); Volume volume; if (StringUtils.isEmpty(snapshotId)) { if (log.isInfoEnabled()) { log.info("Creating a volume in the zone " + zone); } volumeApi.createVolumeFromCustomDiskOfferingInZone(null, diskOfferingID, zone, sizeGB); } else { if (log.isInfoEnabled()) { log.info("Creating a volume in the zone " + zone + " from the snapshot " + snapshotId); } volumeApi.createVolumeFromSnapshotInZone(null, diskOfferingID, zone); } return null; }
Source:
public LinuxKDEWalletKeychainAccessImpl() { try { connection = DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION); } catch (DBusException e) { LOG.error(e.toString(), e.getCause()); } }

Target:
public LinuxKDEWalletKeychainAccessImpl() throws KeychainAccessException { try { connection = DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION); } catch (DBusException e) { LOG.error("Connecting to D-Bus failed:", e); throw new KeychainAccessException(e); } }
Source:
public Degree getDegree() { return ((DegreeUnit) getDelegateFunction().getFunction().getUnit()).getDegree(); }

Target:
protected Degree getDegree() { return ((DegreeUnit) getDelegateFunction().getFunction().getUnit()).getDegree(); }
Source:
public Object executeEvaluated(final VirtualFrame frame, final Object receiver) { SImmutableObject rcvr = (SImmutableObject) receiver; boolean allFieldsContainValues = allFieldsContainValues(rcvr); if (allFieldsContainValues) { return rcvr; } return thrower.execute(rcvr); }

Target:
public Object executeEvaluated(final VirtualFrame frame, final Object receiver) { SImmutableObject rcvr = (SImmutableObject) receiver; boolean allFieldsContainValues = allFieldsContainValues(rcvr); if (allFieldsContainValues) { return rcvr; } return notAValue.signal(rcvr); }
Source:
public void testGetReadOnlyColumn() { generator.registerColumn(pagedTable, callback,true); verify(generator, never()).getEditableColumn(pagedTable, callback); verify(generator).getReadOnlyColumn(); verify(translationService).getTranslation(FormRenderingConstants.EditableColumnGeneratorValueHeader); ArgumentCaptor<Column> columnArgumentCaptor = ArgumentCaptor.forClass(Column.class); verify(pagedTable).addColumn(columnArgumentCaptor.capture(), anyString()); Column column = columnArgumentCaptor.getValue(); assertNotNull(column); assertNull(column.getFieldUpdater()); }

Target:
public void testGetReadOnlyColumn() { testGetColumn(true); }
Source:
public DefaultLeaderElectionService(LeaderElectionDriverFactory leaderElectionDriverFactory) { this.leaderElectionDriverFactory = leaderElectionDriverFactory; leaderContender = null; issuedLeaderSessionID = null; confirmedLeaderSessionID = null; confirmedLeaderAddress = null; running = false; }

Target:
public DefaultLeaderElectionService(LeaderElectionDriverFactory leaderElectionDriverFactory) { this.leaderElectionDriverFactory = checkNotNull(leaderElectionDriverFactory); leaderContender = null; issuedLeaderSessionID = null; confirmedLeaderSessionID = null; confirmedLeaderAddress = null; running = false; }
Source:
private static int getSize(final String propertyKey, final int defaultValue) { final String propString = getProperty(propertyKey); if (propString != null) { return parseSize(propertyKey, propString); } else { return defaultValue; } }

Target:
private static int getSize(final String propertyKey, final int defaultValue) { final String propertyValue = getProperty(propertyKey); if (propertyValue != null) { final long sizeAsLong = parseSize(propertyKey, propertyValue); if (0 <= sizeAsLong && sizeAsLong <= Integer.MAX_VALUE) { return (int)sizeAsLong; } else { throw new ConfigurationException("Value " + sizeAsLong + " for property " + propertyKey + " is too large, must be " + 0 + " <= " + propertyKey + " <= " + Integer.MAX_VALUE); } } else { return defaultValue; } }
Source:
public void unfixLines(final Set<Integer> gids) { final List<Germplasm> listOfGermplasmWithGroup = this.germplasmDataManager.getGermplasmWithGroup(new ArrayList<Integer>(gids)); for (final Germplasm germplasm : listOfGermplasmWithGroup) { germplasm.setMgid(0); this.germplasmDAO.save(germplasm); } }

Target:
public void unfixLines(final Set<Integer> gids) { this.germplasmDAO.resetGermplasmGroup(new ArrayList<Integer>(gids)); }
Source:
private boolean isDraftPatchSet(PatchSet.Id id, ReviewDb db) throws OrmException { PatchSet ps = db.patchSets().get(id); if (ps == null) { return false; } return ps.isDraft(); }

Target:
private boolean isDraftPatchSet(PatchSet.Id id, ReviewDb db) throws OrmException { PatchSet ps = db.patchSets().get(id); if (ps == null) { throw new OrmException("PatchSet " + id + " not found in db"); } return ps.isDraft(); }
Source:
public static SimulationStopCode run() { isRunning = true; INSTANCE.database.addSystemEntry(Database.SystemEntryType.SIM_START); notifyChange(ExecutionState.EXECUTION_STARTED); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); while (!INSTANCE.executionAborted) { if (INSTANCE.checkTerminate()) return stop(SimulationStopCode.TERMINATE_CONDITION); if (INSTANCE.dptManager.checkDPT()) { notifyChange(ExecutionState.STATE_CHANGED); continue; } if (!INSTANCE.eventScheduler.haveEvents()) return stop(SimulationStopCode.NO_MORE_EVENTS); Event current = INSTANCE.eventScheduler.popEvent(); INSTANCE.time = current.getTime(); current.run(); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); } return stop(SimulationStopCode.USER_INTERRUPT); }

Target:
public static SimulationStopCode run() { isRunning = true; INSTANCE.database.addSystemEntry(Database.SystemEntryType.SIM_START); notifyChange(ExecutionState.EXECUTION_STARTED); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); while (!INSTANCE.executionAborted) { if (INSTANCE.checkTerminate()) return stop(SimulationStopCode.TERMINATE_CONDITION); if (INSTANCE.dptManager.checkDPT()) { notifyChange(ExecutionState.STATE_CHANGED); continue; } if (!INSTANCE.eventScheduler.haveEvents()) return stop(SimulationStopCode.NO_MORE_EVENTS); Event event = INSTANCE.eventScheduler.popEvent(); INSTANCE.time = event.getTime(); event.run(); notifyChange(ExecutionState.TIME_CHANGED); notifyChange(ExecutionState.STATE_CHANGED); } return stop(SimulationStopCode.USER_INTERRUPT); }
Source:
private void onEventSynchronous(CoreEvent event, ExecutorCallback executorCallback, Context ctx) { try { SdkInternalContext sdkInternalContext = from(event); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(getLocation()); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(getLocation()); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { sdkInternalContext.setOperationExecutionParams(getLocation(), configuration, parameters, operationEvent, callback); prepareAndExecuteOperation(event, () -> callback, ctx); }; operationExecutionFunction.execute(resolutionResult, event, executorCallback); } catch (Throwable t) { executorCallback.error(unwrap(t)); } }

Target:
private void onEventSynchronous(CoreEvent event, ExecutorCallback executorCallback, Context ctx) { try { SdkInternalContext sdkInternalContext = from(event); final ComponentLocation location = getLocation(); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(location); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(location); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { sdkInternalContext.setOperationExecutionParams(location, configuration, parameters, operationEvent, callback); prepareAndExecuteOperation(event, () -> callback, ctx); }; operationExecutionFunction.execute(resolutionResult, event, executorCallback); } catch (Throwable t) { executorCallback.error(unwrap(t)); } }
Source:
public final void moveTrack(final double dist) { synchronized (this) { for (int i = 0; i < entities.size(); i++) { if (i == player) { continue; } AbstractEntity entity = entities.get(i); moveEntity(entity, -dist); } int index = 0; if (index == player) { index++; } while (true) { if (index >= entities.size()) { break; } if (entities.get(index).getCenter().getZ() > GameScene.CAMERA_TRANS.getZ()) { break; } entities.remove(index); } } }

Target:
public final void moveTrack(final double dist) { synchronized (this) { for (int i = 0; i < entities.size(); i++) { if (i == player) { continue; } moveEntity(entities.get(i), -dist); } int index = 0; if (index == player) { index++; } while (true) { if (index >= entities.size()) { break; } if (entities.get(index).getCenter().getZ() > GameScene.CAMERA_TRANS.getZ()) { break; } entities.remove(index); } } }
Source:
public void set(JSONObject properties) { try { final JSONObject sendProperties = new JSONObject(); sendProperties.put("$android_lib_version", MPConfig.VERSION); sendProperties.put("$android_os", "Android"); sendProperties.put("$android_os_version", Build.VERSION.RELEASE == null ? "UNKNOWN" : Build.VERSION.RELEASE); sendProperties.put("$android_manufacturer", Build.MANUFACTURER == null ? "UNKNOWN" : Build.MANUFACTURER); sendProperties.put("$android_brand", Build.BRAND == null ? "UNKNOWN" : Build.BRAND); sendProperties.put("$android_model", Build.MODEL == null ? "UNKNOWN" : Build.MODEL); for (final Iterator<?> iter = properties.keys(); iter.hasNext();) { final String key = (String) iter.next(); sendProperties.put(key, properties.get(key)); } final JSONObject message = stdPeopleMessage("$set", sendProperties); recordPeopleMessage(message); } catch (final JSONException e) { Log.e(LOGTAG, "Exception setting people properties", e); } }

Target:
public void set(JSONObject properties) { try { final JSONObject sendProperties = new JSONObject(); sendProperties.put("$android_lib_version", MPConfig.VERSION); sendProperties.put("$android_os", "Android"); sendProperties.put("$android_os_version", Build.VERSION.RELEASE == null ? "UNKNOWN" : Build.VERSION.RELEASE); try { PackageManager manager = mContext.getPackageManager(); PackageInfo info = manager.getPackageInfo(mContext.getPackageName(), 0); sendProperties.put("$android_app_version", info.versionName); } catch (PackageManager.NameNotFoundException e) { Log.e(LOGTAG, "Exception getting app version name", e); } sendProperties.put("$android_manufacturer", Build.MANUFACTURER == null ? "UNKNOWN" : Build.MANUFACTURER); sendProperties.put("$android_brand", Build.BRAND == null ? "UNKNOWN" : Build.BRAND); sendProperties.put("$android_model", Build.MODEL == null ? "UNKNOWN" : Build.MODEL); for (final Iterator<?> iter = properties.keys(); iter.hasNext();) { final String key = (String) iter.next(); sendProperties.put(key, properties.get(key)); } final JSONObject message = stdPeopleMessage("$set", sendProperties); recordPeopleMessage(message); } catch (final JSONException e) { Log.e(LOGTAG, "Exception setting people properties", e); } }
Source:
public Attribute getAttributeById(PerunSession sess, Member member, Group group, int id) throws InternalErrorException, AttributeNotExistsException { try { return jdbc.queryForObject("select " + getAttributeMappingSelectQuery("mem") + " from attr_names " + "left join member_group_attr_values mem on id=mem.attr_id and mem.group_id=? and member_id=? " + "where id=?", new AttributeRowMapper(sess, this, member), group.getId(), member.getId(), id); } catch(EmptyResultDataAccessException ex) { throw new AttributeNotExistsException("Attribute id= \"" + id +"\"", ex); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public Attribute getAttributeById(PerunSession sess, Member member, Group group, int id) throws InternalErrorException, AttributeNotExistsException { try { return jdbc.queryForObject("select " + getAttributeMappingSelectQuery("mem_gr") + " from attr_names " + "left join member_group_attr_values mem_gr on id=mem_gr.attr_id and mem_gr.group_id=? and member_id=? " + "where id=?", new AttributeRowMapper(sess, this, member), group.getId(), member.getId(), id); } catch(EmptyResultDataAccessException ex) { throw new AttributeNotExistsException("Attribute id= \"" + id +"\"", ex); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
private void generateDotEclipseProduct(File target) throws MojoExecutionException { getLog().debug("Generating .eclipseproduct"); Properties props = new Properties(); setPropertyIfNotNull(props, "version", productConfiguration.getVersion()); setPropertyIfNotNull(props, "name", productConfiguration.getName()); setPropertyIfNotNull(props, "id", productConfiguration.getId()); File eclipseproduct = new File(target, ".eclipseproduct"); FileOutputStream fos = null; try { fos = new FileOutputStream(eclipseproduct); props.store(fos, "Eclipse Product File"); } catch (IOException e) { throw new MojoExecutionException("Error creating .eclipseproduct file.", e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { throw new MojoExecutionException("Error closing stream on .eclipseproduct file.", e); } } } }

Target:
private void generateDotEclipseProduct(File target) throws MojoExecutionException { getLog().debug("Generating .eclipseproduct"); Properties props = new Properties(); setPropertyIfNotNull(props, "version", productConfiguration.getVersion()); setPropertyIfNotNull(props, "name", productConfiguration.getName()); setPropertyIfNotNull(props, "id", productConfiguration.getId()); File eclipseproduct = new File(target, ".eclipseproduct"); FileOutputStream fos = null; try { fos = new FileOutputStream(eclipseproduct); props.store(fos, "Eclipse Product File"); } catch (IOException e) { throw new MojoExecutionException("Error creating .eclipseproduct file.", e); } finally { if (fos != null) { IOUtil.close(fos); } } }
Source:
public List<RedisClientDelegate> redisClientDelegates(ClientConfigurationWrapper redisClientConfigurations, Optional<List<RedisClientDelegate>> otherRedisClientDelegates) { List<RedisClientDelegate> clients = new ArrayList<>(); redisClientConfigurations.clients.forEach((name, config) -> { if (config.primary != null) { clients.add(createClient( RedisClientSelector.getName(true, name), config.primary.driver, config.primary.config, redisClientConfigurations )); } if (config.previous != null) { clients.add(createClient( RedisClientSelector.getName(false, name), config.previous.driver, config.previous.config, redisClientConfigurations )); } }); otherRedisClientDelegates.ifPresent(clients::addAll); return clients; }

Target:
public List<RedisClientDelegate> redisClientDelegates(ClientConfigurationWrapper redisClientConfigurations, Optional<List<RedisClientDelegate>> otherRedisClientDelegates) { List<RedisClientDelegate> clients = new ArrayList<>(); if (redisClientConfigurations.clients == null || redisClientConfigurations.clients.isEmpty()) { clients.add(createClient("primaryDefault", REDIS, new HashMap<>(), redisClientConfigurations)); } redisClientConfigurations.clients.forEach((name, config) -> { if (config.primary != null) { clients.add(createClient( RedisClientSelector.getName(true, name), config.primary.driver, config.primary.config, redisClientConfigurations )); } if (config.previous != null) { clients.add(createClient( RedisClientSelector.getName(false, name), config.previous.driver, config.previous.config, redisClientConfigurations )); } }); otherRedisClientDelegates.ifPresent(clients::addAll); return clients; }
Source:
private void start() { final long time = this.latency; final CopyOnWriteArraySet<BkTimeable.ThreadInfo> storage = this.threads; this.service.scheduleAtFixedRate( new Runnable() { @Override public void run() { for (final BkTimeable.ThreadInfo info : storage) { if (System.currentTimeMillis() - info.start > time) { if (info.thread.isAlive()) { info.thread.interrupt(); } storage.remove(info); } } } }, 0, BkTimeable.CHECK_INTERVAL, TimeUnit.MILLISECONDS ); }

Target:
private void start() { this.service.scheduleAtFixedRate( new Runnable() { @Override public void run() { for (final BkTimeable.ThreadInfo info : BkTimeable.this.threads) { if (System.currentTimeMillis() - info.start > BkTimeable.this.latency) { if (info.thread.isAlive() || info.alive) { info.thread.interrupt(); } BkTimeable.this.threads.remove(info); } } } }, 0, 100, TimeUnit.MILLISECONDS ); }
Source:
public static boolean start() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException { if (!new File(getPathSpec()).exists() || !new File(getPathFixture()).exists()) { return false; } if (process != null && isAlive(process)) { System.out.println(String.format("stripe-mock is already running, port = %d", port)); return true; } else { process = null; port = null; pid = null; } port = findAvailablePort(); ProcessBuilder processBuilder = new ProcessBuilder() .command( "stripe-mock", "-http-port", String.valueOf(port), "-spec", getPathSpec(), "-fixtures", getPathFixture() ); processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT); processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT); try { process = processBuilder.start(); } catch (IOException e) { System.out.println(String.format( "Error while starting stripe-mock, port = %d, fixtures = %s and %s, " + "error message = %s", port, getPathSpec(), getPathFixture(), e.getMessage() )); System.exit(1); } pid = getProcessId(process); Thread.sleep(1000); if (isAlive(process)) { System.out.println(String.format("Started stripe-mock, PID = %s", pid)); } else { System.out.println( String.format("stripe-mock terminated early, exit value = %d", process.exitValue())); System.exit(1); } return true; }

Target:
public static boolean start() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException { if (!new File(getPathSpec()).exists() || !new File(getPathFixture()).exists()) { return false; } if (process != null && isAlive(process)) { System.out.println(String.format("stripe-mock is already running, port = %s", port)); return true; } else { process = null; port = null; pid = null; } ProcessBuilder processBuilder = new ProcessBuilder() .command( "stripe-mock", "-http-port", "0", "-spec", getPathSpec(), "-fixtures", getPathFixture() ); try { process = processBuilder.start(); } catch (IOException e) { System.out.println(String.format( "Error while starting stripe-mock, fixtures = %s and %s, error message = %s", getPathSpec(), getPathFixture(), e.getMessage() )); System.exit(1); } pid = getProcessId(process); if (isAlive(process)) { System.out.println(String.format("Started stripe-mock, PID = %s", pid)); System.out.println("Finding port bound to stripe-mock..."); port = detectBoundPort(process); if (port == null) { System.out.println(String.format("Unable to find port for stripe-mock, PID = %s", pid)); System.exit(1); } } else { System.out.println( String.format("stripe-mock terminated early, exit value = %d", process.exitValue())); System.exit(1); } return true; }
Source:
public final String getCharset() { return charset; }

Target:
@CheckForNull final String getCharset() { return charset; }
Source:
public String getPathByName(String workspaceName, String workspaceNamespace) throws IOException { if (!isWindows && hostProjectsFolder != null) { return hostProjectsFolder; } try { Workspace workspace = workspaceDao.get(workspaceName, workspaceNamespace); return getPath(workspace.getId()); } catch (NotFoundException | ServerException e) { throw new IOException(e.getLocalizedMessage()); } }

Target:
String getPathByName(String workspaceName, String workspaceNamespace) throws IOException { if (!isWindows && singleMountPointForAllWorkspaces != null) { return singleMountPointForAllWorkspaces; } try { Workspace workspace = workspaceDao.get(workspaceName, workspaceNamespace); return getPath(workspace.getId()); } catch (NotFoundException | ServerException e) { throw new IOException(e.getLocalizedMessage()); } }
Source:
public void should_execute_query_and_not_log_server_side_warnings() { final String disabledLogFlag = System.getProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "false"); assertThat(disabledLogFlag).isEqualTo("false"); System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "true"); SimpleStatement statement = new SimpleStatement("SELECT count(*) FROM foo"); ResultSet rs = session().execute(statement); Row row = rs.one(); assertThat(row).isNotNull(); ExecutionInfo ei = rs.getExecutionInfo(); List<String> warnings = ei.getWarnings(); assertThat(warnings).isNotEmpty(); assertThat(warnings.size()).isEqualTo(1); assertThat(warnings.get(0)).isEqualTo("Aggregation query used without partition key"); String log = logAppender.getNext(); assertThat(log).isNullOrEmpty(); System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, disabledLogFlag); }

Target:
public void should_execute_query_and_not_log_server_side_warnings() { final String disabledLogFlag = System.getProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "false"); assertThat(disabledLogFlag).isEqualTo("false"); System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, "true"); try { SimpleStatement statement = new SimpleStatement("SELECT count(*) FROM foo"); ResultSet rs = session().execute(statement); Row row = rs.one(); assertThat(row).isNotNull(); ExecutionInfo ei = rs.getExecutionInfo(); List<String> warnings = ei.getWarnings(); assertThat(warnings).isNotEmpty(); assertThat(warnings.size()).isEqualTo(1); assertThat(warnings.get(0)).isEqualTo("Aggregation query used without partition key"); String log = logAppender.getNext(); assertThat(log).isNullOrEmpty(); } finally { System.setProperty(RequestHandler.DISABLE_QUERY_WARNING_LOGS, disabledLogFlag); } }
Source:
private boolean isFinalClass(Class clazz) { boolean isFinal = Modifier.isFinal(clazz.getModifiers()); if (!isFinal) { for (Method m : clazz.getMethods()) { if (clazz == m.getDeclaringClass()) { int mod = m.getModifiers(); if (Modifier.isFinal(mod) && !Modifier.isStatic(mod) && (Modifier.isPublic(mod) || Modifier.isProtected(mod))) { isFinal = true; break; } } } } return isFinal; }

Target:
private boolean isFinalClass(Class clazz) { boolean isFinal = Modifier.isFinal(clazz.getModifiers()); if (!isFinal) { for (Method m : clazz.getMethods()) { if (clazz == m.getDeclaringClass()) { int mod = m.getModifiers(); if (Modifier.isFinal(mod) && !Modifier.isStatic(mod) && !Modifier.isPrivate(mod)) { isFinal = true; break; } } } } return isFinal; }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final SecurityKey key = (SecurityKey) o; return Objects.equals(this.getDlmsDevice(), key.getDlmsDevice()) && Objects.equals(this.getSecurityKeyType(), key.getSecurityKeyType()) && Objects.equals(this.getValidFrom(), key.getValidFrom()); }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final SecurityKey compareKey = (SecurityKey) o; return Objects.equals(this.getDlmsDevice(), compareKey.getDlmsDevice()) && Objects.equals(this.getSecurityKeyType(), compareKey.getSecurityKeyType()) && Objects.equals(this.getValidFrom(), compareKey.getValidFrom()); }
Source:
private Optional<SqlCommandCall> parseCommand(String line) { final Optional<SqlCommandCall> parsedLine; try { parsedLine = SqlCommandParser.parse(executor.getSqlParser(sessionId), line); } catch (SqlExecutionException e) { printExecutionException(e); return Optional.empty(); } if (!parsedLine.isPresent()) { printError(CliStrings.MESSAGE_UNKNOWN_SQL); } return parsedLine; }

Target:
private Optional<SqlCommandCall> parseCommand(String line) { final SqlCommandCall parsedLine; try { parsedLine = SqlCommandParser.parse(executor.getSqlParser(sessionId), line); } catch (SqlExecutionException e) { printExecutionException(e); return Optional.empty(); } return Optional.of(parsedLine); }
Source:
public ByteBuffer toByteBuffer(int index, int length) { checkIndexLength(index, length); if (base instanceof byte[]) { return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length).slice(); } try { return (ByteBuffer) newByteBuffer.invokeExact(address + index, length, (Object) reference); } catch (Throwable throwable) { if (throwable instanceof Error) { throw (Error) throwable; } if (throwable instanceof RuntimeException) { throw (RuntimeException) throwable; } if (throwable instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new RuntimeException(throwable); } }

Target:
public ByteBuffer toByteBuffer(int index, int length) { checkIndexLength(index, length); if (base instanceof byte[]) { return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length).slice(); } if ((reference instanceof ByteBuffer) && ((ByteBuffer) reference).isDirect()) { ByteBuffer buffer = (ByteBuffer) reference; int position = toIntExact(address - bufferAddress(buffer)) + index; buffer = buffer.duplicate(); buffer.position(position); buffer.limit(position + length); return buffer.slice(); } throw new UnsupportedOperationException("Conversion to ByteBuffer not supported for this Slice"); }
Source:
public void release() { if (fileChannel != null) { try { fileChannel.close(); } catch (IOException e) { e.printStackTrace(); } } }

Target:
public void release() { if (raf != null) { try { raf.close(); } catch (IOException e) { logger.error("Close file " + this + " failed", e); } } }
Source:
public void testGetAllStoreSomeMatchLoaderNoMatchSomeFailWithBulkCacheLoadingException() throws Exception { final FakeStore fakeStore = new FakeStore(getEntryMap(KEY_SET_A, KEY_SET_B)); this.store = spy(fakeStore); final FakeCacheLoaderWriter fakeLoader = new FakeCacheLoaderWriter(getEntryMap(KEY_SET_F), KEY_SET_C, true); this.loaderWriter = spy(fakeLoader); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); final Set<String> fetchKeys = fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D); try { ehcache.getAll(fetchKeys); fail(); } catch (BulkCacheLoadingException e) { assertThat(e.getSuccesses(), Matchers.<Map<?,?>>equalTo(union(getEntryMap(KEY_SET_A), getNullEntryMap(KEY_SET_C)))); assertThat(e.getFailures().keySet(), Matchers.<Set<?>>equalTo(KEY_SET_D)); } verify(this.store).bulkComputeIfAbsent(eq(fetchKeys), getAnyIterableFunction()); verify(this.loaderWriter, atLeast(1)).loadAll(this.loadAllCaptor.capture()); assertThat(this.getLoadAllArgs(), equalTo(copyWithout(fetchKeys, KEY_SET_A))); verifyZeroInteractions(this.spiedResilienceStrategy); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }

Target:
public void testGetAllStoreSomeMatchLoaderNoMatchSomeFailWithBulkCacheLoadingException() throws Exception { final FakeStore fakeStore = new FakeStore(getEntryMap(KEY_SET_A, KEY_SET_B)); this.store = spy(fakeStore); final FakeCacheLoaderWriter fakeLoader = new FakeCacheLoaderWriter(TEST_ENTRIES, KEY_SET_D, true); this.loaderWriter = spy(fakeLoader); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); final Set<String> fetchKeys = fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D); try { ehcache.getAll(fetchKeys); fail(); } catch (BulkCacheLoadingException e) { assertThat(e.getSuccesses(), Matchers.<Map<?,?>>equalTo(union(getEntryMap(KEY_SET_A), getNullEntryMap(KEY_SET_C)))); assertThat(e.getFailures().keySet(), Matchers.<Set<?>>equalTo(KEY_SET_D)); } verify(this.store).bulkComputeIfAbsent(eq(fetchKeys), getAnyIterableFunction()); verify(this.loaderWriter, atLeast(1)).loadAll(this.loadAllCaptor.capture()); assertThat(this.getLoadAllArgs(), equalTo(copyWithout(fetchKeys, KEY_SET_A))); verifyZeroInteractions(this.spiedResilienceStrategy); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }
Source:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); ModelNode model = context.readResourceFromRoot(address).getModel(); if(model.has(CONTENT)) { contentRepository.removeContent(ModelContentReference.fromModelAddress(address, model.get(CONTENT).asBytes())); } super.execute(context, operation); }

Target:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); ModelNode model = context.readResourceFromRoot(address, false).getModel(); final byte[] hash; if (model.has(CONTENT)) { hash = model.get(CONTENT).asBytes(); } else { hash = null; } context.removeResource(PathAddress.EMPTY_ADDRESS); context.completeStep(new OperationContext.ResultHandler() { @Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction != OperationContext.ResultAction.ROLLBACK) { if (hash != null) { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); contentRepository.removeContent(ModelContentReference.fromModelAddress(address, hash)); } } } }); }
Source:
public String call(String serviceToCall, long serverStartTime) throws Exception { setState(); if (state == State.OPEN) { return "This is stale response from API"; } else { if (serviceToCall.equals("delayedService")) { DelayedService delayedService = new DelayedService(20); String response = delayedService.response(serverStartTime); if (response.split(" ")[3].equals("working")) { reset(); return response; } else { recordFailure(); throw new Exception("Remote service not responding"); } } else { throw new Exception("Unknown Service Name"); } } }

Target:
public String call(String serviceToCall, long serverStartTime) throws Exception { setState(); if (state == State.OPEN) { return "This is stale response from API"; } else { if (serviceToCall.equals("delayedService")) { var delayedService = new DelayedService(20); var response = delayedService.response(serverStartTime); if (response.split(" ")[3].equals("working")) { reset(); return response; } else { recordFailure(); throw new Exception("Remote service not responding"); } } else { throw new Exception("Unknown Service Name"); } } }
Source:
public Set<Integer> getCpusOfProcessors() { if(processors.isEmpty()) return ImmutableSet.of(); return Sets.newHashSet(Iterables.transform(processors, new Function<ContainerVirtualGuestConfigurationOption, Integer>() { @Override public Integer apply(ContainerVirtualGuestConfigurationOption input) { return input.getTemplate().getStartCpus(); } })); }

Target:
public Set<Integer> getCpusOfProcessors() { return Sets.newHashSet(Iterables.transform(processors, new Function<ContainerVirtualGuestConfigurationOption, Integer>() { @Override public Integer apply(ContainerVirtualGuestConfigurationOption input) { return input.getTemplate().getStartCpus(); } })); }
Source:
public void assertChangedResources(String[] expected) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); for (String file: expected) { assertTrue(changedResources.contains(root.findMember(file))); } assertTrue(changedResources.size()==expected.length); }

Target:
public void assertChangedResources(String[] expected) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); for (String file : expected) assertTrue(changedResources.contains(root.findMember(file))); assertTrue(changedResources.size() == expected.length); }
Source:
private TimeoutDuration processGetTimeout(Element parentElement, Node timeoutNode) { TimeoutDuration getTimeout; try { JAXBContext context = JAXBContext.newInstance(TimeType.class.getPackage().getName()); Unmarshaller unmarshaller = context.createUnmarshaller(); JAXBElement<TimeType> jaxbElement = unmarshaller.unmarshal(timeoutNode, TimeType.class); TimeType timeType = jaxbElement.getValue(); BigInteger amount = timeType.getValue(); if (amount.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) { throw new XmlConfigurationException( String.format("Value of XML configuration element <%s> in <%s> exceeds allowed value - %s", timeoutNode.getNodeName(), parentElement.getTagName(), amount)); } getTimeout = TimeoutDuration.of(amount.longValue(), toJavaTimeUnit(timeType.getUnit())); } catch (JAXBException e) { throw new XmlConfigurationException(e); } return getTimeout; }

Target:
private TimeoutDuration processGetTimeout(Element parentElement, Node timeoutNode) { TimeoutDuration getTimeout; try { JAXBContext context = JAXBContext.newInstance(TimeType.class.getPackage().getName()); Unmarshaller unmarshaller = context.createUnmarshaller(); JAXBElement<TimeType> jaxbElement = unmarshaller.unmarshal(timeoutNode, TimeType.class); TimeType timeType = jaxbElement.getValue(); BigInteger amount = timeType.getValue(); if (amount.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) { throw new XmlConfigurationException( String.format("Value of XML configuration element <%s> in <%s> exceeds allowed value - %s", timeoutNode.getNodeName(), parentElement.getTagName(), amount)); } getTimeout = TimeoutDuration.of(amount.longValue(), convertToJavaTimeUnit(timeType.getUnit())); } catch (JAXBException e) { throw new XmlConfigurationException(e); } return getTimeout; }
Source:
public void transmit(String remote, String button) { int repeats = 0; String[] parts = button.split(" "); if (parts.length > 1) { button = parts[0]; repeats = Integer.parseInt(parts[1]); } transmit(remote, button, repeats); }

Target:
public void transmit(String remote, String button) { int timesToSend = 1; String[] parts = button.split(" "); if (parts.length > 1) { button = parts[0]; timesToSend = Integer.parseInt(parts[1]); } transmit(remote, button, timesToSend); }
Source:
private <R extends PersistableBusinessObject> void writeResultDetailToReport(RassBusinessObjectUpdateResult<R> result) { String reportMessage = StringUtils.EMPTY; switch (result.getResultCode()) { case SUCCESS_NEW: reportMessage = result.getBusinessObjectClass().getSimpleName() + " #: " + result.getPrimaryKey() + " created by document #: " + result.getDocumentId(); break; case SUCCESS_EDIT: reportMessage = result.getBusinessObjectClass().getSimpleName() + " #: " + result.getPrimaryKey() + " updated by document #: " + result.getDocumentId(); break; case ERROR: reportMessage = result.getBusinessObjectClass().getSimpleName() + " #: " + result.getPrimaryKey() + " resulted in error. \n Error(s): " + result.getErrorMessage(); break; case SKIPPED: reportMessage = result.getBusinessObjectClass().getSimpleName() + " #: " + result.getPrimaryKey() + " skipped."; break; } reportWriterService.writeFormattedMessageLine(reportMessage); }

Target:
private <R extends PersistableBusinessObject> void writeResultDetailToReport(RassBusinessObjectUpdateResult<R> result) { String reportMessage; String messagePrefix = result.getBusinessObjectClass().getSimpleName() + " #: " + result.getPrimaryKey(); switch (result.getResultCode()) { case SUCCESS_NEW: reportMessage = messagePrefix + " created by document #: " + result.getDocumentId(); break; case SUCCESS_EDIT: reportMessage = messagePrefix + " updated by document #: " + result.getDocumentId(); break; case ERROR: reportMessage = messagePrefix + " resulted in error. \n Error(s): " + result.getErrorMessage(); break; case SKIPPED: reportMessage = messagePrefix + " skipped."; break; default: reportMessage = StringUtils.EMPTY; break; } reportWriterService.writeFormattedMessageLine(reportMessage); }
Source:
private void waitUntilNodeIsCleaned() throws NodeException { long timeout = PAResourceManagerProperties.RM_SELECT_SCRIPT_TIMEOUT.getValueAsLong(); int sleepTime = 100; int waitNumber = Math.round(((float) timeout) / sleepTime); try { int numberOfActiveObjects = node.getNumberOfActiveObjects(); int i = 0; while (numberOfActiveObjects > 0 && i < waitNumber) { Thread.sleep(sleepTime); i++; numberOfActiveObjects = node.getNumberOfActiveObjects(); } if (i >= waitNumber) { logger.error("Node " + nodeName + "could not be cleaned after " + timeout + " ms."); } } catch (InterruptedException e) { logger.warn("Interrupted while cleaning node " + nodeName, e); } }

Target:
private void waitUntilNodeIsCleaned() throws NodeException { long timeout = PAResourceManagerProperties.RM_SELECT_SCRIPT_TIMEOUT.getValueAsLong(); int sleepTime = 100; int maximumNumberOfWait = Math.round(((float) timeout) / sleepTime); try { int numberOfActiveObjects = node.getNumberOfActiveObjects(); int numberOfWait = 0; while (numberOfActiveObjects > 0 && numberOfWait < maximumNumberOfWait) { Thread.sleep(sleepTime); numberOfWait++; numberOfActiveObjects = node.getNumberOfActiveObjects(); } if (numberOfWait >= maximumNumberOfWait) { logger.error("Node " + nodeName + "could not be cleaned after " + timeout + " ms."); } } catch (InterruptedException e) { logger.warn("Interrupted while cleaning node " + nodeName, e); } }