auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected ActionResult execute() { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); String nextUrl = getRequestParamValue(Const.ParamsNames.NEXT_URL); if (nextUrl == null) { nextUrl = Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE; } FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), feedbackSession, false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); if (!feedbackSession.isOpened()) { statusToUser.add(new StatusMessage( Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSESSIONNOTOPEN, StatusMessageColor.DANGER)); return createRedirectResult(nextUrl); } taskQueuer.scheduleFeedbackSessionReminders(courseId, feedbackSessionName); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT, StatusMessageColor.SUCCESS)); statusToAdmin = "Email sent out to all students who have not completed " + "Feedback Session <span class=\"bold\">(" + feedbackSessionName + ")</span> " + "of Course <span class=\"bold\">[" + courseId + "]</span>"; return createRedirectResult(nextUrl); }

Target:
protected ActionResult execute() { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); String nextUrl = getRequestParamValue(Const.ParamsNames.NEXT_URL); if (nextUrl == null) { nextUrl = Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE; } FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), feedbackSession, false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); if (!feedbackSession.isOpened()) { statusToUser.add(new StatusMessage( Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSESSIONNOTOPEN, StatusMessageColor.DANGER)); statusToAdmin = "Reminder email could not be sent out as the feedback session is not open for submissions."; return createRedirectResult(nextUrl); } taskQueuer.scheduleFeedbackSessionReminders(courseId, feedbackSessionName); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT, StatusMessageColor.SUCCESS)); statusToAdmin = "Email sent out to all students who have not completed " + "Feedback Session <span class=\"bold\">(" + feedbackSessionName + ")</span> " + "of Course <span class=\"bold\">[" + courseId + "]</span>"; return createRedirectResult(nextUrl); }
Source:
protected MessageBus getMessageBus() { testMessageBus = new RabbitTestMessageBus(rabbitAvailableRule.getResource(), getCodec()); return testMessageBus; }

Target:
protected MessageBus getMessageBus() { if (testMessageBus == null) { testMessageBus = new RabbitTestMessageBus(rabbitAvailableRule.getResource(), getCodec()); } return testMessageBus; }
Source:
public boolean isConnectionAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager)mConnectionContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); return isConnected; }

Target:
public boolean isConnectionAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager)mConnectionContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); return activeNetwork != null && activeNetwork.isConnectedOrConnecting(); }
Source:
public boolean isHoliday(LocalDate date) { ArgChecker.notNull(date, "date"); try { int index = (date.getYear() - startYear) * 12 + date.getMonthValue() - 1; return (lookup[index] & (1 << (date.getDayOfMonth() - 1))) > 0; } catch (ArrayIndexOutOfBoundsException ex) { if (startYear == 0) { return weekendDays.contains(date.getDayOfWeek()); } throw new IllegalArgumentException("Date is not within the range of known holidays: " + date + ", " + range); } }

Target:
public boolean isHoliday(LocalDate date) { ArgChecker.notNull(date, "date"); try { int index = (date.getYear() - startYear) * 12 + date.getMonthValue() - 1; return (lookup[index] & (1 << (date.getDayOfMonth() - 1))) == 0; } catch (ArrayIndexOutOfBoundsException ex) { if (startYear == 0) { return weekendDays.contains(date.getDayOfWeek()); } throw new IllegalArgumentException(rangeError(date)); } }
Source:
private Object readResolve() { return INSTANCE; }

Target:
protected Object readResolve() { return INSTANCE; }
Source:
public void shouldTraverseListWithGivenFunction2(){ List<String> strings = list("some1", "some2", "some3"); F<String, Option<String>> f = s -> { if(s.startsWith("some")) return some(s); else return Option.none(); }; Option<List<String>> optStr = strings.traverseOption(f); Assert.assertEquals("optStr should be some", optStr.isSome(), true); Assert.assertArrayEquals(optStr.some().toArray().array(), new String[]{"some1", "some2", "some3"}); }

Target:
public void shouldTraverseListWithGivenFunction2(){ List<String> strings = list("some1", "some2", "some3"); F<String, Option<String>> f = s -> { if(s.startsWith("some")) return some(s); else return Option.none(); }; Option<List<String>> optStr = strings.traverseOption(f); Assert.assertEquals("optStr should be some", optStr.isSome(), true); assertThat(optStr.some(), is(List.list("some1", "some2", "some3"))); }
Source:
public static AssetTable<String> buildFromIngestible(AssetNodesByDoi assetNodeMap, ManifestXml manifest) { Map<Key, Value<String>> ingestibleEntryNames = new LinkedHashMap<>(); for (ManifestXml.Asset asset : manifest.parse()) { AssetType assetType = findAssetType(assetNodeMap, asset); for (ManifestXml.Representation representation : asset.getRepresentations()) { String entryName = representation.getEntry(); String fileType = assetType.getFileType(representation.getName()); Key key = new Key(AssetIdentity.create(asset.getUri()), fileType); Value<String> value = new Value<>(assetType, entryName); Value<String> previous = ingestibleEntryNames.put(key, value); if (previous != null) { String message = String.format("More than one file has uri=\"%s\" and repr=\"%s\"", asset.getUri(), representation.getName()); throw new RestClientException(message, HttpStatus.BAD_REQUEST); } } } return new AssetTable<>(ingestibleEntryNames); }

Target:
public static AssetTable<String> buildFromIngestible(AssetNodesByDoi assetNodeMap, ManifestXml manifest) { Map<Key, Value<String>> ingestibleEntryNames = new LinkedHashMap<>(); for (ManifestXml.Asset asset : manifest.parse()) { AssetType assetType = findAssetType(assetNodeMap, asset); for (ManifestXml.Representation representation : asset.getRepresentations()) { insertEntryForAssetRepr(ingestibleEntryNames, asset, assetType, representation); } } return new AssetTable<>(ingestibleEntryNames); }
Source:
private boolean removeInternal(final K key) throws CacheWritingException { removeObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key); final AtomicBoolean modified = new AtomicBoolean(); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { modified.set(previousValue != null); try { if (cacheLoaderWriter != null) { cacheLoaderWriter.delete(key); } } catch (Exception e) { throw newCacheWritingException(e); } eventNotificationService.onEvent(CacheEvents.removal(key, previousValue, Ehcache.this)); return null; } }); try { store.compute(key, remappingFunction); if (modified.get()) { removeObserver.end(RemoveOutcome.SUCCESS); markAllCacheEventsFireable(); } else { removeObserver.end(RemoveOutcome.NOOP); markAllCacheEventsFireable(); } } catch (CacheAccessException e) { try { try { remappingFunction.apply(key, null); } catch (CacheWritingException f) { resilienceStrategy.removeFailure(key, e, f); } resilienceStrategy.removeFailure(key, e); } finally { removeObserver.end(RemoveOutcome.FAILURE); markAllCacheEventsFailed(); } } return modified.get(); }

