auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Delimiter changeDelimiterIfNecessary(String line, Delimiter delimiter) { END statement, then the order is significant. if (line.startsWith("CREATE PROCEDURE") || line.startsWith("CREATE TRIGGER")) { if (insideStatementAllowingNestedBeginEndBlocks) { throw new FlywayException("Beginning another CREATE TRIGGER/CREATE PROCEDURE inside Trigger or Procedure not supported"); } insideStatementAllowingNestedBeginEndBlocks = true; } if (insideStatementAllowingNestedBeginEndBlocks) { if (line.startsWith("BEGIN")) { beginEndNestedDepth++; } if (line.endsWith("END;")) { beginEndNestedDepth--; if (beginEndNestedDepth < 0) { throw new FlywayException("Syntax error in SQL script: unpaired END; statement"); } else if (beginEndNestedDepth == 0) { insideStatementAllowingNestedBeginEndBlocks = false; } } } if (insideStatementAllowingNestedBeginEndBlocks) { return null; } return getDefaultDelimiter(); }

Target:
protected Delimiter changeDelimiterIfNecessary(String line, Delimiter delimiter) { if (statementStartNormalized.length() < 16) { final String effectiveLine = cutCommentsFromEnd(line); statementStartNormalized += effectiveLine + " "; statementStartNormalized = StringUtils.trimLeadingWhitespace(StringUtils.collapseWhitespace(statementStartNormalized)); } boolean insideStatementAllowingNestedBeginEndBlocks = statementStartNormalized.startsWith("CREATE PROCEDURE") || statementStartNormalized.startsWith("CREATE FUNCTION") || statementStartNormalized.startsWith("CREATE TRIGGER"); if (insideStatementAllowingNestedBeginEndBlocks) { if (line.startsWith("BEGIN")) { beginEndNestedDepth++; } if (line.endsWith("END;")) { beginEndNestedDepth--; if (beginEndNestedDepth < 0) { LOG.warn("SQL statement parsed unsuccessfully: found unpaired 'END;' in statement"); } if (beginEndNestedDepth <= 0) { insideStatementAllowingNestedBeginEndBlocks = false; } } } if (insideStatementAllowingNestedBeginEndBlocks) { return null; } return getDefaultDelimiter(); }
Source:
public SharedReferencePointMapper() { idToReferencePointMapping = new HashMap<String, IReferencePoint>(); referencePointToIDMapping = new HashMap<IReferencePoint, String>(); referencePointsOfUsers = new HashMap<User, List<String>>(); partiallySharedResourceMapping = new HashMap<IReferencePoint, Set<IResource>>(); completelySharedReferencePoints = new HashSet<IReferencePoint>(); partiallySharedReferencePoints = new HashSet<IReferencePoint>(); }

Target:
public SharedReferencePointMapper() { idToReferencePointMapping = new HashMap(); referencePointToIDMapping = new HashMap(); referencePointsOfUsers = new HashMap(); partiallySharedResourceMapping = new HashMap(); completelySharedReferencePoints = new HashSet(); partiallySharedReferencePoints = new HashSet(); }
Source:
public PlanSanityChecker(boolean forceSingleNode) { checkers = ImmutableListMultimap.<Stage, Checker>builder() .putAll( Stage.INTERMEDIATE, new ValidateDependenciesChecker(), new NoDuplicatePlanNodeIdsChecker(), new TypeValidator(), new NoSubqueryExpressionLeftChecker(), new NoIdentifierLeftChecker(), new VerifyOnlyOneOutputNode()) .putAll( Stage.FRAGMENT, new ValidateDependenciesChecker(), new NoDuplicatePlanNodeIdsChecker(), new TypeValidator(), new NoSubqueryExpressionLeftChecker(), new NoIdentifierLeftChecker(), new VerifyNoFilteredAggregations()) .putAll( Stage.FINAL, new ValidateDependenciesChecker(), new NoDuplicatePlanNodeIdsChecker(), new TypeValidator(), new NoSubqueryExpressionLeftChecker(), new NoIdentifierLeftChecker(), new VerifyOnlyOneOutputNode(), new VerifyNoFilteredAggregations(), new ValidateAggregationsWithDefaultValues(forceSingleNode), new ValidateStreamingAggregations(), new NoExpressionLeftCheck()) .build(); }

Target:
public PlanSanityChecker(boolean forceSingleNode) { checkers = ImmutableListMultimap.<Stage, Checker>builder() .putAll( Stage.INTERMEDIATE, new ValidateDependenciesChecker(), new NoDuplicatePlanNodeIdsChecker(), new TypeValidator(), new NoSubqueryExpressionLeftChecker(), new NoIdentifierLeftChecker(), new VerifyOnlyOneOutputNode()) .putAll( Stage.FRAGMENT, new ValidateDependenciesChecker(), new NoDuplicatePlanNodeIdsChecker(), new TypeValidator(), new NoSubqueryExpressionLeftChecker(), new NoIdentifierLeftChecker(), new VerifyNoFilteredAggregations(), new VerifyNoOriginalExpression()) .putAll( Stage.FINAL, new ValidateDependenciesChecker(), new NoDuplicatePlanNodeIdsChecker(), new TypeValidator(), new NoSubqueryExpressionLeftChecker(), new NoIdentifierLeftChecker(), new VerifyOnlyOneOutputNode(), new VerifyNoFilteredAggregations(), new ValidateAggregationsWithDefaultValues(forceSingleNode), new ValidateStreamingAggregations(), new VerifyNoOriginalExpression()) .build(); }
Source:
public Collection<ParameterOption> getParameterOptions(URI uri, String param, Locale locale) { if (!uri.equals(CONFIG_URI)) { return null; } if (param.equals(PARAM_PRIMARY_ADDRESS)) { Stream<CidrAddress> ipv4Addresses = NetUtil.getAllInterfaceAddresses().stream() .filter(a -> a.getAddress() instanceof Inet4Address); return ipv4Addresses.map(a -> new ParameterOption(a.toString(), a.toString())).collect(Collectors.toList()); } if (param.equals(PARAM_BROADCAST_ADDRESS)) { List<String> broadcastAddrList = NetUtil.getAllBroadcastAddresses(); broadcastAddrList.add("255.255.255.255"); return broadcastAddrList.stream().map(a -> new ParameterOption(a, a)).collect(Collectors.toList()); } return null; }

