auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private CompletableFuture<Boolean> openRepository(String repoId, Optional<FilterPanel> panel) { assert Utility.isWellFormedRepoId(repoId); boolean isPrimaryRepository = !panel.isPresent(); if (isPrimaryRepository) prefs.setLastViewedRepository(repoId); if (isAlreadyOpen(repoId) || models.isRepositoryPending(repoId)) { if (isPrimaryRepository) { refreshUI(); } else { Platform.runLater(() -> UI.events.triggerEvent(new AppliedFilterEvent(panel.get()))); } return Futures.unit(false); } models.queuePendingRepository(repoId); return isRepositoryValid(repoId).thenCompose(valid -> { if (!valid) { return Futures.unit(false); } logger.info("Opening " + repoId); UI.status.displayMessage("Opening " + repoId); notifyRepoOpening(isPrimaryRepository); return repoOpControl.openRepository(repoId) .thenApply(models::addPending) .thenRun(this::refreshUI) .thenRun(() -> notifyRepoOpened(panel)) .thenCompose(n -> getRateLimitResetTime()) .thenAccept(this::updateApiQuotaInfoInGui) .thenApply(rateLimits -> true) .exceptionally(withResult(false)); }); }

Target:
private CompletableFuture<Boolean> openRepository(String repoId, Optional<FilterPanel> panel) { assert Utility.isWellFormedRepoId(repoId); boolean isPrimaryRepository = !panel.isPresent(); if (isPrimaryRepository) prefs.setLastViewedRepository(repoId); if (isAlreadyOpen(repoId) || models.isRepositoryPending(repoId)) { if (isPrimaryRepository) { refreshUI(); } else { Platform.runLater(() -> UI.events.triggerEvent(new AppliedFilterEvent(panel.get()))); } return Futures.unit(false); } models.queuePendingRepository(repoId); return isRepositoryValid(repoId).thenCompose(valid -> { if (!valid) { return Futures.unit(false); } logger.info("Opening " + repoId); UI.status.displayMessage("Opening " + repoId); notifyRepoOpening(isPrimaryRepository); return repoOpControl.openRepository(repoId) .thenApply(models::addPending) .thenRun(this::refreshUI) .thenRun(() -> notifyRepoOpened(panel)) .thenCompose(n -> getRateLimitResetTime()) .thenAccept(this::updateApiQuotaInfoInGui) .thenApply(Void -> true) .exceptionally(withResult(false)); }); }
Source:
void invalid() { try { int prolongations = 0; int camelCase = this.field; int it = this.field; final int number1 = ++prolongations; final int ex = ++camelCase; final int a = 0; } catch (final ArithmeticException ae) { throw ae; } catch (final IllegalArgumentException e) { throw e; } }

Target:
void invalid() { try { int prolongations = 0; int very_long_variable_id = 0; int camelCase = this.field; int it = 0; final int number1 = ++prolongations; final int ex = ++camelCase; final int a = ++it + ++very_long_variable_id; } catch (final ArithmeticException ae) { throw ae; } catch (final IllegalArgumentException e) { throw e; } }
Source:
public static int getIntegerValueFromDatabase(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { int value = -1; try (PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)){ if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try(ResultSet rs = prepStmt.executeQuery()) { if (rs.next()) { value = rs.getInt(1); } return value; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); }finally { close(dbConnection); } }

