auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void apply(Project project) { project.getTasks().withType(Test.class).configureEach(task -> { task.jvmArgs("-XX:+HeapDumpOnOutOfMemoryError", "-XX:+CrashOnOutOfMemoryError"); if (!Objects.equals("true", project.findProperty("com.palantir.baseline.restore-test-cache"))) { task.getOutputs().cacheIf(t -> false); } String shouldRecreate = System.getProperty("recreate", "false"); task.systemProperty("recreate", shouldRecreate); <START> task.getInputs().property("recreate", shouldRecreate); <END> }); project.getPlugins().withType(JavaPlugin.class, unusedPlugin -> { project.afterEvaluate(proj -> { proj.getConvention() .getPlugin(JavaPluginConvention.class) .getSourceSets() .matching(ss -> hasCompileDependenciesMatching(proj, ss, BaselineTesting::isJunitJupiter)) .forEach(ss -> { Optional<Test> maybeTestTask = getTestTaskForSourceSet(proj, ss); if (!maybeTestTask.isPresent()) { log.warn("Detected 'org:junit.jupiter:junit-jupiter', but unable to find test task"); return; } log.info( "Detected 'org:junit.jupiter:junit-jupiter', enabling useJUnitPlatform() on {}", maybeTestTask.get().getName()); enableJunit5ForTestTask(maybeTestTask.get()); }); }); TaskProvider<CheckJUnitDependencies> task = project.getTasks().register("checkJUnitDependencies", CheckJUnitDependencies.class); project.getTasks().findByName(JavaPlugin.TEST_TASK_NAME).dependsOn(task); }); }</code><technical_language>defensive disable caching shouldRecreate=true</technical_language>

Target:
public void apply(Project project) { project.getTasks().withType(Test.class).configureEach(task -> { task.jvmArgs("-XX:+HeapDumpOnOutOfMemoryError", "-XX:+CrashOnOutOfMemoryError"); if (!Objects.equals("true", project.findProperty("com.palantir.baseline.restore-test-cache"))) { task.getOutputs().cacheIf(t -> false); } boolean shouldRecreate = Boolean.getBoolean("recreate"); task.systemProperty("recreate", Boolean.toString(shouldRecreate)); if (shouldRecreate) { task.getOutputs().upToDateWhen(t -> false); } }); project.getPlugins().withType(JavaPlugin.class, unusedPlugin -> { project.afterEvaluate(proj -> { proj.getConvention() .getPlugin(JavaPluginConvention.class) .getSourceSets() .matching(ss -> hasCompileDependenciesMatching(proj, ss, BaselineTesting::isJunitJupiter)) .forEach(ss -> { Optional<Test> maybeTestTask = getTestTaskForSourceSet(proj, ss); if (!maybeTestTask.isPresent()) { log.warn("Detected 'org:junit.jupiter:junit-jupiter', but unable to find test task"); return; } log.info( "Detected 'org:junit.jupiter:junit-jupiter', enabling useJUnitPlatform() on {}", maybeTestTask.get().getName()); enableJunit5ForTestTask(maybeTestTask.get()); }); }); TaskProvider<CheckJUnitDependencies> task = project.getTasks().register("checkJUnitDependencies", CheckJUnitDependencies.class); project.getTasks().findByName(JavaPlugin.TEST_TASK_NAME).dependsOn(task); }); }
Source:
<code>public synchronized Optional<CommandMapping> get(String alias, @Nullable CommandSource source) { List<CommandMapping> results = this.commands.get(alias.toLowerCase()); Optional<CommandMapping> result = Optional.empty(); if (results.size() == 1) { result = Optional.of(results.get(0)); } else if (results.size() > 1) { <START> result = disambiguatorFunc.disambiguate(source, alias, results); <END> } if (source != null) { result = result.filter(m -> m.getCallable().testPermission(source)); } return result; }</code><technical_language>Put this please</technical_language>

Target:
public synchronized Optional<CommandMapping> get(String alias, @Nullable CommandSource source) { List<CommandMapping> results = this.commands.get(alias.toLowerCase()); Optional<CommandMapping> result = Optional.empty(); if (results.size() == 1) { result = Optional.of(results.get(0)); } else if (results.size() > 1) { result = this.disambiguatorFunc.disambiguate(source, alias, results); } if (source != null) { result = result.filter(m -> m.getCallable().testPermission(source)); } return result; }
Source:
<code>private static long bytesToMb(long bytes) { <START> return bytes / 1024L / 1024L; <END> }</code><technical_language>java return bytes >> 20;</technical_language>

Target:
private static int bytesToMb(long bytes) { return (int) (bytes / 1024L / 1024L); }
Source:
<code>void getThreadData_failed_dataIsPresentThrowableIsAvailable() throws InterruptedException { DataCarrier expectedData = initializeThread(); expectedData.exception = Optional.of(new NullPointerException("This fails badly")); CountDownLatch doneSignal = new CountDownLatch(1); DataCarrier actionHandlerData = new DataCarrier(); DataCarrier completionHandlerData = new DataCarrier(); service.execAsync(service.getThreadData(), () -> actionHandler(actionHandlerData, expectedData.exception), (t) -> completionHandler(doneSignal, completionHandlerData, t)); doneSignal.await(); assertReturnedData(completionHandlerData, expectedData); <START> expectedData.exception = Optional.empty(); <END> assertReturnedData(actionHandlerData, expectedData); }</code><technical_language>I a bit puzzled this assert action handler data. I is easier create 3 tests instead of one, this line is needed: 1. execAsync_default_dataIsPresentInActionHandler 2. execAsync_completionWithError_dataIsPresentInCompletionHandlerThrowableIsAvailable 3. execAsync_completionSuccess_dataIsPresentInCompletionHandlerThrowableIsEmpty</technical_language>

