auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init(GraphHopperConfig ghConfig) { if (ghConfig.has("prepare.lm.weightings")) { throw new IllegalStateException("Use profiles_lm instead of prepare.lm.weightings"); } setPreparationThreads(ghConfig.getInt(Parameters.Landmark.PREPARE + "threads", getPreparationThreads())); setDisablingAllowed(ghConfig.getBool(Landmark.INIT_DISABLING_ALLOWED, isDisablingAllowed())); setLMProfileConfigs(ghConfig.getLMProfiles()); landmarkCount = ghConfig.getInt(Parameters.Landmark.COUNT, landmarkCount); activeLandmarkCount = ghConfig.getInt(Landmark.ACTIVE_COUNT_DEFAULT, Math.min(8, landmarkCount)); logDetails = ghConfig.getBool(Landmark.PREPARE + "log_details", false); minNodes = ghConfig.getInt(Landmark.PREPARE + "min_network_size", -1); for (String loc : ghConfig.get(Landmark.PREPARE + "suggestions_location", "").split(",")) { if (!loc.trim().isEmpty()) lmSuggestionsLocations.add(loc.trim()); } }

Target:
public void init(GraphHopperConfig ghConfig) { if (ghConfig.has("prepare.lm.weightings")) { throw new IllegalStateException("Use profiles_lm instead of prepare.lm.weightings, see #1922"); } setPreparationThreads(ghConfig.getInt(Parameters.Landmark.PREPARE + "threads", getPreparationThreads())); setDisablingAllowed(ghConfig.getBool(Landmark.INIT_DISABLING_ALLOWED, isDisablingAllowed())); setLMProfileConfigs(ghConfig.getLMProfiles()); landmarkCount = ghConfig.getInt(Parameters.Landmark.COUNT, landmarkCount); activeLandmarkCount = ghConfig.getInt(Landmark.ACTIVE_COUNT_DEFAULT, Math.min(8, landmarkCount)); if (activeLandmarkCount > landmarkCount) throw new IllegalArgumentException("Default value for active landmarks " + activeLandmarkCount + " should be less or equal to landmark count of " + landmarkCount); logDetails = ghConfig.getBool(Landmark.PREPARE + "log_details", false); minNodes = ghConfig.getInt(Landmark.PREPARE + "min_network_size", -1); for (String loc : ghConfig.get(Landmark.PREPARE + "suggestions_location", "").split(",")) { if (!loc.trim().isEmpty()) lmSuggestionsLocations.add(loc.trim()); } }
Source:
LRESULT WM_CHAR (long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.WM_CHAR (wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection(); String text = getText(); int x = selection.x; int y = selection.y; if (x == y) { String actText = text.substring (0, getCaretPosition()); java.util.regex.Matcher m = CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (handle, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (handle, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } if ((style & SWT.SINGLE) != 0) { switch ((int) wParam) { case SWT.CR: sendSelectionEvent (SWT.DefaultSelection); case SWT.TAB: case SWT.ESC: return LRESULT.ZERO; } } return result; }

Target:
LRESULT WM_CHAR (long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.WM_CHAR (wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection (); int x = selection.x; int y = selection.y; if (x == y) { String actText = getText ().substring (0, getCaretPosition()); java.util.regex.Matcher m = CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (handle, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (handle, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } if ((style & SWT.SINGLE) != 0) { switch ((int) wParam) { case SWT.CR: sendSelectionEvent (SWT.DefaultSelection); case SWT.TAB: case SWT.ESC: return LRESULT.ZERO; } } return result; }
Source:
private String buildTailApiUrl(String tailApiUrl) { if (!isMethodWithBody() && !args.isEmpty()) { try { boolean questionMarkFound = tailApiUrl.indexOf('?') != -1; StringBuilder argString = new StringBuilder(); argString.append(questionMarkFound ? '&' : '?'); for (Iterator<Entry> it = args.listIterator(); it.hasNext();) { Entry arg = it.next(); argString.append(URLEncoder.encode(arg.key, "UTF-8")); argString.append('='); argString.append(URLEncoder.encode(arg.value.toString(), "UTF-8")); if (it.hasNext()) { argString.append('&'); } } tailApiUrl += argString; } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } } return tailApiUrl; }

Target:
private String buildTailApiUrl(String tailApiUrl) { if (!isMethodWithBody() && !args.isEmpty()) { try { boolean questionMarkFound = tailApiUrl.indexOf('?') != -1; StringBuilder argString = new StringBuilder(); argString.append(questionMarkFound ? '&' : '?'); for (Iterator<Entry> it = args.listIterator(); it.hasNext();) { Entry arg = it.next(); argString.append(URLEncoder.encode(arg.key, StandardCharsets.UTF_8.name())); argString.append('='); argString.append(URLEncoder.encode(arg.value.toString(), StandardCharsets.UTF_8.name())); if (it.hasNext()) { argString.append('&'); } } tailApiUrl += argString; } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } } return tailApiUrl; }
Source:
public static NotificationCompat.Builder setSecretVisibility(NotificationCompat.Builder builder) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return builder.setVisibility(Notification.VISIBILITY_SECRET).setPriority(Notification.PRIORITY_MIN); } return builder; }

Target:
public static NotificationCompat.Builder setSecretVisibility(NotificationCompat.Builder builder) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return builder.setVisibility(Notification.VISIBILITY_SECRET); } return builder; }
Source:
protected void readInternal() throws IOException, CorruptObjectException { if (liveFile == null) throw new IOException(JGitText.get().dirCacheDoesNotHaveABackingFile); if (!liveFile.exists()) clearInternal(); else if (liveFile.lastModified() != lastModified) { try { System.out.println("Reading DirCache"); final FileInputStream inStream = new FileInputStream(liveFile); try { clearInternal(); readFrom(inStream); } finally { try { inStream.close(); } catch (IOException err2) { } } } catch (FileNotFoundException fnfe) { clearInternal(); } } }

