auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testOrderByQualifier() { OpenSourceProject project = new OpenSourceProject(); project.setName( PROJECT_NAME ); Programmer unclebob = new Programmer( CONTRIBUTOR1 ); Programmer ddalto = new Programmer( CONTRIBUTOR2 ); Programmer telegraph4eternity = new Programmer( CONTRIBUTOR3 ); Programmer fax4ever = new Programmer( CONTRIBUTOR4 ); Programmer phone4induction = new Programmer( CONTRIBUTOR5 ); project.addContributor( unclebob ); project.addContributor( ddalto ); project.addContributor( telegraph4eternity ); project.addContributor( fax4ever ); <START> project.addContributor( phone4induction ); <END> inTransaction( session -> persistAll( session, unclebob, ddalto, telegraph4eternity, fax4ever, phone4induction, project ) ); inTransaction( session -> { OpenSourceProject load = session.load( OpenSourceProject.class, PROJECT_NAME ); assertThat( load.getContributors() ).containsOnly( ddalto, fax4ever, phone4induction, telegraph4eternity, unclebob ); } ); }</code><technical_language>Instead of Id constants, create entities constants? This unit test shorter easier read</technical_language>

Target:
public void testOrderByQualifier() { OpenSourceProject project = new OpenSourceProject(); project.setName( PROJECT_NAME ); project.addContributor( UNCLEBOB ); project.addContributor( DDALTO ); project.addContributor( TELEGRAPH_4_ETERNITY ); project.addContributor( FAX_4_EVER ); project.addContributor( PHONE_4_INDUCTION ); inTransaction( session -> persistAll( session, UNCLEBOB, DDALTO, TELEGRAPH_4_ETERNITY, FAX_4_EVER, PHONE_4_INDUCTION, project ) ); inTransaction( session -> { OpenSourceProject load = session.load( OpenSourceProject.class, PROJECT_NAME ); assertThat( load.getContributors() ).containsOnly( DDALTO, FAX_4_EVER, PHONE_4_INDUCTION, TELEGRAPH_4_ETERNITY, UNCLEBOB ); assertThat( load.getContributors() ).hasSize( 5 ); assertThat( load.getContributors().get( 0 ) ).isEqualTo( DDALTO ); assertThat( load.getContributors().get( 1 ) ).isEqualTo( FAX_4_EVER ); assertThat( load.getContributors().get( 2 ) ).isEqualTo( PHONE_4_INDUCTION ); assertThat( load.getContributors().get( 3 ) ).isEqualTo( TELEGRAPH_4_ETERNITY ); assertThat( load.getContributors().get( 4 ) ).isEqualTo( UNCLEBOB ); } ); }
Source:
<code>public void setUp() throws Exception { URL resource = getClass().getResource("/projects/guess-project"); testProjectServiceClient.importProject( workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); ide.open(workspace); <START> projectExplorer.waitProjectExplorer(); <END> projectExplorer.waitItem(PROJECT_NAME); projectExplorer.selectItem(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME); }</code><technical_language>do need open project in setUp()? do in tests avoid skipping of tests execution in case of error, prevent duplication of code. expand full project tree once</technical_language>

Target:
public void setUp() throws Exception { URL resource = getClass().getResource("/projects/guess-project"); testProjectServiceClient.importProject( workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); ide.open(workspace); projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.selectItem(PROJECT_NAME); projectExplorer.quickExpandWithJavaScript(); }
Source:
<code>private ComponentParameter param(String category, String defaultValue, String type, String label, String name, List<String> comboValues) { <START> ComponentParameter param1 = new ComponentParameter(); <END> param1.setCategory(category); param1.setDefaultValue(defaultValue); param1.setType(type); param1.setLabel(label); param1.setName(name); param1.setComboValues(emptyList()); return param1; }</code><technical_language>create a constuctor for ComponentParameter</technical_language>

Target:
private ComponentParameter param(String category, String defaultValue, String type, String label, String name, List<String> comboValues) { return new ComponentParameter(name, type, category, defaultValue, label, comboValues); }
Source:
<code>private void checkForIllegalStreamName(String streamName, String streamDef) { try { StreamNode sn = parse(streamName, streamDef); fail("expected to fail but parsed " + sn.stringify()); } catch (StreamDefinitionException e) { assertEquals(XDDSLMessages.ILLEGAL_STREAM_NAME, e.getMessageCode()); assertEquals(0, e.getPosition()); <START> e.printStackTrace(); <END> assertEquals(streamName, e.getInserts()[0]); } }</code><technical_language>intend leave printStackTrace() here</technical_language>

Target:
private void checkForIllegalStreamName(String streamName, String streamDef) { try { StreamNode sn = parse(streamName, streamDef); fail("expected to fail but parsed " + sn.stringify()); } catch (StreamDefinitionException e) { assertEquals(XDDSLMessages.ILLEGAL_STREAM_NAME, e.getMessageCode()); assertEquals(0, e.getPosition()); assertEquals(streamName, e.getInserts()[0]); } }
Source:
<code><START> protected void <END> endRemoveEntity() { setCommandShouldBeLogged(false); setSucceeded(true); }</code><technical_language>I this is here. consider changing private</technical_language>

Target:
private void endRemoveEntity() { setCommandShouldBeLogged(false); setSucceeded(true); }
Source:
<code><START> public DruidQuerySignature(RowSignature rowSignature) <END> { this.isImmutable = false; this.rowSignature = rowSignature; this.virtualColumnPrefix = rowSignature == null ? "v" : Calcites.findUnusedPrefix( "v", new TreeSet<>(rowSignature.getRowOrder()) ); this.virtualColumnsByExpression = new HashMap<>(); this.virtualColumnsByName = new HashMap<>(); }</code><technical_language>Please add @Nullable for param</technical_language>

