auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public synchronized void flush() throws IOException { checkFlushException(); for (int i = 0; i <= executionOptions.getMaxRetries(); i++) { try { attemptFlush(); batchCount = 0; break; } catch (SQLException e) { LOG.error("JDBC executeBatch error, retry times = {}", i, e); if (i >= executionOptions.getMaxRetries()) { throw new IOException(e); } try { connection = connectionProvider.reestablishConnection(); <START> jdbcStatementExecutor.closeStatements(); <END> jdbcStatementExecutor.prepareStatements(connection); } catch (Exception excpetion) { LOG.error("JDBC connection is not valid, and reestablish connection failed.", excpetion); throw new IOException("Reestablish JDBC connection failed", excpetion); } try { Thread.sleep(1000 * i); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new IOException("unable to flush; interrupted while doing another attempt", e); } } } }</code><technical_language>remove this</technical_language>

Target:
public synchronized void flush() throws IOException { checkFlushException(); for (int i = 0; i <= executionOptions.getMaxRetries(); i++) { try { attemptFlush(); batchCount = 0; break; } catch (SQLException e) { LOG.error("JDBC executeBatch error, retry times = {}", i, e); if (i >= executionOptions.getMaxRetries()) { throw new IOException(e); } try { if (!connectionProvider.isConnectionValid()){ connection = connectionProvider.reestablishConnection(); jdbcStatementExecutor.closeStatements(); jdbcStatementExecutor.prepareStatements(connection); } } catch (Exception excpetion) { LOG.error("JDBC connection is not valid, and reestablish connection failed.", excpetion); throw new IOException("Reestablish JDBC connection failed", excpetion); } try { Thread.sleep(1000 * i); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new IOException("unable to flush; interrupted while doing another attempt", e); } } } }
Source:
<code>public static UserGroup getUserGroupFromLiferayUser(com.liferay.portal.model.User user) { try { List<String> roleNames = user.getRoles().stream() .map(Role::getName) .collect(Collectors.toList()); if (roleNames.contains(PortalConstants.ROLENAME_SW360_ADMIN)) { return UserGroup.SW360_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_CLEARING_ADMIN)) { return UserGroup.CLEARING_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_ECC_ADMIN)) { return UserGroup.ECC_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_SECURITY_ADMIN)) { return UserGroup.SECURITY_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_ADMIN)) { <START> return UserGroup.ADMIN; <END> } } catch (SystemException e) { log.error("Problem retrieving UserGroup", e); } return UserGroup.USER; }</code><technical_language>If a liferay user more role, ADMIN preferred others</technical_language>

Target:
public static UserGroup getUserGroupFromLiferayUser(com.liferay.portal.model.User user) { try { List<String> roleNames = user.getRoles().stream() .map(Role::getName) .collect(Collectors.toList()); if (roleNames.contains(PortalConstants.ROLENAME_ADMIN)) { return UserGroup.ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_SW360_ADMIN)) { return UserGroup.SW360_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_CLEARING_ADMIN)) { return UserGroup.CLEARING_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_ECC_ADMIN)) { return UserGroup.ECC_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_SECURITY_ADMIN)) { return UserGroup.SECURITY_ADMIN; } } catch (SystemException e) { log.error("Problem retrieving UserGroup", e); } return UserGroup.USER; }
Source:
<code>private String ensureTrailingSlashPresent(String path) { if (path == "") { path = "/"; } else if (!path.substring(path.length() - 1).equals("/")) { path += "/"; } return path; <START> } <END></code><technical_language>move of deleteFolder</technical_language>

Target:
private String ensureTrailingSlashPresent(String path) { if (!path.endsWith(PATH_SEPARATOR)) { path = path + PATH_SEPARATOR; } return path; }
Source:
<code>public double getRate() { try { return getRateSafely(); } <START> catch (Exception e) { <END> LogKitten.ex(e); return 0; } }</code><technical_language>Catch specific checked exception a general exception. | syntax</technical_language>

Target:
public double getRate() { try { return getRateSafely(); } catch (InvalidSensorException e) { LogKitten.ex(e); return 0; } }
Source:
<code>public PartitionedOutputOperator( OperatorContext operatorContext, List<Type> sourceTypes, Function<Page, Page> pagePreprocessor, PartitionFunction partitionFunction, List<Integer> partitionChannels, List<Optional<NullableValue>> partitionConstants, boolean replicatesAnyRow, OptionalInt nullChannel, OutputBuffer outputBuffer, PagesSerdeFactory serdeFactory, DataSize maxMemory) { this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.pagePreprocessor = requireNonNull(pagePreprocessor, "pagePreprocessor is null"); this.partitionFunction = new PagePartitioner( partitionFunction, partitionChannels, partitionConstants, replicatesAnyRow, nullChannel, outputBuffer, serdeFactory, sourceTypes, maxMemory); operatorContext.setInfoSupplier(this::getInfo); <START> this.systemMemoryContext = operatorContext.newLocalSystemMemoryContext(); <END> this.systemMemoryContext.setBytes(this.partitionFunction.getSizeInBytes()); }</code><technical_language>Do wanna attribute this part of memory user memory is operator</technical_language>

