auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LeadershipToken blockOnBecomingLeader() throws InterruptedException { while (true) { PaxosValue greatestLearned = knowledge.getGreatestLearnedValue(); if (isThisNodeTheLeaderFor(greatestLearned)) { StillLeadingStatus leadingStatus = determineLeadershipStatus(greatestLearned); if (leadingStatus == StillLeadingStatus.LEADING) { log.info("Successfully became leader!"); return new PaxosLeadershipToken(greatestLearned); } else if (leadingStatus == StillLeadingStatus.NO_QUORUM) { long backoffTime = (long) (noQuorumMaxDelay * Math.random()); log.debug("Waiting for ms before rerequesting leadership status", SafeArg.of("waitTimeMs", backoffTime)); continue; } } else { if (pingLeader()) { Thread.sleep(updatePollingRateInMs); continue; } } boolean learnedNewState = updateLearnedStateFromPeers(greatestLearned); if (learnedNewState) { continue; } long backoffTime = (long) (randomWaitBeforeProposingLeadership * Math.random()); log.debug("Waiting for ms before proposing leadership", SafeArg.of("waitTimeMs", backoffTime)); Thread.sleep(backoffTime); proposeLeadershipAfter(greatestLearned); } }

Target:
public LeadershipToken blockOnBecomingLeader() throws InterruptedException { while (true) { PaxosValue greatestLearned = knowledge.getGreatestLearnedValue(); if (isThisNodeTheLeaderFor(greatestLearned)) { StillLeadingStatus leadingStatus = determineLeadershipStatus(greatestLearned); if (leadingStatus == StillLeadingStatus.LEADING) { log.info("Successfully became leader!"); return new PaxosLeadershipToken(greatestLearned); } else if (leadingStatus == StillLeadingStatus.NO_QUORUM) { long backoffTime = ThreadLocalRandom.current().nextLong(0, noQuorumMaxDelay + 1); log.debug("Waiting for ms before rerequesting leadership status", SafeArg.of("waitTimeMs", backoffTime)); Thread.sleep(backoffTime); continue; } } else { if (pingLeader()) { Thread.sleep(updatePollingRateInMs); continue; } } boolean learnedNewState = updateLearnedStateFromPeers(greatestLearned); if (learnedNewState) { continue; } long backoffTime = ThreadLocalRandom.current().nextLong(0, randomWaitBeforeProposingLeadership + 1); log.debug("Waiting for ms before proposing leadership", SafeArg.of("waitTimeMs", backoffTime)); Thread.sleep(backoffTime); proposeLeadershipAfter(greatestLearned); } }
Source:
private void processVmDevices(XmlRpcStruct vm) { int i = 0; if (vm == null || vm.getItem("vmId") == null) { log.errorFormat("Recieved NULL VM or VM id when processing VM devices, abort."); return; } Guid vmId = new Guid((String) vm.getItem("vmId")); HashSet<Guid> processedDevices = new HashSet<Guid>(); Object[] objects = (Object[]) vm.getItem("devices"); for (Object o : objects) { XmlRpcStruct device = new XmlRpcStruct((Map<String, Object>) o); Guid deviceId = getDeviceId(device); if ((device.getItem("address")) == null) { log.infoFormat("Recieved a Device without an address when processing VM devices, skipping device: {0}.", device.getInnerMap().toString()); continue; } VmDevice vmDevice = DbFacade.getInstance().getVmDeviceDAO().get(new VmDeviceId(deviceId, vmId)); if (deviceId == null || vmDevice == null) { deviceId = addNewVmDevice(vmId, device); } else { vmDevice.setAddress(((Map<String, String>) device.getItem("address")).toString()); DbFacade.getInstance().getVmDeviceDAO().update(vmDevice); } processedDevices.add(deviceId); } handleRemovedDevices(vmId, processedDevices); }

Target:
private void processVmDevices(XmlRpcStruct vm) { if (vm == null || vm.getItem("vmId") == null) { log.errorFormat("Recieved NULL VM or VM id when processing VM devices, abort."); return; } Guid vmId = new Guid((String) vm.getItem("vmId")); HashSet<Guid> processedDevices = new HashSet<Guid>(); Object[] objects = (Object[]) vm.getItem("devices"); for (Object o : objects) { XmlRpcStruct device = new XmlRpcStruct((Map<String, Object>) o); Guid deviceId = getDeviceId(device); if ((device.getItem("address")) == null) { log.infoFormat("Recieved a Device without an address when processing VM {0} devices, skipping device: {1}.", vmId, device.getInnerMap().toString()); continue; } VmDevice vmDevice = DbFacade.getInstance().getVmDeviceDAO().get(new VmDeviceId(deviceId, vmId)); if (deviceId == null || vmDevice == null) { deviceId = addNewVmDevice(vmId, device); } else { vmDevice.setAddress(((Map<String, String>) device.getItem("address")).toString()); addVmDeviceToList(vmDevice); } processedDevices.add(deviceId); } handleRemovedDevices(vmId, processedDevices); }
Source:
public void testRemoveIfUnsupportedOperation() { Collection<Integer> c = Arrays.asList(1, 2, 3, 4); try { c.removeIf(truth); fail(); } catch (UnsupportedOperationException expected) { } try { c.removeIf(falsity); } catch (Exception e) { fail(); } }

Target:
public void testRemoveIfUnsupportedOperation() { Collection<Integer> c = Arrays.asList(1, 2, 3, 4); try { c.removeIf(truth); fail(); } catch (UnsupportedOperationException expected) { } c.removeIf(falsity); }
Source:
AuthenticationResult acquireTokenWithBrokerSilent() throws AuthenticationException { mAuthRequest.setVersion(AuthenticationContext.getVersionName()); mAuthRequest.setBrokerAccountName(mAuthRequest.getLoginHint()); logBrokerVersion(); final AuthenticationResult authenticationResult; if (StringExtensions.isNullOrBlank(mAuthRequest.getBrokerAccountName()) && StringExtensions .isNullOrBlank(mAuthRequest.getUserId())) { Logger.v(TAG, "User is not specified, skipping background(silent) token request"); authenticationResult = null; } else { Logger.v(TAG, "User is specified for background(silent) token request, trying to acquire token silently."); authenticationResult = mBrokerProxy.getAuthTokenInBackground(mAuthRequest); } return authenticationResult; }