Target:
public DruidQuerySignature(RowSignature rowSignature) { this.isAggregateSignature = false; this.rowSignature = rowSignature; this.virtualColumnPrefix = rowSignature == null ? "v" : Calcites.findUnusedPrefix( "v", new TreeSet<>(rowSignature.getRowOrder()) ); this.virtualColumnsByExpression = new HashMap<>(); this.virtualColumnsByName = new HashMap<>(); }
Source:
<code>protected void internalInit() { final HashSet<String> names = new HashSet<>(); <START> final List<Client> loadedClients = loadClientsInternal(); <END> if (loadedClients != null) { for (final Client client : loadedClients) { final String name = client.getName(); if (names.contains(name)) { throw new TechnicalException("Duplicate name in clients: " + name); } names.add(name); updateCallbackUrlOfIndirectClient(client); } } }</code><technical_language>I loadClientsInternal method exist. getClients</technical_language>

Target:
protected void internalInit() { CommonHelper.assertNotNull("clients", getClients()); final HashSet<String> names = new HashSet<>(); for (final Client client : getClients()) { final String name = client.getName(); final String lowerName = name.toLowerCase(); if (names.contains(lowerName)) { throw new TechnicalException("Duplicate name in clients: " + name); } names.add(lowerName); updateCallbackUrlOfIndirectClient(client); } }
Source:
<code>public boolean upload(FilePath workspace, String artifactIncludes, PrintStream log) { boolean result = true; if(workspace!=null) { for(String roomId : roomIds) { SlackFileRequest slackFileRequest = new SlackFileRequest( workspace, populatedToken, roomId, null, artifactIncludes); try { workspace.getChannel().callAsync(new SlackUploadFileRunner(log, Jenkins.get().proxy, slackFileRequest)).get(); } catch (IllegalStateException e) { logger.log(Level.WARNING, "IllegalStateException", e); result = false; } catch (InterruptedException e) { <START> logger.log(Level.WARNING, "InterruptedException", e); <END> result = false; } catch (ExecutionException e) { logger.log(Level.WARNING, "ExecutionException", e); result = false; } catch (IOException e) { logger.log(Level.WARNING, "Error closing HttpClient", e); result = false; } } } else { logger.log(Level.WARNING, "Could not get workspace for current execution"); result = false; } return result; }</code><technical_language>need log of separately, exception message / stacktrace is, collapse in catch block please</technical_language>

Target:
public boolean upload(FilePath workspace, String artifactIncludes, PrintStream log) { boolean result = true; if(workspace!=null) { for(String roomId : roomIds) { SlackFileRequest slackFileRequest = new SlackFileRequest( workspace, populatedToken, roomId, null, artifactIncludes); try { workspace.getChannel().callAsync(new SlackUploadFileRunner(log, Jenkins.get().proxy, slackFileRequest)).get(); } catch (IllegalStateException | InterruptedException e) { logger.log(Level.WARNING, "Exception", e); result = false; } catch (ExecutionException e) { logger.log(Level.WARNING, "ExecutionException", e); result = false; } catch (IOException e) { logger.log(Level.WARNING, "Error closing HttpClient", e); result = false; } } } else { logger.log(Level.WARNING, "Could not get workspace for current execution"); result = false; } return result; }
Source:
<code>public void getApp(HttpServletRequest request, HttpServletResponse response, String app) { org.geoserver.platform.resource.Resource script = null; try { org.geoserver.platform.resource.Resource appDir; try { appDir = scriptManager.app(app); } catch (IllegalStateException e) { throw new RestException(format("Error looking up app directory %s", app), HttpStatus.INTERNAL_SERVER_ERROR); } if (appDir == null) { throw new RestException(format("No such app %s", app), HttpStatus.NOT_FOUND); } script = scriptManager.findAppMainScript(appDir); if (script == null) { throw new RestException(format("No main file for app %s", app), HttpStatus.NOT_FOUND); } ScriptEngine eng = scriptManager.createNewEngine(script); if (eng == null) { throw new RestException(format("Script engine for %s not found", script.name()), HttpStatus.BAD_REQUEST); } AppHook hook = scriptManager.lookupAppHook(script); if (hook == null) { throw new RestException(format("No hook found for %s", script.path()), HttpStatus.INTERNAL_SERVER_ERROR); } Reader in = new BufferedReader(new InputStreamReader(script.in())); try { eng.eval(in); hook.run(request, response, eng); } <START> finally { <END> in.close(); } } catch (Exception e) { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); throw new RestException("Error executing script " + script.name(), HttpStatus.INTERNAL_SERVER_ERROR); } }</code><technical_language>Minor style issue - finally line closing brace of try</technical_language>

Target:
public void getApp(HttpServletRequest request, HttpServletResponse response, String app) { Resource script = null; try { Resource appDir; try { appDir = scriptManager.app(app); } catch (IllegalStateException e) { throw new RestException(format("Error looking up app directory %s", app), HttpStatus.INTERNAL_SERVER_ERROR); } if (appDir == null) { throw new RestException(format("No such app %s", app), HttpStatus.NOT_FOUND); } script = scriptManager.findAppMainScript(appDir); if (script == null) { throw new RestException(format("No main file for app %s", app), HttpStatus.NOT_FOUND); } ScriptEngine eng = scriptManager.createNewEngine(script); if (eng == null) { throw new RestException(format("Script engine for %s not found", script.name()), HttpStatus.BAD_REQUEST); } AppHook hook = scriptManager.lookupAppHook(script); if (hook == null) { throw new RestException(format("No hook found for %s", script.path()), HttpStatus.INTERNAL_SERVER_ERROR); } Reader in = new BufferedReader(new InputStreamReader(script.in())); try { eng.eval(in); hook.run(request, response, eng); } finally { in.close(); } } catch (Exception e) { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); throw new RestException("Error executing script " + script.name(), HttpStatus.INTERNAL_SERVER_ERROR); } }
Source:
<code>public void shouldGetAllDistinctStages() throws Exception { List<StageConfigIdentifier> expectedResult = new ArrayList<StageConfigIdentifier>(); <START> when(sqlMapClientTemplate.queryForObject("findStageHistoryEntryBefore")).thenReturn(expectedResult); <END> List<StageConfigIdentifier> result = stageSqlMapDao.getAllDistinctStages(); assertThat(result, is(expectedResult)); }</code><technical_language>put some dummy object expectedResult? Otherwise, this is a check for empty list</technical_language>