Target:
private boolean removeInternal(final K key) throws CacheWritingException { removeObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key); final AtomicBoolean modified = new AtomicBoolean(); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { modified.set(previousValue != null); try { if (cacheLoaderWriter != null) { cacheLoaderWriter.delete(key); } } catch (Exception e) { throw newCacheWritingException(e); } eventNotificationService.onEvent(CacheEvents.removal(key, previousValue, Ehcache.this)); return null; } }); try { store.compute(key, remappingFunction); if (modified.get()) { removeObserver.end(RemoveOutcome.SUCCESS); eventNotificationService.fireAllEvents(); } else { removeObserver.end(RemoveOutcome.NOOP); eventNotificationService.fireAllEvents(); } } catch (CacheAccessException e) { try { try { remappingFunction.apply(key, null); } catch (CacheWritingException f) { resilienceStrategy.removeFailure(key, e, f); } resilienceStrategy.removeFailure(key, e); } finally { removeObserver.end(RemoveOutcome.FAILURE); } } finally { eventNotificationService.processAndFireRemainingEvents(); } return modified.get(); }
Source:
public void updatePayload( final Map<String, String> key, final Set<Series> series, final List<Payload> values ) { this.childSession.updatePayload(key, series, values); }

Target:
public void updatePayload( final Map<String, String> key, final Set<Series> series, final List<Payload> values ) { }
Source:
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { switch (name) { case ACTION_SEND_TEXT_MESSAGE: try { int channelId = params.getInt(PARAM_CHANNEL_ID); WebSocketProxy proxy = extension.getWebSocketProxy(channelId); if (proxy != null) { this.sendWebSocketMessage( proxy, params.getBoolean(PARAM_OUTGOING), params.getString(PARAM_MESSAGE)); } else { throw new ApiException(ApiException.Type.DOES_NOT_EXIST, "channelId: " + channelId); } } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new ApiException(ApiException.Type.INTERNAL_ERROR, e.getMessage()); } break; case ACTION_SET_BREAK_TEXT_MESSAGE: ExtensionBreak extBreak = (ExtensionBreak) Control.getSingleton().getExtensionLoader().getExtension(ExtensionBreak.NAME); if (extBreak != null) { Message msg = extBreak.getBreakpointManagementInterface().getMessage(); if (msg == null) { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "No currently intercepted message"); } else if (msg instanceof WebSocketMessageDTO) { WebSocketMessageDTO ws = (WebSocketMessageDTO)msg; ws.setPayload(params.optString(PARAM_MESSAGE, "")); extBreak.getBreakpointManagementInterface().setMessage(ws, true); } else { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "Intercepted message is not of the right type " + msg.getClass().getCanonicalName()); } } else { throw new ApiException(ApiException.Type.INTERNAL_ERROR, "ExtensionBreak not present"); } break; default: throw new ApiException(ApiException.Type.BAD_ACTION); } return ApiResponseElement.OK; }

Target:
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { switch (name) { case ACTION_SEND_TEXT_MESSAGE: try { int channelId = params.getInt(PARAM_CHANNEL_ID); WebSocketProxy proxy = extension.getWebSocketProxy(channelId); if (proxy != null) { this.sendWebSocketMessage( proxy, params.getBoolean(PARAM_OUTGOING), params.getString(PARAM_MESSAGE)); } else { throw new ApiException(ApiException.Type.DOES_NOT_EXIST, "channelId: " + channelId); } } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new ApiException(ApiException.Type.INTERNAL_ERROR, e.getMessage()); } break; case ACTION_SET_BREAK_TEXT_MESSAGE: ExtensionBreak extBreak = Control.getSingleton().getExtensionLoader().getExtension(ExtensionBreak.class); if (extBreak == null) { throw new ApiException(ApiException.Type.INTERNAL_ERROR, "ExtensionBreak not present"); } Message msg = extBreak.getBreakpointManagementInterface().getMessage(); if (msg == null) { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "No currently intercepted message"); } else if (msg instanceof WebSocketMessageDTO) { WebSocketMessageDTO ws = (WebSocketMessageDTO)msg; ws.payload = params.optString(PARAM_MESSAGE, ""); extBreak.getBreakpointManagementInterface().setMessage(ws, params.getBoolean(PARAM_OUTGOING)); } else { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "Intercepted message is not of the right type " + msg.getClass().getCanonicalName()); } break; default: throw new ApiException(ApiException.Type.BAD_ACTION); } return ApiResponseElement.OK; }
Source:
public void persistTimer(final TimerImpl timer, boolean newTimer) { if (timer == null) { return; } if (timer.isTimerPersistent()) { try { if (timerPersistence.getOptionalValue() == null) { EJB3_TIMER_LOGGER.timerPersistenceNotEnable(); return; } final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); Transaction clientTX = transactionManager.getTransaction(); if (newTimer) { if( clientTX == null ){ transactionManager.begin(); } try { timerPersistence.getValue().addTimer(timer); if(clientTX == null) transactionManager.commit(); } catch (Exception e){ if(clientTX == null) { try { transactionManager.rollback(); } catch (Exception ee){ EjbLogger.EJB3_TIMER_LOGGER.timerUpdateFailedAndRollbackNotPossible(ee); } } throw e; } } else { if( clientTX != null ) transactionManager.suspend(); for (int count = 3; count > 0; count--) { try { transactionManager.begin(); timerPersistence.getValue().persistTimer(timer); transactionManager.commit(); break; } catch (RuntimeException e) { try { transactionManager.rollback(); } catch (Exception ee) { } if (count > 1) { EJB3_TIMER_LOGGER.debug("Failed to persist timer " + timer + " due to " + e.getCause()); } else { throw e; } } } if( clientTX != null ) transactionManager.resume(clientTX); } } catch (Throwable t) { this.setRollbackOnly(); throw new RuntimeException(t); } } }