Target:
AuthenticationResult acquireTokenWithBrokerSilent() throws AuthenticationException { mAuthRequest.setVersion(AuthenticationContext.getVersionName()); mAuthRequest.setBrokerAccountName(mAuthRequest.getLoginHint()); logBrokerVersion(); final AuthenticationResult authenticationResult; if (!StringExtensions.isNullOrBlank(mAuthRequest.getBrokerAccountName()) || !StringExtensions .isNullOrBlank(mAuthRequest.getUserId())) { Logger.v(TAG, "User is specified for background(silent) token request, trying to acquire token silently."); authenticationResult = mBrokerProxy.getAuthTokenInBackground(mAuthRequest); } else { Logger.v(TAG, "User is not specified, skipping background(silent) token request"); authenticationResult = null; } return authenticationResult; }
Source:
private void validateOAuth2ClientConfig(ClientConfiguration clientConfiguration) { Assert.notNull(clientConfiguration.getClientId(), "clientId cannot be null"); Assert.isTrue(clientConfiguration.getScopes() != null && !clientConfiguration.getScopes().isEmpty(), "At least one scope is required"); String privateKey = clientConfiguration.getPrivateKey(); Assert.hasText(privateKey, "privateKey cannot be null (either PEM file path (or) full PEM content must be supplied)"); if (!(privateKey.startsWith("-----BEGIN PRIVATE KEY-----") && privateKey.contains("-----END PRIVATE KEY-----"))) { Path privateKeyPemFilePath = Paths.get(privateKey); boolean privateKeyPemFileExists = Files.exists(privateKeyPemFilePath, LinkOption.NOFOLLOW_LINKS); Assert.isTrue(privateKeyPemFileExists, "privateKey file does not exist"); } }

Target:
private void validateOAuth2ClientConfig(ClientConfiguration clientConfiguration) { Assert.notNull(clientConfiguration.getClientId(), "clientId cannot be null"); Assert.isTrue(clientConfiguration.getScopes() != null && !clientConfiguration.getScopes().isEmpty(), "At least one scope is required"); String privateKey = clientConfiguration.getPrivateKey(); Assert.hasText(privateKey, "privateKey cannot be null (either PEM file path (or) full PEM content must be supplied)"); if (!ConfigUtil.hasPrivateKeyContentWrapper(privateKey)) { Path privateKeyPemFilePath; try { privateKeyPemFilePath = Paths.get(privateKey); } catch (InvalidPathException ipe) { throw new IllegalArgumentException("Invalid privateKey file path", ipe); } boolean privateKeyPemFileExists = Files.exists(privateKeyPemFilePath, LinkOption.NOFOLLOW_LINKS); Assert.isTrue(privateKeyPemFileExists, "privateKey file does not exist"); } }
Source:
public int hashCode() { return Objects.hash(stream, partitionId, sequenceNumber, data); }

Target:
public int hashCode() { final int hashOfData = data.stream().map(Arrays::hashCode).collect(Collectors.toList()).hashCode(); return Objects.hash(stream, partitionId, sequenceNumber, hashOfData); }
Source:
public void finishedGeotagging(ArrayList<File> files) { FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragment_geotag_layout); if (fragment == null || !(fragment instanceof FinishGeoTagFragment)) { fragment = new FinishGeoTagFragment(); Bundle args = new Bundle(); args.putSerializable(GeoTagImagesService.EXTRA_GEOTAGGED_FILES, files); fragment.setArguments(args); fm.beginTransaction().replace(R.id.fragment_geotag_layout, fragment).commit(); } }

Target:
public void finishedGeotagging(ArrayList<File> files) { FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragment_geotag_layout); if (!(fragment instanceof FinishGeoTagFragment)) { fragment = new FinishGeoTagFragment(); Bundle args = new Bundle(); if (files != null && files.size() > 0) { args.putInt(NUM_IMAGE_FILES, files.size()); args.putString(PARENT_DIR, files.get(0).getParent()); } fragment.setArguments(args); fm.beginTransaction().replace(R.id.fragment_geotag_layout, fragment).commit(); } }
Source:
public static int compare(Number number, BigDecimal value, OptionalInt treatNanAs) { if ( number instanceof Double ) { return compare( (Double) number, value, treatNanAs ); } if ( number instanceof Float ) { return compare( (Float) number, value, treatNanAs ); } if ( number instanceof BigDecimal ) { return compare( (BigDecimal) number, value ); } if ( number instanceof BigInteger ) { return compare( (BigInteger) number, value ); } return BigDecimal.valueOf( number.longValue() ).compareTo( value ); }