Target:
public Collection<ParameterOption> getParameterOptions(URI uri, String param, Locale locale) { if (!uri.equals(CONFIG_URI)) { return null; } if (param.equals(PARAM_PRIMARY_ADDRESS)) { Stream<CidrAddress> ipv4Addresses = NetUtil.getAllInterfaceAddresses().stream() .filter(a -> a.getAddress() instanceof Inet4Address); return ipv4Addresses.map(a -> new ParameterOption(a.toString(), a.toString())).collect(Collectors.toList()); } if (param.equals(PARAM_BROADCAST_ADDRESS)) { ArrayList<String> broadcastAddrList = new ArrayList<>(NetUtil.getAllBroadcastAddresses()); broadcastAddrList.add("255.255.255.255"); return broadcastAddrList.stream().map(a -> new ParameterOption(a, a)).collect(Collectors.toList()); } return null; }
Source:
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.from(1); }

Target:
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(1); }
Source:
public void testAssetLoaderInternalStorageActivity() { mRule.getActivity(); mRule.openByActivityTitle(R.string.asset_loader_internal_storage_activity_title); onWebView() .withElement(findElement(Locator.TAG_NAME, "h3")) .check(webMatches(getText(), containsString("Successfully loaded html from app files dir!"))); }

Target:
public void testAssetLoaderInternalStorageActivity() { mRule.openByActivityTitle(R.string.asset_loader_internal_storage_activity_title); onWebView() .withElement(findElement(Locator.TAG_NAME, "h3")) .check(webMatches(getText(), containsString("Successfully loaded html from app files dir!"))); }
Source:
private void deleteSegmentsOnAck(PBDSegment<M> segment, int entryNumber) { if (m_cursorClosed || m_segments.size() == 1) { return; } if (segment.m_deleteOnAck == true && segment.segmentIndex() == m_segments.firstKey()) { m_deferredDeleter.execute(this::deleteMarkedSegments); return; } if (canDeleteSegmentsBefore(segment, entryNumber)) { m_deferredDeleter.execute(() -> deleteSegmentsBefore(segment)); } }

Target:
private void deleteSegmentsOnAck(PBDSegment<M> segment, int entryNumber) { if (m_cursorClosed || m_segments.size() == 1) { return; } if (segment.m_deleteOnAck == true && segment.segmentIndex() == m_segments.firstKey()) { m_deferredDeleter.execute(this::deleteMarkedSegments); return; } callDeleteSegmentsBefore(segment, entryNumber); }
Source:
public void listClear() throws XWikiException{ attachmentList.clear(); assertEquals(attachmentList,new ArrayList<XWikiAttachment>()); }

Target:
public void listClear() throws XWikiException { attachmentList.clear(); assertTrue(attachmentList.isEmpty()); }
Source:
public void testWithStopSignal() throws Exception { Integer signal = 10; CreateContainerResponse resp = dockerClient.createContainerCmd(BUSYBOX_IMAGE) .withCmd("/bin/sh", "-c", "trap 'echo \"exit trapped 10\"; exit 10' USR1; while true; do sleep 1; done") .withAttachStdin(true) .withTty(true) .withStopSignal(signal.toString()) .exec(); final String containerId = resp.getId(); assertThat(containerId, not(isEmptyString())); dockerClient.startContainerCmd(containerId).exec(); InspectContainerResponse inspect = dockerClient.inspectContainerCmd(containerId).exec(); assertThat(inspect.getState().getRunning(), is(true)); dockerClient.stopContainerCmd(containerId).exec(); Thread.sleep(TimeUnit.SECONDS.toMillis(3)); inspect = dockerClient.inspectContainerCmd(containerId).exec(); assertThat(inspect.getState().getRunning(), is(false)); assertThat(inspect.getState().getExitCode(), is(signal)); StringBuilder stringBuilder = new StringBuilder(); final StringBuilderLogReader callback = new StringBuilderLogReader(stringBuilder); dockerClient.logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .withTailAll() .exec(callback); Thread.sleep(TimeUnit.SECONDS.toMillis(5)); String log = callback.builder.toString(); assertThat(log, is("exit trapped 10")); }

Target:
public void testWithStopSignal() throws Exception { Integer signal = 10; CreateContainerResponse resp = dockerClient.createContainerCmd(BUSYBOX_IMAGE) .withCmd("/bin/sh", "-c", "trap 'echo \"exit trapped 10\"; exit 10' USR1; while true; do sleep 1; done") .withAttachStdin(true) .withTty(true) .withStopSignal(signal.toString()) .exec(); final String containerId = resp.getId(); assertThat(containerId, not(isEmptyString())); dockerClient.startContainerCmd(containerId).exec(); InspectContainerResponse inspect = dockerClient.inspectContainerCmd(containerId).exec(); assertThat(inspect.getState().getRunning(), is(true)); dockerClient.stopContainerCmd(containerId).exec(); Thread.sleep(TimeUnit.SECONDS.toMillis(3)); inspect = dockerClient.inspectContainerCmd(containerId).exec(); assertThat(inspect.getState().getRunning(), is(false)); assertThat(inspect.getState().getExitCode(), is(signal)); StringBuilder stringBuilder = new StringBuilder(); final StringBuilderLogReader callback = new StringBuilderLogReader(stringBuilder); dockerClient.logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .withTailAll() .exec(callback) .awaitCompletion(); String log = callback.builder.toString(); assertThat(log, is("exit trapped 10")); }
Source:
public static String satelReadDeviceName( @ParamDoc(name = "deviceType", text = "type of the device, one of: PARTITION, ZONE, USER, EXPANDER, LCD, OUTPUT, TIMER, TELEPHONE, OBJECT") String deviceType, @ParamDoc(name = "deviceNumber", text = "number of the device to read") int deviceNumber) { if (!satelIsConnected()) { return null; } DeviceType devType; try { devType = DeviceType.valueOf(deviceType.toUpperCase()); } catch (Exception e) { logger.warn("Invalid device type given: {}", deviceType); return null; } ReadDeviceInfoCommand cmd = new ReadDeviceInfoCommand(devType, deviceNumber); if (!SatelActionService.satelCommModule.sendCommand(cmd)) { logger.warn("Unable to read device info: {}, {}", deviceType, deviceNumber); return null; } try { return cmd.getName(SatelActionService.satelCommModule.getTextEncoding()); } catch (UnsupportedEncodingException e) { logger.error("Unsupported encoding: {}", SatelActionService.satelCommModule.getTextEncoding()); return null; } }

