auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DOI(String doi) { Objects.requireNonNull(doi); String trimmedDoi = doi.trim(); if (doi.matches(HTTP_EXP) || doi.matches(SHORT_DOI_HTTP_EXP)) { try { URI url = new URI(trimmedDoi); trimmedDoi = url.getScheme() + "://" + url.getHost() + url.getPath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(doi + " is not a valid HTTP DOI/Short DOI."); } } Matcher matcher = EXACT_DOI_PATT.matcher(trimmedDoi); if (matcher.find()) { this.doi = matcher.group(1).replaceAll("[^\\w,/,:,-,.,-]|[_]", ""); } else { Matcher shortDoiMatcher = EXACT_SHORT_DOI_PATT.matcher(trimmedDoi); if (shortDoiMatcher.find()) { this.doi = shortDoiMatcher.group(1).replaceAll("[^\\w,/,:,-,.,-]|[_]", ""); isShortDoi = true; } else { throw new IllegalArgumentException(trimmedDoi + " is not a valid DOI/Short DOI."); } } }

Target:
public DOI(String doi) { Objects.requireNonNull(doi); String trimmedDoi = doi.trim(); if (doi.matches(HTTP_EXP) || doi.matches(SHORT_DOI_HTTP_EXP)) { try { URI url = new URI(trimmedDoi); trimmedDoi = url.getScheme() + "://" + url.getHost() + url.getPath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(doi + " is not a valid HTTP DOI/Short DOI."); } } Matcher matcher = EXACT_DOI_PATT.matcher(trimmedDoi); if (matcher.find()) { this.doi = matcher.group(1); } else { Matcher shortDoiMatcher = EXACT_SHORT_DOI_PATT.matcher(trimmedDoi); if (shortDoiMatcher.find()) { this.doi = shortDoiMatcher.group(1); isShortDoi = true; } else { Matcher shortcutDoiMatcher = EXACT_SHORT_DOI_SHORTCUT.matcher(trimmedDoi); if (shortcutDoiMatcher.find()) { this.doi = "10/" + shortcutDoiMatcher.group(1); isShortDoi = true; } else { throw new IllegalArgumentException(trimmedDoi + " is not a valid DOI/Short DOI."); } } } }
Source:
public void finalizeRun() { if (getEngine().getPlatform() != Platform.CLIENT && !this.isOnlineLive()) { remove(); } super.finalizeRun(); if (isRemoved()) { if (getEngine().getPlatform() == Platform.SERVER) { ((ServerNetworkSynchronizer) getNetworkSynchronizer()).onRemoved(); ((SpoutServer) getEngine()).removePlayer(this); } getNetwork().setSessionLive(null); } else if (this.isOnline()) { this.getNetworkSynchronizer().finalizeTick(); } }

Target:
public void finalizeRun() { if (getEngine().getPlatform() != Platform.CLIENT && !this.isOnlineLive()) { remove(); } super.finalizeRun(); if (isRemoved()) { if (getEngine().getPlatform() == Platform.SERVER) { ((ServerNetworkSynchronizer) getNetworkSynchronizer()).onRemoved(); ((SpoutServer) getEngine()).removePlayer(this); } } else if (this.isOnline()) { this.getNetworkSynchronizer().finalizeTick(); } }
Source:
private List<ShareButtonAdapter.ShareButtonItem> getShareButtons(Activity activity, Intent intent) { List<ShareButtonAdapter.ShareButtonItem> shareButtons = new ArrayList<>(); final List<ResolveInfo> matches = activity.getPackageManager().queryIntentActivities(intent, 0); for (ResolveInfo match : matches) { IconResizer iconResizer = new IconResizer(getContext()); final Drawable icon = iconResizer.createIconThumbnail(match.loadIcon(activity.getPackageManager())); final CharSequence label = match.loadLabel(activity.getPackageManager()); shareButtons.add(new ShareButtonAdapter.ShareButtonItem(icon, label, match.activityInfo.packageName, match.activityInfo.name)); } return shareButtons; }

Target:
private List<ShareButtonAdapter.ShareButtonItem> getShareButtons(Activity activity, Intent intent) { List<ShareButtonAdapter.ShareButtonItem> shareButtons = new ArrayList<>(); final List<ResolveInfo> matches = activity.getPackageManager().queryIntentActivities(intent, 0); IconResizer iconResizer = new IconResizer(getContext()); for (ResolveInfo match : matches) { final Drawable icon = iconResizer.createIconThumbnail(match.loadIcon(activity.getPackageManager())); final CharSequence label = match.loadLabel(activity.getPackageManager()); shareButtons.add(new ShareButtonAdapter.ShareButtonItem(icon, label, match.activityInfo.packageName, match.activityInfo.name)); } return shareButtons; }
Source:
private void removeAt(int index) { if (head < tail) { if (tail - index < index - head) { for (int i = index + 1; i < tail; ++i) { array[i - 1] = array[i]; } tail -= 1; array[tail] = null; } else { for (int i = index - 1; i >= head; --i) { array[i + 1] = array[i]; } array[head] = null; head++; } } else { if (index >= head) { for (int i = index - 1; i >= head; --i) { array[i + 1] = array[i]; } array[head] = null; head++; } else { for (int i = index + 1; i < tail; ++i) { array[i - 1] = array[i]; } tail -= 1; array[tail] = null; } } }

Target:
private void removeAt(int index) { if (head < tail) { if (tail - index < index - head) { for (int i = index + 1; i < tail; ++i) { array[i - 1] = array[i]; } array[--tail] = null; } else { for (int i = index - 1; i >= head; --i) { array[i + 1] = array[i]; } array[head++] = null; } } else { if (index >= head) { for (int i = index - 1; i >= head; --i) { array[i + 1] = array[i]; } array[head++] = null; } else { for (int i = index + 1; i < tail; ++i) { array[i - 1] = array[i]; } array[--tail] = null; } } }
Source:
public String toString() { return MessageFormat.format( "activity from {0} to {1} (timezone {2}) of activity category with id {3} and app ''{4}'' and device anonymized with id {5} (activity id {6})", startTime, endTime, timeZone, activityCategory.getId(), app, deviceAnonymized.getId(), getId()); }

Target:
public String toString() { UUID deviceAnonymizedId = deviceAnonymized != null ? deviceAnonymized.getId() : null; return MessageFormat.format( "activity from {0} to {1} (timezone {2}) of activity category with id {3} and app ''{4}'' and device anonymized with id {5} (activity id {6})", startTime, endTime, timeZone, activityCategory.getId(), app, deviceAnonymizedId, getId()); }
Source:
private void collectExpandedBreakpoints(TreeItem item, List<IBreakpoint> list) { Object data = item.getData(); if (data instanceof IBreakpoint) { list.add((IBreakpoint) data); return; } if (item.getExpanded()) { for (TreeItem item2 : item.getItems()) { collectExpandedBreakpoints(item2, list); } } }