Target:
public void persistTimer(final TimerImpl timer, boolean newTimer) { if (timer == null) { return; } if (timer.isTimerPersistent()) { try { if (timerPersistence.getOptionalValue() == null) { EJB3_TIMER_LOGGER.timerPersistenceNotEnable(); return; } final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); Transaction clientTX = transactionManager.getTransaction(); if (newTimer || timer.isCanceled()) { if( clientTX == null ){ transactionManager.begin(); } try { if( newTimer ) timerPersistence.getValue().addTimer(timer); else timerPersistence.getValue().persistTimer(timer); if(clientTX == null) transactionManager.commit(); } catch (Exception e){ if(clientTX == null) { try { transactionManager.rollback(); } catch (Exception ee){ EjbLogger.EJB3_TIMER_LOGGER.timerUpdateFailedAndRollbackNotPossible(ee); } } throw e; } } else { new TaskPostPersist(timer).persistTimer(); } } catch (Throwable t) { this.setRollbackOnly(); throw new RuntimeException(t); } } }
Source:
private void send(){ if(!typeText.getText().equals("")){ getMessege("lala",typeText.getText()); typeText.setText(""); } }

Target:
private void send(){ if(!typeText.getText().equals("")){ getMessege("Username",typeText.getText()); typeText.setText(""); } }
Source:
public static void main(String[] args) throws IOException, ClassNotFoundException { Client client = ClientBuilder.newClient(); WebTarget target = client.target(HZ_REST_URL); Response stringResponse = target.path("/maps/simple/key1").request().get(); String responseBody = stringResponse.readEntity(String.class); System.out.println("Value for key1 is " + responseBody); Response objectResponse = target.path("/maps/object/key1").request().get(); byte[] entity = objectResponse.readEntity(byte[].class); ByteArrayInputStream byteArrayInputStream = null; ObjectInputStream objectInputStream = null; try { byteArrayInputStream = new ByteArrayInputStream(entity); objectInputStream = new ObjectInputStream(byteArrayInputStream); Person person = (Person) objectInputStream.readObject(); System.out.println("Object for key1 is " + person.toString()); } finally { closeQuietly(objectInputStream); closeQuietly(byteArrayInputStream); } HazelcastClient.shutdownAll(); }

Target:
public static void main(String[] args) throws IOException, ClassNotFoundException { Client client = ClientBuilder.newClient(); WebTarget target = client.target(HZ_REST_URL); Response stringResponse = target.path("/maps/simple/key1").request().get(); String responseBody = stringResponse.readEntity(String.class); System.out.println("Value for key1 is " + responseBody); Response objectResponse = target.path("/maps/object/key1").request().get(); byte[] entity = objectResponse.readEntity(byte[].class); ByteArrayInputStream byteArrayInputStream = null; ObjectInputStream objectInputStream = null; try { byteArrayInputStream = new ByteArrayInputStream(entity); objectInputStream = new ObjectInputStream(byteArrayInputStream); Person person = (Person) objectInputStream.readObject(); System.out.println("Object for key1 is " + person.toString()); } finally { closeQuietly(objectInputStream); closeQuietly(byteArrayInputStream); } }
Source:
public boolean onPreferenceChange(Preference preference, Object objValue) { boolean isCombiningRestrictedAndUnknownOption = getResources().getBoolean( R.bool.combine_options_to_block_restricted_and_unknown_callers); if (isCombiningRestrictedAndUnknownOption && preference.getKey().equals(BLOCK_UNKNOWN_NUMBERS_KEY)) { Log.i(this, "onPreferenceChange: changing %s and %s to %b", preference.getKey(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); } BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), preference.getKey(), (boolean) objValue); return true; }

Target:
public boolean onPreferenceChange(Preference preference, Object objValue) { if (mIsCombiningRestrictedAndUnknownOption && preference.getKey().equals(BLOCK_UNKNOWN_NUMBERS_KEY)) { Log.i(this, "onPreferenceChange: changing %s and %s to %b", preference.getKey(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); } BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), preference.getKey(), (boolean) objValue); return true; }
Source:
private void mapNodes(GraphModel graphModel, Set<Long> nodeIds) { for (Node node : graphModel.getNodes()) { if (!nodeIds.contains(node.getId())) { Object entity = mappingContext.getNodeEntity(node.getId()); try { if (entity == null) { synchronized (this) { entity = entityFactory.newObject(node); setIdentity(entity, node.getId()); setProperties(node, entity); entity = mappingContext.registerNodeEntity(entity, node.getId()); } } nodeIds.add(node.getId()); } catch (BaseClassNotFoundException e) { logger.debug(e.getMessage()); } } } }

Target:
private void mapNodes(GraphModel graphModel, Set<Long> nodeIds) { for (Node node : graphModel.getNodes()) { if (!nodeIds.contains(node.getId())) { Object entity = mappingContext.getNodeEntity(node.getId()); try { if (entity == null) { synchronized (this) { entity = entityFactory.newObject(node); setIdentity(entity, node.getId()); setProperties(node, entity); entity = mappingContext.registerNodeEntity(entity, node.getId()); } } else { setProperties(node, entity); } nodeIds.add(node.getId()); } catch (BaseClassNotFoundException e) { logger.debug(e.getMessage()); } } } }
Source:
private <T extends Serializable> void registerStatistic(String name, StatisticType type, String tag, Function<EhcacheOffHeapBackingMap<K, OffHeapValueHolder<V>>, T> fn) { StatisticsManager.createPassThroughStatistic(this, name, new HashSet<>(Arrays.asList(name, "tier")), type, () -> { EhcacheOffHeapBackingMap<K, OffHeapValueHolder<V>> map = backingMap(); return map == null ? null : fn.apply(map); }); }