Target:
public static String satelReadDeviceName( @ParamDoc(name = "deviceType", text = "type of the device, one of: PARTITION, ZONE, USER, EXPANDER, LCD, OUTPUT, TIMER, TELEPHONE, OBJECT") String deviceType, @ParamDoc(name = "deviceNumber", text = "number of the device to read") int deviceNumber) { if (!satelIsConnected()) { logger.warn("Not connected to communication module or Satel binding not available."); return null; } DeviceType devType; try { devType = DeviceType.valueOf(deviceType.toUpperCase()); } catch (Exception e) { logger.warn("Invalid device type given: {}", deviceType); return null; } ReadDeviceInfoCommand cmd = new ReadDeviceInfoCommand(devType, deviceNumber); if (!SatelActionService.satelCommModule.sendCommand(cmd)) { logger.warn("Unable to read device info: {}, {}", deviceType, deviceNumber); return null; } try { return cmd.getName(SatelActionService.satelCommModule.getTextEncoding()); } catch (UnsupportedEncodingException e) { logger.error("Unsupported encoding: {}", SatelActionService.satelCommModule.getTextEncoding()); return null; } }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RequestCodes.ADD_ACCOUNT: case RequestCodes.CREATE_SITE: if (resultCode == RESULT_OK) { debounceLoadSites(); if (data == null) { data = new Intent(); } if (data.getBooleanExtra(KEY_SITE_CREATED_BUT_NOT_FETCHED, false)) { showSiteCreatedButNotFetchedSnackbar(); } else { data.putExtra(WPMainActivity.ARG_CREATE_SITE, RequestCodes.CREATE_SITE); setResult(resultCode, data); finish(); } } break; } switch (requestCode) { case RequestCodes.CREATE_SITE: if (data != null) { int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); SiteUtils.enableBlockEditor(mDispatcher, mSiteStore, newSiteLocalID); } break; } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RequestCodes.ADD_ACCOUNT: case RequestCodes.CREATE_SITE: if (resultCode == RESULT_OK) { debounceLoadSites(); if (data == null) { data = new Intent(); } if (data.getBooleanExtra(KEY_SITE_CREATED_BUT_NOT_FETCHED, false)) { showSiteCreatedButNotFetchedSnackbar(); } else { data.putExtra(WPMainActivity.ARG_CREATE_SITE, RequestCodes.CREATE_SITE); setResult(resultCode, data); finish(); } } break; } switch (requestCode) { case RequestCodes.CREATE_SITE: if (data != null) { int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); SiteUtils.enableBlockEditor(mDispatcher, mSiteStore, newSiteLocalID); SiteModel newSiteModel = mSiteStore.getSiteByLocalId(newSiteLocalID); if (newSiteModel != null) { AppPrefs.setShowGutenbergInfoPopup(newSiteModel.getUrl(), true); } } break; } }
Source:
public TaskTracker tasks() throws SemanticException { try { if (event.shouldNotReplicate()) { return tracker; } String dbName = tableContext.dbNameToLoadIn; ImportTableDesc tableDesc = tableContext.overrideProperties(event.tableDesc(dbName)); Table table = ImportSemanticAnalyzer.tableIfExists(tableDesc, context.hiveDb); Database parentDb = context.hiveDb.getDatabase(tableDesc.getDatabaseName()); if (parentDb == null) { if (!tableContext.waitOnPrecursor()) { throw new SemanticException( ErrorMsg.DATABASE_NOT_EXISTS.getMsg(tableDesc.getDatabaseName())); } } Task<?> tblRootTask = null; ReplUtils.LoadOpType opType = getLoadOpType(table, parentDb); switch (opType) { case LOAD_NEW: break; case LOAD_REPLACE: tblRootTask = dropTableTask(table); break; case LOAD_INVALID: throw new InvalidOperationException("Load not allowed on table " + table.getFullyQualifiedName() + " as it was already bootstrap loaded from another dump."); case LOAD_SKIP: return tracker; } if (tableDesc.getLocation() == null) { tableDesc.setLocation(location(tableDesc, parentDb)); } newTableTasks(tableDesc, tblRootTask); Task<?> ckptTask = ReplUtils.getTableCheckpointTask( tableDesc, null, context.dumpDirectory, context.hiveConf ); if (!isPartitioned(tableDesc)) { Task<? extends Serializable> replLogTask = ReplUtils.getTableReplLogTask(tableDesc, replLogger, context.hiveConf); ckptTask.addDependentTask(replLogTask); } tracker.addDependentTask(ckptTask); return tracker; } catch (Exception e) { throw new SemanticException(e); } }

Target:
public TaskTracker tasks() throws SemanticException { try { if (event.shouldNotReplicate()) { return tracker; } String dbName = tableContext.dbNameToLoadIn; ImportTableDesc tableDesc = tableContext.overrideProperties(event.tableDesc(dbName)); Table table = ImportSemanticAnalyzer.tableIfExists(tableDesc, context.hiveDb); Database parentDb = context.hiveDb.getDatabase(tableDesc.getDatabaseName()); if (parentDb == null) { if (!tableContext.waitOnPrecursor()) { throw new SemanticException( ErrorMsg.DATABASE_NOT_EXISTS.getMsg(tableDesc.getDatabaseName())); } } Task<?> tblRootTask = null; ReplLoadOpType loadTblType = getLoadTableType(table); switch (loadTblType) { case LOAD_NEW: break; case LOAD_REPLACE: tblRootTask = dropTableTask(table); break; case LOAD_SKIP: return tracker; default: break; } if (tableDesc.getLocation() == null) { tableDesc.setLocation(location(tableDesc, parentDb)); } newTableTasks(tableDesc, tblRootTask); Task<?> ckptTask = ReplUtils.getTableCheckpointTask( tableDesc, null, context.dumpDirectory, context.hiveConf ); if (!isPartitioned(tableDesc)) { Task<? extends Serializable> replLogTask = ReplUtils.getTableReplLogTask(tableDesc, replLogger, context.hiveConf); ckptTask.addDependentTask(replLogTask); } tracker.addDependentTask(ckptTask); return tracker; } catch (Exception e) { throw new SemanticException(e); } }
Source:
public RFuture<Collection<Double>> getAllScoreAsync(Collection<V> elements) { return redisson.getScript(DoubleCodec.INSTANCE).evalAsync(RScript.Mode.READ_ONLY, "local r = " + "for i, v in ipairs(KEYS) do " + "r[#r+1] = redis.call('ZSCORE', ARGV[1], v); " + "end;" + "return r;", RScript.ReturnType.MULTI, new ArrayList<>(encode(elements)), getName()); }