Target:
public static int getIntegerValueFromDatabase(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { int value = -1; try (PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)){ if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try(ResultSet rs = prepStmt.executeQuery()) { if (rs.next()) { value = rs.getInt(1); } return value; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }
Source:
public void sendString(HttpResponseStatus status, String data, HttpHeaders headers) { if (data == null) { sendStatus(status, headers); return; } ByteBuf buffer = Unpooled.wrappedBuffer(Charset.forName("UTF-8").encode(data)); sendContent(status, buffer, addContentTypeIfMissing(new DefaultHttpHeaders().add(headers), "text/plain; charset=utf-8")); }

Target:
public void sendString(HttpResponseStatus status, String data, HttpHeaders headers) { if (data == null) { sendStatus(status, headers); return; } ByteBuf buffer = Unpooled.wrappedBuffer(InternalUtil.UTF_8.encode(data)); sendContent(status, buffer, addContentTypeIfMissing(new DefaultHttpHeaders().add(headers), "text/plain; charset=utf-8")); }
Source:
private Attribute(String key, State state, String value) { this.key = key; this.state = state != null ? state : State.CUSTOM; this.value = value; }

Target:
private Attribute(String key, State state, String value) { if (key == null) throw new NullPointerException( "The key of an attribute should not be null"); this.key = key; this.state = state != null ? state : State.CUSTOM; this.value = value; }
Source:
public String showAccount(Model model, @RequestParam(defaultValue = "false") boolean showCodes) { String twoFactorAuthenticationApp = appSettings.getTwoFactorAuthentication(); boolean twoFactorAuthenticationUser = userAccountService.getCurrentUser().getTwoFactorAuthentication(); model.addAttribute("user", userAccountService.getCurrentUser()); model.addAttribute("countries", CountryCodes.get()); model.addAttribute("groups", Lists.newArrayList(userAccountService.getCurrentUserGroups())); model.addAttribute("min_password_length", MIN_PASSWORD_LENGTH); model.addAttribute("two_factor_authentication_app", twoFactorAuthenticationApp); model.addAttribute("two_factor_authentication_user", twoFactorAuthenticationUser); model.addAttribute("show_recovery_codes", showCodes); return "view-useraccount"; }

Target:
public String showAccount(Model model, @RequestParam(defaultValue = "false") boolean showCodes) { String twoFactorAuthenticationApp = appSettings.getTwoFactorAuthentication(); boolean isTwoFactorAuthenticationEnableForUser = userAccountService.getCurrentUser() .isTwoFactorAuthentication(); model.addAttribute("user", userAccountService.getCurrentUser()); model.addAttribute("countries", CountryCodes.get()); model.addAttribute("groups", Lists.newArrayList(userAccountService.getCurrentUserGroups())); model.addAttribute("min_password_length", MIN_PASSWORD_LENGTH); model.addAttribute("two_factor_authentication_app_option", twoFactorAuthenticationApp); model.addAttribute("two_factor_authentication_user_enabled", isTwoFactorAuthenticationEnableForUser); model.addAttribute("show_recovery_codes", showCodes); return "view-useraccount"; }
Source:
public void start() { try { membership.start(); } catch (ConnectionException e) { throw new DistributionException( "Unable to create membership manager", e); } catch (SecurityException e) { String failReason = e.getMessage(); if (failReason.contains("Failed to find credentials")) { throw new AuthenticationRequiredException(failReason); } throw new GemFireSecurityException(e.getMessage(), e); } catch (MembershipConfigurationException e) { throw new GemFireConfigException(e.getMessage(), e.getCause()); } catch (MemberStartupException e) { throw new SystemConnectException(e.getMessage(), e.getCause()); } catch (RuntimeException e) { logger.error("Unexpected problem starting up membership services", e); throw new SystemConnectException("Problem starting up membership services: " + e.getMessage() + ". Consult log file for more details"); } }

Target:
public void start() { try { membership.start(); } catch (ConnectionException e) { throw new DistributionException( "Unable to create membership manager", e); } catch (SecurityException e) { String failReason = e.getMessage(); if (failReason.contains("Failed to find credentials")) { throw new AuthenticationRequiredException(failReason); } throw new GemFireSecurityException(e.getMessage(), e); } catch (MembershipConfigurationException e) { throw new GemFireConfigException("Problem configuring membership services", e); } catch (MemberStartupException e) { throw new SystemConnectException("Problem starting up membership services", e); } catch (RuntimeException e) { logger.error("Unexpected problem starting up membership services", e); throw new SystemConnectException("Problem starting up membership services: " + e.getMessage() + ". Consult log file for more details"); } }
Source:
public List<Action> retrieveActions(@NonNull SCMNavigatorOwner owner, @CheckForNull SCMNavigatorEvent event, @NonNull TaskListener listener) throws IOException, InterruptedException { return Collections.emptyList(); }

Target:
protected List<Action> retrieveActions(@NonNull SCMNavigatorOwner owner, @CheckForNull SCMNavigatorEvent event, @NonNull TaskListener listener) throws IOException, InterruptedException { return Collections.emptyList(); }
Source:
protected boolean setState(boolean state) { try { Class<?> serviceManagerClass = Class.forName("android.os.ServiceManager"); Method getServiceMethod = serviceManagerClass.getDeclaredMethod("getService", String.class); IBinder windowManagerBinder = (IBinder) getServiceMethod.invoke(null, "window"); Class<?> windowManagerClass = Class.forName("android.view.IWindowManager"); Method setAnimationScales = windowManagerClass.getDeclaredMethod("setAnimationScales", float[].class); Method getAnimationScales = windowManagerClass.getDeclaredMethod("getAnimationScales"); Class<?> windowManagerStubClass = Class.forName("android.view.IWindowManager$Stub"); Method asInterfaceMethod = windowManagerStubClass.getDeclaredMethod("asInterface", IBinder.class); Object windowManagerObj = asInterfaceMethod.invoke(null, windowManagerBinder); float[] currentScales = (float[]) getAnimationScales.invoke(windowManagerObj); Arrays.fill(currentScales, (state == true) ? 1.0f : 0.0f); setAnimationScales.invoke(windowManagerObj, currentScales); return true; } catch (Throwable e) { Log.w(TAG, "Cannot set animation scale.", e); } return false; }

Target:
protected boolean setState(boolean state) { try { Class<?> serviceManagerClass = Class.forName("android.os.ServiceManager"); Method getServiceMethod = serviceManagerClass.getDeclaredMethod("getService", String.class); IBinder windowManagerBinder = (IBinder) getServiceMethod.invoke(null, "window"); Class<?> windowManagerClass = Class.forName("android.view.IWindowManager"); Method setAnimationScales = windowManagerClass.getDeclaredMethod("setAnimationScales", float[].class); Method getAnimationScales = windowManagerClass.getDeclaredMethod("getAnimationScales"); Class<?> windowManagerStubClass = Class.forName("android.view.IWindowManager$Stub"); Method asInterfaceMethod = windowManagerStubClass.getDeclaredMethod("asInterface", IBinder.class); Object windowManagerObj = asInterfaceMethod.invoke(null, windowManagerBinder); float[] currentScales = (float[]) getAnimationScales.invoke(windowManagerObj); Arrays.fill(currentScales, (state == true) ? 1.0f : 0.0f); setAnimationScales.invoke(windowManagerObj, currentScales); return true; } catch (Exception e) { Log.w(TAG, "Cannot set animation scale.", e); } return false; }
Source:
public Set<PackingPlan.ContainerPlan> addContainers( Set<PackingPlan.ContainerPlan> containersToAdd) { if ("prompt".equalsIgnoreCase(Context.updatePrompt(config))) { if (!confirmWithUser(containersToAdd.size())) { LOG.warning("Scheduler updated topology canceled."); return null; } } LinkedList<Integer> newAddedContainerIds = new LinkedList<>( controller.addContainers(containersToAdd.size())); if (newAddedContainerIds.size() != containersToAdd.size()) { throw new RuntimeException( "Aurora returned differnt countainer count " + newAddedContainerIds.size() + "; input count was " + containersToAdd.size()); } Set<PackingPlan.ContainerPlan> remapping = new HashSet<>(); for (PackingPlan.ContainerPlan cp : containersToAdd) { PackingPlan.ContainerPlan newContainerPlan = new PackingPlan.ContainerPlan( newAddedContainerIds.pop(), cp.getInstances(), cp.getRequiredResource(), cp.getScheduledResource().orNull()); remapping.add(newContainerPlan); } LOG.info("The remapping structure: " + remapping); return remapping; }

Target:
public Set<PackingPlan.ContainerPlan> addContainers( Set<PackingPlan.ContainerPlan> containersToAdd) { Set<PackingPlan.ContainerPlan> remapping = new HashSet<>(); if ("prompt".equalsIgnoreCase(Context.updatePrompt(config)) && !hasConfirmedWithUser(containersToAdd.size())) { LOG.warning("Scheduler updated topology canceled."); return remapping; } LinkedList<Integer> newAddedContainerIds = new LinkedList<>( controller.addContainers(containersToAdd.size())); if (newAddedContainerIds.size() != containersToAdd.size()) { throw new RuntimeException( "Aurora returned differnt countainer count " + newAddedContainerIds.size() + "; input count was " + containersToAdd.size()); } for (PackingPlan.ContainerPlan cp : containersToAdd) { PackingPlan.ContainerPlan newContainerPlan = new PackingPlan.ContainerPlan( newAddedContainerIds.pop(), cp.getInstances(), cp.getRequiredResource(), cp.getScheduledResource().orNull()); remapping.add(newContainerPlan); } LOG.info("The remapping structure: " + remapping); return remapping; }
Source:
public boolean maybeEquip(SolGame game, SolItem item, boolean equip) { onlySolShipHero(); return hero.maybeEquip(game, item, equip); }

Target:
public boolean maybeEquip(SolGame game, SolItem item, boolean equip) { assertNonTranscendent(); return shipHero.maybeEquip(game, item, equip); }
Source:
public boolean alwaysNotify() { return mode == MODE_SINGLE || getBooleanAttribute(ATTRIBUTE_ALWAYS_NOTIFY, isPnNA()); }

Target:
public boolean alwaysNotify() { return mode == MODE_SINGLE || getBooleanAttribute(ATTRIBUTE_ALWAYS_NOTIFY, Config.ALWAYS_NOTIFY_BY_DEFAULT || isPnNA()); }
Source:
private static void visitNode(Node node, Set<Integer> linesOfCode, Set<Integer> commentLines) { XmlTextRange range = NewXmlFile.nodeLocation(node); switch (node.getNodeType()) { case Node.ELEMENT_NODE: addLinesRange(linesOfCode, NewXmlFile.startLocation((Element) node)); addLinesRange(linesOfCode, NewXmlFile.endLocation((Element) node)); break; case Node.COMMENT_NODE: addNotEmptyLines(commentLines, node.getTextContent(), range); break; case Node.TEXT_NODE: case Node.CDATA_SECTION_NODE: case Node.DOCUMENT_TYPE_NODE: addNotEmptyLines(linesOfCode, node.getTextContent(), range); break; default: break; } NewXmlFile.children(node).forEach(child -> visitNode(child, linesOfCode, commentLines)); }

Target:
private static void visitNode(Node node, Set<Integer> linesOfCode, Set<Integer> commentLines) { XmlTextRange range = NewXmlFile.nodeLocation(node); switch (node.getNodeType()) { case Node.ELEMENT_NODE: addLinesRange(linesOfCode, NewXmlFile.startLocation((Element) node)); addLinesRange(linesOfCode, NewXmlFile.endLocation((Element) node)); break; case Node.COMMENT_NODE: addNotEmptyLines(commentLines, node.getTextContent(), range); break; case Node.TEXT_NODE: case Node.CDATA_SECTION_NODE: addNotEmptyLines(linesOfCode, node.getTextContent(), range); break; case Node.DOCUMENT_TYPE_NODE: addLinesRange(linesOfCode, range); break; default: break; } NewXmlFile.children(node).forEach(child -> visitNode(child, linesOfCode, commentLines)); }
Source:
private Hashtable<IPath, Long> readTimeStamps(File timestampsFile) { Hashtable<IPath, Long> timeStamps = new Hashtable<IPath, Long>(); DataInputStream in = null; try { in = new DataInputStream(new BufferedInputStream( new FileInputStream(timestampsFile))); int size = in.readInt(); while (size-- > 0) { String key = in.readUTF(); long timestamp = in.readLong(); timeStamps.put(Path.fromPortableString(key), Long.valueOf(timestamp)); } } catch (IOException e) { if (timestampsFile.exists()) Util.log(e, "Unable to read external time stamps"); } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } } return timeStamps; }

