auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void init () { super.init(); entitySelectBox = new VisSelectBox<>(); entitySelectBox.getSelection().setProgrammaticChangeEvents(false); entitySelectBox.addListener(properties.getSharedSelectBoxChangeListener()); animSelectBox = new VisSelectBox<>(); animSelectBox.getSelection().setProgrammaticChangeEvents(false); animSelectBox.addListener(properties.getSharedSelectBoxChangeListener()); VisTable table = new VisTable(true); table.add(new VisLabel("Entity")); table.add(entitySelectBox); table.add(new VisLabel("Animation")); table.add(animSelectBox); add(table); }

Target:
protected void init () { super.init(); entitySelectBox = new VisSelectBox<>(); entitySelectBox.getSelection().setProgrammaticChangeEvents(false); entitySelectBox.addListener(properties.getSharedSelectBoxChangeListener()); animSelectBox = new VisSelectBox<>(); animSelectBox.getSelection().setProgrammaticChangeEvents(false); animSelectBox.addListener(properties.getSharedSelectBoxChangeListener()); VisTable table = new VisTable(true); table.add(new VisLabel("Entity")); table.add(entitySelectBox); table.row(); table.add(new VisLabel("Animation")); table.add(animSelectBox); add(table); }
Source:
public void basicTest() throws InterruptedException, IOException, StoreException { time.sleep(1 * Time.MsPerSec - 1); MockId addedId = put(1, PUT_RECORD_SIZE, time.milliseconds()).get(0); time.sleep(1 * Time.MsPerSec); liveKeys.remove(addedId); expiredKeys.add(addedId); StoreInfo storeInfo = store.get(new ArrayList<>(liveKeys), EnumSet.noneOf(StoreGetOptions.class)); checkStoreInfo(storeInfo, liveKeys); MockMessageStoreHardDelete hd = (MockMessageStoreHardDelete) hardDelete; for (MockId id : deletedKeys) { hd.setMessageInfo(allKeys.get(id).getFirst()); verifyGetFailure(id, StoreErrorCodes.ID_Deleted); storeInfo = store.get(Collections.singletonList(id), EnumSet.of(StoreGetOptions.Store_Include_Deleted)); checkStoreInfo(storeInfo, Collections.singleton(id)); storeInfo = store.get(Collections.singletonList(id), EnumSet.allOf(StoreGetOptions.class)); checkStoreInfo(storeInfo, Collections.singleton(id)); } for (MockId id : expiredKeys) { verifyGetFailure(id, StoreErrorCodes.TTL_Expired); storeInfo = store.get(Collections.singletonList(id), EnumSet.of(StoreGetOptions.Store_Include_Expired)); checkStoreInfo(storeInfo, Collections.singleton(id)); storeInfo = store.get(Collections.singletonList(id), EnumSet.allOf(StoreGetOptions.class)); checkStoreInfo(storeInfo, Collections.singleton(id)); } delete(addedId); verifyGetFailure(getUniqueId(), StoreErrorCodes.ID_Not_Found); }

Target:
public void basicTest() throws InterruptedException, IOException, StoreException { MockId addedId = put(1, PUT_RECORD_SIZE, time.seconds() + 1).get(0); time.sleep(2 * Time.MsPerSec); liveKeys.remove(addedId); expiredKeys.add(addedId); StoreInfo storeInfo = store.get(new ArrayList<>(liveKeys), EnumSet.noneOf(StoreGetOptions.class)); checkStoreInfo(storeInfo, liveKeys); MockMessageStoreHardDelete hd = (MockMessageStoreHardDelete) hardDelete; for (MockId id : deletedKeys) { hd.setMessageInfo(allKeys.get(id).getFirst()); verifyGetFailure(id, StoreErrorCodes.ID_Deleted); storeInfo = store.get(Collections.singletonList(id), EnumSet.of(StoreGetOptions.Store_Include_Deleted)); checkStoreInfo(storeInfo, Collections.singleton(id)); storeInfo = store.get(Collections.singletonList(id), EnumSet.allOf(StoreGetOptions.class)); checkStoreInfo(storeInfo, Collections.singleton(id)); } for (MockId id : expiredKeys) { verifyGetFailure(id, StoreErrorCodes.TTL_Expired); storeInfo = store.get(Collections.singletonList(id), EnumSet.of(StoreGetOptions.Store_Include_Expired)); checkStoreInfo(storeInfo, Collections.singleton(id)); storeInfo = store.get(Collections.singletonList(id), EnumSet.allOf(StoreGetOptions.class)); checkStoreInfo(storeInfo, Collections.singleton(id)); } delete(addedId); verifyGetFailure(getUniqueId(), StoreErrorCodes.ID_Not_Found); }
Source:
public String build() { return new StringBuilder(URL_CATALOG).append("/buckets/") .append(this.catalogObject.getBucketName()) .append("/resources?") .append(paramPair(NAME_PARAM, this.catalogObject.getNodeSourceName())) .append("&") .append(paramPair(KIND_PARAM, this.catalogObject.getKind())) .append("&") .append(paramPair(COMMIT_MESSAGE_PARAM, this.catalogObject.getCommitMessage())) .append("&") .append(paramPair(OBJECT_CONTENT_TYPE_PARAM, this.catalogObject.getObjectContentType())) .toString(); }

Target:
public String build() { String urlEncodedCommitMessage = getUrlEncodedCommitMessageOrFail(); StringBuilder builder = new StringBuilder(URL_CATALOG).append("/buckets/") .append(this.catalogObjectAction.getBucketName()); if (this.catalogObjectAction.isRevised()) { builder.append("/resources/").append(this.catalogObjectAction.getNodeSourceName()).append("/revisions?"); appendParameters(builder, paramPair(COMMIT_MESSAGE_PARAM, urlEncodedCommitMessage)); } else { builder.append("/resources?"); appendParameters(builder, paramPair(NAME_PARAM, this.catalogObjectAction.getNodeSourceName()), paramPair(KIND_PARAM, this.catalogObjectAction.getKind()), paramPair(COMMIT_MESSAGE_PARAM, urlEncodedCommitMessage), paramPair(OBJECT_CONTENT_TYPE_PARAM, this.catalogObjectAction.getObjectContentType())); } return builder.toString(); }
Source:
public String getName() { return name.replaceAll("^\\s+|\\s+$", ""); }

Target:
public String getName() { return name.trim(); }
Source:
private static CONNECTClient<EntityExchangeManagementPortType> getClient() throws Exception { String url = oProxyHelper.getAdapterEndPointFromConnectionManager(ENTITY_EXCHANGE_MANAGEMENT_SERVICE_NAME); ServicePortDescriptor<EntityExchangeManagementPortType> portDescriptor = new ExchangeManagementPortDescriptor(); return CONNECTCXFClientFactory.getInstance().getCONNECTClientUnsecured(portDescriptor, url, new AssertionType()); }