Target:
public RFuture<List<Double>> getAllScoreAsync(Collection<V> elements) { return commandExecutor.evalReadAsync((String) null, DoubleCodec.INSTANCE, RedisCommands.EVAL_LIST, "local r = " + "for i, v in ipairs(ARGV) do " + "r[#r+1] = redis.call('ZSCORE', KEYS[1], ARGV[i]); " + "end;" + "return r;", Collections.singletonList(getName()), encode(elements).toArray()); }
Source:
public void testArrayOfDates() throws ParseException { ArrayProperty property = getArrayProperty(DateType.INSTANCE); String myTestDate = "2017-11-29T12:30-03:44"; Date date = DateParser.parseW3CDateTime(myTestDate); Calendar cal = Calendar.getInstance(); cal.setTime(date); property.setValue(new Object[] {null, cal, date, myTestDate}); assertArrayEquals(new Object[] { null, cal, cal, cal }, (Calendar[]) property.getValue()); Calendar calWithCorrectTimezone = GregorianCalendar.from(ZonedDateTime.parse(myTestDate)); assertNotEquals(cal, calWithCorrectTimezone); property.setValue(new Object[] {null, calWithCorrectTimezone}); assertArrayEquals(new Object[] { null, calWithCorrectTimezone }, (Calendar[]) property.getValue()); }

Target:
public void testArrayOfDates() { ArrayProperty property = getArrayProperty(DateType.INSTANCE); String myTestDate = "2017-11-29T12:30-03:44"; Date date = DateParser.parseW3CDateTime(myTestDate); Calendar cal = Calendar.getInstance(); cal.setTime(date); property.setValue(new Object[] { null, cal, date, myTestDate }); assertArrayEquals(new Object[] { null, cal, cal, cal }, (Calendar[]) property.getValue()); Calendar calWithCorrectTimezone = GregorianCalendar.from(ZonedDateTime.parse(myTestDate)); assertNotEquals(cal, calWithCorrectTimezone); property.setValue(new Object[] { null, calWithCorrectTimezone }); assertArrayEquals(new Object[] { null, calWithCorrectTimezone }, (Calendar[]) property.getValue()); }
Source:
public void visitToken(DetailAST arrayInit) { final DetailAST rcurly = arrayInit.findFirstToken(TokenTypes.RCURLY); final DetailAST previousSibling = rcurly.getPreviousSibling(); if (arrayInit.getChildCount() != 1 && !TokenUtil.areOnSameLine(rcurly, previousSibling) && !TokenUtil.areOnSameLine(arrayInit, previousSibling) && previousSibling.getType() != TokenTypes.COMMA) { log(rcurly, MSG_KEY); } }

Target:
public void visitToken(DetailAST arrayInit) { final DetailAST rcurly = arrayInit.findFirstToken(TokenTypes.RCURLY); final DetailAST previousSibling = rcurly.getPreviousSibling(); if (arrayInit.getChildCount() != 1 && !TokenUtil.areOnSameLine(rcurly, previousSibling) && !TokenUtil.areOnSameLine(arrayInit, previousSibling) && previousSibling.getType() != TokenTypes.COMMA) { log(previousSibling, MSG_KEY); } }
Source:
public void write( Settings settings, File settingsFile ) throws ManipulationException { try { PrintWriter printWriter = new PrintWriter( settingsFile, StandardCharsets.UTF_8.toString() ); new SettingsXpp3Writer().write( printWriter, settings ); } catch ( IOException e ) { throw new ManipulationException( "Failed to create repo removal backup settings.xml file: {}", settingsFile, e ); } }

Target:
public void write( Settings settings, File settingsFile ) throws ManipulationException { try { PrintWriter printWriter = new PrintWriter( settingsFile, StringUtils.isEmpty( settings.getModelEncoding() ) ? StandardCharsets.UTF_8.toString() : settings.getModelEncoding() ); new SettingsXpp3Writer().write( printWriter, settings ); } catch ( IOException e ) { throw new ManipulationException( "Failed to create repo removal backup settings.xml file: {}", settingsFile, e ); } }
Source:
public static Iterable<Path> listRegionFiles(Path worldDir) { try { return Files.newDirectoryStream(worldDir.resolve("region"), "*.mca"); } catch (IOException e) { return Collections.emptySet(); } }

Target:
public static Iterable<Path> listRegionFiles(Path worldDir) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(worldDir.resolve("region"), "*.mca")) { return Lists.newArrayList(stream); } catch (IOException e) { return Collections.emptySet(); } }
Source:
public String toString() { return "Range [startLine=" + startLine + ", startCh=" + startCh + ", endLine=" + endLine + ", endCh=" + endCh + "]"; }

Target:
public String toString() { return "Range[startLine=" + startLine + ", startCharacter=" + startCharacter + ", endLine=" + endLine + ", endCharacter=" + endCharacter + "]"; }
Source:
protected void writeFile(final IOService ioService, final Path path, final FileItem uploadedItem) throws IOException { try { ioService.startBatch(path.getFileSystem()); if (!ioService.exists(path)) { ioService.createFile(path); } ioService.write(path, IOUtils.toByteArray(uploadedItem.getInputStream())); } catch (final Exception e) { throw new RuntimeException(e); } finally { uploadedItem.getInputStream().close(); ioService.endBatch(); } }

Target:
protected void writeFile(final IOService ioService, final Path path, final FileItem uploadedItem) throws IOException { try { ioService.startBatch(path.getFileSystem()); if (!ioService.exists(path)) { ioService.createFile(path); } ioService.write(path, IOUtils.toByteArray(uploadedItem.getInputStream())); } finally { uploadedItem.getInputStream().close(); ioService.endBatch(); } }
Source:
public String metricNameSuffix() { return "-" + name().toLowerCase(Locale.ROOT); }

Target:
public String metricNameSuffix() { return metricNameSuffix; }
Source:
private static Element createElementEndpointBy(Document document, String serviceName, String serviceUrl, String endpointVersion) { Element endpoint = createElementBy(document, "endpoint"); createElementBy(endpoint, "name", serviceName); Element configurationList = createElementBy(endpoint, "endpointConfigurationList"); Element configuration = createElementBy(configurationList, "endpointConfiguration"); createElementBy(configuration, "url", serviceUrl); createElementBy(configuration, "version", contantsIgnoreCaseOf(serviceName, "adapter") ? "LEVEL_a0" : endpointVersion); return endpoint; }