Target:
private void collectExpandedBreakpoints(TreeItem item, List<IBreakpoint> list) { Object data = item.getData(); if (data instanceof IBreakpoint) { list.add((IBreakpoint) data); return; } if (item.getExpanded()) { for (TreeItem childItem : item.getItems()) { collectExpandedBreakpoints(childItem, list); } } }
Source:
protected void executeCommand() { lunsToUpdateInDb = getLunsToUpdateInDb(); if (acquireLockInternal()) { lunDao.updateAllInBatch(getLunsToUpdateInDb()); freeLock(); setSucceeded(true); } }

Target:
protected void executeCommand() { lunsToUpdateInDb = getLunsToUpdateInDb(); if (acquireLockInternal()) { TransactionSupport.executeInNewTransaction(() -> { Collection<LUNs> oldLuns = lunIdToDiskIdOfDirectLunsAttachedToVmsInPool.keySet() .stream() .map(lunDao::get) .collect(Collectors.toList()); CompensationContext context = getCompensationContext(); context.snapshotEntities(oldLuns); lunDao.updateAllInBatch(lunsToUpdateInDb); context.stateChanged(); log.info("LUNs with IDs: [" + lunsToUpdateInDb.stream().map(LUNs::getLUNId).collect(Collectors.joining(", ")) + "] were updated in the DB."); setSucceeded(true); return null; }); freeLock(); } else { addCustomValue("DisksIds", lunsToUpdateInDb.stream() .map(LUNs::getDiskId).map(Guid::toString).collect(Collectors.joining(", "))); auditLogDirector.log(this, AuditLogType.DIRECT_LUNS_COULD_NOT_BE_SYNCED); } }
Source:
private boolean isSignificant(String candidateClassName) { return !excludedClasses.contains(candidateClassName) && !candidateClassName.startsWith("java.lang.") && (excludeClassesRegexp == null || excludeClassesRegexp.isEmpty() || !candidateClassName.matches(excludeClassesRegexp)); }

Target:
private boolean isSignificant(String candidateClassName) { boolean result = !excludedClasses.contains(candidateClassName) && !candidateClassName.startsWith("java.lang."); if (result) { for (Pattern pattern : excludeClassesRegexps) { if (pattern.matcher(candidateClassName).matches()) { result = false; break; } } } return result; }
Source:
private static void setToken(Application a){ if (a.getPreferenceManager().getToken() != null) CountlyPush.onTokenRefresh(a.getPreferenceManager().getToken()); System.out.println("CountlyPush " + a.getPreferenceManager().getToken()); }

Target:
private static void setToken(Application a){ if (a.getPreferenceManager().getToken() != null) CountlyPush.onTokenRefresh(a.getPreferenceManager().getToken()); }
Source:
private void checkTagPresentInDeleteMarker(String tableName, String startRowKey, boolean tagPresent, String tagValue) throws IOException { List<Cell> values = new ArrayList<>(); TableName table = TableName.valueOf(tableName); for (HRegion region : getUtility().getHBaseCluster().getRegions(table)) { values.clear(); Scan scan = new Scan(); scan.setRaw(true); scan.withStartRow(Bytes.toBytes(startRowKey)); RegionScanner scanner = region.getScanner(scan); scanner.next(values); if (!values.isEmpty()) { break; } } assertTrue("Values shouldn't be empty", !values.isEmpty()); Cell first = values.get(0); assertTrue("First cell should be delete marker ", PrivateCellUtil.isDelete(first.getType().getCode())); List<Tag> tags = PrivateCellUtil.getTags(first); if (tagPresent) { assertEquals(1, tags.size()); Optional<Tag> optional = PrivateCellUtil.getTag(first, PhoenixTagType.SOURCE_OPERATION_TAG_TYPE); assertTrue(optional.isPresent()); Tag sourceOfOperationTag = optional.get(); assertEquals(tagValue, Tag.getValueAsString(sourceOfOperationTag)); } else { assertEquals(0, tags.size()); } }

Target:
private void checkTagPresentInDeleteMarker(String tableName, String startRowKey, boolean tagPresent, String tagValue) throws IOException { List<Cell> values = new ArrayList<>(); TableName table = TableName.valueOf(tableName); for (HRegion region : getUtility().getHBaseCluster().getRegions(table)) { Scan scan = new Scan(); scan.setRaw(true); scan.withStartRow(Bytes.toBytes(startRowKey)); RegionScanner scanner = region.getScanner(scan); scanner.next(values); if (!values.isEmpty()) { break; } } assertFalse("Values shouldn't be empty", values.isEmpty()); Cell first = values.get(0); assertTrue("First cell should be delete marker ", CellUtil.isDelete(first)); List<Tag> tags = PrivateCellUtil.getTags(first); if (tagPresent) { assertEquals(1, tags.size()); RawCell rawCell = (RawCell)first; Optional<Tag> optional = rawCell.getTag(PhoenixTagType.SOURCE_OPERATION_TAG_TYPE); assertTrue(optional.isPresent()); Tag sourceOfOperationTag = optional.get(); assertEquals(tagValue, Tag.getValueAsString(sourceOfOperationTag)); } else { assertEquals(0, tags.size()); } }
Source:
protected void handleEvent(VariableEvent event) { AbstractVariableScope sourceScope = event.getSourceScope(); if (sourceScope instanceof ExecutionEntity) { addEventToScopeExecution((ExecutionEntity) sourceScope, event); } else { if(sourceScope.getParentVariableScope() instanceof ExecutionEntity) { ExecutionEntity execution = (ExecutionEntity)sourceScope.getParentVariableScope(); if (execution != null) { addEventToScopeExecution(execution, event); } } else { throw new ProcessEngineException("BPMN execution scope expected"); } } }

Target:
protected void handleEvent(VariableEvent event) { AbstractVariableScope sourceScope = event.getSourceScope(); if (sourceScope instanceof ExecutionEntity) { addEventToScopeExecution((ExecutionEntity) sourceScope, event); } else if (sourceScope instanceof TaskEntity) { TaskEntity task = (TaskEntity) sourceScope; ExecutionEntity execution = task.getExecution(); if (execution != null) { addEventToScopeExecution(execution, event); } } else if(sourceScope.getParentVariableScope() instanceof ExecutionEntity) { addEventToScopeExecution((ExecutionEntity)sourceScope.getParentVariableScope(), event); } else { throw new ProcessEngineException("BPMN execution scope expected"); } }
Source:
public Object visitSizeCommand(InvocationContext ctx, SizeCommand command) throws Throwable { Object size = super.visitSizeCommand(ctx, command); if (enabled && passivationEnabled && size instanceof Integer) { int loaderSize = loader.loadAllKeys(Collections.emptySet()).size(); return loaderSize + ((Integer) size).intValue(); } else { return size; } }