Target:
public static int compare(Number number, BigDecimal value, OptionalInt treatNanAs) { if ( number instanceof Double ) { return compare( (Double) number, value, treatNanAs ); } if ( number instanceof Float ) { return compare( (Float) number, value, treatNanAs ); } if ( number instanceof BigDecimal ) { return compare( (BigDecimal) number, value ); } if ( number instanceof BigInteger ) { return compare( (BigInteger) number, value ); } if ( number instanceof Byte || number instanceof Integer || number instanceof Long || number instanceof Short ) { return compare( number.longValue(), value ); } return compare( number.doubleValue(), value, treatNanAs ); }
Source:
private void UpdateSpmPriority(Integer value) { List<EntityModel> items = new ArrayList<EntityModel>(); if (value == null) { value = defaultSpmPriority; } int neverValue = -1; EntityModel neverItem = new EntityModel("Never", neverValue); items.add(neverItem); int lowValue = defaultSpmPriority / 2; items.add(new EntityModel("Low", lowValue)); items.add(new EntityModel("Normal", defaultSpmPriority)); int highValue = defaultSpmPriority + (maxSpmPriority - defaultSpmPriority) / 2; items.add(new EntityModel("High", highValue)); EntityModel selectedItem = null; int[] values = new int[] { neverValue, lowValue, defaultSpmPriority, highValue, maxSpmPriority + 1 }; Integer prevValue = null; for (int i = 0; i < values.length; i++) { int currentValue = values[i]; if (value == currentValue) { selectedItem = items.get(i); break; } else if (prevValue != null && value > prevValue && value < currentValue) { EntityModel customItem = new EntityModel("Custom (" + value + ")", value); items.add(i, customItem); selectedItem = customItem; break; } prevValue = currentValue; } if (selectedItem != neverItem) { items.remove(neverItem); } getSpmPriority().setItems(items); getSpmPriority().setSelectedItem(selectedItem); }

Target:
private void UpdateSpmPriority(Integer value) { List<EntityModel> items = new ArrayList<EntityModel>(); if (value == null) { value = defaultSpmPriority; } int neverValue = -1; EntityModel neverItem = new EntityModel(constants.neverTitle(), neverValue); items.add(neverItem); int lowValue = defaultSpmPriority / 2; items.add(new EntityModel(constants.lowTitle(), lowValue)); items.add(new EntityModel(constants.normalTitle(), defaultSpmPriority)); int highValue = defaultSpmPriority + (maxSpmPriority - defaultSpmPriority) / 2; items.add(new EntityModel(constants.highTitle(), highValue)); EntityModel selectedItem = null; int[] values = new int[] { neverValue, lowValue, defaultSpmPriority, highValue, maxSpmPriority + 1 }; Integer prevValue = null; for (int i = 0; i < values.length; i++) { int currentValue = values[i]; if (value == currentValue) { selectedItem = items.get(i); break; } else if (prevValue != null && value > prevValue && value < currentValue) { EntityModel customItem = new EntityModel("Custom (" + value + ")", value); items.add(i, customItem); selectedItem = customItem; break; } prevValue = currentValue; } if (selectedItem != neverItem) { items.remove(neverItem); } getSpmPriority().setItems(items); getSpmPriority().setSelectedItem(selectedItem); }
Source:
public void shouldHandleEmptyListOfDiagnosesConceptSource() throws Exception { ConceptSource source = cs.getConceptSourceByName("ICD-10-WHO"); source.setName("foobar"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(0, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); MockHttpServletRequest getRequest = newGetRequest("/rest/emrapi/concept",new Parameter[]{new Parameter("term", "Diabetes"), new Parameter("limit", "100")}); @SuppressWarnings("unchecked") List<SimpleObject> response1 = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response1.size()); for(Map simpleObject : response1) Assert.assertNull(simpleObject.get("code")); source.setName("ICD-10-WHO"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(1, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); response1 = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response1.size()); for(Map simpleObject : response1) Assert.assertNotNull(simpleObject.get("code")); }

Target:
public void shouldHandleEmptyListOfDiagnosesConceptSource() throws Exception { ConceptSource source = cs.getConceptSourceByName("ICD-10-WHO"); source.setName("foobar"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(0, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); MockHttpServletRequest getRequest = newGetRequest("/rest/emrapi/concept",new Parameter[]{new Parameter("term", "Diabetes"), new Parameter("limit", "100")}); @SuppressWarnings("unchecked") List<SimpleObject> response = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response.size()); List<String> actualUuids = new ArrayList<String>(); for(Map simpleObject : response){ Assert.assertNull(simpleObject.get("code")); actualUuids.add((String) simpleObject.get("conceptUuid")); } source.setName("ICD-10-WHO"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(1, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); response = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response.size()); List<String> expectedUuids = new ArrayList<String>(); for(Map simpleObject : response){ Assert.assertNotNull(simpleObject.get("code")); expectedUuids.add((String) simpleObject.get("conceptUuid")); } Assert.assertArrayEquals(expectedUuids.toArray(), actualUuids.toArray()); }
Source:
public void testBOMWithCharBeforeProlog() throws Exception { HighlightingData firstHighlightingData = getFirstHighlightingData("bomCharBeforeProlog.xml"); assertTrue(firstHighlightingData.startOffset() == 1 || firstHighlightingData.startOffset() == 2); assertTrue(firstHighlightingData.endOffset() == 6 || firstHighlightingData.endOffset() == 7); assertTrue(TypeOfText.KEYWORD.equals(firstHighlightingData.highlightCode())); }

Target:
public void testBOMWithCharBeforeProlog() throws Exception { HighlightingData firstHighlightingData = getFirstHighlightingData("bomCharBeforeProlog.xml"); int expectedStartOffset = System.getProperty("os.name").contains("Windows") ? 2 : 1; int expectedEndOffset = System.getProperty("os.name").contains("Windows") ? 7 : 6; assertData(firstHighlightingData, expectedStartOffset, expectedEndOffset, TypeOfText.KEYWORD); }
Source:
public String unconvert(T[] array) { if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; Stream<Tuple<String, String>> unconverted = Arrays.stream(array).map(dfm::unconvertSeparated); List<String> results = TupleUtil.arrayLeftAndCombine(unconverted, listSep); return StringUtil.join(results, groupSep); } return Arrays.stream(array) .map(componentManager::unconvert) .collect(joining(listSep)); }