Target:
private static Element createElementEndpointBy(Document document, String serviceName, String serviceUrl, String endpointVersion) { Element endpoint = createElementBy(document, "endpoint"); createElementBy(endpoint, "name", serviceName); Element configurationList = createElementBy(endpoint, "endpointConfigurationList"); Element configuration = createElementBy(configurationList, "endpointConfiguration"); createElementBy(configuration, "url", serviceUrl); createElementBy(configuration, "version", containsIgnoreCaseOf(serviceName, "adapter") ? "LEVEL_a0" : endpointVersion); return endpoint; }
Source:
public Map<String, Locale> getLocales() { return Locale.getMap("en-US", "fr-FR", "es-ES", "de-DE", "nl-NL", "ru-RU", "hi-IN","it-IT", "fi-FI","pt-PT"); }

Target:
public Map<String, Locale> getLocales() { return Locale.getLocaleMap("en-US", "fr-FR", "es-ES", "de-DE", "nl-NL", "ru-RU", "hi-IN","it-IT", "fi-FI","pt-PT"); }
Source:
public void receiveResponse(final Exchange exchange, final Response response) { if (isTransparentBlockwiseHandlingEnabled()) { if (response.isError()) { switch(response.getCode()) { case REQUEST_ENTITY_INCOMPLETE: case REQUEST_ENTITY_TOO_LARGE: KeyUri key = getKey(exchange, exchange.getCurrentRequest()); clearBlock1Status(key); default: Response resp = new Response(response.getCode()); resp.setToken(exchange.getRequest().getToken()); if (exchange.getRequest().getType() == Type.CON) { resp.setType(Type.ACK); resp.setMID(exchange.getRequest().getMID()); } else { resp.setType(Type.NON); } resp.setSource(response.getSource()); resp.setSourcePort(response.getSourcePort()); resp.setPayload(response.getPayload()); resp.setOptions(response.getOptions()); exchange.setResponse(resp); upper().receiveResponse(exchange, resp); } } else if (!response.hasBlockOption()) { KeyUri key = getKey(exchange, response); Block2BlockwiseStatus status = block2Transfers.get(key); if (response.getOptions().hasObserve() && status != null && status.isNotification() && status.getObserve() < response.getOptions().getObserve()) { exchange.setComplete(); exchange.setCurrentRequest(exchange.getRequest()); clearBlock2Status(key); } exchange.setResponse(response); upper().receiveResponse(exchange, response); } else { if (response.getOptions().hasBlock1()) { handleBlock1Response(exchange, response); } if (response.getOptions().hasBlock2()) { handleBlock2Response(exchange, response); } } } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } }

Target:
public void receiveResponse(final Exchange exchange, final Response response) { if (isTransparentBlockwiseHandlingEnabled()) { if (response.isError()) { switch(response.getCode()) { case REQUEST_ENTITY_INCOMPLETE: case REQUEST_ENTITY_TOO_LARGE: KeyUri key = getKey(exchange, exchange.getCurrentRequest()); clearBlock1Status(key); default: Response resp = new Response(response.getCode()); resp.setToken(exchange.getRequest().getToken()); if (exchange.getRequest().getType() == Type.CON) { resp.setType(Type.ACK); resp.setMID(exchange.getRequest().getMID()); } else { resp.setType(Type.NON); } resp.setSource(response.getSource()); resp.setSourcePort(response.getSourcePort()); resp.setPayload(response.getPayload()); resp.setOptions(response.getOptions()); exchange.setResponse(resp); upper().receiveResponse(exchange, resp); } } else if (!response.hasBlockOption()) { KeyUri key = getKey(exchange, response); Block2BlockwiseStatus status = getBlock2Status(key); if (response.getOptions().hasObserve() && status != null && status.isNotification() && status.getObserve() < response.getOptions().getObserve()) { exchange.setComplete(); exchange.setCurrentRequest(exchange.getRequest()); clearBlock2Status(key); } exchange.setResponse(response); upper().receiveResponse(exchange, response); } else { if (response.getOptions().hasBlock1()) { handleBlock1Response(exchange, response); } if (response.getOptions().hasBlock2()) { handleBlock2Response(exchange, response); } } } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } }
Source:
public void factoryWithDirectUrlWithSpecificBranch() throws Exception { try { testFactoryWithSpecificBranch.authenticateAndOpen(); } catch (TimeoutException ex) { fail("Known issue <LINK_0>"); } projectExplorer.waitProjectExplorer(); notificationsPopupPanel.waitProgressPopupPanelClose(); events.clickEventLogBtn(); events.waitExpectedMessage("Project gitPullTest imported", UPDATING_PROJECT_TIMEOUT_SEC); events.waitExpectedMessage( "Successfully configured and cloned source code of gitPullTest.", UPDATING_PROJECT_TIMEOUT_SEC); events.waitExpectedMessage( "Project: gitPullTest | cloned from: gitPullTest | remote branch: refs/remotes/origin/contrib-12092015 | local branch: contrib-12092015", UPDATING_PROJECT_TIMEOUT_SEC); projectExplorer.expandPathInProjectExplorer("gitPullTest/my-lib"); projectExplorer.waitItem("gitPullTest/my-lib/pom.xml"); String wsId = workspaceServiceClient .getByName(seleniumWebDriver.getWorkspaceNameFromBrowserUrl(), testUser.getName()) .getId(); List<String> visibleItems = projectExplorer.getNamesOfAllOpenItems(); assertTrue( visibleItems.containsAll( ImmutableList.of("gitPullTest", "my-lib", "my-webapp", "src", "pom.xml"))); String projectType = testProjectServiceClient.getFirstProject(wsId).getType(); assertTrue(projectType.equals("blank")); }