Target:
public PartitionedOutputOperator( OperatorContext operatorContext, List<Type> sourceTypes, Function<Page, Page> pagePreprocessor, PartitionFunction partitionFunction, List<Integer> partitionChannels, List<Optional<NullableValue>> partitionConstants, boolean replicatesAnyRow, OptionalInt nullChannel, OutputBuffer outputBuffer, PagesSerdeFactory serdeFactory, DataSize maxMemory) { this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.pagePreprocessor = requireNonNull(pagePreprocessor, "pagePreprocessor is null"); this.partitionFunction = new PagePartitioner( partitionFunction, partitionChannels, partitionConstants, replicatesAnyRow, nullChannel, outputBuffer, serdeFactory, sourceTypes, maxMemory); operatorContext.setInfoSupplier(this::getInfo); this.systemMemoryContext = operatorContext.newLocalSystemMemoryContext(); this.partitionsInitialRetainedSize = this.partitionFunction.getRetainedSizeInBytes(); this.systemMemoryContext.setBytes(partitionsInitialRetainedSize); }
Source:
<code>public Map<TaskId, Long> taskOffsetSums() { if (taskOffsetSumsCache == null) { taskOffsetSumsCache = new HashMap<>(); if (data.version() >= MIN_VERSION_OFFSET_SUM_SUBSCRIPTION) { for (final TaskOffsetSum topicGroup : data.taskOffsetSums()) { for (final PartitionToOffsetSum partitionOffsetSum : topicGroup.partitionToOffsetSum()) { taskOffsetSumsCache.put(new TaskId(topicGroup.topicGroupId(), partitionOffsetSum.partition()), partitionOffsetSum.offsetSum()); } } } else { <START> for (final TaskId task : prevTasks()) { taskOffsetSumsCache.put(task, Task.LATEST_OFFSET); } for (final TaskId task : standbyTasks()) { taskOffsetSumsCache.put(task, 0L); } <END> } } return taskOffsetSumsCache; }</code><technical_language>prop: suggestion prevTasks().forEach((taskId) -> taskOffsetSumsCache.put(taskId, Task.LATEST_OFFSET)); prevTasks().forEach((taskId) -> taskOffsetSumsCache.put(taskId, 0L));</technical_language>

Target:
Map<TaskId, Long> taskOffsetSums() { if (taskOffsetSumsCache == null) { taskOffsetSumsCache = new HashMap<>(); if (data.version() >= MIN_VERSION_OFFSET_SUM_SUBSCRIPTION) { for (final TaskOffsetSum taskOffsetSum : data.taskOffsetSums()) { for (final PartitionToOffsetSum partitionOffsetSum : taskOffsetSum.partitionToOffsetSum()) { taskOffsetSumsCache.put( new TaskId(taskOffsetSum.topicGroupId(), partitionOffsetSum.partition()), partitionOffsetSum.offsetSum() ); } } } else { prevTasks().forEach(taskId -> taskOffsetSumsCache.put(taskId, Task.LATEST_OFFSET)); standbyTasks().forEach(taskId -> taskOffsetSumsCache.put(taskId, UNKNOWN_OFFSET_SUM)); } } return taskOffsetSumsCache; }
Source:
<code>public void should_create_error_message() { String message = factory.create(new TestDescription("Test"), new StandardRepresentation()); assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <12.0>%n" + "to be close to:%n" + " <10.0>%n" + <START> "by less than <10.0> percent but difference was <20.0> percent.%n" + <END> "(a difference of exactly <10.0> being considered valid)")); }</code><technical_language>with: "by 10.0% difference 20.0% percent</technical_language>

Target:
public void should_create_error_message() { String message = factory.create(new TestDescription("Test"), new StandardRepresentation()); assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <12.0>%n" + "to be close to:%n" + " <10.0>%n" + "by less than <10.0>%% but difference was <20.0>%%.%n" + "(a difference of exactly <10.0> being considered valid)")); }
Source:
<code>private void handlePendingScenario(ITmfEvent event, boolean isInputValid) { if (fConsuming && isEventConsumed()) { return; } if ((fInitialStateId.equals(TmfXmlState.INITIAL_STATE_ID) || isInputValid) && fPendingScenario != null) { <START> @NonNull TmfXmlScenario scenario = fPendingScenario; <END> handleScenario(scenario, event); if (!scenario.isPending()) { addActiveScenario(scenario); fPendingScenario = null; } } }</code><technical_language>extract local variable if this variable null-check in if</technical_language>

Target:
private void handlePendingScenario(ITmfEvent event, boolean isInputValid) { if (fConsuming && isEventConsumed()) { return; } TmfXmlScenario scenario = fPendingScenario; if ((fInitialStateId.equals(TmfXmlState.INITIAL_STATE_ID) || isInputValid) && scenario != null) { handleScenario(scenario, event); if (!scenario.isPending()) { addActiveScenario(scenario); fPendingScenario = null; } } }
Source:
<code>public void get_default_profile() { dbTester.prepareDbUnit(getClass(), "shared.xml"); <START> QualityProfileDto java = underTest.selectDefaultProfile(dbTester.getSession(), organization, "java"); <END> assertThat(java).isNotNull(); assertThat(java.getKey()).isEqualTo("java_sonar_way"); assertThat(underTest.selectDefaultProfile(dbTester.getSession(), organization, "js")).isNull(); }</code><technical_language>test improved verify condition organization is applied. Currently test passes if I drop p.organization_uuid = #{organizationUuid, jdbcType=VARCHAR} SQL request</technical_language>

Target:
public void get_default_profile() { dbTester.prepareDbUnit(getClass(), "shared.xml"); QualityProfileDto java = underTest.selectDefaultProfile(dbTester.getSession(), organization, "java"); assertThat(java).isNotNull(); assertThat(java.getKey()).isEqualTo("java_sonar_way"); assertThat(underTest.selectDefaultProfile(dbTester.getSession(), dbTester.organizations().insert(), "java")).isNull(); assertThat(underTest.selectDefaultProfile(dbTester.getSession(), organization, "js")).isNull(); }
Source:
<code>public static Resource getResultResource(final JavaSparkContext sparkContext, final SparkJobContext sparkJobContext) { final HdfsHelper hdfsHelper = new HdfsHelper(sparkContext); final String resultPath; if (Strings.isNullOrEmpty(sparkJobContext.getResultPath())) { resultPath = DEFAULT_RESULT_PATH + '/' + generateResultFilename(sparkJobContext); } else { <START> if (hdfsHelper.isDirectory(sparkJobContext.getResultPath())) { <END> if (sparkJobContext.getResultPath().endsWith("/")) { resultPath = sparkJobContext.getResultPath() + generateResultFilename(sparkJobContext); } else { resultPath = sparkJobContext.getResultPath() + '/' + generateResultFilename(sparkJobContext); } } else { resultPath = sparkJobContext.getResultPath(); } } return hdfsHelper.getResourceToUse(resultPath); }</code><technical_language>Ew. Strings everywhere. This a huge step me. URIs (and in a tight loop, URIs a heavier), other way</technical_language>

Target:
public static Resource getResultResource(final JavaSparkContext sparkContext, final SparkJobContext sparkJobContext) { final HdfsHelper hdfsHelper = new HdfsHelper(sparkContext); URI resultPath = sparkJobContext.getResultPath(); if (resultPath == null) { resultPath = URI.create(DEFAULT_RESULT_PATH + '/' + generateResultFilename(sparkJobContext)); } else { if (hdfsHelper.isDirectory(resultPath)) { if (resultPath.toString().endsWith("/")) { resultPath = URI.create(resultPath.toString() + generateResultFilename(sparkJobContext)); } else { resultPath = URI.create(resultPath.toString() + '/' + generateResultFilename(sparkJobContext)); } } else { resultPath = sparkJobContext.getResultPath(); } } return hdfsHelper.getResourceToUse(resultPath); }
Source:
<code>public SecretKeySpec getRandomKey() throws GeneralSecurityException { KeyGenerator keyGen = null; try { <START> keyGen = KeyGenerator.getInstance("AES"); <END> keyGen.init(config.kmsRandomKeySizeInBits); SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, "AES"); } catch (NoSuchAlgorithmException e) { throw new GeneralSecurityException("NoSuchAlgorithmException thrown while generating random key", e); } }</code><technical_language>is this static KeyGenerator? If not, is ok this a class variable instead of creating a new time</technical_language>

Target:
public SecretKeySpec getRandomKey() throws GeneralSecurityException { SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, keyGenAlgo); }
Source:
<code>private synchronized OkHttpClient getClient(long timeoutMs) { if (client == null) { client = new OkHttpClient.Builder() .callTimeout(timeoutMs, TimeUnit.MILLISECONDS) .followRedirects(true) .addInterceptor(new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { Request request = chain.request(); if (RealmLog.getLevel() <= LogLevel.DEBUG) { StringBuilder sb = new StringBuilder(request.method()); sb.append(' '); sb.append(request.url()); sb.append('\n'); sb.append(request.headers()); if (request.body() != null) { Buffer buffer = new Buffer(); request.body().writeTo(buffer); <START> <END> String obfuscatedOutput = loginInfoObfuscator.obfuscate(request.url().pathSegments(), buffer.readString(UTF8)); sb.append(obfuscatedOutput); } RealmLog.debug("HTTP Request = \n%s", sb); } return chain.proceed(request); } }) .connectionPool(new ConnectionPool(5, 5, TimeUnit.SECONDS)) .build(); } return client; }</code><technical_language>unwrap this actual LoggingInterceptor passed OkHttpNetworkTransport</technical_language>

