auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void captureTable(Table t) throws SQLException { int i = 0; infoSchemaStmt.setString(1, t.getDatabase()); infoSchemaStmt.setString(2, t.getName()); ResultSet r = infoSchemaStmt.executeQuery(); while(r.next()) { String[] enumValues = null; String colName = r.getString("COLUMN_NAME"); String colType = r.getString("DATA_TYPE"); String colEnc = r.getString("CHARACTER_SET_NAME"); int colPos = r.getInt("ORDINAL_POSITION") - 1; boolean colSigned = !r.getString("COLUMN_TYPE").matches(".* unsigned$"); Long columnLength; try { columnLength = r.getLong("DATETIME_PRECISION"); } catch ( java.sql.SQLException e ) { columnLength = null; } if ( r.getString("COLUMN_KEY").equals("PRI") ) t.pkIndex = i; if ( colType.equals("enum") || colType.equals("set")) { String expandedType = r.getString("COLUMN_TYPE"); enumValues = extractEnumValues(expandedType); } t.addColumn(ColumnDef.build(colName, colEnc, colType, colPos, colSigned, enumValues, columnLength)); i++; } captureTablePK(t); }

Target:
private void captureTable(Table t) throws SQLException { int i = 0; infoSchemaStmt.setString(1, t.getDatabase()); infoSchemaStmt.setString(2, t.getName()); ResultSet r = infoSchemaStmt.executeQuery(); boolean hasDatetimePrecision = isMySQLAtLeast56(); while(r.next()) { String[] enumValues = null; String colName = r.getString("COLUMN_NAME"); String colType = r.getString("DATA_TYPE"); String colEnc = r.getString("CHARACTER_SET_NAME"); int colPos = r.getInt("ORDINAL_POSITION") - 1; boolean colSigned = !r.getString("COLUMN_TYPE").matches(".* unsigned$"); Long columnLength = null; if (hasDatetimePrecision) columnLength = r.getLong("DATETIME_PRECISION"); if ( r.getString("COLUMN_KEY").equals("PRI") ) t.pkIndex = i; if ( colType.equals("enum") || colType.equals("set")) { String expandedType = r.getString("COLUMN_TYPE"); enumValues = extractEnumValues(expandedType); } t.addColumn(ColumnDef.build(colName, colEnc, colType, colPos, colSigned, enumValues, columnLength)); i++; } captureTablePK(t); }
Source:
public ActionResult execute() { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); List<FeedbackSessionAttributes> feedbackSessionAttributes; if (courseId == null) { if (userInfo.isInstructor) { boolean isInRecycleBin = getBooleanRequestParamValue(Const.ParamsNames.IS_IN_RECYCLE_BIN); List<InstructorAttributes> instructors = logic.getInstructorsForGoogleId(userInfo.getId(), true); if (isInRecycleBin) { feedbackSessionAttributes = logic.getSoftDeletedFeedbackSessionsListForInstructors(instructors); } else { feedbackSessionAttributes = logic.getFeedbackSessionsListForInstructor(instructors); } } else { List<StudentAttributes> students = logic.getStudentsForGoogleId(userInfo.getId()); feedbackSessionAttributes = new ArrayList<>(); for (StudentAttributes student : students) { feedbackSessionAttributes.addAll(logic.getFeedbackSessionsForCourse(student.getCourse())); } } } else { feedbackSessionAttributes = logic.getFeedbackSessionsForCourse(courseId); } return new JsonResult(new FeedbackSessionsData(feedbackSessionAttributes)); }

Target:
public ActionResult execute() { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String entityType = getNonNullRequestParamValue(Const.ParamsNames.ENTITY_TYPE); List<FeedbackSessionAttributes> feedbackSessionAttributes; if (courseId == null) { if (entityType.equals(Const.EntityType.STUDENT)) { List<StudentAttributes> students = logic.getStudentsForGoogleId(userInfo.getId()); feedbackSessionAttributes = new ArrayList<>(); for (StudentAttributes student : students) { feedbackSessionAttributes.addAll(logic.getFeedbackSessionsForCourse(student.getCourse())); } } else { boolean isInRecycleBin = getBooleanRequestParamValue(Const.ParamsNames.IS_IN_RECYCLE_BIN); List<InstructorAttributes> instructors = logic.getInstructorsForGoogleId(userInfo.getId(), true); if (isInRecycleBin) { feedbackSessionAttributes = logic.getSoftDeletedFeedbackSessionsListForInstructors(instructors); } else { feedbackSessionAttributes = logic.getFeedbackSessionsListForInstructor(instructors); } } } else { feedbackSessionAttributes = logic.getFeedbackSessionsForCourse(courseId); } if (entityType.equals(Const.EntityType.STUDENT)) { feedbackSessionAttributes = feedbackSessionAttributes.stream() .filter(FeedbackSessionAttributes::isVisible).collect(Collectors.toList()); } FeedbackSessionsData responseData = new FeedbackSessionsData(feedbackSessionAttributes); if (entityType.equals(Const.EntityType.STUDENT)) { responseData.getFeedbackSessions().forEach(FeedbackSessionData::hideInformationForStudent); } return new JsonResult(responseData); }
Source:
private static List<String> getExpectedInputParams(final CSARID csarID, final QName typeID, final String interfaceName, final String operationName) { ParameterHandler.LOG.debug("Fetching expected input params of " + operationName + " in interface " + interfaceName); final List<String> inputParams = new ArrayList<>(); ParameterHandler.LOG.debug("Checking for params with Type: {}", typeID); if (ServiceHandler.toscaEngineService.hasOperationOfATypeSpecifiedInputParams(csarID, typeID, interfaceName, operationName)) { final Node definedInputParameters = ServiceHandler.toscaEngineService.getInputParametersOfATypeOperation(csarID, typeID, interfaceName, operationName); if (definedInputParameters != null) { final NodeList definedInputParameterList = definedInputParameters.getChildNodes(); for (int i = 0; i < definedInputParameterList.getLength(); i++) { final Node currentNode = definedInputParameterList.item(i); if (currentNode.getNodeType() == Node.ELEMENT_NODE) { final String name = ((Element) currentNode).getAttribute("name"); inputParams.add(name); } } } } return inputParams; }