Target:
public Object visitSizeCommand(InvocationContext ctx, SizeCommand command) throws Throwable { int totalSize = 0; if (enabled && !shouldSkipCacheLoader(command)) { totalSize = loader.loadAllKeys(Collections.emptySet()).size(); } if (cacheConfiguration.loaders().passivation() || totalSize == 0) { totalSize += (Integer)super.visitSizeCommand(ctx, command); } return totalSize; }
Source:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); FailureCollector collector = context.getFailureCollector(); collector.getOrThrowException(); context.record( TransformLineageRecorderUtils.oneInToAllOut(config.inputField, TransformLineageRecorderUtils.getFields(outSchema), "XMLParse", "Parsed XML data into a full row.")); }

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); FailureCollector collector = context.getFailureCollector(); collector.getOrThrowException(); context.record( TransformLineageRecorderUtils.generateOneToMany(config.inputField, TransformLineageRecorderUtils.getFields(context.getOutputSchema()), "XMLParse", "Parsed XML data into a full row.")); }
Source:
public int compareTo(final TimeValue other) { if (other != null) { final TimeUnit targetTimeUnit = min(other.getTimeUnit()); return Long.compare(convert(targetTimeUnit), other.convert(targetTimeUnit)); } else { return -Integer.MAX_VALUE; } }

Target:
public int compareTo(final TimeValue other) { final TimeUnit targetTimeUnit = min(other.getTimeUnit()); return Long.compare(convert(targetTimeUnit), other.convert(targetTimeUnit)); }
Source:
void add(Closeable hook) { if (closeHooks == null) { closeHooks = new ConcurrentHashSet<>(); } closeHooks.add(hook); }

Target:
synchronized void add(Closeable hook) { if (closeHooks == null) { closeHooks = new HashSet<>(); } closeHooks.add(hook); }
Source:
public void startGitRepoRemoteHttpAuthTest() throws Exception { container.startGitBackedConfiguration("http://agitter@localhost:" + httpServer.getUri().getPort() + "/sbasic/.git", Constants.MASTER, AUTH_FILE); Assert.assertTrue("Directory not found " + getDotGitDir(), Files.exists(getDotGitDir())); Assert.assertTrue("File not found " + getDotGitIgnore(), Files.exists(getDotGitIgnore())); List<String> commits = listCommits(remoteRepository); Assert.assertEquals(1, commits.size()); addSystemProperty(); publish(null); commits = listCommits(remoteRepository); Assert.assertEquals(3, commits.size()); try (Git git = new Git(remoteRepository)) { git.checkout().setName("my_branch").setCreateBranch(true).call(); } removeSystemProperty(); publish(null); container.stop(); closeRepository(); container.startGitBackedConfiguration("http://agitter@localhost:" + httpServer.getUri().getPort() + "/sbasic/.git", "my_branch", AUTH_FILE); Assert.assertTrue("Directory not found " + getDotGitDir(), Files.exists(getDotGitDir())); Assert.assertTrue("File not found " + getDotGitIgnore(), Files.exists(getDotGitIgnore())); try { addSystemProperty(); Assert.fail("Operation should have failed"); } catch (UnsuccessfulOperationException uoe) { Assert.assertTrue(uoe.getMessage().contains("WFLYCTL0212")); } }

Target:
public void startGitRepoRemoteHttpAuthTest() throws Exception { container.startGitBackedConfiguration("<LINK_0>" + httpServer.getUri().getPort() + "/sbasic/.git", Constants.MASTER, AUTH_FILE); Assert.assertTrue("Directory not found " + getDotGitDir(), Files.exists(getDotGitDir())); Assert.assertTrue("File not found " + getDotGitIgnore(), Files.exists(getDotGitIgnore())); List<String> commits = listCommits(remoteRepository); Assert.assertEquals(1, commits.size()); addSystemProperty(); publish(null); commits = listCommits(remoteRepository); Assert.assertEquals(3, commits.size()); try (Git git = new Git(remoteRepository)) { git.checkout().setName("my_branch").setCreateBranch(true).call(); } removeSystemProperty(); publish(null); container.stop(); closeRepository(); container.startGitBackedConfiguration("<LINK_0>" + httpServer.getUri().getPort() + "/sbasic/.git", "my_branch", AUTH_FILE); Assert.assertTrue("Directory not found " + getDotGitDir(), Files.exists(getDotGitDir())); Assert.assertTrue("File not found " + getDotGitIgnore(), Files.exists(getDotGitIgnore())); try { addSystemProperty(); Assert.fail("Operation should have failed"); } catch (UnsuccessfulOperationException uoe) { Assert.assertTrue(uoe.getMessage().contains("WFLYCTL0212")); } }
Source:
@Override public RelRoot rel(SqlNode sql) throws RelConversionException { if (m_state == State.STATE_1_READY) { try { validate(sql); } catch (ValidationException e) { throw new RelConversionException(e); } } ensure(State.STATE_2_VALIDATED); assert(m_validatedSqlNode != null); m_relRoot = m_sqlToRelConverter.convertQuery( m_validatedSqlNode, false , true ); m_relRoot = m_relRoot.withRel(RelDecorrelator.decorrelateQuery(m_relRoot.rel, m_relBuilder)); m_state = State.STATE_3_CONVERTED; return m_relRoot; }

Target:
@Override public RelRoot rel(SqlNode sql) throws RelConversionException { if (m_state == State.STATE_1_READY) { try { validate(sql); } catch (ValidationException e) { throw new RelConversionException(e); } } ensure(State.STATE_2_VALIDATED); Preconditions.checkNotNull(m_validatedSqlNode, "Validated SQL node cannot be null."); m_relRoot = m_sqlToRelConverter.convertQuery( m_validatedSqlNode, false , true ); m_relRoot = m_relRoot.withRel(RelDecorrelator.decorrelateQuery(m_relRoot.rel, m_relBuilder)); m_state = State.STATE_3_CONVERTED; return m_relRoot; }
Source:
public static boolean isStreamStoreValueTable(TableReference tableReference) { return tableReference.getQualifiedName().contains(StreamTableType.VALUE.tableSuffix); }

