auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void processJobExecuteResponse(UUID nodeId, GridJobExecuteResponse msg) { assert nodeId != null; assert msg != null; lock.readLock(); try { GridTaskWorker<?, ?> task = tasks.get(msg.getSessionId()); if (stopping && !waiting) { U.warn(log, "Received job execution response while stopping grid (will ignore): " + msg + (task != null && task.getSession() != null ? (", " + task.getSession().getTaskName()) : "")); return; } if (task == null) { if (log.isDebugEnabled()) log.debug("Received job execution response for unknown task (was task already reduced?): " + msg); return; } if (log.isDebugEnabled()) log.debug("Received grid job response message [msg=" + msg + ", nodeId=" + nodeId + ']'); task.onResponse(msg); } finally { lock.readUnlock(); } }

Target:
public void processJobExecuteResponse(UUID nodeId, GridJobExecuteResponse msg) { assert nodeId != null; assert msg != null; lock.readLock(); try { GridTaskWorker<?, ?> task = tasks.get(msg.getSessionId()); if (stopping && !waiting) { U.warn(log, "Received job execution response while stopping grid (will ignore): " + msg + tryResolveTaskName(task)); return; } if (task == null) { if (log.isDebugEnabled()) log.debug("Received job execution response for unknown task (was task already reduced?): " + msg); return; } if (log.isDebugEnabled()) log.debug("Received grid job response message [msg=" + msg + ", nodeId=" + nodeId + ']'); task.onResponse(msg); } finally { lock.readUnlock(); } }
Source:
protected void after() { System.setOut(originalOut); System.setErr(originalErr); System.out.println("What was captured:"); System.out.println(out); }

Target:
protected void after() { System.setOut(originalOut); System.setErr(originalErr); }
Source:
public SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX()

Target:
public SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX() { super(); }
Source:
public void clientCallback(final ClientResponse response) throws Exception { byte status = response.getStatus(); if (status == ClientResponse.SUCCESS) { if (m_callbackExecutor != null && m_successCallback != null) { m_callbackExecutor.execute(new Runnable() { @Override public void run() { m_successCallback.success(m_csvLine, response); } }); } } else if (status != ClientResponse.CONNECTION_LOST){ m_failedCount.incrementAndGet(); m_errHandler.handleError(m_csvLine, response, response.getStatusString()); } long currentCount = m_processedCount.incrementAndGet(); if (currentCount % m_reportEveryNRows == 0) { m_log.info("Inserted " + (currentCount - m_failedCount.get()) + " rows"); } }

Target:
public void clientCallback(final ClientResponse response) throws Exception { byte status = response.getStatus(); if (status == ClientResponse.SUCCESS) { if (m_callbackExecutor != null && m_successCallback != null) { m_callbackExecutor.execute(new Runnable() { @Override public void run() { m_successCallback.success(m_csvLine, response); } }); } } else if (status == ClientResponse.CONNECTION_LOST && m_autoReconnect) { m_reinsertExecutor.execute(new Runnable() { @Override public void run() { try { insert(m_csvLine, m_values); } catch (InterruptedException e) { m_log.error("CSVLoader interrupted: " + e); } } }); return; } else { m_failedCount.incrementAndGet(); m_errHandler.handleError(m_csvLine, response, response.getStatusString()); } long currentCount = m_processedCount.incrementAndGet(); if (currentCount % m_reportEveryNRows == 0) { m_log.info("Inserted " + (currentCount - m_failedCount.get()) + " rows"); } }
Source:
static Properties attemptLoadAsResource(String propertiesFile, ClassLoader classLoader) { LOGGER.debug("Attempting to load properties as a resource: {}", propertiesFile); InputStream ins = PropertiesLoader.class.getResourceAsStream(propertiesFile); Properties properties = new Properties(); if (ins != null) { try { properties.load(ins); ins.close(); } catch (IOException e) { LOGGER.debug("Unable to load properties: {}", propertiesFile, e); properties.clear(); } finally { IOUtils.closeQuietly(ins); } } return properties; }

Target:
static Properties attemptLoadAsResource(String propertiesFile, ClassLoader classLoader) { LOGGER.debug("Attempting to load properties as a resource: {}", propertiesFile); InputStream ins = PropertiesLoader.class.getResourceAsStream(propertiesFile); Properties properties = new Properties(); if (ins != null) { try { properties.load(ins); } catch (IOException e) { LOGGER.debug("Unable to load properties: {}", propertiesFile, e); } finally { IOUtils.closeQuietly(ins); } } return properties; }
Source:
protected void validateCurrentPassword(UserVO user, String currentPassword) { AccountVO userAccount = _accountDao.findById(user.getAccountId()); boolean currentPasswordMatchesDataBasePassword = false; for (UserAuthenticator userAuthenticator : _userPasswordEncoders) { Pair<Boolean, ActionOnFailedAuthentication> authenticationResult = userAuthenticator.authenticate(user.getUsername(), currentPassword, userAccount.getDomainId(), null); if (authenticationResult == null) { s_logger.trace(String.format("Authenticator [%s] is returning null for the authenticate mehtod.", userAuthenticator.getClass())); continue; } if (BooleanUtils.toBoolean(authenticationResult.first())) { s_logger.debug(String.format("User [id=%s] re-authenticated [authenticator=%s] during password update.", user.getUuid(), userAuthenticator.getName())); currentPasswordMatchesDataBasePassword = true; break; } } if (!currentPasswordMatchesDataBasePassword) { throw new InvalidParameterValueException("Current password informed does not match the database password."); } }

Target:
protected void validateCurrentPassword(UserVO user, String currentPassword) { AccountVO userAccount = _accountDao.findById(user.getAccountId()); boolean currentPasswordMatchesDataBasePassword = false; for (UserAuthenticator userAuthenticator : _userPasswordEncoders) { Pair<Boolean, ActionOnFailedAuthentication> authenticationResult = userAuthenticator.authenticate(user.getUsername(), currentPassword, userAccount.getDomainId(), null); if (authenticationResult == null) { s_logger.trace(String.format("Authenticator [%s] is returning null for the authenticate mehtod.", userAuthenticator.getClass())); continue; } if (BooleanUtils.toBoolean(authenticationResult.first())) { s_logger.debug(String.format("User [id=%s] re-authenticated [authenticator=%s] during password update.", user.getUuid(), userAuthenticator.getName())); currentPasswordMatchesDataBasePassword = true; break; } } if (!currentPasswordMatchesDataBasePassword) { throw new InvalidParameterValueException("Current password is incorrect."); } }
Source:
public void setDataSources(List<DataSource> dataSources) { this.dataSources = dataSources; }