Target:
private <T extends Serializable> void registerStatistic(String name, StatisticType type, String tag, Function<EhcacheOffHeapBackingMap<K, OffHeapValueHolder<V>>, T> fn) { StatisticsManager.createPassThroughStatistic(this, name, tags(tag, "tier"), type, () -> { EhcacheOffHeapBackingMap<K, OffHeapValueHolder<V>> map = backingMap(); return map == null ? null : fn.apply(map); }); }
Source:
public synchronized String toString() { StringBuilder sb = new StringBuilder(); sb.append("Stream " + getUniqueID() + ", Number of Packets: " + (fNbPacketsAtoB + fNbPacketsBtoA) + "\n"); String string = sb.toString(); if (string == null) { return EMPTY_STRING; } return string; }

Target:
public synchronized String toString() { StringBuilder sb = new StringBuilder(); sb.append("Stream " + getUniqueID() + ", Number of Packets: " + getNbPackets() + "\n"); @SuppressWarnings("null") @NonNull String string = sb.toString(); return string; }
Source:
public void test_SerializationBug_26387905() throws Exception { Locale l = Locale.US; ObjectInputStream oinput = null; try { oinput = new ObjectInputStream(getClass().getResource("/serialization/org/apache/harmony/tests/java/util/Locale_Bug_26387905.ser") .openStream()); l = (Locale) oinput.readObject(); } finally { try { if (null != oinput) { oinput.close(); } } catch (Exception e) { } } }

Target:
public void test_SerializationBug_26387905() throws Exception { try (ObjectInputStream oinput = new ObjectInputStream(getClass() .getResource("/serialization/org/apache/harmony/tests/java/util/Locale_Bug_26387905.ser") .openStream())) { Locale l = (Locale) oinput.readObject(); } }
Source:
private Map<String, String> addBuildArgsFromDockerConfig() { JsonObject dockerConfig = DockerFileUtil.readDockerConfig(); if (dockerConfig == null) { return Collections.emptyMap(); } Map<String, String> buildArgs = new HashMap<>(); if (dockerConfig.has("proxies")) { JsonObject proxies = dockerConfig.getAsJsonObject("proxies"); if (proxies.has("default")) { JsonObject defaultProxyObj = proxies.getAsJsonObject("default"); for(Map.Entry<String, String> entry : Collections.unmodifiableMap(new HashMap<String, String>() {{ put("httpProxy", "http_proxy"); put("httpsProxy", "https_proxy"); put("noProxy", "no_proxy"); put("ftpProxy", "ftp_proxy"); }}).entrySet()) { if (defaultProxyObj.has(entry.getKey())) { buildArgs.put(argPrefix + entry.getValue(), defaultProxyObj.get(entry.getKey()).getAsString()); } } } } log.debug("Build args set %s", buildArgs); return buildArgs; }

Target:
private Map<String, String> addBuildArgsFromDockerConfig() { JsonObject dockerConfig = DockerFileUtil.readDockerConfig(); if (dockerConfig == null) { return Collections.emptyMap(); } Map<String, String> buildArgs = new HashMap<>(); if (dockerConfig.has("proxies")) { JsonObject proxies = dockerConfig.getAsJsonObject("proxies"); if (proxies.has("default")) { JsonObject defaultProxyObj = proxies.getAsJsonObject("default"); String[] proxyMapping = new String[] { "httpProxy", "http_proxy", "httpsProxy", "https_proxy", "noProxy", "no_proxy", "ftpProxy", "ftp_proxy" }; for(int index = 0; index < proxyMapping.length; index += 2) { if (defaultProxyObj.has(proxyMapping[index])) { buildArgs.put(argPrefix + proxyMapping[index+1], defaultProxyObj.get(proxyMapping[index]).getAsString()); } } } } log.debug("Build args set %s", buildArgs); return buildArgs; }
Source:
protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModule == null) { return; } ITmfStateSystem ss = fModule.getStateSystem(); if (ss == null) { return; } double[] xAxis = getXAxis(start, end, nb); if (xAxis.length == 1) { return; } setXAxis(xAxis); for (Integer quark : fQuarks) { try { double[] steps = new double[xAxis.length]; Object prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getValue(); for (int i = 0; i < xAxis.length; i++) { Object next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getValue(); long prevValue = prev instanceof Long ? (long) prev : 0; long nextValue = next instanceof Long ? (long) next : 0; long stateValue = (prev == null) ? nextValue : nextValue - prevValue; steps[i] = (next == null) ? 0 : stateValue; prev = next; } setSeries(ss.getFullAttributePath(quark), steps); } catch (StateSystemDisposedException e) { return; } } updateDisplay(); }

Target:
protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModule == null) { return; } ITmfStateSystem ss = fModule.getStateSystem(); if (ss == null) { return; } double[] xAxis = getXAxis(start, end, nb); if (xAxis.length == 1) { return; } setXAxis(xAxis); try (ScopeLog log = new ScopeLog(LOGGER, Level.FINE, "CounterChartViewer#updateData")) { for (Integer quark : fQuarks) { double[] steps = new double[xAxis.length]; Object prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getValue(); long prevValue = prev instanceof Long ? (long) prev : 0; for (int i = 0; i < xAxis.length; i++) { Object next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getValue(); long nextValue = next instanceof Long ? (long) next : 0; steps[i] = (next == null) ? 0 : nextValue - prevValue; prevValue = nextValue; } setSeries(ss.getFullAttributePath(quark), steps); } } catch (StateSystemDisposedException e) { return; } updateDisplay(); }
Source:
private static SslContextFactory getSslContextFactory(ZeppelinConfiguration conf) { SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); if (StringUtils.isNoneBlank(conf.getPemKeyFile(), conf.getPemCertFile())) { File pemKey = new File(conf.getPemKeyFile()); File pemCert = new File(conf.getPemCertFile()); try { String password = conf.getPemKeyPassword(); sslContextFactory.setKeyStore(PEMImporter.loadKeyStore(pemCert, pemKey, password)); sslContextFactory.setKeyStoreType("JKS"); sslContextFactory.setKeyStorePassword(password); if (conf.useClientAuth() && StringUtils.isNotBlank(conf.getPemCAFile())) { File pemCA = new File(conf.getPemCAFile()); sslContextFactory.setTrustStore(PEMImporter.loadTrustStore(pemCA)); sslContextFactory.setTrustStoreType("JKS"); sslContextFactory.setTrustStorePassword(""); sslContextFactory.setNeedClientAuth(conf.useClientAuth()); } } catch (IOException | GeneralSecurityException e) { LOG.error("Failed to initailize Certificates from PEM files", e); } } else { sslContextFactory.setKeyStorePath(conf.getKeyStorePath()); sslContextFactory.setKeyStoreType(conf.getKeyStoreType()); sslContextFactory.setKeyStorePassword(conf.getKeyStorePassword()); sslContextFactory.setKeyManagerPassword(conf.getKeyManagerPassword()); if (conf.useClientAuth()) { sslContextFactory.setNeedClientAuth(conf.useClientAuth()); sslContextFactory.setTrustStorePath(conf.getTrustStorePath()); sslContextFactory.setTrustStoreType(conf.getTrustStoreType()); sslContextFactory.setTrustStorePassword(conf.getTrustStorePassword()); } } return sslContextFactory; }