Target:
public void shouldGetAllDistinctStages() throws Exception { List<StageConfigIdentifier> expectedResult = Arrays.asList(new StageConfigIdentifier()); when(sqlMapClientTemplate.queryForList("getDistinctStages")).thenReturn(expectedResult); List<StageConfigIdentifier> result = stageSqlMapDao.getAllDistinctStages(); assertThat(result, is(expectedResult)); }
Source:
<code>private void removeNetworkFromHosts() { List<VdsNetworkInterface> nics = interfaceDao.getAllInterfacesByLabelForDataCenter(getStoragePoolId(), network.getLabel()); ArrayList<ActionParametersBase> parameters = removeNetworkParametersBuilder.buildParameters(network, nics); if <START> (!parameters.isEmpty()) { <END> HostSetupNetworksParametersBuilder.updateParametersSequencing(parameters); parameters.forEach(this::withRootCommandInfo); backend.runInternalMultipleActions(ActionType.PersistentHostSetupNetworks, parameters, cloneContextAndDetachFromParent()); } }</code><technical_language>happen if network is connected host? notifications</technical_language>

Target:
private void removeNetworkFromHosts() { List<VdsNetworkInterface> nics = interfaceDao.getAllInterfacesByLabelForDataCenter(getStoragePoolId(), network.getLabel()); setupNetworksParameters = removeNetworkParametersBuilder.buildParameters(network, nics); if (!setupNetworksParameters.isEmpty()) { HostSetupNetworksParametersBuilder.updateParametersSequencing(setupNetworksParameters); setupNetworksParameters.forEach(this::withRootCommandInfo); backend.runInternalMultipleActions(ActionType.PersistentHostSetupNetworks, setupNetworksParameters, cloneContextAndDetachFromParent()); } }
Source:
<code>public void checkPrefixFormatValidation() { assertEquals("Failed to validate prefix's Format: " + mask, <START> isMaskValid && isPrefixValid, MaskValidator.getInstance().isPrefixValid(mask)); <END> }</code><technical_language>isMaskValid parameter is irrelevant here. This test checks input is in valid prefix format</technical_language>

Target:
public void checkPrefixFormatValidation() { assertEquals("Failed to validate prefix's Format: " + mask, isPrefixValid, MaskValidator.getInstance().isPrefixValid(mask)); }
Source:
<code>public static OkHttpClient.Builder enableTls12OnPreLollipop(OkHttpClient.Builder client) { if (Build.VERSION.SDK_INT >= 16 && Build.VERSION.SDK_INT < 22) { try { SSLContext sc = SSLContext.getInstance("TLSv1.2"); sc.init(null, null, null); client.sslSocketFactory(new Tls12SocketFactory(sc.getSocketFactory())); ConnectionSpec cs = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) .tlsVersions(TlsVersion.TLS_1_2) .build(); List<ConnectionSpec> specs = new ArrayList<>(); specs.add(cs); specs.add(ConnectionSpec.COMPATIBLE_TLS); specs.add(ConnectionSpec.CLEARTEXT); client.connectionSpecs(specs); <START> } catch (Exception exc) { <END> logger.error(exc); } } return client; }</code><technical_language>catch exception there</technical_language>

Target:
public static OkHttpClient.Builder enableTls12OnPreLollipop(OkHttpClient.Builder client) { if (Build.VERSION.SDK_INT >= 16 && Build.VERSION.SDK_INT < 22) { try { final SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, null, null); client.sslSocketFactory(new Tls12SocketFactory(sslContext.getSocketFactory())); final ConnectionSpec connectionSpec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) .tlsVersions(TlsVersion.TLS_1_2) .build(); final List<ConnectionSpec> specs = new ArrayList<>(); specs.add(connectionSpec); specs.add(ConnectionSpec.COMPATIBLE_TLS); specs.add(ConnectionSpec.CLEARTEXT); client.connectionSpecs(specs); } catch (NoSuchAlgorithmException e) { logger.error(e); } catch (KeyManagementException e) { logger.error(e); } } return client; }
Source:
<code>private void informUnkownHaskellException() { <START> String msg = "Whoops! An unkown error has occured. We're sorry, but can't really tell you more than this."; <END> CustomAlert alert = new CustomAlert(getPane(), msg); getPane().getChildren().add(alert); alert.relocate(this.getLayoutX() + 100, this.getLayoutY() + 100); }</code><technical_language>this method (optionally) Exception add a button show Exception's toString</technical_language>

Target:
protected void informUnkownHaskellException() { String msg = "Whoops! An unkown error has occured. We're sorry, but can't really tell you more than this."; CustomAlert alert = new CustomAlert(getPane(), msg); getPane().getChildren().add(alert); alert.relocate(this.getLayoutX() + 100, this.getLayoutY() + 100); }
Source:
<code>public void runWorkflowThroughOneSuccessfulState() { WorkflowInstance instance = executingInstanceBuilder().setType("execute-test").setState("start").build(); when(workflowInstances.getWorkflowInstance(instance.id, INCLUDES, null)).thenReturn(instance); when(workflowInstancePreProcessor.process(newChildWorkflow)).thenReturn(newChildWorkflow); when(workflowInstancePreProcessor.process(newWorkflow)).thenReturn(newWorkflow); <START> assertTimeoutPreemptively(ofSeconds(5),() -> executor.run()); <END> verify(workflowInstanceDao).updateWorkflowInstanceAfterExecution( argThat( matchesWorkflowInstance(inProgress, ExecuteTestWorkflow.State.process, 0, is("Scheduled by previous state start"))), argThat(matchesWorkflowInstanceAction(ExecuteTestWorkflow.State.start, is("Process after delay"), 0, stateExecution)), childWorkflows.capture(), workflows.capture(), eq(true)); assertThat(childWorkflows.getValue().get(0), is(newChildWorkflow)); assertThat(workflows.getValue().get(0), is(newWorkflow)); }</code><technical_language>extract method suggestion assertTimeoutPreemptively(ofSeconds(5), () -> executor.run());</technical_language>