Target:
private static CONNECTClient<EntityExchangeManagementPortType> getClient() throws ExchangeManagerException { if (null == client) { String url = oProxyHelper.getAdapterEndPointFromConnectionManager(ENTITY_EXCHANGE_MANAGEMENT_SERVICE_NAME); ServicePortDescriptor<EntityExchangeManagementPortType> portDescriptor = new ExchangeManagementPortDescriptor(); client = CONNECTCXFClientFactory.getInstance().getCONNECTClientUnsecured(portDescriptor, url, new AssertionType()); } return client; }
Source:
public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName) { return tryGetSourceTable(tableName).map((t) -> { RaptorTableHandle sourceTableHandle = (RaptorTableHandle) getTableHandle(t); if (sourceTableHandle != null) { return new ColumnRangesSystemTable(sourceTableHandle, dbi); } return null; }); }

Target:
public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName) { return getSourceTable(tableName) .map(this::getTableHandle) .map(handle -> new ColumnRangesSystemTable(handle, dbi)); }
Source:
private static String urlEncode(String s) { try { return URLEncoder.encode(s, Charsets.UTF_8.name()) .replace("+", "%20").replace("*", "%2A").replace("%7E", "~"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }

Target:
private static String urlEncode(String s) { try { return URLEncoder.encode(s, Charsets.UTF_8.name()) .replace("+", "%20").replace("*", "%2A"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
public ArrayList<Property> getProcessProperties() { if (Objects.isNull(processProperties)) { return new ArrayList<>(); } return processProperties; }

Target:
public ArrayList<Property> getProcessProperties() { if (Objects.isNull(processProperties)) { processProperties = new ArrayList<>(); } return processProperties; }
Source:
public List<String> getDomains() throws DomainListException { List<String> domains = getDomainListInternal(); if (domains != null) { domains = new ArrayList<String>(domains); String hostName; try { hostName = getDNSServer().getHostName(getDNSServer().getLocalHost()); } catch (UnknownHostException ue) { hostName = "localhost"; } getLogger().info("Local host is: " + hostName); if (autoDetect && (!hostName.equals("localhost"))) { domains.add(hostName.toLowerCase(Locale.US)); } if (autoDetectIP) { domains.addAll(getDomainsIP(domains, dns, getLogger())); } if (getLogger().isInfoEnabled()) { for (String domain : domains) { getLogger().debug("Handling mail for: " + domain); } } } return ImmutableList.copyOf(domains); }

Target:
public List<String> getDomains() throws DomainListException { List<String> domains = getDomainListInternal(); if (domains != null) { ArrayList<String> mutableDomains = new ArrayList<String>(domains); String hostName; try { hostName = getDNSServer().getHostName(getDNSServer().getLocalHost()); } catch (UnknownHostException ue) { hostName = "localhost"; } getLogger().info("Local host is: " + hostName); if (autoDetect && (!hostName.equals("localhost"))) { mutableDomains.add(hostName.toLowerCase(Locale.US)); } if (autoDetectIP) { mutableDomains.addAll(getDomainsIP(mutableDomains, dns, getLogger())); } if (getLogger().isInfoEnabled()) { for (String domain : mutableDomains) { getLogger().debug("Handling mail for: " + domain); } } return ImmutableList.copyOf(mutableDomains); } return ImmutableList.of(); }
Source:
public Result apply(JoinNode joinNode, Captures captures, Context context) { if (!(joinNode.getType() == INNER) || joinNode.getDistributionType().isPresent()) { return Result.empty(); } MultiJoinNode multiJoinNode = toMultiJoinNode(joinNode, context.getLookup(), JOIN_LIMIT); if (multiJoinNode.getSources().size() < 2) { return Result.empty(); } JoinEnumerator joinEnumerator = new JoinEnumerator( context.getSession(), context.getCostProvider(), costComparator, context.getIdAllocator(), multiJoinNode.getFilter(), context.getLookup()); JoinEnumerationResult result = joinEnumerator.chooseJoinOrder(multiJoinNode.getSources(), multiJoinNode.getOutputSymbols()); if (!result.getPlanNode().isPresent()) { return Result.empty(); } if (result.getCost().hasUnknownComponents() || result.getCost().equals(INFINITE_COST)) { return Result.empty(); } return Result.ofPlanNode(result.getPlanNode().get()); }

Target:
public Result apply(JoinNode joinNode, Captures captures, Context context) { MultiJoinNode multiJoinNode = toMultiJoinNode(joinNode, context.getLookup(), getMaxReorderedTables(context.getSession())); JoinEnumerator joinEnumerator = new JoinEnumerator( context.getSession(), context.getCostProvider(), costComparator, context.getIdAllocator(), multiJoinNode.getFilter(), context.getLookup(), context); JoinEnumerationResult result = joinEnumerator.chooseJoinOrder(multiJoinNode.getSources(), multiJoinNode.getOutputSymbols()); if (!result.getPlanNode().isPresent()) { return Result.empty(); } return Result.ofPlanNode(result.getPlanNode().get()); }
Source:
private StandaloneFailedAttemptResult processTestAttempt( int attemptId, boolean isLastAttempt, ActionExecutionContext actionExecutionContext, TestRunnerAction action, StandaloneTestResult result) throws IOException { ImmutableList<Pair<String, Path>> testOutputs = action.getTestOutputsMapping( actionExecutionContext.getPathResolver(), actionExecutionContext.getExecRoot()); if (!isLastAttempt) { testOutputs = renameOutputs(actionExecutionContext, action, testOutputs, attemptId); } TestResultData.Builder dataBuilder = result.testResultDataBuilder(); BlazeTestStatus status = BlazeTestStatus.INCOMPLETE; Path renamedTestLog = null; for (Pair<String, Path> pair : testOutputs) { if (TestFileNameConstants.TEST_LOG.equals(pair.getFirst())) { Preconditions.checkState(renamedTestLog == null, "multiple test_log matches"); renamedTestLog = pair.getSecond(); status = dataBuilder.getStatus(); } } if (status == BlazeTestStatus.PASSED) { dataBuilder.setPassedLog(renamedTestLog.toString()); } else if (status == BlazeTestStatus.INCOMPLETE) { Preconditions.checkState(renamedTestLog == null); dataBuilder.setStatus(status); } else { dataBuilder.addFailedLogs(renamedTestLog.toString()); } TestResultData data = dataBuilder.build(); actionExecutionContext .getEventHandler() .post( TestAttempt.forExecutedTestResult( action, data, attemptId, testOutputs, result.executionInfo(), isLastAttempt)); processTestOutput(actionExecutionContext, data, action.getTestName(), renamedTestLog); return new StandaloneFailedAttemptResult(data); }

Target:
private StandaloneFailedAttemptResult processTestAttempt( int attemptId, boolean isLastAttempt, ActionExecutionContext actionExecutionContext, TestRunnerAction action, StandaloneTestResult result) throws IOException { ImmutableList<Pair<String, Path>> testOutputs = action.getTestOutputsMapping( actionExecutionContext.getPathResolver(), actionExecutionContext.getExecRoot()); if (!isLastAttempt) { testOutputs = renameOutputs(actionExecutionContext, action, testOutputs, attemptId); } Path renamedTestLog = null; for (Pair<String, Path> pair : testOutputs) { if (TestFileNameConstants.TEST_LOG.equals(pair.getFirst())) { Preconditions.checkState(renamedTestLog == null, "multiple test_log matches"); renamedTestLog = pair.getSecond(); } } TestResultData.Builder dataBuilder = result.testResultDataBuilder(); if (renamedTestLog == null) { dataBuilder.setStatus(BlazeTestStatus.INCOMPLETE); } if (dataBuilder.getStatus() == BlazeTestStatus.PASSED) { dataBuilder.setPassedLog(renamedTestLog.toString()); } else if (dataBuilder.getStatus() == BlazeTestStatus.INCOMPLETE) { Preconditions.checkState(renamedTestLog == null); } else { dataBuilder.addFailedLogs(renamedTestLog.toString()); } TestResultData data = dataBuilder.build(); actionExecutionContext .getEventHandler() .post( TestAttempt.forExecutedTestResult( action, data, attemptId, testOutputs, result.executionInfo(), isLastAttempt)); processTestOutput(actionExecutionContext, data, action.getTestName(), renamedTestLog); return new StandaloneFailedAttemptResult(data); }
Source:
public void testParseJDBCPassword() throws SqlException { String password = "Abd98*@80EFg"; String raw = "No suitable driver found for jdbc:splice://dwbdtest1r1w3.wellpoint" + ".com:1527/splicedb;user=af29891;password=" + password; assertEquals(password, SpliceClient.parseJDBCPassword(raw)); raw = "No suitable driver found for jdbc:splice://dwbdtest1r1w3.wellpoint" + ".com:1527/splicedb;password=" + password + ";user=af29891"; assertEquals(password, SpliceClient.parseJDBCPassword(raw)); }

Target:
public void testParseJDBCPassword() throws SqlException { String password = "Abd98*@80EFg"; String raw = "jdbc:splice://localhost.com:1527/splicedb;user=af29891;password=" + password; assertEquals(password, SpliceClient.parseJDBCPassword(raw)); raw = "jdbc:splice://localhost:1527/splicedb;password=" + password + ";user=af29891"; assertEquals(password, SpliceClient.parseJDBCPassword(raw)); }
Source:
private boolean isCatalogAccessible(String catalogName) { return accessControl.filterCatalogs(session.getIdentity(), ImmutableSet.of(catalogName)).contains(catalogName) && metadata.catalogExists(session, catalogName); }

Target:
private boolean isCatalogAccessible(String catalogName) { return metadata.catalogExists(session, catalogName) && accessControl.filterCatalogs(session.getIdentity(), ImmutableSet.of(catalogName)).contains(catalogName); }
Source:
public SQLException(String sqlState, String message) { super(message); assert(sqlState.length() == 5); byte[] sqlStateBytes = null; try { sqlStateBytes = sqlState.getBytes("UTF-8"); } catch (UnsupportedEncodingException e1) { sqlStateBytes = new byte[5]; e1.printStackTrace(); assert(false); } assert(sqlStateBytes.length == 5); m_sqlState = sqlStateBytes; }

Target:
public SQLException(String sqlState, String message) { super(message); assert(sqlState.length() == 5); byte[] sqlStateBytes = null; sqlStateBytes = sqlState.getBytes(StandardCharsets.UTF_8); assert(sqlStateBytes.length == 5); m_sqlState = sqlStateBytes; }
Source:
public Vector2 getOrientation () { return position.set(vals[COS], vals[SIN]); }

Target:
public Vector2 getOrientation () { return orientation.set(vals[COS], vals[SIN]); }
Source:
public ITimeGraphEntry @Nullable getChildren(@Nullable Object parentElement) { if (parentElement instanceof CriticalPathEntry) { List<@NonNull ? extends ITimeGraphEntry> children = ((CriticalPathEntry) parentElement).getChildren(); return children.toArray(new TimeGraphEntry[children.size()]); } return null; }

Target:
public ITimeGraphEntry @Nullable getChildren(@Nullable Object parentElement) { if (parentElement instanceof CriticalPathEntry) { List<? extends ITimeGraphEntry> children = ((CriticalPathEntry) parentElement).getChildren(); return children.toArray(new TimeGraphEntry[children.size()]); } return null; }
Source:
public void createAndStoreCredentialFile(String username, String password) { if (!PASchedulerProperties.SCHEDULER_CREATE_CREDENTIALS_WHEN_LOGIN.getValueAsBoolean()) { return; } try { byte[] credentialBytes = createCredentials(username, password); saveCredentialsFile(username, credentialBytes); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public synchronized void createAndStoreCredentialFile(String username, String password) { if (!PASchedulerProperties.SCHEDULER_CREATE_CREDENTIALS_WHEN_LOGIN.getValueAsBoolean()) { return; } try { byte[] credentialBytes = createCredentials(username, password); saveCredentialsFile(username, credentialBytes); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
private void confirmResetStatistics() { if (!countAll) { ConfirmationDialog conDialog = new ConfirmationDialog( getActivity(), R.string.statistics_reset_data_title, R.string.statistics_reset_data_msg) { @Override public void onConfirmButtonPressed( DialogInterface dialog) { dialog.dismiss(); doResetStatistics(); } }; conDialog.createNewDialog().show(); } }

Target:
private void confirmResetStatistics() { if (!countAll) { ConfirmationDialog conDialog = new ConfirmationDialog( getActivity(), R.string.statistics_reset_data, R.string.statistics_reset_data_msg) { @Override public void onConfirmButtonPressed(DialogInterface dialog) { dialog.dismiss(); doResetStatistics(); } }; conDialog.createNewDialog().show(); } }
Source:
public int read() throws IOException { return length > processed++ ? Math.abs(random.nextInt()) : -1; }

Target:
public int read() throws IOException { return length > processed++ ? Math.abs(random.nextInt() & 0xFF) : -1; }
Source:
public void setUp() throws Exception { PowerMockito.mockStatic(GdxNativesLoader.class); testSprite = new SingleSprite("testSprite"); project = new Project(MockUtil.mockContextForProject(), "testProject"); ProjectManager.getInstance().setCurrentProject(project); userVariable = new UserVariable(TEST_USERVARIABLE); project.addUserVariable(userVariable); StageActivity.webConnectionHolder = Mockito.mock(WebConnectionHolder.class); webConnectionFactory = Mockito.mock(WebConnectionFactory.class); webConnection = Mockito.mock(WebConnection.class); }

Target:
public void setUp() throws Exception { mockStatic(GdxNativesLoader.class); testSprite = new SingleSprite("testSprite"); userVariable = new UserVariable(TEST_USERVARIABLE); StageActivity.stageListener = mock(StageListener.class); StageActivity.stageListener.webConnectionHolder = mock(WebConnectionHolder.class); webConnectionFactory = mock(WebConnectionFactory.class); webConnection = mock(WebConnection.class); }
Source:
private boolean isMailWantedBy(String userEmail, String notificationPreferenceKey){ User user; try { user = (new ThriftClients()).makeUserClient().getByEmail(userEmail); } catch (TException e){ log.info("Problem fetching user:" + e); return false; } if(user != null) { if(!user.isSetWantsMailNotification()) { user.setWantsMailNotification(true); } SW360Utils.setDefaultNotificationsPreferencesIfEmpty(user); return user.isWantsMailNotification() && user.getNotificationPreferences().getOrDefault(notificationPreferenceKey, Boolean.FALSE) ; } return false; }

Target:
private boolean isMailWantedBy(String userEmail, String notificationPreferenceKey){ User user; try { user = (new ThriftClients()).makeUserClient().getByEmail(userEmail); } catch (TException e){ log.info("Problem fetching user:" + e); return false; } if(user != null) { SW360Utils.initializeMailNotificationsPreferences(user); return user.isWantsMailNotification() && user.getNotificationPreferences().getOrDefault(notificationPreferenceKey, Boolean.FALSE) ; } return false; }
Source:
public void onRenderTick(RenderWorldLastEvent event) { if(Minecraft.getMinecraft().player != null && !Minecraft.getMinecraft().player.isDead) { if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 || Minecraft.getMinecraft().currentScreen != null) { EntityPlayer p = Minecraft.getMinecraft().player; if(!p.isInWater()) updateSwimDataAngles(p); updateSwimRenderAngles(p); } } }

Target:
public void onRenderTick(RenderWorldLastEvent event) { EntityPlayer p = Minecraft.getMinecraft().player; if (p != null && !p.isDead) { if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 || Minecraft.getMinecraft().currentScreen != null) { if (!p.isInWater()) { updateSwimDataAngles(p); } updateSwimRenderAngles(p); } } }
Source:
public void onFollowTapped(View view, String blogName, final long blogId) { mDispatcher.dispatch(AccountActionBuilder.newFetchSubscriptionsAction()); Snackbar.make(view, Html.fromHtml(getString(R.string.reader_followed_blog_notifications, "<b>", blogName, "</b>")), Snackbar.LENGTH_LONG) .setAction(getString(R.string.reader_followed_blog_notifications_action), new View.OnClickListener() { @Override public void onClick(View view) { AddOrDeleteSubscriptionPayload payload = new AddOrDeleteSubscriptionPayload( String.valueOf(blogId), AddOrDeleteSubscriptionPayload.SubscriptionAction.NEW); mDispatcher.dispatch(newUpdateSubscriptionNotificationPostAction(payload)); } }) .setActionTextColor(getResources().getColor(R.color.color_accent)) .show(); }

Target:
public void onFollowTapped(View view, String blogName, final long blogId) { mDispatcher.dispatch(AccountActionBuilder.newFetchSubscriptionsAction()); if (isAdded()) { String blog = TextUtils.isEmpty(blogName) ? getString(R.string.reader_followed_blog_notifications_this) : blogName; Snackbar.make(view, Html.fromHtml(getString(R.string.reader_followed_blog_notifications, "<b>", blog, "</b>")), AccessibilityUtils.getSnackbarDuration(getActivity())) .setAction(getString(R.string.reader_followed_blog_notifications_action), new View.OnClickListener() { @Override public void onClick(View view) { AnalyticsUtils.trackWithSiteId(Stat.FOLLOWED_BLOG_NOTIFICATIONS_READER_ENABLED, blogId); AddOrDeleteSubscriptionPayload payload = new AddOrDeleteSubscriptionPayload( String.valueOf(blogId), SubscriptionAction.NEW); mDispatcher.dispatch(newUpdateSubscriptionNotificationPostAction(payload)); ReaderBlogTable.setNotificationsEnabledByBlogId(blogId, true); } }) .setActionTextColor(getResources().getColor(R.color.color_accent)) .show(); } }
Source:
private boolean isUserBrickAdapter(BaseAdapter baseAdapter) { return baseAdapter instanceof UserBrickAdapter; }

Target:
private static boolean isUserBrickAdapter(BaseAdapter baseAdapter) { return baseAdapter instanceof UserBrickAdapter; }
Source:
public InputStream nextElement() { int bytesRead; try { bytesRead = inputStream.read(buffer, 0, buffer.length); } catch (IOException e) { throw new ChunkedUploadException("read from input stream error", e); } byte[] chunk; if (bytesRead != -1) { chunk = constructSignedChunk(bytesRead, buffer); } else { chunk = constructSignedChunk(0, buffer); lastChunked = true; } return new ByteArrayInputStream(chunk); }

Target:
public InputStream nextElement() { int bytesRead; try { bytesRead = ByteStreams.read(inputStream, buffer, 0, buffer.length); } catch (IOException e) { throw new ChunkedUploadException("read from input stream error", e); } byte[] chunk; if (bytesRead > 0) { chunk = constructSignedChunk(bytesRead, buffer); } else { chunk = constructSignedChunk(0, buffer); lastChunked = true; } return new ByteArrayInputStream(chunk); }
Source:
RootReference<Long,Record<?,?>>[] collectUndoLogRootReferences() { BitSet opentransactions = openTransactions.get(); @SuppressWarnings("unchecked") RootReference<Long,Record<?,?>>[] undoLogRootReferences = (RootReference<Long,Record<?,?>>[])new RootReference[opentransactions.length()]; for (int i = opentransactions.nextSetBit(0); i >= 0; i = opentransactions.nextSetBit(i+1)) { MVMap<Long,Record<?,?>> undoLog = undoLogs[i]; if (undoLog != null) { RootReference<Long,Record<?,?>> rootReference = undoLog.getRoot(); if (rootReference.needFlush()) { return null; } undoLogRootReferences[i] = rootReference; } } return undoLogRootReferences; }

Target:
RootReference<Long,Record<?,?>>[] collectUndoLogRootReferences() { BitSet opentransactions = openTransactions.get(); @SuppressWarnings("unchecked") RootReference<Long,Record<?,?>>[] undoLogRootReferences = new RootReference[opentransactions.length()]; for (int i = opentransactions.nextSetBit(0); i >= 0; i = opentransactions.nextSetBit(i+1)) { MVMap<Long,Record<?,?>> undoLog = undoLogs[i]; if (undoLog != null) { RootReference<Long,Record<?,?>> rootReference = undoLog.getRoot(); if (rootReference.needFlush()) { return null; } undoLogRootReferences[i] = rootReference; } } return undoLogRootReferences; }
Source:
private boolean validateContent(byte[] content) { for (int i = 0; i < content.length; i++) { if (content[i] != (byte) (i % (Byte.MAX_VALUE + 1))) { return false; } ; } return true; }

Target:
private boolean validateContent(byte[] content) { for (int i = 0; i < content.length; i++) { if (content[i] != (byte) (i % (Byte.MAX_VALUE + 1))) { return false; } } return true; }
Source:
public void setFactionNameAndDefaults(String factionName) { this.factionName = factionName; FactionNpcDefault npcDefault = NpcDefaultsRegistry.getFactionNpcDefault(this); applyFactionNpcSettings(npcDefault); if (!getCustomEquipmentOverride()) { npcDefault.applyEquipment(this); } Range<Float> heightRange = npcDefault.getHeightRange(); float newHeight = heightRange.getMinimum() + world.rand.nextFloat() * (heightRange.getMaximum() - heightRange.getMinimum()); setSize((newHeight / 1.8f) * 0.6f * npcDefault.getThinness(), newHeight); }

Target:
public void setFactionNameAndDefaults(String factionName) { this.factionName = factionName; FactionNpcDefault npcDefault = NpcDefaultsRegistry.getFactionNpcDefault(this); applyFactionNpcSettings(npcDefault); if (!getCustomEquipmentOverride()) { npcDefault.applyEquipment(this); } if (!AWNPCStatics.vanillaEquipmentDropRate) { inventoryArmorDropChances = new float[] {1.f, 1.f, 1.f, 1.f}; inventoryHandsDropChances = new float[] {1.f, 1.f}; } Range<Float> heightRange = npcDefault.getHeightRange(); float newHeight = heightRange.getMinimum() + world.rand.nextFloat() * (heightRange.getMaximum() - heightRange.getMinimum()); setSize((newHeight / 1.8f) * 0.6f * npcDefault.getThinness(), newHeight); }
Source:
public List<MetricFamilySamples> collect() { List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>(); addBufferPoolMetrics(mfs); return mfs; }

Target:
public List<MetricFamilySamples> collect() { List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>(); GaugeMetricFamily used = new GaugeMetricFamily( "jvm_buffer_pool_used_bytes", "Used bytes of a given JVM buffer pool.", Collections.singletonList("pool")); mfs.add(used); GaugeMetricFamily capacity = new GaugeMetricFamily( "jvm_buffer_pool_capacity_bytes", "Bytes capacity of a given JVM buffer pool.", Collections.singletonList("pool")); mfs.add(capacity); GaugeMetricFamily buffers = new GaugeMetricFamily( "jvm_buffer_pool_used_buffers", "Used buffers of a given JVM buffer pool.", Collections.singletonList("pool")); mfs.add(buffers); for (final Object pool : bufferPoolMXBeans) { used.addMetric( Collections.singletonList(getName(pool)), callLongMethond(getMemoryUsed,pool)); capacity.addMetric( Collections.singletonList(getName(pool)), callLongMethond(getTotalCapacity,pool)); buffers.addMetric( Collections.singletonList(getName(pool)), callLongMethond(getCount,pool)); } return mfs; }
Source:
public void testStreamWriter() throws IOException, ExecutionException, InterruptedException { streamClient.create(TEST_STREAM); streamClient.truncate(TEST_STREAM); StreamWriter writer = streamClient.createWriter(TEST_STREAM); int expectedEventsNum = 10; try { for (int i = 0; i < expectedEventsNum; i++) { writer.write("test" + i, Charset.forName("UTF8"), Collections.singletonMap("key", "value")).get(); } } finally { writer.close(); } List<JsonObject> streamEvents = streamClientTestHelper.getStreamEvents(TEST_STREAM); Assert.assertEquals(expectedEventsNum, streamEvents.size()); streamClient.truncate(TEST_STREAM); streamEvents = streamClientTestHelper.getStreamEvents(TEST_STREAM); Assert.assertEquals(0, streamEvents.size()); }

Target:
public void testStreamWriter() throws Exception { streamClient.create(TEST_STREAM); streamClient.truncate(TEST_STREAM); StreamWriter writer = streamClient.createWriter(TEST_STREAM); int expectedEventsNum = 10; try { for (int i = 0; i < expectedEventsNum; i++) { writer.write(EVENT_STR_PREFIX + i, Charset.forName("UTF8"), Collections.singletonMap("key", "value")).get(); } } finally { writer.close(); } List<String> streamEvents = streamReader.getDeliveredEvents(TEST_STREAM); Assert.assertEquals(expectedEventsNum, streamEvents.size()); for (int i = 0; i < expectedEventsNum; i++) { Assert.assertEquals(EVENT_STR_PREFIX + i, streamEvents.get(i)); } streamClient.truncate(TEST_STREAM); streamEvents = streamReader.getDeliveredEvents(TEST_STREAM); Assert.assertEquals(0, streamEvents.size()); }
Source:
SaveTransaction(EngineEntityManager privateEntityManager, EntitySetDeltaRecorder deltaToSave, Map<String, EntityData.PlayerStore> unloadedPlayers, Map<String, PlayerStoreBuilder> loadedPlayers, GlobalStoreBuilder globalStoreBuilder, Map<Vector3i, CompressedChunkBuilder> unloadedChunks, Map<Vector3i, ChunkImpl> loadedChunks, GameManifest gameManifest, boolean storeChunksInZips, StoragePathProvider storagePathProvider, Lock worldDirectoryWriteLock, RecordAndReplaySerializer recordAndReplaySerializer, RecordAndReplayUtils recordAndReplayUtils) { this.privateEntityManager = privateEntityManager; this.deltaToSave = deltaToSave; this.unloadedPlayers = unloadedPlayers; this.loadedPlayers = loadedPlayers; this.unloadedChunks = unloadedChunks; this.loadedChunks = loadedChunks; this.globalStoreBuilder = globalStoreBuilder; this.gameManifest = gameManifest; this.storeChunksInZips = storeChunksInZips; this.storagePathProvider = storagePathProvider; this.saveTransactionHelper = new SaveTransactionHelper(storagePathProvider); this.worldDirectoryWriteLock = worldDirectoryWriteLock; this.recordAndReplaySerializer = recordAndReplaySerializer; this.recordAndReplayUtils = recordAndReplayUtils; }

Target:
public SaveTransaction(EngineEntityManager privateEntityManager, EntitySetDeltaRecorder deltaToSave, Map<String, EntityData.PlayerStore> unloadedPlayers, Map<String, PlayerStoreBuilder> loadedPlayers, GlobalStoreBuilder globalStoreBuilder, Map<Vector3i, CompressedChunkBuilder> unloadedChunks, Map<Vector3i, ChunkImpl> loadedChunks, GameManifest gameManifest, boolean storeChunksInZips, StoragePathProvider storagePathProvider, Lock worldDirectoryWriteLock, RecordAndReplaySerializer recordAndReplaySerializer, RecordAndReplayUtils recordAndReplayUtils) { this.privateEntityManager = privateEntityManager; this.deltaToSave = deltaToSave; this.unloadedPlayers = unloadedPlayers; this.loadedPlayers = loadedPlayers; this.unloadedChunks = unloadedChunks; this.loadedChunks = loadedChunks; this.globalStoreBuilder = globalStoreBuilder; this.gameManifest = gameManifest; this.storeChunksInZips = storeChunksInZips; this.storagePathProvider = storagePathProvider; this.saveTransactionHelper = new SaveTransactionHelper(storagePathProvider); this.worldDirectoryWriteLock = worldDirectoryWriteLock; this.recordAndReplaySerializer = recordAndReplaySerializer; this.recordAndReplayUtils = recordAndReplayUtils; }
Source:
public PlannerTool(final Database database, byte[] catalogHash) { assert(database != null); m_database = database; m_catalogHash = catalogHash; m_cache = AdHocCompilerCache.getCacheForCatalogHash(catalogHash); m_hsql = HSQLInterface.loadHsqldb(); String binDDL = m_database.getSchema(); String ddl = Encoder.decodeBase64AndDecompress(binDDL); String[] commands = ddl.split("\n"); for (String command : commands) { String decoded_cmd = Encoder.hexDecodeToString(command); decoded_cmd = decoded_cmd.trim(); if (decoded_cmd.length() == 0) continue; try { m_hsql.runDDLCommand(decoded_cmd); } catch (HSQLParseException e) { throw new RuntimeException("Error creating hsql: " + e.getMessage() + " in DDL statement: " + decoded_cmd); } } hostLog.debug("hsql loaded"); synchronized (PlannerTool.class) { if (m_plannerStats == null) { final StatsAgent statsAgent = VoltDB.instance().getStatsAgent(); if (statsAgent != null) { m_plannerStats = new PlannerStatsCollector(-1); statsAgent.registerStatsSource(StatsSelector.PLANNER, -1, m_plannerStats); } } } }

Target:
public PlannerTool(final Database database, byte[] catalogHash) { assert(database != null); m_database = database; m_catalogHash = catalogHash; m_cache = AdHocCompilerCache.getCacheForCatalogHash(catalogHash); m_hsql = HSQLInterface.loadHsqldb(); String binDDL = m_database.getSchema(); String ddl = Encoder.decodeBase64AndDecompress(binDDL); String[] commands = ddl.split("\n"); for (String command : commands) { String decoded_cmd = Encoder.hexDecodeToString(command); decoded_cmd = decoded_cmd.trim(); if (decoded_cmd.length() == 0) continue; try { m_hsql.runDDLCommand(decoded_cmd); } catch (HSQLParseException e) { throw new RuntimeException("Error creating hsql: " + e.getMessage() + " in DDL statement: " + decoded_cmd); } } hostLog.debug("hsql loaded"); if (m_plannerStats == null) { synchronized (this.getClass()) { if (m_plannerStats == null) { final StatsAgent statsAgent = VoltDB.instance().getStatsAgent(); if (statsAgent != null) { m_plannerStats = new PlannerStatsCollector(-1); statsAgent.registerStatsSource(StatsSelector.PLANNER, -1, m_plannerStats); } } } } }
Source:
public void testWriteTo() throws Exception { final Path tmpPath = Files.createTempFile("testfile", ".txt"); tmpPath.toFile().deleteOnExit(); try (final OutputStream outStream = Files.newOutputStream(tmpPath)) { outStream.write(0); outStream.write(1); outStream.write(2); outStream.write(3); } try (final PathEntity httpentity = new PathEntity(tmpPath, ContentType.TEXT_PLAIN)) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); httpentity.writeTo(out); final byte[] bytes = out.toByteArray(); Assert.assertNotNull(bytes); Assert.assertEquals(Files.size(tmpPath), bytes.length); for (int i = 0; i < 4; i++) { Assert.assertEquals(i, bytes[i]); } if (!Files.deleteIfExists(tmpPath)) { Assert.fail("Failed to delete: " + tmpPath); } try { httpentity.writeTo(null); Assert.fail("NullPointerException should have been thrown"); } catch (final NullPointerException ex) { } } }

Target:
public void testWriteTo() throws Exception { final Path tmpPath = Files.createTempFile("testfile", ".txt"); tmpPath.toFile().deleteOnExit(); try (final OutputStream outStream = Files.newOutputStream(tmpPath)) { outStream.write(0); outStream.write(1); outStream.write(2); outStream.write(3); } try (final PathEntity httpEntity = new PathEntity(tmpPath, ContentType.TEXT_PLAIN)) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); httpEntity.writeTo(out); final byte[] bytes = out.toByteArray(); Assert.assertNotNull(bytes); Assert.assertEquals(Files.size(tmpPath), bytes.length); for (int i = 0; i < 4; i++) { Assert.assertEquals(i, bytes[i]); } if (!Files.deleteIfExists(tmpPath)) { Assert.fail("Failed to delete: " + tmpPath); } try { httpEntity.writeTo(null); Assert.fail("NullPointerException should have been thrown"); } catch (final NullPointerException ex) { } } }
Source:
public SimpleEventHandlerInvoker(List<?> eventListeners, ParameterResolverFactory parameterResolverFactory, ListenerInvocationErrorHandler listenerInvocationErrorHandler, SequencingPolicy<? super EventMessage<?>> sequencingPolicy) { this(eventListeners, parameterResolverFactory, new ClasspathHandlerDefinition(Thread.currentThread().getContextClassLoader()), listenerInvocationErrorHandler, sequencingPolicy); }

Target:
public SimpleEventHandlerInvoker(List<?> eventListeners, ParameterResolverFactory parameterResolverFactory, ListenerInvocationErrorHandler listenerInvocationErrorHandler, SequencingPolicy<? super EventMessage<?>> sequencingPolicy) { this.eventListeners = eventListeners; this.wrappedEventListeners = eventListeners.stream() .map(listener -> listener instanceof EventListener ? (EventListener) listener : new AnnotationEventListenerAdapter(listener, parameterResolverFactory)) .collect(toCollection(ArrayList::new)); this.sequencingPolicy = sequencingPolicy; this.listenerInvocationErrorHandler = listenerInvocationErrorHandler; }
Source:
private void addFieldDialog() { fieldNameInput = new EditText(this); fieldNameInput.setSingleLine(true); new MaterialDialog.Builder(this) .title(R.string.model_field_editor_add) .positiveText(R.string.dialog_ok) .customView(fieldNameInput, true) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { String fieldName = fieldNameInput.getText().toString() .replaceAll("[\'\"\\n\\r\\[\\]\\(\\)]", ""); if (fieldName.length() == 0) { showToast(getResources().getString(R.string.toast_empty_name)); } else if (containsField(fieldName)) { showToast(getResources().getString(R.string.toast_duplicate_field)); } else { try { col.modSchema(); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ADD_FIELD, mChangeFieldHandler, new DeckTask.TaskData(new Object[]{mod, fieldName})); } catch (ConfirmModSchemaException e) { ConfirmationDialog c = new ConfirmationDialog() { public void confirm() { col.modSchemaNoCheck(); String fieldName = fieldNameInput.getText().toString() .replaceAll("[\'\"\\n\\r\\[\\]\\(\\)]", ""); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ADD_FIELD, mChangeFieldHandler, new DeckTask.TaskData(new Object[]{mod, fieldName})); dismissContextMenu(); } public void cancel() { dismissContextMenu(); } }; c.setArgs(getResources().getString(R.string.full_sync_confirmation)); ModelFieldEditor.this.showDialogFragment(c); } col.getModels().update(mod); fullRefreshList(); } } }) .negativeText(R.string.dialog_cancel) .show(); }