Target:
public String unconvert(T[] array) { if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; Stream<Tuple<String, String>> unconverted = Arrays.stream(array).map(dfm::unconvertSeparated); List<String> results = TupleUtil.arrayLeftAndCombine(unconverted, listSeparator); return StringUtil.join(results, groupSeparator); } return Arrays.stream(array) .map(componentManager::unconvert) .collect(joining(listSeparator)); }
Source:
public void deleteGroup() throws ESException { makeUserPA(); final ACOrgUnitId newUser = getSuperAdminBroker().createUser(getNewUsername()); final ACOrgUnitId group = getSuperAdminBroker().createGroup(getNewGroupName()); final ACOrgUnitId otherGroup = getSuperAdminBroker().createGroup(getNewOtherGroupName()); getAdminBroker().addMember(group, otherGroup); getAdminBroker().addMember(otherGroup, newUser); ProjectUtil.share(getUsersession(), getLocalProject()); final ProjectSpace clonedProjectSpace = cloneProjectSpace(getProjectSpace()); ProjectUtil.share(getSuperUsersession(), clonedProjectSpace.toAPI()); getAdminBroker().changeRole(getProjectSpace().getProjectId(), group, Roles.writer()); getAdminBroker().changeRole(getProjectSpace().getProjectId(), otherGroup, Roles.writer()); final int oldSize = getAdminBroker().getGroups().size(); getAdminBroker().deleteGroup(group); assertEquals(oldSize - 1, getAdminBroker().getGroups().size()); }

Target:
public void deleteGroup() throws ESException { makeUserPA(); final ACOrgUnitId newUser = getSuperAdminBroker().createUser(getNewUsername()); final ACOrgUnitId group = getSuperAdminBroker().createGroup(getNewGroupName()); final ACOrgUnitId otherGroup = getSuperAdminBroker().createGroup(getNewOtherGroupName()); getSuperAdminBroker().addMember(group, otherGroup); getSuperAdminBroker().addMember(otherGroup, newUser); ProjectUtil.share(getUsersession(), getLocalProject()); getSuperAdminBroker().changeRole(getProjectSpace().getProjectId(), group, Roles.writer()); final int oldSize = getSuperAdminBroker().getGroups().size(); getAdminBroker().deleteGroup(group); assertEquals(oldSize - 1, getSuperAdminBroker().getGroups().size()); assertEquals(oldSize - 2, getAdminBroker().getGroups().size()); }
Source:
public Conversions getConversion(Comparable<? extends Object> colIndex) { Conversions type = null; if (colIndex instanceof Double) { type = Conversions.DOUBLE; } else if (colIndex instanceof Integer) { type = Conversions.INTEGER; } else if (colIndex instanceof Float) { type = Conversions.FLOAT; } else if (colIndex instanceof Byte) { type = Conversions.BYTE; } else if (colIndex instanceof Short) { type = Conversions.SHORT; } else if (colIndex instanceof Long) { type = Conversions.LONG; } return type; }

Target:
private Conversions getConversion(Comparable<? extends Object> colIndex) { Conversions type = null; if (colIndex instanceof Double) { type = Conversions.DOUBLE; } else if (colIndex instanceof Integer) { type = Conversions.INTEGER; } else if (colIndex instanceof Float) { type = Conversions.FLOAT; } else if (colIndex instanceof Byte) { type = Conversions.BYTE; } else if (colIndex instanceof Short) { type = Conversions.SHORT; } else if (colIndex instanceof Long) { type = Conversions.LONG; } else { throw new IllegalArgumentException(); } return type; }
Source:
private static String getApiTokenVersion2(SharedPreferences prefs) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, UnrecoverableEntryException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return null; final KeyStore keyStore = getKeyStore(); final SecretKey key = (SecretKey) keyStore.getKey(KEYSTORE_WIGLE_CREDS_KEY_V2, null); final Cipher decrypt = Cipher.getInstance(AES_CIPHER); final byte[] cypherToken = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN, ""), Base64.DEFAULT); final byte[] iv = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN_IV, ""), Base64.DEFAULT); final int tagLength = prefs.getInt(ListFragment.PREF_TOKEN_TAG_LENGTH, 128); decrypt.init(Cipher.DECRYPT_MODE, key, new GCMParameterSpec(tagLength, iv) ); final byte[] done = decrypt.doFinal(cypherToken); final String token = new String(done, UTF8); MainActivity.info("[TOKEN] aes decrypted token length: " + token.length()); return token; }

Target:
private static String getApiTokenVersion2(SharedPreferences prefs) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, UnrecoverableEntryException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { MainActivity.warn("[TOKEN] getApiTokenVersion2 sdk not M+: " + Build.VERSION.SDK_INT); return null; } else { final KeyStore keyStore = getKeyStore(); final SecretKey key = (SecretKey) keyStore.getKey(KEYSTORE_WIGLE_CREDS_KEY_V2, null); final Cipher decrypt = Cipher.getInstance(AES_CIPHER); final byte[] cypherToken = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN, ""), Base64.DEFAULT); final byte[] iv = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN_IV, ""), Base64.DEFAULT); final int tagLength = prefs.getInt(ListFragment.PREF_TOKEN_TAG_LENGTH, 128); decrypt.init(Cipher.DECRYPT_MODE, key, new GCMParameterSpec(tagLength, iv)); final byte[] done = decrypt.doFinal(cypherToken); final String token = new String(done, UTF8); MainActivity.info("[TOKEN] aes decrypted token length: " + token.length()); return token; } }
Source:
public void testStartEffect() { PlayerFish pf = pu.getTarget(); double oldAcceleration = pf.getAcceleration(); double oldMaxSpeed = pf.getMaxSpeed(); pu.startEffect(); assertEquals(oldAcceleration * PuSuperSpeed.ACCELERATION_FACTOR, pf.getAcceleration(), 0.0000001D); assertEquals(oldMaxSpeed * PuSuperSpeed.MAX_SPEED_FACTOR, pf.getMaxSpeed(), 0.0000001D); }