Target:
private static Set<String> getExpectedInputParams(final CSARID csarID, final QName typeID, final String interfaceName, final String operationName) { final Node definedInputParameters = ServiceHandler.toscaEngineService.getInputParametersOfATypeOperation(csarID, typeID, interfaceName, operationName); if (Objects.isNull(definedInputParameters)) { return Collections.emptySet(); } final Set<String> inputParams = new HashSet<>(); final NodeList definedInputParameterList = definedInputParameters.getChildNodes(); for (int i = 0; i < definedInputParameterList.getLength(); i++) { final Node currentNode = definedInputParameterList.item(i); if (currentNode.getNodeType() == Node.ELEMENT_NODE) { final String name = ((Element) currentNode).getAttribute("name"); inputParams.add(name); } } return inputParams; }
Source:
public static void resetServerConfiguration() throws Exception { try (CLIWrapper cli = new CLIWrapper(true)) { FileUtils.deleteQuietly(tempFolder); cli.sendLine(String.format( "/core-service=management/management-interface=http-interface:undefine-attribute(name=http-authentication-factory)", MANAGEMENT_FILESYSTEM_NAME)); cli.sendLine(String.format( "/subsystem=elytron/http-authentication-factory=%s:remove()", MANAGEMENT_FILESYSTEM_NAME, PREDEFINED_HTTP_SERVER_MECHANISM_FACTORY)); cli.sendLine(String.format("/subsystem=elytron/security-domain=%s:remove()", MANAGEMENT_FILESYSTEM_NAME)); cli.sendLine(String.format("/subsystem=elytron/filesystem-realm=%s:remove()", MANAGEMENT_FILESYSTEM_NAME)); } FileUtils.deleteDirectory(tempFolder); }

Target:
public static void resetServerConfiguration() throws Exception { try (CLIWrapper cli = new CLIWrapper(true)) { cli.sendLine(String.format( "/core-service=management/management-interface=http-interface:undefine-attribute(name=http-authentication-factory)", MANAGEMENT_FILESYSTEM_NAME), true); cli.sendLine(String.format( "/subsystem=elytron/http-authentication-factory=%s:remove()", MANAGEMENT_FILESYSTEM_NAME, PREDEFINED_HTTP_SERVER_MECHANISM_FACTORY), true); cli.sendLine(String.format("/subsystem=elytron/security-domain=%s:remove()", MANAGEMENT_FILESYSTEM_NAME), true); cli.sendLine(String.format("/subsystem=elytron/filesystem-realm=%s:remove()", MANAGEMENT_FILESYSTEM_NAME), true); cli.sendLine(String.format("/subsystem=elytron/custom-credential-security-factory=%s:remove()", CUSTOM_CRED_SEC_FACTORY_NAME), true); cli.sendLine("module remove --name=" + CUSTOM_CREDENTIAL_SECURITY_FACTORY_MODULE_NAME, true); } finally { FileUtils.deleteDirectory(tempFolder.toFile()); } }
Source:
public void getBoolean() { account.setNotifyByEmail(Boolean.TRUE); assertTrue(service.getOptions(TestConstants.TEST_STUDY, HEALTH_CODE).getBoolean(EMAIL_NOTIFICATIONS)); }

Target:
public void getBoolean() { account.setNotifyByEmail(Boolean.FALSE); assertFalse(service.getOptions(TestConstants.TEST_STUDY, HEALTH_CODE).getBoolean(EMAIL_NOTIFICATIONS)); account.setNotifyByEmail(Boolean.TRUE); assertTrue(service.getOptions(TestConstants.TEST_STUDY, HEALTH_CODE).getBoolean(EMAIL_NOTIFICATIONS)); }
Source:
public LeaderAndIsrRequest build(short version) { List<LeaderAndIsrLiveLeader> leaders = liveLeaders.stream().map(n -> new LeaderAndIsrLiveLeader() .setBrokerId(n.id()) .setHostName(n.host()) .setPort(n.port()) ).collect(Collectors.toList()); LeaderAndIsrRequestData data = new LeaderAndIsrRequestData() .setControllerId(controllerId) .setControllerEpoch(controllerEpoch) .setBrokerEpoch(brokerEpoch) .setLiveLeaders(leaders); if (version >= 2) { Map<String, List<LeaderAndIsrPartitionState>> groupedMap = groupByTopic(partitionStates); List<LeaderAndIsrTopicState> topicStates = groupedMap.entrySet().stream().map(entry -> new LeaderAndIsrTopicState() .setTopicName(entry.getKey()) .setPartitionStates(entry.getValue()) ).collect(Collectors.toList()); data.setTopicStates(topicStates); } else { data.setUngroupedPartitionStates(partitionStates); } return new LeaderAndIsrRequest(data, version); }

Target:
public LeaderAndIsrRequest build(short version) { List<LeaderAndIsrLiveLeader> leaders = liveLeaders.stream().map(n -> new LeaderAndIsrLiveLeader() .setBrokerId(n.id()) .setHostName(n.host()) .setPort(n.port()) ).collect(Collectors.toList()); LeaderAndIsrRequestData data = new LeaderAndIsrRequestData() .setControllerId(controllerId) .setControllerEpoch(controllerEpoch) .setBrokerEpoch(brokerEpoch) .setLiveLeaders(leaders); if (version >= 2) { Map<String, LeaderAndIsrTopicState> topicStatesMap = groupByTopic(partitionStates); data.setTopicStates(new ArrayList<>(topicStatesMap.values())); } else { data.setUngroupedPartitionStates(partitionStates); } return new LeaderAndIsrRequest(data, version); }
Source:
public Board() { Buttons(); createScore(); createGrid(); initGameProperties(); }

Target:
public Board() { CreateButtons(); createScore(); createGrid(); initGameProperties(); }
Source:
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { if (cachedTraversals == null) { try { cachedTraversals = convertCompareTraversal(resolveEMFTraversal(context, monitor)); } catch (InterruptedException e) { final ResourceTraversal singletonTraversal = new ResourceTraversal(new IResource[] {file, }, IResource.DEPTH_ONE, IResource.NONE); return new ResourceTraversal[] {singletonTraversal, }; } } return cachedTraversals; }

