auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void updateNetwrokDetailsInInterface(VDS vds, Map<String, Integer> currVlans, Map<String, Integer> networkVlans, XmlRpcStruct network, network net, String ifaceName) { VdsNetworkInterface iface = null; for (VdsNetworkInterface tempInterface : vds.getInterfaces()) { if (tempInterface.getName().equals(ifaceName)) { iface = tempInterface; break; } } if (iface != null) { iface.setNetworkName(net.getname()); if (currVlans.containsKey(iface.getName())) { networkVlans.put(net.getname(), currVlans.get(iface.getName())); } iface.setAddress(net.getaddr()); iface.setBridged(true); if (StringHelper.EqOp(iface.getNetworkName(), NetworkUtils.getEngineNetwork())) { iface.setType(iface.getType() | VdsInterfaceType.Management.getValue()); } iface.setSubnet(net.getsubnet()); iface.setGateway(net.getgateway()); java.util.Map networkConfigAsMap = (java.util.Map) ((network.getItem("cfg") instanceof java.util.Map) ? network .getItem("cfg") : null); XmlRpcStruct networkConfig = networkConfigAsMap == null ? null : new XmlRpcStruct( networkConfigAsMap); AddBootProtocol(networkConfig, iface); } }

Target:
private static void updateNetwrokDetailsInInterface(VDS vds, Map<String, Integer> currVlans, Map<String, Integer> networkVlans, XmlRpcStruct network, network net, String ifaceName) { VdsNetworkInterface iface = null; for (VdsNetworkInterface tempInterface : vds.getInterfaces()) { if (tempInterface.getName().equals(ifaceName)) { iface = tempInterface; break; } } if (iface != null) { iface.setNetworkName(net.getname()); if (currVlans.containsKey(iface.getName())) { networkVlans.put(net.getname(), currVlans.get(iface.getName())); } iface.setAddress(net.getaddr()); boolean bridged = false; if (network.getItem("bridged") != null) { bridged = Boolean.parseBoolean(network.getItem("bridged").toString()); } iface.setBridged(bridged); if (StringHelper.EqOp(iface.getNetworkName(), NetworkUtils.getEngineNetwork())) { iface.setType(iface.getType() | VdsInterfaceType.Management.getValue()); } iface.setSubnet(net.getsubnet()); iface.setGateway(net.getgateway()); Map<String, Object> networkConfigAsMap = (Map<String, Object>) ((network.getItem("cfg") instanceof Map) ? network.getItem("cfg") : null); XmlRpcStruct networkConfig = networkConfigAsMap == null ? null : new XmlRpcStruct( networkConfigAsMap); AddBootProtocol(networkConfig, iface); } }
Source:
public Entry getEntryFromTuple(YailList tuple) { try { String xValue = tuple.getString(0); String yValue = tuple.getString(1); try { float y = Float.parseFloat(yValue); return new PieEntry(y, xValue); } catch (NumberFormatException e) { } } catch (Exception e) { } return null; }

Target:
public Entry getEntryFromTuple(YailList tuple) { try { String xValue = tuple.getString(0); String yValue = tuple.getString(1); try { float y = Float.parseFloat(yValue); return new PieEntry(y, xValue); } catch (NumberFormatException e) { this.view.getForm().dispatchErrorOccurredEvent(this.view.chartComponent, "GetEntryFromTuple", ErrorMessages.ERROR_INVALID_CHART_ENTRY_VALUES, xValue, yValue); } } catch (NullPointerException e) { this.view.getForm().dispatchErrorOccurredEvent(this.view.chartComponent, "GetEntryFromTuple", ErrorMessages.ERROR_NULL_CHART_ENTRY_VALUES); } catch (IndexOutOfBoundsException e) { this.view.getForm().dispatchErrorOccurredEvent(this.view.chartComponent, "GetEntryFromTuple", ErrorMessages.ERROR_INSUFFICIENT_CHART_ENTRY_VALUES, getTupleSize(), tuple.size()); } return null; }
Source:
private void updateColumnNamesInSetQuery(SetOperatorNode setOperatorNode, String columnName, int columnPosition) throws StandardException { ResultColumn rc; boolean replacementDone = false; if (setOperatorNode.getLeftResultSet() instanceof SetOperatorNode) { updateColumnNamesInSetQuery((SetOperatorNode)setOperatorNode.getLeftResultSet(), columnName, columnPosition); } else { rc = setOperatorNode.getLeftResultSet().getResultColumns().elementAt(columnPosition); rc.setName(columnName); } if (setOperatorNode.getRightResultSet() instanceof SetOperatorNode) updateColumnNamesInSetQuery((SetOperatorNode)setOperatorNode.getRightResultSet(), columnName, columnPosition); else { rc = setOperatorNode.getRightResultSet().getResultColumns().elementAt(columnPosition); rc.setName(columnName); } rc = setOperatorNode.getResultColumns().elementAt(columnPosition);; rc.setName(columnName); ColumnReference columnReference = (ColumnReference) getNodeFactory().getNode( C_NodeTypes.COLUMN_REFERENCE, columnName, null, getContextManager()); rc.setExpression(columnReference); }

Target:
private void updateColumnNamesInSetQuery(SetOperatorNode setOperatorNode, String columnName, int columnPosition) throws StandardException { ResultColumn rc; if (setOperatorNode.getLeftResultSet() instanceof SetOperatorNode) { updateColumnNamesInSetQuery((SetOperatorNode)setOperatorNode.getLeftResultSet(), columnName, columnPosition); } else { rc = setOperatorNode.getLeftResultSet().getResultColumns().elementAt(columnPosition); rc.setName(columnName); } if (setOperatorNode.getRightResultSet() instanceof SetOperatorNode) updateColumnNamesInSetQuery((SetOperatorNode)setOperatorNode.getRightResultSet(), columnName, columnPosition); else { rc = setOperatorNode.getRightResultSet().getResultColumns().elementAt(columnPosition); rc.setName(columnName); } rc = setOperatorNode.getResultColumns().elementAt(columnPosition); rc.setName(columnName); ColumnReference columnReference = (ColumnReference) getNodeFactory().getNode( C_NodeTypes.COLUMN_REFERENCE, columnName, null, getContextManager()); rc.setExpression(columnReference); }
Source:
public static PrefixMapping calcInUsePrefixMapping(Graph graph, PrefixMapping prefixMapping) { Map<String, String> pmap = prefixMapping.getNsPrefixMap() ; Trie<String> trie = new Trie<>() ; pmap.forEach((prefix,uri)-> trie.add(uri, prefix)) ; Iterator<Triple> iter = graph.find(null, null, null) ; Set<String> inUse = new HashSet<>() ; Consumer<Node> process = (node)->{ if ( ! node.isURI() ) return ; String uri = node.getURI() ; List<String> hits = trie.partialSearch(uri) ; if ( hits == null || hits.isEmpty() ) return ; inUse.addAll(hits) ; } ; while(iter.hasNext()) { Triple triple = iter.next() ; process.accept(triple.getSubject()) ; process.accept(triple.getPredicate()) ; process.accept(triple.getObject()) ; if ( pmap.size() == inUse.size() ) break ; } if ( pmap.size() == inUse.size() ) return prefixMapping ; PrefixMapping pmap2 = new PrefixMappingImpl() ; inUse.forEach((prefix)-> pmap2.setNsPrefix(prefix, prefixMapping.getNsPrefixURI(prefix)) ) ; return pmap2 ; }