Target:
public static boolean isStreamStoreValueTable(TableReference tableReference) { return tableReference.getQualifiedName().endsWith(StreamTableType.VALUE.tableSuffix); }
Source:
private void handleTimeZone() { if (!isVmTimeZoneValid(getVm())) { log.warnFormat("ResourceManager::{0}::Attempting to run VM {1} with incorrect timezone '{2}'. Resetting timezone to engine default.", getClass().getName(), getVmId().toString(), getVm().getTimeZone()); getVm().getStaticData().setTimeZone(null); if (!getVm().isRunOnce()) { getVmStaticDAO().update(getVm().getStaticData()); } } }

Target:
private void handleTimeZone() { if (!VmHandler.isTimeZoneLegal(getVm().getStaticData())) { log.warnFormat("Attempting to run VM {0} - {1} with incorrect timezone '{2}'. Resetting timezone to engine default.", getVmId(), getVm().getName(), getVm().getTimeZone()); getVm().getStaticData().setTimeZone(null); if (!getVm().isRunOnce()) { getVmStaticDAO().update(getVm().getStaticData()); } } }
Source:
private void testFindAvailableFunctions(String clazz, String[] expectedFunctions) { List<FunctionDef> functionDefs = service.findAvailableFunctions(path, clazz); assertEquals(functionDefs.size(), expectedFunctions.length); for (String expectedFunction : expectedFunctions) { assertTrue(functionDefs.stream() .filter(functionDef -> expectedFunction.equals(functionDef.getName())) .findFirst() .isPresent()); } }

Target:
private void testFindAvailableFunctions(String clazz, String[] expectedFunctions) { List<FunctionDef> functionDefs = service.findAvailableFunctions(path, clazz); assertEquals(functionDefs.size(), expectedFunctions.length); for (String expectedFunction : expectedFunctions) { assertTrue(functionDefs.stream() .anyMatch(functionDef -> expectedFunction.equals(functionDef.getName()))); } }
Source:
public void teardownTest() throws InterruptedException { sharedStorageApi().delete(currentSharedStorage.id()); assertNodeAvailable(currentServer); deleteServer(currentServer.id()); }

Target:
public void teardownTest() { sharedStorageApi().delete(currentSharedStorage.id()); assertNodeAvailable(currentServer); deleteServer(currentServer.id()); }
Source:
public ManagerMethod getMethod(String methodName) { return TasksManagerMethod.valueOf(methodName); }

Target:
public ManagerMethod getMethod(String methodName) { return VosManagerMethod.valueOf(methodName); }
Source:
public Completable sendMessage(int threadId, String body) { body = "<p>" + body + "</p>"; body = body.replaceAll("\n", "<br>"); String finalBody = body; return Completable.create(emitter -> { MessageThread thread = getRaw(threadId); if (thread == null) { throw new Error("The thread needs to already be in the cache."); } int id = getNextPendingMessageId(thread); int authorId = mLoggedInUserHelper.getId(); if (authorId == -1) { throw new Error("No currently logged in user."); } Message message = new Message(id, threadId, authorId, new Date(), finalBody, false, false); List<Message> messages = new ArrayList<>(thread.messages); messages.add(message); thread = new MessageThread( thread.id, thread.subject, thread.started, thread.isRead, thread.participantIds, messages, new Date()); save(threadId, thread); emitter.onComplete(); sendMessagesToServer(thread); }).subscribeOn(Schedulers.io()); }

Target:
public Completable sendMessage(int threadId, String body) { body = "<p>" + body + "</p>"; body = body.replace("\n", "<br>"); String finalBody = body; return Completable.create(emitter -> { MessageThread thread = getRaw(threadId); if (thread == null) { throw new Error("The thread needs to already be in the cache."); } int id = getNextPendingMessageId(thread); int authorId = mLoggedInUserHelper.getId(); if (authorId == -1) { throw new Error("No currently logged in user."); } Message message = new Message(id, threadId, authorId, new Date(), finalBody, false, false); List<Message> messages = new ArrayList<>(thread.messages); messages.add(message); thread = new MessageThread( thread.id, thread.subject, thread.started, thread.isRead, thread.participantIds, messages, new Date()); save(threadId, thread); emitter.onComplete(); sendMessagesToServer(thread); }).subscribeOn(Schedulers.io()); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((owningNodeUuid == null) ? 0 : owningNodeUuid.hashCode()); result = prime * result + ((workspaceName == null) ? 0 : workspaceName.hashCode()); return result; }

Target:
public int hashCode() { return owningNodeUuid.hashCode(); }
Source:
public NetworkMetadata claim(String dataCenterId) { NetworkMetadata metadata = experimentalClient("/networks/{accountAlias}/{dataCenterId}/claim") .resolveTemplate("dataCenterId", dataCenterId) .request() .post(entity(new HashMap(), APPLICATION_JSON_TYPE)) .readEntity(NetworkMetadata.class); setDatacenter(metadata, dataCenterId); return metadata; }

Target:
public NetworkMetadata claim(String dataCenterId) { NetworkMetadata metadata = experimentalClient("/networks/{accountAlias}/{dataCenterId}/claim") .resolveTemplate("dataCenterId", dataCenterId) .request() .post(entity(new HashMap<>(), APPLICATION_JSON_TYPE)) .readEntity(NetworkMetadata.class); setDatacenter(metadata, dataCenterId); return metadata; }
Source:
public final void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = (ConfigurableApplicationContext) applicationContext; Map<String, StreamListenerParameterAdapter> parameterAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerParameterAdapter.class); for (StreamListenerParameterAdapter parameterAdapter : parameterAdapterMap.values()) { this.streamListenerParameterAdapters.add(parameterAdapter); } Map<String, StreamListenerResultAdapter> resultAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerResultAdapter.class); this.streamListenerResultAdapters.add(new MessageChannelStreamListenerResultAdapter()); for (StreamListenerResultAdapter resultAdapter : resultAdapterMap.values()) { this.streamListenerResultAdapters.add(resultAdapter); } this.evaluationContext = new StandardEvaluationContext(); }

Target:
public final void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = (ConfigurableApplicationContext) applicationContext; }
Source:
private boolean removeDirectedEdge(DirectedGraphNode source, DirectedGraphNode target) { boolean sourceExisted = source.outgoings.remove(target); boolean targetExisted = target.ingoings.remove(source); assert sourceExisted == targetExisted; return targetExisted; }

