auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("CompactionDetal:") .append(compactionDetails.toString()) .append("\n") .append("CopyStartTime:") .append(copyStartTime) .append("\n") .append("CommitStartTime:") .append(commitStartTime) .append("\n") .append("CleanupStartTime:") .append(cleanupStartTime) .append("\n") .append("CycleEndTime:") .append(cycleEndTime) .append("\n"); return buffer.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("CompactionDetails:") .append(compactionDetails.toString()) .append("\n") .append("CopyStartTime:") .append(copyStartTime) .append("\n") .append("CommitStartTime:") .append(commitStartTime) .append("\n") .append("CleanupStartTime:") .append(cleanupStartTime) .append("\n") .append("CycleEndTime:") .append(cycleEndTime) .append("\n"); if (safeToken != null) { sb.append("SafeToken:").append(safeToken.toString()).append("\n"); } return sb.toString(); }
Source:
private void appendShowHideButtons() { String hideButton = "<button type=\"button\" onclick=\"hideLowLevelActions()\">hide low level actions</button>"; String showButton = "<button type=\"button\" onclick=\"showLowLevelActions()\">show low level actions</button>"; StringBuilder builder = new StringBuilder(); builder.append(hideButton+showButton); CommonUtils.appendTextToFile(logPath, builder.toString()); }

Target:
private void appendShowHideButtons() { String hideButton = "<button id=\"hideLowLevel\">hide low level actions</button>"; String showButton = "<button id=\"showLowLevel\">show low level actions</button>"; StringBuilder builder = new StringBuilder(); builder.append(hideButton); builder.append(showButton); CommonUtils.appendTextToFile(logPath, builder.toString()); }
Source:
protected final Object invokeNextAndCommitIf1Pc(TxInvocationContext ctx, PrepareCommand command) throws Throwable { Object result = invokeNextInterceptor(ctx, command); if (command.isOnePhaseCommit() && (ctx.isOriginLocal() || configuration.isSecondPhaseAsync())) { lockManager.unlockAll(ctx); } return result; }

Target:
protected final Object invokeNextAndCommitIf1Pc(TxInvocationContext ctx, PrepareCommand command) throws Throwable { Object result = invokeNextInterceptor(ctx, command); if (command.isOnePhaseCommit() && releaseLockOnTxCompletion(ctx)) { lockManager.unlockAll(ctx); } return result; }
Source:
protected NodeSelection getSelectionHistory(ExecutionEvent event) { TaskView taskView = getTaskView(event); if (taskView != null) { NodeSelection selectionHistory = taskView.getSelection(); if (!isEnabledFor(selectionHistory)) { throw new IllegalStateException( String.format("Cannot execute command '%s' for current selection.", getCommandName(event))); } return selectionHistory; } else { ISelection currentSelection = HandlerUtil.getCurrentSelection(event); return NodeSelection.from(currentSelection); } }

Target:
protected NodeSelection getSelectionHistory(ExecutionEvent event) { ISelection currentSelection = HandlerUtil.getCurrentSelection(event); return NodeSelection.from(currentSelection); }
Source:
public Integer getId() { return id; }

Target:
public Integer getId() { return this.id; }
Source:
public String toString() { return "TaskSelectionEvent{" + "forAdmin=" + forAdmin + ", forLog=" + forLog + ", description='" + description + '\'' + ", expirationTime=" + expirationTime + ", actualOwner='" + actualOwner + '\'' + ", status='" + status + '\'' + ", slaCompliance='" + slaCompliance + '\'' + ", priority=" + priority + ", processInstanceId=" + processInstanceId + ", processId='" + processId + '\'' + ", workItemId=" + workItemId + ", slaCompliance=" + slaCompliance + "} " + super.toString(); }

Target:
public String toString() { return "TaskSelectionEvent{" + "forAdmin=" + forAdmin + ", forLog=" + forLog + ", description='" + description + '\'' + ", expirationTime=" + expirationTime + ", actualOwner='" + actualOwner + '\'' + ", status='" + status + '\'' + ", slaCompliance='" + slaCompliance + '\'' + ", priority=" + priority + ", processInstanceId=" + processInstanceId + ", processId='" + processId + '\'' + "} " + super.toString(); }
Source:
public void testGetSchema() throws Exception { File schema = File.createTempFile("schema", ".sql"); Configuration c1 = new VoltDB.Configuration(new String[]{"get", "schema", "getvoltdbroot", voltDBRootParent, "file", schema.getAbsolutePath(), "forceget"}); ServerThread server = new ServerThread(c1); try { server.cli(); } catch (SimulatedExitException ex) { } byte[] encoded = Files.readAllBytes(Paths.get(schema.getAbsolutePath())); assertNotNull(encoded); assertTrue(encoded.length > 0); String ddl = new String(encoded, Constants.UTF8ENCODING); assertTrue(ddl.toLowerCase().contains("create table blah (")); assertTrue(ddl.toLowerCase().contains("ival bigint default '0' not null")); assertTrue(ddl.toLowerCase().contains("primary key (ival)")); }

Target:
public void testGetSchema() throws Exception { File schema = File.createTempFile("schema", ".sql"); Configuration config = new VoltDB.Configuration(new String[]{"get", "schema", "getvoltdbroot", voltDBRootParentPath, "file", schema.getAbsolutePath(), "forceget"}); ServerThread server = new ServerThread(config); try { server.cli(); } catch (Throwable ex) { } byte[] encoded = Files.readAllBytes(Paths.get(schema.getAbsolutePath())); assertNotNull(encoded); assertTrue(encoded.length > 0); String ddl = new String(encoded, StandardCharsets.UTF_8); assertTrue(ddl.toLowerCase().contains("create table blah (")); assertTrue(ddl.toLowerCase().contains("ival bigint default '0' not null")); assertTrue(ddl.toLowerCase().contains("primary key (ival)")); }
Source:
protected byte[] getFramedWriteBytes() { if (writeBuffer == null) { throw new UnsupportedOperationException("No write buffer set on FTranspprt"); } int numBytes = writeBuffer.size(); byte[] data = new byte[numBytes + 4]; ProtocolUtils.writeInt(numBytes, data, 0); System.arraycopy(writeBuffer.toByteArray(), 0, data, 4, numBytes); writeBuffer.reset(); return data; }