Target:
public void testStartEffect() { PlayerFish pf = pu.getTarget(); double oldAcceleration = pf.getAcceleration(); double oldMaxSpeed = pf.getMaxSpeed(); pu.startEffect(); assertEquals(oldAcceleration * PuSuperSpeed.ACCELERATION_FACTOR, pf.getAcceleration(), DELTA); assertEquals(oldMaxSpeed * PuSuperSpeed.MAX_SPEED_FACTOR, pf.getMaxSpeed(), DELTA); }
Source:
public void testE2() { try { T_const_class_7 t = new T_const_class_7(); t.run(); fail("expected a IllegalAccessError exception"); } catch (IllegalAccessError e) { } }

Target:
public void testE2() { try { T_const_class_7 t = new T_const_class_7(); t.run(); fail("expected an IllegalAccessError exception"); } catch (IllegalAccessError e) { } }
Source:
public IdToken idTokenWithAudience(String targetAudience, List<IdTokenProvider.Option> options) throws IOException { boolean includeEmail = false; if (options != null) if (options.contains(IdTokenProvider.Option.INCLUDE_EMAIL)) includeEmail = true; return IamUtils.getIdToken(getAccount(), sourceCredentials, transportFactory.create(), targetAudience, includeEmail, ImmutableMap.of("delegates", this.delegates)); }

Target:
public IdToken idTokenWithAudience(String targetAudience, List<IdTokenProvider.Option> options) throws IOException { boolean includeEmail = options != null && options.contains(IdTokenProvider.Option.INCLUDE_EMAIL); return IamUtils.getIdToken( getAccount(), sourceCredentials, transportFactory.create(), targetAudience, includeEmail, ImmutableMap.of("delegates", this.delegates)); }
Source:
public String getStartupNotifications() { this.configCommands.triggerTarget(); super.setPromptPath(null); final StringBuilder sb = new StringBuilder(); if (targetHolder.getTarget().getTargetException() != null && StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append("WARNING - During targeting we encountered a problem:" + System.lineSeparator()) .append("\"" + targetHolder.getTarget().getTargetResultMessage() + "\"" + System.lineSeparator()) .append("Please double check your startup parameters and either restart the " + "Data Flow Shell or target the Data Flow Server using the " + "'dataflow config server' command." + System.lineSeparator() + System.lineSeparator()); } else if (StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append(targetHolder.getTarget().getTargetResultMessage()); } return sb.toString(); }

Target:
public String getStartupNotifications() { this.configCommands.triggerTarget(); super.setPromptPath(null); final StringBuilder sb = new StringBuilder(); if (targetHolder.getTarget().getTargetException() != null && StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append("WARNING - Problem connecting to the Spring Cloud Data Flow Server:" + System.lineSeparator()) .append("\"" + targetHolder.getTarget().getTargetResultMessage() + "\"" + System.lineSeparator()) .append("Please double check your startup parameters and either restart the " + "Data Flow Shell (with any missing configuration including security etc.) " + "or target the Data Flow Server using the " + "'dataflow config server' command." + System.lineSeparator() + System.lineSeparator()); } else if (StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append(targetHolder.getTarget().getTargetResultMessage()); } return sb.toString(); }
Source:
public void test() throws Exception { javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager .transactionManager(); tm.begin(); javax.transaction.Transaction theTransaction = tm.getTransaction(); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(false))); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(true))); tm.rollback(); }

Target:
public void test() throws Exception { ORB myORB = ORB.getInstance("test"); RootOA myOA = OA.getRootOA(myORB); myORB.initORB(new String[] {}, null); myOA.initOA(); ORBManager.setORB(myORB); ORBManager.setPOA(myOA); jtaPropertyManager.getJTAEnvironmentBean().setTransactionManagerClassName(com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.class.getName()); jtaPropertyManager.getJTAEnvironmentBean().setUserTransactionClassName(com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple.class.getName()); javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager(); tm.begin(); javax.transaction.Transaction theTransaction = tm.getTransaction(); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(false))); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(true))); tm.rollback(); myOA.destroy(); myORB.shutdown(); }
Source:
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { GithubSecurityRealm realm = new GithubSecurityRealm(); String node; String value; while (reader.hasMoreChildren()) { reader.moveDown(); node = reader.getNodeName(); value = reader.getValue(); setValue(realm, node, value); reader.moveUp(); } if (realm.getGithubWebUri() == null) { realm.setGithubWebUri(DEFAULT_WEB_URI); } if (realm.getGithubApiUri() == null) { realm.setGithubApiUri(DEFAULT_API_URI); } return realm; }

Target:
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { GithubSecurityRealm realm = new GithubSecurityRealm(); String node; String value; while (reader.hasMoreChildren()) { reader.moveDown(); node = reader.getNodeName(); value = reader.getValue(); setValue(realm, node, value); reader.moveUp(); } if (realm.getGithubWebUri() == null) { realm.setGithubWebUri(DEFAULT_WEB_URI); } if (realm.getGithubApiUri() == null) { realm.setGithubApiUri(DEFAULT_API_URI); } if (realm.getForceGithubEmail() == null) { realm.setForceGithubEmail(DEFAULT_FORCE_GITHUB_EMAIL); } return realm; }
Source:
private static void usageError() { System.err.println("Usage: psql [-t table-name] [-h comma-separated-column-names | in-line] [-d field-delimiter-char quote-char escape-char]<zookeeper> <path-to-sql-or-csv-file>...\n" + " By default, the name of the CSV file is used to determine the Phoenix table into which the CSV data is loaded\n" + " and the ordinal value of the columns determines the mapping.\n" + " -t overrides the table into which the CSV data is loaded\n" + " -h overrides the column names to which the CSV data maps\n" + " A special value of in-line indicating that the first line of the CSV file\n" + " determines the column to which the data maps.\n" + " -s uses strict mode by throwing an exception if a column name doesn't match during CSV loading.\n" + " -d uses custom delimiters for CSV loader, need to specify single char for field delimiter, phrase delimiter, and escape char.\n" + " number is NOT usually a delimiter and shall be taken as 1 -> ctrl A, 2 -> ctrl B ... 9 -> ctrl I. \n" + "Examples:\n" + " psql localhost my_ddl.sql\n" + " psql localhost my_ddl.sql my_table.csv\n" + " psql my_cluster:1825 -t my_table my_table2012-Q3.csv\n" + " psql my_cluster -t my_table -h col1,col2,col3 my_table2012-Q3.csv\n" ); System.exit(-1); }