Target:
public static PrefixMapping calcInUsePrefixMapping(Graph graph, PrefixMapping prefixMapping) { Map<String, String> pmap = prefixMapping.getNsPrefixMap() ; Trie<String> trie = new Trie<>() ; pmap.forEach((prefix,uri)-> trie.add(uri, prefix)) ; Iterator<Triple> iter = graph.find(null, null, null) ; Set<String> inUse = new HashSet<>() ; Consumer<Node> process = (node)->{ if ( ! node.isURI() ) return ; String uri = node.getURI() ; List<String> hits = trie.partialSearch(uri) ; if ( hits.isEmpty() ) return ; inUse.addAll(hits) ; } ; while(iter.hasNext()) { Triple triple = iter.next() ; process.accept(triple.getSubject()) ; process.accept(triple.getPredicate()) ; process.accept(triple.getObject()) ; if ( pmap.size() == inUse.size() ) break ; } if ( pmap.size() == inUse.size() ) return prefixMapping ; PrefixMapping pmap2 = new PrefixMappingImpl() ; inUse.forEach((prefix)-> pmap2.setNsPrefix(prefix, prefixMapping.getNsPrefixURI(prefix)) ) ; return pmap2 ; }
Source:
private Locale determineLocale(final HttpServletRequest request) { Locale locale = LocaleUtils.getLocaleFromString(request.getParameter(LOCALE)); if (locale == null) { locale = getLocaleFromCookies(request.getCookies()); } if (locale == null) { locale = request.getLocale(); } if (locale == null) { locale = Locale.US; } log.debug("Filter determined locale to be: " + locale.toLanguageTag()); return lookupSupportedLocale(locale, getLocaleKeys()); }

Target:
private Locale determineLocale(final HttpServletRequest request) { Locale locale = LocaleUtils.getLocaleFromString(request.getParameter(LOCALE)); if (locale == null) { locale = getLocaleFromCookies(request.getCookies()); } if (locale == null) { locale = request.getLocale(); } if (locale == null) { locale = Locale.US; } locale = lookupSupportedLocale(locale, getLocaleKeys()); log.debug("Filter determined locale to be: " + locale.toLanguageTag()); return locale; }
Source:
private void validateDiscardAfterDelete() { if (getDiscardAfterDelete().getIsAvailable() && getDiscardAfterDelete().getEntity()) { SanStorageModelBase sanStorageModel = (SanStorageModelBase) getCurrentStorageItem(); Collection<LunModel> luns = sanStorageModel.getAddedLuns(); if (luns != null && !storageDomainSupportsDiscard(luns)) { getDiscardAfterDelete().setIsValid(false); getDiscardAfterDelete().getInvalidityReasons().add( constants.discardIsNotSupportedByUnderlyingStorage()); return; } } getDiscardAfterDelete().setIsValid(true); }

Target:
private void validateDiscardAfterDelete() { if (getDiscardAfterDelete().getIsAvailable() && getDiscardAfterDelete().getEntity()) { SanStorageModelBase sanStorageModel = (SanStorageModelBase) getCurrentStorageItem(); Collection<LunModel> luns = sanStorageModel.getAddedLuns(); if (luns != null && !storageDomainSupportsDiscard(luns)) { getDiscardAfterDelete().getInvalidityReasons().add( constants.discardIsNotSupportedByUnderlyingStorage()); getDiscardAfterDelete().setIsValid(false); return; } } getDiscardAfterDelete().setIsValid(true); }
Source:
public static void main(String[] args) { Options options = configureCommandLineParser(); try { CommandLineParser parser = new BasicParser(); CommandLine commandLine = parser.parse(options, args); if (commandLine.hasOption(HELP)) { usage(options); return; } String propertiesFileName = commandLine.getOptionValue("p"); String testFileName = commandLine.getOptionValue("s"); SqlResultGenerator resultGenerator = new SqlResultGenerator(testFileName, propertiesFileName); resultGenerator.generateExpectedResults(); } catch (ParseException e) { usage(options); System.exit(99); } catch (Exception e) { LOGGER.error("Caught exception in main", e); System.exit(99); } System.exit(0); }