Target:
private static SslContextFactory getSslContextFactory(ZeppelinConfiguration conf) { SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); if (StringUtils.isNoneBlank(conf.getPemKeyFile(), conf.getPemCertFile())) { setupKeystoreWithPemFiles(sslContextFactory, conf); } else { sslContextFactory.setKeyStorePath(conf.getKeyStorePath()); sslContextFactory.setKeyStoreType(conf.getKeyStoreType()); sslContextFactory.setKeyStorePassword(conf.getKeyStorePassword()); sslContextFactory.setKeyManagerPassword(conf.getKeyManagerPassword()); } if (conf.useClientAuth()) { if (StringUtils.isNotBlank(conf.getPemCAFile())) { setupTruststoreWithPemFiles(sslContextFactory, conf); } else { sslContextFactory.setNeedClientAuth(conf.useClientAuth()); sslContextFactory.setTrustStorePath(conf.getTrustStorePath()); sslContextFactory.setTrustStoreType(conf.getTrustStoreType()); sslContextFactory.setTrustStorePassword(conf.getTrustStorePassword()); } } return sslContextFactory; }
Source:
public void partialCumulate() { final Object decoded = new Object(); for (int firstMessageCount = 0 ; firstMessageCount <= 1 ; ++firstMessageCount) { for (int unreadFinalBytes = 0 ; unreadFinalBytes <= 1 ; ++unreadFinalBytes) { final PartialCumulationDecoder decoder = new PartialCumulationDecoder(2) { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) { while (true) { if (in.readableBytes() < 2) return; in.readByte(); in.readByte(); out.add(decoded); } } }; ByteBuf in1 = Unpooled.buffer().writeZero(firstMessageCount * 2 + 1); ByteBuf in2 = Unpooled.buffer().writeZero(5 + unreadFinalBytes); EmbeddedChannel channel = new EmbeddedChannel(decoder); channel.writeInbound(in1); for (int i = 0 ; i < firstMessageCount ; ++i) { assertSame(decoded, channel.readInbound()); } assertNull(channel.readInbound()); channel.writeInbound(in2); for (int i = 0 ; i < 3 ; ++i) { assertSame(decoded, channel.readInbound()); } assertEquals(0, in1.refCnt()); assertEquals(2 + unreadFinalBytes, decoder.cumulations); if (unreadFinalBytes > 0) { assertSame(in2, decoder.cumulation); assertEquals(1, decoder.cumulation.readableBytes()); decoder.cumulation.release(); } else { assertEquals(0, in2.refCnt()); assertNull(decoder.cumulation); } } } }

Target:
public void partialCumulate() { final Object decoded = new Object(); for (int firstMessageCount = 0 ; firstMessageCount <= 1 ; ++firstMessageCount) { for (int unreadFinalBytes = 0 ; unreadFinalBytes <= 1 ; ++unreadFinalBytes) { final PartialCumulationDecoder decoder = new PartialCumulationDecoder(2) { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) { while (in.readableBytes() >= 2) { in.skipBytes(2); out.add(decoded); } } }; ByteBuf in1 = Unpooled.buffer().writeZero(firstMessageCount * 2 + 1); ByteBuf in2 = Unpooled.buffer().writeZero(5 + unreadFinalBytes); EmbeddedChannel channel = new EmbeddedChannel(decoder); assertEquals(firstMessageCount > 0, channel.writeInbound(in1)); for (int i = 0 ; i < firstMessageCount ; ++i) { assertSame(decoded, channel.readInbound()); } assertNull(channel.readInbound()); assertTrue(channel.writeInbound(in2)); for (int i = 0 ; i < 3 ; ++i) { assertSame(decoded, channel.readInbound()); } assertEquals(0, in1.refCnt()); assertEquals(2 + unreadFinalBytes, decoder.cumulations); if (unreadFinalBytes > 0) { assertSame(in2, decoder.cumulation); assertEquals(1, decoder.cumulation.readableBytes()); } else { assertEquals(0, in2.refCnt()); assertNull(decoder.cumulation); } assertFalse(channel.finish()); } } }
Source:
public ValidationResult validate( LayerInfo layer, boolean isNew) { if ( layer.getResource() == null ) { throw new NullPointerException( "Layer resource must not be null" ); } if (null == getResourceByName(layer.getResource().getNamespace(), layer.getResource() .getName(), ResourceInfo.class)) { throw new IllegalStateException("Found no resource named " + layer.prefixedName() + " , Layer with that name can't be added"); } LayerInfo existing = getLayerByName( layer.getName() ); if ( existing != null && !existing.getId().equals( layer.getId() ) ) { if ( existing.getResource().getNamespace().equals( layer.getResource().getNamespace() ) ) { throw new IllegalArgumentException( "Layer named '"+layer.getName()+"' already exists."); } } if ( layer.getDefaultStyle() == null ) { try { LOGGER.log(Level.INFO, "Layer " + layer.prefixedName() + " is missing the default style, assigning one automatically"); StyleInfo style = new CatalogBuilder(this).getDefaultStyle(layer.getResource()); layer.setDefaultStyle(style); } catch(IOException e) { LOGGER.log(Level.WARNING, "Layer " + layer.prefixedName() + " is missing the default style, " + "failed to associate one automatically", e); } } Set<StyleInfo> styles = layer.getStyles(); if (styles != null) { for (Iterator it = styles.iterator(); it.hasNext();) { StyleInfo styleInfo = (StyleInfo) it.next(); if(styleInfo == null) { it.remove(); } } } return postValidate(layer, isNew); }