Target:
private static void usageError() { System.err.println("Usage: psql [-t table-name] [-h comma-separated-column-names | in-line] [-d field-delimiter-char quote-char escape-char]<zookeeper> <path-to-sql-or-csv-file>...\n" + " By default, the name of the CSV file is used to determine the Phoenix table into which the CSV data is loaded\n" + " and the ordinal value of the columns determines the mapping.\n" + " -t overrides the table into which the CSV data is loaded\n" + " -h overrides the column names to which the CSV data maps\n" + " A special value of in-line indicating that the first line of the CSV file\n" + " determines the column to which the data maps.\n" + " -s uses strict mode by throwing an exception if a column name doesn't match during CSV loading.\n" + " -d uses custom delimiters for CSV loader, need to specify single char for field delimiter, phrase delimiter, and escape char.\n" + " number is NOT usually a delimiter and shall be taken as 1 -> ctrl A, 2 -> ctrl B ... 9 -> ctrl I. \n" + "Examples:\n" + " psql localhost my_ddl.sql\n" + " psql localhost my_ddl.sql my_table.csv\n" + " psql -t my_table my_cluster:1825 my_table2012-Q3.csv\n" + " psql -t my_table -h col1,col2,col3 my_cluster:1825 my_table2012-Q3.csv\n" + " psql -t my_table -h col1,col2,col3 -d 1 2 3 my_cluster:1825 my_table2012-Q3.csv\n" ); System.exit(-1); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof AuditLog)) { return false; } AuditLog other = (AuditLog) obj; return auditLogId == other.auditLogId && Objects.equals(logTime, other.logTime) && logType == other.logType && Objects.equals(message, other.message) && Objects.equals(storageDomainId, other.storageDomainId) && Objects.equals(storagePoolId, other.storagePoolId) && severity == other.severity && Objects.equals(userId, other.userId) && Objects.equals(vdsId, other.vdsId) && Objects.equals(quotaId, other.quotaId) && Objects.equals(vmId, other.vmId) && Objects.equals(vmTemplateId, other.vmTemplateId) && processed == other.processed && Objects.equals(correlationId, other.correlationId) && Objects.equals(jobId, other.jobId) && Objects.equals(origin, other.origin) && customId == other.customId && customEventId == other.customEventId && eventFloodInSec == other.eventFloodInSec && Objects.equals(customData, other.customData) && external == other.external && deleted == other.deleted && Objects.equals(callStack, other.callStack); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof AuditLog)) { return false; } AuditLog other = (AuditLog) obj; return auditLogId == other.auditLogId && Objects.equals(logTime, other.logTime) && logType == other.logType && Objects.equals(message, other.message) && Objects.equals(storageDomainId, other.storageDomainId) && Objects.equals(storagePoolId, other.storagePoolId) && severity == other.severity && Objects.equals(userId, other.userId) && Objects.equals(vdsId, other.vdsId) && Objects.equals(quotaId, other.quotaId) && Objects.equals(vmId, other.vmId) && Objects.equals(vmTemplateId, other.vmTemplateId) && processed == other.processed && Objects.equals(correlationId, other.correlationId) && Objects.equals(jobId, other.jobId) && Objects.equals(origin, other.origin) && Objects.equals(customId, other.customId) && customEventId == other.customEventId && eventFloodInSec == other.eventFloodInSec && Objects.equals(customData, other.customData) && external == other.external && deleted == other.deleted && Objects.equals(callStack, other.callStack); }
Source:
public void stop(ComponentContext context) throws InterruptedException { setFailure(); }

Target:
public void stop(ComponentContext context) { setFailure(); }
Source:
public void testGetDeployment() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(jsonResponse("/createdeploymentsucceeded.json")); Deployment deployment = deploymentApi.get(deploymentName); assertTrue(deployment != null); assertEquals(ProvisioningState.fromValue(deployment.properties().provisioningState()), ProvisioningState.SUCCEEDED); }

Target:
public void testGetDeployment() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(jsonResponse("/createdeploymentsucceeded.json")); Deployment deployment = deploymentApi.get(deploymentName); assertTrue(deployment != null); assertEquals(ProvisioningState.fromValue(deployment.properties().provisioningState()), ProvisioningState.SUCCEEDED); assertSent(server, "GET", "/subscriptions/" + subscriptionId + "/resourcegroups/" + resourceGroup + "/providers/microsoft.resources/deployments/" + deploymentName + "?api-version=2016-02-01"); }
Source:
public Builder setClass(Class utilClass) { this.utilClass = utilClass; return this; }

Target:
public Builder setClass(Class utilClass) { this.targetClass = checkNotNull(utilClass); return this; }
Source:
protected boolean doFilter(ScoredCandidate<T> candidate, T subject, ResultDescription desc) { ImmutableList<Long> excludedIds = excludedUris.stream() .filter(id -> !id.contains("http")) .map(id -> codec.decode(id).longValue()) .collect(MoreCollectors.toImmutableList()); boolean result = !excludedUris.contains(candidate.candidate().getCanonicalUri()) && !excludedIds.contains(candidate.candidate().getId()); if (!result) { desc.appendText("%s removed as contained in exclusion list", candidate.candidate().getCanonicalUri()); } return result; }