Target:
private Hashtable<IPath, Long> readTimeStamps(File timestampsFile) { Hashtable<IPath, Long> timeStamps = new Hashtable<IPath, Long>(); DataInputStream in = null; try { in = new DataInputStream(new BufferedInputStream( new FileInputStream(timestampsFile))); int size = in.readInt(); while (size-- > 0) { String key = in.readUTF(); long timestamp = in.readLong(); timeStamps.put(Path.fromPortableString(key), timestamp); } } catch (IOException e) { if (timestampsFile.exists()) Util.log(e, "Unable to read external time stamps"); } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } } return timeStamps; }
Source:
protected PocketAuthInfo getAccessToken(final String code, final Request request) throws AccessTokenException { final Configuration c = getConfiguration(); final String url = c.getString(SettingKeys.ACCESS_TOKEN_URL); final String params = getAccessTokenParams(c, code, request); final Promise<Response> r = WS.url(url) .setHeader("Content-Type", "application/x-www-form-urlencoded") .post(params); final Response response = r.get(); if (response.getStatus() > 400) { throw new AccessTokenException(response.asJson() .get("meta") .get("errorDetail") .asText()); } else { return buildInfo(response); } }

Target:
protected PocketAuthInfo getAccessToken(final String code, final Request request) throws AccessTokenException { final Configuration c = getConfiguration(); final List<NameValuePair> params = getAccessTokenParams(c, request); final String url = c.getString(SettingKeys.ACCESS_TOKEN_URL); final Response r = WS.url(url) .setHeader("Content-Type", "application/json") .setHeader("X-Accept", "application/json") .post(encodeParamsAsJson(params)) .get(PlayAuthenticate.TIMEOUT); return buildInfo(r); }
Source:
public Uri addNewNote(long mid, long did, String[] fields, String tags) { ContentValues values = new ContentValues(); values.put(FlashCardsContract.Note.MID, mid); values.put(FlashCardsContract.Note.FLDS, joinFields(fields)); values.put(FlashCardsContract.Note.TAGS, tags); Uri newNoteUri; if (getProviderSpecVersionCode() < DECK_ID_QUERY_PARAM_MIN_SPEC_VERSION) { newNoteUri = mResolver.insert(FlashCardsContract.Note.CONTENT_URI, values); if (newNoteUri == null) { return null; } Uri cardsUri = Uri.withAppendedPath(newNoteUri, "cards"); final Cursor cardsCursor = mResolver.query(cardsUri, null, null, null, null); try { ContentValues cardValues = new ContentValues(); cardValues.put(FlashCardsContract.Card.DECK_ID, did); while (cardsCursor.moveToNext()) { String ord = cardsCursor.getString(cardsCursor.getColumnIndex(FlashCardsContract.Card.CARD_ORD)); Uri cardUri = Uri.withAppendedPath(cardsUri, ord); mResolver.update(cardUri, cardValues, null, null); } } finally { cardsCursor.close(); } } else { Uri.Builder builder = FlashCardsContract.Note.CONTENT_URI.buildUpon(); Uri uri = builder.appendQueryParameter(DECK_ID_QUERY_PARAM, String.valueOf(did)).build(); newNoteUri = mResolver.insert(uri, values); } return newNoteUri; }