Target:
protected byte[] getFramedWriteBytes() { if (writeBuffer == null) { throw new UnsupportedOperationException("No write buffer set on FTranspprt"); } int numBytes = writeBuffer.size(); byte[] data = new byte[numBytes + 4]; ProtocolUtils.writeInt(numBytes, data, 0); System.arraycopy(writeBuffer.toByteArray(), 0, data, 4, numBytes); return data; }
Source:
private void expandWorkSpaceItem() { Wait fluentWait = new FluentWait(seleniumWebDriver) .withTimeout(WIDGET_TIMEOUT_SEC, SECONDS) .pollingEvery(MINIMUM_SEC, SECONDS) .ignoring(StaleElementReferenceException.class, NoSuchElementException.class); fluentWait.until((ExpectedCondition<Boolean>) input -> workSpaceLink.isEnabled()); workSpaceLink.click(); }

Target:
private void expandWorkSpaceItem() { Wait fluentWait = new FluentWait(seleniumWebDriver) .withTimeout(ELEMENT_TIMEOUT_SEC, SECONDS) .pollingEvery(MINIMUM_SEC, SECONDS) .ignoring(StaleElementReferenceException.class, NoSuchElementException.class); fluentWait.until((ExpectedCondition<Boolean>) input -> workSpaceLink.isEnabled()); workSpaceLink.click(); }
Source:
public UserView() { Span text = new Span("This is the view for a logged in user."); add(text); if (SessionRouteRegistry.getSessionRegistry(VaadinSession.getCurrent()) .getTargetUrl(VersionView.class).isPresent()) { add(new RouterLink("Version", VersionView.class)); } if (SessionRouteRegistry.getSessionRegistry(VaadinSession.getCurrent()) .getTargetUrl(TimeView.class).isPresent()) { add(new RouterLink("Time", TimeView.class)); } Button logout = new Button("Logout", e -> Login.logout()); add(logout); }

Target:
public UserView() { Span text = new Span("This is the view for a logged in user."); add(text); RouteConfiguration routeConfiguration = RouteConfiguration .forSessionScope(); if (routeConfiguration.isRouteRegistered(VersionView.class)) { add(new RouterLink("Version", VersionView.class)); } if (routeConfiguration.isRouteRegistered(TimeView.class)) { add(new RouterLink("Time", TimeView.class)); } Button logout = new Button("Logout", e -> Login.logout()); add(logout); }
Source:
public void delete() { this.open(); clickLink("Delete Project"); elasticSleep(500); confirmAlert(); }