Target:
public void factoryWithDirectUrlWithSpecificBranch() throws Exception { try { testFactoryWithSpecificBranch.authenticateAndOpen(); } catch (TimeoutException ex) { fail("Known issue <LINK_0>", ex); } projectExplorer.waitProjectExplorer(); notificationsPopupPanel.waitProgressPopupPanelClose(); events.clickEventLogBtn(); events.waitExpectedMessage("Project gitPullTest imported", UPDATING_PROJECT_TIMEOUT_SEC); events.waitExpectedMessage( "Successfully configured and cloned source code of gitPullTest.", UPDATING_PROJECT_TIMEOUT_SEC); events.waitExpectedMessage( "Project: gitPullTest | cloned from: gitPullTest | remote branch: refs/remotes/origin/contrib-12092015 | local branch: contrib-12092015", UPDATING_PROJECT_TIMEOUT_SEC); projectExplorer.expandPathInProjectExplorer("gitPullTest/my-lib"); projectExplorer.waitItem("gitPullTest/my-lib/pom.xml"); String wsId = workspaceServiceClient .getByName(seleniumWebDriver.getWorkspaceNameFromBrowserUrl(), testUser.getName()) .getId(); List<String> visibleItems = projectExplorer.getNamesOfAllOpenItems(); assertTrue( visibleItems.containsAll( ImmutableList.of("gitPullTest", "my-lib", "my-webapp", "src", "pom.xml"))); String projectType = testProjectServiceClient.getFirstProject(wsId).getType(); assertTrue(projectType.equals("blank")); }
Source:
private ObjectPool(final int min, final int max, final long validationInterval) { this.maxSize = max; initialize(min); schedulerWorker = Executors.newScheduledThreadPool(1, new RxThreadFactory("RxObjectPool")); schedulerWorker.scheduleAtFixedRate(new Runnable() { @Override public void run() { int size = pool.size(); if (size < min) { int sizeToBeAdded = max - size; for (int i = 0; i < sizeToBeAdded; i++) { pool.add(createObject()); } } else if (size > max) { int sizeToBeRemoved = size - max; for (int i = 0; i < sizeToBeRemoved; i++) { pool.poll(); } } } }, validationInterval, validationInterval, TimeUnit.SECONDS); }

Target:
private ObjectPool(final int min, final int max, final long validationInterval) { this.maxSize = max; initialize(min); schedulerWorker = Schedulers.computation().createWorker(); schedulerWorker.schedulePeriodically(new Action0() { @Override public void call() { int size = pool.size(); if (size < min) { int sizeToBeAdded = max - size; for (int i = 0; i < sizeToBeAdded; i++) { pool.add(createObject()); } } else if (size > max) { int sizeToBeRemoved = size - max; for (int i = 0; i < sizeToBeRemoved; i++) { pool.poll(); } } } }, validationInterval, validationInterval, TimeUnit.SECONDS); }
Source:
private Comparator<Class<? extends Annotation>> createDecoratorComparator(DecoratorOrder order) { List<Class<? extends Annotation>> ordering = Arrays.asList(order.value()); ToIntFunction<Class<? extends Annotation>> indexOf = type -> { int index = ordering.indexOf(type); return index == -1 ? ordering.size() : index; }; return Comparator.comparingInt(indexOf::applyAsInt); }

Target:
private Comparator<Class<? extends Annotation>> createDecoratorComparator(DecoratorOrder order) { List<Class<? extends Annotation>> ordering = Arrays.asList(order.value()); return Comparator.comparingInt(type -> { int index = ordering.indexOf(type); return index == -1 ? ordering.size() : index; }); }
Source:
public void setAnycastPrefix(String anycastPrefix) { ActiveMQServerLogger.LOGGER.info("Setting a prefix", new Exception()); for (String prefix : anycastPrefix.split(",")) { prefixes.put(SimpleString.toSimpleString(prefix), RoutingType.ANYCAST); } }

Target:
public void setAnycastPrefix(String anycastPrefix) { for (String prefix : anycastPrefix.split(",")) { prefixes.put(SimpleString.toSimpleString(prefix), RoutingType.ANYCAST); } }
Source:
private void setViewsGreyedOut(boolean greyedOut) { titleView.setTextColor(greyedOut ? ContextCompat.getColor(getContext(), R.color.base30) : ResourceUtil.getThemedColor(getContext(), R.attr.primary_text_color)); subtitleView.setTextColor(greyedOut ? ContextCompat.getColor(getContext(), R.color.base50) : ResourceUtil.getThemedColor(getContext(), R.attr.secondary_text_color)); imageView.setAlpha(greyedOut ? 0.5f : 1.0f); }

Target:
private void setViewsGreyedOut(boolean greyedOut) { if (!isAttachedToWindow()) { return; } titleView.setTextColor(greyedOut ? ContextCompat.getColor(getContext(), R.color.base30) : ResourceUtil.getThemedColor(getContext(), R.attr.primary_text_color)); subtitleView.setTextColor(greyedOut ? ContextCompat.getColor(getContext(), R.color.base50) : ResourceUtil.getThemedColor(getContext(), R.attr.secondary_text_color)); imageView.setAlpha(greyedOut ? 0.5f : 1.0f); }
Source:
public boolean nullable() { return !nullableAnnotation().isEmpty(); }

Target:
public boolean nullable() { return nullable; }
Source:
public void testAdjustmentOfSubsmission() { loadEnrollmentPage(); ______TS("typical case: enroll new student to existing course"); StudentAttributes newStudent = new StudentAttributes(); newStudent.section = "None"; newStudent.team = "Team 1.1</td></div>'\""; newStudent.course = "idOfTypicalCourse1"; newStudent.email = "random@g.tmt"; newStudent.name = "someName"; newStudent.comments = "comments"; String enrollString = "Section | Team | Name | Email | Comment" + Const.EOL + newStudent.toEnrollmentString(); enrollPage.enroll(enrollString); ThreadHelper.waitFor(2000); ______TS("typical case : existing student changes team"); loadEnrollmentPage(); final FeedbackSessionAttributes session = testData.feedbackSessions.get("session2InCourse1"); final StudentAttributes student = testData.students.get("student1InCourse1"); List<FeedbackResponseAttributes> oldResponsesForSession = getAllResponsesForStudentForSession(student, session.getFeedbackSessionName()); assertFalse(oldResponsesForSession.isEmpty()); String newTeam = "Team 1.2"; student.team = newTeam; enrollString = "Section | Team | Name | Email | Comment" + Const.EOL + student.toEnrollmentString(); enrollPage.enroll(enrollString); RetryManager.runUntilSuccessful(new RetryableTaskReturns<Integer>("Assert zero new responses") { @Override public Integer run() { return getAllResponsesForStudentForSession(student, session.getFeedbackSessionName()).size(); } @Override public boolean isSuccessful(Integer result) { return result == 0; } }); }