Target:
void getThreadData_failed_dataIsPresentThrowableIsAvailable() throws InterruptedException { DataCarrier expectedData = initializeThread(); expectedData.exception = Optional.of(new NullPointerException("This fails badly")); CountDownLatch doneSignal = new CountDownLatch(1); DataCarrier actionHandlerData = new DataCarrier(); DataCarrier completionHandlerData = new DataCarrier(); service.execAsync(service.getThreadData(), () -> actionHandler(actionHandlerData, expectedData.exception), (t) -> completionHandler(doneSignal, completionHandlerData, t)); doneSignal.await(); assertActionHandlerData(actionHandlerData, expectedData); assertCompletionHandlerData(completionHandlerData, expectedData); }
Source:
<code>public boolean undo() { if (!history.undoIsPossible()) { return false; } UndoState lastStep = history.backward(); if (lastStep != null) { <START> internFormula = lastStep.internFormulaState.createInternFormulaFromState(); <END> internFormula.generateExternFormulaStringAndInternExternMapping(context); internFormula.updateInternCursorPosition(); updateTextAndCursorFromInternFormula(); } formulaEditorFragment.refreshFormulaPreviewString(internFormula.getExternFormulaString()); return true; }</code><technical_language>Is a call this function? if lastStep.interFormulaState == null? provide a function in lastStep itself, dig layers</technical_language>

Target:
public boolean undo() { if (!history.undoIsPossible()) { return false; } UndoState previousState = history.backward(); if (previousState != null) { internFormula = previousState.internFormulaState.createInternFormulaFromState(); internFormula.generateExternFormulaStringAndInternExternMapping(context); internFormula.updateInternCursorPosition(); updateTextAndCursorFromInternFormula(); } formulaEditorFragment.refreshFormulaPreviewString(internFormula.getExternFormulaString()); return true; }
Source:
<code>public void doInit() { if (Recipes.recyclerBlacklist != null && ModuleHelper.isEnabled(ForestryModuleUids.APICULTURE)) { ItemRegistryApiculture beeItems = ModuleApiculture.getItems(); Recipes.recyclerBlacklist.add(Recipes.inputFactory.forStack(new ItemStack(beeItems.beeQueenGE))); Recipes.recyclerBlacklist.add(Recipes.inputFactory.forStack(new ItemStack(beeItems.beePrincessGE))); } else { <START> Log.error("IC2 Recipes.recyclerBlacklist not found."); <END> } Circuits.energyElectricChoke1 = new CircuitElectricChoke("electric.choke.1"); Circuits.energyElectricEfficiency1 = new CircuitElectricEfficiency("electric.efficiency.1"); Circuits.energyElectricBoost1 = new CircuitElectricBoost("electric.boost.1", 4, 10); Circuits.energyElectricBoost2 = new CircuitElectricBoost("electric.boost.2", 7, 20); blocks.electricalEngine.init(); blocks.generator.init(); }</code><technical_language>This log if apiculture is disabled, log in case</technical_language>

Target:
public void doInit() { if (ModuleHelper.isEnabled(ForestryModuleUids.APICULTURE)) { if (Recipes.recyclerBlacklist != null) { ItemRegistryApiculture beeItems = ModuleApiculture.getItems(); Recipes.recyclerBlacklist.add(Recipes.inputFactory.forStack(new ItemStack(beeItems.beeQueenGE))); Recipes.recyclerBlacklist.add(Recipes.inputFactory.forStack(new ItemStack(beeItems.beePrincessGE))); } else { Log.error("IC2 Recipes.recyclerBlacklist not found."); } } Circuits.energyElectricChoke1 = new CircuitElectricChoke("electric.choke.1"); Circuits.energyElectricEfficiency1 = new CircuitElectricEfficiency("electric.efficiency.1"); Circuits.energyElectricBoost1 = new CircuitElectricBoost("electric.boost.1", 4, 10); Circuits.energyElectricBoost2 = new CircuitElectricBoost("electric.boost.2", 7, 20); getBlocks().electricalEngine.init(); getBlocks().generator.init(); }
Source:
<code><START> private void setValues(Map<Symbol, Object> sourceMap, Map<String, Object> targetMap) { <END> if (sourceMap != null) { for (Map.Entry<Symbol, Object> entry : sourceMap.entrySet()) { final String key = entry.getKey().toString(); final Object value = entry.getValue(); targetMap.put(key, value); } } }</code><technical_language>this logic duplicated lines 403</technical_language>

Target:
private void setValues(Map<Symbol, Object> sourceMap, Map<String, Object> targetMap) { if (sourceMap != null) { for (Map.Entry<Symbol, Object> entry : sourceMap.entrySet()) { targetMap.put(entry.getKey().toString(), entry.getValue()); } } }
Source:
<code>public Object getCellValueByEvaluatingFormula(String fileLocation, String cellLocation) throws IOException { Object cellValue; FileInputStream inputStream = new FileInputStream(new File(fileLocation)); Workbook workbook = new XSSFWorkbook(inputStream); Sheet sheet = workbook.getSheetAt(0); FormulaEvaluator evaluator = workbook.getCreationHelper() .createFormulaEvaluator(); CellAddress cellAddress = new CellAddress(cellLocation); Row row = sheet.getRow(cellAddress.getRow()); Cell cell = row.getCell(cellAddress.getColumn()); switch (evaluator.evaluateFormulaCell(cell)) { <START> case BOOLEAN: <END> cellValue = cell.getBooleanCellValue(); break; case NUMERIC: cellValue = cell.getNumericCellValue(); break; case STRING: cellValue = cell.getStringCellValue(); break; default: cellValue = null; } workbook.close(); return cellValue; }</code><technical_language>fix indentation switch cases</technical_language>

Target:
public Object getCellValueByEvaluatingFormula(String fileLocation, String cellLocation) throws IOException { Object cellValue = new Object(); FileInputStream inputStream = new FileInputStream(new File(fileLocation)); Workbook workbook = new XSSFWorkbook(inputStream); Sheet sheet = workbook.getSheetAt(0); FormulaEvaluator evaluator = workbook.getCreationHelper() .createFormulaEvaluator(); CellAddress cellAddress = new CellAddress(cellLocation); Row row = sheet.getRow(cellAddress.getRow()); Cell cell = row.getCell(cellAddress.getColumn()); if (cell.getCellType() == CellType.FORMULA) { switch (evaluator.evaluateFormulaCell(cell)) { case BOOLEAN: cellValue = cell.getBooleanCellValue(); break; case NUMERIC: cellValue = cell.getNumericCellValue(); break; case STRING: cellValue = cell.getStringCellValue(); break; default: cellValue = null; } } workbook.close(); return cellValue; }
Source:
<code>public List<CourseAttributes> getCoursesForStudentAccount(String googleId) throws EntityDoesNotExistException { List<StudentAttributes> studentDataList = studentsLogic.getStudentsForGoogleId(googleId); if (studentDataList.isEmpty()) { throw new EntityDoesNotExistException("Student with Google ID " + googleId + " does not exist"); } List<String> courseIds = new ArrayList<>(); for (StudentAttributes s : studentDataList) { <START> if (!getCourse(s.course).isCourseDeleted()) { <END> courseIds.add(s.course); } } return coursesDb.getCourses(courseIds); }</code><technical_language>Java 8 streams API in lines 477-480 for cleaner syntax</technical_language>