Target:
synchronized void setDataSources(List<DataSource> dataSources) { this.dataSources = dataSources; }
Source:
private boolean isUsedSlot(int dimIndex) { final int index = dimIndex / 8; final int extraIndex = dimIndex % 8; final int usedByte = 1 << extraIndex; return (usedFlagBuffer.get(index) & usedByte) == usedByte; }

Target:
private boolean isUsedSlot(int dimIndex) { final int index = dimIndex / Byte.SIZE; final int extraIndex = dimIndex % Byte.SIZE; final int usedFlagByte = 1 << extraIndex; return (usedFlagBuffer.get(index) & usedFlagByte) != 0; }
Source:
protected void configure() { Multibinder<RuntimeInfrastructure> infrastructures = Multibinder.newSetBinder(binder(), RuntimeInfrastructure.class); infrastructures.addBinding().to(OpenShiftInfrastructure.class); bind(InfrastructureProvisioner.class).to(OpenShiftInfrastructureProvisioner.class); bind(ConfigurationProvisioner.class).to(PersistentVolumeClaimProvisioner.class); install(new FactoryModuleBuilder().build(OpenShiftRuntimeContextFactory.class)); install(new FactoryModuleBuilder().build(OpenShiftRuntimeFactory.class)); install(new FactoryModuleBuilder().build(OpenShiftBootstrapperFactory.class)); }

Target:
protected void configure() { Multibinder<RuntimeInfrastructure> infrastructures = Multibinder.newSetBinder(binder(), RuntimeInfrastructure.class); infrastructures.addBinding().to(OpenShiftInfrastructure.class); install(new FactoryModuleBuilder().build(OpenShiftRuntimeContextFactory.class)); install(new FactoryModuleBuilder().build(OpenShiftRuntimeFactory.class)); install(new FactoryModuleBuilder().build(OpenShiftBootstrapperFactory.class)); }
Source:
public MoveToBlockAITask build(Creature owner) { Preconditions.checkNotNull(destinationPredicate); IMixinMoveToBlock aiTask = (IMixinMoveToBlock) (Object) new EntityAIMoveToBlock((EntityCreature) owner, this.speed, this.searchRange) { @Override protected boolean shouldMoveTo(net.minecraft.world.World worldIn, BlockPos pos) { return destinationPredicate.test(((World) worldIn).getLocation(pos.getX(), pos.getY(), pos.getZ())); } }; aiTask.setDestinationPredicate(destinationPredicate); return (MoveToBlockAITask) aiTask; }

Target:
public MoveToBlockAITask build(Creature owner) { Preconditions.checkNotNull(destinationPredicate); IMixinEntityAIMoveToBlock aiTask = (IMixinEntityAIMoveToBlock) (Object) new EntityAIMoveToBlock((EntityCreature) owner, this.speed, this.searchRange) { @Override protected boolean shouldMoveTo(net.minecraft.world.World worldIn, BlockPos pos) { return ((IMixinEntityAIMoveToBlock) (Object) this).getDestinationPredicate().test(((World) worldIn).getLocation(pos.getX(), pos.getY(), pos.getZ())); } }; aiTask.setDestinationPredicate(destinationPredicate); return (MoveToBlockAITask) aiTask; }
Source:
private void drawAxes() { GlyphLayout layout = getScaledFont(); batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(axes, -virtualWidthHalf, -AXIS_WIDTH / 2, virtualWidth, AXIS_WIDTH); batch.draw(axes, -AXIS_WIDTH / 2, -virtualHeightHalf, AXIS_WIDTH, virtualHeight); final float fontOffset = layout.height / 2; font.draw(batch, "-" + (int) virtualWidthHalf, -virtualWidthHalf + fontOffset, -fontOffset); font.draw(batch, String.valueOf((int) virtualWidthHalf), virtualWidthHalf - layout.width, -fontOffset); font.draw(batch, "-" + (int) virtualHeightHalf, fontOffset, -virtualHeightHalf + layout.height + fontOffset); font.draw(batch, String.valueOf((int) virtualHeightHalf), fontOffset, virtualHeightHalf - fontOffset); font.draw(batch, "0", fontOffset, -fontOffset); batch.end(); font.getData().setScale(1.2f); }

Target:
private void drawAxes() { GlyphLayout layout = getScaledFont(); batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(axes, -virtualWidthHalf, -AXIS_WIDTH / 2, virtualWidth, AXIS_WIDTH); batch.draw(axes, -AXIS_WIDTH / 2, -virtualHeightHalf, AXIS_WIDTH, virtualHeight); final float fontOffset = layout.height / 2; font.draw(batch, "-" + (int) virtualWidthHalf, -virtualWidthHalf + fontOffset, -fontOffset); font.draw(batch, String.valueOf((int) virtualWidthHalf), virtualWidthHalf - layout.width - fontOffset, -fontOffset); font.draw(batch, "-" + (int) virtualHeightHalf, fontOffset, -virtualHeightHalf + layout.height + fontOffset); font.draw(batch, String.valueOf((int) virtualHeightHalf), fontOffset, virtualHeightHalf - fontOffset); font.draw(batch, "0", fontOffset, -fontOffset); batch.end(); }
Source:
protected ExprEval eval(ExprEval param) { return eval(param, 0); }

Target:
private ExprEval eval(ExprEval param) { return eval(param, 0); }
Source:
private ZkClient getZkClient(String path) { checkClosedState(); String zkRealm = getZkRealm(path); ZkClient zkClient = _zkRealmToZkClientMap.get(zkRealm); if (zkClient == null) { synchronized (_zkRealmToZkClientMap) { checkClosedState(); if (!_zkRealmToZkClientMap.containsKey(zkRealm)) { zkClient = createZkClient(zkRealm); _zkRealmToZkClientMap.put(zkRealm, zkClient); } } } return zkClient; }