Target:
private void addFieldDialog() { mFieldNameInput = new EditText(this); mFieldNameInput.setSingleLine(true); new MaterialDialog.Builder(this) .title(R.string.model_field_editor_add) .positiveText(R.string.dialog_ok) .customView(mFieldNameInput, true) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { String fieldName = mFieldNameInput.getText().toString() .replaceAll("[\'\"\\n\\r\\[\\]\\(\\)]", ""); if (fieldName.length() == 0) { showToast(getResources().getString(R.string.toast_empty_name)); } else if (containsField(fieldName)) { showToast(getResources().getString(R.string.toast_duplicate_field)); } else { try { mCol.modSchema(); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ADD_FIELD, mChangeFieldHandler, new DeckTask.TaskData(new Object[]{mMod, fieldName})); } catch (ConfirmModSchemaException e) { ConfirmationDialog c = new ConfirmationDialog() { public void confirm() { mCol.modSchemaNoCheck(); String fieldName = mFieldNameInput.getText().toString() .replaceAll("[\'\"\\n\\r\\[\\]\\(\\)]", ""); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ADD_FIELD, mChangeFieldHandler, new DeckTask.TaskData(new Object[]{mMod, fieldName})); dismissContextMenu(); } public void cancel() { dismissContextMenu(); } }; c.setArgs(getResources().getString(R.string.full_sync_confirmation)); ModelFieldEditor.this.showDialogFragment(c); } mCol.getModels().update(mMod); fullRefreshList(); } } }) .negativeText(R.string.dialog_cancel) .show(); }
Source:
public void ban(UUID uuid) { return getClanPlayer(uuid); }