Target:
private synchronized OkHttpClient getClient(long timeoutMs) { if (client == null) { client = new OkHttpClient.Builder() .callTimeout(timeoutMs, TimeUnit.MILLISECONDS) .followRedirects(true) .addInterceptor(new LoggingInterceptor(httpLogObfuscator)) .connectionPool(new ConnectionPool(5, 5, TimeUnit.SECONDS)) .build(); } return client; }
Source:
<code>private synchronized void waitToCatchUp(int batchThreshold, int timeOutThresholdInMS) { int counter = 0; while(this.getBatchesSent() - this.getBatchesResponded() > batchThreshold && counter < timeOutThresholdInMS) { try { Thread.yield(); Thread.sleep(1); <START> timeOutThresholdInMS++; <END> } catch(InterruptedException ie) { } } }</code><technical_language>sleep 1ms? spend a lot of CPU time in wait Also, incrementing timeoutthreshold</technical_language>

Target:
private synchronized void waitToCatchUp(int batchThreshold, int timeOutThresholdInMS) { int counter = 0; while(this.getBatchesSent() - this.getBatchesResponded() > batchThreshold && counter < timeOutThresholdInMS) { try { Thread.yield(); Thread.sleep(1); counter++; } catch(InterruptedException ie) { } } }
Source:
<code>private String getLine(int line) { try { return lines().get(line - 1); <START> } catch (Exception ex) { <END> System.out.println("error! could not get line " + line); return ""; } }</code><technical_language>broad a catch. IndexOutOfBoundsException enough</technical_language>

Target:
private String getLine(int line) { try { return lines().get(line - 1); } catch (IndexOutOfBoundsException ex) { return ""; } }
Source:
<code>private void putApnsClientForVariantID(final String variantID, final ApnsClient apnsClient) { final ApnsClient client = apnsClientExpiringMap.putIfAbsent(variantID, apnsClient); if (client != null) { logger.warn("duplicate connection in pool, shutting it down"); <START> tearDownApnsHttp2Connection(client); <END> } }</code><technical_language>putIfAbsent returns **previous** key. tear apnsClient instead of client</technical_language>

Target:
private void putApnsClientForVariantID(final String variantID, final ApnsClient apnsClient) { final ApnsClient client = apnsClientExpiringMap.putIfAbsent(variantID, apnsClient); if (client != null) { logger.warn("duplicate connection in pool, immediately shutting down the new connection"); tearDownApnsHttp2Connection(apnsClient); } }
Source:
<code>protected ThreadPoolExecutor createSingleThreadExecutor(ThreadFactory factory) { BlockingQueue<Runnable> queue; if (enableBusyWait) { <START> queue = new BlockingMpscQueue<>(10000); <END> } else { queue = new LinkedBlockingQueue<>(); } return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, queue, factory); }</code><technical_language>10000 configurable</technical_language>