Target:
protected boolean doFilter(ScoredCandidate<T> candidate, T subject, ResultDescription desc) { ImmutableList<Long> excludedDecodedIds = excludedIds.stream() .map(id -> codec.decode(id).longValue()) .collect(MoreCollectors.toImmutableList()); boolean result = !excludedUris.contains(candidate.candidate().getCanonicalUri()) && !excludedDecodedIds.contains(candidate.candidate().getId()); if (!result) { desc.appendText("%s removed as contained in exclusion list", candidate.candidate().getCanonicalUri()); } return result; }
Source:
private static Benchmark run(String name, StarlarkFunction f, long budgetNanos) { Mutability mu = Mutability.create("test"); StarlarkThread thread = new StarlarkThread(mu, semantics); Benchmark b = new Benchmark(); for (b.n = 1; b.time < budgetNanos && (b.n << 1) > b.n; b.n <<= 1) { try { b.start(thread); Starlark.fastcall(thread, f, new Object[] {b}, new Object[0]); b.stop(thread); } catch (EvalException ex) { System.err.println(ex.getMessageWithStack()); return null; } catch ( @SuppressWarnings("InterruptedExceptionSwallowed") Throwable ex) { System.err.printf("In %s: %s\n", name, ex.getMessage()); ex.printStackTrace(); return null; } } return b; }

Target:
private static Benchmark run(String name, StarlarkFunction f, long budgetNanos) { Mutability mu = Mutability.create("test"); StarlarkThread thread = new StarlarkThread(mu, semantics); Benchmark b = new Benchmark(); for (b.n = 1; b.time < budgetNanos; b.n <<= 1) { if (b.n <= 0) { System.err.printf("In %s: bench is too fast, likely a loop over `range(b.n)` is missing", name); return null; } try { b.start(thread); Starlark.fastcall(thread, f, new Object[] {b}, new Object[0]); b.stop(thread); } catch (EvalException ex) { System.err.println(ex.getMessageWithStack()); return null; } catch ( @SuppressWarnings("InterruptedExceptionSwallowed") Throwable ex) { System.err.printf("In %s: %s\n", name, ex.getMessage()); ex.printStackTrace(); return null; } } return b; }
Source:
private static String getPostCode3(byte[] bytes) { return String.valueOf( new char[] { SETS[0].charAt(getInt(bytes, new byte[] {39, 40, 41, 42, 31, 32})), SETS[0].charAt(getInt(bytes, new byte[] {33, 34, 35, 36, 25, 26})), SETS[0].charAt(getInt(bytes, new byte[] {27, 28, 29, 30, 19, 20})), SETS[0].charAt(getInt(bytes, new byte[] {21, 22, 23, 24, 13, 14})), SETS[0].charAt(getInt(bytes, new byte[] {15, 16, 17, 18, 7, 8})), SETS[0].charAt(getInt(bytes, new byte[] { 9, 10, 11, 12, 1, 2})) } ); }

Target:
private static String getPostCode3(byte[] bytes) { return String.valueOf( new char[] { SETS[0].charAt(getInt(bytes, new byte[] {39, 40, 41, 42, 31, 32})), SETS[0].charAt(getInt(bytes, new byte[] {33, 34, 35, 36, 25, 26})), SETS[0].charAt(getInt(bytes, new byte[] {27, 28, 29, 30, 19, 20})), SETS[0].charAt(getInt(bytes, new byte[] {21, 22, 23, 24, 13, 14})), SETS[0].charAt(getInt(bytes, new byte[] {15, 16, 17, 18, 7, 8})), SETS[0].charAt(getInt(bytes, new byte[] { 9, 10, 11, 12, 1, 2})), } ); }
Source:
protected void checkBundles(DistributionSnapshot snapshot, boolean partial) throws IOException { List<String> bids = snapshot.getBundleIds(); StringBuilder sb = new StringBuilder(); bids.forEach(bid -> sb.append(represent(snapshot.getBundle(bid)))); if (partial) { checkContentEquals("apidoc_snapshot/bundles_partial.txt", sb.toString()); } else { checkContentEquals("apidoc_snapshot/bundles.txt", sb.toString()); } }

Target:
protected void checkBundles(DistributionSnapshot snapshot, boolean partial) throws IOException { List<String> bids = snapshot.getBundleIds(); String s = bids.stream().map(snapshot::getBundle).map(this::represent).collect(Collectors.joining()); if (partial) { checkContentEquals("apidoc_snapshot/bundles_partial.txt", s); } else { checkContentEquals("apidoc_snapshot/bundles.txt", s); } }
Source:
public String toString() { return "Tag{" + "id='" + id + '\'' + ", value='" + user + '\'' + ", hashtag='" + hashtag + '\'' + '}'; }

Target:
public String toString() { return "InstaPost{" + "id='" + id + '\'' + ", user='" + user + '\'' + ", hashtag='" + hashtag + '\'' + '}'; }
Source:
private long getContentLength(ClientLogger logger, HttpHeaders headers) { long contentLength = 0; try { contentLength = Long.parseLong(headers.getValue("content-length")); } catch (NumberFormatException | NullPointerException ignored) { logger.warning("Http logging cannot parse the content-length: " + headers.getValue("content-length")); } return contentLength; }

Target:
private long getContentLength(ClientLogger logger, HttpHeaders headers) { long contentLength = 0; try { contentLength = Long.parseLong(headers.getValue("content-length")); } catch (NumberFormatException | NullPointerException e) { logger.warning("Could not parse the HTTP header content-length: '{}'.", headers.getValue("content-length"), e); } return contentLength; }
Source:
private boolean validateLine(byte[] line, int lineStart, int lineEnd) { for (; lineStart < lineEnd; lineStart++) { if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) { return false; } for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= 1); utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) { return false; } if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) { return false; } } } return true; }

Target:
private boolean validateLine(byte[] line, int lineStart, int lineEnd) { for (; lineStart < lineEnd; lineStart++) { if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) { return false; } for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= 1) {}; utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) { return false; } if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) { return false; } } } return true; }
Source:
default void sendMessages(Text... messages) { for (Text message : messages) { this.sendMessage(message); } }

