auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Indexer(Config config, Deduper deduper) { this.config = config; this.deduper = deduper; this.localDatabase = new SqlDatabase(config); try { localDatabase.getConnection().setReadOnly(true); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.eventBus = LocalEventBus.getInstance(); }

Target:
public Indexer(Config config, Deduper deduper) { this.config = config; this.deduper = deduper; this.localDatabase = new SqlDatabase(config, true); this.eventBus = LocalEventBus.getInstance(); }
Source:
void setLocalPartitionCount(int partitionCount) { // this method should be invoked before participation, so the initial value is expected to be 0. if (!offlineCount.compareAndSet(0, partitionCount)) { logger.warn("Number of OFFLINE partitions has changed before initializing participant metrics"); } }

Target:
void setLocalPartitionCount(int partitionCount) { // this method should be invoked before participation, so the initial value is expected to be 0. if (!offlineCount.compareAndSet(0, partitionCount)) { throw new IllegalStateException( "Number of OFFLINE partitions has changed before initializing participant metrics"); } }
Source:
private void mapLinesToOffsets() throws IOException { try (Scanner scanner = new Scanner(Paths.get(filePath))) { int currentGlobalOffset = 0; while (scanner.hasNextLine()) { lineToOffset.add(currentGlobalOffset); currentGlobalOffset += getLineLengthWithLineSeparator(scanner); } } }

Target:
private void mapLinesToOffsets() throws IOException { try (Scanner scanner = new Scanner(filePath)) { int currentGlobalOffset = 0; while (scanner.hasNextLine()) { lineToOffset.add(currentGlobalOffset); currentGlobalOffset += getLineLengthWithLineSeparator(scanner); } } }
Source:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for All > AbandonedOpen--> status:abandoned GerritUi.Ftracer.traceInfo(NLS.bind(Messages.AllReviewsHandler_executeCommand, GerritQuery.QUERY_ALL_ABANDONED_CHANGES)); reviewTableView.processCommands(GerritQuery.QUERY_ALL_ABANDONED_CHANGES); return null; }

Target:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for All > AbandonedOpen--> status:abandoned reviewTableView.processCommands(GerritQuery.QUERY_ALL_ABANDONED_CHANGES); return null; }
Source:
private URL deploymentOne() throws Throwable { System.out.println("deployment"); return new URL("http://blah.com"); }

Target:
private URL deploymentOne() throws Throwable { return new URL("http://blah.com"); }
Source:
protected void limitTotalNumberOfCnxns() throws IOException { if (maxCnxns <= 0) { // maxCnxns limit is disabled return; } int cnxns = getNumAliveConnections(); if (cnxns >= maxCnxns) { throw new IOException("Too many connections " + cnxns + " - max is " + maxCnxns); } }

Target:
protected boolean limitTotalNumberOfCnxns() { if (maxCnxns <= 0) { // maxCnxns limit is disabled return false; } int cnxns = getNumAliveConnections(); if (cnxns >= maxCnxns) { LOG.error("Too many connections " + cnxns + " - max is " + maxCnxns); return true; } return false; }
Source:
public static XmlForm parse(String xml, boolean strict) throws IOException { ObjectMapper objectMapper = new XmlMapper(); if (!strict) { objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); //For production, ignore unknown stuff } XmlForm form = objectMapper.readValue(xml, XmlForm.class); System.out.println(form); //Debug only return form; }

Target:
public static XmlForm parse(String xml, boolean strict) throws IOException { ObjectMapper objectMapper = new XmlMapper(); if (!strict) { objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); //For production, ignore unknown stuff } XmlForm form = objectMapper.readValue(xml, XmlForm.class); return form; }