Target:
private ZkClient getZkClient(String path) { checkClosedState(); String zkRealm = getZkRealm(path); ZkClient zkClient = _zkRealmToZkClientMap.get(zkRealm); if (zkClient == null) { synchronized (_zkRealmToZkClientMap) { checkClosedState(); if (!_zkRealmToZkClientMap.containsKey(zkRealm)) { zkClient = createZkClient(zkRealm); _zkRealmToZkClientMap.put(zkRealm, zkClient); } else { zkClient = _zkRealmToZkClientMap.get(zkRealm); } } } return zkClient; }
Source:
public void returnedTextTest() { assertEquals("mode return label is incorrect", MODEL_STYLED_LABEL.getString(), labelProvider.getText(model)); assertEquals("simple class return label is incorrect", SIMPLE_CLASS_STYLED_LABEL.getString(), labelProvider.getText(simpleClass)); assertEquals("stereotyped Class return label is incorrect", STEREOTYPED_CLASS_STYLED_LABEL.getString(), labelProvider.getText(stereotypedClass)); assertEquals("empty comment return label is incorrect", EMPTY_COMMENT_STYLED_LABEL.getString(), labelProvider.getText(emptyCommment)); assertEquals("comment return label is incorrect", BODY_COMMENT_STYLED_LABEL.getString(), labelProvider.getText(commment)); labelProvider.setStylesList(types4templateParameterTest, Collections.<Styler> emptyList()); assertEquals("template signature return label is incorrect", TEMPLATE_SIGNATURE_STYLED_LABEL.getString(), labelProvider.getText(templateSignature)); assertEquals("template parameter return label is incorrect", TEMPLATE_PARAMETER_STYLED_LABEL.getString(), labelProvider.getText(templateParameter)); }

Target:
public void returnedTextTest() { assertEquals("model return label is incorrect", MODEL_STYLED_LABEL.getString(), labelProvider.getText(model)); assertEquals("simple class return label is incorrect", SIMPLE_CLASS_STYLED_LABEL.getString(), labelProvider.getText(simpleClass)); assertEquals("stereotyped Class return label is incorrect", STEREOTYPED_CLASS_STYLED_LABEL.getString(), labelProvider.getText(stereotypedClass)); assertEquals("empty comment return label is incorrect", EMPTY_COMMENT_STYLED_LABEL.getString(), labelProvider.getText(emptyCommment)); assertEquals("comment return label is incorrect", BODY_COMMENT_STYLED_LABEL.getString(), labelProvider.getText(commment)); labelProvider.setStylesList(types4templateParameterTest, Collections.<Styler> emptyList()); assertEquals("template signature return label is incorrect", TEMPLATE_SIGNATURE_STYLED_LABEL.getString(), labelProvider.getText(templateSignature)); assertEquals("template parameter return label is incorrect", TEMPLATE_PARAMETER_STYLED_LABEL.getString(), labelProvider.getText(templateParameter)); }
Source:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); ILttngUstEventLayout layout = getLayoutFromEnv(); fLayout = layout; ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder(); builder.addAll(LTTNG_UST_ASPECTS); if (checkFieldPresent(layout.contextVtid())) { builder.add(new ContextVtidAspect(layout)); } if (checkFieldPresent(layout.contextVpid())) { builder.add(new ContextVpidAspect(layout)); } if (getContainedEventTypes().stream().anyMatch(potentialEvent -> potentialEvent.getName().startsWith(layout.eventTraceFPrefix()))) { builder.add(UstTraceFAspect.INSTANCE); } builder.addAll(createCounterAspects(this)); fUstTraceAspects = builder.build(); }

Target:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); ILttngUstEventLayout layout = getLayoutFromEnv(); fLayout = layout; ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder(); builder.addAll(LTTNG_UST_ASPECTS); if (checkFieldPresent(layout.contextVtid())) { builder.add(new ContextVtidAspect(layout)); } if (checkFieldPresent(layout.contextVpid())) { builder.add(new ContextVpidAspect(layout)); } if (getContainedEventTypes().stream().anyMatch(potentialEvent -> potentialEvent.getName().startsWith(layout.eventTraceFPrefix()))) { builder.add(UstTraceFAspect.getInstance()); } builder.addAll(createCounterAspects(this)); fUstTraceAspects = builder.build(); }
Source:
private LRAStatus getExpectedStatus() { return compensate ? LRAStatus.Cancelled : LRAStatus.Closed; }

Target:
private ParticipantStatus getExpectedStatus() { return compensate ? ParticipantStatus.Compensated : ParticipantStatus.Completed; }
Source:
Database(CloudantClient client, CouchDatabase db) { super(); this.client = client; this.db = db; this.couchDbDesign = db.getDesignDocumentManager(); apiV2DBSecurityURI = buildUri(client.getBaseUri()).path("_api/v2/db/").path(db.getDbName ()).path("/_security").build(); }

Target:
Database(CloudantClient client, CouchDatabase db) { super(); this.client = client; this.db = db; apiV2DBSecurityURI = buildUri(client.getBaseUri()).path("_api/v2/db/").path(db.getDbName ()).path("/_security").build(); }
Source:
public void handleFirstChildExchange( List<IkePayload> reqPayloads, List<IkePayload> respPayloads, InetAddress localAddress, InetAddress remoteAddress, UdpEncapsulationSocket udpEncapSocket, IkeMacPrf ikePrf, byte[] skD) { this.mLocalAddress = localAddress; this.mRemoteAddress = remoteAddress; this.mUdpEncapSocket = udpEncapSocket; this.mIkePrf = ikePrf; this.mSkD = skD; IkeSaPayload saPayload = IkePayload.getPayloadForTypeInProvidedList( PAYLOAD_TYPE_SA, IkeSaPayload.class, respPayloads); if (saPayload != null) { int spi = registerProvisionalChildAndGetSpi(saPayload); sendMessage( CMD_HANDLE_FIRST_CHILD_EXCHANGE, new FirstChildNegotiationData(reqPayloads, respPayloads, spi)); } else { sendMessage( CMD_HANDLE_FIRST_CHILD_EXCHANGE, new FirstChildNegotiationData(reqPayloads, respPayloads)); } }