Target:
public static void main(String[] args) { Options options = configureCommandLineParser(); try { CommandLineParser parser = new BasicParser(); CommandLine commandLine = parser.parse(options, args); if (commandLine.hasOption(HELP)) { usage(options); return; } String propertiesFileName = commandLine.getOptionValue("p"); String testFileName = commandLine.getOptionValue("s"); SqlResultGenerator resultGenerator = new SqlResultGenerator(testFileName, propertiesFileName); resultGenerator.generateExpectedResults(); } catch (ParseException e) { usage(options); } catch (Exception e) { LOGGER.error("Caught exception in main", e); } }
Source:
public Intent getIntentForBrokerActivity(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { final Bundle requestBundle = getBrokerOptions(request); final Intent intent; if (isBrokerAccountServiceSupported()) { intent = BrokerAccountServiceHandler.getInstance().getIntentForInteractiveRequest(mContext, brokerEvent); intent.putExtras(requestBundle); } else { intent = getIntentForBrokerActivityFromAccountManager(requestBundle); } if (intent != null) { intent.putExtra(AuthenticationConstants.Broker.BROKER_REQUEST, AuthenticationConstants.Broker.BROKER_REQUEST); if (!isBrokerWithPRTSupport(intent) && PromptBehavior.FORCE_PROMPT == request.getPrompt()) { Logger.v(TAG, "FORCE_PROMPT is set for broker auth via old version of broker app, reset to ALWAYS."); intent.putExtra(AuthenticationConstants.Broker.ACCOUNT_PROMPT, PromptBehavior.Always.name()); } } return intent; }

Target:
public Intent getIntentForBrokerActivity(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { final Bundle requestBundle = getBrokerOptions(request); final Intent intent; if (isBrokerAccountServiceSupported()) { intent = BrokerAccountServiceHandler.getInstance().getIntentForInteractiveRequest(mContext, brokerEvent); if (intent == null) { Logger.e(TAG, "Received null intent from broker interactive request.", null, ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING); throw new AuthenticationException(ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING, "Received null intent from broker interactive request."); } else { intent.putExtras(requestBundle); } } else { intent = getIntentForBrokerActivityFromAccountManager(requestBundle); } if (intent != null) { intent.putExtra(AuthenticationConstants.Broker.BROKER_REQUEST, AuthenticationConstants.Broker.BROKER_REQUEST); if (!isBrokerWithPRTSupport(intent) && PromptBehavior.FORCE_PROMPT == request.getPrompt()) { Logger.v(TAG, "FORCE_PROMPT is set for broker auth via old version of broker app, reset to ALWAYS."); intent.putExtra(AuthenticationConstants.Broker.ACCOUNT_PROMPT, PromptBehavior.Always.name()); } } return intent; }
Source:
public void close() { state = State.DISPOSED; try (Closer closer = Closer.create()) { closer.register(index::clear); spiller.ifPresent(closer::register); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public void close() { lookupSourceSupplier = null; state = State.DISPOSED; finishMemoryRevoke = finishMemoryRevoke.map(ifPresent -> () -> {}); try (Closer closer = Closer.create()) { closer.register(index::clear); spiller.ifPresent(closer::register); closer.register(() -> operatorContext.setMemoryReservation(0)); closer.register(() -> operatorContext.setRevocableMemoryReservation(0)); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public void saveLocationsToDatabase(List<Location> locationList, String selectedLocation) { mOpenMRS.setLocation(selectedLocation); locationDAO.deleteAllLocations(); for (int i = 0; i < locationList.size(); i++) { locationDAO.saveLocation(locationList.get(i)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(); } }

Target:
public void saveLocationsToDatabase(List<Location> locationList, String selectedLocation) { mOpenMRS.setLocation(selectedLocation); locationDAO.deleteAllLocations(); for (int i = 0; i < locationList.size(); i++) { locationDAO.saveLocation(locationList.get(i)) .observeOn(Schedulers.io()) .subscribe(); } }
Source:
public void testEventStreamingWithEventTypeFilter() throws Exception { assumeNotSwarm("", dockerRule); String startTime = getEpochTime(); int expectedEvents = 1; EventsTestCallback eventCallback = new EventsTestCallback(expectedEvents); dockerRule.getClient().eventsCmd() .withSince(startTime) .withEventTypeFilter(EventType.CONTAINER) .withEventFilter("start") .exec(eventCallback); generateEvents(); List<Event> events = eventCallback.awaitExpectedEvents(30, TimeUnit.SECONDS); for (Event event : events) { assertThat("Received event: " + event, event.getAction(), is("start")); } }

Target:
public void testEventStreamingWithEventTypeFilter() throws Exception { assumeNotSwarm("", dockerRule); String startTime = getEpochTime(); generateEvents(); String endTime = getEpochTime(); for (EventType eventType : EventType.values()) { List<Event> events = new CopyOnWriteArrayList<>(); try ( ResultCallback.Adapter<?> eventCallback = dockerRule.getClient().eventsCmd() .withSince(startTime) .withUntil(endTime) .withEventTypeFilter(eventType) .exec(new ResultCallback.Adapter<Event>() { @Override public void onNext(Event event) { events.add(event); } }) ) { eventCallback.awaitCompletion(30, TimeUnit.SECONDS); for (Event event : events) { assertThat("Received event: " + event, event.getType(), is(eventType)); } } } }
Source:
public SizeCachedNoTagsByteBufferKeyValue(ByteBuffer buf, int offset, int length, long seqId, int keyLen) { super(buf, offset, length); rowLen = super.getRowLength(); this.keyLen = keyLen; setSequenceId(seqId); }

Target:
public SizeCachedNoTagsByteBufferKeyValue(ByteBuffer buf, int offset, int length, long seqId, int keyLen) { super(buf, offset, length); this.rowLen = super.getRowLength(); this.keyLen = keyLen; setSequenceId(seqId); }
Source:
public URL create(final String key, final int value) { return create(key, ""+ value); }

Target:
public URL create(final String key, final int value) { return create(key, String.valueOf(value)); }
Source:
public void testRemoteOutdatedSnapshot() throws Exception { IgniteEx ig0 = startGrids(2); ig0.cluster().active(true); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.cache(DEFAULT_CACHE_NAME).put(i, i); awaitPartitionMapExchange(); for (int i = 0; i < 2; i++) { grid(i). context() .cache() .context() .database() .forceCheckpoint("the next one") .futureFor(CheckpointState.FINISHED) .get(); } TestRecordingCommunicationSpi.spi(ig0) .blockMessages((node, msg) -> msg instanceof SnapshotRequestMessage); UUID rmtNodeId = grid(1).localNode().id(); IgniteSnapshotManager mgr0 = ig0.context() .cache() .context() .snapshotMgr(); IgniteInternalFuture<?> snpFut = mgr0.createRemoteSnapshot(rmtNodeId, owningParts(ig0, new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), rmtNodeId), (part, grp) -> {}); TestRecordingCommunicationSpi.spi(ig0) .waitForBlocked(); startGrid(2); ig0.cluster().setBaselineTopology(ig0.cluster().forServers().nodes()); awaitPartitionMapExchange(); stopGrid(2); TestRecordingCommunicationSpi.spi(grid(1)) .blockMessages((node, msg) -> msg instanceof GridDhtPartitionDemandMessage); ig0.cluster().setBaselineTopology(ig0.cluster().forServers().nodes()); TestRecordingCommunicationSpi.spi(ig0) .stopBlock(true, obj -> obj.get2().message() instanceof SnapshotRequestMessage); snpFut.get(); }

Target:
public void testRemoteOutdatedSnapshot() throws Exception { IgniteEx ig0 = startGrids(2); ig0.cluster().state(ClusterState.ACTIVE); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.cache(DEFAULT_CACHE_NAME).put(i, i); awaitPartitionMapExchange(); forceCheckpoint(); TestRecordingCommunicationSpi.spi(ig0) .blockMessages((node, msg) -> msg instanceof SnapshotRequestMessage); UUID rmtNodeId = grid(1).localNode().id(); IgniteSnapshotManager mgr0 = snp(ig0); IgniteInternalFuture<?> snpFut = mgr0.createRemoteSnapshot(rmtNodeId, owningParts(ig0, new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), rmtNodeId), (part, grp) -> {}); TestRecordingCommunicationSpi.spi(ig0) .waitForBlocked(); startGrid(2); ig0.cluster().setBaselineTopology(ig0.cluster().forServers().nodes()); awaitPartitionMapExchange(); stopGrid(2); TestRecordingCommunicationSpi.spi(grid(1)) .blockMessages((node, msg) -> msg instanceof GridDhtPartitionDemandMessage); ig0.cluster().setBaselineTopology(ig0.cluster().forServers().nodes()); TestRecordingCommunicationSpi.spi(ig0) .stopBlock(true, obj -> obj.get2().message() instanceof SnapshotRequestMessage); snpFut.get(); }
Source:
private void updateMap(Map map, ServerLocation location, String memberId, float load, float loadPerConnection) { Map groupMap = (Map) map.get(null); ServerLocationAndMemberId locationAndMemberId = new ServerLocationAndMemberId(location, memberId); LoadHolder holder = (LoadHolder) groupMap.get(locationAndMemberId); if (holder != null) { holder.setLoad(load, loadPerConnection); } }

Target:
void updateMap(Map map, ServerLocation location, String memberId, float load, float loadPerConnection) { Map groupMap = (Map) map.get(null); LoadHolder holder; if (memberId.equals("")) { holder = (LoadHolder) groupMap.get(location); } else { ServerLocationAndMemberId locationAndMemberId = new ServerLocationAndMemberId(location, memberId); holder = (LoadHolder) groupMap.get(locationAndMemberId); } if (holder != null) { holder.setLoad(load, loadPerConnection); } }
Source:
public String[] splitArguments(String s) { if (s == null || s.isEmpty()) { return NO_ARGS; } int state = NORMAL; String delimiter = DOUBLE_QUOTE + SINGLE_QUOTE + SPACE; StringTokenizer tokenizer = new StringTokenizer(s, delimiter, true); List<String> args = new ArrayList<String>(); StringBuilder current = new StringBuilder(); boolean lastTokenInQuotes = false; while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); switch (state) { case IN_SINGLE_QUOTE: if (SINGLE_QUOTE.equals(token)) { lastTokenInQuotes = true; state = NORMAL; } else { current.append(token); } break; case IN_DOUBLE_QUOTE: if (DOUBLE_QUOTE.equals(token)) { lastTokenInQuotes = true; state = NORMAL; } else { current.append(token); } break; default: if (SINGLE_QUOTE.equals(token)) { state = IN_SINGLE_QUOTE; } else if (DOUBLE_QUOTE.equals(token)) { state = IN_DOUBLE_QUOTE; } else if (SPACE.equals(token)) { if (lastTokenInQuotes || current.length() != 0) { args.add(current.toString()); current = new StringBuilder(); } } else { current.append(token); } lastTokenInQuotes = false; break; } } if (lastTokenInQuotes || current.length() != 0) { args.add(current.toString()); } if (state == IN_SINGLE_QUOTE || state == IN_DOUBLE_QUOTE) { throw new IllegalArgumentException("Unbalanced quotes in " + s); } return args.toArray(new String[args.size()]); }

Target:
public String[] splitArguments(String s) { if (s == null || s.isEmpty()) { return NO_ARGS; } ParserState state = ParserState.NORMAL; StringBuilder current = new StringBuilder(); List<String> args = new ArrayList<String>(); boolean lastTokenInQuotes = false; char previous = 0; for (char c : s.toCharArray()) { switch (state) { case IN_SINGLE_QUOTE: if (previous != BACKSLASH && c == SINGLE_QUOTE) { lastTokenInQuotes = true; state = ParserState.NORMAL; } else { previous = c; current.append(c); } break; case IN_DOUBLE_QUOTE: if (previous != BACKSLASH && c == DOUBLE_QUOTE) { lastTokenInQuotes = true; state = ParserState.NORMAL; } else { previous = c; current.append(c); } break; default: switch (c) { case SINGLE_QUOTE: if (previous != BACKSLASH) { state = ParserState.IN_SINGLE_QUOTE; } break; case DOUBLE_QUOTE: if (previous != BACKSLASH) { state = ParserState.IN_DOUBLE_QUOTE; } break; case SPACE: if (lastTokenInQuotes || current.length() != 0) { args.add(current.toString()); current.setLength(0); } break; default: previous = c; current.append(c); } lastTokenInQuotes = false; break; } } if (lastTokenInQuotes || current.length() != 0) { args.add(current.toString()); } if (state != ParserState.NORMAL) { throw new IllegalArgumentException("Unbalanced quotes in " + s); } return args.toArray(new String[args.size()]); }
Source:
private void startReencryption(Collection<Integer> grpIds) throws IgniteCheckedException { if (pageScanner.disabled()) return; for (int grpId : grpIds) { IgniteInternalFuture<?> fut = pageScanner.schedule(grpId); fut.listen(f -> { try { f.get(); synchronized (metaStorageMux) { cleanupKeys(grpId); reencryptGroups.remove(grpId); } } catch (IgniteFutureCancelledCheckedException e) { log.warning("Reencryption cancelled [grp=" + grpId + "]"); } catch (IgniteCheckedException e) { log.warning("Reencryption failed [grp=" + grpId + "]", e); } }); } }

Target:
private void startReencryption(Collection<Integer> grpIds) throws IgniteCheckedException { for (int grpId : grpIds) { IgniteInternalFuture<?> fut = pageScanner.schedule(grpId); fut.listen(f -> { if (f.isCancelled() || f.error() != null) { log.warning("Reencryption " + (f.isCancelled() ? "cancelled" : "failed") + " [grp=" + grpId + "]", f.error()); return; } withMasterKeyChangeReadLock(() -> { synchronized (metaStorageMux) { cleanupKeys(grpId); reencryptGroups.remove(grpId); } return null; }); }); } }
Source:
private static int scaleSimpleTextLines(TextView tv) { SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(tv.getContext()); float scalingFactor = Float.parseFloat(mPrefs.getString(SettingsActivity.SP_FONT_SIZE, "1.0")); int numLines = 5; if(scalingFactor < 0.9) { numLines = 7; } else if (scalingFactor < 1.1 ) { numLines = 5; } else if (scalingFactor < 1.3 ) { numLines = 4; } else if (scalingFactor < 1.5 ) { numLines = 3; } return numLines; }

Target:
private static int scaleSimpleTextLines(TextView tv) { SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(tv.getContext()); float scalingFactor = Float.parseFloat(mPrefs.getString(SettingsActivity.SP_FONT_SIZE, "1.0")); return Math.round((scalingFactor*-5)+10); }
Source:
private List<EurekaEndpoint> getHostCandidates() { List<EurekaEndpoint> candidateHosts = clusterResolver.getClusterEndpoints(); quarantineSet.retainAll(candidateHosts); int threshold = candidateHosts.size() * transportConfig.getRetryableClientQuarantineRefreshPercentage() / 100; if (quarantineSet.isEmpty()) { } else if (quarantineSet.size() >= threshold) { logger.debug("Clearing quarantined list of size {}", quarantineSet.size()); quarantineSet.clear(); } else { List<EurekaEndpoint> remainingHosts = new ArrayList<>(candidateHosts.size()); for (EurekaEndpoint endpoint : candidateHosts) { if (!quarantineSet.contains(endpoint)) { remainingHosts.add(endpoint); } } candidateHosts = remainingHosts; } return candidateHosts; }

Target:
private List<EurekaEndpoint> getHostCandidates() { List<EurekaEndpoint> candidateHosts = clusterResolver.getClusterEndpoints(); quarantineSet.retainAll(candidateHosts); int threshold = (int) (candidateHosts.size() * transportConfig.getRetryableClientQuarantineRefreshPercentage()); if (quarantineSet.isEmpty()) { } else if (quarantineSet.size() >= threshold) { logger.debug("Clearing quarantined list of size {}", quarantineSet.size()); quarantineSet.clear(); } else { List<EurekaEndpoint> remainingHosts = new ArrayList<>(candidateHosts.size()); for (EurekaEndpoint endpoint : candidateHosts) { if (!quarantineSet.contains(endpoint)) { remainingHosts.add(endpoint); } } candidateHosts = remainingHosts; } return candidateHosts; }
Source:
void emit(double tot_distance) { double avg_time = sum_time; double avg_dist = sum_distance; double avg_hr = calculateAverageHr(hr); { double max_pace[] = { 0, 0, 0 }; double min_pace[] = { Double.MAX_VALUE, 0, 0 }; for (int i = 0; i < this.time.length; i++) { double pace = this.time[i] / this.distance[i]; if (pace > max_pace[0]) { max_pace[0] = pace; max_pace[1] = this.time[i]; max_pace[2] = this.distance[i]; } if (pace < min_pace[0]) { min_pace[0] = pace; min_pace[1] = this.time[i]; min_pace[2] = this.distance[i]; } } } if (avg_dist > 0) { double pace = 0.0; switch(this.preferred_speedunit){ case PACE: pace = avg_time / avg_dist / 1000.0; break; case SPEED: pace = avg_dist / avg_time / 1000.0; break; } if (first) { paceList.add(new DataPoint(0, pace)); hrList.add(new DataPoint(0, Math.round(avg_hr))); first = false; } paceList.add(new DataPoint(tot_distance, pace)); hrList.add(new DataPoint(tot_distance, Math.round(avg_hr))); acc_time = 0; tot_avg_hr += avg_hr; avg_pace += pace; min_pace = Math.min(min_pace, pace); max_pace = Math.max(max_pace, pace); } }

Target:
void emit(double tot_distance) { double avg_time = sum_time; double avg_dist = sum_distance; double avg_hr = calculateAverageHr(hr); { double max_velocity[] = { 0, 0, 0 }; double min_velocity[] = { Double.MAX_VALUE, 0, 0 }; for (int i = 0; i < this.time.length; i++) { double velocity = this.time[i] / this.distance[i]; if (velocity > max_velocity[0]) { max_velocity[0] = velocity; max_velocity[1] = this.time[i]; max_velocity[2] = this.distance[i]; } if (velocity < min_velocity[0]) { min_velocity[0] = velocity; min_velocity[1] = this.time[i]; min_velocity[2] = this.distance[i]; } } } double velocity = 0.0; switch (this.preferred_speedunit) { case PACE: if (avg_dist > 0) { velocity = avg_time / avg_dist / 1000.0; } break; case SPEED: if (avg_time > 0) { velocity = avg_dist / avg_time * 1000.0; } break; } if (first) { velocityList.add(new DataPoint(0, velocity)); hrList.add(new DataPoint(0, Math.round(avg_hr))); first = false; } velocityList.add(new DataPoint(tot_distance, velocity)); hrList.add(new DataPoint(tot_distance, Math.round(avg_hr))); acc_time = 0; tot_avg_hr += avg_hr; avg_velocity += velocity; min_velocity = Math.min(min_velocity, velocity); max_velocity = Math.max(max_velocity, velocity); }
Source:
public ResultInterface query(int maxrows) { Column column = new Column("PLAN", Value.STRING); Database db = session.getDatabase(); ExpressionColumn expr = new ExpressionColumn(db, column); Expression[] expressions = { expr }; result = session.getDatabase().getResultFactory().create(session, expressions, 1); if (maxrows >= 0) { String plan; if (executeCommand) { PageStore store = null; Store mvStore = null; if (db.isPersistent()) { store = db.getPageStore(); if (store != null) { store.statisticsStart(); } mvStore = db.getStore(); if (mvStore != null) { mvStore.statisticsStart(); } } if (command.isQuery()) { command.query(maxrows); } else { command.update(); } plan = command.getPlanSQL(); Map<String, Integer> statistics = null; if (store != null) { statistics = store.statisticsEnd(); } else if (mvStore != null) { statistics = mvStore.statisticsEnd(); } if (statistics != null) { int total = 0; for (Entry<String, Integer> e : statistics.entrySet()) { total += e.getValue(); } if (total > 0) { statistics = new TreeMap<>(statistics); StringBuilder buff = new StringBuilder(); if (statistics.size() > 1) { buff.append("total: ").append(total).append('\n'); } for (Entry<String, Integer> e : statistics.entrySet()) { int value = e.getValue(); int percent = (int) (100L * value / total); buff.append(e.getKey()).append(": ").append(value); if (statistics.size() > 1) { buff.append(" (").append(percent).append("%)"); } buff.append('\n'); } plan += "\n "; } } } else { plan = command.getPlanSQL(); } add(plan); } result.done(); return result; }

Target:
public ResultInterface query(int maxrows) { Column column = new Column("PLAN", Value.STRING); Database db = session.getDatabase(); ExpressionColumn expr = new ExpressionColumn(db, column); Expression[] expressions = { expr }; result = db.getResultFactory().create(session, expressions, 1); if (maxrows >= 0) { String plan; if (executeCommand) { PageStore store = null; Store mvStore = null; if (db.isPersistent()) { store = db.getPageStore(); if (store != null) { store.statisticsStart(); } mvStore = db.getStore(); if (mvStore != null) { mvStore.statisticsStart(); } } if (command.isQuery()) { command.query(maxrows); } else { command.update(); } plan = command.getPlanSQL(); Map<String, Integer> statistics = null; if (store != null) { statistics = store.statisticsEnd(); } else if (mvStore != null) { statistics = mvStore.statisticsEnd(); } if (statistics != null) { int total = 0; for (Entry<String, Integer> e : statistics.entrySet()) { total += e.getValue(); } if (total > 0) { statistics = new TreeMap<>(statistics); StringBuilder buff = new StringBuilder(); if (statistics.size() > 1) { buff.append("total: ").append(total).append('\n'); } for (Entry<String, Integer> e : statistics.entrySet()) { int value = e.getValue(); int percent = (int) (100L * value / total); buff.append(e.getKey()).append(": ").append(value); if (statistics.size() > 1) { buff.append(" (").append(percent).append("%)"); } buff.append('\n'); } plan += "\n "; } } } else { plan = command.getPlanSQL(); } add(plan); } result.done(); return result; }
Source:
public void setActionParameters(ArrayList<ActionParameter> actionParameters) { var newParameters = new ArrayList<ActionParameter>(); for (ActionParameter actionParameter : actionParameters) { newParameters.add(actionParameter); } scriptGeneratorTable.setActionParameters(newParameters); scriptGeneratorTable.clearActions(); }

Target:
private void setActionParameters(ArrayList<ActionParameter> actionParameters) { scriptGeneratorTable.setActionParameters(actionParameters); scriptGeneratorTable.clearActions(); }
Source:
public void close() { LOGGER.info("Closing PollingLookup [%s]", id); synchronized (isOpen) { isOpen.getAndSet(false); if (pollFuture != null) { pollFuture.cancel(true); scheduledExecutorService.shutdown(); } CacheRefKeeper cacheRefKeeper = refOfCacheKeeper.getAndSet(null); if (cacheRefKeeper != null) { cacheRefKeeper.doneWithIt(); } } }

Target:
public void close() { LOGGER.info("Closing polling lookup [%s]", id); synchronized (isOpen) { isOpen.getAndSet(false); if (pollFuture != null) { pollFuture.cancel(true); scheduledExecutorService.shutdown(); } CacheRefKeeper cacheRefKeeper = refOfCacheKeeper.getAndSet(null); if (cacheRefKeeper != null) { cacheRefKeeper.doneWithIt(); } } }
Source:
private void setupLookAndFeel() { String lookAndFeelClassnameFromCommandline = System.getProperty("swing.defaultlaf"); String lookAndFeelClassnameFromOptions = null; OptionsParam options = Model.getSingleton().getOptionsParam();; String lookAndFeelOptions = options.getViewParam().getLookAndFeel(); if(lookAndFeelClassnameFromCommandline == null) { if(lookAndFeelOptions.contains("Native")) { lookAndFeelClassnameFromOptions = UIManager.getSystemLookAndFeelClassName(); } else if(lookAndFeelOptions.contains("Cross")) { lookAndFeelClassnameFromOptions = UIManager.getCrossPlatformLookAndFeelClassName(); } else if(lookAndFeelOptions.contains("Default")) { lookAndFeelClassnameFromOptions = System.getProperty("swing.defaultlaf"); } } if ( lookAndFeelClassnameFromCommandline!= null) { try{ UIManager.setLookAndFeel(lookAndFeelClassnameFromCommandline); return; } catch (final UnsupportedLookAndFeelException | ClassNotFoundException | ClassCastException | InstantiationException | IllegalAccessException e) { logger.warn("Failed to set the specified look and feel:" + e.getMessage()); } } if (lookAndFeelClassnameFromOptions != null) { try { UIManager.setLookAndFeel(lookAndFeelClassnameFromOptions); return; } catch (final UnsupportedLookAndFeelException | ClassNotFoundException | ClassCastException | InstantiationException | IllegalAccessException e) { logger.warn("Failed to set the specified look and feel: " + e.getMessage()); } } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (Constant.isMacOsX()) { OsXGui.setup(); } else { for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } } catch (final UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { logger.warn("Failed to set the \"default\" look and feel: " + e.getMessage()); } }

Target:
private void setupLookAndFeel() { if (lookAndFeelSet) { return; } lookAndFeelSet = true; if (setLookAndFeel(System.getProperty("swing.defaultlaf"))) { return; } OptionsParam options = Model.getSingleton().getOptionsParam(); if (setLookAndFeel(getLookAndFeelClassname(options.getViewParam().getLookAndFeel()))) { return; } if (Constant.isMacOsX()) { OsXGui.setup(); } else if (setLookAndFeel(getLookAndFeelClassname("Nimbus"))) { return; } setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
Source:
public ArchiveList listArchives(String sessionId) throws OpenTokException { if (sessionId == null || sessionId.isEmpty() ) { throw new InvalidArgumentException("Session string null or empty"); } return listArchives(sessionId, 0, 1000); }

Target:
public ArchiveList listArchives(String sessionId) throws OpenTokException { if (sessionId == null || sessionId.isEmpty() ) { throw new InvalidArgumentException("Session Id cannot be null or empty"); } return listArchives(sessionId, 0, 1000); }
Source:
public static Object createNullValue() { return SPLNullValue.asJSON(); }

Target:
public static Object createNullValue() { JsonObject jo = new JsonObject(); jo.addProperty("type", JParamTypes.TYPE_SPL_EXPRESSION); jo.addProperty("value", "null"); return jo; }
Source:
public void run() { while (true) { logger.info("Job janitor daemon waking up"); if (stop) { logger.info("Job janitor stopping as per request"); return; } try { int numRowsUpdated = markZombies(); logger.info("Total jobs marked as zombies: " + numRowsUpdated); } catch (Exception e) { logger.error(e.getMessage()); } long minSleepTime = conf.getLong( "netflix.genie.server.janitor.min.sleep.ms", 300000); long maxSleepTime = conf.getLong( "netflix.genie.server.janitor.max.sleep.ms", 600000); Random randomGenerator = new Random(); long randomSleepTime = randomGenerator.nextInt((int) (maxSleepTime - minSleepTime)) + minSleepTime; logger.info("Job janitor daemon going to sleep for " + randomSleepTime / 1000 + " seconds."); try { Thread.sleep(randomSleepTime); } catch (InterruptedException e) { logger.warn(e.getMessage()); continue; } } }

Target:
public void run() { while (true) { logger.info("Job janitor daemon waking up"); if (stop) { logger.info("Job janitor stopping as per request"); return; } try { int numRowsUpdated = markZombies(); logger.info("Total jobs marked as zombies: " + numRowsUpdated); } catch (Exception e) { logger.error(e.getMessage()); } final long minSleepTime = conf.getLong( "netflix.genie.server.janitor.min.sleep.ms", 300000); final long maxSleepTime = conf.getLong( "netflix.genie.server.janitor.max.sleep.ms", 600000); Random randomGenerator = new Random(); long randomSleepTime = randomGenerator.nextInt((int) (maxSleepTime - minSleepTime)) + minSleepTime; logger.info("Job janitor daemon going to sleep for " + randomSleepTime / 1000 + " seconds."); try { Thread.sleep(randomSleepTime); } catch (InterruptedException e) { logger.warn(e.getMessage()); continue; } } }
Source:
public void should_pass_if_difference_is_less_than_given_percentage() { bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, ONE, withPercentage(valueOf(1))); bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, TWO, withPercentage(valueOf(50))); }

Target:
public void should_pass_if_difference_is_less_than_given_percentage() { bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, ONE, withPercentage(valueOf(1))); bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, TWO, withPercentage(valueOf(100))); }
Source:
public void display(OutputStream out) { final PrintWriter stdout; try { stdout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException("JVM lacks UTF-8 encoding", e); } Map<String, PluginInfo> output = Maps.newTreeMap(); List<Plugin> plugins = Lists.newArrayList(pluginLoader.getPlugins(all)); Collections.sort(plugins, new Comparator<Plugin>() { @Override public int compare(Plugin a, Plugin b) { return a.getName().compareTo(b.getName()); } }); if (!format.isJson()) { stdout.format("%-30s %-10s\n", "Name", "Version"); stdout .print("----------------------------------------------------------------------\n"); } for (Plugin p : plugins) { PluginInfo info = new PluginInfo(); info.version = p.getVersion(); info.isDisabled = p.isDisabled(); if (format.isJson()) { output.put(p.getName(), info); } else { stdout.format("%-30s %-10s\n", p.getName() + (info.isDisabled ? " (DISABLED)" : ""), Strings.nullToEmpty(info.version)); } } if (format.isJson()) { format.newGson().toJson(output, new TypeToken<Map<String, PluginInfo>>() {}.getType(), stdout); stdout.print('\n'); } stdout.flush(); }