Target:
private boolean removeDirectedEdge(DirectedGraphNode source, DirectedGraphNode target) { boolean sourceExisted = source.outgoings.remove(target); boolean targetExisted = target.ingoings.remove(source); if (sourceExisted != targetExisted) { String message = MessageFormat .format("Inconsistent edge encountered from [source: {0}] to [target: {1}]:", source, target); throw new IllegalStateException(message); } return targetExisted; }
Source:
public RedisMetadataStore(RedisConnectionFactory connectionFactory) { Assert.notNull(connectionFactory, "'connectionFactory' must not be null."); this.redisTemplate = new StringRedisTemplate(connectionFactory); this.redisTemplate.afterPropertiesSet(); }

Target:
public RedisMetadataStore(RedisConnectionFactory connectionFactory) { Assert.notNull(connectionFactory, "'connectionFactory' must not be null."); this.redisTemplate = new StringRedisTemplate(connectionFactory); }
Source:
public List<NameValuePair> build() { String expectedFrontend3dsIncomingUrl = "<LINK_0>"; EpdqParameterBuilder epdqParameterBuilder = newParameterBuilder() .add(ACCEPTURL_KEY, expectedFrontend3dsIncomingUrl) .add(AMOUNT_KEY, AMOUNT) .add(CARD_NO_KEY, CARD_NO) .add(CARDHOLDER_NAME_KEY, CARDHOLDER_NAME) .add(CURRENCY_KEY, CURRENCY) .add(CVC_KEY, CVC) .add(DECLINEURL_KEY, expectedFrontend3dsIncomingUrl + "?status=declined") .add(EXPIRY_DATE_KEY, END_DATE) .add(EXCEPTIONURL_KEY, expectedFrontend3dsIncomingUrl + "?status=error") .add(FLAG3D_KEY, "Y") .add(HTTPACCEPT_URL, ACCEPT_HEADER) .add(LANGUAGE_URL, "en_GB") .add(OPERATION_KEY, OPERATION_TYPE) .add(ORDER_ID_KEY, ORDER_ID) .add(PSPID_KEY, PSP_ID) .add(PSWD_KEY, PASSWORD) .add(USERID_KEY, USER_ID) .add(WIN3DS_URL, "MAINW") .add(BROWSER_COLOR_DEPTH, browserColorDepth) .add(BROWSER_LANGUAGE, browserLanguage) .add(BROWSER_SCREEN_HEIGHT, browserScreenHeight) .add(BROWSER_SCREEN_WIDTH, browserScreenWidth) .add(BROWSER_TIMEZONE_OFFSET_MINS, browserTimezoneOffsetMins) .add(BROWSER_USER_AGENT, browserUserAgent); return epdqParameterBuilder.build(); }

Target:
public List<NameValuePair> build() { String expectedFrontend3dsIncomingUrl = "<LINK_0>"; EpdqParameterBuilder epdqParameterBuilder = newParameterBuilder() .add(ACCEPTURL_KEY, expectedFrontend3dsIncomingUrl) .add(AMOUNT_KEY, AMOUNT) .add(CARD_NO_KEY, CARD_NO) .add(CARDHOLDER_NAME_KEY, CARDHOLDER_NAME) .add(CURRENCY_KEY, CURRENCY) .add(CVC_KEY, CVC) .add(DECLINEURL_KEY, expectedFrontend3dsIncomingUrl + "?status=declined") .add(EXPIRY_DATE_KEY, END_DATE) .add(EXCEPTIONURL_KEY, expectedFrontend3dsIncomingUrl + "?status=error") .add(FLAG3D_KEY, "Y") .add(HTTPACCEPT_KEY, browserAcceptHeader) .add(HTTPUSER_AGENT_KEY, browserUserAgent) .add(LANGUAGE_URL, "en_GB") .add(OPERATION_KEY, OPERATION_TYPE) .add(ORDER_ID_KEY, ORDER_ID) .add(PSPID_KEY, PSP_ID) .add(PSWD_KEY, PASSWORD) .add(USERID_KEY, USER_ID) .add(WIN3DS_URL, "MAINW") .add(BROWSER_COLOR_DEPTH, browserColorDepth) .add(BROWSER_LANGUAGE, browserLanguage) .add(BROWSER_SCREEN_HEIGHT, browserScreenHeight) .add(BROWSER_SCREEN_WIDTH, browserScreenWidth) .add(BROWSER_TIMEZONE_OFFSET_MINS, browserTimezoneOffsetMins) .add(BROWSER_ACCEPT_HEADER, browserAcceptHeader) .add(BROWSER_USER_AGENT, browserUserAgent); return epdqParameterBuilder.build(); }
Source:
public void onExit() { uncommittedOffsets = offsets.entrySet().stream() .filter(e -> !e.getValue().isCommitted()) .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getSentOffset())); final String appName = getContext().getParameters().getConsumingAppId(); final NakadiKpiPublisher kpiPublisher = getContext().getKpiPublisher(); final Subscription subscription = getContext().getSubscription(); subscription.getEventTypes().stream() .forEach(et -> { final long bytes = kpiDataPerEventType.get(et).getAndResetBytesSent(); final long count = kpiDataPerEventType.get(et).getAndResetNumberOfEventsSent(); publishKpi(appName, kpiPublisher, et, bytes, count); }); if (null != topologyChangeSubscription) { try { topologyChangeSubscription.close(); } catch (final RuntimeException ex) { getLog().warn("Failed to cancel topology subscription", ex); } finally { topologyChangeSubscription = null; new HashSet<>(offsets.keySet()).forEach(this::removeFromStreaming); } } if (null != eventConsumer) { try { eventConsumer.close(); } catch (final IOException e) { throw new NakadiRuntimeException(e); } finally { eventConsumer = null; } } if (cursorResetSubscription != null) { try { cursorResetSubscription.close(); } catch (IOException ignore) { } cursorResetSubscription = null; } }

Target:
public void onExit() { uncommittedOffsets = offsets.entrySet().stream() .filter(e -> !e.getValue().isCommitted()) .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getSentOffset())); getContext().getSubscription().getEventTypes().stream().forEach(et -> publishKpi(et)); if (null != topologyChangeSubscription) { try { topologyChangeSubscription.close(); } catch (final RuntimeException ex) { getLog().warn("Failed to cancel topology subscription", ex); } finally { topologyChangeSubscription = null; new HashSet<>(offsets.keySet()).forEach(this::removeFromStreaming); } } if (null != eventConsumer) { try { eventConsumer.close(); } catch (final IOException e) { throw new NakadiRuntimeException(e); } finally { eventConsumer = null; } } if (cursorResetSubscription != null) { try { cursorResetSubscription.close(); } catch (IOException ignore) { } cursorResetSubscription = null; } }
Source:
public List<Job> getConfiguredJobs(String serverName) { LinkedList<Job> configuredJobs = new LinkedList<Job>(); for (Job<?, ?> project : Hudson.getInstance().getItems(Job.class)) { GerritTrigger gerritTrigger = GerritTrigger.getTrigger(project); if (gerritTrigger != null && gerritTrigger.getServerName().equals(serverName)) { configuredJobs.add(project); } } return configuredJobs; }