Target:
public List<CourseAttributes> getCoursesForStudentAccount(String googleId) throws EntityDoesNotExistException { List<StudentAttributes> studentDataList = studentsLogic.getStudentsForGoogleId(googleId); if (studentDataList.isEmpty()) { throw new EntityDoesNotExistException("Student with Google ID " + googleId + " does not exist"); } List<String> courseIds = studentDataList.stream() .filter(student -> !getCourse(student.course).isCourseDeleted()) .map(StudentAttributes::getCourse) .collect(Collectors.toList()); return coursesDb.getCourses(courseIds); }
Source:
<code>private void processAddedPages(ApplicationSentListingMessage applicationSentListingMessage) { <START> List<WebkitPage> pages = new ArrayList<WebkitPage>(); <END> pages.addAll(driver.getPages()); for (WebkitPage p : driver.getPages()) { applicationSentListingMessage.getPages().remove(p); } if (applicationSentListingMessage.getPages().size() == 0) { throw new WebDriverException(applicationSentListingMessage.getPages().size() + " new pages."); } WebkitPage newOne = Collections.max(applicationSentListingMessage.getPages()); pages.addAll(applicationSentListingMessage.getPages()); driver.setPages(pages); if (driver.getPages().size() == 0) { } else if (newOne.isITunesAd()) { } else { WebkitPage focus = newOne; if (session != null) { waitForWindowSwitchingAnimation(); driver.switchTo(focus); } else { driver.switchTo(focus); } } }</code><technical_language>change this List<WebKitPage> pages = new ArrayList<WebKitPage>(driver.getPages())</technical_language>

Target:
private void processAddedPages(ApplicationSentListingMessage applicationSentListingMessage) { List<WebkitPage> pages = new ArrayList<WebkitPage>(driver.getPages()); for (WebkitPage p : driver.getPages()) { applicationSentListingMessage.getPages().remove(p); } WebkitPage newOne = Collections.max(applicationSentListingMessage.getPages()); pages.addAll(applicationSentListingMessage.getPages()); driver.setPages(pages); if (driver.getPages().size() > 0 && !newOne.isITunesAd()) { WebkitPage focus = newOne; if (session != null) { waitForWindowSwitchingAnimation(); driver.switchTo(focus); } else { driver.switchTo(focus); } } }
Source:
<code>protected void configure() { super.configure(); WaitAllStrategy waitStrategy = new WaitAllStrategy(); waitStrategy = waitStrategy.withStrategy( new HttpWaitStrategy() .forPath("/pools/default") .forPort(MGMT_PORT) .withBasicCredentials(username, password) .forStatusCode(200) .forResponsePredicate(response -> { try { return Optional.of(MAPPER.readTree(response)) .map(n -> n.at("/nodes/0/status")) .map(JsonNode::asText) .map("healthy"::equals) .orElse(false); } catch (IOException e) { <START> logger().error("Unable to parse response: " + response, e); <END> return false; } }) ); if (enabledServices.contains(CouchbaseService.QUERY)) { waitStrategy = waitStrategy.withStrategy( new HttpWaitStrategy() .forPath("/admin/ping") .forPort(QUERY_PORT) .withBasicCredentials(username, password) .forStatusCode(200) ); } waitingFor(waitStrategy); }</code><technical_language>put for response, Throwables argument error() calls. logger().error("Unable parse response {}", response, e);</technical_language>

Target:
protected void configure() { super.configure(); WaitAllStrategy waitStrategy = new WaitAllStrategy(); waitStrategy = waitStrategy.withStrategy( new HttpWaitStrategy() .forPath("/pools/default") .forPort(MGMT_PORT) .withBasicCredentials(username, password) .forStatusCode(200) .forResponsePredicate(response -> { try { return Optional.of(MAPPER.readTree(response)) .map(n -> n.at("/nodes/0/status")) .map(JsonNode::asText) .map("healthy"::equals) .orElse(false); } catch (IOException e) { logger().error("Unable to parse response: {}", response, e); return false; } }) ); if (enabledServices.contains(CouchbaseService.QUERY)) { waitStrategy = waitStrategy.withStrategy( new HttpWaitStrategy() .forPath("/admin/ping") .forPort(QUERY_PORT) .withBasicCredentials(username, password) .forStatusCode(200) ); } waitingFor(waitStrategy); }
Source:
<code>private void run(String[] argv) throws Exception { MaxwellBootstrapUtilityConfig config = new MaxwellBootstrapUtilityConfig(argv); if ( config.log_level != null ) { MaxwellLogging.setLevel(config.log_level); } ConnectionPool connectionPool = getConnectionPool(config); try ( final Connection connection = connectionPool.getConnection() ) { if ( config.abortBootstrapID != null ) { removeBootstrapRow(connection, config.abortBootstrapID); return; } long rowId; if ( config.monitorBootstrapID != null ) <START> rowId = config.monitorBootstrapID; <END> else { Long totalRows = calculateRowCount(connection, config.databaseName, config.tableName); rowId = insertBootstrapStartRow(connection, config.databaseName, config.tableName, totalRows); } monitorProgress(connection, rowId); } catch ( SQLException e ) { LOGGER.error("failed to connect to mysql server @ " + config.getConnectionURI()); LOGGER.error(e.getLocalizedMessage()); System.exit(1); } }</code><technical_language>nice show error return if monitor a rowId exist</technical_language>