Target:
public void runWorkflowThroughOneSuccessfulState() { WorkflowInstance instance = executingInstanceBuilder().setType("execute-test").setState("start").build(); when(workflowInstances.getWorkflowInstance(instance.id, INCLUDES, null)).thenReturn(instance); when(workflowInstancePreProcessor.process(newChildWorkflow)).thenReturn(newChildWorkflow); when(workflowInstancePreProcessor.process(newWorkflow)).thenReturn(newWorkflow); runExecutorWithTimout(); verify(workflowInstanceDao).updateWorkflowInstanceAfterExecution( argThat( matchesWorkflowInstance(inProgress, ExecuteTestWorkflow.State.process, 0, is("Scheduled by previous state start"))), argThat(matchesWorkflowInstanceAction(ExecuteTestWorkflow.State.start, is("Process after delay"), 0, stateExecution)), childWorkflows.capture(), workflows.capture(), eq(true)); assertThat(childWorkflows.getValue().get(0), is(newChildWorkflow)); assertThat(workflows.getValue().get(0), is(newWorkflow)); }
Source:
<code>public DiscountViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); <START> } <END></code><technical_language>extra lines</technical_language>

Target:
public DiscountViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); context = itemView.getContext(); }
Source:
<code>public FlatTextRange(int start, int end) { this.start = start; this.end = end; <START> this.length = end - start; <END> }</code><technical_language>add sanity check</technical_language>

Target:
public FlatTextRange(int start, int end) { if (end < start) { throw new IllegalArgumentException("start must be < end"); } this.start = start; this.end = end; this.length = end - start; }
Source:
<code>public void connectionChanged(@Nonnull EnderLiquidConduit con, @Nonnull EnumFacing conDir) { NetworkTankKey key = new NetworkTankKey(con, conDir); NetworkTank tank = new NetworkTank(con, conDir); tanks.remove(tank); tanks.add(tank); tankMap.remove(key); tankMap.put(key, tank); hasMultipleTanksSet.remove(key); <START> if (tank.isValid() && !tank.externalTank.getTankInfoWrappers().isEmpty()) { <END> hasMultipleTanksSet.add(key); } tanks.sort((left, right) -> right.priority - left.priority); }</code><technical_language>size() > 1 instead of !.isEmpty() sense here? Do assuming a tank a tank list of 1 stay 1 return tank's content asked "anything"</technical_language>

Target:
public void connectionChanged(@Nonnull EnderLiquidConduit con, @Nonnull EnumFacing conDir) { NetworkTankKey key = new NetworkTankKey(con, conDir); NetworkTank tank = new NetworkTank(con, conDir); tanks.remove(tank); tanks.add(tank); tankMap.remove(key); tankMap.put(key, tank); tanks.sort((left, right) -> right.priority - left.priority); }
Source:
<code>public boolean onPrepareActionMode(ActionMode mode, Menu menu) { <START> boolean isClozeType, itemExists; <END> int noteModelType; try { noteModelType = getCurrentlySelectedModel().getInt("type"); } catch (JSONException e) { throw new RuntimeException(e); } isClozeType = noteModelType == Consts.MODEL_CLOZE; itemExists = menu.findItem(mMenuId) != null; if (isClozeType && !itemExists) { menu.add(Menu.NONE, mMenuId, 0, R.string.multimedia_editor_popup_cloze); return true; } else { return false; } }</code><technical_language>Is some reason declaring variables initializing them? reduces readability for apparent reason</technical_language>

Target:
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { int noteModelType; try { noteModelType = getCurrentlySelectedModel().getInt("type"); } catch (JSONException e) { throw new RuntimeException(e); } boolean isClozeType = noteModelType == Consts.MODEL_CLOZE; boolean itemExists = menu.findItem(mMenuId) != null; if (isClozeType && !itemExists) { menu.add(Menu.NONE, mMenuId, 0, R.string.multimedia_editor_popup_cloze); return true; } else { return false; } }
Source:
<code><START> public static Graph load(InputStream in) { <END> Input input = new Input(in); Kryo kryo = makeKryo(); GraphAndEdges graphAndEdges = (GraphAndEdges) kryo.readClassAndObject(input); Graph graph = graphAndEdges.graph; LOG.debug("Graph read."); if (graph.graphVersionMismatch()) { throw new RuntimeException("Graph version mismatch detected."); } graphAndEdges.reconstructEdgeLists(); LOG.info("Graph read. |V|={} |E|={}", graph.countVertices(), graph.countEdges()); graph.index(new DefaultStreetVertexIndexFactory()); return graph; }</code><technical_language>This method moved GraphAndEdges class makeKryo(), save(OutputStream outputStream) - making GraphAndEdges responsible for serialization</technical_language>