Target:
public ValidationResult validate( LayerInfo layer, boolean isNew) { if ( layer.getResource() == null ) { throw new NullPointerException( "Layer resource must not be null" ); } if (null == getResourceByName(layer.getResource().getNamespace(), layer.getResource() .getName(), ResourceInfo.class)) { throw new IllegalStateException("Found no resource named " + layer.prefixedName() + " , Layer with that name can't be added"); } LayerInfo existing = getLayerByName( layer.getName() ); if ( existing != null && !existing.getId().equals( layer.getId() ) ) { if ( existing.getResource().getNamespace().equals( layer.getResource().getNamespace() ) ) { throw new IllegalArgumentException( "Layer named '"+layer.getName()+"' already exists."); } } if ( layer.getDefaultStyle() == null ) { try { LOGGER.log(Level.INFO, "Layer " + layer.prefixedName() + " is missing the default style, assigning one automatically"); StyleInfo style = new CatalogBuilder(this).getDefaultStyle(layer.getResource()); layer.setDefaultStyle(style); } catch(IOException e) { LOGGER.log(Level.WARNING, "Layer " + layer.prefixedName() + " is missing the default style, " + "failed to associate one automatically", e); } } Set<StyleInfo> styles = layer.getStyles(); for (Iterator it = styles.iterator(); it.hasNext();) { StyleInfo styleInfo = (StyleInfo) it.next(); if(styleInfo == null) { it.remove(); } } return postValidate(layer, isNew); }
Source:
public static CriticalHitEvent getCriticalHit(EntityPlayer player, Entity target, boolean vanillaCritical, float damageModifier) { CriticalHitEvent hitResult = new CriticalHitEvent(player, target, damageModifier); MinecraftForge.EVENT_BUS.post(hitResult); if (hitResult.getResult() == Event.Result.ALLOW || (vanillaCritical && hitResult.getResult() == Event.Result.DEFAULT)) { return hitResult; } return null; }