Target:
public void ban(UUID uuid) { ClanPlayer cp = getClanPlayer(uuid); Clan clan = null; if (cp != null) { clan = cp.getClan(); } if (clan != null) { if (clan.getSize() == 1) { clan.disband(); } else { cp.setClan(null); cp.addPastClan(clan.getColorTag() + (cp.isLeader() ? ChatColor.DARK_RED + "*" : "")); cp.setLeader(false); cp.setJoinDate(0); clan.removeMember(uuid); plugin.getStorageManager().updateClanPlayer(cp); plugin.getStorageManager().updateClan(clan); } } plugin.getSettingsManager().addBanned(uuid); }
Source:
public void deleteEncounterFormDataAndRelatedPatientData(List<FormData> formDataList) throws FormDeleteException{ try { for (FormData formData : formDataList) { if (isCompleteFormData(formData)) { Encounter encounter = encounterService.getEncounterByFormDataUuid(formData.getUuid()); if (encounter != null) { List<Observation> observations = observationService.getObservationsByEncounter(encounter.getUuid()); observationService.deleteObservations(observations); encounterService.deleteEncounter(encounter); } } System.out.println("Deleting formdata: "+formData.getUserUuid()); formService.deleteFormData(formData); } }catch(IOException e){ throw new FormDeleteException(e); } }