Target:
protected void readInternal() throws IOException, CorruptObjectException { if (liveFile == null) throw new IOException(JGitText.get().dirCacheDoesNotHaveABackingFile); if (!liveFile.exists()) clearInternal(); else if (liveFile.lastModified() != lastModified) { try { final FileInputStream inStream = new FileInputStream(liveFile); try { clearInternal(); readFrom(inStream); } finally { try { inStream.close(); } catch (IOException err2) { } } } catch (FileNotFoundException fnfe) { clearInternal(); } } }
Source:
private void verifyLoginFailed(String username, String password) { events.clear(); loginPage.open(); loginPage.login(username, password); Assert.assertEquals("Invalid username or password.", loginPage.getError()); if (username.equals(DEFAULT_TEST_USERS.get("INVALID_USER_EMAIL")) || username.equals(DEFAULT_TEST_USERS.get("INVALID_USER_NAME"))) { events.expect(EventType.LOGIN_ERROR).user((String) null).error("user_not_found").assertEvent(); } else if (username.equals(DEFAULT_TEST_USERS.get("VALID_USER_EMAIL")) || username.equals(DEFAULT_TEST_USERS.get("VALID_USER_NAME"))) { List<UserRepresentation> knownUsers = getAdminClient().realm(TEST_REALM_NAME).users().search(DEFAULT_TEST_USERS.get("VALID_USER_NAME")); Assert.assertTrue(!knownUsers.isEmpty()); final String userId = knownUsers.get(0).getId(); events.expect(EventType.LOGIN_ERROR).user(userId).error("invalid_user_credentials").assertEvent(); } }

Target:
private void verifyLoginFailed(String username, String password) { events.clear(); loginPage.open(); loginPage.login(username, password); Assert.assertEquals("Invalid username or password.", loginPage.getError()); if (username.equals(DEFAULT_TEST_USERS.get("INVALID_USER_EMAIL")) || username.equals(DEFAULT_TEST_USERS.get("INVALID_USER_NAME"))) { events.expect(EventType.LOGIN_ERROR).user((String) null).error(Errors.USER_NOT_FOUND).assertEvent(); } else if (username.equals(DEFAULT_TEST_USERS.get("VALID_USER_EMAIL")) || username.equals(DEFAULT_TEST_USERS.get("VALID_USER_NAME"))) { List<UserRepresentation> knownUsers = getAdminClient().realm(TEST_REALM_NAME).users().search(DEFAULT_TEST_USERS.get("VALID_USER_NAME")); Assert.assertTrue(!knownUsers.isEmpty()); final String userId = knownUsers.get(0).getId(); events.expect(EventType.LOGIN_ERROR).user(userId).error(Errors.INVALID_USER_CREDENTIALS).assertEvent(); } }
Source:
public final String consoleClientResourcesUrl() { String url = getString(DynamicMessageKey.CONSOLE_CLIENT_RESOURCES_URL); boolean isAbsolute = url.contains("://"); return isAbsolute ? url : Window.Location.getProtocol() + " "/" + BaseContextPathData.getInstance().getRelativePath() + url; }

Target:
public final String consoleClientResourcesUrl() { String url = getString(DynamicMessageKey.CONSOLE_CLIENT_RESOURCES_URL); boolean isAbsolute = url.contains("://"); return isAbsolute ? url : "/" + BaseContextPathData.getInstance().getRelativePath() + url; }
Source:
protected void showCreateContactDialog(final String prefilledJid, final Invite invite) { EnterJidDialog dialog = new EnterJidDialog( this, mKnownHosts, mActivatedAccounts, getString(R.string.dialog_title_create_contact), getString(R.string.create), prefilledJid, null, invite == null || !invite.hasFingerprints() ); dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> { if (!xmppConnectionServiceBound) { return false; } final Account account = xmppConnectionService.findAccountByJid(accountJid); if (account == null) { return true; } final Contact contact = account.getRoster().getContact(contactJid); if (invite.getName() != null) contact.setServerName(invite.getName()); if (contact.isSelf()) { switchToConversation(contact,null); return true; } else if (contact.showInRoster()) { throw new EnterJidDialog.JidError(getString(R.string.contact_already_exists)); } else { xmppConnectionService.createContact(contact); if (invite != null && invite.hasFingerprints()) { xmppConnectionService.verifyFingerprints(contact,invite.getFingerprints()); } switchToConversation(contact, invite == null ? null : invite.getBody()); return true; } }); mCurrentDialog = dialog.show(); }

Target:
protected void showCreateContactDialog(final String prefilledJid, final Invite invite) { EnterJidDialog dialog = new EnterJidDialog( this, mKnownHosts, mActivatedAccounts, getString(R.string.dialog_title_create_contact), getString(R.string.create), prefilledJid, null, invite == null || !invite.hasFingerprints() ); dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> { if (!xmppConnectionServiceBound) { return false; } final Account account = xmppConnectionService.findAccountByJid(accountJid); if (account == null) { return true; } final Contact contact = account.getRoster().getContact(contactJid); if (contact.isSelf()) { switchToConversation(contact,null); return true; } else if (contact.showInRoster()) { throw new EnterJidDialog.JidError(getString(R.string.contact_already_exists)); } else { xmppConnectionService.createContact(contact); if (invite != null && invite.hasFingerprints()) { xmppConnectionService.verifyFingerprints(contact,invite.getFingerprints()); } switchToConversation(contact, invite == null ? null : invite.getBody()); return true; } }); mCurrentDialog = dialog.show(); }
Source:
private void logStatesAndWeights() { final StringBuilder message = new StringBuilder("Joint segmenter has following (copy-ratio, allele-fraction): weight pairs: "); for (int n = 0; n < weights.length; n++) { final AFCRHiddenState state = hiddenStateValues.get(n); final double cr = state.getLog2CopyRatio(); final double af = state.getMinorAlleleFraction(); final double weight = weights[n]; message.append(String.format("(%f, %f): %f", cr, af, weight) + ((n < weights.length - 1) ? ";" : ".")); } logger.info(message); }