Target:
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { if (cachedTraversals == null) { try { cachedTraversals = convertCompareTraversal(resolveEMFTraversal(context, monitor)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); final ResourceTraversal singletonTraversal = new ResourceTraversal(new IResource[] {file, }, IResource.DEPTH_ONE, IResource.NONE); return new ResourceTraversal[] {singletonTraversal, }; } } return cachedTraversals; }
Source:
T perform() throws Exception; } public interface OnFailure { void perform() throws Exception; }

Target:
T perform() throws Exception; } public interface CleanupAfterFailure { void cleanup() throws Exception; }
Source:
private boolean hasPropertiesWithValues() { int targetCount = queries.length; read.singleNode( nodeLabelCursor.nodeReference(), nodeCursor ); if ( nodeCursor.next() ) { nodeCursor.properties( propertyCursor ); while ( propertyCursor.next() ) { for ( IndexQuery query : queries ) { if ( propertyCursor.propertyKey() == query.propertyKeyId() && query.acceptsValueAt( propertyCursor ) ) { targetCount--; if ( targetCount == 0 ) { return true; } } } } } return false; }

Target:
private boolean hasPropertiesWithValues() { int targetCount = queries.length; read.singleNode( nodeLabelCursor.nodeReference(), nodeCursor ); if ( nodeCursor.next() ) { nodeCursor.properties( propertyCursor ); while ( propertyCursor.next() ) { for ( IndexQuery query : queries ) { if ( propertyCursor.propertyKey() == query.propertyKeyId() ) { if ( query.acceptsValueAt( propertyCursor ) ) { targetCount--; if ( targetCount == 0 ) { return true; } } else { return false; } } } } } return false; }
Source:
public TimestampedValue<V> fromBytes(byte[] bytes) { ByteBuffer bb = ByteBuffer.wrap(bytes); byte[] vBytes = new byte[bytes.length - 8 ]; bb.get(vBytes, 0, vBytes.length); V v = vSerde.fromBytes(vBytes); long ts = bb.getLong(); return new TimestampedValue<>(v, ts); }

Target:
public TimestampedValue<V> fromBytes(byte[] bytes) { ByteBuffer bb = ByteBuffer.wrap(bytes); byte[] vBytes = new byte[bytes.length - TIMESTAMP_BYTES]; bb.get(vBytes, 0, vBytes.length); V v = vSerde.fromBytes(vBytes); long ts = bb.getLong(); return new TimestampedValue<>(v, ts); }
Source:
public synchronized void modified(Map<String, Object> config) { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); try { primaryAddress = new CidrAddress(primaryAddressConf); } catch (IllegalArgumentException e) { } }

Target:
public synchronized void modified(Map<String, Object> config) { final @Nullable String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); if (primaryAddressConf != null) { try { primaryAddress = new CidrAddress(primaryAddressConf); } catch (IllegalArgumentException e) { LOGGER.warn("Primary address configuration value invalid", e); } } }
Source:
protected List<MethodMatcher> getMethodInvocationMatchers() { return ImmutableList.of( MethodMatcher.create().typeDefinition("javax.crypto.spec.IvParameterSpec").name("<init>").withAnyParameters()); }

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList( MethodMatcher.create().typeDefinition("javax.crypto.spec.IvParameterSpec").name("<init>").withAnyParameters()); }
Source:
protected void register() { Composite plotArea = (Composite) getChart().getPlotArea(); if (this instanceof MouseListener) { plotArea.addMouseListener((MouseListener) this); } if (this instanceof MouseMoveListener) { plotArea.addMouseMoveListener((MouseMoveListener) this); } if (this instanceof MouseWheelListener) { plotArea.addMouseWheelListener((MouseWheelListener) this); } if (this instanceof MouseTrackListener) { plotArea.addMouseTrackListener((MouseTrackListener) this); } if (this instanceof PaintListener) { plotArea.addPaintListener((PaintListener) this); } if (this instanceof ICustomPaintListener) { ((IPlotArea) plotArea).addCustomPaintListener((ICustomPaintListener) this); } TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler(); if(tooltipHandler != null) { tooltipHandler.activateHoverHelp(plotArea); } }

Target:
protected void register() { IPlotArea plotArea = getChart().getPlotArea(); Control control = plotArea.getControl(); if (this instanceof MouseListener) { control.addMouseListener((MouseListener) this); } if (this instanceof MouseMoveListener) { control.addMouseMoveListener((MouseMoveListener) this); } if (this instanceof MouseWheelListener) { control.addMouseWheelListener((MouseWheelListener) this); } if (this instanceof MouseTrackListener) { control.addMouseTrackListener((MouseTrackListener) this); } if (this instanceof PaintListener) { control.addPaintListener((PaintListener) this); } if (this instanceof ICustomPaintListener) { plotArea.addCustomPaintListener((ICustomPaintListener) this); } TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler(); if(tooltipHandler != null) { tooltipHandler.activateHoverHelp(control); } }
Source:
public void addConfiguration(File configFile) throws ConfigException { { LOG.info("Reading configuration from: {}", configFile.getAbsolutePath()); try { configFile = (new VerifyingFileFactory.Builder(LOG).warnForRelativePath().failForNonExistingPath() .build()).validate(configFile); Properties cfg = new Properties(); FileInputStream in = new FileInputStream(configFile); try { cfg.load(in); } finally { in.close(); } parseProperties(cfg); } catch (IOException | IllegalArgumentException e) { LOG.error("Error while configuration from: {}", configFile.getAbsolutePath(), e); throw new ConfigException("Error while processing " + configFile.getAbsolutePath(), e); } } }

Target:
public void addConfiguration(File configFile) throws ConfigException { LOG.info("Reading configuration from: {}", configFile.getAbsolutePath()); try { configFile = (new VerifyingFileFactory.Builder(LOG).warnForRelativePath().failForNonExistingPath().build()) .validate(configFile); Properties cfg = new Properties(); FileInputStream in = new FileInputStream(configFile); try { cfg.load(in); } finally { in.close(); } parseProperties(cfg); } catch (IOException | IllegalArgumentException e) { LOG.error("Error while configuration from: {}", configFile.getAbsolutePath(), e); throw new ConfigException("Error while processing " + configFile.getAbsolutePath(), e); } }
Source:
public static String conjoinSolrQueries(String q1, String q2){ if(q1.isEmpty()){ return q2; } if(q2.isEmpty()){ return q1; } return q1 + " AND " + q2 ; }