Target:
public List<Job> getConfiguredJobs(String serverName) { LinkedList<Job> configuredJobs = new LinkedList<Job>(); for (Job<?, ?> project : Jenkins.getInstance().getItems(Job.class)) { GerritTrigger gerritTrigger = GerritTrigger.getTrigger(project); if (gerritTrigger != null && gerritTrigger.getServerName().equals(serverName)) { configuredJobs.add(project); } } return configuredJobs; }
Source:
public List<Variant> mapLine(String line, int lineNumber) { assertNotNull(this.getClass().getSimpleName() + " should be used to read genotyped VCFs only " + "(hint: set VariantSource.Aggregation to NONE)", factory); return factory.create(fileId, studyId, line); }

Target:
public List<Variant> mapLine(String line, int lineNumber) { return factory.create(fileId, studyId, line); }
Source:
public ExecutionHandler(Executor<C, E> executor, Collection<? extends E> executables, Function<E, String> nameFactory, Function<ModelNode, String> nameExtractor) { this.executor = executor; Map<String, E> map = new HashMap<>(); for (E executable : executables) { if (map.put(nameFactory.apply(executable), executable) != null) { throw new IllegalStateException("Duplicate key"); } } this.executables = map; this.nameExtractor = nameExtractor; }

Target:
public ExecutionHandler(Executor<C, E> executor, Collection<? extends E> executables, Function<E, String> nameFactory, Function<ModelNode, String> nameExtractor) { this.executor = executor; Map<String, E> map = new HashMap<>(); for (E executable : executables) { map.put(nameFactory.apply(executable), executable); } this.executables = map; this.nameExtractor = nameExtractor; }
Source:
protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) { final Scan scan = new Scan(); for (Column column : columns) { if (!column.isPrimaryKey()) { final int colonIndex = column.getName().indexOf(':'); final int len = column.getName().length(); if (colonIndex != -1) { String family = column.getName().substring(0, colonIndex); String colName = column.getName().substring(colonIndex + 1, len); scan.addColumn(family.getBytes(),colName.getBytes()); } else { scan.addFamily(column.getName().getBytes()); } } } if (maxRows > 0) { setMaxRows(scan, maxRows); } final org.apache.hadoop.hbase.client.Table hTable = getHTable(table.getName()); try { final ResultScanner scanner = hTable.getScanner(scan); return new HBaseDataSet(columns, scanner, hTable); } catch (Exception e) { FileHelper.safeClose(hTable); throw new MetaModelException(e); } }

Target:
protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) { final Scan scan = new Scan(); for (Column column : columns) { if (!column.isPrimaryKey()) { final int colonIndex = column.getName().indexOf(':'); final int len = column.getName().length(); if (colonIndex != -1) { final String family = column.getName().substring(0, colonIndex); final String colName = column.getName().substring(colonIndex + 1, len); scan.addColumn(family.getBytes(), colName.getBytes()); } else { scan.addFamily(column.getName().getBytes()); } } } if (maxRows > 0) { setMaxRows(scan, maxRows); } final org.apache.hadoop.hbase.client.Table hTable = getHTable(table.getName()); try { final ResultScanner scanner = hTable.getScanner(scan); return new HBaseDataSet(columns, scanner, hTable); } catch (Exception e) { FileHelper.safeClose(hTable); throw new MetaModelException(e); } }
Source:
private void NoInternetConnectionSnackbar() { Snackbar mSnackbar = Snackbar.make(getActivity().findViewById(android.R.id.content), "No internet connection", Snackbar.LENGTH_SHORT); View sbView = mSnackbar.getView(); TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); textView.setTextColor(Color.WHITE); mSnackbar.show(); }

Target:
private void NoInternetConnectionSnackbar() { Snackbar mSnackbar = Snackbar.make(getActivity().findViewById(android.R.id.content), R.string.snackbar_no_internet_connection, Snackbar.LENGTH_SHORT); View sbView = mSnackbar.getView(); TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); textView.setTextColor(Color.WHITE); mSnackbar.show(); }
Source:
public void run() { for (int i = 0; i < UPLOADRETRYNUM; i++) { LOG.info(i + " time to try upload"); try { LOG.info("sleep " + ((long) Math.pow(WAITTIMEMILLIS / 1000, i * UPLOADRETRYRATE) - 1) + " seconds"); Thread.sleep(((long) Math.pow(WAITTIMEMILLIS / 1000, i * UPLOADRETRYRATE) - 1) * 1000); } catch (InterruptedException e) { e.printStackTrace(); } uploadRoll(); if (uploadSuccess) { break; } else { if (!networkError) { break; } else { networkError = false; } } } mgr.reportUpload(ident, compression, uploadSuccess); }

Target:
public void run() { for (int i = 0; i < UPLOAD_RETRY_NUM; i++) { uploadRoll(); if (!uploadSuccess && networkError) { if (i + 1 == UPLOAD_RETRY_NUM) break; try { Thread.sleep(WAIT_TIME_MILLIS); } catch (InterruptedException e) { LOG.error("sleep error: " + e); } LOG.warn((i + 1) + " time to retry upload " + ident); networkError = false; } else { break; } } mgr.reportUpload(ident, compression, uploadSuccess); }
Source:
public void descriptionAndBlockTagsAreRetrievable() { Javadoc javadoc = JavaParser.parseJavadoc("first line\nsecond line\n\n@param node a node\n@return result the result"); assertEquals(javadoc.getDescription().toText(), "first line\nsecond line"); assertEquals(2, javadoc.getBlockTagCount()); }

Target:
public void descriptionAndBlockTagsAreRetrievable() { Javadoc javadoc = JavaParser.parseJavadoc("first line\nsecond line\n\n@param node a node\n@return result the result"); assertEquals("first line\nsecond line", javadoc.getDescription().toText()); assertEquals(2, javadoc.getBlockTags().size()); }
Source:
boolean shouldReactToChildVisibilityChanges(MUIElement theElement) { return (theElement instanceof MPartSashContainer || theElement instanceof MPartStack); }

Target:
private static boolean shouldReactToChildVisibilityChanges(MUIElement theElement) { return (theElement instanceof MPartSashContainer || theElement instanceof MPartStack); }
Source:
private List<String> writeStringToFile(String fileContents, String filePath) { return Arrays.asList( "cat << END_OF_FILE_CONTENTS" + ">", filePath + "\n" + fileContents + "\nEND_OF_FILE_CONTENTS\n"); }