Target:
private void logStatesAndWeights() { final StringBuilder message = new StringBuilder("Joint segmenter has following (copy-ratio, allele-fraction): weight pairs: "); for (int n = 0; n < numStates(); n++) { final AFCRHiddenState state = getState(n); final double cr = state.getLog2CopyRatio(); final double af = state.getMinorAlleleFraction(); final double weight = getWeight(n); message.append(String.format("(%f, %f): %f", cr, af, weight) + ((n < numStates() - 1) ? "; " : ".")); } logger.info(message); }
Source:
public boolean isCredentialValid() throws IOException { try { retrieve().to("/user", GHUser.class); return true; } catch (IOException e) { logger.log(Level.FINEST, "Exception validating credentials on {0} with login {1}: {2}", new Object[]{this.apiUrl, this.login, e, e}); return false; } }

Target:
public boolean isCredentialValid() throws IOException { try { retrieve().to("/user", GHUser.class); return true; } catch (IOException e) { if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "Exception validating credentials on " + this.apiUrl + " with login '" + this.login + "' " + e, e); return false; } }
Source:
public void senml_json_encode_device_object_instance() { LwM2mObjectInstance oInstance = new LwM2mObjectInstance(0, getDeviceResources()); byte[] encoded = LwM2mNodeSenMLJsonEncoder.encode(oInstance, new LwM2mPath("/3/0"), model, new DefaultLwM2mValueConverter()); StringBuilder b = new StringBuilder(); b.append("[{\"bn\":\"/3/0\",\"n\":\"0\",\"vs\":\"Open Mobile Alliance\"},"); b.append("{\"n\":\"1\",\"vs\":\"Lightweight M2M Client\"},"); b.append("{\"n\":\"2\",\"vs\":\"345000123\"},"); b.append("{\"n\":\"3\",\"vs\":\"1.0\"},"); b.append("{\"n\":\"6/0\",\"v\":1},"); b.append("{\"n\":\"6/1\",\"v\":5},"); b.append("{\"n\":\"7/0\",\"v\":3800},"); b.append("{\"n\":\"7/1\",\"v\":5000},"); b.append("{\"n\":\"8/0\",\"v\":125},"); b.append("{\"n\":\"8/1\",\"v\":900},"); b.append("{\"n\":\"9\",\"v\":100},"); b.append("{\"n\":\"10\",\"v\":15},"); b.append("{\"n\":\"11/0\",\"v\":0},"); b.append("{\"n\":\"13\",\"v\":1.3674912E9},"); b.append("{\"n\":\"14\",\"vs\":\"+02:00\"},"); b.append("{\"n\":\"16\",\"vs\":\"U\"}]"); String expected = b.toString(); Assert.assertEquals(expected, new String(encoded)); }

Target:
public void senml_json_encode_device_object_instance() { LwM2mObjectInstance oInstance = new LwM2mObjectInstance(0, getDeviceResources()); byte[] encoded = LwM2mNodeSenMLJsonEncoder.encode(oInstance, new LwM2mPath("/3/0"), model, new DefaultLwM2mValueConverter()); StringBuilder b = new StringBuilder(); b.append("[{\"bn\":\"/3/0/\",\"n\":\"0\",\"vs\":\"Open Mobile Alliance\"},"); b.append("{\"n\":\"1\",\"vs\":\"Lightweight M2M Client\"},"); b.append("{\"n\":\"2\",\"vs\":\"345000123\"},"); b.append("{\"n\":\"3\",\"vs\":\"1.0\"},"); b.append("{\"n\":\"6/0\",\"v\":1},"); b.append("{\"n\":\"6/1\",\"v\":5},"); b.append("{\"n\":\"7/0\",\"v\":3800},"); b.append("{\"n\":\"7/1\",\"v\":5000},"); b.append("{\"n\":\"8/0\",\"v\":125},"); b.append("{\"n\":\"8/1\",\"v\":900},"); b.append("{\"n\":\"9\",\"v\":100},"); b.append("{\"n\":\"10\",\"v\":15},"); b.append("{\"n\":\"11/0\",\"v\":0},"); b.append("{\"n\":\"13\",\"v\":1.3674912E9},"); b.append("{\"n\":\"14\",\"vs\":\"+02:00\"},"); b.append("{\"n\":\"16\",\"vs\":\"U\"}]"); String expected = b.toString(); Assert.assertEquals(expected, new String(encoded)); }
Source:
public void setup() throws Exception { initMocks(this); depositUUID = UUID.randomUUID().toString(); pid = new PID(depositUUID); eventType = Premis.VirusCheck; premisFile = File.createTempFile(depositUUID, ".ttl"); premisFile.deleteOnExit(); premis = new FilePremisLogger(pid, premisFile, repository); date = new Date(); SoftwareAgentConstants.setCdrVersion("4.0-SNAPSHOT"); when(repository.mintPremisEventUrl(any(PID.class))).thenAnswer(new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { return "<LINK_0>" + UUID.randomUUID().toString(); } }); }

Target:
public void setup() throws Exception { initMocks(this); depositUUID = UUID.randomUUID().toString(); pid = new PID(depositUUID); eventType = Premis.VirusCheck; premisFile = File.createTempFile(depositUUID, ".ttl"); premisFile.deleteOnExit(); premis = new FilePremisLogger(pid, premisFile, repository); date = new Date(); when(repository.mintPremisEventUrl(any(PID.class))).thenAnswer(new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { return "<LINK_0>" + UUID.randomUUID().toString(); } }); }
Source:
public Secret getPassword() { String appInstallationToken; synchronized (this) { try { if (cachedToken == null || cachedToken.isStale()) { LOGGER.log(Level.FINE, "Generating App Installation Token for app ID {0}", appID); cachedToken = generateAppInstallationToken(appID, privateKey.getPlainText(), actualApiUri(), owner); LOGGER.log(Level.FINER, "Retrieved GitHub App Installation Token for app ID {0}", appID); } } catch (Exception e) { if (cachedToken != null && !cachedToken.isExpired()) { LOGGER.log(Level.WARNING, "Keeping cached GitHub App Installation Token for app ID {0}: token is stale but has not expired", appID); } else { throw e; } } appInstallationToken = cachedToken.getToken(); } LOGGER.log(Level.FINEST, "Returned GitHub App Installation Token for app ID {0}", appID); return Secret.fromString(appInstallationToken); }