Target:
public static Graph load(InputStream in) { Input input = new Input(in); Kryo kryo = SerializedGraphObject.makeKryo(); SerializedGraphObject serializedGraphObject = (SerializedGraphObject) kryo.readClassAndObject(input); Graph graph = serializedGraphObject.graph; LOG.debug("Graph read."); if (graph.graphVersionMismatch()) { throw new RuntimeException("Graph version mismatch detected."); } serializedGraphObject.reconstructEdgeLists(); LOG.info("Graph read. |V|={} |E|={}", graph.countVertices(), graph.countEdges()); graph.index(new DefaultStreetVertexIndexFactory()); return graph; }
Source:
<code>public int getLocalTableBlogIdForJetpackOrWpComRemoteSiteId(int remoteBlogId) { int localId = getLocalTableBlogIdForJetpackRemoteID(remoteBlogId, null); if (localId == 0) { <START> localId = getLocalTableBlogIdForRemoteBlogId(remoteBlogId); <END> } return localId; }</code><technical_language>I call getLocalTableBlogIdForRemoteBlogId(remoteBlogId) changed here, getLocalTableBlogIdForRemoteBlogId ensure dotcomFlag=1. a edge case, hosted network installations of WP, blog_id field a high number, matches values wpcom. add a new method getLocalTableBlogIdForWpComRemoteBlogId thar int localBlogID = SqlUtils.intForQuery(db, "SELECT id accounts blogId=? dotcomFlag=1", new String[]{Integer.toString(remoteBlogId)});</technical_language>

Target:
public int getLocalTableBlogIdForJetpackOrWpComRemoteSiteId(int remoteBlogId) { int localId = getLocalTableBlogIdForJetpackRemoteID(remoteBlogId, null); if (localId == 0) { localId = getLocalTableBlogIdForWpComRemoteBlogId(remoteBlogId); } return localId; }
Source:
<code>protected String loadKieTextFromJar(final String jarFilePath, final String subPath, final String fileName) { ArtifactRepository repository = this.getArtifactRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME); final File file = new File(repository.getRootDir(), jarFilePath); final String normalizedPath = file.toPath().normalize().toString(); if (isJar(normalizedPath) || isKJar(normalizedPath)) { return loadFileTextFromJar(file, subPath, fileName); } <START> return ""; <END> }</code><technical_language>TLDR; I return null here. I a ways handling "issue file" .... here, returning empty string in case filename end .jar .kjar. If end suffixes, file is corrupt error reading happens, return null loadFileTextFromJar method. Empty string IMO returned file exists, is a jar/kjar a zipentry entry is empty file</technical_language>

Target:
protected String loadKieTextFromJar(final String jarFilePath, final String subPath, final String fileName) { ArtifactRepository repository = this.getArtifactRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME); final File file = new File(repository.getRootDir(), jarFilePath); final String normalizedPath = file.toPath().normalize().toString(); if (isJar(normalizedPath) || isKJar(normalizedPath)) { return loadFileTextFromJar(file, subPath, fileName); } return null; }
Source:
<code>private void finalizePipeline(PipelineID pipelineId) throws IOException { lock.writeLock().lock(); try { stateManager.finalizePipeline(pipelineId); Set<ContainerID> containerIDs = stateManager.getContainers(pipelineId); for (ContainerID containerID : containerIDs) { eventPublisher.fireEvent(SCMEvents.CLOSE_CONTAINER, containerID); } <START> metrics.clearMetrics(pipelineId); <END> } finally { lock.writeLock().unlock(); } }</code><technical_language>Lets rename this removePipelineMetrics</technical_language>

Target:
private void finalizePipeline(PipelineID pipelineId) throws IOException { lock.writeLock().lock(); try { stateManager.finalizePipeline(pipelineId); Set<ContainerID> containerIDs = stateManager.getContainers(pipelineId); for (ContainerID containerID : containerIDs) { eventPublisher.fireEvent(SCMEvents.CLOSE_CONTAINER, containerID); } metrics.removePipelineMetrics(pipelineId); } finally { lock.writeLock().unlock(); } }
Source:
<code>public boolean contains (Circle circle) { float xmin = circle.x - circle.radius; float xmax = circle.x + circle.radius; float ymin = circle.y - circle.radius; float ymax = circle.y + circle.radius; return (xmin >= x && xmin <= x + width) && (xmax >= x && xmax <= x + width) <START> && (ymin >= y && ymin <= y + height) && (ymax >= y && ymax <= y + height); <END> }</code><technical_language>min <= max, this reduced to: xmin >= x && xmax <= x + width && ymin >= y && ymax <= y + height</technical_language>

Target:
public boolean contains (Circle circle) { return (circle.x - circle.radius >= x) && (circle.x + circle.radius <= x + width) && (circle.y - circle.radius >= y) && (circle.y + circle.radius <= y + height); }
Source:
<code>private void setFocusOnVisible() { TerminalSession visibleTerminal = getSelectedTerminal(); if (visibleTerminal != null) { if (!suppressAutoFocus_) Scheduler.get().scheduleDeferred(() -> { if (visibleTerminal.terminalEmulatorLoaded()) { visibleTerminal.setFocus(true); } else { <START> new Timer() <END> { @Override public void run() { if (visibleTerminal.terminalEmulatorLoaded()) { visibleTerminal.setFocus(true); } } }.schedule(200); } }); activeTerminalToolbarButton_.setActiveTerminal( visibleTerminal.getCaption(), visibleTerminal.getHandle()); setTerminalTitle(visibleTerminal.getTitle()); } }</code><technical_language>FYI, recently-added Timers.singleShot(200, () -> { ... }) a more succinct of expressing this. <LINK_0></technical_language>