Target:
public static String conjoinSolrQueries(String q1, String q2){ if(StringUtils.isEmpty(q1)){ return q2; } if(StringUtils.isEmpty(q2)){ return q1; } return q1 + " AND " + q2 ; }
Source:
private void copyTemplatePermissions() { if (!getParameters().isCopyTemplatePermissions()) { return; } PermissionDAO dao = getDbFacade().getPermissionDao(); List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { boolean templateOwnerRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_OWNER.getId()); boolean templateUserRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_USER.getId()); if (templateOwnerRole || templateUserRole) { continue; } vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); } }

Target:
private void copyTemplatePermissions() { PermissionDAO dao = getDbFacade().getPermissionDao(); List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { boolean templateOwnerRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_OWNER.getId()); boolean templateUserRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_USER.getId()); if (templateOwnerRole || templateUserRole) { continue; } vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); } }
Source:
public void diagnostic(String expression, Diagnostic diagnostic) { final String ls = System.getProperty("line.separator"); StringBuilder messageToLog = new StringBuilder(); if (diagnostic.getMessage() != null && diagnostic.getMessage().trim().length() > 0) { messageToLog.append(diagnostic.getMessage()); messageToLog.append(ls); } List<Diagnostic> children = diagnostic.getChildren(); for (Diagnostic childDiagnostic : children) { if (childDiagnostic.getMessage() != null && childDiagnostic.getMessage().trim().length() > 0) { messageToLog.append(childDiagnostic.getMessage()); messageToLog.append(ls); } } String message = MessageFormat.format(Messages.AbstractEEFEclipsePlugin_InvalidEvaluation, expression, messageToLog); IStatus status = new Status(diagnostic.getSeverity(), this.bundleSymbolicName, message); this.getLog().log(status); }