Target:
public Secret getPassword() { String appInstallationToken; synchronized (this) { try { if (cachedToken == null || cachedToken.isStale()) { LOGGER.log(Level.FINE, "Generating App Installation Token for app ID {0}", appID); cachedToken = generateAppInstallationToken(appID, privateKey.getPlainText(), actualApiUri(), owner); LOGGER.log(Level.FINER, "Retrieved GitHub App Installation Token for app ID {0}", appID); } } catch (Exception e) { if (cachedToken != null && !cachedToken.isExpired()) { LOGGER.log(Level.WARNING, "Failed to generate new GitHub App Installation Token for app ID " + appID + ": cached token is stale but has not expired", e); } else { throw e; } } appInstallationToken = cachedToken.getToken(); } LOGGER.log(Level.FINEST, "Returned GitHub App Installation Token for app ID {0}", appID); return Secret.fromString(appInstallationToken); }
Source:
Map<SystemStreamPartition, String> getOldestOffsets() { Map<SystemStreamPartition, String> oldestOffsets = new HashMap<>(); Map<SystemStream, List<SystemStreamPartition>> systemStreamToSsp = sspsToStores.keySet().stream() .collect(Collectors.groupingBy(SystemStreamPartition::getSystemStream)); Map<SystemStream, SystemStreamMetadata> metadata = JavaConverters.mapAsJavaMapConverter( streamMetadataCache.getStreamMetadata( JavaConverters.asScalaSetConverter(systemStreamToSsp.keySet()).asScala().toSet(), false)).asJava(); metadata.forEach((systemStream, systemStreamMetadata) -> { Map<Partition, SystemStreamMetadata.SystemStreamPartitionMetadata> partitionMetadata = systemStreamMetadata.getSystemStreamPartitionMetadata(); Map<SystemStreamPartition, String> offsets = new HashMap<>(); for (SystemStreamPartition ssp : systemStreamToSsp.get(systemStream)) { if (partitionMetadata == null || partitionMetadata.get(ssp.getPartition()) == null) { offsets.put(ssp, null); } else { offsets.put(ssp, partitionMetadata.get(ssp.getPartition()).getOldestOffset()); } } oldestOffsets.putAll(offsets); }); return oldestOffsets; }

Target:
Map<SystemStreamPartition, String> getOldestOffsets() { Map<SystemStreamPartition, String> oldestOffsets = new HashMap<>(); Map<SystemStream, List<SystemStreamPartition>> systemStreamToSsp = sspsToStores.keySet().stream() .collect(Collectors.groupingBy(SystemStreamPartition::getSystemStream)); Map<SystemStream, SystemStreamMetadata> metadata = JavaConverters.mapAsJavaMapConverter( streamMetadataCache.getStreamMetadata( JavaConverters.asScalaSetConverter(systemStreamToSsp.keySet()).asScala().toSet(), false)).asJava(); metadata.forEach((systemStream, systemStreamMetadata) -> { Map<Partition, SystemStreamMetadata.SystemStreamPartitionMetadata> partitionMetadata = systemStreamMetadata.getSystemStreamPartitionMetadata(); for (SystemStreamPartition ssp : systemStreamToSsp.get(systemStream)) { oldestOffsets.put(ssp, partitionMetadata.get(ssp.getPartition()).getOldestOffset()); } }); return oldestOffsets; }
Source:
public ImageInfo inspectImage(InspectImageParams params) throws IOException { String image = params.getImage(); if (image.contains(":")) { image = image.replaceAll(":.*", ""); } String imageStreamTagName = KubernetesStringUtils.getTagNameFromRepoString(image); ImageStreamTag imageStreamTag = getImageStreamTagFromRepo(imageStreamTagName); return getImageInfoFromTag(imageStreamTag); }

Target:
public ImageInfo inspectImage(InspectImageParams params) throws IOException { String image = KubernetesStringUtils.getImageStreamNameFromPullSpec(params.getImage()); String imageStreamTagName = KubernetesStringUtils.convertPullSpecToTagName(image); ImageStreamTag imageStreamTag = getImageStreamTagFromRepo(imageStreamTagName); return getImageInfoFromTag(imageStreamTag); }
Source:
public HostNetworkQos getHostNetworkQosFromNetwork(Network network) { return network != null ? hostNetworkQosDao.get(network.getQosId()) : null; }

Target:
HostNetworkQos getHostNetworkQosFromNetwork(Network network) { return network != null ? hostNetworkQosDao.get(network.getQosId()) : null; }
Source:
private <T> List<T> retrieveListOrSingleItem(List<T> list, T item) { if (list != null && list.size() > 0) { return list; } else if (item == null) { return new ArrayList<>(); } else { return Arrays.asList(item); } }

Target:
private <T> List<T> retrieveListOrSingleItem(List<T> list, T item) { if (list != null && list.size() > 0) { return list; } else if (item != null) { return Arrays.asList(item); } else { return new ArrayList<>(); } }
Source:
public Document parseDocument(String input, String sourceName) { GraphqlLexer lexer = new GraphqlLexer(CharStreams.fromString(input, Optional.ofNullable(sourceName).orElse(IntStream.UNKNOWN_SOURCE_NAME))); CommonTokenStream tokens = new CommonTokenStream(lexer); GraphqlParser parser = new GraphqlParser(tokens); parser.removeErrorListeners(); parser.getInterpreter().setPredictionMode(PredictionMode.SLL); parser.setErrorHandler(new BailErrorStrategy()); GraphqlParser.DocumentContext document = parser.document(); GraphqlAntlrToLanguage antlrToLanguage = new GraphqlAntlrToLanguage(tokens); antlrToLanguage.visitDocument(document); Token stop = document.getStop(); List<Token> allTokens = tokens.getTokens(); if (stop != null && allTokens != null && !allTokens.isEmpty()) { Token last = allTokens.get(allTokens.size() - 1); boolean notEOF = last.getType() != Token.EOF; boolean lastGreaterThanDocument = last.getTokenIndex() > stop.getTokenIndex(); boolean sameChannel = last.getChannel() == stop.getChannel(); if (notEOF && lastGreaterThanDocument && sameChannel) { throw new ParseCancellationException("There are more tokens in the query that have not been consumed"); } } return antlrToLanguage.getResult(); }