Target:
private void run(String[] argv) throws Exception { MaxwellBootstrapUtilityConfig config = new MaxwellBootstrapUtilityConfig(argv); if ( config.log_level != null ) { MaxwellLogging.setLevel(config.log_level); } ConnectionPool connectionPool = getConnectionPool(config); try ( final Connection connection = connectionPool.getConnection() ) { if ( config.abortBootstrapID != null ) { getInsertedRowsCount(connection, config.abortBootstrapID); removeBootstrapRow(connection, config.abortBootstrapID); return; } long rowId; if ( config.monitorBootstrapID != null ) { getInsertedRowsCount(connection, config.monitorBootstrapID); rowId = config.monitorBootstrapID; } else { Long totalRows = calculateRowCount(connection, config.databaseName, config.tableName); rowId = insertBootstrapStartRow(connection, config.databaseName, config.tableName, totalRows); } try { monitorProgress(connection, rowId); } catch ( MissingBootstrapRowException e ) { LOGGER.error("bootstrap aborted."); Runtime.getRuntime().halt(1); } } catch ( SQLException e ) { LOGGER.error("failed to connect to mysql server @ " + config.getConnectionURI()); LOGGER.error(e.getLocalizedMessage()); System.exit(1); } }
Source:
<code>public void getNextOffsetAndMin() { Node node = mock(Node.class); Bounds bounds = new BoundsImpl(new BoundImpl(100d, 100d), new BoundImpl(300d, 200d)); List<Node> nodes = new ArrayList<Node>(); View view = mock(View.class); when(node.getContent()).thenReturn(view); when(view.getBounds()).thenReturn(bounds); nodes.add(node); when(graph.nodes()).thenReturn(nodes); double[] next = canvasLayoutUtils.getNext(canvasHandler, newNodeWidth, newNodeHeight, offsetX, offsetY, canvasMinX, canvasMinY); double nextX = next[0]; <START> double nextY = next[1]; <END> assertTrue(nextX > (newNodeWidth + offsetX)); assertTrue(nextY > (newNodeHeight + offsetY)); }</code><technical_language>Thank for this test. thing: I ask run IDE Formatter (Ctrl+Alt+L) avoid useless reformattings in future? P.S. Also, enable checkbox code reformat Optimize imports automatically commit. Click Ctrl+K set check boxes picture. ![image](<LINK_0></technical_language>

Target:
public void getNextOffsetAndMin() { Node node = mock(Node.class); Bounds bounds = new BoundsImpl(new BoundImpl(100d, 100d), new BoundImpl(300d, 200d)); List<Node> nodes = new ArrayList<Node>(); View view = mock(View.class); when(node.getContent()).thenReturn(view); when(view.getBounds()).thenReturn(bounds); nodes.add(node); when(graph.nodes()).thenReturn(nodes); final Point2D min = new Point2D(canvasMin.getX(), canvasMin.getY()); double[] next = canvasLayoutUtils.getNext(canvasHandler, NEW_NODE_HEIGHT, offset, min); double nextX = next[0]; double nextY = next[1]; assertTrue(nextX > (NEW_NODE_WIDTH + offset.getX())); assertTrue(nextY > (NEW_NODE_HEIGHT + offset.getY())); }
Source:
<code>private void populateReviews(List<TaskReview> reviewContainers) throws NumberFormatException { for (ITask review : reviews) { int codeReviewVal = Integer .parseInt(review.getAttribute(Messages.TaskEditorReviewsPart_CodeReviewAttribute)); int verifiedVal = Integer.parseInt(review.getAttribute(Messages.TaskEditorReviewsPart_VerifiedAttribute)); boolean incoming = false; <START> if (review.getSynchronizationState() == ITask.SynchronizationState.INCOMING) { <END> hasIncoming = true; incoming = true; } reviewContainers.add( new TaskReview(review.getSummary(), codeReviewVal, verifiedVal, "", incoming, review.getUrl())); } }</code><technical_language>pass ITask TaskReview getIncoming do this check? show current need call setIncoming opening it</technical_language>

Target:
private void populateReviews(List<TaskReview> reviewContainers) throws NumberFormatException { for (ITask review : reviews) { reviewContainers.add(new TaskReview(review)); } }
Source:
<code>private CompiledQuery repairTables(SqlExecutionContext executionContext) throws SqlException { CharSequence tok; tok = SqlUtil.fetchNext(lexer); if (tok == null || !Chars.equalsLowerCaseAscii(tok, "table")) { throw SqlException.$(lexer.lastTokenPosition(), "'table' expected"); } do { tok = SqlUtil.fetchNext(lexer); if (tok == null || Chars.equals(tok, ',')) { throw SqlException.$(lexer.getPosition(), "table name expected"); } if (Chars.isQuoted(tok)) { tok = GenericLexer.unquote(tok); } tableExistsOrFail(lexer.lastTokenPosition(), tok, executionContext); try { <START> TableWriter writer = engine.getWriter(executionContext.getCairoSecurityContext(), tok); <END> engine.migrateNullFlag(writer, executionContext.getCairoSecurityContext(), tok); writer.close(); } catch (CairoException e) { LOG.info().$("table busy [table=").$(tok).$(", e=").$((Sinkable) e).$(']').$(); throw SqlException.$(lexer.lastTokenPosition(), "table '").put(tok).put("' is busy"); } tok = SqlUtil.fetchNext(lexer); } while (tok != null && Chars.equals(tok, ',')); return compiledQuery.ofRepair(); }</code><technical_language>wondering if responsibility of reader lock writer? In this case migrating a simpler engine call. Additionally writer closed in case of exception</technical_language>

Target:
private CompiledQuery repairTables(SqlExecutionContext executionContext) throws SqlException { CharSequence tok; tok = SqlUtil.fetchNext(lexer); if (tok == null || !Chars.equalsLowerCaseAscii(tok, "table")) { throw SqlException.$(lexer.lastTokenPosition(), "'table' expected"); } do { tok = SqlUtil.fetchNext(lexer); if (tok == null || Chars.equals(tok, ',')) { throw SqlException.$(lexer.getPosition(), "table name expected"); } if (Chars.isQuoted(tok)) { tok = GenericLexer.unquote(tok); } tableExistsOrFail(lexer.lastTokenPosition(), tok, executionContext); try { engine.getWriter(executionContext.getCairoSecurityContext(), tok).close(); engine.migrateNullFlag(executionContext.getCairoSecurityContext(), tok); } catch (CairoException e) { LOG.info().$("table busy [table=").$(tok).$(", e=").$((Sinkable) e).$(']').$(); throw SqlException.$(lexer.lastTokenPosition(), "table '").put(tok).put("' is busy"); } tok = SqlUtil.fetchNext(lexer); } while (tok != null && Chars.equals(tok, ',')); return compiledQuery.ofRepair(); }
Source:
<code>public boolean advance() throws IOException { if (isRejectError) { return true; } boolean validationResult = validateResultSet(rs); if (!validationResult) { return false; } boolean hasNext = false; try { hasNext = rs.next(); } catch (SQLException e) { if (dieOnError) { <START> throw new IOException(); <END> } LOGGER.warn(I18N_MESSAGES.getMessage("error.resultSetIssue"), e); } if (hasNext) { current = converter.convertToAvro(rs); result.totalCount++; result.successCount++; } return hasNext; }</code><technical_language>empty exception message here. send parent exception message constructor</technical_language>

Target:
public boolean advance() throws IOException { if (isRejectError) { return true; } boolean validationResult = validateResultSet(rs); if (!validationResult) { return false; } boolean hasNext = false; try { hasNext = rs.next(); } catch (SQLException e) { if (dieOnError) { throw new IOException(e); } LOGGER.warn(I18N_MESSAGES.getMessage("error.resultSetIssue"), e); } if (hasNext) { current = converter.convertToAvro(rs); result.totalCount++; result.successCount++; } return hasNext; }
Source:
<code>public String toString() { String result = new String(bout.toByteArray(), StandardCharsets.UTF_8); if (fmt.equals(Depiction.SVG_FMT)) { result = result.replaceAll("\"([-+0-9.]+)px\"", "\"$1mm\""); } <START> if (fmt.equals(Depiction.EPS_FMT)) { <END> String nl = System.getProperty("line.separator"); String split[] = result.split(nl,2); if( split.length > 1 && split[0].startsWith("%!PS-") ) { String boundingBox; if( this.dim != null ) { boundingBox = "%%BoundingBox: 0 0 " + dim.width + " " + dim.height + nl; } else { boundingBox = ""; } if(!split[0].contains("EPS") && !boundingBox.equals("")) { split[0] += " EPSF-3.0"; } result = split[0] + nl + boundingBox + split[1]. replaceFirst("(\\d+ ){4}setmargins", "0 0 0 0 setmargins"). replaceFirst("(\\d+ ){2}setpagesize", dim.width + " " + dim.height + " setpagesize"); } } return result; }</code><technical_language>performance difference is minimal, 'else-if' here</technical_language>

Target:
public String toString() { String result = new String(bout.toByteArray(), StandardCharsets.UTF_8); if (fmt.equals(Depiction.SVG_FMT)) { result = result.replaceAll("\"([-+0-9.]+)px\"", "\"$1mm\""); } else if (fmt.equals(Depiction.EPS_FMT)) { String nl; if( result.contains("\r\n")) { nl = "\r\n"; } else if( result.contains("\r")) { nl = "\r"; } else { nl = "\n"; } String split[] = result.split(nl,2); if( split.length > 1 && split[0].startsWith("%!PS-") ) { String boundingBox; if( this.dim != null ) { boundingBox = "%%BoundingBox: 0 0 " + dim.width + " " + dim.height + nl; } else { boundingBox = ""; } if(!split[0].contains("EPS") && !boundingBox.equals("")) { split[0] += " EPSF-3.0"; } result = split[0] + nl + boundingBox + split[1]. replaceFirst("(\\d+ ){4}setmargins", "0 0 0 0 setmargins"). replaceFirst("(\\d+ ){2}setpagesize", dim.width + " " + dim.height + " setpagesize"); } } return result; }
Source:
<code>protected void executeQueryCommand() { Map<String, Network> clusterNetworksByName = networkDao .getAllForCluster(getParameters().getId()) .stream() .collect(Collectors.toMap(Network::getName, Function.identity())); Set<String> outOfSyncVdsNames = interfaceDao .getAllInterfacesByClusterId(getParameters().getId()) .stream() .map(iface -> new Pair<>(iface.getVdsName(), util.calculateNetworkImplementationDetails(iface, clusterNetworksByName.get(iface.getNetworkName())))) .filter(pair -> pair.getSecond() != null && pair.getSecond().isManaged() && !pair.getSecond().isInSync()) .map(Pair::getFirst) .collect(Collectors.toSet()); StringBuilder names = new StringBuilder(); outOfSyncVdsNames.forEach(name -> <START> names.append("\n").append(name)); <END> getQueryReturnValue().setReturnValue(names.toString()); }</code><technical_language>lineSeparator instead</technical_language>

Target:
protected void executeQueryCommand() { Map<String, Network> clusterNetworksByName = networkDao .getAllForCluster(getParameters().getId()) .stream() .collect(Collectors.toMap(Network::getName, Function.identity())); List<String> outOfSyncVdsNames = interfaceDao .getAllInterfacesByClusterId(getParameters().getId()) .stream() .map(iface -> new Pair<>(iface.getVdsName(), util.calculateNetworkImplementationDetails(iface, clusterNetworksByName.get(iface.getNetworkName())))) .filter(pair -> pair.getSecond() != null && pair.getSecond().isManaged() && !pair.getSecond().isInSync()) .map(Pair::getFirst) .collect(Collectors.toSet()) .stream() .sorted() .collect(Collectors.toList()); StringBuilder names = new StringBuilder(); outOfSyncVdsNames.forEach(name -> names.append("\n").append(name)); getQueryReturnValue().setReturnValue(names.toString()); }
Source:
<code>private DateTime parseShortDate(String dateString) { if (StringUtils.isNotBlank(dateString)) { <START> return new DateTime(RassStringToJavaShortDateTimeAdapter.parseToDateTime(dateString).toDate()); <END> } else { return null; } }</code><technical_language>method RassStringToJavaShortDateTimeAdapter.parseToDateTime() is returning a DateTime, extracting Date re-wrapping in a new DateTime redundant</technical_language>

Target:
private DateTime parseShortDate(String dateString) { if (StringUtils.isNotBlank(dateString)) { return RassStringToJavaShortDateTimeAdapter.parseToDateTime(dateString); } else { return null; } }
Source:
<code>private Object getConstraintKey(PConstraint constraint) { <START> if (constraint instanceof TypeConstraint) { <END> return ((TypeConstraint) constraint).getEquivalentJudgement(); } return constraint; }</code><technical_language>I recommend ITypeConstraint instead of TypeConstraint here. is for enumerable type constaints (I know, super misleading legacy name), include TypeFilterConstraints correspond non-enumerable IInputKeys (such java Class type filters unscoped EClass type filters)</technical_language>

Target:
private Object getConstraintKey(PConstraint constraint) { if (constraint instanceof ITypeConstraint) { return ((ITypeConstraint) constraint).getEquivalentJudgement(); } return constraint; }
Source:
<code>public void loadStaffInOffice(final int officeId) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscription.add(mDataManager.getStaffInOffice(officeId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<List<Staff>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); <START> try { <END> if (e instanceof HttpException) { String errorMessage = ((HttpException) e).response().errorBody() .string(); getMvpView().showError(MFErrorParser.parseError(errorMessage) .getErrors().get(0).getDefaultUserMessage()); } } catch (Throwable throwable) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } } @Override public void onNext(List<Staff> staffs) { getMvpView().showProgressbar(false); getMvpView().showStaffInOffice(staffs, officeId); } })); }</code><technical_language>this utils method show error <LINK_0></technical_language>