Target:
public void handleFirstChildExchange( List<IkePayload> reqPayloads, List<IkePayload> respPayloads, InetAddress localAddress, InetAddress remoteAddress, UdpEncapsulationSocket udpEncapSocket, IkeMacPrf ikePrf, byte[] skD) { this.mLocalAddress = localAddress; this.mRemoteAddress = remoteAddress; this.mUdpEncapSocket = udpEncapSocket; this.mIkePrf = ikePrf; this.mSkD = skD; int spi = registerProvisionalChildAndGetSpi(respPayloads); sendMessage( CMD_HANDLE_FIRST_CHILD_EXCHANGE, new FirstChildNegotiationData(reqPayloads, respPayloads, spi)); }
Source:
protected List<String> getErlFlags() { List<String> result; if (myConfiguration.isUseShortNames()) { result = new ArrayList<String>(ContainerUtil.list("-sname", getNodeName())); } else { String host = StringUtil.nullize(myConfiguration.getHost(), true); String qualifiedName = getNodeName() + "@" + (host == null ? getDefaultHost() : host); result = new ArrayList<String>(ContainerUtil.list("-name", qualifiedName)); } List<String> debugNodeArgs = Arrays.asList(myConfiguration.getDebugNodeArgs().split(" ")); result.addAll(debugNodeArgs); return result; }

Target:
protected List<String> getErlFlags() { if (myConfiguration.isUseShortNames()) { return ContainerUtil.concat(ContainerUtil.list("-sname", getNodeName()), ParametersListUtil.parse(myConfiguration.getDebugNodeArgs())); } String host = StringUtil.nullize(myConfiguration.getHost(), true); String qualifiedName = getNodeName() + "@" + (host == null ? getDefaultHost() : host); return ContainerUtil.concat(ContainerUtil.list("-name", qualifiedName), ParametersListUtil.parse(myConfiguration.getDebugNodeArgs())); }
Source:
private void getNumSuccessData(String series, LineGraph lineGraph) { Map<String, LineGraph.Data> data = new HashMap<>(); for (Map.Entry<String, SummaryStatistics> threadMethodEntry : mTimeToFirstByte.entrySet()) { String[] threadMethod = threadMethodEntry.getKey().split(",", 2); String prefix = series + ", method: " + threadMethod[1]; LineGraph.Data currentData = data.getOrDefault(prefix, new LineGraph.Data()); currentData.addData(Integer.valueOf(threadMethod[0]), threadMethodEntry.getValue().mNumSuccess); data.put(prefix, currentData); } for (Map.Entry<String, LineGraph.Data> entry : data.entrySet()) { lineGraph.addDataSeries(entry.getKey(), entry.getValue()); } }

Target:
private void getNumSuccessData(String series, LineGraph lineGraph) { Map<String, LineGraph.Data> data = new HashMap<>(); for (Map.Entry<Integer, Map<String, SummaryStatistics>> threadEntry : mTimeToFirstByte.entrySet()) { for (Map.Entry<String, SummaryStatistics> methodEntry : threadEntry.getValue().entrySet()) { String prefix = series + ", method: " + methodEntry.getKey(); LineGraph.Data currentData = data.getOrDefault(prefix, new LineGraph.Data()); currentData.addData(threadEntry.getKey(), methodEntry.getValue().mNumSuccess); data.put(prefix, currentData); } } for (Map.Entry<String, LineGraph.Data> entry : data.entrySet()) { lineGraph.addDataSeries(entry.getKey(), entry.getValue()); } }
Source:
private static boolean networkError(InternalDownloadBatchStatus downloadBatchStatus) { if (downloadBatchStatus.status() == DELETING) { Logger.v("abort networkError check because the batch " + downloadBatchStatus.getDownloadBatchId().rawId() + " is deleting"); return false; } DownloadBatchStatus.Status status = downloadBatchStatus.status(); if (status == WAITING_FOR_NETWORK) { return true; } else if (status == ERROR) { DownloadError downloadError = downloadBatchStatus.downloadError(); if (downloadError != null && downloadError.type() == DownloadError.Type.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE) { return true; } } return false; }

Target:
private static boolean networkError(InternalDownloadBatchStatus downloadBatchStatus) { if (downloadBatchStatus.status() == DELETING) { Logger.v("abort networkError check because the batch " + downloadBatchStatus.getDownloadBatchId().rawId() + " is deleting"); return false; } DownloadBatchStatus.Status status = downloadBatchStatus.status(); if (status == WAITING_FOR_NETWORK) { return true; } else if (status == ERROR) { DownloadError downloadError = downloadBatchStatus.downloadError(); return downloadError != null && downloadError.type() == DownloadError.Type.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE; } return false; }
Source:
static private void buildPredicatesAndValues(Domain nameDomain, List<String> values, List<String> predicates, String predicatePrefix) { if (nameDomain.isSingleValue()) { predicates.add(predicatePrefix + " = ?"); values.add(getStringValue(nameDomain.getSingleValue())); } else if (nameDomain.getValues() instanceof SortedRangeSet) { List<String> names = ((SortedRangeSet)nameDomain.getValues()).getOrderedRanges() .stream() .map(range-> getStringValue(range.getSingleValue())) .collect(toList()); values.addAll(names); StringBuffer tmp = new StringBuffer(); for(int i = 0; i<names.size(); i++){ tmp.append('?'); if(i != names.size() - 1) { tmp.append(','); } } predicates.add(predicatePrefix + " IN ( " + tmp.toString() + " )"); } }

Target:
private static void buildPredicatesAndValues(Domain nameDomain, List<String> values, List<String> predicates, String predicatePrefix) { List<String> names = nameDomain.getValues().getRanges().getOrderedRanges().stream() .filter(Range::isSingleValue) .map(range -> getStringValue(range.getSingleValue())) .collect(toList()); if (!names.isEmpty()) { values.addAll(names); String inClause = Joiner.on(",").join(nCopies(names.size(), "?")); predicates.add(format("%s IN (%s)", predicatePrefix, inClause)); } }
Source:
private AccountAttributes createAccountAttributesToSanitize() { String shortName = "<name>"; String personalEmail = "'toSanitize@email.com'"; String profileInstitute = ""; String nationality = "&\"invalid nationality &"; String gender = "'\"'other"; String moreInfo = "<<script> alert('hi!'); </script>"; String pictureKey = ""; return AccountAttributes.builder() .withGoogleId("googleId@gmail.com") .withName("'name'") .withInstitute("\\/") .withEmail("&<email>&") .withIsInstructor(true) .withStudentProfileAttributes(StudentProfileAttributes.builder("googleId@gmail.com") .withShortName(shortName) .withEmail(personalEmail) .withInstitute(profileInstitute) .withNationality(nationality) .withGender(gender) .withMoreInfo(moreInfo) .withPictureKey(pictureKey) .withModifiedDate(Instant.parse("2018-03-30T13:23:42.663Z")) .build()) .build(); }