Target:
public Document parseDocument(String input, String sourceName) { CharStream charStream; if(sourceName == null) { charStream = CharStreams.fromString(input); } else{ charStream = CharStreams.fromString(input, sourceName); } GraphqlLexer lexer = new GraphqlLexer(charStream); CommonTokenStream tokens = new CommonTokenStream(lexer); GraphqlParser parser = new GraphqlParser(tokens); parser.removeErrorListeners(); parser.getInterpreter().setPredictionMode(PredictionMode.SLL); parser.setErrorHandler(new BailErrorStrategy()); GraphqlParser.DocumentContext document = parser.document(); GraphqlAntlrToLanguage antlrToLanguage = new GraphqlAntlrToLanguage(tokens); antlrToLanguage.visitDocument(document); Token stop = document.getStop(); List<Token> allTokens = tokens.getTokens(); if (stop != null && allTokens != null && !allTokens.isEmpty()) { Token last = allTokens.get(allTokens.size() - 1); boolean notEOF = last.getType() != Token.EOF; boolean lastGreaterThanDocument = last.getTokenIndex() > stop.getTokenIndex(); boolean sameChannel = last.getChannel() == stop.getChannel(); if (notEOF && lastGreaterThanDocument && sameChannel) { throw new ParseCancellationException("There are more tokens in the query that have not been consumed"); } } return antlrToLanguage.getResult(); }
Source:
public void testHuffmanIntHelper() throws IOException { int size = 100; HuffmanParamsCalculator cal = new HuffmanParamsCalculator(); for (int i = -300; i < 300; i++) { cal.add(i, 1+ (i + 300) / 3); } cal.calculate(); HuffmanIntHelper helper = new HuffmanIntHelper(cal.getValues(), cal.getBitLens()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DefaultBitOutputStream bos = new DefaultBitOutputStream(baos); for (int i = 0; i < size; i++) { for (int b : cal.getValues()) { helper.write(bos, b); } } bos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); DefaultBitInputStream bis = new DefaultBitInputStream(bais); int counter = 0; for (int i = 0; i < size; i++) { for (int b : cal.getValues()) { int v = helper.read(bis); if (v != b) { Assert.fail("Mismatch: " + v + " vs " + b + " at " + counter); } counter++; } } }

Target:
public void testHuffmanIntHelper() throws IOException { final int size = 100; final HuffmanParamsCalculator cal = new HuffmanParamsCalculator(); for (int i = -300; i < 300; i++) { cal.add(i, 1+ (i + 300) / 3); } cal.calculate(); final HuffmanIntHelper helper = new HuffmanIntHelper(cal.getValues(), cal.getBitLens()); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final DefaultBitOutputStream bos = new DefaultBitOutputStream(baos); for (int i = 0; i < size; i++) { for (final int b : cal.getValues()) { helper.write(bos, b); } } bos.close(); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final DefaultBitInputStream bis = new DefaultBitInputStream(bais); int counter = 0; for (int i = 0; i < size; i++) { for (final int b : cal.getValues()) { final int v = helper.read(bis); if (v != b) { Assert.fail("Mismatch: " + v + " vs " + b + " at " + counter); } counter++; } } }
Source:
private double completePercentage() { int completed = 0; for (InflightMessage m : linkedMap.values()) { if (m.isComplete) completed ++; } return ((double) completed) / ((double) linkedMap.size()); }

Target:
private double completePercentage() { long completed = linkedMap.values().stream().filter(m -> m.isComplete).count(); return completed / ((double) linkedMap.size()); }
Source:
public VM get() { VM vm = performGet(VdcQueryType.GetVmByVmId, new GetVmByVmIdParameters(guid)); return vm; }

Target:
public VM get() { return performGet(VdcQueryType.GetVmByVmId, new GetVmByVmIdParameters(guid)); }
Source:
public static String getVersion() { return System.getProperty("java.vm.vendor", "UsNKNOWN_VM_VENDOR") + ' ' + System.getProperty("java.version", "UNKNOWN_JAVA_VERSION") + '-' + System.getProperty("java.vm.version", "UNKNOWN_VM_VERSION"); }

Target:
public static String getVersion() { return System.getProperty("java.vm.vendor", "UNKNOWN_VM_VENDOR") + ' ' + System.getProperty("java.version", "UNKNOWN_JAVA_VERSION") + '-' + System.getProperty("java.vm.version", "UNKNOWN_VM_VERSION"); }
Source:
public synchronized ServletOutputStream getOutputStream() { checkState(writer == null, "getWriter() already called"); if (outputStream == null) { final PrintWriter osWriter = new PrintWriter(actualBody); outputStream = new ServletOutputStream() { @Override public void write(int c) throws IOException { osWriter.write(c); osWriter.flush(); } }; } return outputStream; }

Target:
public synchronized ServletOutputStream getOutputStream() { checkState(writer == null, "getWriter() already called"); if (outputStream == null) { outputStream = new ServletOutputStream() { @Override public void write(int b) throws IOException { actualBody.write(b); } }; } return outputStream; }
Source:
private JsonObject getHubConfiguration() throws Exception{ String hubApi = "http://" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_HOST) + ":" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_PORT) + "/grid/api/hub"; HttpClient client = httpClientFactory.getHttpClient(); URL api = new URL(hubApi); HttpHost host = new HttpHost(api.getHost(), api.getPort()); String url = api.toExternalForm(); BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("GET", url); HttpResponse response = client.execute(host, r); return extractObject(response); }