Target:
protected ThreadPoolExecutor createSingleThreadExecutor(ThreadFactory factory) { BlockingQueue<Runnable> queue; if (enableBusyWait) { queue = new BlockingMpscQueue<>(maxTasksInQueue > 0 ? maxTasksInQueue : DEFAULT_MAX_ARRAY_QUEUE_SIZE); } else { queue = new LinkedBlockingQueue<>(); } return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, queue, factory); }
Source:
<code>public void run() { int numTimeouts = checkPendingTimeouts(); if (!pendingData.isEmpty() || !pendingEvents.isEmpty() || numTimeouts > 0) { Collection<Data> newData = getAndClearPendingData(); Collection<Event> newEvents = getAndClearPendingEvents(); log.debug("Executing rules engine on " + newData.size() + " datums, " + newEvents.size() + " events and " <START> + numTimeouts +" dampening timeouts."); <END> try { if (newData.isEmpty() && newEvents.isEmpty()) { rules.fireNoData(); } else { if (!newData.isEmpty()) { rules.addData(newData); newData.clear(); } if (!newEvents.isEmpty()) { rules.addEvents(newEvents); newEvents.clear(); } } rules.fire(); alertsService.addAlerts(alerts); alerts.clear(); alertsService.persistEvents(events); events.clear(); handleDisabledTriggers(); handleAutoResolvedTriggers(); } catch (Exception e) { e.printStackTrace(); log.debug("Error on rules processing: " + e); msgLog.errorProcessingRules(e.getMessage()); } finally { alerts.clear(); events.clear(); } } }</code><technical_language>This other places if ( log.debugEnabled() ){...}</technical_language>

Target:
public void run() { int numTimeouts = checkPendingTimeouts(); if (!pendingData.isEmpty() || !pendingEvents.isEmpty() || numTimeouts > 0) { Collection<Data> newData = getAndClearPendingData(); Collection<Event> newEvents = getAndClearPendingEvents(); if (log.isDebugEnabled()) { log.debug("Executing rules engine on " + newData.size() + " datums, " + newEvents.size() + " events and " + numTimeouts +" dampening timeouts."); } try { if (newData.isEmpty() && newEvents.isEmpty()) { rules.fireNoData(); } else { if (!newData.isEmpty()) { rules.addData(newData); newData.clear(); } if (!newEvents.isEmpty()) { rules.addEvents(newEvents); newEvents.clear(); } } rules.fire(); alertsService.addAlerts(alerts); alerts.clear(); alertsService.persistEvents(events); if (distributed) { partitionManager.notifyEvents(events); } events.clear(); handleDisabledTriggers(); handleAutoResolvedTriggers(); } catch (Exception e) { e.printStackTrace(); if (log.isDebugEnabled()) { log.debug("Error on rules processing: " + e); } msgLog.errorProcessingRules(e.getMessage()); } finally { alerts.clear(); events.clear(); } } }
Source:
<code>public void testRemoteProxyCreationDelegatesToClientEventually() { final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client); assertEquals(0, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); <START> server.getMap("map"); <END> assertTrueEventually(new AssertTask() { @Override public void run() { assertEquals(1, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); } }); }</code><technical_language>if a client instance do this remote operation, test easily duplicated non-java clients well</technical_language>

Target:
public void testRemoteProxyCreationDelegatesToClientEventually() { final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client); assertEquals(0, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); client2.getMap("map"); assertTrueEventually(new AssertTask() { @Override public void run() { assertEquals(1, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); } }); }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!children.get(0).evaluate(tuple, ptr)) { if (logger.isDebugEnabled()) { logger.debug("->> left value is null"); } return false; } PhoenixJson source =(PhoenixJson) PJson.INSTANCE.toObject(ptr, children.get(0).getSortOrder()); if (!children.get(1).evaluate(tuple, ptr)) { if (logger.isDebugEnabled()) { <START> logger.debug("->> right value is null"); <END> } return false; } String key = (String) PVarchar.INSTANCE.toObject(ptr, children.get(1).getSortOrder()); PhoenixJson jsonValue=source.getValue(key); if(jsonValue!=null) { ptr.set(jsonValue.toBytes()); return true; } return false; }</code><technical_language>remove logger.debug statements</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!children.get(0).evaluate(tuple, ptr)) { return false; } PhoenixJson source =(PhoenixJson) PJson.INSTANCE.toObject(ptr, children.get(0).getSortOrder()); if (!children.get(1).evaluate(tuple, ptr)) { return false; } String key = (String) PVarchar.INSTANCE.toObject(ptr, children.get(1).getSortOrder()); PhoenixJson jsonValue=source.getValue(key); if(jsonValue!=null) { ptr.set(jsonValue.toBytes()); return true; } return false; }
Source:
<code>public void paintControl(PaintEvent e) { GC gc = e.gc; Rectangle bounds; if (plotArea == null) { bounds = gc.getClipping(); } else { bounds = plotArea.getBounds(); } double[][] series = this.getPieSeriesArray(); <START> if (series.length == 0) { <END> return; } int width = (bounds.width - bounds.x) / series.length; int x = bounds.x; for (double s[] : series) { drawPieChart(e, s, new Rectangle(x, bounds.y, width, bounds.height)); x += width; } }</code><technical_language>sense print a label data chart opposed leaving graph empty do feel user data list</technical_language>