Target:
default void sendMessages(Text... messages) { checkNotNull(messages, "messages"); checkArgument(messages.length > 0, "empty array of messages"); for (Text message : messages) { this.sendMessage(message); } }
Source:
public int updateAnnouncement(final Announcement announcement) { LOG.debug("update announcement"); final SqlSession session = factory.openSession(); int updateId = -1; try { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); updateId = mapper.updateAnnouncement(announcement); session.commit(); } catch (Exception e) { throw new RuntimeException("Failed to update announcement", e); } finally { session.close(); } return updateId; }

Target:
public int updateAnnouncement(final Announcement announcement) { int updateId = -1; try (final SqlSession session = factory.openSession()) { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); updateId = mapper.updateAnnouncement(announcement); return updateId; } catch (Exception e) { throw new ServiceRuntimeException("Failed to update announcements", e); } }
Source:
private void performSave(final IEditorPart editor) { EditorHandler.getInstance().activate(editor); System.out.println("My Saving editor"); Display.asyncExec(new Runnable() { @Override public void run() { editor.doSave(new NullProgressMonitor()); } }); new WaitUntil(new WaitCondition() { @Override public boolean test() { return !editor.isDirty(); } @Override public String errorMessage() { return "Could not save the editor"; } @Override public String description() { return " editor is not dirty..."; } }, TimePeriod.SHORT); }

Target:
private void performSave(final IEditorPart editor) { EditorHandler.getInstance().activate(editor); Display.asyncExec(new Runnable() { @Override public void run() { editor.doSave(new NullProgressMonitor()); } }); new WaitUntil(new WaitCondition() { @Override public boolean test() { return !editor.isDirty(); } @Override public String errorMessage() { return "Could not save the editor"; } @Override public String description() { return " editor is not dirty..."; } }, TimePeriod.SHORT); }
Source:
void run(final ReviewDb db) throws OrmException { if (commands == null) { return; } try { final Connection c = ((JdbcSchema) db).getConnection(); final Statement stmt = c.createStatement(); try { for (String sql : commands) { try { stmt.execute(sql); } catch (SQLException e) { throw new OrmException("Error in " + name + ":\n" + sql, e); } } } finally { stmt.close(); } } catch (SQLException e) { throw new OrmException("Cannot run statements for " + name, e); } }

Target:
void run(final ReviewDb db) throws OrmException { try { final Connection c = ((JdbcSchema) db).getConnection(); final Statement stmt = c.createStatement(); try { for (String sql : commands) { try { stmt.execute(sql); } catch (SQLException e) { throw new OrmException("Error in " + name + ":\n" + sql, e); } } } finally { stmt.close(); } } catch (SQLException e) { throw new OrmException("Cannot run statements for " + name, e); } }
Source:
ActionConfigurationBuilder() { }

Target:
private ActionConfigurationBuilder() { }
Source:
public BotConfigDialog(JFrame parent, BotClient existingBot) { this(parent, new HashSet<IPlayer>()); if(existingBot instanceof Princess) { this.princessBehavior = ((Princess) existingBot).getBehaviorSettings(); nameField.setText(existingBot.getName()); setPrincessFields(); } }

Target:
public BotConfigDialog(JFrame parent, BotClient existingBot) { this(parent, new HashSet<>()); if (existingBot instanceof Princess) { this.princessBehavior = ((Princess) existingBot).getBehaviorSettings(); nameField.setText(existingBot.getName()); setPrincessFields(); } }
Source:
public String[] cutUri (URI uri) throws NullPointerException, IllegalArgumentException { String path = uri.getPath(); String[] result = path.split("/"); if (result.length < 2) { throw new IllegalArgumentException(); } for (int i = 1; i < result.length; i++){ if (result[i] == null) { throw new NullPointerException(); } } return result; }

Target:
public String[] cutUri(URI uri) throws IllegalArgumentException { String path = uri.getPath(); String[] result = path.split("/"); if (result.length < 2) { throw new IllegalArgumentException("there is neither ContainerName nor BlobName in the URI path"); } return result; }
Source:
public InformationDialog build() { final InformationDialog dialog = new InformationDialog(); dialog.initOwner(owner); dialog.setTitle(title); dialog.setHeaderText(title); dialog.setContentText(message); dialog.setResizable(resizable); dialog.getDialogPane().getChildren().stream() .filter(node -> node instanceof Label) .map(node -> (Label) node) .forEach(label -> label.setMinHeight(Region.USE_PREF_SIZE)); return dialog; }

Target:
public InformationDialog build() { final InformationDialog dialog = new InformationDialog(); dialog.initOwner(owner); dialog.setTitle(title); dialog.setHeaderText(title); dialog.setContentText(message); dialog.setResizable(resizable); dialog.getDialogPane().setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); return dialog; }
Source:
private RuntimeException requestFailedException(String task, Request request, JsonResponse<QueryResults> response) { state.compareAndSet(State.RUNNING, State.COMMUNICATION_FAILURE); if (!response.hasValue()) { if (response.getStatusCode() == HTTP_UNAUTHORIZED) { return new ClientException("Authentication failed" + Optional.ofNullable(response.getStatusMessage()) .map(message -> ": " + message) .orElse("")); } return new RuntimeException( format("Error %s at %s returned an invalid response: %s [Error: %s]", task, request.url(), response, response.getResponseBody()), response.getException()); } return new RuntimeException(format("Error %s at %s returned HTTP %s", task, request.url(), response.getStatusCode())); }

Target:
private RuntimeException requestFailedException(String task, Request request, JsonResponse<QueryResults> response) { if (!response.hasValue()) { if (response.getStatusCode() == HTTP_UNAUTHORIZED) { return new ClientException("Authentication failed" + Optional.ofNullable(response.getStatusMessage()) .map(message -> ": " + message) .orElse("")); } return new RuntimeException( format("Error %s at %s returned an invalid response: %s [Error: %s]", task, request.url(), response, response.getResponseBody()), response.getException()); } return new RuntimeException(format("Error %s at %s returned HTTP %s", task, request.url(), response.getStatusCode())); }