Target:
public void loadStaffInOffice(final int officeId) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscription.add(mDataManager.getStaffInOffice(officeId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<List<Staff>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(MFErrorParser.errorMessage(e)); } @Override public void onNext(List<Staff> staffs) { getMvpView().showProgressbar(false); getMvpView().showStaffInOffice(staffs, officeId); } })); }
Source:
<code>public void rejectInvalidJsonObjectsInResultArray() throws Exception { JsonObject result = new JsonObject(); JsonObject testObject = new JsonObject(); JsonArray results = new JsonArray(); for(int i = 1; i<=3; i++) { JsonObject element = new JsonObject(); <START> element.addProperty("experiment_accession", "e"+ i); <END> element.addProperty("contrast_id", "c"+ i); element.addProperty("bioentity_identifier", "id"+ i); element.addProperty("species", "org"+ i); element.addProperty("p_value", 1.11); element.addProperty("fold_change", -1.12); element.addProperty("t_statistic", 0.0); element.addProperty("keyword_symbol", i); results.add(element); } results.add(testObject); testObject.addProperty("experiment accession","e"+4); testObject.addProperty("contrast_id", "c"+4); testObject.addProperty("bioentity_identifier", "id"+4); testObject.addProperty("species", "org"+4); testObject.addProperty("p_value", 1.14); testObject.addProperty("fold_change", -1.14); testObject.addProperty("t_statistic", 0.0); testObject.addProperty("keyword_symbol", 4); result.add("results", results); List<DiffAnalytics> expression = subject.parseDifferentialResults(result); assertThat(expression,hasSize(3)); }</code><technical_language>wow copypasted everywhere. do Alfonso said</technical_language>