Target:
public void testAdjustmentOfSubsmission() { loadEnrollmentPage(); ______TS("typical case: enroll new student to existing course"); StudentAttributes newStudent = new StudentAttributes(); newStudent.section = "None"; newStudent.team = "Team 1.1</td></div>'\""; newStudent.course = "idOfTypicalCourse1"; newStudent.email = "random@g.tmt"; newStudent.name = "someName"; newStudent.comments = "comments"; String enrollString = "Section | Team | Name | Email | Comment" + Const.EOL + newStudent.toEnrollmentString(); enrollPage.enroll(enrollString); ThreadHelper.waitFor(2000); ______TS("typical case : existing student changes team"); loadEnrollmentPage(); final FeedbackSessionAttributes session = testData.feedbackSessions.get("session2InCourse1"); final StudentAttributes student = testData.students.get("student1InCourse1"); List<FeedbackResponseAttributes> oldResponsesForSession = getAllResponsesForStudentForSession(student, session.getFeedbackSessionName()); assertFalse(oldResponsesForSession.isEmpty()); String newTeam = "Team 1.2"; student.team = newTeam; enrollString = "Section | Team | Name | Email | Comment" + Const.EOL + student.toEnrollmentString(); enrollPage.enroll(enrollString); RetryManager.runUntilSuccessful(new RetryableTaskReturns<Integer>("Assert outdated responses removed") { @Override public Integer run() { return getAllResponsesForStudentForSession(student, session.getFeedbackSessionName()).size(); } @Override public boolean isSuccessful(Integer numberOfResponses) { return numberOfResponses == 0; } }); }
Source:
public SaveScreenshotTask(Bitmap screenshot) { this.context = getContext(); this.screenshot = screenshot; }

Target:
SaveScreenshotTask(Bitmap screenshot) { this.context = getContext(); this.screenshot = screenshot; }
Source:
public void acknowledgeRequest(int requestID) throws RemoteException { logger.finer("Received acknowledgement for request " + requestID); int newCount = pendingAcknowledgements.get(requestID) - 1; pendingAcknowledgements.replace(requestID, newCount); if (newCount == 0) { logger.fine("All acknowledgements for request " + requestID + " received"); Action action = pendingRequests.get(requestID).getAction(); performAction(action); broadcastActionToServers(action); removeRequest(requestID); } }

Target:
public void acknowledgeRequest(int requestID) throws RemoteException { logger.finer("Received acknowledgement for request " + requestID); int newCount = pendingAcknowledgements.get(requestID) - 1; if(pendingAcknowledgements.containsKey(requestID)) { pendingAcknowledgements.put(requestID, newCount); } if (newCount == 0) { logger.fine("All acknowledgements for request " + requestID + " received"); Action action = pendingRequests.get(requestID).getAction(); performAction(action); broadcastActionToServers(action); removeRequest(requestID); } }
Source:
public void serialize( QueryMetricsResponse response, JsonGenerator g, SerializerProvider provider ) throws IOException { final List<ShardedResultGroup> result = response.getResult(); final Map<String, SortedSet<String>> common = calculateCommon(g, result); g.writeStartObject(); g.writeObjectField("queryId", response.getQueryId()); g.writeObjectField("range", response.getRange()); g.writeObjectField("trace", response.getTrace()); g.writeObjectField("limits", response.getLimits()); g.writeFieldName("commonTags"); serializeCommonTags(g, common); g.writeFieldName("result"); serializeResult(g, common, result); g.writeObjectField("rawSampleSize", response.getPreAggregationSampleSize()); g.writeFieldName("errors"); serializeErrors(g, response.getErrors()); g.writeEndObject(); }

Target:
public void serialize( QueryMetricsResponse response, JsonGenerator g, SerializerProvider provider ) throws IOException { final List<ShardedResultGroup> result = response.getResult(); final Map<String, SortedSet<String>> common = calculateCommon(g, result); g.writeStartObject(); g.writeObjectField("queryId", response.getQueryId()); g.writeObjectField("range", response.getRange()); g.writeObjectField("trace", response.getTrace()); g.writeObjectField("limits", response.getLimits()); g.writeFieldName("commonTags"); serializeCommonTags(g, common); g.writeFieldName("result"); serializeResult(g, common, result); g.writeObjectField("preAggregationSampleSize", response.getPreAggregationSampleSize()); g.writeFieldName("errors"); serializeErrors(g, response.getErrors()); g.writeEndObject(); }
Source:
public RefactoringStatus validateDescriptor() { final RefactoringStatus status= super.validateDescriptor(); if (fType == null) status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.MoveStaticMembersDescriptor_no_type)); if (fMembers == null) status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.MoveStaticMembersDescriptor_no_members)); else { for (IMember fMember : fMembers) { if (fMember == null) { status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.MoveStaticMembersDescriptor_invalid_members)); break; } } } return status; }

Target:
public RefactoringStatus validateDescriptor() { final RefactoringStatus status= super.validateDescriptor(); if (fType == null) status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.MoveStaticMembersDescriptor_no_type)); if (fMembers == null) status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.MoveStaticMembersDescriptor_no_members)); else { for (IMember member : fMembers) { if (member == null) { status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.MoveStaticMembersDescriptor_invalid_members)); break; } } } return status; }
Source:
public <T extends Identifiable> void moveItems(Workset from, Workset to, Collection<T> items, Function<Workset, Set<T>> getter, String pluralTypeLabel) { Set<T> sourceItems = getter.apply(from); int initialSize = sourceItems.size(); Set<Long> itemIds = items.stream().map(Identifiable::getId).collect(Collectors.toSet()); sourceItems.removeIf(item -> itemIds.contains(item.getId())); if (initialSize - sourceItems.size() != items.size()) { throw new ValidationException(String.format("Not all %s were found in source workset", pluralTypeLabel)); } getter.apply(to).addAll(items); worksetStore.save(to); worksetStore.save(from); }

Target:
public <T extends Identifiable> void moveItems(Workset from, Workset to, Collection<T> items, Function<Workset, Set<T>> getter, String pluralTypeLabel) { if (from.getId() == to.getId()) { throw new ValidationException(String.format("Trying to move %s from the same workset", pluralTypeLabel)); } Set<T> sourceItems = getter.apply(from); int initialSize = sourceItems.size(); Set<Long> itemIds = items.stream().map(Identifiable::getId).collect(Collectors.toSet()); sourceItems.removeIf(item -> itemIds.contains(item.getId())); if (initialSize - sourceItems.size() != items.size()) { throw new ValidationException(String.format("Not all %s were found in source workset", pluralTypeLabel)); } getter.apply(to).addAll(items); worksetStore.save(to); worksetStore.save(from); }
Source:
public Void call() throws Exception { if (verbose) { System.out.println("Launching brooklyn app: "+app+" in "+Iterables.toString(locations)); } ResourceUtils utils = new ResourceUtils(this); ClassLoader parent = utils.getLoader(); GroovyClassLoader loader = new GroovyClassLoader(parent); AbstractApplication application = loadApplicationFromClasspathOrParse(utils, loader, app); if (script != null) { String content = utils.getResourceAsString(script); GroovyShell shell = new GroovyShell(loader); shell.evaluate(content); } List<Location> brooklynLocations = new LocationRegistry().getLocationsById( Iterables.isEmpty(locations) ? ImmutableSet.of(CommandLineLocations.LOCALHOST) : locations); BrooklynLauncher.manage(application, port, !noShutdownOnExit, !noConsole); application.start(brooklynLocations); if (verbose) { Entities.dumpInfo(application); } waitUntilInterrupted(); return null; }