Target:
public void paintControl(PaintEvent e) { GC gc = e.gc; Rectangle bounds; if (plotArea == null) { bounds = gc.getClipping(); } else { bounds = plotArea.getBounds(); } double[][] series = this.getPieSeriesArray(); if (series.length == 0) { Rectangle allBounds = chart.getBounds(); Font font = new Font(Display.getDefault(), "Arial", 15, SWT.BOLD); gc.setForeground(BLACK); gc.setFont(font); String text = "No data"; Point textSize = e.gc.textExtent(text); gc.drawText(text, (allBounds.width - textSize.x) / 2, (allBounds.height - textSize.y) / 2); font.dispose(); return; } int width = (bounds.width - bounds.x) / series.length; int x = bounds.x; for (int i = 0; i < series.length; i++) { double[] s = series[i]; drawPieChart(e, i, s, new Rectangle(x, bounds.y, width, bounds.height)); x += width; } }
Source:
<code>public Map<String, Object> createUser(final UserDetailDto user) { LOG.debug(user.toString()); final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), UserServiceImpl.USER_NAME); final HashMap<String, Object> mapResponse = new HashMap<String, Object>(); mapResponse.put("id", String.valueOf(0)); userValidator.validate(user, errors, true); if (errors.hasErrors()) { LOG.debug("UserValidator returns errors"); translateErrorToMap(errors, mapResponse); return mapResponse; } final UserDto userdto = translateUserDetailsDtoToUserDto(user); userdto.setPassword(passwordEncoder.encode(userdto.getUsername())); try { final Integer newUserId = this.workbenchDataManager.createUser(userdto); mapResponse.put("id", String.valueOf(newUserId)); <START> } catch (MiddlewareQueryException e) { <END> LOG.info("Error on workbenchDataManager.addNewUser " + e.getMessage()); } return mapResponse; }</code><technical_language>MiddlewareQueryException is a runtime exception. If do catch this exception, diverted Spring's default exception handler. custom exception handler is - this do for now. Currently logging exception returning a 200 status, tricks service consumer thinking is OK</technical_language>

Target:
public Map<String, Object> createUser(final UserDetailDto user) { LOG.debug(user.toString()); final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), UserServiceImpl.USER_NAME); final HashMap<String, Object> mapResponse = new HashMap<String, Object>(); mapResponse.put("id", String.valueOf(0)); userValidator.validate(user, errors, true); if (errors.hasErrors()) { LOG.debug("UserValidator returns errors"); translateErrorToMap(errors, mapResponse); } else { final UserDto userdto = translateUserDetailsDtoToUserDto(user); userdto.setPassword(passwordEncoder.encode(userdto.getUsername())); try { final Integer newUserId = this.workbenchDataManager.createUser(userdto); mapResponse.put("id", String.valueOf(newUserId)); } catch (MiddlewareQueryException e) { LOG.info("Error on workbenchDataManager.createUser " + e.getMessage()); errors.rejectValue(UserValidator.USER_ID, UserValidator.DATABASE_ERROR); translateErrorToMap(errors, mapResponse); } } return mapResponse; }
Source:
<code>private void downloadFullTexts(Map<BibEntry, Optional<URL>> downloads, BibDatabaseContext databaseContext) { for (Map.Entry<BibEntry, Optional<URL>> download : downloads.entrySet()) { BibEntry entry = download.getKey(); Optional<URL> result = download.getValue(); if (result.isPresent()) { Optional<Path> dir = databaseContext.getFirstExistingFileDir(Globals.prefs.getFilePreferences()); if (dir.isEmpty()) { dialogService.showErrorDialogAndWait(Localization.lang("Directory not found"), Localization.lang("Main file directory not set!\n") + Localization.lang("Check the Preferences (Linked files)") <START> + Localization.lang(" or the Library properties.")); <END> return; } addLinkedFileFromURL(databaseContext, result.get(), entry, dir.get()); } else { dialogService.notify(Localization.lang("No full text document found for entry %0.", entry.getCitationKey().orElse(Localization.lang("undefined")))); } } }</code><technical_language>care casing - is better? Main file directory set. Check preferences (linked files) library properties</technical_language>

Target:
private void downloadFullTexts(Map<BibEntry, Optional<URL>> downloads, BibDatabaseContext databaseContext) { for (Map.Entry<BibEntry, Optional<URL>> download : downloads.entrySet()) { BibEntry entry = download.getKey(); Optional<URL> result = download.getValue(); if (result.isPresent()) { Optional<Path> dir = databaseContext.getFirstExistingFileDir(Globals.prefs.getFilePreferences()); if (dir.isEmpty()) { dialogService.showErrorDialogAndWait(Localization.lang("Directory not found"), (Localization.lang("Main file directory not set. Check the preferences (linked files) or the library properties."))); return; } addLinkedFileFromURL(databaseContext, result.get(), entry, dir.get()); } else { dialogService.notify(Localization.lang("No full text document found for entry %0.", entry.getCitationKey().orElse(Localization.lang("undefined")))); } } }
Source:
<code>public void onOrganizationalUnitRemoved(@Observes final AfterDeleteOrganizationalUnitEvent removedOrganizationalUnitEvent) { <START> if (isLibraryPerspectiveOpen() && isSpaceActive(removedOrganizationalUnitEvent)) { <END> projectContext.getActiveOrganizationalUnit() .filter(active -> active.equals(removedOrganizationalUnitEvent.getOrganizationalUnit())) .ifPresent(active -> goToOrganizationalUnits()); } }</code><technical_language>wondering need method isSpaceActive this additional check && isSpaceActive(removedOrganizationalUnitEvent) similar check .filter(active -> active.equals(removedOrganizationalUnitEvent.getOrganizationalUnit())) below. happen 2 OrganizationalUnits equal identifier? I remove newly added private isSpaceActive remove && check behave same</technical_language>

Target:
public void onOrganizationalUnitRemoved(@Observes final AfterDeleteOrganizationalUnitEvent removedOrganizationalUnitEvent) { if (isLibraryPerspectiveOpen()) { projectContext.getActiveOrganizationalUnit() .filter(active -> active.equals(removedOrganizationalUnitEvent.getOrganizationalUnit())) .ifPresent(active -> this.goToOrganizationalUnits()); } }
Source:
<code>public void checkDecisionServerSecureMultiContainerHttpClient() throws Exception { String HOST = "https://" + System.getenv("SECURE_KIE_APP_SERVICE_HOST") + ":" + System.getenv("SECURE_KIE_APP_SERVICE_PORT"); String URI = "/kie-server/services/rest/server/containers"; HttpResponse response = genericResponse(HOST, URI); Assert.assertEquals(200, response.getResponseCode()); String output = response.getResponseBodyAsString(); JAXBContext jaxbContent = JAXBContext.newInstance(ServiceResponse.class); Unmarshaller unmarshaller = jaxbContent.createUnmarshaller(); ServiceResponse serviceResponse = (ServiceResponse) unmarshaller.unmarshal(new StringReader(output)); KieContainerResourceList kieContainers = (KieContainerResourceList) serviceResponse.getResult(); Assert.assertEquals(2, kieContainers.getContainers().size()); <START> kieContainers.getContainers().stream().forEach(container -> { <END> String containerAliasToID = new SumCoder.MD5().encode(container.getResolvedReleaseId().getArtifactId() + "=" + container.getReleaseId()); if (!containerAliasToID.equals(container.getContainerId())){ containerAliasToID = new SumCoder.MD5().encode("AnotherContainer=" + container.getReleaseId()); } Assert.assertEquals(container.getContainerId(), containerAliasToID); Assert.assertEquals(org.kie.server.api.model.KieContainerStatus.STARTED, container.getStatus()); }); }</code><technical_language>Lambdas</technical_language>