Target:
private AccountAttributes createAccountAttributesToSanitize() { String shortName = "<name>"; String personalEmail = "'toSanitize@email.com'"; String profileInstitute = ""; String nationality = "&\"invalid nationality &"; String gender = "'\"'other"; String moreInfo = "<<script> alert('hi!'); </script>"; String pictureKey = ""; return AccountAttributes.builder() .withGoogleId("googleId@gmail.com") .withName("'name'") .withInstitute("\\/") .withEmail("&<email>&") .withIsInstructor(true) .withStudentProfileAttributes(StudentProfileAttributes.builder("googleId@gmail.com") .withShortName(shortName) .withEmail(personalEmail) .withInstitute(profileInstitute) .withNationality(nationality) .withGender(gender) .withMoreInfo(moreInfo) .withPictureKey(pictureKey) .withModifiedDate(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP) .build()) .build(); }
Source:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); OverlappedTiledWriter overlappedTiledWriter = new OverlappedTiledWriter(args[0], args[1], tileSizeX, tileSizeY); overlappedTiledWriter.initialize(); overlappedTiledWriter.readWriteTiles(); overlappedTiledWriter.cleanup(); }

Target:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); OverlappedTiledWriter overlappedTiledWriter = new OverlappedTiledWriter(args[0], args[1], tileSizeX, tileSizeY); overlappedTiledWriter.initialize(); try { overlappedTiledWriter.readWriteTiles(); } catch(Exception e) { System.err.println("Failed to read and write tiles."); e.printStackTrace(); throw e; } finally { overlappedTiledWriter.cleanup(); } }
Source:
List<MetricFamilySamples> fromGauge(String name, Gauge gauge) { Object obj = gauge.getValue(); Double value; if (obj instanceof Integer) { value = Double.valueOf(((Integer) obj).doubleValue()); } else if (obj instanceof Double) { value = (Double) obj; } else if (obj instanceof Float) { value = Double.valueOf(((Float) obj).doubleValue()); } else if (obj instanceof Long) { value = Double.valueOf(((Long) obj).doubleValue()); } else { LOGGER.warning(String.format("Invalid type for Gauge %s: %s", name, obj.getClass().getName())); return new ArrayList<MetricFamilySamples>(); } MetricFamilySamples.Sample sample = new MetricFamilySamples.Sample(name, new ArrayList<String>(), new ArrayList<String>(), value); return Arrays.asList(new MetricFamilySamples(name, Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(sample))); }

Target:
List<MetricFamilySamples> fromGauge(String name, Gauge gauge) { Object obj = gauge.getValue(); Double value; if (obj instanceof Integer) { value = Double.valueOf(((Integer) obj).doubleValue()); } else if (obj instanceof Double) { value = (Double) obj; } else if (obj instanceof Float) { value = Double.valueOf(((Float) obj).doubleValue()); } else if (obj instanceof Long) { value = Double.valueOf(((Long) obj).doubleValue()); } else { LOGGER.log(Level.FINE, String.format("Invalid type for Gauge %s: %s", name, obj.getClass().getName())); return new ArrayList<MetricFamilySamples>(); } MetricFamilySamples.Sample sample = new MetricFamilySamples.Sample(name, new ArrayList<String>(), new ArrayList<String>(), value); return Arrays.asList(new MetricFamilySamples(name, Type.GAUGE, getHelpMessage(name, gauge), Arrays.asList(sample))); }
Source:
public void testRegionIsFoundWithMafGreaterThan() { String chr = "11"; int start = 185000; int end = 190000; Region region = new Region(chr, start, end); List<Region> regions = new ArrayList<>(); regions.add(region); List<VariantEntityRepositoryFilter> filters = new FilterBuilder().withMaf(">0.125").build(); List<String> exclude = new ArrayList<>(); testFiltersHelperRegion(regions, filters, exclude, 43); }

Target:
public void testRegionIsFoundWithMafGreaterThan() { String chr = "11"; int start = 191000; int end = 193000; Region region = new Region(chr, start, end); List<Region> regions = new ArrayList<>(); regions.add(region); List<VariantEntityRepositoryFilter> filters = new FilterBuilder().withMaf(">0.125").build(); List<String> exclude = new ArrayList<>(); testFiltersHelperRegion(regions, filters, exclude, 13); }
Source:
@Override public Connection getConnection(String userName, String password) throws JMSException { Connection connection; if (cachedConnection == null) { connection = createConnection(userName, password); } else { connection = cachedConnection; } if (connection == null) { return null; } try { connection.start(); } catch (JMSException e) { if (cachedConnection != null) { resetCache(); getConnection(userName, password); } else { logger.error( "JMS Exception while starting connection for factory '" + this.connectionFactoryString + "' " + e.getMessage()); throw e; } } return connection; }

Target:
public Connection getConnection(String userName, String password) throws JMSException { Connection connection; if (cachedConnection == null) { connection = createConnection(userName, password); } else { connection = cachedConnection; } try { connection.start(); } catch (JMSException e) { if (cachedConnection != null) { resetCache(); getConnection(userName, password); } else { throw e; } } return connection; }
Source:
public static void assertPushed(DatastoreExtended datastore, CouchClient client) { logger.entering(DatabaseAssert.class.getCanonicalName(),"assertPushed",new Object[]{datastore,client}); Long start = System.currentTimeMillis(); Set<String> alreadyChecked = new HashSet<String>(); Changes changesBatch = datastore.changes(0, BATCH_LIMIT); while(changesBatch.size() > 0) { for (BasicDocumentRevision object : changesBatch.getResults()) { ChangeRowAdaptor adaptor = new ChangeRowAdaptor(object); if (alreadyChecked.contains(adaptor.id)) { continue; } DatabaseAssert.checkChangeRow(adaptor, client, datastore); alreadyChecked.add(adaptor.id); } changesBatch = datastore.changes(changesBatch.getLastSequence(), BATCH_LIMIT); } Long end = System.currentTimeMillis(); logger.finest(String.format("Done check took %1 seconds",(end - start)/1000.0)); }