Target:
public void diagnostic(String expression, Diagnostic diagnostic) { final String ls = System.getProperty("line.separator"); StringBuilder messageToLog = new StringBuilder(); if (!Util.isBlank(diagnostic.getMessage())) { messageToLog.append(diagnostic.getMessage()); messageToLog.append(ls); } List<Diagnostic> children = diagnostic.getChildren(); for (Diagnostic childDiagnostic : children) { if (!Util.isBlank(childDiagnostic.getMessage())) { messageToLog.append(childDiagnostic.getMessage()); messageToLog.append(ls); } } String message = MessageFormat.format(Messages.AbstractEEFEclipsePlugin_InvalidEvaluation, expression, messageToLog); IStatus status = new Status(diagnostic.getSeverity(), this.bundleSymbolicName, message); this.getLog().log(status); }
Source:
public void renderState(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setHeader("pragma", "no-cache"); res.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate"); res.setDateHeader("Expires", 0); final long startTime = System.nanoTime(); final PipelineEventReader<CharacterEventReader, CharacterEvent> pipelineEventReader = this.pipeline.getEventReader(req, res); final String contentType = "application/json; charset=" + CHARACTER_SET; res.setContentType(contentType); final PrintWriter writer = res.getWriter(); if (pipelineEventReader != null) { for (final CharacterEvent event : pipelineEventReader) { if (CharacterEventTypes.CHARACTER != event.getEventType()) { throw new RenderingPipelineConfigurationException( "Only " + CharacterEventTypes.CHARACTER + " events are supported in the top level renderer. " + event.getEventType() + " is not supported."); } final String data = ((CharacterDataEvent) event).getData(); writer.print(data); writer.flush(); res.flushBuffer(); } } final long executionTime = System.nanoTime() - startTime; final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(req); this.portalEventFactory.publishPortalRenderEvent( req, this, req.getPathInfo(), executionTime, portalRequestInfo); }

Target:
public void renderState(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException, IllegalStateException { res.setHeader("pragma", "no-cache"); res.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate"); res.setDateHeader("Expires", 0); final long startTime = System.nanoTime(); final PipelineEventReader<CharacterEventReader, CharacterEvent> pipelineEventReader = this.pipeline.getEventReader(req, res); final String contentType = "application/json; charset=" + CHARACTER_SET; res.setContentType(contentType); final PrintWriter writer = res.getWriter(); if (pipelineEventReader != null) { for (final CharacterEvent event : pipelineEventReader) { if (CharacterEventTypes.CHARACTER != event.getEventType()) { throw new RenderingPipelineConfigurationException( "Only " + CharacterEventTypes.CHARACTER + " events are supported in the top level renderer. " + event.getEventType() + " is not supported."); } final String data = ((CharacterDataEvent) event).getData(); writer.print(data); writer.flush(); res.flushBuffer(); } } else { logger.warn("PipelineEventReader is null"); throw new IllegalStateException("PipelineEventReader is null"); } final long executionTime = System.nanoTime() - startTime; final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(req); this.portalEventFactory.publishPortalRenderEvent( req, this, req.getPathInfo(), executionTime, portalRequestInfo); }
Source:
private void setBatteryLevel(int newBatteryLevel, View source) { mBatteryLevelCharacteristic.setValue(newBatteryLevel, BluetoothGattCharacteristic.FORMAT_UINT8, 0); if (source instanceof TextView) { mBatteryLevelSeekBar.setProgress(newBatteryLevel); } else if (source instanceof SeekBar) { mBatteryLevelEditText.setText(Integer.toString(newBatteryLevel)); } else { mBatteryLevelSeekBar.setProgress(newBatteryLevel); mBatteryLevelEditText.setText(Integer.toString(newBatteryLevel)); } }

Target:
private void setBatteryLevel(int newBatteryLevel, View source) { mBatteryLevelCharacteristic.setValue(newBatteryLevel, BluetoothGattCharacteristic.FORMAT_UINT8, 0); if (source != mBatteryLevelSeekBar) { mBatteryLevelSeekBar.setProgress(newBatteryLevel); } if (source != mBatteryLevelEditText) { mBatteryLevelEditText.setText(Integer.toString(newBatteryLevel)); } }
Source:
protected int run() throws Exception { Jenkins jenkins = Jenkins.get(); final HashSet<String> names = new HashSet<>(); names.addAll(jobNames); final StringBuilder resultBuilder = new StringBuilder(); for (final String jobName : names) { Item item = jenkins.getItemByFullName(jobName); if (item instanceof Job) { stopJobBuilds((Job) item, jobName, resultBuilder); } else if (item != null) { resultBuilder.append(String.format("Cannot abort runs for %s. Unsupported job type: %s\n", item, item.getClass())); } else { resultBuilder.append(String.format("Job with name %s not found.\n", jobName)); } } stdout.print(resultBuilder.toString()); return 0; }

Target:
protected int run() throws Exception { Jenkins jenkins = Jenkins.get(); final HashSet<String> names = new HashSet<>(); names.addAll(jobNames); final List<Job> jobsToStop = new ArrayList<>(); for (final String jobName : names) { Item item = jenkins.getItemByFullName(jobName); if (item instanceof Job) { jobsToStop.add((Job) item); } else { throw new IllegalArgumentException("Job not found: '" + jobName + "'"); } } for (final Job job : jobsToStop) { stopJobBuilds(job); } if (!isAnyBuildStopped) { stdout.println("No builds stopped"); } return 0; }
Source:
public void onFailure(WorkflowExecutionContext context) throws FalconException { if (context.isWorkflowKilledManually()) { LOG.debug("User workflow: killed manually of instance: belongs to entity: {}, so retry won't happen ", context.getWorkflowId(), context.getNominalTimeAsISO8601(), context.getEntityName()); return; } else if (context.hasWorkflowTimedOut()) { Entity entity = EntityUtil.getEntity(context.getEntityType(), context.getEntityName()); Retry retry = getRetry(entity); if (!retry.isOnTimeout()) { return; } } handleRerun(context.getClusterName(), context.getEntityType(), context.getEntityName(), context.getNominalTimeAsISO8601(), context.getWorkflowRunIdString(), context.getWorkflowId(), context.getWorkflowParentId(), context.getWorkflowUser(), context.getExecutionCompletionTime()); }

Target:
public void onFailure(WorkflowExecutionContext context) throws FalconException { if (context.isWorkflowKilledManually()) { LOG.debug("Workflow: Instance: Entity: {}, killed manually by user. Will not retry.", context.getWorkflowId(), context.getNominalTimeAsISO8601(), context.getEntityName()); return; } else if (context.hasWorkflowTimedOut()) { Entity entity = EntityUtil.getEntity(context.getEntityType(), context.getEntityName()); Retry retry = getRetry(entity); if (!retry.isOnTimeout()) { return; } } handleRerun(context.getClusterName(), context.getEntityType(), context.getEntityName(), context.getNominalTimeAsISO8601(), context.getWorkflowRunIdString(), context.getWorkflowId(), context.getWorkflowParentId(), context.getWorkflowUser(), context.getExecutionCompletionTime()); }
Source:
private void exitLocked() { final ConnectivityManager cm = ConnectivityManager.from(mContext); cm.unregisterNetworkCallback(mNetworkCallback); agentDisconnect(); resetIkeStateLocked(); mActiveNetwork = null; updateState(DetailedState.DISCONNECTED, "Platform VPN exit"); }

Target:
private void exitLocked() { final ConnectivityManager cm = ConnectivityManager.from(mContext); cm.unregisterNetworkCallback(mNetworkCallback); agentDisconnect(); resetIkeStateLocked(); mActiveNetwork = null; }
Source:
private void addFailureCauseRepresentation(final StringBuilder stringBuilder, final IndicationUrlBuilder indicationUrlBuilder, final FoundFailureCause cause, final int indentLevel) { final int nextIndentLevel = indentLevel + LIST_INCREMENT; if (useHtmlFormat) { stringBuilder.append("<li>"); stringBuilder.append(cause.getName()); stringBuilder.append(": "); stringBuilder.append(cause.getDescription()); if (includeIndications) { addIndicationsRepresentation(stringBuilder, indicationUrlBuilder, cause.getIndications(), nextIndentLevel); } stringBuilder.append("</li>"); } else { stringBuilder.append(indentForDepth(indentLevel)); stringBuilder.append("* "); stringBuilder.append(cause.getName()); stringBuilder.append(": "); stringBuilder.append(cause.getDescription()); stringBuilder.append("\n"); if (includeIndications) { addIndicationsRepresentation(stringBuilder, indicationUrlBuilder, cause.getIndications(), nextIndentLevel); } } }

Target:
private void addFailureCauseRepresentation(final StringBuilder stringBuilder, final IndicationUrlBuilder indicationUrlBuilder, final FoundFailureCause cause, final int indentLevel) { final int nextIndentLevel = indentLevel + LIST_INCREMENT; if (useHtmlFormat) { stringBuilder.append("<li>"); try { stringBuilder.append(Jenkins.getInstance().getMarkupFormatter().translate(cause.getName())); } catch (final IOException exception) { stringBuilder.append("cause-name"); } stringBuilder.append(": "); try { stringBuilder.append(Jenkins.getInstance().getMarkupFormatter().translate(cause.getDescription())); } catch (final IOException exception) { stringBuilder.append("cause-description"); } if (includeIndications) { addIndicationsRepresentation(stringBuilder, indicationUrlBuilder, cause.getIndications(), nextIndentLevel); } stringBuilder.append("</li>"); } else { final List<String> lines = wrap( cause.getName() + ": " + cause.getDescription(), wrapWidth - indentForDepth(indentLevel).length() - LIST_BULLET.length()); for (int lineIndex = 0, lineCount = lines.size(); lineIndex < lineCount; ++lineIndex) { if (lineIndex == 0) { stringBuilder.append(LIST_BULLET); } else { stringBuilder.append(LIST_BULLET_SPACE); } stringBuilder.append(lines.get(lineIndex)); stringBuilder.append("\n"); } if (includeIndications) { addIndicationsRepresentation(stringBuilder, indicationUrlBuilder, cause.getIndications(), nextIndentLevel); } } }
Source:
private void unlockEntities() { getSnapshotDao().updateStatus(sourceSnapshotId, SnapshotStatus.OK); getVmDynamicDao().updateStatus(getVmId(), VMStatus.Down); freeLock(); }

Target:
private void unlockEntities() { getSnapshotDao().updateStatus(sourceSnapshotId, SnapshotStatus.OK); getVmDynamicDao().updateStatus(getVmId(), VMStatus.Down); }
Source:
private boolean isChangeRecent(Change change) { if (revisionCutoff == 0) { return false; } return change.timestamp() != null && change.timestamp().isAfter(Instant.now().minus(revisionCutoff, ChronoUnit.HOURS)); }

Target:
private boolean isChangeRecent(Change change) { if (revisionCutoff == null || revisionCutoff.isZero()) { return false; } return change.timestamp() != null && change.timestamp().isAfter(Instant.now().minus(revisionCutoff)); }
Source:
@Override public void clear() { try { lockWriteLocks(); replaceOldSegments(); } finally { unlockWriteLocks(); } }

Target:
@Override public void clear() { for (Segment<K, V> segment : segments) segment.writeLock().lock(); try { for (int i = 0; i < segments.length; i++) segments[i] = new Segment<>(segmentInitCap, loadFactor); modCnt.increment(); } finally { for (Segment<K, V> segment : segments) segment.writeLock().unlock(); } }
Source:
public void testDateExtendingFact() { final Resource resource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(DRL)); resource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); }

Target:
public void testDateExtendingFact() { final Resource resource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(DRL)); resource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); Assertions.assertThat(kbuilder.getResults().getMessages(Message.Level.ERROR)).isEmpty(); }
Source:
private void invalidateDisposedFlowFromCaches(String flowName) { sourcePolicyOuterCache.asMap().keySet().stream() .filter(pair -> pair.getFirst().equals(flowName)) .forEach(matchingPair -> sourcePolicyOuterCache.invalidate(matchingPair)); sourcePolicyInnerCache.asMap().keySet().stream() .filter(pair -> pair.getFirst().equals(flowName)) .forEach(matchingPair -> sourcePolicyInnerCache.invalidate(matchingPair)); noPolicySourceInstances.asMap().keySet().stream() .filter(key -> key.equals(flowName)) .forEach(matchingPair -> noPolicySourceInstances.invalidate(matchingPair)); }