Target:
public static CriticalHitEvent getCriticalHit(EntityPlayer player, Entity target, boolean vanillaCritical, float damageModifier) { CriticalHitEvent hitResult = new CriticalHitEvent(player, target, damageModifier, vanillaCritical); MinecraftForge.EVENT_BUS.post(hitResult); if (hitResult.getResult() == Event.Result.ALLOW || (vanillaCritical && hitResult.getResult() == Event.Result.DEFAULT)) { return hitResult; } return null; }
Source:
public void shouldAddMetricsOnAllLevels() throws Exception { builder.stream(STREAM_INPUT, Consumed.with(Serdes.Integer(), Serdes.String())) .to(STREAM_OUTPUT_1, Produced.with(Serdes.Integer(), Serdes.String())); builder.table(STREAM_OUTPUT_1, Materialized.as(Stores.inMemoryKeyValueStore(MY_STORE_IN_MEMORY)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_2); builder.table(STREAM_OUTPUT_2, Materialized.as(Stores.persistentKeyValueStore(MY_STORE_PERSISTENT_KEY_VALUE)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_3); builder.table(STREAM_OUTPUT_3, Materialized.as(Stores.lruMap(MY_STORE_LRU_MAP, 10000)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_4); startApplication(); for (final Metric metric : new ArrayList<Metric>(kafkaStreams.metrics().values())) { System.out.println(metric.metricName()); } checkThreadLevelMetrics(); checkTaskLevelMetrics(); checkProcessorLevelMetrics(); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_ROCKSDB_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_LRU_STATE_METRICS); checkRocksDBMetricsByTag("rocksdb-state-id"); checkCacheMetrics(); closeApplication(); checkMetricsDeregistration(); }

Target:
public void shouldAddMetricsOnAllLevels() throws Exception { builder.stream(STREAM_INPUT, Consumed.with(Serdes.Integer(), Serdes.String())) .to(STREAM_OUTPUT_1, Produced.with(Serdes.Integer(), Serdes.String())); builder.table(STREAM_OUTPUT_1, Materialized.as(Stores.inMemoryKeyValueStore(MY_STORE_IN_MEMORY)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_2); builder.table(STREAM_OUTPUT_2, Materialized.as(Stores.persistentKeyValueStore(MY_STORE_PERSISTENT_KEY_VALUE)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_3); builder.table(STREAM_OUTPUT_3, Materialized.as(Stores.lruMap(MY_STORE_LRU_MAP, 10000)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_4); startApplication(); checkThreadLevelMetrics(); checkTaskLevelMetrics(); checkProcessorLevelMetrics(); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_ROCKSDB_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_LRU_STATE_METRICS); checkRocksDBMetricsByTag("rocksdb-state-id"); checkCacheMetrics(); closeApplication(); checkMetricsDeregistration(); }
Source:
public IgniteInternalFuture<?> initStartedCaches( boolean crd, final GridDhtPartitionsExchangeFuture fut, Collection<DynamicCacheDescriptor> descs ) throws IgniteCheckedException { IgniteInternalFuture<?> res = cachesRegistry.addUnregistered(descs); for (DynamicCacheDescriptor d: descs) { cctx.coordinators().validateCacheConfiguration(d.cacheConfiguration()); } if (fut.context().mergeExchanges()) return res; forAllRegisteredCacheGroups(new IgniteInClosureX<CacheGroupDescriptor>() { @Override public void applyx(CacheGroupDescriptor desc) throws IgniteCheckedException { CacheGroupHolder cache = getOrCreateGroupHolder(fut.initialVersion(), desc); if (cache.affinity().lastVersion().equals(AffinityTopologyVersion.NONE)) { initAffinity(desc, cache.affinity(), fut); cctx.exchange().exchangerUpdateHeartbeat(); fut.timeBag().finishLocalStage("Affinity initialization (new cache) " + "[grp=" + desc.cacheOrGroupName() + ", crd=" + crd + "]"); } } }); return res; }

Target:
public IgniteInternalFuture<?> initStartedCaches( boolean crd, final GridDhtPartitionsExchangeFuture fut, Collection<DynamicCacheDescriptor> descs ) throws IgniteCheckedException { IgniteInternalFuture<?> res = cachesRegistry.addUnregistered(descs); for (DynamicCacheDescriptor d: descs) cctx.coordinators().validateCacheConfiguration(d.cacheConfiguration()); if (fut.context().mergeExchanges()) return res; forAllRegisteredCacheGroups(new IgniteInClosureX<CacheGroupDescriptor>() { @Override public void applyx(CacheGroupDescriptor desc) throws IgniteCheckedException { CacheGroupHolder cache = getOrCreateGroupHolder(fut.initialVersion(), desc); if (cache.affinity().lastVersion().equals(AffinityTopologyVersion.NONE)) { initAffinity(desc, cache.affinity(), fut); cctx.exchange().exchangerUpdateHeartbeat(); fut.timeBag().finishLocalStage("Affinity initialization (new cache) " + "[grp=" + desc.cacheOrGroupName() + ", crd=" + crd + "]"); } } }); return res; }
Source:
private void destroyTree(RepositoryObject rootOfTree) throws FedoraException, IOException, FcrepoOperationFailedException { deletedObjCount += 1; deletedObjIds.add(rootOfTree.getPid().getUUID()); if (rootOfTree instanceof ContentContainerObject) { ContentContainerObject container = (ContentContainerObject) rootOfTree; List<ContentObject> members = container.getMembers(); for (ContentObject member : members) { deletedObjIds.add(member.getPid().getUUID()); destroyTree(member); } deletedObjCount += members.size(); } Resource rootResc = rootOfTree.getResource(); Model rootModel = rootResc.getModel(); if (rootOfTree instanceof FileObject) { destroyFile((FileObject) rootOfTree, rootResc); } boolean hasLdpContains = rootModel.contains(rootResc, Ldp.contains); if (hasLdpContains) { deleteNonContentObjects(rootModel); } Model stoneModel = convertModelToTombstone(rootOfTree, rootResc); repoObjFactory.createOrTransformObject(rootOfTree.getUri(), stoneModel); rootOfTree.getPremisLog().buildEvent(Premis.Deletion) .addAuthorizingAgent(agent.getUsername()) .addEventDetail("Item deleted from repository and replaced by tombstone") .writeAndClose(); }

Target:
private void destroyTree(RepositoryObject rootOfTree) throws FedoraException, IOException, FcrepoOperationFailedException { if (rootOfTree instanceof ContentContainerObject) { ContentContainerObject container = (ContentContainerObject) rootOfTree; List<ContentObject> members = container.getMembers(); for (ContentObject member : members) { deletedObjIds.add(member.getPid().getUUID()); destroyTree(member); } } Resource rootResc = rootOfTree.getResource(); Model rootModel = rootResc.getModel(); if (rootOfTree instanceof FileObject) { destroyFile((FileObject) rootOfTree, rootResc); } boolean hasLdpContains = rootModel.contains(rootResc, Ldp.contains); if (hasLdpContains) { deleteNonContentObjects(rootModel); } Model stoneModel = convertModelToTombstone(rootOfTree, rootResc); repoObjFactory.createOrTransformObject(rootOfTree.getUri(), stoneModel); rootOfTree.getPremisLog().buildEvent(Premis.Deletion) .addAuthorizingAgent(agent.getUsername()) .addEventDetail("Item deleted from repository and replaced by tombstone") .writeAndClose(); }
Source:
private List<String> getHdfsNotebook() { List<String> hdfsNotebook = new ArrayList<String>(); Gson gson = new Gson(); String hdfsDirStatus = null; try { hdfsDirStatus = this.hdfsCmd.runCommand(this.hdfsCmd.listStatus, this.hdfsNotebookDir, null); if (hdfsDirStatus != null) { AllFileStatus allFiles = gson.fromJson(hdfsDirStatus, AllFileStatus.class); if (allFiles != null && allFiles.FileStatuses != null && allFiles.FileStatuses.FileStatus != null) { for (OneFileStatus fs : allFiles.FileStatuses.FileStatus) { if ("DIRECTORY".equals(fs.type) && fs.pathSuffix.startsWith("_") == false) { hdfsNotebook.add(fs.pathSuffix); logger.info("read a notebook from HDFS: " + fs.pathSuffix); } } } } } catch (Exception e) { logger.error("Exception: ", e); } return hdfsNotebook; }

Target:
private List<String> getHdfsNotebook() { List<String> hdfsNotebook = new ArrayList<String>(); Gson gson = new Gson(); String hdfsDirStatus = null; try { hdfsDirStatus = this.hdfsCmd.runCommand(this.hdfsCmd.listStatus, this.hdfsNotebookDir, null); if (hdfsDirStatus != null) { AllFileStatus allFiles = gson.fromJson(hdfsDirStatus, AllFileStatus.class); if (allFiles != null && allFiles.FileStatuses != null && allFiles.FileStatuses.FileStatus != null) { for (OneFileStatus fs : allFiles.FileStatuses.FileStatus) { if ("DIRECTORY".equals(fs.type) && fs.pathSuffix.startsWith("_") == false) { hdfsNotebook.add(fs.pathSuffix); logger.info("read a notebook from HDFS: " + fs.pathSuffix); } } } } } catch (Exception e) { logger.error("exception occurred during getting notebook from hdfs : ", e); } return hdfsNotebook; }
Source:
public Builder hostStatuses(final List<HostStatus> hostStatuses) { this.hostStatuses = hostStatuses; return this; }

Target:
public Builder hostStatuses(final List<HostStatus> hostStatuses) { this.hostStatuses = ImmutableList.copyOf(hostStatuses); return this; }
Source:
private void deferredWithResolver( final CheckedConsumer<ResourceResolver> action, final boolean closesResolver) { taskRunner.scheduleWork(() -> { started.compareAndSet(0, System.currentTimeMillis()); try { withResolver(action); if (!closesResolver) { logCompletetion(); } } catch (Throwable t) { LOG.error("Error in error handler for action "+getName(), t); if (!closesResolver) { logError(t); } } }); if (!closesResolver) { tasksAdded.incrementAndGet(); } }

Target:
private void deferredWithResolver( final CheckedConsumer<ResourceResolver> action, final boolean closesResolver) { taskRunner.scheduleWork(() -> { started.compareAndSet(0, System.currentTimeMillis()); try { withResolver(action); if (!closesResolver) { logCompletetion(); } } catch (Exception ex) { LOG.error("Error in error handler for action "+getName(), ex); if (!closesResolver) { logError(ex); } } catch (Throwable t) { LOG.error("Fatal uncaught error in error handler for action "+getName(), t); if (!closesResolver) { logError(new RuntimeException(t)); } throw t; } }); if (!closesResolver) { tasksAdded.incrementAndGet(); } }
Source:
public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { if (mSelectedSite != null && event.error.type == AuthenticationErrorType.INVALID_TOKEN) { AuthenticationDialogUtils.showAuthErrorView(this, mSiteStore, mSelectedSite); } return; } if (mAccountStore.hasAccessToken()) { if (hasMagicLinkSignupIntent()) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_MAGIC_LINK_SUCCEEDED); Intent intent = getIntent(); ActivityLauncher.showSignupEpilogue(this, null, null, null, null, true); } else if (hasMagicLinkLoginIntent()) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_SUCCEEDED); ActivityLauncher.showLoginEpilogue(this, true, getIntent().getIntegerArrayListExtra(ARG_OLD_SITES_IDS)); } } }