Target:
private JsonObject getHubConfiguration() throws Exception{ String hubApi = "http://" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_HOST) + ":" + nodeConfig.getConfiguration().get(RegistrationRequest.HUB_PORT) + "/grid/api/hub"; HttpClient client = httpClientFactory.getHttpClient(); URL api = new URL(hubApi); HttpHost host = new HttpHost(api.getHost(), api.getPort()); String url = api.toExternalForm(); BasicHttpRequest r = new BasicHttpRequest("GET", url); HttpResponse response = client.execute(host, r); return extractObject(response); }
Source:
private static VariableAccessor buildAccessor( Config grants, String key, Config params, SecretProvider secretProvider) { if (grants.get(key, JsonNode.class).isObject()) { ConfigKey secretOnlyKey = grants.getNested(key).convert(SecretOnlyGrant.class).secret; return (required) -> { Optional<String> secret = secretProvider.getSecretOptional(secretOnlyKey.toString()); if (required && !secret.isPresent()) { throw new SecretNotFoundException(secretOnlyKey.toString()); } return secret.orNull(); }; } else { ConfigKey secretSharedKey = grants.get(key, ConfigKey.class); return (required) -> { Optional<String> secret = secretProvider.getSecretOptional(secretSharedKey.toString()); if (secret.isPresent()) { return secret.get(); } Config nested = params; for (String nestName : secretSharedKey.getNestNames()) { Optional<Config> optionalNested = nested.getOptionalNested(nestName); if (!optionalNested.isPresent()) { if (required) { throw new ConfigException("Nested object '" + nestName + "' out of " + secretSharedKey + " is required but not set"); } else { return null; } } nested = optionalNested.get(); } String value = nested.get(secretSharedKey.getLastName(), String.class, null); if (required && value == null) { throw new ConfigException("Nested object '" + secretSharedKey.getLastName() + "' out of " + secretSharedKey + " is required but not set"); } return value; }; } }

Target:
private static VariableAccessor buildAccessor( Config grants, String key, Config params, SecretProvider secretProvider) { if (grants.get(key, JsonNode.class).isObject()) { ConfigKey secretOnlyKey = grants.getNested(key).convert(SecretOnlyGrant.class).secret; return (required) -> { Optional<String> secret = secretProvider.getSecretOptional(secretOnlyKey.toString()); if (required && !secret.isPresent()) { throw new SecretNotFoundException(secretOnlyKey.toString()); } return secret.orNull(); }; } else { ConfigKey secretKey = grants.get(key, ConfigKey.class); return (required) -> { Optional<String> secret = secretProvider.getSecretOptional(secretKey.toString()); if (secret.isPresent()) { return secret.get(); } Config nested = params; for (String nestName : secretKey.getNestNames()) { Optional<Config> optionalNested = nested.getOptionalNested(nestName); if (!optionalNested.isPresent()) { if (required) { throw new ConfigException("Nested object '" + nestName + "' out of " + secretKey + " is required but not set"); } else { return null; } } nested = optionalNested.get(); } String value = nested.get(secretKey.getLastName(), String.class, null); if (required && value == null) { throw new ConfigException("Nested object '" + secretKey.getLastName() + "' out of " + secretKey + " is required but not set"); } return value; }; } }
Source:
private static byte[] createCryptoParameters(String version, Key encryptingKek, String encryptingKekId, String encryptingKeyManager, Key fek) { byte[] bytes; try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream params = new DataOutputStream(baos)) { params.writeUTF("org.apache.accumulo.core.security.crypto.impl.AESCryptoService"); params.writeUTF(version); params.writeUTF(encryptingKeyManager); params.writeUTF(encryptingKekId); byte[] wrappedFek = KeyManager.wrapKey(fek, encryptingKek); params.writeInt(wrappedFek.length); params.write(wrappedFek); bytes = baos.toByteArray(); } catch (IOException e) { throw new CryptoException("Error creating crypto params", e); } return bytes; }

Target:
private static byte[] createCryptoParameters(String version, Key encryptingKek, String encryptingKekId, String encryptingKeyManager, Key fek) { byte[] bytes; try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream params = new DataOutputStream(baos)) { params.writeUTF(AESCryptoService.class.getName()); params.writeUTF(version); params.writeUTF(encryptingKeyManager); params.writeUTF(encryptingKekId); byte[] wrappedFek = KeyManager.wrapKey(fek, encryptingKek); params.writeInt(wrappedFek.length); params.write(wrappedFek); bytes = baos.toByteArray(); } catch (IOException e) { throw new CryptoException("Error creating crypto params", e); } return bytes; }
Source:
public boolean inputSet() { if (viewer == null) { return false; } final IBuildPlan plan = getPlan(); if (plan != null && refreshOperation == null) { GetBuildsRequest request = new GetBuildsRequest(plan, Kind.ALL, Scope.HISTORY); refreshOperation = new GetBuildsOperation(BuildsUiInternal.getFactory().getService(), request) { protected void schedule(List<BuildJob> jobs) { for (BuildJob job : jobs) { BuildHistoryPage.this.schedule(job); } } }; refreshOperation.addOperationChangeListener(new OperationChangeListener() { @Override public void done(OperationChangeEvent event) { if (!event.getStatus().isOK()) { refreshOperation = null; return; } if (Display.getDefault().isDisposed()) { refreshOperation = null; return; } final GetBuildsOperation operation = (GetBuildsOperation) event.getOperation(); Display.getDefault().asyncExec(new Runnable() { public void run() { if (viewer.getControl() != null && !viewer.getControl().isDisposed()) { List<IBuild> builds = operation.getBuilds(); if (builds != null) { for (IBuild build : builds) { build.setPlan(plan); build.setServer(plan.getServer()); } viewer.setInput(builds); } } } }); refreshOperation = null; } }); refreshOperation.execute(); return true; } return false; }

Target:
public boolean inputSet() { if (viewer == null) { return false; } final IBuildPlan plan = getPlan(); if (plan != null && refreshOperation == null) { GetBuildsRequest request = new GetBuildsRequest(plan, Kind.ALL, Scope.HISTORY); refreshOperation = new GetBuildsOperation(BuildsUiInternal.getFactory().getService(), request) { protected void schedule(List<BuildJob> jobs) { for (BuildJob job : jobs) { BuildHistoryPage.this.schedule(job); } } }; refreshOperation.addOperationChangeListener(new OperationChangeListener() { @Override public void done(OperationChangeEvent event) { if (event.getStatus().isOK() && !Display.getDefault().isDisposed()) { final GetBuildsOperation operation = (GetBuildsOperation) event.getOperation(); Display.getDefault().asyncExec(new Runnable() { public void run() { if (viewer.getControl() != null && !viewer.getControl().isDisposed()) { List<IBuild> builds = operation.getBuilds(); if (builds != null) { for (IBuild build : builds) { build.setPlan(plan); build.setServer(plan.getServer()); } viewer.setInput(builds); } } } }); } refreshOperation = null; } }); refreshOperation.execute(); return true; } return false; }
Source:
void put(SystemStreamPartition ssp, IncomingMessageEnvelope envelope) { List<IncomingMessageEnvelope> messages = bufferedMessages.get(ssp); String offset = String.valueOf(messages.size()); if (!envelope.getOffset().equals(offset)) { throw new SamzaException( String.format("Offset mismatch for ssp %s, expected %s found %s, please set the correct offset", ssp, offset, envelope.getOffset())); } bufferedMessages.get(ssp).add(envelope); }