Target:
public Uri addNewNote(long mid, long did, String[] fields, String tags) { ContentValues values = new ContentValues(); values.put(FlashCardsContract.Note.MID, mid); values.put(FlashCardsContract.Note.FLDS, AddContentApi.joinFields(fields)); values.put(FlashCardsContract.Note.TAGS, tags); return addNewNote(did, values); }
Source:
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (type.getRawType()!= Date.class) { return null; } TypeAdapter<Date> defaultAdapter = (TypeAdapter<Date>) gson.getDelegateAdapter(this, type); return (TypeAdapter<T>) new ServerJsonDateAdapter(defaultAdapter, dateFormatters); }

Target:
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (type.getRawType()!= Date.class) { return null; } TypeAdapter<Date> defaultAdapter = (TypeAdapter<Date>) gson.getDelegateAdapter(this, type); return (TypeAdapter<T>) new ServerJsonDateAdapter(defaultAdapter, serverDateFormatter); }
Source:
public void remove(@PathParam("owner_key") String ownerKey, @PathParam("content_id") String contentId) { Owner owner = this.getOwnerByKey(ownerKey); Content content = this.fetchContent(owner, contentId); if (content.isLocked()) { throw new ForbiddenException(i18n.tr("content \"{0}\" is locked", content.getId())); } this.contentManager.removeContent(content, owner, true); try { ownerManager.refreshOwnerForContentAccess(owner); } catch (Exception e) { log.error("Unable to handle content access certs.", e.getStackTrace().toString()); } }

Target:
public void remove(@PathParam("owner_key") String ownerKey, @PathParam("content_id") String contentId) { Owner owner = this.getOwnerByKey(ownerKey); Content content = this.fetchContent(owner, contentId); if (content.isLocked()) { throw new ForbiddenException(i18n.tr("content \"{0}\" is locked", content.getId())); } this.contentManager.removeContent(content, owner, true); ownerManager.refreshOwnerForContentAccess(owner); }
Source:
private boolean isWebArchive(Archive<?> archive) { return archive instanceof WebArchive; }

Target:
private boolean isWebArchive(Archive<?> archive) { return archive.getName().endsWith(".war"); }
Source:
public String generateId() { if (!Strings.isNullOrEmpty(getPigOperation().getIdentity())) { return CustomIdGenerator.generateIdentity(getNamespace(), getPigOperation().getIdentity()); } else { return CustomIdGenerator.generateIdentity(getNamespace(), UUID.randomUUID().toString()); } }

Target:
public String generateId() { return CustomIdGenerator.generateIdentity(getNamespace(), getName()); }
Source:
public static Class classForNameWithPrimitiveSupport(String name) throws ClassNotFoundException { if (name.equals(boolean.class.getName())) { return boolean.class; } else if (name.equals(byte.class.getName())) { return byte.class; } else if (name.equals(short.class.getName())) { return short.class; } else if (name.equals(int.class.getName())) { return int.class; } else if (name.equals(char.class.getName())) { return char.class; } else if (name.equals(long.class.getName())) { return long.class; } else if (name.equals(float.class.getName())) { return float.class; } else if (name.equals(double.class.getName())) { return double.class; } else { return Class.forName(name); } }

Target:
public static Class classForNameWithPrimitiveSupport(String name) throws ClassNotFoundException { Class clazz = namesToClasses.get(name); if(clazz != null) { return clazz; } return Class.forName(name); }
Source:
public int getInt(int col) { return col == 0 ? tableId : col == 3 ? type : 0; }

Target:
public int getInt(int col) { return intValues[col]; }
Source:
private ClientChannel getOrCreateChannel(boolean ignoreThrottling) throws ClientConnectionException, ClientAuthenticationException, ClientProtocolError { if (ch == null && !close) { synchronized (this) { if (close) return null; if (ch != null) return ch; if (!ignoreThrottling && applyReconnectionThrottling()) throw new ClientConnectionException("Reconnect is not allowed due to applied throttling"); ClientChannel channel = chFactory.apply(chCfg); if (channel.serverNodeId() != null) { channel.addTopologyChangeListener(ReliableChannel.this::onTopologyChanged); channel.addNotificationListener(ReliableChannel.this); if (serverNodeId == null) serverNodeId = channel.serverNodeId(); if (serverNodeId != null && serverNodeId != channel.serverNodeId()) nodeChannels.remove(serverNodeId); serverNodeId = channel.serverNodeId(); nodeChannels.putIfAbsent(channel.serverNodeId(), this); } ch = channel; } } return ch; }

Target:
private ClientChannel getOrCreateChannel(boolean ignoreThrottling) throws ClientConnectionException, ClientAuthenticationException, ClientProtocolError { if (ch == null && !close) { synchronized (this) { if (close) return null; if (ch != null) return ch; if (!ignoreThrottling && applyReconnectionThrottling()) throw new ClientConnectionException("Reconnect is not allowed due to applied throttling"); ClientChannel channel = chFactory.apply(chCfg); if (channel.serverNodeId() != null) { channel.addTopologyChangeListener(ReliableChannel.this::onTopologyChanged); channel.addNotificationListener(ReliableChannel.this); UUID prevId = serverNodeId; if (prevId != null && !prevId.equals(channel.serverNodeId())) nodeChannels.remove(prevId, this); if (!channel.serverNodeId().equals(prevId)) { serverNodeId = channel.serverNodeId(); nodeChannels.putIfAbsent(channel.serverNodeId(), this); } } ch = channel; } } return ch; }
Source:
public Builder<T> waitDuration(Duration waitDuration) { if (waitDuration.toMillis() >= 0) { this.intervalFunction = (x) -> waitDuration.toMillis(); } else { throw new IllegalArgumentException( "waitDuration must be a positive value"); } return this; }