Target:
public void rejectInvalidJsonObjectsInResultArray() throws Exception { JsonObject result = buildJsonObject(3,true); List<DiffAnalytics> expression = subject.parseDifferentialResults(result); assertThat(expression,hasSize(3)); }
Source:
<code>public static ExecutorService createLocalExecutor(Cache<?, ?> masterCacheNode) { <START> String nodeName = masterCacheNode != null ? masterCacheNode.getCacheManager().getCacheManagerConfiguration().transport().nodeName() : ""; <END> return Executors.newSingleThreadExecutor( new DefaultThreadFactory(null, Thread.NORM_PRIORITY, DefaultThreadFactory.DEFAULT_PATTERN, nodeName, "DefaultExecutorService")); }</code><technical_language>this null if cache is null? want consistent other below</technical_language>

Target:
public static ExecutorService createLocalExecutor(Cache<?, ?> masterCacheNode) { String nodeName = masterCacheNode != null ? SecurityActions.getConfiguredNodeName(masterCacheNode) : null; return Executors.newSingleThreadExecutor( new DefaultThreadFactory(null, Thread.NORM_PRIORITY, DefaultThreadFactory.DEFAULT_PATTERN, nodeName, "DefaultExecutorService")); }
Source:
<code>public void testMultiThreadMultiKeyPull() throws InterruptedException, TimeoutException, ExecutionException { final int numPullThreads = 8; final int numPullPerThread = 1000; final CountDownLatch countDownLatch = new CountDownLatch(numPullThreads); final Runnable[] threads = new Runnable[numPullThreads]; final AtomicBoolean correctResultReturned = new AtomicBoolean(true); for (int index = 0; index < numPullThreads; ++index) { final int threadIndex = index; threads[index] = () -> { for (int pull = 0; pull < numPullPerThread; ++pull) { final List<Integer> keyList = new ArrayList<>(3); keyList.add((threadIndex + pull) % 4); <START> keyList.add((threadIndex + pull + 1)); <END> keyList.add((threadIndex + pull + 2) % 4); final List<Integer> vals = worker.pull(keyList); for (int listIndex = 0; listIndex < 3; ++listIndex) { final Integer val = vals.get(listIndex); if (val == null || !val.equals(keyList.get(listIndex))) { correctResultReturned.set(false); break; } } } countDownLatch.countDown(); }; } ThreadUtils.runConcurrently(threads); final boolean allThreadsFinished = countDownLatch.await(60, TimeUnit.SECONDS); worker.close(CLOSE_TIMEOUT); assertTrue(MSG_THREADS_SHOULD_FINISH, allThreadsFinished); assertTrue(MSG_RESULT_ASSERTION, correctResultReturned.get()); }</code><technical_language>missed adding % 4 end</technical_language>