Target:
public Void call() throws Exception { if (verbose) { System.out.println("Launching brooklyn app: "+app+" in "+Iterables.toString(locations)); } ResourceUtils utils = new ResourceUtils(this); ClassLoader parent = utils.getLoader(); GroovyClassLoader loader = new GroovyClassLoader(parent); AbstractApplication application = loadApplicationFromClasspathOrParse(utils, loader, app); if (script != null) { String content = utils.getResourceAsString(script); GroovyShell shell = new GroovyShell(loader); shell.evaluate(content); } List<Location> brooklynLocations = new LocationRegistry().getLocationsById( (locations==null || Iterables.isEmpty(locations)) ? ImmutableSet.of(CommandLineLocations.LOCALHOST) : locations); log.info("Adding application under brooklyn management"); BrooklynLauncher.manage(application, port, !noShutdownOnExit, !noConsole); log.info("Starting brooklyn application: "+app); application.start(brooklynLocations); if (verbose) { Entities.dumpInfo(application); } waitUntilInterrupted(); return null; }
Source:
public void setBreakpointMark( final Breakpoint breakpoint, final boolean active, final LineChangeAction action) { if (hasGutter != null) { BreakpointConfiguration breakpointConfiguration = breakpoint.getBreakpointConfiguration(); int lineNumber = breakpoint.getLocation().getLineNumber() - 1; boolean hasCondition = !Strings.isNullOrEmpty(breakpointConfiguration.getCondition()) || breakpointConfiguration.getHitCount() != 0; Element newElement = active ? (hasCondition ? activeConditionBreakpointMark : activeBreakpointMark) : (hasCondition ? inactiveConditionBreakpointMark : inactiveBreakpointMark); if (hasCondition) { newElement.setTitle( "Condition: " + breakpointConfiguration.getCondition() + ", hit count: " + breakpointConfiguration.getCondition()); } Element existedElement = hasGutter.getGutterItem(lineNumber, BREAKPOINTS_GUTTER); if (existedElement != null) { hasGutter.setGutterItem(lineNumber, BREAKPOINTS_GUTTER, newElement); } else { hasGutter.addGutterItem( lineNumber, BREAKPOINTS_GUTTER, newElement, (fromLine, linesRemoved, linesAdded) -> action.onLineChange(document.getFile(), fromLine, linesAdded, linesRemoved)); } } }

Target:
public void setBreakpointMark( final Breakpoint breakpoint, final boolean active, final LineChangeAction action) { if (hasGutter != null) { int lineNumber = breakpoint.getLocation().getLineNumber() - 1; boolean hasCondition = !Strings.isNullOrEmpty(breakpoint.getCondition()); Element newElement = active ? (hasCondition ? activeConditionBreakpointMark : activeBreakpointMark) : (hasCondition ? inactiveConditionBreakpointMark : inactiveBreakpointMark); if (hasCondition) { newElement.setTitle("Condition: " + breakpoint.getCondition()); } Element existedElement = hasGutter.getGutterItem(lineNumber, BREAKPOINTS_GUTTER); if (existedElement != null) { hasGutter.setGutterItem(lineNumber, BREAKPOINTS_GUTTER, newElement); } else { hasGutter.addGutterItem( lineNumber, BREAKPOINTS_GUTTER, newElement, (fromLine, linesRemoved, linesAdded) -> action.onLineChange(document.getFile(), fromLine, linesAdded, linesRemoved)); } } }
Source:
public boolean isAvailable(@RcsImsCapabilities.RcsImsCapabilityFlag int capability) throws ImsException { try { int currentStatus = mRcsFeatureConnection.queryCapabilityStatus(); return (capability == currentStatus) ? true : false; } catch (RemoteException e) { loge("isAvailable error: ", e); throw new ImsException("is RCS available", e, ImsReasonInfo.CODE_LOCAL_INTERNAL_ERROR); } }

Target:
public boolean isAvailable(@RcsImsCapabilities.RcsImsCapabilityFlag int capability) throws ImsException { try { int currentStatus = mRcsFeatureConnection.queryCapabilityStatus(); return new RcsImsCapabilities(currentStatus).isCapable(capability); } catch (RemoteException e) { loge("isAvailable error: ", e); throw new ImsException("is RCS available", e, ImsReasonInfo.CODE_LOCAL_INTERNAL_ERROR); } }
Source:
public void updateCredential(UserCredentialModel cred) { if (cred.getType().equals(UserCredentialModel.PASSWORD)) { updatePasswordCredential(cred); } else { CredentialEntity credentialEntity = getCredentialEntity(user, cred.getType()); if (credentialEntity == null) { credentialEntity = setCredentials(user, cred); credentialEntity.setValue(cred.getValue()); user.getCredentials().add(credentialEntity); } else { credentialEntity.setValue(cred.getValue()); } } getMongoStore().updateEntity(user, invocationContext); }

Target:
public void updateCredential(UserCredentialModel cred) { CredentialEntity credentialEntity = getCredentialEntity(user, cred.getType()); if (credentialEntity == null) { credentialEntity = new CredentialEntity(); credentialEntity.setType(cred.getType()); credentialEntity.setDevice(cred.getDevice()); user.getCredentials().add(credentialEntity); } if (cred.getType().equals(UserCredentialModel.PASSWORD)) { byte[] salt = Pbkdf2PasswordEncoder.getSalt(); int hashIterations = 1; PasswordPolicy policy = realm.getPasswordPolicy(); if (policy != null) { hashIterations = policy.getHashIterations(); if (hashIterations == -1) hashIterations = 1; } credentialEntity.setValue(new Pbkdf2PasswordEncoder(salt).encode(cred.getValue(), hashIterations)); credentialEntity.setSalt(salt); credentialEntity.setHashIterations(hashIterations); } else { credentialEntity.setValue(cred.getValue()); } credentialEntity.setDevice(cred.getDevice()); getMongoStore().updateEntity(user, invocationContext); }