Target:
public void checkDecisionServerSecureMultiContainerHttpClient() { String HOST = "https://" + System.getenv("SECURE_KIE_APP_SERVICE_HOST") + ":" + System.getenv("SECURE_KIE_APP_SERVICE_PORT"); String URI = "/kie-server/services/rest/server/containers"; HttpResponse response = genericResponse(HOST, URI); Assert.assertEquals(200, response.getResponseCode()); String output = null; try { output = response.getResponseBodyAsString(); JAXBContext jaxbContent = JAXBContext.newInstance(ServiceResponse.class); Unmarshaller unmarshaller = jaxbContent.createUnmarshaller(); ServiceResponse serviceResponse = (ServiceResponse) unmarshaller.unmarshal(new StringReader(output)); KieContainerResourceList kieContainers = (KieContainerResourceList) serviceResponse.getResult(); Assert.assertEquals(2, kieContainers.getContainers().size()); for (KieContainerResource container : kieContainers.getContainers()) { String containerAliasToID = new SumCoder.MD5().encode(container.getResolvedReleaseId().getArtifactId() + "=" + container.getReleaseId()); if (!containerAliasToID.equals(container.getContainerId())) { containerAliasToID = new SumCoder.MD5().encode("AnotherContainer=" + container.getReleaseId()); } Assert.assertEquals(container.getContainerId(), containerAliasToID); Assert.assertEquals(org.kie.server.api.model.KieContainerStatus.STARTED, container.getStatus()); } } catch (IOException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } }
Source:
<code><START> private <T>Comparator<T> reverseComparator(final Comparator<T> comparator) { <END> return new Comparator<T>() { @Override public int compare(T t1, T t2) { return -comparator.compare(t1, t2); } }; }</code><technical_language>please static</technical_language>