Target:
public void delete() { this.open(); clickLink("Delete Project"); confirmAlert(2); }
Source:
protected void onHandleIntent(Intent intent) { Log.d(TAG, "onHandleIntent()"); if(false == NetworkUtils.networkAvailable(this)) { return; } List<FeedMedia> list = DBReader.getFeedMediaUnknownSize(this); for (FeedMedia media : list) { if(false == NetworkUtils.networkAvailable(this)) { return; } long size = Integer.MIN_VALUE; Log.d(TAG, media.getDownload_url()); try { URL url = new URL(media.getDownload_url()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty( "Accept-Encoding", "" ); conn.setRequestMethod("HEAD"); size = conn.getContentLength(); conn.disconnect(); } catch (IOException e) { Log.d(TAG, media.getDownload_url()); e.printStackTrace(); } media.setSize(size); DBWriter.setFeedMedia(this, media); EventBus.getDefault().post(FeedMediaEvent.update(media)); } }

Target:
protected void onHandleIntent(Intent intent) { Log.d(TAG, "onHandleIntent()"); if(false == NetworkUtils.networkAvailable(this)) { return; } List<FeedMedia> list = DBReader.getFeedMediaUnknownSize(this); for (FeedMedia media : list) { if(false == NetworkUtils.networkAvailable(this)) { return; } long size = Integer.MIN_VALUE; if(media.isDownloaded()) { File mediaFile = new File(media.getLocalMediaUrl()); if(mediaFile.exists()) { size = mediaFile.length(); } } else { HttpURLConnection conn = null; try { URL url = new URL(media.getDownload_url()); conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("Accept-Encoding", ""); conn.setRequestMethod("HEAD"); size = conn.getContentLength(); conn.disconnect(); } catch (IOException e) { Log.d(TAG, media.getDownload_url()); e.printStackTrace(); } finally { if (conn != null) { conn.disconnect(); } } } media.setSize(size); DBWriter.setFeedMedia(this, media); EventBus.getDefault().post(FeedMediaEvent.update(media)); } }
Source:
public void testGenerateXpathSuppressionOptionEmptyConfig() throws Exception { final String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!DOCTYPE suppressions PUBLIC\n" + " \"- + " \"<LINK_0>" + "suppressions_1_2_xpath_experimental.dtd\">\n" + "<suppressions>\n" + "</suppressions>\n"; exit.checkAssertionAfterwards(() -> { assertEquals("Unexpected output log", expected, systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }); Main.main("-c", getPath("InputMainConfig-empty.xml"), "--generate-xpath-suppression", getPath("InputMainComplexityOverflow.java")); }

Target:
public void testGenerateXpathSuppressionOptionEmptyConfig() throws Exception { final String expected = ""; exit.checkAssertionAfterwards(() -> { assertEquals("Unexpected output log", expected, systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }); Main.main("-c", getPath("InputMainConfig-empty.xml"), "--generate-xpath-suppression", getPath("InputMainComplexityOverflow.java")); }
Source:
public EventReceiverFirehoseTestClient( String host, String chatID, ObjectMapper jsonMapper, @TestClient HttpClient httpClient, ObjectMapper smileMapper ) { this.host = host; this.jsonMapper = jsonMapper; this.responseHandler = StatusResponseHandler.getInstance(); this.httpClient = httpClient; this.chatID = chatID; this.smileMapper = smileMapper; }

Target:
public EventReceiverFirehoseTestClient( String host, String chatID, ObjectMapper jsonMapper, @TestClient HttpClient httpClient, ObjectMapper smileMapper ) { this.host = host; this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.chatID = chatID; this.smileMapper = smileMapper; }
Source:
public void testExport() throws IOException { setup(); SWTBotEditor editorBot = fEditorBot; assertNotNull(editorBot); final SWTBotTable tableBot = editorBot.bot().table(); tableBot.getTableItem(1).contextMenu(EXPORT_TO_TSV).click(); File file = new File(fAbsolutePath); fBot.waitUntil(new FileLargerThanZeroCondition(file)); try (BufferedReader br = new BufferedReader(new FileReader(file))) { long lines = br.lines().count(); assertEquals("Line count", 23, lines); } finally { new File(fAbsolutePath).delete(); } }

Target:
public void testExport() throws IOException { SWTBotEditor editorBot = fEditorBot; assertNotNull(editorBot); final SWTBotTable tableBot = editorBot.bot().table(); tableBot.getTableItem(1).contextMenu(EXPORT_TO_TSV).click(); File file = new File(fAbsolutePath); fBot.waitUntil(new FileLargerThanZeroCondition(file)); try (BufferedReader br = new BufferedReader(new FileReader(file))) { long lines = br.lines().count(); assertEquals("Line count", 23, lines); } finally { new File(fAbsolutePath).delete(); } }
Source:
private void handleDatastreamAddOrDelete() { leaderDoAssignmentScheduled.set(false); List<Datastream> newDatastreams = _adapter.getAllDatastreams(); if (newDatastreams.isEmpty()) { _log.warn("Received a new datastream event, but there were no datastreams"); return; } try { _destinationManager.populateDatastreamDestination(newDatastreams); for (Datastream stream : newDatastreams) { if (stream.hasDestination() && !_adapter.updateDatastream(stream)) { _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleDatastreamAddOrDelete", NUM_ERRORS, 1); _log.error(String.format("Failed to update datastream destination for datastream %s, " + "This datastream will not be scheduled for producing events ", stream.getName())); } } _eventQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent()); } catch (Exception e) { _log.error("Failed to update the destination of new datastreams.", e); _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleDatastreamAddOrDelete", NUM_ERRORS, 1); if (leaderDoAssignmentScheduled.compareAndSet(false, true)) { _log.warn("Schedule retry for handling new datastream"); _executor.schedule(() -> _eventQueue.put(CoordinatorEvent.createHandleDatastreamAddOrDeleteEvent()), _config.getRetryIntervalMS(), TimeUnit.MILLISECONDS); } } }

Target:
private void handleDatastreamAddOrDelete() { leaderDoAssignmentScheduled.set(false); List<Datastream> newDatastreams = _adapter.getAllDatastreams(); if (newDatastreams.isEmpty()) { _log.warn("Received a new datastream event, but there were no datastreams"); return; } try { _destinationManager.populateDatastreamDestination(newDatastreams); for (Datastream stream : newDatastreams) { if (stream.hasDestination() && !_adapter.updateDatastream(stream)) { _log.error(String.format("Failed to update datastream destination for datastream %s, " + "This datastream will not be scheduled for producing events ", stream.getName())); throw new DatastreamException("Failed to update datastream destination for datastream" + stream.getName()); } } _eventQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent()); } catch (Exception e) { _log.error("Failed to update the destination of new datastreams.", e); _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleDatastreamAddOrDelete", NUM_RETRIES, 1); if (leaderDoAssignmentScheduled.compareAndSet(false, true)) { _log.warn("Schedule retry for handling new datastream"); _executor.schedule(() -> _eventQueue.put(CoordinatorEvent.createHandleDatastreamAddOrDeleteEvent()), _config.getRetryIntervalMS(), TimeUnit.MILLISECONDS); } } }
Source:
public void testBlockQuote() { builder.beginDocument(); builder.beginBlock(BlockType.QUOTE, new Attributes()); builder.beginBlock(BlockType.PARAGRAPH, new Attributes()); builder.characters("First paragraph."); builder.endBlock(); builder.beginBlock(BlockType.PARAGRAPH, new Attributes()); builder.characters("Second paragraph."); builder.endBlock(); builder.endBlock(); builder.endDocument(); assertMarkup("> First paragraph.\n\n> Second paragraph.\n\n"); }

Target:
public void testBlockQuote() { builder.beginDocument(); builder.beginBlock(BlockType.QUOTE, new Attributes()); builder.characters("A quote by someone important."); builder.endBlock(); builder.endDocument(); assertMarkup("> A quote by someone important.\n\n"); }
Source:
public void init(final VM vm, final CloudInitParameters ciParams) { getHostnameEnabled().setEntity(Boolean.FALSE); getHostname().setEntity(vm.getName()); getAuthorizedKeysEnabled().setEntity(Boolean.FALSE); getRegenerateKeysEnabled().setEntity(Boolean.FALSE); getTimeZoneEnabled().setEntity(Boolean.FALSE); getRootPasswordEnabled().setEntity(Boolean.FALSE); getNetworkEnabled().setEntity(Boolean.FALSE); getAttachmentEnabled().setEntity(Boolean.FALSE); AsyncDataProvider.getTimeZoneList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { @SuppressWarnings("unchecked") Map<String, String> timezones = (Map<String, String>) returnValue; getTimeZoneList().setItems(timezones.entrySet()); getTimeZoneList().setSelectedItem(Linq.firstOrDefault(timezones.entrySet(), new IPredicate<Map.Entry<String, String>>() { @Override public boolean match(Map.Entry<String, String> item) { return item.getValue().startsWith("(GMT) Greenwich"); } })); } }), TimeZoneType.GENERAL_TIMEZONE); getAttachmentType().setItems(attachmentTypes.entrySet()); getAttachmentType().setSelectedItem(Linq.firstOrDefault(attachmentTypes.entrySet())); }

Target:
public void init(final VM vm, final CloudInitParameters ciParams) { getHostnameEnabled().setEntity(false); getHostname().setEntity(vm.getName()); getAuthorizedKeysEnabled().setEntity(false); getRegenerateKeysEnabled().setEntity(false); getTimeZoneEnabled().setEntity(false); getRootPasswordEnabled().setEntity(false); getNetworkEnabled().setEntity(false); getAttachmentEnabled().setEntity(false); AsyncDataProvider.getTimeZoneList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { @SuppressWarnings("unchecked") Map<String, String> timezones = (Map<String, String>) returnValue; getTimeZoneList().setItems(timezones.entrySet()); getTimeZoneList().setSelectedItem(Linq.firstOrDefault(timezones.entrySet(), new IPredicate<Map.Entry<String, String>>() { @Override public boolean match(Map.Entry<String, String> item) { return item.getValue().startsWith("(GMT) Greenwich"); } })); } }), TimeZoneType.GENERAL_TIMEZONE); getAttachmentType().setItems(attachmentTypes.entrySet()); getAttachmentType().setSelectedItem(Linq.firstOrDefault(attachmentTypes.entrySet())); }
Source:
private List<CloudIdAndTimestampResponse> intersectCloudIdAndTimestampResponsesBasedOnCloudId(List<CloudIdAndTimestampResponse> dereferenceCloudIdAndTimestampResponseList, List<CloudIdAndTimestampResponse> publishedCloudIdAndTimestampResponseList) { List<CloudIdAndTimestampResponse> intesectCloudIds = new ArrayList<>(); for (CloudIdAndTimestampResponse dereferenceCloudIdAndTimestamp : dereferenceCloudIdAndTimestampResponseList) { String dereferenceCloudId = dereferenceCloudIdAndTimestamp.getCloudId(); for (CloudIdAndTimestampResponse publishedCloudIdAndTimestamp : publishedCloudIdAndTimestampResponseList) { String publishCloudId = publishedCloudIdAndTimestamp.getCloudId(); if (dereferenceCloudId.equals(publishCloudId)) { intesectCloudIds.add(dereferenceCloudIdAndTimestamp); } } } return intesectCloudIds; }