Target:
public static void assertPushed(DatastoreExtended datastore, CouchClient client) { logger.entering("DatabaseAssert","assertPushed",new Object[]{datastore,client}); Long start = System.currentTimeMillis(); Set<String> alreadyChecked = new HashSet<String>(); Changes changesBatch = datastore.changes(0, BATCH_LIMIT); while(changesBatch.size() > 0) { for (BasicDocumentRevision object : changesBatch.getResults()) { ChangeRowAdaptor adaptor = new ChangeRowAdaptor(object); if (alreadyChecked.contains(adaptor.id)) { continue; } DatabaseAssert.checkChangeRow(adaptor, client, datastore); alreadyChecked.add(adaptor.id); } changesBatch = datastore.changes(changesBatch.getLastSequence(), BATCH_LIMIT); } Long end = System.currentTimeMillis(); logger.finest(String.format("Done check took %1 seconds",(end - start)/1000.0)); }
Source:
public void setIndentationFactor(int indentationFactor) { this.indentationFactor = indentationFactor; }

Target:
public CodeWriter setIndentationFactor(int indentationFactor) { this.indentationFactor = indentationFactor; return this; }
Source:
protected void handleSeal(Request request, ChannelHandlerContext ctx) { log.warn("handleSeal: Received SEAL request from client with " + "LSB: MSB:{}, " + "moving to new epoch {}", request.getHeader().getClientId().getLsb(), request.getHeader().getClientId().getMsb(), request.getSealRequest().getEpoch()); ByteBuf byteBuf = PooledByteBufAllocator.DEFAULT.buffer(); byteBuf.writeByte(0x2); byteBuf.writeBytes(API.newSealResponse(request.getHeader()).toByteArray()); ctx.writeAndFlush(byteBuf); }

Target:
protected synchronized void handleSeal(Request request, ChannelHandlerContext ctx) { log.warn("handleSeal: Received SEAL request from client with " + "LSB: MSB:{}, " + "moving to new epoch {}", request.getHeader().getClientId().getLsb(), request.getHeader().getClientId().getMsb(), request.getSealRequest().getEpoch()); ByteBuf byteBuf = PooledByteBufAllocator.DEFAULT.buffer(); byteBuf.writeByte(0x2); byteBuf.writeBytes(API.getSealResponse(request.getHeader()).toByteArray()); ctx.writeAndFlush(byteBuf); }
Source:
public void run() { while (running.get()) { try { if (!hardDelete(true)) { isCaughtUp = true; Thread.sleep(hardDeleterSleepTimeWhenCaughtUpMs); } else if (isCaughtUp) { isCaughtUp = false; logger.info("Resumed hard deletes for after having caught up", dataDir); } } catch (InterruptedException e) { logger.info("Caught interrupted exception"); } catch (Exception e) { logger.error("Caught exception: ", e); } } close(); }

Target:
public void run() { try { while (running.get()) { try { if (!hardDelete(true)) { isCaughtUp = true; Thread.sleep(hardDeleterSleepTimeWhenCaughtUpMs); } else if (isCaughtUp) { isCaughtUp = false; logger.info("Resumed hard deletes for after having caught up", dataDir); } } catch (InterruptedException e) { logger.info("Caught interrupted exception during hard delete", e); } catch (StoreException e) { logger.error("Caught store exception: ", e); } } } finally { close(); } }
Source:
private Map<String, Object> getVisitTypeColorCodes(VisitType visitType){ Map<String, Object> colorCode = new HashMap<String, Object>(); AdministrationService adminService = Context.getAdministrationService(); String propertyValue = adminService.getGlobalProperty(CoreAppsConstants.VISIT_TYPE_COLORS); try{ if(StringUtils.isNotEmpty(propertyValue)){ ArrayNode array = new ObjectMapper().readValue(propertyValue, ArrayNode.class); for (JsonNode node : array) { String visitTypeUuid= node.path("uuid").getTextValue(); if(visitType.getUuid().equalsIgnoreCase(visitTypeUuid)){ colorCode.put("uuid", visitTypeUuid); String color = node.path("color").getTextValue(); colorCode.put("color", color); String shortName = node.path("shortName").getTextValue(); colorCode.put("shortName", shortName); } } } } catch(IOException ex){ ex.printStackTrace(); } return colorCode; }

Target:
private Map<String, Object> getVisitTypeColorCodes(VisitType visitType){ Map<String, Object> colorCode = new HashMap<String, Object>(); AdministrationService adminService = Context.getAdministrationService(); String propertyValue = adminService.getGlobalProperty(CoreAppsConstants.VISIT_TYPE_COLORS); try{ if(StringUtils.isNotEmpty(propertyValue)){ ArrayNode array = new ObjectMapper().readValue(propertyValue, ArrayNode.class); for (JsonNode node : array) { String visitTypeUuid= node.path("uuid").getTextValue(); if(visitType.getUuid().equalsIgnoreCase(visitTypeUuid)){ colorCode.put("uuid", visitTypeUuid); String color = node.path("color").getTextValue(); colorCode.put("color", color); String shortName = node.path("shortName").getTextValue(); colorCode.put("shortName", shortName); } } } } catch(IOException ex){ LOG.error("Error retrieving visit type color codes, " + ex); } return colorCode; }
Source:
public CorfuRecordId enqueue(E e) { checkState(TransactionalContext.isInTransaction(), "must be called within a transaction!"); final CorfuRecordId id = new CorfuRecordId(0, guidGenerator.nextLong()); class QueueEntryAddressGetter implements PreCommitListener { private CorfuRecordId recordId; private QueueEntryAddressGetter(CorfuRecordId recordId) { this.recordId = recordId; } @Override public void preCommitCallback(TokenResponse tokenResponse) { recordId.setTxSequence(tokenResponse.getSequence()); log.trace("preCommitCallback for Queue: " + recordId.toString()); } } QueueEntryAddressGetter addressGetter = new QueueEntryAddressGetter(id); log.trace("enqueue: Adding preCommitListener for Queue: " + id.toString()); TransactionalContext.getRootContext().addPreCommitListener(addressGetter); corfuTable.put(id, e); return id; }