Target:
private void setFocusOnVisible() { TerminalSession visibleTerminal = getSelectedTerminal(); if (visibleTerminal != null) { if (!suppressAutoFocus_) Scheduler.get().scheduleDeferred(() -> { if (visibleTerminal.terminalEmulatorLoaded()) { visibleTerminal.setFocus(true); } else { Timers.singleShot(200, () -> { if (visibleTerminal.terminalEmulatorLoaded()) visibleTerminal.setFocus(true); }); } }); activeTerminalToolbarButton_.setActiveTerminal( visibleTerminal.getCaption(), visibleTerminal.getHandle()); setTerminalTitle(visibleTerminal.getTitle()); } }
Source:
<code>EmailSender(final Mailer mailer, final Config config, final ObjectMapper mapper) { _fromAddress = config.getString("fromAddress"); _mailer = mailer; try { <START> _allowedRecipients = mapper.readValue(ConfigurationHelper.toJson(config, "allowedRecipients"), ALLOWED_RECIPIENTS_TYPE); <END> } catch (final IOException e) { throw new IllegalArgumentException(e); } }</code><technical_language>nit. this string literal a top-level constant</technical_language>

Target:
EmailSender(final Mailer mailer, final Config config, final ObjectMapper mapper) { _fromAddress = config.getString("fromAddress"); _mailer = mailer; try { _allowedRecipients = mapper.readValue(ConfigurationHelper.toJson(config, ALLOWED_RECIPIENTS_KEY), ALLOWED_RECIPIENTS_TYPE); } catch (final IOException e) { throw new IllegalArgumentException(e); } }
Source:
<code>public void setName(String name) { if (name == null) { super.setName(name); return; <START> } else if (name.startsWith(this.getContextIndex() + ":")) { <END> name = name.substring(name.indexOf(":")+1); } super.setName(getPanelName(this.getContextIndex(), name)); }</code><technical_language>else is necessary (the if returns)</technical_language>

Target:
public void setName(String name) { if (name == null) { super.setName(name); return; } if (name.startsWith(this.getContextIndex() + ":")) { name = name.substring(name.indexOf(":")+1); } super.setName(getPanelName(this.getContextIndex(), name)); }
Source:
<code>public Long create(T data) { logger.debug("Adding new row to table for data object {}", getTableName(), data); assertDatabaseOpen(); ContentValues contentValues = new ContentValues(); <START> if (getContentValuesPopulator().populate(contentValues, data) == true) { <END> logger.debug("Adding new row to table with Content Values {}", getTableName(), contentValues); if (listenerRegistry != null) listenerRegistry.listener(data, this); return database.insert(getName(), null, contentValues); } return (long) -1; }</code><technical_language>need do a == true check, a simple check works if (getContentValuesPopulator().populate(contentValues, data)) { .... }</technical_language>

Target:
public Long create(T data) { logger.debug("Adding new row to table for data object {}", getTableName(), data); assertDatabaseOpen(); ContentValues contentValues = new ContentValues(); if (getContentValuesPopulator().populate(contentValues, data)) { logger.debug("Adding new row to table with Content Values {}", getTableName(), contentValues); if (listenerRegistry != null) listenerRegistry.listener(data, this); return database.insert(getName(), null, contentValues); } return (long) -1; }
Source:
<code>public void shouldThrowExceptionIfCursorNullObservable() { final PreparedGetCursor queryWithNullResult = createQueryWithNullResult(); final TestSubscriber<Cursor> testSubscriber = new TestSubscriber<Cursor>(); queryWithNullResult .createObservable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); <START> testSubscriber.assertError(StorIOException.class); <END> }</code><technical_language>Please add check for exception type message, expected exception</technical_language>

Target:
public void shouldThrowExceptionIfCursorNullObservable() { final PreparedGetCursor queryWithNullResult = createQueryWithNullResult(); final TestSubscriber<Cursor> testSubscriber = new TestSubscriber<Cursor>(); queryWithNullResult .createObservable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); TestUtils.checkException( testSubscriber, StorIOException.class, IllegalStateException.class, "Cursor returned by content provider is null"); }
Source:
<code>private boolean authorize(String username, HttpServerRequest request) throws HttpAuthenticationException { if (log.isTraceEnabled()) { try { log.tracef("Trying to authorize user %s using FormAuthenticationMechanism. Request URI: [%s], Context path: [%s], Session ID: [%s]", username, request.getRequestURI(), this.contextPath, getSessionScope(request, false).getID()); <START> } catch (NullPointerException ex) { <END> log.tracef("Unable to re-authorize user %s using FormAuthenticationMechanism. There is no session attached to the following request. " + "Request URI: [%s], Context path: [%s]", username, request.getRequestURI(), this.contextPath); } } IdentityCache identityCache = createIdentityCache(request, true); if (identityCache != null) { CachedIdentityAuthorizeCallback authorizeCallback = new CachedIdentityAuthorizeCallback(username, identityCache); try { callbackHandler.handle(new Callback[]{authorizeCallback}); return authorizeCallback.isAuthorized(); } catch (IOException | UnsupportedCallbackException e) { throw new HttpAuthenticationException(e); } } return super.authorize(username); }</code><technical_language>NPE catch control flow is a good pattern. do null check hand</technical_language>

Target:
private boolean authorize(String username, HttpServerRequest request) throws HttpAuthenticationException { log.tracef("Authorizing username: [%s], Request URI: [%s], Context path: [%s]", username, request.getRequestURI(), this.contextPath); IdentityCache identityCache = createIdentityCache(request, true); if (identityCache != null) { CachedIdentityAuthorizeCallback authorizeCallback = new CachedIdentityAuthorizeCallback(username, identityCache); try { callbackHandler.handle(new Callback[]{authorizeCallback}); return authorizeCallback.isAuthorized(); } catch (IOException | UnsupportedCallbackException e) { throw new HttpAuthenticationException(e); } } return super.authorize(username); }
Source:
<code>public ReactiveCosmosTemplate(CosmosFactory cosmosFactory, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter) { <START> Assert.notNull(cosmosFactory, "CosmosDbFactory must not be null!"); <END> Assert.notNull(cosmosConfig, "CosmosConfig must not be null!"); Assert.notNull(mappingCosmosConverter, "MappingCosmosConverter must not be null!"); this.cosmosFactory = cosmosFactory; this.cosmosConfig = cosmosConfig; this.mappingCosmosConverter = mappingCosmosConverter; this.cosmosAsyncClient = cosmosFactory.getCosmosClient(); }</code><technical_language>Rename -> CosmosDbFactory CosmosFactory</technical_language>