Target:
private void invalidateDisposedFlowFromCaches(String flowName) { noPolicySourceInstances.invalidate(flowName); sourcePolicyOuterCache.asMap().keySet().stream() .filter(pair -> pair.getFirst().equals(flowName)) .forEach(matchingPair -> sourcePolicyOuterCache.invalidate(matchingPair)); sourcePolicyInnerCache.asMap().keySet().stream() .filter(pair -> pair.getFirst().equals(flowName)) .forEach(matchingPair -> sourcePolicyInnerCache.invalidate(matchingPair)); }
Source:
public void setLength(int length) { if (offset + length > buffer.length) { throw new IllegalArgumentException("length"); } this.length = length; }

Target:
public void setLength(int length) { if (offset + length > buffer.length || length < 0) { throw new IllegalArgumentException("length"); } this.length = length; }
Source:
public Value evaluate(DataSourceFactory dsf, Value... values) throws FunctionException { if (gpr == null) { final int nbDec = values[1].getAsInt(); if (nbDec < 0) { throw new FunctionException("Decimal_places has to be >= 0."); } PrecisionModel pm = new PrecisionModel(scaleFactorForDecimalPlaces(nbDec)); gpr = new GeometryPrecisionReducer(pm); } Geometry geom = gpr.reduce(values[0].getAsGeometry()); return ValueFactory.createValue(geom, values[0].getCRS()); }

Target:
public Value evaluate(DataSourceFactory dsf, Value... values) throws FunctionException { if (gpr == null) { final int nbDec = values[1].getAsInt(); if (nbDec < 0) { throw new FunctionException("Decimal_places has to be >= 0."); } PrecisionModel pm = new PrecisionModel(scaleFactorForDecimalPlaces(nbDec)); gpr = new GeometryPrecisionReducer(pm); } return ValueFactory.createValue(gpr.reduce(values[0].getAsGeometry()), values[0].getCRS()); }
Source:
public void delete(String id) { CuratorFramework client = zkConnection.getClient(); String path = Paths.build(Paths.CONTAINERS, id); try { client.delete().forPath(path); } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, KeeperException.NoNodeException.class); } }

Target:
public void delete(String id) { }
Source:
private void validateDataset(final Integer studyId, final DatasetDTO dataSet, final Boolean shouldBeSubobservationDataset) { if (dataSet == null) { this.errors.reject("dataset.does.not.exist", ""); throw new ResourceNotFoundException(this.errors.getAllErrors().get(0)); } this.validateDatasetBelongsToStudy(studyId, dataSet.getDatasetId()); final DatasetType datasetType = this.datasetTypeService.getDatasetTypeById(dataSet.getDatasetTypeId()); if (shouldBeSubobservationDataset && !DatasetTypeEnum.isSubObservationType(datasetType.getDatasetTypeId())) { this.errors.reject("dataset.type.not.subobservation", ""); throw new NotSupportedException(this.errors.getAllErrors().get(0)); } }

Target:
private void validateDataset(final Integer studyId, final DatasetDTO dataSet, final Boolean shouldBeSubobservationDataset) { if (dataSet == null) { this.errors.reject("dataset.does.not.exist", ""); throw new ResourceNotFoundException(this.errors.getAllErrors().get(0)); } this.validateDatasetBelongsToStudy(studyId, dataSet.getDatasetId()); final DatasetTypeDTO datasetType = this.datasetTypeService.getDatasetTypeById(dataSet.getDatasetTypeId()); if (shouldBeSubobservationDataset && !datasetType.isSubObservationType()) { this.errors.reject("dataset.type.not.subobservation", ""); throw new NotSupportedException(this.errors.getAllErrors().get(0)); } }
Source:
private void updateTaggedMemoryAllocations(QueryId queryId, String allocationTag, long delta, boolean putQueryIdIfAbsent) { if (delta == 0) { return; } if (!putQueryIdIfAbsent && !taggedMemoryAllocations.containsKey(queryId)) { return; } Map<String, Long> allocations = taggedMemoryAllocations.computeIfAbsent(queryId, ignored -> new ConcurrentHashMap<>()); allocations.compute(allocationTag, (ignored, oldValue) -> { if (oldValue == null) { return delta; } long newValue = oldValue.longValue() + delta; if (newValue == 0) { return null; } return newValue; }); }