Target:
public void display(OutputStream out) { final PrintWriter stdout; try { stdout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException("JVM lacks UTF-8 encoding", e); } Map<String, PluginInfo> output = Maps.newTreeMap(); List<Plugin> plugins = Lists.newArrayList(pluginLoader.getPlugins(all)); Collections.sort(plugins, new Comparator<Plugin>() { @Override public int compare(Plugin a, Plugin b) { return a.getName().compareTo(b.getName()); } }); if (!format.isJson()) { stdout.format("%-30s %-10s %-8s\n", "Name", "Version", "Status"); stdout .print("-------------------------------------------------------------------------------\n"); } for (Plugin p : plugins) { PluginInfo info = new PluginInfo(); info.version = p.getVersion(); info.disabled = p.isDisabled(); if (format.isJson()) { output.put(p.getName(), info); } else { stdout.format("%-30s %-10s %-8s\n", p.getName(), Strings.nullToEmpty(info.version), info.disabled ? "DISABLED" : ""); } } if (format.isJson()) { format.newGson().toJson(output, new TypeToken<Map<String, PluginInfo>>() {}.getType(), stdout); stdout.print('\n'); } stdout.flush(); }
Source:
public void testCacheIdleVerifyDumpForCorruptedDataOnNonePersistenceClientCache() throws Exception { int parts = 32; dataRegionConfiguration = new DataRegionConfiguration() .setName("none-persistence-region"); IgniteEx ignite = (IgniteEx)startGrids(3); ignite.cluster().active(true); IgniteCache<Object, Object> cache = ignite.createCache(new CacheConfiguration<>() .setAffinity(new RendezvousAffinityFunction(false, parts)) .setBackups(2) .setName(DEFAULT_CACHE_NAME) .setDataRegionName("none-persistence-region")); for (int i = 0; i < 100; i++) cache.put(i, i); injectTestSystemOut(); GridCacheContext<Object, Object> cacheCtx = ignite.cachex(DEFAULT_CACHE_NAME).context(); corruptDataEntry(cacheCtx, 0, true, false); corruptDataEntry(cacheCtx, parts / 2, false, true); assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--dump", "--cacheKind", "NOT_PERSISTENT")); Matcher fileNameMatcher = dumpFileNameMatcher(); if (fileNameMatcher.find()) { String dumpWithConflicts = new String(Files.readAllBytes(Paths.get(fileNameMatcher.group(1)))); assertTrue(dumpWithConflicts.contains("found 1 conflict partitions: [counterConflicts=0, " + "hashConflicts=1]")); } else fail("Should be found dump with conflicts"); }

Target:
public void testCacheIdleVerifyDumpForCorruptedDataOnNonePersistenceClientCache() throws Exception { int parts = 32; dataRegionConfiguration = new DataRegionConfiguration() .setName("none-persistence-region"); IgniteEx ignite = (IgniteEx)startGrids(3); ignite.cluster().active(true); IgniteCache<Object, Object> cache = ignite.createCache(new CacheConfiguration<>() .setAffinity(new RendezvousAffinityFunction(false, parts)) .setBackups(2) .setName(DEFAULT_CACHE_NAME) .setDataRegionName("none-persistence-region")); for (int i = 0; i < 100; i++) cache.put(i, i); injectTestSystemOut(); GridCacheContext<Object, Object> cacheCtx = ignite.cachex(DEFAULT_CACHE_NAME).context(); corruptDataEntry(cacheCtx, 0, true, false); corruptDataEntry(cacheCtx, parts / 2, false, true); assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--dump", "--cacheFilter", CacheFilterEnum .NOT_PERSISTENT.toString())); Matcher fileNameMatcher = dumpFileNameMatcher(); if (fileNameMatcher.find()) { String dumpWithConflicts = new String(Files.readAllBytes(Paths.get(fileNameMatcher.group(1)))); assertTrue(dumpWithConflicts.contains("found 1 conflict partitions: [counterConflicts=0, " + "hashConflicts=1]")); } else fail("Should be found dump with conflicts"); }
Source:
public void canTakeBlockageIsDisplayed() throws Exception { FreeStyleProject project = r.createFreeStyleProject(); r.jenkins.getQueue().schedule(project); Queue.Item item = null; long timeout = TimeUnit.MINUTES.toMillis(1); long started = System.currentTimeMillis(); while (System.currentTimeMillis() - started < timeout) { item = r.jenkins.getQueue().getItem(project); if (item.isBuildable() && item.getCauseOfBlockage().getShortDescription().contains("blocked by canTake")) { break; } Thread.sleep(100); } assertNotNull(item); CauseOfBlockage cob = item.getCauseOfBlockage(); assertNotNull(cob); assertThat(cob.getShortDescription(), containsString("blocked by canTake")); StringWriter w = new StringWriter(); TaskListener l = new StreamTaskListener(w); cob.print(l); l.getLogger().flush(); assertThat(w.toString(), containsString("blocked by canTake")); }

Target:
public void canTakeBlockageIsDisplayed() throws Exception { FreeStyleProject project = r.createFreeStyleProject(); r.jenkins.getQueue().schedule(project, 0); r.getInstance().getQueue().maintain(); Queue.Item item = r.jenkins.getQueue().getItem(project); assertNotNull(item); CauseOfBlockage cob = item.getCauseOfBlockage(); assertNotNull(cob); assertThat(cob.getShortDescription(), containsString("blocked by canTake")); StringWriter w = new StringWriter(); TaskListener l = new StreamTaskListener(w); cob.print(l); l.getLogger().flush(); assertThat(w.toString(), containsString("blocked by canTake")); }
Source:
protected synchronized MantaObjectInputStream connectOrGetResponse() throws IOException { if (responseStream.get() != null) { return responseStream.get(); } final HttpUriRequest request = connectionFactory.get(path); final MantaHttpHeaders headers = new MantaHttpHeaders(); headers.setRange(String.format("bytes=%d-", position)); this.requestRef.set(request); MantaObjectInputStream stream = httpHelper.httpRequestAsInputStream( request, headers); responseStream.compareAndSet(null, stream); final String contentType = stream.getContentType(); if (MantaObjectResponse.DIRECTORY_RESPONSE_CONTENT_TYPE.equals(contentType)) { MantaClientException e = new MantaClientException( "Can't get SeekableByteChannel for directory objects"); @SuppressWarnings("unchecked") HttpResponse response = (HttpResponse)stream.getHttpResponse(); HttpHelper.annotateContextedException(e, request, response); throw e; } return stream; }

Target:
protected synchronized MantaObjectInputStream connectOrGetResponse() throws IOException { if (responseStream.get() != null) { return responseStream.get(); } final HttpUriRequest request = connectionFactory.get(path); final MantaHttpHeaders headers = new MantaHttpHeaders(); headers.setRange(String.format("bytes=%d-", position.get())); this.requestRef.set(request); MantaObjectInputStream stream = httpHelper.httpRequestAsInputStream( request, headers); responseStream.compareAndSet(null, stream); final String contentType = stream.getContentType(); if (MantaObjectResponse.DIRECTORY_RESPONSE_CONTENT_TYPE.equals(contentType)) { MantaClientException e = new MantaClientException( "Can't get SeekableByteChannel for directory objects"); @SuppressWarnings("unchecked") HttpResponse response = (HttpResponse)stream.getHttpResponse(); HttpHelper.annotateContextedException(e, request, response); throw e; } return stream; }
Source:
public static XBeeProtocol get(int id) { return lookupTable.get(id); }

Target:
public static XBeeProtocol get(int id) { if (!lookupTable.containsKey(id)) return UNKNOWN; return lookupTable.get(id); }
Source:
public CacheConfigurationBuilder<K, V> add(ServiceConfiguration<?> configuration) { CacheConfigurationBuilder<K, V> otherBuilder = new CacheConfigurationBuilder<K, V>(expiry, classLoader, evictionPrioritizer, evictionVeto, resourcePools, serviceConfigurations); otherBuilder.serviceConfigurations.add(configuration); return otherBuilder; }

Target:
public CacheConfigurationBuilder<K, V> add(ServiceConfiguration<?> configuration) { CacheConfigurationBuilder<K, V> otherBuilder = new CacheConfigurationBuilder<K, V>(this); otherBuilder.serviceConfigurations.add(configuration); return otherBuilder; }
Source:
protected void onHandleIntent(Intent intent) { mContext = getApplicationContext(); prefs = PreferenceManager.getDefaultSharedPreferences(mContext); bg_missed_alerts = prefs.getBoolean("bg_missed_alerts", false); bg_missed_minutes = Integer.parseInt(prefs.getString("bg_missed_minutes", "30")); otherAlertSnooze = Integer.parseInt(prefs.getString("other_alerts_snooze", "20")); if (bg_missed_alerts && BgReading.getTimeSinceLastReading() > (bg_missed_minutes * 1000 * 60) && prefs.getLong("alerts_disabled_until", 0) < new Date().getTime()) { Notifications.bgMissedAlert(mContext); checkBackAfterSnoozeTime(); } else { long alarmIn = (prefs.getLong("alerts_disabled_until", 0) - new Date().getTime()) * 1000 * 60; if (alarmIn <= 0) { alarmIn = Long.parseLong(prefs.getString("bg_missed_minutes", "30")); } checkBackAfterMissedTime(alarmIn); } }

Target:
protected void onHandleIntent(Intent intent) { mContext = getApplicationContext(); prefs = PreferenceManager.getDefaultSharedPreferences(mContext); bg_missed_alerts = prefs.getBoolean("bg_missed_alerts", false); bg_missed_minutes = Integer.parseInt(prefs.getString("bg_missed_minutes", "30")); otherAlertSnooze = Integer.parseInt(prefs.getString("other_alerts_snooze", "20")); if (bg_missed_alerts && BgReading.getTimeSinceLastReading() > (bg_missed_minutes * 1000 * 60) && prefs.getLong("alerts_disabled_until", 0) < new Date().getTime()) { Notifications.bgMissedAlert(mContext); checkBackAfterSnoozeTime(); } else { long alarmIn = prefs.getLong("alerts_disabled_until", 0) - new Date().getTime(); if (alarmIn <= 0) { alarmIn = Long.parseLong(prefs.getString("bg_missed_minutes", "30"))* 1000 * 60; } checkBackAfterMissedTime(alarmIn); } }