Target:
public ReactiveCosmosTemplate(CosmosFactory cosmosFactory, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter) { Assert.notNull(cosmosFactory, "CosmosFactory must not be null!"); Assert.notNull(cosmosConfig, "CosmosConfig must not be null!"); Assert.notNull(mappingCosmosConverter, "MappingCosmosConverter must not be null!"); this.mappingCosmosConverter = mappingCosmosConverter; this.cosmosAsyncClient = cosmosFactory.getCosmosAsyncClient(); this.databaseName = cosmosFactory.getDatabaseName(); this.responseDiagnosticsProcessor = cosmosConfig.getResponseDiagnosticsProcessor(); this.queryMetricsEnabled = cosmosConfig.isQueryMetricsEnabled(); }
Source:
<code>protected static Blob readStringBlob(String ctype, String fileName, String content) throws IOException { Blob blob = new StringBlob(fileName, content, ctype); <START> return blob; <END> }</code><technical_language>line need throw IOException</technical_language>

Target:
protected static Blob readStringBlob(String ctype, String fileName, String content) { return new StringBlob(fileName, content, ctype); }
Source:
<code>public Map<String, Mapped<PatientDataDefinition>> getContainedDataDefinitions() { <START> return containedDataDefinitions; <END> }</code><technical_language>above, change this "if (containedDataDefinitions == null) { containedDataDefinitions = new HashMap... }; return containedDataDefinitions;</technical_language>

Target:
public Map<String, Mapped<PatientDataDefinition>> getContainedDataDefinitions() { if (containedDataDefinitions == null) { containedDataDefinitions = new HashMap<String, Mapped<PatientDataDefinition>>(); } return containedDataDefinitions; }
Source:
<code>public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) { if (isReal || hasData) { if (!this.tank.getFluidInstance().isEmpty()) { info.add(new LiteralText(this.tank.getFluidAmount() + " of " + this.tank.getFluid())); } else { info.add(new LiteralText("Empty")); } } <START> info.add(new LiteralText(Formatting.GRAY + "Capacity: " + Formatting.GOLD + this.tank.getCapacity() + " (" + this.tank.getCapacity().getRawValue() / 1000 + ")")); <END> }</code><technical_language>PLease, add translation</technical_language>