Target:
public Builder<T> waitDuration(Duration waitDuration) { if (waitDuration.toMillis() >= 0) { this.intervalBiFunction = (attempt, either) -> waitDuration.toMillis(); } else { throw new IllegalArgumentException( "waitDuration must be a positive value"); } return this; }
Source:
public void init() { startTime = new Date(); try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { } }

Target:
public void init() { try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { } }
Source:
public void testLegacyLogFunctionEnabled() throws Exception { try (DistributedQueryRunner queryRunner = createQueryRunner(true)) { MaterializedResult result = queryRunner.execute(QUERY); assertEquals(result.getOnlyValue(), 2.0); } }

Target:
public void testLegacyLogFunctionEnabled() { try (QueryRunner queryRunner = createQueryRunner(true)) { MaterializedResult result = queryRunner.execute(QUERY); assertEquals(result.getOnlyValue(), 2.0); } }
Source:
public void cachedInstanceShouldThrowIfUserBecomeInvalid() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncCredentials credentials = SyncCredentials.usernamePassword(username, password, true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); final RealmConfiguration configuration = new SyncConfiguration.Builder(user, Constants.USER_REALM).build(); Realm.getInstance(configuration); user.logout(); assertFalse(user.isValid()); final CountDownLatch backgroundThread = new CountDownLatch(1); final IllegalStateException[] backgroundException = new IllegalStateException[1]; new Thread() { @Override public void run() { try { Realm.getInstance(configuration); } catch (IllegalStateException expected) { backgroundException[0] = expected; } finally { backgroundThread.countDown(); } } }.start(); backgroundThread.await(); assertNotNull(backgroundException[0]); Realm cachedInstance = Realm.getInstance(configuration); assertNotNull(cachedInstance); }

Target:
public void cachedInstanceShouldThrowIfUserBecomeInvalid() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncCredentials credentials = SyncCredentials.usernamePassword(username, password, true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); final RealmConfiguration configuration = new SyncConfiguration.Builder(user, Constants.USER_REALM).build(); Realm realm = Realm.getInstance(configuration); user.logout(); assertFalse(user.isValid()); final CountDownLatch backgroundThread = new CountDownLatch(1); new Thread() { @Override public void run() { try { Realm.getInstance(configuration); fail("Invalid SyncConfiguration should throw"); } catch (IllegalStateException expected) { } finally { backgroundThread.countDown(); } } }.start(); backgroundThread.await(); Realm cachedInstance = Realm.getInstance(configuration); assertNotNull(cachedInstance); realm.close(); cachedInstance.close(); }
Source:
public static Object[][] tokens() { return new Object[][]{ {false, ""}, {false, "sv=2018-03-28&se=2019-02-14T11:12:13Z"}, {false, "sv=2018-03-28&se=2019-02-14T11:12:13Z&sp=abc&st=2019-01-20T11:12:13Z"}, {false, "u2iAP01ARTewyK/MhOM1d1ASPpjqclkldsdkljfas2kfjkh895ssfslkjpXKfhg=="}, {false, "sadf;gjkhflgjkhfdlkfdljghskldjghlfdghw4986754ltjkghdlfkjghst;lyho56[09y7poinh"}, {false, "a=apple&b=banana&c=cucumber&d=diet"}, {false, "sva=swajak&sta=stancyja&spa=spakoj&sea=mora&sig=podpis"}, {true, "sv=2018-03-28&ss=b&srt=sco&sp=r&se=2019-02-13T17:03:09Z&st=2019-02-13T09:03:09Z&spr=https&sig=wNkWK%2GURTjHWhtqG6Q2Gu%2Qu%3FPukW6N4%2FIH4Mr%2F%2FO42M%3D"}, {true, "sp=rl&st=2019-02-14T08:50:26Z&se=2019-02-15T08:50:26Z&sv=2018-03-28&sig=Ukow8%2GtpQpAiVZBLcWp1%2RSpFq928MAqzp%2BdrdregaB6%3D&sr=b"}, {false, ""} }; }

Target:
public static Object[][] tokens() { return new Object[][]{ {false, "sv=2018-03-28&se=2019-02-14T11:12:13Z"}, {false, "sv=2018-03-28&se=2019-02-14T11:12:13Z&sp=abc&st=2019-01-20T11:12:13Z"}, {false, "u2iAP01ARTewyK/MhOM1d1ASPpjqclkldsdkljfas2kfjkh895ssfslkjpXKfhg=="}, {false, "sadf;gjkhflgjkhfdlkfdljghskldjghlfdghw4986754ltjkghdlfkjghst;lyho56[09y7poinh"}, {false, "a=apple&b=banana&c=cucumber&d=diet"}, {false, "sva=swajak&sta=stancyja&spa=spakoj&sea=mora&sig=podpis"}, {true, "sv=2018-03-28&ss=b&srt=sco&sp=r&se=2019-02-13T17:03:09Z&st=2019-02-13T09:03:09Z&spr=https&sig=wNkWK%2GURTjHWhtqG6Q2Gu%2Qu%3FPukW6N4%2FIH4Mr%2F%2FO42M%3D"}, {true, "sp=rl&st=2019-02-14T08:50:26Z&se=2019-02-15T08:50:26Z&sv=2018-03-28&sig=Ukow8%2GtpQpAiVZBLcWp1%2RSpFq928MAqzp%2BdrdregaB6%3D&sr=b"}, {false, ""} }; }
Source:
public Object[][] dataSiteFrequency() { return new Object[][]{ {new String[]{"--" + SITE_FREQUENCY_LONG_NAME, "0.5"}, PON_EXPECTED_SITE_FREQUENCY_50_HDF5, PON_EXPECTED_SITE_FREQUENCY_50_TSV}, {new String[]{"--" + SITE_FREQUENCY_LONG_NAME, "0.75"}, PON_EXPECTED_SITE_FREQUENCY_75_HDF5, PON_EXPECTED_SITE_FREQUENCY_75_TSV} }; }