Target:
void put(SystemStreamPartition ssp, IncomingMessageEnvelope envelope) { Preconditions.checkNotNull(envelope); Preconditions.checkNotNull(envelope.getOffset()); List<IncomingMessageEnvelope> messages = bufferedMessages.get(ssp); String offset = String.valueOf(messages.size()); if (!envelope.getOffset().equals(offset)) { throw new SamzaException( String.format("Offset mismatch for ssp %s, expected %s found %s, please set the correct offset", ssp, offset, envelope.getOffset())); } bufferedMessages.get(ssp).add(envelope); }
Source:
public CompletableFuture<? extends JobClient> execute( Pipeline pipeline, Configuration configuration) throws Exception { Plan plan = (Plan) pipeline; CollectionExecutor exec = new CollectionExecutor(plan.getExecutionConfig()); JobExecutionResult result = exec.execute(plan); return CompletableFuture.completedFuture(new JobClient() { @Override public JobID getJobID() { return new JobID(); } @Override public CompletableFuture<JobStatus> getJobStatus() { return CompletableFuture.completedFuture(JobStatus.FINISHED); } @Override public CompletableFuture<Void> cancel() { return null; } @Override public CompletableFuture<String> stopWithSavepoint( boolean advanceToEndOfEventTime, @Nullable String savepointDirectory) { return null; } @Override public CompletableFuture<String> triggerSavepoint(@Nullable String savepointDirectory) { return null; } @Override public CompletableFuture<Map<String, Object>> getAccumulators(ClassLoader classLoader) { return null; } @Override public CompletableFuture<JobExecutionResult> getJobExecutionResult(ClassLoader userClassloader) { return CompletableFuture.completedFuture(result); } }); }

Target:
public CompletableFuture<? extends JobClient> execute( Pipeline pipeline, Configuration configuration) throws Exception { Plan plan = (Plan) pipeline; CollectionExecutor exec = new CollectionExecutor(plan.getExecutionConfig()); JobExecutionResult result = exec.execute(plan); return CompletableFuture.completedFuture(new JobClient() { @Override public JobID getJobID() { return new JobID(); } @Override public CompletableFuture<JobStatus> getJobStatus() { return CompletableFuture.completedFuture(JobStatus.FINISHED); } @Override public CompletableFuture<Void> cancel() { return CompletableFuture.completedFuture(null); } @Override public CompletableFuture<String> stopWithSavepoint( boolean advanceToEndOfEventTime, @Nullable String savepointDirectory) { return CompletableFuture.completedFuture("null"); } @Override public CompletableFuture<String> triggerSavepoint(@Nullable String savepointDirectory) { return CompletableFuture.completedFuture("null"); } @Override public CompletableFuture<Map<String, Object>> getAccumulators(ClassLoader classLoader) { return CompletableFuture.completedFuture(Collections.emptyMap()); } @Override public CompletableFuture<JobExecutionResult> getJobExecutionResult(ClassLoader userClassloader) { return CompletableFuture.completedFuture(result); } }); }
Source:
public void init(FilterConfig filterConfig) throws ServletException { Histogram.Builder builder = Histogram.build() .labelNames("path", "method"); if (filterConfig == null && isEmpty(metricName)) { throw new ServletException("No configuration object provided, and no metricName passed via constructor"); } if (filterConfig != null) { if (isEmpty(metricName)) { metricName = filterConfig.getInitParameter(METRIC_NAME_PARAM); if (isEmpty(metricName)) { throw new ServletException("Init parameter \"" + METRIC_NAME_PARAM + "\" is required; please supply a value"); } } if (!isEmpty(filterConfig.getInitParameter(HELP_PARAM))) { help = filterConfig.getInitParameter(HELP_PARAM); } if (!isEmpty(filterConfig.getInitParameter(PATH_COMPONENT_PARAM))) { pathComponents = Integer.valueOf(filterConfig.getInitParameter(PATH_COMPONENT_PARAM)); } if (!isEmpty(filterConfig.getInitParameter(BUCKET_CONFIG_PARAM))) { String[] bucketParams = filterConfig.getInitParameter(BUCKET_CONFIG_PARAM).split(","); buckets = new double[bucketParams.length]; for (int i = 0; i < bucketParams.length; i++) { buckets[i] = Double.parseDouble(bucketParams[i]); } } } if (buckets != null) { builder = builder.buckets(buckets); } histogram = builder .help(help) .name(metricName) .register(); statusCounter = Counter.build(metricName + "_status", "HTTP status codes of " + help) .labelNames("path", "method", "status") .register(); }

Target:
public void init(FilterConfig filterConfig) throws ServletException { Histogram.Builder builder = Histogram.build() .labelNames("path", "method"); if (filterConfig == null && isEmpty(metricName)) { throw new ServletException("No configuration object provided, and no metricName passed via constructor"); } if (filterConfig != null) { if (isEmpty(metricName)) { metricName = filterConfig.getInitParameter(METRIC_NAME_PARAM); if (isEmpty(metricName)) { throw new ServletException("Init parameter \"" + METRIC_NAME_PARAM + "\" is required; please supply a value"); } } if (!isEmpty(filterConfig.getInitParameter(HELP_PARAM))) { help = filterConfig.getInitParameter(HELP_PARAM); } if (!isEmpty(filterConfig.getInitParameter(PATH_COMPONENT_PARAM))) { pathComponents = Integer.valueOf(filterConfig.getInitParameter(PATH_COMPONENT_PARAM)); } if (!isEmpty(filterConfig.getInitParameter(BUCKET_CONFIG_PARAM))) { String[] bucketParams = filterConfig.getInitParameter(BUCKET_CONFIG_PARAM).split(","); buckets = new double[bucketParams.length]; for (int i = 0; i < bucketParams.length; i++) { buckets[i] = Double.parseDouble(bucketParams[i]); } } } if (buckets != null) { builder = builder.buckets(buckets); } histogram = builder .help(help) .name(metricName) .register(); statusCounter = Counter.build(metricName + "_status_total", "HTTP status codes of " + help) .labelNames("path", "method", "status") .register(); }
Source:
public ListenableFuture<Void> reportFeedback(AuthHeader authHeader, ConjureTimeLockClientFeedback feedbackReport) { return null; }