Target:
public void deleteEncounterFormDataAndRelatedPatientData(List<FormData> formDataList) throws FormDeleteException{ try { for (FormData formData : formDataList) { if (isCompleteFormData(formData)) { Encounter encounter = encounterService.getEncounterByFormDataUuid(formData.getUuid()); if (encounter != null) { List<Observation> observations = observationService.getObservationsByEncounter(encounter.getUuid()); observationService.deleteObservations(observations); encounterService.deleteEncounter(encounter); } } formService.deleteFormData(formData); } }catch(IOException e){ throw new FormDeleteException(e); } }
Source:
public double calculateEntropy() { double[] samples = reservoir.stream().toArray(); return calculateEntropyFromSamples(samples); }

Target:
public double calculateEntropy() { return calculateFromSamples(reservoir.getSamples()); }
Source:
public void testWriteReadNullValuesAvro() throws Exception { String tablePath = getTempOutputDirectory() + "null_test_location_avro"; methodWatcher.executeUpdate(String.format("create external table null_test_avro (col1 int, col2 varchar(24))" + " STORED AS AVRO LOCATION '%s'",tablePath)); int insertCount = methodWatcher.executeUpdate(String.format("insert into null_test_avro values (1,null)," + "(2,'YYYY')," + "(3,'ZZZZ')")); Assert.assertEquals("insertCount is wrong",3,insertCount); ResultSet rs = methodWatcher.executeQuery("select * from null_test_avro where col2 is null"); Assert.assertEquals("COL1 |COL2 |\n" + "------------\n" + " 1 |NULL |",TestUtils.FormattedResult.ResultFactory.toString(rs)); ResultSet rs2 = methodWatcher.executeQuery("select * from null_test_avro where col2 is not null"); Assert.assertEquals("COL1 |COL2 |\n" + "------------\n" + " 2 |YYYY |\n" + " 3 |ZZZZ |",TestUtils.FormattedResult.ResultFactory.toString(rs2)); Assert.assertTrue(String.format("Table %s hasn't been created",tablePath), new File(tablePath).exists()); }