Target:
private void updateTaggedMemoryAllocations(QueryId queryId, String allocationTag, long delta, boolean putQueryIdIfAbsent) { if (delta == 0) { return; } Map<String, Long> allocations; if (putQueryIdIfAbsent) { allocations = taggedMemoryAllocations.computeIfAbsent(queryId, ignored -> new ConcurrentHashMap<>()); } else { allocations = taggedMemoryAllocations.get(queryId); if (allocations == null) { return; } } allocations.compute(allocationTag, (ignored, oldValue) -> { if (oldValue == null) { return delta; } long newValue = oldValue.longValue() + delta; if (newValue == 0) { return null; } return newValue; }); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof MediaUnit)) { return false; } MediaUnit other = (MediaUnit) obj; if (mediaFiles == null) { if (other.mediaFiles != null) { return false; } } else if (!mediaFiles.equals(other.mediaFiles)) { return false; } if (order != other.order) { return false; } if (orderlabel == null) { if (other.orderlabel != null) { return false; } } else if (!orderlabel.equals(other.orderlabel)) { return false; } if (type == null) { if (other.type != null) { return false; } } else if (!type.equals(other.type)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MediaUnit)) { return false; } MediaUnit other = (MediaUnit) obj; if (mediaFiles == null) { if (other.mediaFiles != null) { return false; } } else if (!mediaFiles.equals(other.mediaFiles)) { return false; } if (order != other.order) { return false; } if (orderlabel == null) { if (other.orderlabel != null) { return false; } } else if (!orderlabel.equals(other.orderlabel)) { return false; } if (Objects.isNull(type)) { if (Objects.nonNull(other.type)) { return false; } } else if (!type.equals(other.type)) { return false; } return true; }
Source:
public void testReadAheadManagerForOlderReadAheadFailure() throws Exception { AbfsClient client = getMockAbfsClient(); AbfsRestOperation successOp = getMockRestOp(); doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doReturn(successOp) .doReturn(successOp) .when(client) .read(any(String.class), any(Long.class), any(byte[].class), any(Integer.class), any(Integer.class), any(String.class)); AbfsInputStream inputStream = getAbfsInputStream(client, "testReadAheadManagerForOlderReadAheadFailure.txt"); queueReadAheads(inputStream); Thread.sleep(ReadBufferManager.getBufferManager().getThresholdAgeMilliseconds()); verifyReadCallCount(client, 3); int bytesRead = ReadBufferManager.getBufferManager().getBlock( inputStream, 1 * KILOBYTE, 1 * KILOBYTE, new byte[1 * KILOBYTE]); Assert.assertTrue("bytesRead should be zero when previously read " + "ahead buffer had failed", bytesRead == 0); checkEvictedStatus(inputStream, 0, false); }

Target:
public void testReadAheadManagerForOlderReadAheadFailure() throws Exception { AbfsClient client = getMockAbfsClient(); AbfsRestOperation successOp = getMockRestOp(); doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doReturn(successOp) .doReturn(successOp) .when(client) .read(any(String.class), any(Long.class), any(byte[].class), any(Integer.class), any(Integer.class), any(String.class), any(String.class)); AbfsInputStream inputStream = getAbfsInputStream(client, "testReadAheadManagerForOlderReadAheadFailure.txt"); queueReadAheads(inputStream); Thread.sleep(ReadBufferManager.getBufferManager().getThresholdAgeMilliseconds()); verifyReadCallCount(client, 3); int bytesRead = ReadBufferManager.getBufferManager().getBlock( inputStream, ONE_KB, ONE_KB, new byte[ONE_KB]); Assert.assertEquals("bytesRead should be zero when previously read " + "ahead buffer had failed", 0, bytesRead); checkEvictedStatus(inputStream, 0, false); }
Source:
public static TimeZone getTimeZone() { if (System.getProperty("testng.timezone", "").trim().isEmpty()) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(System.getProperty("testng.timezone")); }

Target:
public static TimeZone getTimeZone() { String timeZone = System.getProperty("testng.timezone", ""); if (timeZone.trim().isEmpty()) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(timeZone); }
Source:
private File createInputFile(final String extension) throws IOException { final File input = new File(outputDir, "input" + extension); final SAMFileWriterFactory samFileWriterFactory = new SAMFileWriterFactory(); final SAMFileWriter writer; if(extension.equals(".cram")) { final Path fasta = IOUtil.getPath("Testinput.fasta"); IOUtil.deleteOnExit(fasta); IOUtil.deleteOnExit(ReferenceSequenceFileFactory.getFastaIndexFileName(fasta)); IOUtil.deleteOnExit(ReferenceSequenceFileFactory.getDefaultDictionaryForReferenceSequence(fasta)); samRecordSetBuilder.writeRandomReference(fasta); writer = samFileWriterFactory.makeWriter(samRecordSetBuilder.getHeader(), true, input, fasta.toFile()); } else { writer = samFileWriterFactory.makeWriter(samRecordSetBuilder.getHeader(), true, input, null); } samRecordSetBuilder.getRecords().forEach(writer::addAlignment); writer.close(); return input; }