Target:
private List<String> writeStringToFile(String fileContents, String filePath) { return Arrays.asList( "cat << 'END_OF_FILE_CONTENTS' >", filePath + "\n" + fileContents + "\nEND_OF_FILE_CONTENTS\n"); }
Source:
private Subfield.PathElement matchQuotedSubscript() { StringBuilder token = new StringBuilder(); boolean escaped = false; while (hasNextCharacter() && (escaped || peekCharacter() != QUOTE)) { if (escaped) { switch (peekCharacter()) { case QUOTE: case BACKSLASH: token.append(peekCharacter()); break; default: throw invalidSubfieldPath(); } escaped = false; } else { switch (peekCharacter()) { case BACKSLASH: escaped = true; break; case QUOTE: throw new IllegalStateException("Should be handled by loop condition"); default: token.append(peekCharacter()); } } nextCharacter(); } if (escaped) { if (hasNextCharacter()) { throw new IllegalStateException("Loop terminated after escape while there is still input"); } throw invalidSubfieldPath(); } match(QUOTE); String index = token.toString(); if (index.equals("*")) { return Subfield.allSubscripts(); } return new Subfield.StringSubscript(index); }

Target:
private Subfield.PathElement matchQuotedSubscript() { StringBuilder token = new StringBuilder(); boolean escaped = false; while (hasNextCharacter() && (escaped || peekCharacter() != QUOTE)) { if (escaped) { switch (peekCharacter()) { case QUOTE: case BACKSLASH: token.append(peekCharacter()); break; default: throw invalidSubfieldPath(); } escaped = false; } else { if (peekCharacter() == BACKSLASH) { escaped = true; } else { token.append(peekCharacter()); } } nextCharacter(); } if (escaped) { throw invalidSubfieldPath(); } match(QUOTE); String index = token.toString(); if (index.equals(String.valueOf(WILDCARD))) { return Subfield.allSubscripts(); } return new Subfield.StringSubscript(index); }
Source:
public int getStatus() { if (m_hasTests) { return exitCode.getExitCode(); } return HAS_NO_TEST; }

Target:
public int getStatus() { if (!exitCodeListener.hasTests()) { return ExitCode.HAS_NO_TEST; } return exitCode.getExitCode(); }
Source:
public void install() throws Exception { log.info("Installing Patient flag tags"); install(Tags.PATIENT_STATUS); log.info("Installing patient flag priorities"); install(Priorites.GREEN); install(Priorites.RED); install(Priorites.ORANGE); log.info("Installing flags"); install(Flags.DUE_FOR_FIRST_VIRAL_LOAD); install(Flags.OVERDUE_FOR_FIRST_VIRAL_LOAD); install(Flags.MISSED_APPOINTMENT); install(Flags.UPCOMING_APPOINTMENT); install(Flags.PATIENT_LOST); install(Flags.PATIENT_LOST_TO_FOLLOWUP); install(Flags.DUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.OVERDUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.DUE_FOR_FIRST_DNA_PCR); install(Flags.OVERDUE_FOR_FIRST_DNA_PCR); install(Flags.DUE_FOR_SECOND_DNA_PCR); install(Flags.OVERDUE_FOR_SECOND_DNA_PCR); install(Flags.DUE_FOR_RAPID_TEST); install(Flags.OVER_DUE_FOR_THIRD_DNA_PCR); install(Flags.OVERDUE_FOR_RAPID_TEST); install(Flags.HAS_DETECTABLE_VIRAL_LOAD); install(Flags.PATIENT_TRANSFERED_OUT); }

Target:
public void install() throws Exception { log.info("Installing Patient flag tags"); install(Tags.PATIENT_STATUS); log.info("Installing patient flag priorities"); install(Priorites.GREEN); install(Priorites.RED); install(Priorites.ORANGE); log.info("Installing flags"); install(Flags.DUE_FOR_FIRST_VIRAL_LOAD); install(Flags.OVERDUE_FOR_FIRST_VIRAL_LOAD); install(Flags.MISSED_APPOINTMENT); install(Flags.UPCOMING_APPOINTMENT); install(Flags.PATIENT_LOST); install(Flags.PATIENT_LOST_TO_FOLLOWUP); install(Flags.DUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.OVERDUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.DUE_FOR_FIRST_DNA_PCR); install(Flags.OVERDUE_FOR_FIRST_DNA_PCR); install(Flags.DUE_FOR_SECOND_DNA_PCR); install(Flags.OVERDUE_FOR_SECOND_DNA_PCR); install(Flags.DUE_FOR_RAPID_TEST); install(Flags.DUE_FOR_THIRD_DNA_PCR); install(Flags.OVERDUE_FOR_THIRD_DNA_PCR); install(Flags.OVERDUE_FOR_RAPID_TEST); install(Flags.HAS_DETECTABLE_VIRAL_LOAD); install(Flags.PATIENT_TRANSFERED_OUT); }
Source:
public GeodesyMLMoxy() { try { Properties properties = new Properties(); SessionEventListener sessionEventListener = new NullPolicySessionEventListener(); properties.put(JAXBContextProperties.SESSION_EVENT_LISTENER, sessionEventListener); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String mappingFilename = "moxy.xml"; Source mapping_geodesyMl = new StreamSource(classLoader.getResourceAsStream(mappingFilename)); Map<String, Source> metadata = new HashMap<String, Source>(); metadata.put("au.gov.xml.icsm.geodesyml.v_0_4", mapping_geodesyMl); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadata); jaxbContext = JAXBContextFactory.createContext(new Class[] {GeodesyMLType.class}, properties); } catch (JAXBException e) { throw new RuntimeException("Failed to initialise JAXBContext", e); } }

Target:
public GeodesyMLMoxy() { try { Properties properties = new Properties(); SessionEventListener sessionEventListener = new NullPolicySessionEventListener(); properties.put(JAXBContextProperties.SESSION_EVENT_LISTENER, sessionEventListener); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String mappingFilename = "moxy.xml"; Source mappingGeodesyML = new StreamSource(classLoader.getResourceAsStream(mappingFilename)); Map<String, Source> metadata = new HashMap<String, Source>(); metadata.put("au.gov.xml.icsm.geodesyml.v_0_4", mappingGeodesyML); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadata); jaxbContext = JAXBContextFactory.createContext(new Class[] {GeodesyMLType.class}, properties); } catch (JAXBException e) { throw new RuntimeException("Failed to initialise JAXBContext", e); } }
Source:
public LedgerEntryImpl duplicate() { LedgerEntryImpl other = RECYCLER.get(); other.ledgerId = ledgerId; other.entryId = entryId; other.length = length; other.entryBuf = entryBuf.retainedSlice(); return other; }