Target:
public CorfuRecordId enqueue(E e) { checkState(TransactionalContext.isInTransaction(), "must be called within a transaction!"); final CorfuRecordId id = new CorfuRecordId(0, guidGenerator.nextLong()); @AllArgsConstructor class QueueEntryAddressGetter implements PreCommitListener { private final CorfuRecordId recordId; @Override public void preCommitCallback(TokenResponse tokenResponse) { recordId.setTxSequence(tokenResponse.getSequence()); log.trace("preCommitCallback for Queue: " + recordId.toString()); } } QueueEntryAddressGetter addressGetter = new QueueEntryAddressGetter(id); log.trace("enqueue: Adding preCommitListener for Queue: " + id.toString()); TransactionalContext.getRootContext().addPreCommitListener(addressGetter); corfuTable.put(id, e); return id; }
Source:
public void load() { extraConfig.clear(); if (!configFile.exists()) { if (!configDir.isDirectory() && !configDir.mkdirs()) { GlowServer.logger.severe("Cannot create directory: " + configDir); return; } createDefaultConfig(configFile); return; } try { config.load(configFile); } catch (IOException e) { GlowServer.logger.log(Level.SEVERE, "Failed to read config: " + configFile, e); } catch (InvalidConfigurationException e) { report(configFile, e); } if (migrate()) { try { config.save(configFile); } catch (IOException e) { GlowServer.logger.log(Level.SEVERE, "Failed to write config: " + configFile, e); return; } GlowServer.logger.info("Migrated configuration from CraftBukkit"); } }

Target:
public void load() { extraConfig.clear(); boolean changed = false; if (!configFile.exists()) { GlowServer.logger.info("Creating default config: " + configFile); if (!configDir.isDirectory() && !configDir.mkdirs()) { GlowServer.logger.severe("Cannot create directory: " + configDir); return; } for (Key key : Key.values()) { config.set(key.path, key.def); } if (migrate()) { GlowServer.logger.info("Migrated configuration from previous installation"); } changed = true; } else { try { config.load(configFile); } catch (IOException e) { GlowServer.logger.log(Level.SEVERE, "Failed to read config: " + configFile, e); } catch (InvalidConfigurationException e) { report(configFile, e); } for (Key key : Key.values()) { if (!config.contains(key.path)) { config.set(key.path, key.def); changed = true; } } } if (changed) { save(); } }
Source:
private boolean hasPermissions() { if (checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PERMISSION_GRANTED && checkSelfPermission(context, ACCESS_COARSE_LOCATION) != PERMISSION_GRANTED) { Log.e(TAG, String.format("Missing permission: '%s'", Manifest.permission.ACCESS_FINE_LOCATION)); return false; } return true; }

Target:
private boolean hasPermissions() { if (checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PERMISSION_GRANTED) { Log.e(TAG, String.format("Missing permission: '%s'", Manifest.permission.ACCESS_FINE_LOCATION)); return false; } return true; }
Source:
public AbstractSegmentStoreTableViewer getTableViewer() { return fTableViewer; }

Target:
public @Nullable AbstractSegmentStoreTableViewer getTableViewer() { return fTableViewer; }
Source:
extractVariablesThirdPartyCredentialsAndSystemEnvironmentVariables(TaskContext taskContext) { ForkEnvironment forkEnvironment = taskContext.getInitializer().getForkEnvironment(); Map<String, Serializable> variables = new HashMap<>(); try { variables = extractAllVariables(taskContext, null, ""); } catch (IOException | ClassNotFoundException e) { logger.error("Error reading variables from task context!"); } Map<String, String> thirdPartyCredentials = new HashMap<>(); try { thirdPartyCredentials = forkedTaskVariablesManager.extractThirdPartyCredentials(taskContext); } catch (Exception e) { logger.error("Error decrypting third party credentials!"); } HashMap<String, Serializable> systemEnvironmentVariables = new HashMap<String, Serializable>(System.getenv()); systemEnvironmentVariables.putAll(variables); systemEnvironmentVariables.putAll(thirdPartyCredentials); return filterAndUpdate(forkEnvironment.getSystemEnvironment(), systemEnvironmentVariables); }

Target:
extractVariablesThirdPartyCredentialsAndSystemEnvironmentVariables(TaskContext taskContext) { ForkEnvironment forkEnvironment = taskContext.getInitializer().getForkEnvironment(); Map<String, Serializable> variables = new HashMap<>(); try { variables = extractAllVariables(taskContext, null, ""); } catch (IOException | ClassNotFoundException e) { logger.error(ERROR_READING_VARIABLES, e); } Map<String, String> thirdPartyCredentials = new HashMap<>(); try { thirdPartyCredentials = forkedTaskVariablesManager.extractThirdPartyCredentials(taskContext); } catch (Exception e) { logger.error(ERROR_READING_VARIABLES, e); } HashMap<String, Serializable> systemEnvironmentVariables = new HashMap<String, Serializable>(System.getenv()); systemEnvironmentVariables.putAll(variables); systemEnvironmentVariables.putAll(thirdPartyCredentials); return filterAndUpdate(forkEnvironment.getSystemEnvironment(), systemEnvironmentVariables); }
Source:
public AvroRecordIterator(Schema schema, ByteString bytes) { reader = new GenericDatumReader<>(schema); in = new DecoderFactory().binaryDecoder(bytes.toByteArray(), null); }

Target:
AvroRecordIterator(Schema schema, ByteString bytes) { reader = new GenericDatumReader<>(schema); in = new DecoderFactory().binaryDecoder(bytes.toByteArray(), null); }
Source:
public static void processResponse(HttpResponseProcessor responseProcessor, int responseCode, ResponseStreamAccessor streamAccessor) { if (responseCode >= 200 && responseCode < 300) { InputStream responseStream; try { responseStream = streamAccessor.getResponseStream(); } catch (IOException e) { responseProcessor.handleException(e); return; } responseProcessor.processSuccess(responseCode, responseStream); } else if (responseCode >= 400 && responseCode < 500) { responseProcessor.processClientError(responseCode); } else if (responseCode >= 500 && responseCode < 600) { responseProcessor.processServerError(responseCode); } else { responseProcessor.processOther(responseCode); } }

Target:
public static void processResponse(HttpResponseProcessor responseProcessor, int responseCode, ResponseStreamAccessor streamAccessor) { if (responseCode >= 200 && responseCode < 300) { InputStream responseStream; try { responseStream = streamAccessor.getResponseStream(); } catch (IOException e) { responseProcessor.handleIOException(e); return; } responseProcessor.processSuccess(responseCode, responseStream); } else if (responseCode >= 400 && responseCode < 500) { responseProcessor.processClientError(responseCode); } else if (responseCode >= 500 && responseCode < 600) { responseProcessor.processServerError(responseCode); } else { responseProcessor.processOther(responseCode); } }
Source:
protected boolean doesDataExist(Entity entity) { return !entity.isDead; }