Target:
private File createInputFile(final String extension) throws IOException { final File input = new File(outputDir, "input" + extension); final SAMFileWriterFactory samFileWriterFactory = new SAMFileWriterFactory(); final SAMFileWriter writer; if (extension.equals(".cram")) { final Path fasta = fastaFiles.computeIfAbsent(samRecordSetBuilder.getHeader(), h -> { final Path fastaDir = IOUtil.createTempDir("SamFileTester", "").toPath(); IOUtil.deleteOnExit(fastaDir); final Path newFasta = fastaDir.resolve("input.fasta"); IOUtil.deleteOnExit(newFasta); IOUtil.deleteOnExit(ReferenceSequenceFileFactory.getFastaIndexFileName(newFasta)); IOUtil.deleteOnExit(ReferenceSequenceFileFactory.getDefaultDictionaryForReferenceSequence(newFasta)); try { long sum = samRecordSetBuilder.getHeader() .getSequenceDictionary().getSequences().stream() .mapToLong(SAMSequenceRecord::getSequenceLength) .sum(); Assert.assertFalse(sum >= 10_000_000, "Sequence dictionary is very large (total size " + sum + "). In a Cram test this could be a problem leading to writing lots" + "of bases to disk. please modify the tester using 'ModifyTesterForCramTests'. " + "For exmaple look at testBulkFragmentsNoDuplicates in AbstractMarkDuplicatesCommandLineProgramTest"); samRecordSetBuilder.writeRandomReference(newFasta); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("failed to create fasta file"); } return newFasta; }); writer = samFileWriterFactory.makeWriter(samRecordSetBuilder.getHeader(), true, input, fasta.toFile()); } else { writer = samFileWriterFactory.makeWriter(samRecordSetBuilder.getHeader(), true, input, null); } samRecordSetBuilder.getRecords().forEach(writer::addAlignment); writer.close(); return input; }
Source:
protected static String read(Path file) { try { return Files.lines(file).collect(joining("\n")); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private static String read(Path file) { try { return Files.asCharSource(file.toFile(), UTF_8).read(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public List<Integer> anyInsertQuery(QueryBuilder query) { try (Connection c = ds.getConnection()) { LOGGER.log(Level.FINEST, query.toString()); PreparedStatement stmt = query.toStatement(c, Statement.RETURN_GENERATED_KEYS); try { if (stmt.executeUpdate() <= 0) { return null; } ResultSet rs = stmt.getGeneratedKeys(); List<Integer> list = new ArrayList<Integer>(); while (rs.next()) { list.add(rs.getInt(1)); } rs.close(); return list; } finally { stmt.close(); } } catch (SQLException ex) { throw new IllegalStateException("InsertQuery Failed", ex); } }

Target:
public List<Integer> anyInsertQuery(QueryBuilder query) { LOGGER.log(Level.FINEST, query.toString()); try (Connection c = ds.getConnection()) { try (PreparedStatement stmt = query.toStatement(c, Statement.RETURN_GENERATED_KEYS)) { if (stmt.executeUpdate() <= 0) { return null; } try (ResultSet rs = stmt.getGeneratedKeys()) { List<Integer> list = new ArrayList<Integer>(); while (rs.next()) { list.add(rs.getInt(1)); } return list; } } } catch (SQLException ex) { throw new IllegalStateException("InsertQuery Failed", ex); } }
Source:
public String exportExecutionCoursesEffortRates(Model model, @ModelAttribute ExecutionYear executionYear, final HttpServletResponse response) throws IOException { if (executionYear != null) { List<ExecutionCourse> executionCourses = executionYear.getExecutionPeriodsSet().stream() .flatMap(es -> es.getAssociatedExecutionCoursesSet().stream()).filter(ec -> !ec.getProjectTutorialCourse()) .sorted(ExecutionCourse.EXECUTION_COURSE_COMPARATOR_BY_EXECUTION_PERIOD_AND_NAME) .collect(Collectors.toList()); SpreadsheetBuilder builder = new SpreadsheetBuilder(); builder.addSheet(executionYear.getName(), new SheetData<ExecutionCourse>(executionCourses) { @Override protected void makeLine(ExecutionCourse executionCourse) { addCell(executionCourse.getExternalId()); addCell(executionCourse.getName() + " (" + executionCourse.getSigla() + ")"); addCell(executionCourse.getDegreePresentationString()); addCell(executionCourse.getEffortRate()); } }); response.setContentType("text/csv"); String fileName = BundleUtil.getString("resources.TeacherCreditsSheetResources", "label.effortRate").replaceAll(" ", "_") + "_" + executionYear.getName().replaceAll("/", "_") + ".csv"; response.setHeader("Content-Disposition", "filename=" + fileName); builder.build(WorkbookExportFormat.CSV, response.getOutputStream()); response.flushBuffer(); } return null; }

Target:
public String exportExecutionCoursesEffortRates(Model model, @ModelAttribute ExecutionYear executionYear, final HttpServletResponse response) throws IOException { if (executionYear != null) { List<ExecutionCourse> executionCourses = executionYear.getExecutionPeriodsSet().stream() .flatMap(es -> es.getAssociatedExecutionCoursesSet().stream()).filter(ec -> !ec.getProjectTutorialCourse()) .sorted(ExecutionCourse.EXECUTION_COURSE_COMPARATOR_BY_EXECUTION_PERIOD_AND_NAME) .collect(Collectors.toList()); SpreadsheetBuilder builder = new SpreadsheetBuilder(); builder.addSheet(executionYear.getName(), new SheetData<ExecutionCourse>(executionCourses) { @Override protected void makeLine(ExecutionCourse executionCourse) { addCell(GepReportFile.getExecutionCourseCode(executionCourse)); addCell(executionCourse.getEffortRate()); } }); response.setContentType("text/csv"); String fileName = BundleUtil.getString("resources.TeacherCreditsSheetResources", "label.effortRate").replaceAll(" ", "_") + "_" + executionYear.getName().replaceAll("/", "_") + ".csv"; response.setHeader("Content-Disposition", "filename=" + fileName); builder.build(WorkbookExportFormat.CSV, response.getOutputStream()); response.flushBuffer(); } return null; }
Source:
public static void eventNewConnection( final String channel, final int streamId, final int sessionId, final long position, final String sourceInformation) { System.out.println( String.format( "new connection on %s streamId %x sessionId %x from %s", channel, streamId, sessionId, sourceInformation)); }

Target:
public static void eventNewConnection( final String channel, final int streamId, final int sessionId, final long position, final String sourceInformation) { System.out.format( "new connection on %s streamId %x sessionId %x from %s%n", channel, streamId, sessionId, sourceInformation); }