Target:
public LedgerEntryImpl duplicate() { return duplicate(this); }
Source:
boolean allowAction(T obj) { activeObjects.add(obj); AtomicInteger cnt = actionsCnt.get(obj); if (cnt != null) cnt.incrementAndGet(); else actionsCnt.put(obj, new AtomicInteger(1)); return (!actionsCnt.containsKey(obj) || actionsCnt.get(obj).get() <= limit); }

Target:
boolean allowAction(T obj) { activeObjects.add(obj); int cnt = actionsCnt.computeIfAbsent(obj, o -> new AtomicInteger(0)) .incrementAndGet(); return (cnt <= limit); }
Source:
private void saveTiffHeader(Process inProcess) { try { URI imagesDirectory = serviceManager.getFileService().getImagesDirectory(inProcess); URI tiffWriterURI = Paths.get(new File(imagesDirectory).getPath(), "tiffwriter.conf").toUri(); if (new File(tiffWriterURI).exists()) { return; } TiffHeader tif = new TiffHeader(inProcess); try (BufferedWriter outfile = new BufferedWriter( new OutputStreamWriter(fileService.write(tiffWriterURI), StandardCharsets.UTF_8))) { outfile.write(tif.getTiffAlles()); } } catch (Exception e) { Helper.setFehlerMeldung("Download aborted", e); logger.error(e.getMessage(), e); } }

Target:
private void saveTiffHeader(Process inProcess) { try { URI imagesDirectory = serviceManager.getFileService().getImagesDirectory(inProcess); URI tiffWriterURI = Paths.get(new File(imagesDirectory).getPath(), "tiffwriter.conf").toUri(); if (new File(tiffWriterURI).exists()) { return; } TiffHeader tif = new TiffHeader(inProcess); try (BufferedWriter outfile = new BufferedWriter( new OutputStreamWriter(fileService.write(tiffWriterURI), StandardCharsets.UTF_8))) { outfile.write(tif.getTiffAlles()); } } catch (IOException | RuntimeException e) { Helper.setErrorMessage("Download aborted", logger, e); } }
Source:
protected void parseTickerFromJsonObject(int requestId, JSONObject jsonObject, Ticker ticker, CheckerInfo checkerInfo) throws Exception { ticker.bid = jsonObject.getDouble("bidPrice"); ticker.ask = jsonObject.getDouble("askPrice"); ticker.vol = jsonObject.getDouble("turnover24h") / 1e8; if (!jsonObject.isNull("highPrice")) ticker.high = jsonObject.getDouble("highPrice"); if (!jsonObject.isNull("lowPrice")) ticker.low = jsonObject.getDouble("lowPrice"); ticker.last = jsonObject.getDouble("lastPrice"); ticker.timestamp = ISO_DATE_FORMAT.parse(jsonObject.getString("timestamp")).getTime() + TimeZone.getDefault().getOffset(System.currentTimeMillis()); }

Target:
protected void parseTickerFromJsonObject(int requestId, JSONObject jsonObject, Ticker ticker, CheckerInfo checkerInfo) throws Exception { ticker.bid = jsonObject.getDouble("bidPrice"); ticker.ask = jsonObject.getDouble("askPrice"); ticker.vol = jsonObject.getDouble("turnover24h") / 1e8; if (!jsonObject.isNull("highPrice")) ticker.high = jsonObject.getDouble("highPrice"); if (!jsonObject.isNull("lowPrice")) ticker.low = jsonObject.getDouble("lowPrice"); ticker.last = jsonObject.getDouble("lastPrice"); ticker.timestamp = ISO_DATE_FORMAT.parse(jsonObject.getString("timestamp")).getTime(); }
Source:
protected boolean setState(boolean state) { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); return state ? bluetoothAdapter.enable() : bluetoothAdapter.disable(); }

Target:
protected boolean setState(boolean state) { return state ? bluetoothAdapter.enable() : bluetoothAdapter.disable(); }
Source:
public static IcsToast makeText(Context context, int resId, int duration) { return IcsToast.makeText(context, context.getResources().getString(resId), duration); }

Target:
public static Toast makeText(Context context, int resId, int duration) { return makeText(context, context.getResources().getString(resId), duration); }
Source:
public static final IntList lineMap(final byte[] buf, int ptr, int end) throws BinaryBlobException { int start = ptr; IntList map = new IntList((end - ptr) / 36); map.add(Integer.MIN_VALUE); boolean foundLF = true; for (; ptr < end; ptr++) { if (foundLF) { map.add(ptr); } if (buf[ptr] == '\0') { throw new BinaryBlobException(); } foundLF = (buf[ptr] == '\n'); } map.add(end); return map; }

Target:
public static final IntList lineMap(final byte[] buf, int ptr, int end) throws BinaryBlobException { IntList map = new IntList((end - ptr) / 36); map.add(Integer.MIN_VALUE); boolean foundLF = true; for (; ptr < end; ptr++) { if (foundLF) { map.add(ptr); } if (buf[ptr] == '\0') { throw new BinaryBlobException(); } foundLF = (buf[ptr] == '\n'); } map.add(end); return map; }
Source:
public boolean queue(ByteBuffer buffer, int length) { boolean out = (mEndpoint.getDirection() == UsbConstants.USB_DIR_OUT); boolean result; if (mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P && length > MAX_USBFS_BUFFER_SIZE) { length = MAX_USBFS_BUFFER_SIZE; } synchronized (mLock) { mBuffer = buffer; mLength = length; if (buffer.isDirect()) { result = native_queue_direct(buffer, length, out); } else if (buffer.hasArray()) { result = native_queue_array(buffer.array(), length, out); } else { throw new IllegalArgumentException("buffer is not direct and has no array"); } if (!result) { mBuffer = null; mLength = 0; } } return result; }

Target:
public boolean queue(ByteBuffer buffer, int length) { boolean out = (mEndpoint.getDirection() == UsbConstants.USB_DIR_OUT); boolean result; if (mConnection.getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P && length > MAX_USBFS_BUFFER_SIZE) { length = MAX_USBFS_BUFFER_SIZE; } synchronized (mLock) { mBuffer = buffer; mLength = length; if (buffer.isDirect()) { result = native_queue_direct(buffer, length, out); } else if (buffer.hasArray()) { result = native_queue_array(buffer.array(), length, out); } else { throw new IllegalArgumentException("buffer is not direct and has no array"); } if (!result) { mBuffer = null; mLength = 0; } } return result; }