Target:
public void testMultiThreadMultiKeyPull() throws InterruptedException, TimeoutException, ExecutionException { final int numPullThreads = 8; final int numKeys = 4; final int numPullPerThread = 1000; final int numKeysPerPull = 3; final CountDownLatch countDownLatch = new CountDownLatch(numPullThreads); final Runnable[] threads = new Runnable[numPullThreads]; final AtomicBoolean correctResultReturned = new AtomicBoolean(true); for (int index = 0; index < numPullThreads; ++index) { final int threadIndex = index; threads[index] = () -> { for (int pull = 0; pull < numPullPerThread; ++pull) { final List<Integer> keyList = new ArrayList<>(numKeysPerPull); for (int keyIndex = 0; keyIndex < numKeysPerPull; ++keyIndex) { keyList.add((threadIndex + pull + keyIndex) % numKeys); } final List<Integer> vals = worker.pull(keyList); for (int listIndex = 0; listIndex < keyList.size(); ++listIndex) { final Integer val = vals.get(listIndex); if (val == null || !val.equals(keyList.get(listIndex))) { correctResultReturned.set(false); break; } } } countDownLatch.countDown(); }; } ThreadUtils.runConcurrently(threads); final boolean allThreadsFinished = countDownLatch.await(60, TimeUnit.SECONDS); worker.close(CLOSE_TIMEOUT); assertTrue(MSG_THREADS_SHOULD_FINISH, allThreadsFinished); assertTrue(MSG_RESULT_ASSERTION, correctResultReturned.get()); }
Source:
<code>public void visitNode(AstNode node) { AstNode singleIfChild = singleIfChild(node); if(singleIfChild != null && !hasElseOrElsif(singleIfChild)){ <START> addIssue(singleIfChild, this, "Merge this if statement with the enclosing one."); <END> } }</code><technical_language>minor: \"if\" instead of if</technical_language>

Target:
public void visitNode(AstNode node) { AstNode singleIfChild = singleIfChild(node); if(singleIfChild != null && !hasElseOrElsif(singleIfChild)){ addIssue(singleIfChild, this, "Merge this \"if\" statement with the enclosing one."); } }
Source:
<code>private void releaseExecutor(Execution execution) { executorsSemaphore.release(); if (currentlyProcessing.remove(execution) == null) { LOG.error("Released execution was not found in collection of executions currently being processed. Should never happen."); statsRegistry.registerUnexpectedError(); } <START> if(pollAfterCompletion && currentlyProcessing.isEmpty()) { <END> triggerCheckForDueExecutions(); } }</code><technical_language>This work for now. thinking ideally need re-write executeDue works, a model threads poll blockingly continously a queue of executions, some other thread populates it. is a lot more work.</technical_language>

Target:
private void releaseExecutor(Execution execution) { executorsSemaphore.release(); if (currentlyProcessing.remove(execution) == null) { LOG.error("Released execution was not found in collection of executions currently being processed. Should never happen."); statsRegistry.registerUnexpectedError(); } if (pollAfterCompletion && lastPollAcquiredAllAvailableExecutors) { triggerCheckForDueExecutions(); } }
Source:
<code>public StringBuilder getCsvDetailedFeedbackResponseCommentsRow(FeedbackResponseAttributes response) { List<FeedbackResponseCommentAttributes> frcList = this.responseComments.get(response.getId()); StringBuilder commentRow = new StringBuilder(200); for (FeedbackResponseCommentAttributes frc : frcList) { commentRow.append("," + frc.giverEmail + "," + SanitizationHelper.desanitizeFromHtml( <START> frc.commentText.getValue().substring(3, frc.commentText.getValue().length() - 4))); <END> } return commentRow; }</code><technical_language>extract this line out a separate method show this is intended remove <p> </p> (if reading this correctly</technical_language>

Target:
public StringBuilder getCsvDetailedFeedbackResponseCommentsRow(FeedbackResponseAttributes response) { List<FeedbackResponseCommentAttributes> frcList = this.responseComments.get(response.getId()); StringBuilder commentRow = new StringBuilder(200); for (FeedbackResponseCommentAttributes frc : frcList) { commentRow.append("," + instructorEmailNameTable.get(frc.giverEmail) + "," + getTextFromComment(frc.commentText)); } return commentRow; }
Source:
<code>public void startSignIn(@NonNull final IdpResponse response, @NonNull String password) { if (!response.isSuccessful()) { setResult(Resource.<IdpResponse>forFailure(response.getError())); return; } if (!response.getProviderType().equals(EmailAuthProvider.PROVIDER_ID)) { throw new IllegalStateException( "This handler can only be used with the email provider"); } setResult(Resource.<IdpResponse>forLoading()); final String email = response.getEmail(); getAuth().createUserWithEmailAndPassword(email, password) .continueWithTask(new ProfileMerger(response)) .addOnFailureListener(new TaskFailureLogger(TAG, "Error creating user")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult result) { setResult(Resource.forSuccess(response)); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { ProviderUtils.fetchTopProvider(getAuth(), email) <START> .addOnSuccessListener(new StartWelcomeBackFlow(email)); <END> } else { setResult(Resource.<IdpResponse>forFailure(e)); } } }); }</code><technical_language>this call fails too? Feels get a case Resource a final state</technical_language>

Target:
public void startSignIn(@NonNull final IdpResponse response, @NonNull String password) { if (!response.isSuccessful()) { setResult(Resource.<IdpResponse>forFailure(response.getError())); return; } if (!response.getProviderType().equals(EmailAuthProvider.PROVIDER_ID)) { throw new IllegalStateException( "This handler can only be used with the email provider"); } setResult(Resource.<IdpResponse>forLoading()); final String email = response.getEmail(); getAuth().createUserWithEmailAndPassword(email, password) .continueWithTask(new ProfileMerger(response)) .addOnFailureListener(new TaskFailureLogger(TAG, "Error creating user")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult result) { setResult(Resource.forSuccess(response)); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { ProviderUtils.fetchTopProvider(getAuth(), email) .addOnSuccessListener(new StartWelcomeBackFlow(email)) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { setResult(Resource.<IdpResponse>forFailure(e)); } }); } else { setResult(Resource.<IdpResponse>forFailure(e)); } } }); }
Source:
<code><START> public THIS as(LogicalTypeAnnotation type) { <END> this.logicalTypeAnnotation = type; return self(); }</code><technical_language>This method breaks fluent API of builder need factory method of final type create a LogicalTypeAnnotation. If is practically feasible, I suggest refactor LogicalTypeAnnotation API fit more in fluent API of Types</technical_language>

Target:
public THIS as(LogicalTypeAnnotation type) { this.logicalTypeAnnotation = type; this.newLogicalTypeSet = true; return self(); }
Source:
<code>public void testValidate() { DispoAnnotationData annotation = new DispoAnnotationData(); annotation.setResolutionType("Modify_Code"); annotation.setResolution(""); DispoResolutionValidator validator = new DispoResolutionValidator(); validator.validate(annotation); Assert.assertTrue(annotation.getIsAnalyze()); Assert.assertTrue(!annotation.getIsResolutionValid()); annotation.setResolution("something"); validator.validate(annotation); Assert.assertTrue(annotation.getIsAnalyze()); Assert.assertTrue(annotation.getIsResolutionValid()); <START> <END> annotation.setResolutionType("nonesense"); validator.validate(annotation); Assert.assertTrue(!annotation.getIsAnalyze()); Assert.assertTrue(annotation.getIsResolutionValid()); }</code><technical_language>nit: nonesense a word. nonsense</technical_language>