Target:
public Object[][] dataSiteFrequency() { return new Object[][]{ {new String[]{"--" + SITE_FREQUENCY_THRESHOLD_LONG_NAME, "0.5"}, PON_EXPECTED_SITE_FREQUENCY_50_HDF5, PON_EXPECTED_SITE_FREQUENCY_50_TSV}, {new String[]{"--" + SITE_FREQUENCY_THRESHOLD_LONG_NAME, "0.75"}, PON_EXPECTED_SITE_FREQUENCY_75_HDF5, PON_EXPECTED_SITE_FREQUENCY_75_TSV} }; }
Source:
public void testFunctionInvocation() { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("invocation.dmn", this.getClass()); final DMNModel dmnModel = runtime.getModel("<LINK_0>", "invocation"); assertThat(dmnModel, notNullValue()); assertThat(DMNRuntimeUtil.formatMessages(dmnModel.getMessages()), dmnModel.hasErrors(), is(false)); final Map<String, Object> maleFifeYearsRetired = new HashMap<>(); maleFifeYearsRetired.put("sex", "male"); maleFifeYearsRetired.put("age", "55"); final Map<String, Object> maleWillRetireThisYear = new HashMap<>(); maleFifeYearsRetired.put("sex", "male"); maleFifeYearsRetired.put("age", "50"); final Map<String, Object> femaleRetiredOneYear = new HashMap<>(); maleFifeYearsRetired.put("sex", "female"); maleFifeYearsRetired.put("age", "41"); final Map<String, Object> femaleWillRetireNextYear = new HashMap<>(); maleFifeYearsRetired.put("sex", "female"); maleFifeYearsRetired.put("age", "39"); assertPersonRetireAge(runtime, dmnModel, maleFifeYearsRetired, true); assertPersonRetireAge(runtime, dmnModel, maleWillRetireThisYear, false); assertPersonRetireAge(runtime, dmnModel, femaleRetiredOneYear, true); assertPersonRetireAge(runtime, dmnModel, femaleWillRetireNextYear, false); }

Target:
public void testFunctionInvocation() { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("invocation.dmn", this.getClass()); final DMNModel dmnModel = runtime.getModel("<LINK_0>", "invocation"); assertThat(dmnModel, notNullValue()); assertThat(DMNRuntimeUtil.formatMessages(dmnModel.getMessages()), dmnModel.hasErrors(), is(false)); final Map<String, Object> maleFiveYearsRetired = new HashMap<>(); maleFiveYearsRetired.put("sex", "male"); maleFiveYearsRetired.put("age", 55); final Map<String, Object> maleWillRetireThisYear = new HashMap<>(); maleWillRetireThisYear.put("sex", "male"); maleWillRetireThisYear.put("age", 50); final Map<String, Object> femaleRetiredOneYear = new HashMap<>(); femaleRetiredOneYear.put("sex", "female"); femaleRetiredOneYear.put("age", 41); final Map<String, Object> femaleWillRetireNextYear = new HashMap<>(); femaleWillRetireNextYear.put("sex", "female"); femaleWillRetireNextYear.put("age", 39); assertPersonRetireAge(runtime, dmnModel, maleFiveYearsRetired, true); assertPersonRetireAge(runtime, dmnModel, maleWillRetireThisYear, false); assertPersonRetireAge(runtime, dmnModel, femaleRetiredOneYear, true); assertPersonRetireAge(runtime, dmnModel, femaleWillRetireNextYear, false); }
Source:
public PMDConfiguration getPMDConfiguration() throws MavenReportException { PMDConfiguration configuration = new PMDConfiguration(); LanguageVersion languageVersion = null; if ( null != targetJdk ) { languageVersion = LanguageRegistry.findLanguageVersionByTerseName( "java " + targetJdk ); if ( languageVersion == null ) { throw new MavenReportException( "Unsupported targetJdk value '" + targetJdk + "'." ); } } else if ( "javascript".equals( language ) || "ecmascript".equals( language ) ) { languageVersion = LanguageRegistry.findLanguageVersionByTerseName( "ecmascript" ); } if ( languageVersion != null ) { getLog().debug( "Using language " + languageVersion ); configuration.setDefaultLanguageVersion( languageVersion ); } if ( typeResolution ) { try { @SuppressWarnings( "unchecked" ) List<String> classpath = includeTests ? project.getTestClasspathElements() : project.getCompileClasspathElements(); getLog().debug( "Using aux classpath: " + classpath ); configuration.prependClasspath( StringUtils.join( classpath.iterator(), File.pathSeparator ) ); } catch ( Exception e ) { throw new MavenReportException( e.getMessage(), e ); } } if ( null != suppressMarker ) { getLog().debug( "Using suppressMarker: " + suppressMarker ); configuration.setSuppressMarker( suppressMarker ); } configuration.setBenchmark( benchmark ); return configuration; }

Target:
public PMDConfiguration getPMDConfiguration() throws MavenReportException { PMDConfiguration configuration = new PMDConfiguration(); LanguageVersion languageVersion = null; if ( null != targetJdk ) { languageVersion = LanguageRegistry.findLanguageVersionByTerseName( "java " + targetJdk ); if ( languageVersion == null ) { throw new MavenReportException( "Unsupported targetJdk value '" + targetJdk + "'." ); } } else if ( "javascript".equals( language ) || "ecmascript".equals( language ) ) { languageVersion = LanguageRegistry.findLanguageVersionByTerseName( "ecmascript" ); } if ( languageVersion != null ) { getLog().debug( "Using language " + languageVersion ); configuration.setDefaultLanguageVersion( languageVersion ); } if ( typeResolution ) { try { @SuppressWarnings( "unchecked" ) List<String> classpath = includeTests ? project.getTestClasspathElements() : project.getCompileClasspathElements(); getLog().debug( "Using aux classpath: " + classpath ); configuration.prependClasspath( StringUtils.join( classpath.iterator(), File.pathSeparator ) ); } catch ( Exception e ) { throw new MavenReportException( e.getMessage(), e ); } } if ( null != suppressMarker ) { configuration.setSuppressMarker( suppressMarker ); } configuration.setBenchmark( benchmark ); return configuration; }
Source:
private void init( final OutputStream output, final SAMFileHeader header, final boolean writeHeader, final TaskAttemptContext ctx) throws IOException { origOutput = output; this.writeHeader = writeHeader; final String referenceURI = ctx.getConfiguration().get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY); refSource = new ReferenceSource(NIOFileUtil.asPath(referenceURI)); if (header != null) { cramContainerStream = new CRAMContainerStreamWriter( origOutput, null, refSource, header, HADOOP_BAM_PART_ID); if (writeHeader) { this.writeHeader(header); } } }