Target:
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) { if (isReal || hasData) { if (!this.tank.getFluidInstance().isEmpty()) { info.add(new LiteralText(this.tank.getFluidAmount() + StringUtils.t("techreborn.tooltip.unit.divider") + this.tank.getFluid())); } else { info.add(new TranslatableText("techreborn.tooltip.unit.empty")); } } info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.unit.capacity") + ":" + Formatting.GOLD + this.tank.getCapacity() + " (" + this.tank.getCapacity().getRawValue() / 1000 + ")")); }
Source:
<code>public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader!"); <START> metrics.leaderElection.inc(); <END> zkController.subscribeToProcessorChange(); debounceTimer.scheduleAfterDebounceTime( ScheduleAfterDebounceTime.ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }</code><technical_language>@PawasChhokra this metric counts number of times a processor leader. metric name "leader-election" easily misinterpreted number of times processor participated in leader election. please rename this metric</technical_language>

Target:
public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader!"); metrics.isLeader.set(true); zkController.subscribeToProcessorChange(); debounceTimer.scheduleAfterDebounceTime( ScheduleAfterDebounceTime.ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }
Source:
<code>RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { if (firstParent && i > 0) { break; } RevCommit p = c.parents[i]; if ((p.flags & SEEN) != 0) { continue; } <START> if ((p.flags & PARSED) == 0) { p.parseHeaders(walker); } <END> p.flags |= SEEN; pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }</code><technical_language>Is this needed for non-first parents, too? I thought through. (The non-first parents encountered RevCommit.carryFlags. quickly code assumes a RevCommit is parsed code doesn't.)</technical_language>

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; if (firstParent && i > 0) { continue; } pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }
Source:
<code>public void startClientAwakeTimer() { try { timerSemaphore.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } if (clientAwakeTime != 0) { if (clientAwakeTimer != null) { clientAwakeTimer.cancel(); clientAwakeTimer.purge(); } clientAwakeTimer = new Timer(); clientAwakeTask = new TimerTask() { @Override public void run() { if (!isClientSleeping()) { setSleeping(); } } }; clientAwakeTimer.schedule(clientAwakeTask, clientAwakeTime); } <START> timerSemaphore.release(); <END> }</code><technical_language>release in finally block</technical_language>

Target:
public void startClientAwakeTimer() { try { timerSemaphore.acquire(); try { if (clientAwakeTime != 0) { if (clientAwakeTimer != null) { clientAwakeTimer.cancel(); clientAwakeTimer.purge(); } clientAwakeTimer = new Timer(); clientAwakeTask = new TimerTask() { @Override public void run() { if (!isClientSleeping()) { setSleeping(); } } }; clientAwakeTimer.schedule(clientAwakeTask, clientAwakeTime); } } finally { timerSemaphore.release(); } } catch (InterruptedException e) { LOG.warn("Unable to restart the client timer due to semaphore exception", e); } }
Source:
<code>public void <START> setFetchAtomic(final boolean <END> atomic) { this.fetchAtomic = Optional.of(atomic); }</code><technical_language>nit. unnecessary 'final'</technical_language>

Target:
public void setFetchAtomic(final boolean atomic) { this.fetchAtomic = atomic; }
Source:
<code>public void finalizeCompileActionBuilder( BuildConfiguration configuration, FeatureConfiguration featureConfiguration, CppCompileActionBuilder actionBuilder) { CcToolchainProvider toolchain = actionBuilder.getToolchain(); actionBuilder .addTransitiveMandatoryInputs( configuration.getFragment(CppConfiguration.class).useSpecificToolFiles() <START> ? (actionBuilder.getActionName() == CppActionNames.ASSEMBLE <END> ? toolchain.getAsFiles() : toolchain.getCompilerFiles()) : toolchain.getAllFiles()) .setShouldScanIncludes(false); }</code><technical_language>equals() instead of ==</technical_language>

Target:
public void finalizeCompileActionBuilder( BuildConfiguration configuration, FeatureConfiguration featureConfiguration, CppCompileActionBuilder actionBuilder) { CcToolchainProvider toolchain = actionBuilder.getToolchain(); actionBuilder .addTransitiveMandatoryInputs( configuration.getFragment(CppConfiguration.class).useSpecificToolFiles() ? (actionBuilder.getActionName().equals(CppActionNames.ASSEMBLE) ? toolchain.getAsFiles() : toolchain.getCompilerFiles()) : toolchain.getAllFiles()) .setShouldScanIncludes(false); }
Source:
<code>private String generateRandomPassword() { <START> String acceptable = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(),."; END> char[] chars = new char[8]; for (int i = 0; i < chars.length; i++) { char r = acceptable.charAt(rand.nextInt(acceptable.length())); chars[i] = r; } return new String(chars); }</code><technical_language>include confusing characters 1 I, 0 O, . ,</technical_language>

Target:
private String generateRandomPassword() { String acceptable = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(),."; char[] chars = new char[8]; char last = 'a'; for (int i = 0; i < chars.length; i++) { char r = acceptable.charAt(rand.nextInt(acceptable.length())); while (checkSimilar(last, r)) r = acceptable.charAt(rand.nextInt(acceptable.length())); last = r; chars[i] = r; } return new String(chars); }
Source:
<code>protected void execute(Context context) throws SQLException { <START> MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users"); <END> massUpdate.select("SELECT u.id, g.id FROM users u " + "INNER JOIN organization_members om ON om.user_id=u.id " + "INNER JOIN groups g ON g.organization_uuid=om.organization_uuid AND g.name=? " + "WHERE u.active=? AND NOT EXISTS " + "(SELECT 1 FROM groups_users gu " + "INNER JOIN groups g on g.id=gu.group_id AND g.name=? " + "WHERE gu.user_id=u.id)") .setString(1, MEMBERS_NAME) .setBoolean(2, true) .setString(3, MEMBERS_NAME); massUpdate.update("INSERT INTO groups_users (user_id, group_id) values (?, ?)"); massUpdate.execute((row, update) -> { update.setLong(1, row.getLong(1)); update.setLong(2, row.getLong(2)); return true; }); }</code><technical_language>name users</technical_language>

Target:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users not belonging to 'members' group"); massUpdate.select("SELECT u.id, g.id FROM users u " + "INNER JOIN organization_members om ON om.user_id=u.id " + "INNER JOIN groups g ON g.organization_uuid=om.organization_uuid AND g.name=? " + "WHERE u.active=? AND NOT EXISTS " + "(SELECT 1 FROM groups_users gu " + "INNER JOIN groups g on g.id=gu.group_id AND g.name=? " + "WHERE gu.user_id=u.id)") .setString(1, MEMBERS_NAME) .setBoolean(2, true) .setString(3, MEMBERS_NAME); massUpdate.update("INSERT INTO groups_users (user_id, group_id) values (?, ?)"); massUpdate.execute((row, update) -> { update.setLong(1, row.getLong(1)); update.setLong(2, row.getLong(2)); return true; }); }
Source:
<code>public void prepare() { <START> if ( isPreparing ) { <END> return; } isPreparing = true; try { for ( PojoContainedTypeWorkPlan<?> delegate : containedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.prepare(); } } finally { isPreparing = false; } }</code><technical_language>This looks... odd. reproduce issue working around? concerned need do more ignoring call..</technical_language>

Target:
public void prepare() { if ( isPreparing ) { throw log.recursiveWorkPlanPrepare(); } isPreparing = true; try { for ( PojoContainedTypeWorkPlan<?> delegate : containedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.resolveDirty( this::updateBecauseOfContained ); } for ( PojoIndexedTypeWorkPlan<?, ?, ?> delegate : indexedTypeDelegates.values() ) { delegate.prepare(); } } finally { isPreparing = false; } }
Source:
<code>private void addSystemProperties(){ Properties properties = new Properties(); String filePath = System.getProperty(CONF_DIRECTORY_PATH) + File.separator + CARBON_PROPERTIES; File file = new File(filePath); if (file.exists()) { InputStream in = null; try { in = new FileInputStream(file); properties.load(in); } catch (IOException e) { e.printStackTrace(); System.exit(1); } finally { if (in != null) { try { in.close(); } catch (IOException ignored) { } } } } Set<Object> keys = properties.keySet(); for (Object key: keys) { System.setProperty((String)key, (String)properties.get(key)); } <START> System.setProperty("javax.xml.bind.JAXBContextFactory", "com.sun.xml.bind.v2.ContextFactory"); <END> }</code><technical_language>carbon.properties file pass property</technical_language>

Target:
private void addSystemProperties(){ Properties properties = new Properties(); String filePath = System.getProperty(CONF_DIRECTORY_PATH) + File.separator + CARBON_PROPERTIES; File file = new File(filePath); if (file.exists()) { InputStream in = null; try { in = new FileInputStream(file); properties.load(in); } catch (IOException e) { e.printStackTrace(); System.exit(1); } finally { if (in != null) { try { in.close(); } catch (IOException ignored) { } } } } Set<Object> keys = properties.keySet(); for (Object key: keys) { System.setProperty((String)key, (String)properties.get(key)); } }