Target:
private List<CloudIdAndTimestampResponse> intersectCloudIdAndTimestampResponsesBasedOnCloudId(List<CloudIdAndTimestampResponse> dereferenceCloudIdAndTimestampResponseList, List<CloudIdAndTimestampResponse> publishedCloudIdAndTimestampResponseList) { List<CloudIdAndTimestampResponse> intesectCloudIds = new ArrayList<>(); for (CloudIdAndTimestampResponse dereferenceCloudIdAndTimestamp : dereferenceCloudIdAndTimestampResponseList) { String dereferenceCloudId = dereferenceCloudIdAndTimestamp.getCloudId(); for (CloudIdAndTimestampResponse publishedCloudIdAndTimestamp : publishedCloudIdAndTimestampResponseList) { if (dereferenceCloudId.equals(publishedCloudIdAndTimestamp.getCloudId())) { intesectCloudIds.add(dereferenceCloudIdAndTimestamp); } } } return intesectCloudIds; }
Source:
public void testCompressNullTransformerId() throws Exception { Map<String, Serializable> arguments = new HashMap<>(); arguments.put("transformerId", null); zipCompression.transform(SINGLE_RESULT_SOURCE_RESPONSE, arguments); }

Target:
public void testCompressNullTransformerId() throws Exception { Map<String, Serializable> arguments = Collections.singletonMap("transformerId", null); zipCompression.transform(SINGLE_RESULT_SOURCE_RESPONSE, arguments); }
Source:
public int allowedValueForRef(Set<AccountGroup.Id> groups) { int val = Integer.MIN_VALUE; for (RefRight right : rights) { if (groups.contains(right.getAccountGroupId())) { if ((val < 0 && right.getMaxValue() > 0)) { val = Math.max(right.getMaxValue(), val); } } } return val; }

Target:
public int allowedValueForRef(Set<AccountGroup.Id> groups) { int val = Integer.MIN_VALUE; for (RefRight right : rights) { if (groups.contains(right.getAccountGroupId())) { val = Math.max(right.getMaxValue(), val); } } return val; }
Source:
public void shouldGetErrorWhenUsingCreateUniqueWhenCypherVersionIs3_3() { thrown.expect( QueryExecutionException.class ); thrown.expectMessage( "CREATE UNIQUE is no longer supported. You can achieve the same result using MERGE"); Result result = db().execute( "CYPHER 3.3 MATCH (b) WITH b LIMIT 1 CREATE UNIQUE (b)-[:REL]->()" ); }

Target:
public void shouldGetErrorWhenUsingCreateUniqueWhenCypherVersionIs3_3() { thrown.expect( QueryExecutionException.class ); thrown.expectMessage( "CREATE UNIQUE is no longer supported. You can achieve the same result using MERGE"); db().execute( "CYPHER 3.3 MATCH (b) WITH b LIMIT 1 CREATE UNIQUE (b)-[:REL]->()" ); }
Source:
public static Object structAccess(Object structObject, int index, String fieldName) { if (structObject == null) { return null; } if (structObject instanceof Object[]) { return ((Object[]) structObject)[index]; } else if (structObject instanceof List) { return ((List) structObject).get(index); } else if (structObject instanceof Row) { return ((Row) structObject).getObject(index); } else { Class<?> beanClass = structObject.getClass(); try { Field structField = beanClass.getDeclaredField(fieldName); return structField.get(structObject); } catch (NoSuchFieldException | IllegalAccessException ex) { throw new IllegalStateException(ex); } } }

Target:
public static Object structAccess(Object structObject, int index, String fieldName) { if (structObject == null) { return null; } if (structObject instanceof Object[]) { return ((Object[]) structObject)[index]; } else if (structObject instanceof List) { return ((List) structObject).get(index); } else if (structObject instanceof Row) { return ((Row) structObject).getObject(index); } else { Class<?> beanClass = structObject.getClass(); try { Field structField = beanClass.getDeclaredField(fieldName); return structField.get(structObject); } catch (NoSuchFieldException | IllegalAccessException ex) { throw new IllegalStateException("Failed to access field '" + fieldName + "' of object of type " + beanClass.getName(), ex); } } }
Source:
public Library save(Library library) throws IOException { library.setLastModifier(authorizationManager.getCurrentUser()); try { Long newId = libraryDao.save(library); Library managed = libraryDao.get(newId); boolean needsUpdate = false; if (hasTemporaryName(library)) { managed.setName(namingScheme.generateNameFor(managed)); validateNameOrThrow(managed, namingScheme); if (autoGenerateIdBarcodes && isStringEmptyOrNull(managed.getIdentificationBarcode())) generateAndSetIdBarcode(managed); needsUpdate = true; } if (needsUpdate) libraryDao.save(managed); return managed; } catch (MisoNamingException e) { throw new IllegalArgumentException("Name generator failed to generate valid name for library"); } catch (ConstraintViolationException e) { throw new ConstraintViolationException(e.getMessage() + " " + ExceptionUtils.getRootCauseMessage(e), e.getSQLException(), e.getConstraintName()); } }