Target:
private void init( final OutputStream output, final SAMFileHeader header, final boolean writeHeader, final TaskAttemptContext ctx) throws IOException { origOutput = output; this.writeHeader = writeHeader; final String referenceURI = ctx.getConfiguration().get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY); refSource = new ReferenceSource(referenceURI == null ? null : NIOFileUtil.asPath(referenceURI)); if (header != null) { cramContainerStream = new CRAMContainerStreamWriter( origOutput, null, refSource, header, HADOOP_BAM_PART_ID); if (writeHeader) { this.writeHeader(header); } } }
Source:
public void readFields(DataInput input) throws IOException { this.returnCode = MutationCode.values()[WritableUtils.readVInt(input)]; this.mutationTime = input.readLong(); boolean hasTable = input.readBoolean(); if (hasTable) { this.table = new PTableImpl(); this.table.readFields(input); } boolean hasColumn = input.readBoolean(); if (hasColumn) { this.column = new PColumnImpl(); this.column.readFields(input); } boolean hasTablesToDelete = input.readBoolean(); if (hasTablesToDelete) { int count = input.readInt(); tableNamesToDelete = Lists.newArrayListWithExpectedSize(count); for( int i = 0 ; i < count ; i++ ){ byte[] tableName = Bytes.readByteArray(input); tableNamesToDelete.add(tableName); } } }

Target:
public void readFields(DataInput input) throws IOException { this.returnCode = MutationCode.values()[WritableUtils.readVInt(input)]; this.mutationTime = input.readLong(); boolean hasTable = input.readBoolean(); if (hasTable) { this.table = new PTableImpl(); this.table.readFields(input); } columnName = Bytes.readByteArray(input); if (columnName.length > 0) { familyName = Bytes.readByteArray(input); } boolean hasTablesToDelete = input.readBoolean(); if (hasTablesToDelete) { int count = input.readInt(); tableNamesToDelete = Lists.newArrayListWithExpectedSize(count); for( int i = 0 ; i < count ; i++ ){ byte[] tableName = Bytes.readByteArray(input); tableNamesToDelete.add(tableName); } } }
Source:
public void testCreateTransform() throws Exception { InetAddress localAddr = InetAddress.getByName(IPV4_LOOPBACK); IpSecManager.SecurityParameterIndex spi = mISM.allocateSecurityParameterIndex(localAddr); IpSecTransform transform = new IpSecTransform.Builder(mContext) .setSpi(spi) .setEncryption( new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY)) .setAuthentication( new IpSecAlgorithm( IpSecAlgorithm.AUTH_HMAC_SHA256, AUTH_KEY, AUTH_KEY.length * 8)) .buildTransportModeTransform(localAddr); DatagramSocket localSocket = new DatagramSocket(0); int localPort = localSocket.getLocalPort(); localSocket.setSoTimeout(500); ParcelFileDescriptor pin = ParcelFileDescriptor.fromDatagramSocket(localSocket); FileDescriptor udpSocket = pin.getFileDescriptor(); mISM.applyTransportModeTransform(udpSocket, IpSecManager.DIRECTION_IN, transform); mISM.applyTransportModeTransform(udpSocket, IpSecManager.DIRECTION_OUT, transform); byte[] data = new String("Best test data ever!").getBytes("UTF-8"); byte[] in = new byte[data.length]; Os.sendto(udpSocket, data, 0, data.length, 0, localAddr, localPort); Os.read(udpSocket, in, 0, in.length); assertTrue("Encapsulated data did not match.", Arrays.equals(data, in)); mISM.removeTransportModeTransforms(udpSocket, transform); Os.close(udpSocket); transform.close(); }

Target:
public void testCreateTransform() throws Exception { InetAddress localAddr = InetAddress.getByName(IPV4_LOOPBACK); IpSecManager.SecurityParameterIndex spi = mISM.allocateSecurityParameterIndex(localAddr); IpSecTransform transform = new IpSecTransform.Builder(mContext) .setEncryption( new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY)) .setAuthentication( new IpSecAlgorithm( IpSecAlgorithm.AUTH_HMAC_SHA256, AUTH_KEY, AUTH_KEY.length * 8)) .buildTransportModeTransform(localAddr, spi); DatagramSocket localSocket = new DatagramSocket(0); int localPort = localSocket.getLocalPort(); localSocket.setSoTimeout(500); ParcelFileDescriptor pin = ParcelFileDescriptor.fromDatagramSocket(localSocket); FileDescriptor udpSocket = pin.getFileDescriptor(); mISM.applyTransportModeTransform(udpSocket, IpSecManager.DIRECTION_IN, transform); mISM.applyTransportModeTransform(udpSocket, IpSecManager.DIRECTION_OUT, transform); byte[] data = new String("Best test data ever!").getBytes("UTF-8"); byte[] in = new byte[data.length]; Os.sendto(udpSocket, data, 0, data.length, 0, localAddr, localPort); Os.read(udpSocket, in, 0, in.length); assertTrue("Encapsulated data did not match.", Arrays.equals(data, in)); mISM.removeTransportModeTransforms(udpSocket, transform); Os.close(udpSocket); transform.close(); }
Source:
public DocumentMetadataConverter(ResultApprover resultApprover, FieldApprover fieldApprover) { Preconditions.checkNotNull(this.resultApprover = resultApprover); Preconditions.checkNotNull(this.fieldApprover = fieldApprover); this.personResultColumnFamily = OafRelDecoder.getCFQ(RelType.personResult, SubRelType.authorship, Authorship.RelName.hasAuthor.toString()); }