Target:
public ListenableFuture<Void> reportFeedback(AuthHeader authHeader, ConjureTimeLockClientFeedback feedbackReport) { return Futures.immediateVoidFuture(); }
Source:
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException { assert item != null; if (item.getVersion() == null) { throw new MojoExecutionException("Unable to find artifact version of " + item.getGroupId() + ":" + item.getArtifactId() + " in either project dependencies or in project dependencyManagement."); } if (item.getVersion().trim().startsWith("[") || item.getVersion().trim().startsWith("(") ) { try { item.setVersion(resolveVersionRange(item.getGroupId(), item.getArtifactId(), item.getType(), item.getVersion())); } catch (VersionRangeResolutionException e) { throw new MojoExecutionException("Could not get the highest version from the range: " + item.getVersion(), e); } } return resolveArtifactItem(item); }

Target:
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException { assert item != null; if (item.getVersion() == null) { throw new MojoExecutionException("Unable to find artifact without version specified: " + item.getGroupId() + ":" + item.getArtifactId() + ":" + item.getVersion() + " in either project dependencies or in project dependencyManagement."); } if (item.getVersion().trim().startsWith("[") || item.getVersion().trim().startsWith("(") ) { try { item.setVersion(resolveVersionRange(item.getGroupId(), item.getArtifactId(), item.getType(), item.getVersion())); } catch (VersionRangeResolutionException e) { throw new MojoExecutionException("Could not get the highest version from the range: " + item.getVersion(), e); } } return resolveArtifactItem(item); }
Source:
public Map<Measure, Result<?>> calculate( T target, Set<Measure> measures, CalculationParameters parameters, ScenarioMarketData marketData, ReferenceData refData) { Measure derivedMeasure = derivedFunction.measure(); if (!measures.contains(derivedMeasure)) { return delegate.calculate(target, measures, parameters, marketData, refData); } SetView<Measure> allRequiredMeasures = Sets.union(measures, derivedFunction.requiredMeasures()); Set<Measure> requiredMeasures = Sets.difference(allRequiredMeasures, ImmutableSet.of(derivedMeasure)); Map<Measure, Result<?>> delegateResults = delegate.calculate(target, requiredMeasures, parameters, marketData, refData); Result<?> result = calculateMeasure(target, delegateResults, parameters, marketData, refData); Map<Measure, Result<?>> requestedResults = MapStream.of(delegateResults) .filterKeys(measures::contains) .filterKeys(measure -> !measure.equals(derivedMeasure)) .toMap(); return ImmutableMap.<Measure, Result<?>>builder() .put(derivedMeasure, result) .putAll(requestedResults) .build(); }

Target:
public Map<Measure, Result<?>> calculate( T target, Set<Measure> measures, CalculationParameters parameters, ScenarioMarketData marketData, ReferenceData refData) { Measure derivedMeasure = derivedFunction.measure(); if (!measures.contains(derivedMeasure)) { return delegate.calculate(target, measures, parameters, marketData, refData); } Set<Measure> allRequiredMeasures = Sets.union(measures, derivedFunction.requiredMeasures()); Set<Measure> requiredMeasures = Sets.difference(allRequiredMeasures, ImmutableSet.of(derivedMeasure)); Map<Measure, Result<?>> delegateResults = delegate.calculate(target, requiredMeasures, parameters, marketData, refData); Result<?> result = calculateMeasure(target, delegateResults, parameters, marketData, refData); Map<Measure, Result<?>> requestedResults = MapStream.of(delegateResults) .filterKeys(measures::contains) .filterKeys(measure -> !measure.equals(derivedMeasure)) .toMap(); return ImmutableMap.<Measure, Result<?>>builder() .put(derivedMeasure, result) .putAll(requestedResults) .build(); }
Source:
private void acceptTerms() { try { RESTClientImpl client = new RESTClientImpl(usernameTextField.getText(), new String(passwordTextField.getPassword())); client.getResponse(RESTClient.HttpMethod.POST, RemoteDescriptorProvider.DATACLOUD_TERMS_ACCEPT_URL, ""); addRemoteServer(); dontShowAgainCheckBox.setVisible(false); } catch(Exception e) { showError("Cannot send acceptance message to server: " + e.getMessage()); } }

Target:
private void acceptTerms() { try { final RESTClientImpl client = new RESTClientImpl(usernameTextField.getText(), new String(passwordTextField.getPassword())); client.getResponse(RESTClient.HttpMethod.POST, RemoteDescriptorProvider.DATACLOUD_TERMS_ACCEPT_URL, ""); addRemoteServer(); dontShowAgainCheckBox.setVisible(false); } catch(Exception e) { showError("Cannot send acceptance message to server: " + e.getMessage()); } }
Source:
private Runnable handleFailure(final Runnable r) { if (myErrorHandler == null) { myErrorHandler = new Consumer<Throwable>() { @Override public void accept(Throwable t) { ThrowableHandlers.handle(new RuntimeException("Exception in " + ExecutorEdt.this + ": ", t)); } }; } return new Runnable() { @Override public void run() { try { r.run(); } catch (Throwable t) { ThrowableHandlers.handleError(t); myErrorHandler.accept(t); } } }; }

Target:
private Runnable handleFailure(final Runnable r) { if (myErrorHandler == null) { myErrorHandler = new Consumer<Throwable>() { @Override public void accept(Throwable t) { ThrowableHandlers.handle(new RuntimeException("Exception in " + ExecutorEdt.this + ": ", t)); } }; } return new Runnable() { @Override public void run() { try { r.run(); } catch (Throwable t) { myErrorHandler.accept(t); } } }; }