Target:
private Library save(Library library) throws IOException { try { Long newId = libraryDao.save(library); Library managed = libraryDao.get(newId); boolean needsUpdate = false; if (hasTemporaryName(library)) { managed.setName(namingScheme.generateNameFor(managed)); validateNameOrThrow(managed, namingScheme); needsUpdate = true; } if (autoGenerateIdBarcodes && isStringEmptyOrNull(managed.getIdentificationBarcode())) { generateAndSetIdBarcode(managed); needsUpdate = true; } if (needsUpdate) libraryDao.save(managed); return managed; } catch (MisoNamingException e) { throw new IllegalArgumentException("Name generator failed to generate valid name for library"); } catch (ConstraintViolationException e) { throw new ConstraintViolationException(e.getMessage() + " " + ExceptionUtils.getRootCauseMessage(e), e.getSQLException(), e.getConstraintName()); } }
Source:
private static String readSchema(String dataSchemaLocation) { try { InputStream inputStream = isURL(dataSchemaLocation.trim().toLowerCase(Locale.ENGLISH)) ? new URL(dataSchemaLocation).openStream() : new FileInputStream(new File(dataSchemaLocation)); return CharStreams.toString(new InputStreamReader(inputStream, UTF_8)); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Could not parse the AVRO schema at: " + dataSchemaLocation); } }

Target:
private static String readSchema(String dataSchemaLocation) { InputStream inputStream = null; try { if (isURI(dataSchemaLocation.trim().toLowerCase(ENGLISH))) { try { inputStream = new URL(dataSchemaLocation).openStream(); } catch (MalformedURLException e) { inputStream = new FileInputStream(dataSchemaLocation); } } else { inputStream = new FileInputStream(dataSchemaLocation); } return CharStreams.toString(new InputStreamReader(inputStream, UTF_8)); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Could not parse the AVRO schema at: " + dataSchemaLocation, e); } finally { closeQuietly(inputStream); } }
Source:
public void setTabIndex(int index) { }

Target:
public void setTabIndex(int index) { this.tabIndex = index; }
Source:
public String decodeSamlAuthnRequest(final String encodedRequestXmlString) { if (StringUtils.isEmpty(encodedRequestXmlString)) { return null; } final byte[] decodedBytes = EncodingUtils.decodeBase64(encodedRequestXmlString); if (decodedBytes == null) { return null; } final String inflated = CompressionUtils.inflate(decodedBytes); if (!StringUtils.isEmpty(inflated)) { return inflated; } else { return new String(decodedBytes, StandardCharsets.UTF_8); } }

Target:
public String decodeSamlAuthnRequest(final String encodedRequestXmlString) { if (StringUtils.isEmpty(encodedRequestXmlString)) { return null; } final byte[] decodedBytes = EncodingUtils.decodeBase64(encodedRequestXmlString); if (decodedBytes == null) { return null; } final String inflated = CompressionUtils.inflate(decodedBytes); if (!StringUtils.isEmpty(inflated)) { return inflated; } return new String(decodedBytes, StandardCharsets.UTF_8); }
Source:
public void whenPOSTInvalidEventTypeThenUnprocessableEntity() { Map body = buildEventTypeBody(null); final Response response = given().body(body).post("http://localhost:8080/event_types"); response.then().body(equalTo( "{\"detail\":\"#/event-type/name: expected type: String, found: Null\",\"title\":\"Invalid EventType object\",\"status\":422,\"type\":\"<LINK_1>\"}")); response.then().statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY); }

Target:
public void whenPOSTInvalidEventTypeThenUnprocessableEntity() throws JsonProcessingException { EventType eventType = buildEventTypeBody(); eventType.setName(""); eventType.setCategory(""); eventType.getEventTypeSchema().setType(null); eventType.getEventTypeSchema().setSchema(null); String body = mapper.writer().writeValueAsString(eventType); given(). body(body). header("accept", "application/json"). contentType(JSON). when(). post(ENDPOINT). then(). body("detail", containsString("Field \"name\" may not be empty")). body("detail", containsString("Field \"category\" may not be empty")). body("detail", containsString("Field \"event_type_schema.type\" may not be null")). body("detail", containsString("Field \"event_type_schema.schema\" may not be null")). body("title", equalTo("Invalid event type")). body("status", equalTo("UNPROCESSABLE_ENTITY")). body("type", equalTo("<LINK_1>")). statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY); }
Source:
public UICommandEntry() { subscribe(new CursorUpdateEventListener() { @Override public void onCursorUpdated(int oldPosition, int newPosition) { if(tabCompletionEngine == null) return; tabCompletionEngine.reset(); } }); }

Target:
public UICommandEntry() { subscribe(new CursorUpdateEventListener() { @Override public void onCursorUpdated(int oldPosition, int newPosition) { if (tabCompletionEngine == null) { return; } tabCompletionEngine.reset(); } }); }
Source:
public <T extends DataAccessObject> void persist(T dao) throws IOException { File objectPath = getDaoPersistencePath(dao); FileOutputStream fileStream = new FileOutputStream(objectPath); ObjectOutputStream oos = new ObjectOutputStream(fileStream); try { oos.writeObject(dao.list()); } finally { oos.close(); } }

Target:
public <T extends DataAccessObject> void persist(T dao) throws IOException { File objectPath = getDaoPersistencePath(dao); FileOutputStream fileStream = new FileOutputStream(objectPath); ObjectOutputStream serializer = new ObjectOutputStream(fileStream); try { serializer.writeObject(dao.list()); } finally { serializer.close(); } }
Source:
public TypeMatcher(Assignability assignability) { super( Boolean.TRUE ); this.assignability = assignability; }

Target:
public TypeMatcher(Assignability assignability) { super( Boolean.FALSE ); this.assignability = assignability; }
Source:
public Timeline getFakeTimeline(final EventType eventType) { try { final Storage storage = storageDbRepository.getStorage(DEFAULT_STORAGE) .orElseThrow(() -> new UnableProcessException("No default storage defined")); return Timeline.createFakeTimeline(eventType, storage); } catch (InternalNakadiException ex) { throw new IllegalStateException("Default storage is not defined"); } }

Target:
public Timeline getFakeTimeline(final EventType eventType) { return Timeline.createFakeTimeline(eventType, defaultStorage); }
Source:
public void headerValuesWithSameNameOnlyVaryingInCaseAreMerged() { Map<String, Collection<String>> headersMap = new LinkedHashMap<>(); headersMap.put("Set-Cookie", Lists.newArrayList("Cookie-A=Value", "Cookie-B=Value")); headersMap.put("set-cookie", Lists.newArrayList("Cookie-C=Value")); Response response = Response.create(200, null, headersMap, new byte[0]); List<String> expectedHeaderValue = Lists.newArrayList("Cookie-A=Value", "Cookie-B=Value", "Cookie-C=Value"); assertThat(response.headers().get("set-cookie")).isEqualTo(expectedHeaderValue); }

Target:
public void headerValuesWithSameNameOnlyVaryingInCaseAreMerged() { Map<String, Collection<String>> headersMap = new LinkedHashMap<>(); headersMap.put("Set-Cookie", Arrays.asList("Cookie-A=Value", "Cookie-B=Value")); headersMap.put("set-cookie", Arrays.asList("Cookie-C=Value")); Response response = Response.create(200, null, headersMap, new byte[0]); List<String> expectedHeaderValue = Arrays.asList("Cookie-A=Value", "Cookie-B=Value", "Cookie-C=Value"); assertThat(response.headers()).containsOnly(entry(("set-cookie"), expectedHeaderValue)); }
Source:
private InputStream setupInputStream(URL url, Map<String, String> headers) throws IOException { HttpClient client = new HttpClient(); String uri = url.toExternalForm(); uri = uri.replaceAll("\\{Time\\}", "20140101"); LOGGER.log(Level.FINE, "URL is "+ uri); HttpMethod get = new GetMethod(uri); if(MapUtils.isNotEmpty(headers)) { for (String headerName : headers.keySet()) { if(LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Adding header " + headerName +" = " + headers.get(headerName)); } get.addRequestHeader(headerName, headers.get(headerName)); } } int code = client.executeMethod(get); if(code != 200) { throw new IOException("Connection returned code " + code); } return get.getResponseBodyAsStream(); }

Target:
private InputStream setupInputStream(URL url, Map<String, String> headers) throws IOException { HttpClient client = new HttpClient(); String uri = url.toExternalForm(); if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, "URL is " + uri); HttpMethod get = new GetMethod(uri); if (MapUtils.isNotEmpty(headers)) { for (String headerName : headers.keySet()) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Adding header " + headerName + " = " + headers.get(headerName)); } get.addRequestHeader(headerName, headers.get(headerName)); } } int code = client.executeMethod(get); if (code != 200) { throw new IOException("Connection returned code " + code); } return get.getResponseBodyAsStream(); }
Source:
private NoarkMetadataFraAvleverendeSakssystem metaDataFrom(MeldingType meldingType) { NoarkMetadataFraAvleverendeSakssystem.Builder<Void> metadata = NoarkMetadataFraAvleverendeSakssystem.builder(); metadata.withSakssekvensnummer(Integer.valueOf(meldingType.getNoarksak().getSaSeknr())); metadata.withSaksaar(Integer.valueOf(meldingType.getNoarksak().getSaSaar())); metadata.withJournalaar(Integer.valueOf(meldingType.getJournpost().getJpJaar())); metadata.withJournalsekvensnummer(Integer.valueOf(meldingType.getJournpost().getJpSeknr())); metadata.withJournalpostnummer(Integer.valueOf(meldingType.getJournpost().getJpJpostnr())); metadata.withJournalposttype(meldingType.getJournpost().getJpNdoktype()); metadata.withJournalstatus(meldingType.getJournpost().getJpStatus()); metadata.withJournaldato(journalDatoFrom(meldingType.getJournpost().getJpDokdato())); metadata.withTittel(meldingType.getJournpost().getJpOffinnhold()); String avsendernavn = getAvsnederNavn(meldingType); if(avsendernavn != null) { metadata.withSaksbehandler(avsendernavn); } return metadata.build(); }

Target:
private NoarkMetadataFraAvleverendeSakssystem metaDataFrom(MeldingType meldingType) { NoarkMetadataFraAvleverendeSakssystem.Builder<Void> metadata = NoarkMetadataFraAvleverendeSakssystem.builder(); metadata.withSakssekvensnummer(Integer.valueOf(meldingType.getNoarksak().getSaSeknr())); metadata.withSaksaar(Integer.valueOf(meldingType.getNoarksak().getSaSaar())); metadata.withJournalaar(Integer.valueOf(meldingType.getJournpost().getJpJaar())); metadata.withJournalsekvensnummer(Integer.valueOf(meldingType.getJournpost().getJpSeknr())); metadata.withJournalpostnummer(Integer.valueOf(meldingType.getJournpost().getJpJpostnr())); metadata.withJournalposttype(meldingType.getJournpost().getJpNdoktype()); metadata.withJournalstatus(meldingType.getJournpost().getJpStatus()); metadata.withJournaldato(journalDatoFrom(meldingType.getJournpost().getJpJdato())); metadata.withDokumentetsDato(journalDatoFrom(meldingType.getJournpost().getJpDokdato())); metadata.withTittel(meldingType.getJournpost().getJpOffinnhold()); Optional<AvsmotType> avsender = getAvsender(meldingType); avsender.map(a -> a.getAmNavn()).ifPresent(metadata::withSaksbehandler); return metadata.build(); }
Source:
public static String fingerprint( X509Certificate cert ) throws CertificateException { try { MessageDigest md = MessageDigest.getInstance( "SHA-1" ); md.update( cert.getEncoded() ); return BytePrinter.compactHex( md.digest() ); } catch( NoSuchAlgorithmException e ) { throw new CertificateException( "Cannot use TLS on this platform, because SHA-1 message digest algorithm is not available: " + e.getMessage(), e ); } }

Target:
public static String fingerprint( X509Certificate cert ) throws CertificateException { try { MessageDigest md = MessageDigest.getInstance( "SHA-512" ); md.update( cert.getEncoded() ); return BytePrinter.compactHex( md.digest() ); } catch( NoSuchAlgorithmException e ) { throw new CertificateException( "Cannot use TLS on this platform, because SHA-512 message digest algorithm is not available: " + e.getMessage(), e ); } }
Source:
private void notifyPacketReceived(final XBeePacket packet) { logger.debug("New packet received: \n{}", packet.toPrettyString()); try { synchronized (packetReceiveListeners) { final ArrayList<IPacketReceiveListener> removeListeners = new ArrayList<IPacketReceiveListener>(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(Math.min(MAXIMUM_PARALLEL_LISTENER_THREADS, packetReceiveListeners.size())); for (final IPacketReceiveListener listener:packetReceiveListeners.keySet()) { executor.execute(new Runnable() { public void run() { if (packetReceiveListeners.get(listener) == ALL_FRAME_IDS) listener.packetReceived(packet); else if (((XBeeAPIPacket)packet).needsAPIFrameID() && ((XBeeAPIPacket)packet).getFrameID() == packetReceiveListeners.get(listener)) { listener.packetReceived(packet); removeListeners.add(listener); } } }); } executor.shutdown(); for (IPacketReceiveListener listener:removeListeners) packetReceiveListeners.remove(listener); } } catch (Exception e) { logger.error(e.getMessage(), e); } }

Target:
private void notifyPacketReceived(final XBeePacket packet) { logger.debug(connectionInterface.toString() + "Packet received: \n{}", packet.toPrettyString()); try { synchronized (packetReceiveListeners) { final ArrayList<IPacketReceiveListener> removeListeners = new ArrayList<IPacketReceiveListener>(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(Math.min(MAXIMUM_PARALLEL_LISTENER_THREADS, packetReceiveListeners.size())); for (final IPacketReceiveListener listener:packetReceiveListeners.keySet()) { executor.execute(new Runnable() { public void run() { if (packetReceiveListeners.get(listener) == ALL_FRAME_IDS) listener.packetReceived(packet); else if (((XBeeAPIPacket)packet).needsAPIFrameID() && ((XBeeAPIPacket)packet).getFrameID() == packetReceiveListeners.get(listener)) { listener.packetReceived(packet); removeListeners.add(listener); } } }); } executor.shutdown(); for (IPacketReceiveListener listener:removeListeners) packetReceiveListeners.remove(listener); } } catch (Exception e) { logger.error(e.getMessage(), e); } }
Source:
private void releaseLock(final KeyType key, final Jedis jedis) { jedis.del(redisLockKey(generateRedisKey(key))); }

Target:
private void releaseLock(final KeyType key, final Jedis jedis) { for(int i = 0; i < lockReleaseRetries; i++) { try { jedis.del(redisLockKey(generateRedisKey(key))); return; } catch (Exception ex) { log.warn("{}: exception releasing lock, will retry", getCacheName(), ex); try { Thread.sleep(lockReleaseRetryWaitMillis); } catch (InterruptedException e) { log.debug("{}, interrupted retrying lock release", getCacheName(), e); } } } }
Source:
void gatherHeaders(int maxPos) throws IOException { try { while(this.bufferPosition < maxPos) { int possible = maxPos - this.bufferPosition; int want = msgHeaders.length - msgHeadersPosition; if (want > 0 && want <= possible) { System.arraycopy(this.buffer, this.bufferPosition, this.msgHeaders, this.msgHeadersPosition, want); msgHeadersPosition += want; this.bufferPosition += want; continue; } else if (want > 0) { System.arraycopy(this.buffer, this.bufferPosition, this.msgHeaders, this.msgHeadersPosition, possible); msgHeadersPosition += possible; this.bufferPosition += possible; continue; } if (msgHeadersPosition == msgHeaders.length) { incoming.setHeaders(msgHeaders); msgHeaders = null; msgHeadersPosition = -1; this.mode = Mode.GATHER_DATA; break; } else { throw new IllegalStateException("Bad socket data, headers do not match excpected length"); } } } catch (IllegalStateException | NullPointerException ex) { this.encounteredProtocolError(ex); } }

Target:
void gatherHeaders(int maxPos) throws IOException { try { while(this.bufferPosition < maxPos) { int possible = maxPos - this.bufferPosition; int want = msgHeaders.length - msgHeadersPosition; if (want > 0 && want <= possible) { System.arraycopy(this.buffer, this.bufferPosition, this.msgHeaders, this.msgHeadersPosition, want); msgHeadersPosition += want; this.bufferPosition += want; continue; } else if (want > 0) { System.arraycopy(this.buffer, this.bufferPosition, this.msgHeaders, this.msgHeadersPosition, possible); msgHeadersPosition += possible; this.bufferPosition += possible; continue; } if (msgHeadersPosition == msgHeaders.length) { incoming.setHeaders(new IncomingHeadersProcessor(msgHeaders)); msgHeaders = null; msgHeadersPosition = -1; this.mode = Mode.GATHER_DATA; break; } else { throw new IllegalStateException("Bad socket data, headers do not match expected length"); } } } catch (IllegalStateException | NullPointerException ex) { this.encounteredProtocolError(ex); } }
Source:
private List<TaskResult> loadTaskResultAllAttempts(Session session, TaskId taskId) { DBTaskId dbTaskId = taskId(taskId); TaskData task = session.load(TaskData.class, dbTaskId); Query query = session.getNamedQuery("loadTasksResultByTaskAsc").setParameter("task", task); List<TaskResultData> resultsData = (List<TaskResultData>) query.list(); List<TaskResult> results = new ArrayList<>(resultsData.size()); for (TaskResultData resultData : resultsData) { results.add(resultData.toTaskResult(taskId)); } return results; }

Target:
private List<TaskResult> loadTaskResultAllAttempts(Session session, TaskId taskId) { DBTaskId dbTaskId = taskId(taskId); TaskData task = session.load(TaskData.class, dbTaskId); Query query = session.getNamedQuery("loadTasksResultByTaskAsc").setParameter("task", task); return ((List<TaskResultData>) query.list()).stream() .map(resultData -> resultData.toTaskResult(taskId)) .collect(Collectors.toList()); }
Source:
public synchronized void setAutoCommit(boolean enable) throws SQLException { if (activeConnection != null && activeConnection.isValid(5)) { activeConnection.setAutoCommit(enable); } else { logger.debug("Connection to MySql DB is not available"); } }

Target:
public synchronized void setAutoCommit(boolean enable) throws SQLException { activeConnection.setAutoCommit(enable); }
Source:
public Collection<UUID> nodeIds() { return nodeIds == null ? null : new HashSet<>(nodeIds); }

Target:
public Collection<UUID> nodeIds() { return nodeIds == null ? null : Collections.unmodifiableCollection(nodeIds); }
Source:
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bindGuiTexture(); int sx = (width - xSize) / 2; int sy = (height - ySize) / 2; drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize); renderCustomOptions(getGuiTop() + 13, par1, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY); }

Target:
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); bindGuiTexture(); int sx = (width - xSize) / 2; int sy = (height - ySize) / 2; drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize); renderCustomOptions(getGuiTop() + 13, par1, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY); }
Source:
protected AtlasDbRuntimeConfig getAtlasDbRuntimeConfig() throws JsonProcessingException { if (runtimeConfig == null) { if (runtimeConfigFile != null) { runtimeConfig = parseAtlasDbConfig(runtimeConfigFile, AtlasDbRuntimeConfig.class, runtimeConfigRoot); } else { runtimeConfig = AtlasDbRuntimeConfig.defaultRuntimeConfig(); } } return runtimeConfig; }

Target:
protected AtlasDbRuntimeConfig getAtlasDbRuntimeConfig() { if (runtimeConfig == null) { if (runtimeConfigFile != null) { runtimeConfig = parseAtlasDbConfig(runtimeConfigFile, AtlasDbRuntimeConfig.class, runtimeConfigRoot); } else { runtimeConfig = AtlasDbRuntimeConfig.defaultRuntimeConfig(); } } return runtimeConfig; }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { streamBatchConfig.validate(); pipelineConfigurer.addStream(new Stream(streamBatchConfig.name)); if (streamBatchConfig.format == null) { pipelineConfigurer.getStageConfigurer().setOutputSchema(DEFAULT_SCHEMA); } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { streamBatchConfig.validate(); pipelineConfigurer.addStream(new Stream(streamBatchConfig.name)); if (streamBatchConfig.format == null) { pipelineConfigurer.getStageConfigurer().setOutputSchema(DEFAULT_SCHEMA); } else if (streamBatchConfig.getFormatSpec() != null) { List<Schema.Field> fields = Lists.newArrayList(); fields.add(Schema.Field.of("ts", Schema.of(Schema.Type.LONG))); fields.add(Schema.Field.of("headers", Schema.mapOf(Schema.of(Schema.Type.STRING), Schema.of(Schema.Type.STRING)))); fields.addAll(streamBatchConfig.getFormatSpec().getSchema().getFields()); pipelineConfigurer.getStageConfigurer().setOutputSchema(Schema.recordOf("event", fields)); } }
Source:
private List<PartETag> collectPartETags() { final List<PartETag> partETags = new ArrayList<PartETag>(eTagsBeforeResume.size()); partETags.addAll(eTagsBeforeResume); int index = 0; try { for (; index < futures.size(); index++) { partETags.add(futures.get(index).get()); } } catch (Exception e) { for (; index < futures.size(); index++) { futures.get(index).cancel(true); } throw new SdkClientException( "Unable to complete multi-part upload. Individual part upload failed : " + e.getCause().getMessage(), e.getCause()); } return partETags; }

Target:
private List<PartETag> collectPartETags() { final List<PartETag> partETags = new ArrayList<PartETag>(eTagsBeforeResume.size() + futures.size()); partETags.addAll(eTagsBeforeResume); int index = 0; try { for (; index < futures.size(); index++) { partETags.add(futures.get(index).get()); } } catch (Exception e) { for (; index < futures.size(); index++) { futures.get(index).cancel(true); } throw new SdkClientException( "Unable to complete multi-part upload. Individual part upload failed : " + e.getCause().getMessage(), e.getCause()); } return partETags; }
Source:
private void saveStateParamForIdpToRequestSession(String state, String idpOriginKey, HttpServletRequest request) { if (request != null) { request.getSession().setAttribute("xoauth-state-" + idpOriginKey, state); } }

Target:
private void saveStateParamForIdpToRequestSession(String state, String idpOriginKey, HttpServletRequest request) { request.getSession().setAttribute("xoauth-state-" + idpOriginKey, state); }
Source:
public ApiClient(ApiClientConfiguration config) { Proxy proxy = ProxySelector.getDefault().select(URI.create(config.getBaseUrl())).iterator().next(); URI proxyUri = URI.create(proxy.type() + "://" + proxy.address()); HttpRoutePlanner routePlanner; if (Proxy.Type.HTTP.equals(proxy.type())) { HttpHost proxyHost = new HttpHost(proxyUri.getHost(), proxyUri.getPort(), proxyUri.getScheme()); routePlanner = new DefaultProxyRoutePlanner(proxyHost); } else { routePlanner = new DefaultRoutePlanner(null); } StandardHttpRequestRetryHandler requestRetryHandler = new StandardHttpRequestRetryHandler(RETRY_COUNT, true); HttpClient client = HttpClientBuilder.create().setRetryHandler(requestRetryHandler) .setUserAgent("OktaSDKJava_v" + Utils.getSdkVersion()).disableCookieManagement() .setRoutePlanner(routePlanner) .build(); this.httpClient = client; this.baseUrl = config.getBaseUrl(); this.apiVersion = config.getApiVersion(); this.configuration = config; this.token = config.getApiToken(); initMarshaller(); }

Target:
public ApiClient(ApiClientConfiguration config) { Proxy proxy = ProxySelector.getDefault().select(URI.create(config.getBaseUrl())).iterator().next(); HttpRoutePlanner routePlanner; if (Proxy.Type.HTTP.equals(proxy.type())) { URI proxyUri = URI.create(proxy.type() + "://" + proxy.address()); HttpHost proxyHost = new HttpHost(proxyUri.getHost(), proxyUri.getPort(), proxyUri.getScheme()); routePlanner = new DefaultProxyRoutePlanner(proxyHost); } else { routePlanner = new DefaultRoutePlanner(null); } StandardHttpRequestRetryHandler requestRetryHandler = new StandardHttpRequestRetryHandler(RETRY_COUNT, true); HttpClient client = HttpClientBuilder.create().setRetryHandler(requestRetryHandler) .setUserAgent("OktaSDKJava_v" + Utils.getSdkVersion()).disableCookieManagement() .setRoutePlanner(routePlanner) .build(); this.httpClient = client; this.baseUrl = config.getBaseUrl(); this.apiVersion = config.getApiVersion(); this.configuration = config; this.token = config.getApiToken(); initMarshaller(); }