Target:
public void testWriteReadNullValuesAvro() throws Exception { String tablePath = getExternalResourceDirectory()+"null_test_location_avro"; methodWatcher.executeUpdate(String.format("create external table null_test_avro (col1 int, col2 varchar(24))" + " STORED AS AVRO LOCATION '%s'",tablePath)); int insertCount = methodWatcher.executeUpdate(String.format("insert into null_test_avro values (1,null)," + "(2,'YYYY')," + "(3,'ZZZZ')")); Assert.assertEquals("insertCount is wrong",3,insertCount); ResultSet rs = methodWatcher.executeQuery("select * from null_test_avro where col2 is null"); Assert.assertEquals("COL1 |COL2 |\n" + "------------\n" + " 1 |NULL |",TestUtils.FormattedResult.ResultFactory.toString(rs)); ResultSet rs2 = methodWatcher.executeQuery("select * from null_test_avro where col2 is not null"); Assert.assertEquals("COL1 |COL2 |\n" + "------------\n" + " 2 |YYYY |\n" + " 3 |ZZZZ |",TestUtils.FormattedResult.ResultFactory.toString(rs2)); Assert.assertTrue(String.format("Table %s hasn't been created",tablePath), new File(tablePath).exists()); }
Source:
public boolean needsInput() { if (unfinishedWork.isPresent() && !processUnfinishedWork()) { return false; } return !finished; }