Target:
public void testValidate() { DispoAnnotationData annotation = new DispoAnnotationData(); annotation.setResolutionType(ANALYZE_CODE); annotation.setResolution(""); DispoResolutionValidator validator = new DispoResolutionValidator(); validator.validate(annotation); Assert.assertTrue(annotation.getIsAnalyze()); Assert.assertTrue(!annotation.getIsResolutionValid()); annotation.setResolution("something"); validator.validate(annotation); Assert.assertTrue(annotation.getIsAnalyze()); Assert.assertTrue(annotation.getIsResolutionValid()); annotation.setResolutionType("non-essense"); validator.validate(annotation); Assert.assertTrue(!annotation.getIsAnalyze()); Assert.assertTrue(annotation.getIsResolutionValid()); }
Source:
<code>public final void testAlterTableUnsetProperty() throws Exception { executeDDL("table2_ddl.sql", "table2.tbl", "ALTY"); String tableName = IdentifierUtil.buildFQName(getCurrentDatabase(), "alty"); assertTrue(catalog.existsTable(tableName)); TableDesc tableDesc = catalog.getTableDesc(tableName); TableMeta tableMeta = tableDesc.getMeta(); assertEquals(tableMeta.getPropertySet().size(), 3); assertNotNull(tableMeta.getProperty("timezone")); assertNotNull(tableMeta.getProperty("text.null")); assertEquals(tableMeta.getProperty("text.delimiter"), "\\u002b"); executeDDL("alter_table_unset_property_delimiter.sql", null); tableDesc = catalog.getTableDesc(tableName); tableMeta = tableDesc.getMeta(); assertEquals(tableMeta.getPropertySet().size(), 2); assertNotNull(tableMeta.getProperty("timezone")); <START> assertNotNull(tableMeta.getProperty("text.null")); <END> executeDDL("alter_table_unset_not_exists_property.sql", null); tableDesc = catalog.getTableDesc(tableName); tableMeta = tableDesc.getMeta(); assertEquals(tableMeta.getPropertySet().size(), 2); assertNotNull(tableMeta.getProperty("timezone")); assertNotNull(tableMeta.getProperty("text.null")); }</code><technical_language>verify unset property</technical_language>

Target:
public final void testAlterTableUnsetProperty() throws Exception { executeDDL("table2_ddl.sql", "table2.tbl", "ALTY"); String tableName = IdentifierUtil.buildFQName(getCurrentDatabase(), "alty"); assertTrue(catalog.existsTable(tableName)); TableDesc tableDesc = catalog.getTableDesc(tableName); TableMeta tableMeta = tableDesc.getMeta(); assertEquals(tableMeta.getPropertySet().size(), 3); assertNotNull(tableMeta.getProperty("timezone")); assertNotNull(tableMeta.getProperty("text.null")); assertEquals(tableMeta.getProperty("text.delimiter"), "\\u002b"); executeDDL("alter_table_unset_property_delimiter.sql", null); tableDesc = catalog.getTableDesc(tableName); tableMeta = tableDesc.getMeta(); assertEquals(tableMeta.getPropertySet().size(), 2); assertNotNull(tableMeta.getProperty("timezone")); assertNotNull(tableMeta.getProperty("text.null")); assertFalse(tableMeta.getPropertySet().containsKey("text.delimiter")); executeDDL("alter_table_unset_not_exists_property.sql", null); tableDesc = catalog.getTableDesc(tableName); tableMeta = tableDesc.getMeta(); assertEquals(tableMeta.getPropertySet().size(), 2); assertNotNull(tableMeta.getProperty("timezone")); assertNotNull(tableMeta.getProperty("text.null")); assertFalse(tableMeta.getPropertySet().containsKey("text.delimiter")); }
Source:
<code>public void updated(Dictionary config) throws ConfigurationException { if (config != null) { String ip = (String) config.get("ip"); if (StringUtils.isNotBlank(ip)) { if (!ip.equals(FritzboxBinding.ip)) { FritzboxBinding.ip = ip; conditionalDeActivate(); try { Scheduler sched = StdSchedulerFactory .getDefaultScheduler(); JobDetail job = newJob(ReconnectJob.class) .withIdentity("Reconnect", "FritzBox").build(); CronTrigger trigger = newTrigger() .withIdentity("Reconnect", "FritzBox") .withSchedule( CronScheduleBuilder .cronSchedule("0 0 0 * * ?")) .build(); sched.scheduleJob(job, trigger); <START> logger.debug("Scheduled a daily reconnection to FritzBox on " + ip + ":" + MONITOR_PORT); <END> } catch (SchedulerException e) { logger.warn("Could not create daily reconnection job", e); } } } String password = (String) config.get("password"); if (StringUtils.isNotBlank(password)) { FritzboxBinding.password = password; } } }</code><technical_language>change this statement</technical_language>

Target:
public void updated(Dictionary config) throws ConfigurationException { if (config != null) { String ip = (String) config.get("ip"); if (StringUtils.isNotBlank(ip)) { if (!ip.equals(FritzboxBinding.ip)) { FritzboxBinding.ip = ip; conditionalDeActivate(); try { Scheduler sched = StdSchedulerFactory .getDefaultScheduler(); JobDetail job = newJob(ReconnectJob.class) .withIdentity("Reconnect", "FritzBox").build(); CronTrigger trigger = newTrigger() .withIdentity("Reconnect", "FritzBox") .withSchedule( CronScheduleBuilder .cronSchedule("0 0 0 * * ?")) .build(); sched.scheduleJob(job, trigger); logger.debug("Scheduled a daily reconnection to FritzBox on {}:{}", ip, MONITOR_PORT); } catch (SchedulerException e) { logger.warn("Could not create daily reconnection job", e); } } } String password = (String) config.get("password"); if (StringUtils.isNotBlank(password)) { FritzboxBinding.password = password; } } }