Target:
private static <T>Comparator<T> reverseComparator(final Comparator<T> comparator) { return new Comparator<T>() { @Override public int compare(T t1, T t2) { return -comparator.compare(t1, t2); } }; }
Source:
<code>protected void onMethodInvocationFound(MethodInvocationTree mit) { if (!mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { return; } ExpressionTree firstOperand = ExpressionUtils.skipParentheses(((MemberSelectExpressionTree) mit.methodSelect()).expression()); ExpressionTree secondOperand = ExpressionUtils.skipParentheses(mit.arguments().get(0)); boolean firstOperandNonCompliant = useClassGetNameMethod(firstOperand); boolean secondOperandNonCompliant = useClassGetNameMethod(secondOperand); if (firstOperandNonCompliant && secondOperandNonCompliant) { reportIssue(mit, "Use \"isAssignableFrom\" instead."); } else if (firstOperandNonCompliant && secondOperand.is(Tree.Kind.STRING_LITERAL)) { reportIssue(mit, "Use an \"instanceof\" comparison instead."); <START> } else if (secondOperandNonCompliant && firstOperand.is(Tree.Kind.STRING_LITERAL)) { <END> reportIssue(mit, "Use an \"instanceof\" comparison instead."); } }</code><technical_language>a in previous if</technical_language>

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { if (!mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { return; } ExpressionTree firstOperand = ExpressionUtils.skipParentheses(((MemberSelectExpressionTree) mit.methodSelect()).expression()); ExpressionTree secondOperand = ExpressionUtils.skipParentheses(mit.arguments().get(0)); boolean firstOpIsClassGetNameMethod = useClassGetNameMethod(firstOperand); boolean secondOpIsClassGetNameMethod = useClassGetNameMethod(secondOperand); if (firstOpIsClassGetNameMethod && secondOpIsClassGetNameMethod) { reportIssue(mit, "Use \"isAssignableFrom\" instead."); } else if ((firstOpIsClassGetNameMethod && secondOperand.is(Tree.Kind.STRING_LITERAL)) || (secondOpIsClassGetNameMethod && firstOperand.is(Tree.Kind.STRING_LITERAL))) { reportIssue(mit, "Use an \"instanceof\" comparison instead."); } }
Source:
<code>private Optional<DRepresentation> getRepresentationInternal(boolean loadOnDemand) { ResourceDescriptor resourceDescriptor = repDescriptor.getRepPath(); Resource resource = repDescriptor.eResource(); Optional<URI> uri = Optional.ofNullable(resourceDescriptor).map(desc -> desc.getResourceURI()); if (uri.isPresent()) { URI repResourceURI = uri.get().trimFragment(); Optional<Resource> representationResource = Optional.ofNullable(resource) .map(rsr -> rsr.getResourceSet()) .filter(resourceSet -> !loadOnDemand || resourceSet.getURIConverter().exists(repResourceURI, new HashMap<>())) .map(resourceSet -> { Resource res = null; try { res = resourceSet.getResource(repResourceURI, loadOnDemand); } catch <START> (Exception e) <END> { } return res; }); String repId = uri.get().fragment(); if (representationResource.isPresent() && repId != null) { return representationResource.get().getContents().stream().filter(DRepresentation.class::isInstance).map(DRepresentation.class::cast) .filter(dRepresentation -> repId.equals(dRepresentation.getUid())).findFirst(); } } return Optional.empty(); }</code><technical_language>I throw a RuntimeException</technical_language>

Target:
private Optional<DRepresentation> getRepresentationInternal(boolean loadOnDemand) { ResourceDescriptor resourceDescriptor = repDescriptor.getRepPath(); Resource resource = repDescriptor.eResource(); Optional<URI> uri = Optional.ofNullable(resourceDescriptor).map(desc -> desc.getResourceURI()); if (uri.isPresent()) { URI repResourceURI = uri.get().trimFragment(); Optional<Resource> representationResource = Optional.ofNullable(resource) .map(rsr -> rsr.getResourceSet()) .filter(resourceSet -> !loadOnDemand || resourceSet.getURIConverter().exists(repResourceURI, new HashMap<>())) .map(resourceSet -> { Resource res = null; try { res = resourceSet.getResource(repResourceURI, loadOnDemand); } catch (RuntimeException e) { } return res; }); String repId = uri.get().fragment(); if (representationResource.isPresent() && repId != null) { return representationResource.get().getContents().stream().filter(DRepresentation.class::isInstance).map(DRepresentation.class::cast) .filter(dRepresentation -> repId.equals(dRepresentation.getUid())).findFirst(); } } return Optional.empty(); }
Source:
<code><START> public void getAllProvidersByType(AsyncQuery<List<Provider<?>>> aQuery, ProviderType providerType) { aQuery.converterCallback = new ListConverter<>(); Frontend.getInstance().runQuery(QueryType.GetAllProviders, new GetAllProvidersParameters(providerType), aQuery); } <END></code><technical_language>in a places. modify this method, allowing multiple providerTypes, result same, modify usages</technical_language>

Target:
public void getAllProvidersByType(AsyncQuery<List<Provider<?>>> aQuery, ProviderType providerType) { getAllProvidersByTypes(aQuery, providerType); }
Source:
<code>private ImmutableSortedMap<String, ImmutableSet<String>> readMap(final String mapPath) { String fileContent; String actualPath = mapPath; if (Strings.isNullOrEmpty(mapPath)) { <START> actualPath = this.getClass().getClassLoader().getResource("defaultWitheListMap.json").getFile(); <END> LOGGER.warn("using default whiteList map located at [%s]", actualPath); } try { fileContent = Files.asCharSource(new File(actualPath), Charset.forName("UTF-8")).read(); return mapper.reader(new TypeReference<ImmutableSortedMap<String, ImmutableSet<String>>>() { }).readValue(fileContent); } catch (IOException e) { throw new ISE(e, "Got an exception while parsing file [%s]", actualPath); } }</code><technical_language>u fix spelling mistake in file name s/Withe/White</technical_language>

Target:
private ImmutableSortedMap<String, ImmutableSet<String>> readMap(final String mapPath) { String fileContent; String actualPath = mapPath; if (Strings.isNullOrEmpty(mapPath)) { actualPath = this.getClass().getClassLoader().getResource("defaultWhiteListMap.json").getFile(); LOGGER.warn("using default whiteList map located at [%s]", actualPath); } try { fileContent = Files.asCharSource(new File(actualPath), Charset.forName("UTF-8")).read(); return mapper.reader(new TypeReference<ImmutableSortedMap<String, ImmutableSet<String>>>() { }).readValue(fileContent); } catch (IOException e) { throw new ISE(e, "Got an exception while parsing file [%s]", actualPath); } }
Source:
<code>private void startGeoActivity() { Context context = getContext(); Intent intent = new Intent(context, GeoPointActivity.class); if (stringAnswer != null && !stringAnswer.isEmpty()) { intent.putExtra(LOCATION, GeoWidgetUtils.getLocationParamsFromStringAnswer(stringAnswer)); } intent.putExtra(READ_ONLY, readOnly); <START> intent.putExtra(DRAGGABLE_ONLY, false); <END> intent.putExtra(ACCURACY_THRESHOLD, accuracyThreshold); ((Activity) context).startActivityForResult(intent, RequestCodes.LOCATION_CAPTURE); }</code><technical_language>I this removed</technical_language>

Target:
private void startGeoActivity() { Context context = getContext(); Intent intent = new Intent(context, GeoPointActivity.class); if (stringAnswer != null && !stringAnswer.isEmpty()) { intent.putExtra(LOCATION, GeoWidgetUtils.getLocationParamsFromStringAnswer(stringAnswer)); } intent.putExtra(ACCURACY_THRESHOLD, accuracyThreshold); ((Activity) context).startActivityForResult(intent, RequestCodes.LOCATION_CAPTURE); }
Source:
<code>private Map<Integer, Map<Integer, List<HiveBloomFilter>>> readBloomFilterIndexes(Map<StreamId, Stream> streams, Map<StreamId, OrcInputStream> streamsData) throws IOException { Map<Integer, Map<Integer, List<HiveBloomFilter>>> bloomFilters = new HashMap<>(); for (Entry<StreamId, Stream> entry : streams.entrySet()) { Stream stream = entry.getValue(); if (stream.getStreamKind() == BLOOM_FILTER) { OrcInputStream inputStream = streamsData.get(entry.getKey()); <START> Map<Integer, List<HiveBloomFilter>> bloomFiltersForColumn = bloomFilters.getOrDefault(stream.getColumn(), new HashMap<>()); <END> bloomFiltersForColumn.put(stream.getSequence(), metadataReader.readBloomFilterIndexes(inputStream)); bloomFilters.put(stream.getColumn(), bloomFiltersForColumn); } } return ImmutableMap.copyOf(bloomFilters); }</code><technical_language>computeIfAbsent able avoid put logic</technical_language>

Target:
private Map<StreamId, List<HiveBloomFilter>> readBloomFilterIndexes(Map<StreamId, Stream> streams, Map<StreamId, OrcInputStream> streamsData) throws IOException { ImmutableMap.Builder<StreamId, List<HiveBloomFilter>> bloomFilters = ImmutableMap.builder(); for (Entry<StreamId, Stream> entry : streams.entrySet()) { Stream stream = entry.getValue(); if (stream.getStreamKind() == BLOOM_FILTER) { OrcInputStream inputStream = streamsData.get(entry.getKey()); bloomFilters.put(entry.getKey(), metadataReader.readBloomFilterIndexes(inputStream)); } } return bloomFilters.build(); }
Source:
<code>public void run() { long start = System.currentTimeMillis(); boolean done = false; while(running.get() && !done) { try { Connection conn = getConnection(url); conn.setAutoCommit(false); PreparedStatement ps = conn.prepareStatement( "SELECT * FROM test WHERE entity_id = ? FOR UPDATE"); ps.setString(1, "1"); ResultSet rs = ps.executeQuery(); assertTrue(rs.next()); assertTrue(rs.getInt(2) == 100); conn.commit(); long now = System.currentTimeMillis(); if (now - start > 1000*60) done = true; } catch (SQLException e1) { e1.printStackTrace(); } <START> } <END> }</code><technical_language>need close connections</technical_language>

Target:
public void run() { long start = System.currentTimeMillis(); boolean done = false; Connection conn = null; while(running.get() && !done) { try { conn = getConnection(getTestName() + url); conn.setAutoCommit(false); PreparedStatement ps = conn.prepareStatement( "SELECT * FROM testmvccmultithreaded2 WHERE entity_id = ? FOR UPDATE"); ps.setString(1, "1"); ResultSet rs = ps.executeQuery(); assertTrue(rs.next()); assertTrue(rs.getInt(2) == 100); conn.commit(); long now = System.currentTimeMillis(); if (now - start > 1000*60) done = true; } catch (JdbcSQLException e1) { if (e1.getErrorCode() != ErrorCode.DUPLICATE_KEY_1) e1.printStackTrace(); } catch (SQLException e2) { e2.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e1) { e1.printStackTrace(); } } }
Source:
<code>public DataSegment push(final File indexFilesDir, final DataSegment segment) throws IOException { log.info("Uploading [%s] to Azure.", indexFilesDir); final int version = SegmentUtils.getVersionFromDir(indexFilesDir); final File zipOutFile = File.createTempFile("index", ".zip"); <START> final long size = CompressionUtils.zip(indexFilesDir, zipOutFile); <END> final File descriptorFile = createSegmentDescriptorFile(jsonMapper, segment); final Map<String, String> azurePaths = getAzurePaths(segment); try { return AzureUtils.retryAzureOperation( new Callable<DataSegment>() { @Override public DataSegment call() throws Exception { return uploadDataSegment(segment, version, size, zipOutFile, descriptorFile, azurePaths); } }, config.getMaxTries() ); } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>Needs try cleanup</technical_language>

Target:
public DataSegment push(final File indexFilesDir, final DataSegment segment) throws IOException { log.info("Uploading [%s] to Azure.", indexFilesDir); final int version = SegmentUtils.getVersionFromDir(indexFilesDir); File zipOutFile = null; File descriptorFile = null; try { final File outFile = zipOutFile = File.createTempFile("index", ".zip"); final long size = CompressionUtils.zip(indexFilesDir, zipOutFile); final File descFile = descriptorFile = createSegmentDescriptorFile(jsonMapper, segment); final Map<String, String> azurePaths = getAzurePaths(segment); return AzureUtils.retryAzureOperation( new Callable<DataSegment>() { @Override public DataSegment call() throws Exception { return uploadDataSegment(segment, version, size, outFile, descFile, azurePaths); } }, config.getMaxTries() ); } catch (Exception e) { throw Throwables.propagate(e); } finally { if (zipOutFile != null) { log.info("Deleting zipped index File[%s]", zipOutFile); zipOutFile.delete(); } if (descriptorFile != null) { log.info("Deleting descriptor file[%s]", descriptorFile); descriptorFile.delete(); } } }
Source:
<code>public void testIntegerCollection() { <START> assertImageEqualsCollection( imgByte, FlatCollections.integerCollection( imgByte ), ( e, a ) -> e.getInteger() == a ); <END> assertImageEqualsCollection( imgInt, FlatCollections.integerCollection( imgInt ), ( e, a ) -> e.get() == a ); assertImageEqualsCollection( imgLong, FlatCollections.integerCollection( imgLong ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgShort, FlatCollections.integerCollection( imgShort ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgBig, FlatCollections.integerCollection( imgBig ), ( e, a ) -> e.getInteger() == a ); }</code><technical_language>simpler, if test for value: java assertCollectionEquals( Arrays.asList(42), FloatCollections.integerCollection(ArrayImgs.bytes(byte[]{42},1)) );</technical_language>

Target:
public void testIntegerCollection() { assertImageEqualsCollection( imgByte, FlatCollections.integerCollection( imgByte ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgInt, FlatCollections.integerCollection( imgInt ), ( e, a ) -> e.get() == a ); assertImageEqualsCollection( imgLong, FlatCollections.integerCollection( imgLong ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgShort, FlatCollections.integerCollection( imgShort ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgUnsignedLong, FlatCollections.integerCollection( imgUnsignedLong ), ( e, a ) -> e.getInteger() == a ); }
Source:
<code>public static Cluster open(final String configurationFile) throws Exception { File file = new File(configurationFile); if (!file.exists()) { <START> ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); <END> URL resource = currentClassLoader.getResource(configurationFile); file = new File(resource.getFile()); if (!file.exists()) { throw new IllegalArgumentException(String.format("Configuration file at %s does not exist", configurationFile)); } } return build(file).create(); }</code><technical_language>Note code style is final variables possible...could please add necessary</technical_language>

Target:
public static Cluster open(final String configurationFile) throws Exception { final File systemFile = new File(configurationFile); if (!systemFile.exists()) { final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); final URL resource = currentClassLoader.getResource(configurationFile); final File resourceFile = new File(resource.getFile()); if (!resourceFile.exists()) { throw new IllegalArgumentException(String.format("Configuration file at %s does not exist", configurationFile)); } return build(resourceFile).create(); } return build(systemFile).create(); }