Target:
public boolean needsInput() { return !finished && (unfinishedWork == null || processUnfinishedWork()); }
Source:
public ImmutableValue<Text> author() { return new ImmutableSpongeValue<Text>(Keys.BOOK_AUTHOR, this.getValue()); }

Target:
public ImmutableValue<Text> author() { return author; }
Source:
private List<ParameterOption> getIPv4Addresses() { ArrayList<ParameterOption> interfaceOptions = new ArrayList<>(); HashSet<String> subnets = new HashSet<>(); try { final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { final NetworkInterface current = interfaces.nextElement(); if (!current.isUp() || current.isLoopback() || current.isVirtual()) { continue; } for (InterfaceAddress ifAddr : current.getInterfaceAddresses()) { InetAddress addr = ifAddr.getAddress(); if (addr.isLoopbackAddress() || (addr instanceof Inet6Address)) { continue; } String ipv4Address = addr.getHostAddress(); String subNetString = NetUtil.getIpv4NetAddress(ipv4Address, ifAddr.getNetworkPrefixLength()) + "/" + String.valueOf(ifAddr.getNetworkPrefixLength()); subnets.add(subNetString); } } } catch (SocketException ex) { logger.error("Could not retrieve network interface: {}", ex.getMessage(), ex); return null; } for (String subnet : subnets) { ParameterOption po = new ParameterOption(subnet, subnet); interfaceOptions.add(po); } return interfaceOptions; }