Target:
protected boolean doesDataExist(Entity entity) { return true; }
Source:
public void clear() throws SQLException { dbmsSynchronizer.closeSharedDatabase(); this.dbmsConnection.getConnection().close(); }

Target:
public void clear() throws SQLException { dbmsSynchronizer.closeSharedDatabase(); }
Source:
private void registerSnomedIdentifierService(final SnomedIdentifierConfiguration conf, final Environment env, final ISnomedIdentiferReservationService reservationService) { ISnomedIdentifierService identifierService = null; switch (conf.getStrategy()) { case EMBEDDED: final Index index = Indexes.createIndex("snomedids", env.service(ObjectMapper.class), new Mappings(SctId.class), env.service(IndexSettings.class)); index.admin().create(); LOGGER.info("Snow Owl is configured to use embedded identifier service."); final ItemIdGenerationStrategy generationStrategy = new SequentialItemIdGenerationStrategy(index, reservationService); identifierService = new DefaultSnomedIdentifierService(index, generationStrategy, reservationService, conf); break; case CIS: final ObjectMapper mapper = new ObjectMapper(); LOGGER.info("Snow Owl is configured to use CIS based identifier service."); identifierService = new CisSnomedIdentifierService(conf, reservationService, mapper); break; default: throw new IllegalStateException(String.format("Unknown ID generation source configured: %s. ", conf.getStrategy())); } env.services().registerService(ISnomedIdentifierService.class, identifierService); }

Target:
private void registerSnomedIdentifierService(final SnomedIdentifierConfiguration conf, final Environment env, final ISnomedIdentiferReservationService reservationService) { ISnomedIdentifierService identifierService = null; switch (conf.getStrategy()) { case EMBEDDED: final Index index = Indexes.createIndex(SNOMED_IDS_INDEX, env.service(ObjectMapper.class), new Mappings(SctId.class), env.service(IndexSettings.class)); index.admin().create(); final ItemIdGenerationStrategy generationStrategy = new SequentialItemIdGenerationStrategy(index, reservationService); identifierService = new DefaultSnomedIdentifierService(index, generationStrategy, reservationService, conf); break; case CIS: final ObjectMapper mapper = new ObjectMapper(); identifierService = new CisSnomedIdentifierService(conf, reservationService, mapper); break; default: throw new IllegalStateException(String.format("Unknown ID generation source configured: %s. ", conf.getStrategy())); } env.services().registerService(ISnomedIdentifierService.class, identifierService); LOGGER.info("Snow Owl is configured to use based identifier service.", conf.getStrategy()); }
Source:
public String say(long number) { if (number < 0) { throw new IllegalArgumentException("input out of range"); } char[] digits = String.valueOf(number).toCharArray(); if (digits.length > 12) { throw new IllegalArgumentException("input out of range"); } char[][] processedDigits = process(digits); String message = ""; for (int index = 0; index < processedDigits.length; index++) { char[] blockDigits = processedDigits[index]; message = concatWithSpace(message, sayDigits(blockDigits, processedDigits.length - index)); } return message; }

Target:
public String say(long number) { if (number < 0 || number >= Magnitude.TRILLIONS.getNumber()) { throw new IllegalArgumentException("input out of range"); } List<Part> parts = new ArrayList<Say.Part>(); for (Magnitude magnitude: supportedMagnitudes) { double quoziente = Math.floor(number / magnitude.getNumber()); Part part = new Part((int) quoziente, magnitude); if (part.getDigits() > 0 || (part.getMagnitude().equals(Magnitude.ONES) && parts.size() == 0)) { parts.add(part); } number = number % magnitude.getNumber(); } return String.join(" ", parts.stream().map(part -> part.say()).collect(Collectors.toList())); }
Source:
public String getHARole() { if (true) return roles.keySet().toString(); if ( roles.containsKey( HighAvailabilityModeSwitcher.MASTER ) ) { return HighAvailabilityModeSwitcher.MASTER; } if ( roles.containsKey( HighAvailabilityModeSwitcher.SLAVE ) ) { return HighAvailabilityModeSwitcher.SLAVE; } return HighAvailabilityModeSwitcher.UNKNOWN; }

Target:
public String getHARole() { if ( roles.containsKey( HighAvailabilityModeSwitcher.MASTER ) ) { return HighAvailabilityModeSwitcher.MASTER; } if ( roles.containsKey( HighAvailabilityModeSwitcher.SLAVE ) ) { return HighAvailabilityModeSwitcher.SLAVE; } return HighAvailabilityModeSwitcher.UNKNOWN; }
Source:
public void refreshPersonDetails() { if (!isAdded()) return; Person person = loadPerson(); if (person != null) { int avatarSz = getResources().getDimensionPixelSize(R.dimen.avatar_sz_large); String avatarUrl = GravatarUtils.fixGravatarUrl(person.getAvatarUrl(), avatarSz); mAvatarImageView.setImageUrl(avatarUrl, WPNetworkImageView.ImageType.AVATAR); mDisplayNameTextView.setText(person.getDisplayName()); mUsernameTextView.setText(person.getUsername()); mRoleTextView.setText(StringUtils.capitalize(person.getRole())); setupRoleContainerForCapability(); } else { AppLog.w(AppLog.T.PEOPLE, "Person returned null from DB for personID: " + mPersonID + " & localTableBlogID: " + mLocalTableBlogID); } }

Target:
public void refreshPersonDetails() { if (!isAdded()) return; Person person = loadPerson(); if (person != null) { int avatarSz = getResources().getDimensionPixelSize(R.dimen.people_avatar_sz); String avatarUrl = GravatarUtils.fixGravatarUrl(person.getAvatarUrl(), avatarSz); mAvatarImageView.setImageUrl(avatarUrl, WPNetworkImageView.ImageType.AVATAR); mDisplayNameTextView.setText(person.getDisplayName()); mUsernameTextView.setText(person.getUsername()); mRoleTextView.setText(StringUtils.capitalize(person.getRole())); setupRoleContainerForCapability(); } else { AppLog.w(AppLog.T.PEOPLE, "Person returned null from DB for personID: " + mPersonID + " & localTableBlogID: " + mLocalTableBlogID); } }