Target:
public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { if (mSelectedSite != null && event.error.type == AuthenticationErrorType.INVALID_TOKEN) { AuthenticationDialogUtils.showAuthErrorView(this, mSiteStore, mSelectedSite); } return; } if (mAccountStore.hasAccessToken()) { if (hasMagicLinkLoginIntent()) { if (hasMagicLinkSignupIntent()) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_MAGIC_LINK_SUCCEEDED); Intent intent = getIntent(); ActivityLauncher.showSignupEpilogue(this, null, null, null, null, true); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_SUCCEEDED); ActivityLauncher.showLoginEpilogue(this, true, getIntent().getIntegerArrayListExtra(ARG_OLD_SITES_IDS)); } } } }
Source:
String toRawHeaderString() { if (!parameters.isEmpty()) { throw new UnsupportedOperationException("arbitrary parameters not supported"); } String autocryptHeaderString = AutocryptHeader.AUTOCRYPT_HEADER + ": "; autocryptHeaderString += AutocryptHeader.AUTOCRYPT_PARAM_ADDR + "=" + addr + ";"; if (isPreferEncryptMutual) { autocryptHeaderString += AutocryptHeader.AUTOCRYPT_PARAM_PREFER_ENCRYPT + "=" + AutocryptHeader.AUTOCRYPT_PREFER_ENCRYPT_MUTUAL + ";"; } autocryptHeaderString += AutocryptHeader.AUTOCRYPT_PARAM_KEY_DATA + "=" + ByteString.of(keyData).base64(); StringBuilder headerLines = new StringBuilder(); int autocryptHeaderLength = autocryptHeaderString.length(); for (int i = 0; i < autocryptHeaderLength; i += HEADER_LINE_LENGTH) { if (i + HEADER_LINE_LENGTH <= autocryptHeaderLength) { headerLines.append(autocryptHeaderString, i, i + HEADER_LINE_LENGTH).append("\n "); } else { headerLines.append(autocryptHeaderString, i, autocryptHeaderLength); } } return headerLines.toString(); }

Target:
String toRawHeaderString() { if (!parameters.isEmpty()) { throw new UnsupportedOperationException("arbitrary parameters not supported"); } StringBuilder builder = new StringBuilder(); builder.append(AutocryptHeader.AUTOCRYPT_HEADER).append(": "); builder.append(AutocryptHeader.AUTOCRYPT_PARAM_ADDR).append('=').append(addr).append("; "); if (isPreferEncryptMutual) { builder.append(AutocryptHeader.AUTOCRYPT_PARAM_PREFER_ENCRYPT) .append('=').append(AutocryptHeader.AUTOCRYPT_PREFER_ENCRYPT_MUTUAL).append("; "); } builder.append(AutocryptHeader.AUTOCRYPT_PARAM_KEY_DATA).append("="); appendBase64KeyData(builder); return builder.toString(); }
Source:
private Collection<Classifier> getClassifiers(ClassificationRequest request) { final List<Classifier> srcPortClassifiers = classifierPortList.get(request.getSrcPort()); final List<Classifier> dstPortClassifiers = classifierPortList.get(request.getDstPort()); if (srcPortClassifiers.isEmpty()) { return dstPortClassifiers; } if (dstPortClassifiers.isEmpty()) { return srcPortClassifiers; } if (Objects.equals(srcPortClassifiers, dstPortClassifiers)) { return dstPortClassifiers; } final Set<Classifier> classifiers = new HashSet<>(); classifiers.addAll(srcPortClassifiers); classifiers.addAll(dstPortClassifiers); final List<Classifier> sortedClassifiers = new ArrayList<>(classifiers); Collections.sort(sortedClassifiers); return sortedClassifiers; }

Target:
private Collection<Classifier> getClassifiers(ClassificationRequest request) { final List<Classifier> srcPortClassifiers = classifierPortList.get(request.getSrcPort()); final List<Classifier> dstPortClassifiers = classifierPortList.get(request.getDstPort()); if (srcPortClassifiers.isEmpty()) { return dstPortClassifiers; } if (dstPortClassifiers.isEmpty()) { return srcPortClassifiers; } if (Objects.equals(srcPortClassifiers, dstPortClassifiers)) { return dstPortClassifiers; } final List<Classifier> classifiers = new ArrayList<>(); classifiers.addAll(srcPortClassifiers); for (Classifier c : dstPortClassifiers) { if (!classifiers.contains(c)) { classifiers.add(c); } } Collections.sort(classifiers); return classifiers; }