Target:
private List<ParameterOption> getIPv4Addresses() { List<ParameterOption> interfaceOptions = new ArrayList<>(); Set<String> subnets = new HashSet<>(); try { final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { final NetworkInterface current = interfaces.nextElement(); if (!current.isUp() || current.isLoopback() || current.isVirtual()) { continue; } for (InterfaceAddress ifAddr : current.getInterfaceAddresses()) { InetAddress addr = ifAddr.getAddress(); if (addr.isLoopbackAddress() || (addr instanceof Inet6Address)) { continue; } String ipv4Address = addr.getHostAddress(); try { @SuppressWarnings("null") String subNetString = NetUtil.getIpv4NetAddress(ipv4Address, ifAddr.getNetworkPrefixLength()) + "/" + String.valueOf(ifAddr.getNetworkPrefixLength()); subnets.add(subNetString); } catch (IllegalArgumentException ex) { logger.error("Could not calculate network address: Ignoring IP {}", ex.getMessage(), ipv4Address, ex); } } } } catch (SocketException ex) { logger.error("Could not retrieve network interface: {}", ex.getMessage(), ex); return null; } for (String subnet : subnets) { ParameterOption po = new ParameterOption(subnet, subnet); interfaceOptions.add(po); } return interfaceOptions; }
Source:
long webkit_download_decide_destination(long download, long suggested_filename) { assert WEBKIT2 : WebKitGTK.Webkit2AssertMsg; final String fileName = getString(suggested_filename); if (!browser.isDisposed ()) { FileDialog dialog = new FileDialog (browser.getShell (), SWT.SAVE); dialog.setFileName (fileName); String title = Compatibility.getMessage ("SWT_FileDownload"); dialog.setText (title); String path = dialog.open (); if (path != null) { path = URI_FILEROOT + path; byte[] uriBytes = Converter.wcsToMbcs (path, true); WebKitGTK.webkit_download_set_allow_overwrite (download, true); WebKitGTK.webkit_download_set_destination (download, uriBytes); OS.g_object_ref (download); browser.getDisplay().asyncExec(() -> { openDownloadWindow (download, fileName); }); } } return 0; }

Target:
long webkit_download_decide_destination(long download, long suggested_filename) { assert WEBKIT2 : WebKitGTK.Webkit2AssertMsg; final String fileName = getString(suggested_filename); if (!browser.isDisposed ()) { FileDialog dialog = new FileDialog (browser.getShell (), SWT.SAVE); dialog.setFileName (fileName); String title = Compatibility.getMessage ("SWT_FileDownload"); dialog.setText (title); String path = dialog.open (); if (path != null) { path = URI_FILEROOT + path; byte[] uriBytes = Converter.wcsToMbcs (path, true); WebKitGTK.webkit_download_set_allow_overwrite (download, true); WebKitGTK.webkit_download_set_destination (download, uriBytes); openDownloadWindow (download, fileName); } } return 0; }