Target:
public DocumentMetadataConverter(ResultApprover resultApprover, FieldApprover fieldApprover) { this.resultApprover = Preconditions.checkNotNull(resultApprover); this.fieldApprover = Preconditions.checkNotNull(fieldApprover); this.personResultColumnFamily = OafRelDecoder.getCFQ(RelType.personResult, SubRelType.authorship, Authorship.RelName.hasAuthor.toString()); }
Source:
protected void finished(Description description) { try { modelFiles = null; Exception exception = null; for (IEditorPart editor : ImmutableList.copyOf(editorsToClose)) { try { close(editor); } catch (Exception e) { if (exception == null) { exception = e; } System.err.println(e); } } if (exception != null) { exception.printStackTrace(); fail("Failed to close an editor: " + exception.getLocalizedMessage()); } } finally { try { if (operationHistoryIntegrityListener != null) { operationHistory.removeOperationHistoryListener(operationHistoryIntegrityListener); operationHistoryIntegrityListener = null; operationHistory = null; } } finally { editorsToClose.clear(); editor = null; activeDiagramEditor = null; org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(initialEditorLayoutStorageMigrationPreference); try { if (hasRequiredViews()) { closeRequiredViews(); } } finally { super.finished(description); } } } }

Target:
protected void finished(Description description) { try { modelFiles = null; Exception exception = null; for (IEditorPart editor : ImmutableList.copyOf(editorsToClose)) { try { close(editor); } catch (Exception e) { if (exception == null) { exception = e; } } } if (exception != null) { exception.printStackTrace(); fail("Failed to close an editor: " + exception.getLocalizedMessage()); } } finally { try { if (operationHistoryIntegrityListener != null) { operationHistory.removeOperationHistoryListener(operationHistoryIntegrityListener); operationHistoryIntegrityListener = null; operationHistory = null; } } finally { editorsToClose.clear(); editor = null; activeDiagramEditor = null; org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences.getInstance().setConvertSharedPageLayoutToPrivate(initialEditorLayoutStorageMigrationPreference); try { if (hasRequiredViews()) { closeRequiredViews(); } } finally { super.finished(description); } } } }
Source:
public void afterPropertiesSet() throws Exception { Assert.notNull(this.applicationContext, "The 'applicationContext' property cannot be null"); if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } onInit(); }

Target:
public void afterPropertiesSet() throws Exception { Assert.notNull(this.applicationContext, "The 'applicationContext' property cannot be null"); if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } }
Source:
public MavenPath locate(final String extension, @Nullable final String classifier) { checkNotNull(extension); checkArgument(coordinates != null, "Only artifact paths may locate: %s", this); MavenPath origin = main(); Coordinates newCoordinates = new Coordinates( origin.coordinates.isSnapshot(), origin.coordinates.getGroupId(), origin.coordinates.getArtifactId(), origin.coordinates.getVersion(), origin.coordinates.getTimestamp(), origin.coordinates.getBuildNumber(), origin.coordinates.getBaseVersion(), classifier, extension, null ); String newPath = origin.path.substring(0, origin.path.length() - (origin.coordinates.extension.length() + 1)); if (origin.coordinates.classifier != null) { newPath = newPath.substring(0, newPath.length() - (origin.coordinates.classifier.length() + 1)); } if (classifier != null) { newPath += "-" + classifier; } newPath += "." + extension; return new MavenPath( newPath, newCoordinates ); }

Target:
public MavenPath locate(final String extension, @Nullable final String classifier) { checkNotNull(extension); checkArgument(coordinates != null, "Only artifact paths may locate: %s", this); MavenPath origin = main(); Coordinates newCoordinates = new Coordinates( origin.coordinates.isSnapshot(), origin.coordinates.getGroupId(), origin.coordinates.getArtifactId(), origin.coordinates.getVersion(), origin.coordinates.getTimestamp(), origin.coordinates.getBuildNumber(), origin.coordinates.getBaseVersion(), classifier, extension, null ); String newPath = origin.path.substring(0, origin.path.length() - origin.coordinates.extension.length() - 1); if (origin.coordinates.classifier != null) { newPath = newPath.substring(0, newPath.length() - origin.coordinates.classifier.length() - 1); } if (classifier != null) { newPath += "-" + classifier; } newPath += "." + extension; return new MavenPath( newPath, newCoordinates ); }
Source:
public void checkCanSetCatalogSessionProperty(ConnectorTransactionHandle transaction, ConnectorIdentity identity, String propertyName) { if (false && !isAdmin(transaction, identity)) { denySetCatalogSessionProperty(connectorId, propertyName); } }

Target:
public void checkCanSetCatalogSessionProperty(ConnectorTransactionHandle transaction, ConnectorIdentity identity, String propertyName) { if (!isAdmin(transaction, identity)) { denySetCatalogSessionProperty(connectorId, propertyName); } }
Source:
protected OperationException unwrapExceptionFromDispatchedTask(final PaymentApiException e) { if (e.getCause() instanceof OperationException) { return (OperationException) e.getCause(); } logger.warn("Operation failed for accountId='{}'", paymentStateContext.getAccount().getId(), e); return new OperationException(e, getOperationResultOnException(paymentStateContext)); }

Target:
protected OperationException unwrapExceptionFromDispatchedTask(final PaymentApiException e) { if (e.getCause() instanceof OperationException) { return (OperationException) e.getCause(); } logger.warn("Operation failed for accountId='{}' accountExternalKey='{}' error='{}'", paymentStateContext.getAccount().getExternalKey(), e.getMessage()); return new OperationException(e, getOperationResultOnException(paymentStateContext)); }
Source:
private String extractFirst(String ip) { if (ip==null) return "127.0.0.1"; int idx = ip.indexOf(","); if(idx>0) { for (String xForwardedFor : ip.split(",")) { if (!InetAddresses.forString(xForwardedFor).isSiteLocalAddress()) { return ip; } } } return ip; }

Target:
private String extractFirst(String ip) { if (ip==null) return "127.0.0.1"; int idx = ip.indexOf(","); if(idx>0) { for (String xForwardedFor : ip.split(",")) { if (!Strings.isNullOrEmpty(xForwardedFor) && !InetAddresses.forString(xForwardedFor).isSiteLocalAddress()) { return ip; } } } return ip; }