auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/copyToVRFrameBuffers"); FINAL.bindTexture(); <START> if (!renderingConfig.isVrSupport()) { <END> logger.warn("CopyToVRFrameBufferNode processed in non-VR mode."); } else { renderFinalStereoImage(worldRenderer.getCurrentRenderStage()); } PerformanceMonitor.endActivity(); }</code><technical_language>of requireCondition() line in init() need this IF block. process() method executed (in NodeTask.execute()) _only_ if required conditions satisfied. In short, in place of IF block leave renderFinalStereoImage call. logger warning get executed anyway</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/copyImageToHMD"); FINAL.bindTexture(); renderFinalStereoImage(worldRenderer.getCurrentRenderStage()); PerformanceMonitor.endActivity(); }
Source:
<code>public boolean teleportToSpawn() { Location target = getBedSpawnLocation(); if (target == null) { target = server.getWorlds().get(0).getSpawnLocation(); } PlayerPortalEvent event = EventFactory.callEvent(new PlayerPortalEvent(this, location.clone(), target, null)); if (event.isCancelled()) { return false; } target = event.getTo(); spawnAt(target); teleported = true; <START> awardAchievement(Achievement.THE_END); <END> return true; }</code><technical_language>achievements awarded if prerequisites been; a helper method checks achievement's parent awarding helpful here</technical_language>

Target:
protected boolean teleportToSpawn() { Location target = getBedSpawnLocation(); if (target == null) { target = server.getWorlds().get(0).getSpawnLocation(); } PlayerPortalEvent event = EventFactory.callEvent(new PlayerPortalEvent(this, location.clone(), target, null)); if (event.isCancelled()) { return false; } target = event.getTo(); spawnAt(target); teleported = true; awardAchievement(Achievement.THE_END, false); return true; }
Source:
<code>public static void addLicenseTexts(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { List<LicenseNameWithText> lts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); lts.forEach(lt -> { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle("Heading2"); XWPFRun licenseRun = licenseParagraph.createRun(); String licenseName = lt.isSetLicenseName() ? lt.getLicenseName() : "Unknown license name"; licenseRun.setText(licenseName); addNewLines(licenseRun, 1); XWPFParagraph licenseTextParagraph = document.createParagraph(); XWPFRun licenseTextRun = licenseTextParagraph.createRun(); <START> addFormattedText(licenseTextRun, nullToEmptyString(lt.getLicenseText()), 12); <END> addNewLines(licenseTextRun, 1); }); }</code><technical_language>magic constant</technical_language>

Target:
public static void addLicenseTexts(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { List<LicenseNameWithText> lts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); lts.forEach(lt -> { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle("Heading2"); XWPFRun licenseRun = licenseParagraph.createRun(); String licenseName = lt.isSetLicenseName() ? lt.getLicenseName() : "Unknown license name"; licenseRun.setText(licenseName); addNewLines(licenseRun, 1); XWPFParagraph licenseTextParagraph = document.createParagraph(); XWPFRun licenseTextRun = licenseTextParagraph.createRun(); addFormattedText(licenseTextRun, nullToEmptyString(lt.getLicenseText()), FONT_SIZE); addNewLines(licenseTextRun, 1); }); }
Source:
<code>public void checksJsonSchemaConstraints() throws Exception { final JSONArray invalidTestCases = new JSONArray( readFile("org/zalando/nakadi/validation/invalid-json-schema-examples.json")); <START> for(final Iterator<Object> i = invalidTestCases.iterator(); i.hasNext();) { <END> final JSONObject testCase = (JSONObject) i.next(); final Schema schema = SchemaLoader.load(testCase.getJSONObject("schema")); final List<String> errorMessages = testCase .getJSONArray("errors") .toList() .stream() .map(Object::toString) .collect(toList()); final String description = testCase.getString("description"); assertThat(description, service.checkConstraints(schema).stream().map(Object::toString).collect(toList()), is(errorMessages)); } }</code><technical_language>Hm... I if iterator sense here, usual foreach loop do pretty fine here, iterator code more complicated</technical_language>

Target:
public void checksJsonSchemaConstraints() throws Exception { final JSONArray invalidTestCases = new JSONArray( readFile("org/zalando/nakadi/validation/invalid-json-schema-examples.json")); for(final Object testCaseObject : invalidTestCases) { final JSONObject testCase = (JSONObject) testCaseObject; final Schema schema = SchemaLoader.load(testCase.getJSONObject("schema")); final List<String> errorMessages = testCase .getJSONArray("errors") .toList() .stream() .map(Object::toString) .collect(toList()); final String description = testCase.getString("description"); assertThat(description, service.checkConstraints(schema).stream().map(Object::toString).collect(toList()), is(errorMessages)); } }
Source:
<code>private File createHandleServiceDeployCfg( final MongoController mongo, final String shockHost, final URL authURL, final AuthToken shockAdminToken, final String handleAdminRole, final String mongoDB) throws IOException { final File iniFile = tempDir.resolve("handleService.cfg").toFile(); if (iniFile.exists()) { iniFile.delete(); } final Ini ini = new Ini(); final Section hs = ini.add(HANDLE_SERVICE_NAME); hs.add("self-url", "http://localhost:" + handleServicePort); hs.add("service-port", "" + handleServicePort); hs.add("service-host", "localhost"); URL authServiceURL = new URL(authURL.toString() + "/api/legacy/KBase/Sessions/Login"); hs.add("auth-service-url", authServiceURL.toString()); hs.add("auth-url", authURL.toString()); hs.add("shock-url", shockHost); hs.add("admin-token", shockAdminToken.getToken().toString()); hs.add("admin-roles", handleAdminRole); hs.add("mongo-host", "127.0.0.1"); hs.add("mongo-port", "" + mongo.getServerPort()); hs.add("mongo-database", mongoDB); hs.add("mongo-user", ""); hs.add("mongo-password", ""); <START> hs.add("start-local-mongo", 1); <END> hs.add("namespace", "KBH"); ini.store(iniFile); return iniFile; }</code><technical_language>tests a mongod running this point - passed in MongoController manages that, server mongo.getServerPort() returns. Another mongo server necessary</technical_language>

Target:
private File createHandleServiceDeployCfg( final MongoController mongo, final String shockHost, final URL authURL, final AuthToken shockAdminToken, final String handleAdminRole, final String mongoDB) throws IOException { final File iniFile = tempDir.resolve("handleService.cfg").toFile(); if (iniFile.exists()) { iniFile.delete(); } final Ini ini = new Ini(); final Section hs = ini.add(HANDLE_SERVICE_NAME); hs.add("self-url", "http://localhost:" + handleServicePort); hs.add("service-port", "" + handleServicePort); hs.add("service-host", "localhost"); URL authServiceURL = new URL(authURL.toString() + "/api/legacy/KBase/Sessions/Login"); hs.add("auth-service-url", authServiceURL.toString()); hs.add("auth-url", authURL.toString()); hs.add("shock-url", shockHost); hs.add("admin-token", shockAdminToken.getToken().toString()); hs.add("admin-roles", handleAdminRole); hs.add("mongo-host", "127.0.0.1"); hs.add("mongo-port", "" + mongo.getServerPort()); hs.add("mongo-database", mongoDB); hs.add("mongo-user", ""); hs.add("mongo-password", ""); hs.add("start-local-mongo", 0); hs.add("namespace", "KBH"); ini.store(iniFile); return iniFile; }
Source:
<code>public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child) { final IndentLevel childIndent; if (child.getMainAst().getType() == TokenTypes.OBJBLOCK) { childIndent = new IndentLevel(getIndent(), getBasicOffset()); } else { childIndent = new IndentLevel(getIndent(), getIndentCheck().getLineWrappingIndentation()); } <START> return childIndent; <END> }</code><technical_language>for me, a bit final int offset; if (child.getMainAst().getType() == TokenTypes.OBJBLOCK) { offset= getBasicOffset(); } else { offset= getIndentCheck().getLineWrappingIndentation()); } return new IndentLevel(getIndent(), offset);</technical_language>

Target:
public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child) { final int offset; if (TokenUtil.isOfType(child.getMainAst(), TokenTypes.OBJBLOCK)) { offset = getBasicOffset(); } else { offset = getLineWrappingIndent(); } return new IndentLevel(getIndent(), offset); }
Source:
<code>public void theFirmwareVersionResultShouldBeReturned(final Map<String, String> settings) throws Throwable { final GetFirmwareVersionAsyncRequest getFirmwareVersionAsyncRequest = FirmwareVersionRequestFactory .fromScenarioContext(); final GetFirmwareVersionResponse getFirmwareVersionResponse = this.smartMeteringConfigurationClient .retrieveGetFirmwareVersionResponse(getFirmwareVersionAsyncRequest); assertNotNull("Get firmware version response has result null", getFirmwareVersionResponse.getResult()); final List<FirmwareVersion> firmwareVersions = getFirmwareVersionResponse.getFirmwareVersion(); <START> assertEquals(firmwareVersions.size(), 3); <END> for (final FirmwareVersion receivedFirmwareVersion : firmwareVersions) { assertNotNull("The received firmware module type is null", receivedFirmwareVersion.getFirmwareModuleType()); LOGGER.info("The received firmware module type: {}", receivedFirmwareVersion.getFirmwareModuleType()); assertNotNull("The received firmware version is null", receivedFirmwareVersion.getVersion()); LOGGER.info("The received firmware version: {}", receivedFirmwareVersion.getVersion()); } }</code><technical_language>Please magic numbers</technical_language>

Target:
public void theFirmwareVersionResultShouldBeReturned(final Map<String, String> settings) throws Throwable { final GetFirmwareVersionAsyncRequest getFirmwareVersionAsyncRequest = FirmwareVersionRequestFactory .fromScenarioContext(); final int EXPECTED_FIRMWARE_VERSION_SIZE = 3; final GetFirmwareVersionResponse getFirmwareVersionResponse = this.smartMeteringConfigurationClient .retrieveGetFirmwareVersionResponse(getFirmwareVersionAsyncRequest); assertNotNull("Get firmware version response has result null", getFirmwareVersionResponse.getResult()); assertEquals("Response should be OK", OsgpResultType.OK, getFirmwareVersionResponse.getResult()); final List<FirmwareVersion> firmwareVersions = getFirmwareVersionResponse.getFirmwareVersion(); assertEquals(firmwareVersions.size(), EXPECTED_FIRMWARE_VERSION_SIZE); for (final FirmwareVersion receivedFirmwareVersion : firmwareVersions) { LOGGER.info("The received firmware module type: {}", receivedFirmwareVersion.getFirmwareModuleType()); assertNotNull("The received firmware module type is null", receivedFirmwareVersion.getFirmwareModuleType()); LOGGER.info("The received firmware version: {}", receivedFirmwareVersion.getVersion()); assertNotNull("The received firmware version is null", receivedFirmwareVersion.getVersion()); } }
Source:
<code><START> protected DigitalTwinsClientBuilder getDigitalTwinsClientBuilder(){ <END> DigitalTwinsClientBuilder builder = new DigitalTwinsClientBuilder() .endpoint(DIGITALTWINS_URL) .tokenCredential(new ClientSecretCredentialBuilder() .tenantId(TENANT_ID) .clientId(CLIENT_ID) .clientSecret(CLIENT_SECRET) .build()); if(interceptorManager.isPlaybackMode()){ builder.httpClient(interceptorManager.getPlaybackClient()); return builder; } if(!interceptorManager.isLiveMode()){ builder.addPolicy(interceptorManager.getRecordPolicy()); } return builder; }</code><technical_language>space () {</technical_language>

Target:
protected DigitalTwinsClientBuilder getDigitalTwinsClientBuilder() { DigitalTwinsClientBuilder builder = new DigitalTwinsClientBuilder() .endpoint(DIGITALTWINS_URL); if (interceptorManager.isPlaybackMode()){ builder.httpClient(interceptorManager.getPlaybackClient()); builder.tokenCredential(new FakeCredentials()); return builder; } if (!interceptorManager.isLiveMode()){ builder.addPolicy(interceptorManager.getRecordPolicy()); } builder.tokenCredential(new ClientSecretCredentialBuilder() .tenantId(TENANT_ID) .clientId(CLIENT_ID) .clientSecret(CLIENT_SECRET) .build()); return builder; }
Source:
<code>private List<String> getArguments() { List<String> args = executionContext.commandLine().allArguments(); if (systemProperties != null) { <START> args.addAll( <END> systemProperties.stream().map( entry -> "-D" + entry) .collect(Collectors.toList())); } args.add("-Dvertx.id=" + getId()); return args; }</code><technical_language>simpler do systemProperties.stream().map(entry -> "-D" + entry).forEach(args::add)</technical_language>

Target:
private List<String> getArguments() { List<String> args = executionContext.commandLine().allArguments(); if (systemProperties != null) { systemProperties.stream().map(entry -> "-D" + entry).forEach(args::add); } args.add("-Dvertx.id=" + getId()); return args; }
Source:
<code>public Iterable<Class<? extends ITmfTrace>> getValidTraceTypes() { <START> return new ArrayList<>(); <END> }</code><technical_language>good know</technical_language>

Target:
public Iterable<Class<? extends ITmfTrace>> getValidTraceTypes() { return Collections.EMPTY_SET; }
Source:
<code>final Values addValuesSpecificForCacheType(Values generalCacheValues) { return generalCacheValues .andOptional("async-marshalling", asyncMarshalling) .andOptional("mode", mode != null ? mode.getMode() : null) .andOptional("queue-flush-interval", queueFlushInterval) .andOptional("remote-timeout", remoteTimeout) .andOptional("capacity-factor", capacityFactor) .andOptional("consistent-hash-strategy", <START> consistentHashStrategy != null ? consistentHashStrategy.getType() : null) <END> .andOptional("l1-lifespan", l1lifespan) .andOptional("owners", owners) .andOptional("segments", segments); }</code><technical_language>test capacity-factor consistent-hash-strategy WFLY 9+ -- if so, throw exception if set current server is < WFLY 9. silently ignore them, I typically do exception thing</technical_language>

Target:
Values addValuesSpecificForCacheType(Values generalCacheValues) { return generalCacheValues .andOptional("async-marshalling", asyncMarshalling) .andOptional("mode", mode != null ? mode.getMode() : null) .andOptional("queue-flush-interval", queueFlushInterval) .andOptional("remote-timeout", remoteTimeout) .andOptional("capacity-factor", capacityFactor) .andOptional("consistent-hash-strategy", consistentHashStrategy != null ? consistentHashStrategy.getType() : null) .andOptional("l1-lifespan", l1lifespan) .andOptional("owners", owners) .andOptional("segments", segments); }
Source:
<code>synchronized private void removeClearedAndOldTasks() { Set<Guid> poolsOfActiveTasks = new HashSet<Guid>(); Set<Guid> poolsOfClearedAndOldTasks = new HashSet<Guid>(); <START> ConcurrentMap<Guid, SPMTask> activeTaskMap = new ConcurrentHashMap<Guid, SPMTask>(); <END> for (SPMTask task : _tasks.values()) { if (!cachingOver(task)) { activeTaskMap.put(task.getVdsmTaskId(), task); poolsOfActiveTasks.add(task.getStoragePoolID()); } else { poolsOfClearedAndOldTasks.add(task.getStoragePoolID()); } } if (poolsOfClearedAndOldTasks.size() > 0) { setNewMap(activeTaskMap); poolsOfClearedAndOldTasks.removeAll(poolsOfActiveTasks); } for (Guid storagePoolID : poolsOfClearedAndOldTasks) { log.infoFormat("Cleared all tasks of pool {0}.", storagePoolID); } }</code><technical_language>if is changed, prefer diamond operator</technical_language>

Target:
synchronized private void removeClearedAndOldTasks() { Set<Guid> poolsOfActiveTasks = new HashSet<Guid>(); Set<Guid> poolsOfClearedAndOldTasks = new HashSet<Guid>(); ConcurrentMap<Guid, SPMTask> activeTaskMap = new ConcurrentHashMap<>(); for (SPMTask task : _tasks.values()) { if (!cachingOver(task)) { activeTaskMap.put(task.getVdsmTaskId(), task); poolsOfActiveTasks.add(task.getStoragePoolID()); } else { poolsOfClearedAndOldTasks.add(task.getStoragePoolID()); } } if (poolsOfClearedAndOldTasks.size() > 0) { setNewMap(activeTaskMap); poolsOfClearedAndOldTasks.removeAll(poolsOfActiveTasks); } for (Guid storagePoolID : poolsOfClearedAndOldTasks) { log.infoFormat("Cleared all tasks of pool {0}.", storagePoolID); } }
Source:
<code>public OpenShiftWorkspaceFilesCleaner( OpenShiftPvcHelper openShiftPvcHelper, @Named("che.openshift.project") String projectNamespace, @Named("che.openshift.workspaces.pvc.name") String workspacesPvcName) { this.projectNamespace = projectNamespace; this.workspacesPvcName = workspacesPvcName; this.openShiftPvcHelper = openShiftPvcHelper; this.deleteQueue = ConcurrentHashMap.newKeySet(); this.executor = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setNameFormat("OpenShiftWorkspaceFilesCleaner-%d") .setUncaughtExceptionHandler(LoggingUncaughtExceptionHandler.getInstance()) <START> .setDaemon(true) <END> .build()); }</code><technical_language>non-daemon, please</technical_language>

Target:
public OpenShiftWorkspaceFilesCleaner( OpenShiftPvcHelper openShiftPvcHelper, @Named("che.openshift.project") String projectNamespace, @Named("che.openshift.workspaces.pvc.name") String workspacesPvcName) { this.projectNamespace = projectNamespace; this.workspacesPvcName = workspacesPvcName; this.openShiftPvcHelper = openShiftPvcHelper; this.deleteQueue = ConcurrentHashMap.newKeySet(); }
Source:
<code><START> public @Nullable LanguageServer getLanguageClient() { <END> return this.wrapper.getServer(); }</code><technical_language>added a null check below, this null then? LanguageServerInfo created if LanguageServer is null</technical_language>

Target:
public @NonNull LanguageServer getLanguageClient() { return this.server; }
Source:
<code>protected IStatus[] executeFullPublish(IModule[] module, IPath archiveDestination, IModulePathFilter filter, IProgressMonitor monitor) throws CoreException { <START> undeployModuleAndWait(module, archiveDestination, 15000, monitor); <END> return super.executeFullPublish(module, archiveDestination, filter, monitor); }</code><technical_language>proceed if undeployModuleAndWait return false? log failed un-deployment attempt</technical_language>

Target:
protected IStatus[] executeFullPublish(IModule[] module, IPath archiveDestination, IModulePathFilter filter, IProgressMonitor monitor) throws CoreException { boolean undeploySucceeded = undeployModuleAndWait(module, archiveDestination, 45000, monitor); if( !undeploySucceeded ) { ServerLogger.getDefault().log(getServer(), new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, NLS.bind("Safely halting deployment {0} on server {1} before publish has failed.", module[0].getName(), getServer().getName()))); } return super.executeFullPublish(module, archiveDestination, filter, monitor); }
Source:
<code>protected boolean drawState(TimeGraphColorScheme colors, ITimeEvent event, Rectangle rect, GC gc, boolean selected, boolean timeSelected) { int colorIdx = fTimeGraphProvider.getStateTableIndex(event); if (colorIdx < 0 && colorIdx != ITimeGraphPresentationProvider.TRANSPARENT) { return false; } boolean visible = rect.width == 0 ? false : true; <START> Color black = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); <END> gc.setForeground(black); if (visible) { if (colorIdx == ITimeGraphPresentationProvider.TRANSPARENT) { gc.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y); gc.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1); if (rect.width == 1) { gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); gc.drawPoint(rect.x, rect.y - 2); } return false; } Color stateColor = null; if (colorIdx < fEventColorMap.length) { stateColor = fEventColorMap[colorIdx]; } else { stateColor = black; } boolean reallySelected = timeSelected && selected; if (!reallySelected) { gc.setBackground(black); gc.fillRectangle(rect); gc.setBackground(stateColor); gc.fillRectangle(rect.x, rect.y+1, rect.width, rect.height-2); } else { gc.setBackground(stateColor); gc.fillRectangle(rect); } } else { gc.drawPoint(rect.x, rect.y - 2); } fTimeGraphProvider.postDrawEvent(event, rect, gc); return visible; }</code><technical_language>I suggest store black Color a static final constant</technical_language>

Target:
protected boolean drawState(TimeGraphColorScheme colors, ITimeEvent event, Rectangle rect, GC gc, boolean selected, boolean timeSelected) { int colorIdx = fTimeGraphProvider.getStateTableIndex(event); if (colorIdx < 0 && colorIdx != ITimeGraphPresentationProvider.TRANSPARENT) { return false; } boolean visible = rect.width == 0 ? false : true; Color black = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); gc.setForeground(black); if (visible) { if (colorIdx == ITimeGraphPresentationProvider.TRANSPARENT) { gc.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y); gc.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1); if (rect.width == 1) { gc.drawPoint(rect.x, rect.y - 2); } return false; } Color stateColor = null; if (colorIdx < fEventColorMap.length) { stateColor = fEventColorMap[colorIdx]; } else { stateColor = black; } boolean reallySelected = timeSelected && selected; gc.setBackground(stateColor); gc.fillRectangle(rect); if (reallySelected) { gc.drawRectangle(rect.x, rect.y - 1, rect.width -2, rect.height + 1); } } else { gc.drawPoint(rect.x, rect.y - 2); } fTimeGraphProvider.postDrawEvent(event, rect, gc); return visible; }
Source:
<code>private void disconnect() { try { if (outputStream != null) { outputStream.close(); outputStream = null; } } catch (IOException e) { log.debug("Error while disconnecting to " + hostUrl + " : " + e.getMessage(), e); } try { if (clientSocket != null) { clientSocket.close(); clientSocket = null; } } catch (IOException e) { log.debug("Error while closing socket to " + hostUrl + " : " + e.getMessage(), e); } finally { if(connectionCallback != null){ connectionCallback.onCepReceiverDisconnect(); <START> log.info("--------------------------TCPEventPublisher onclose invoked."); END> } } }</code><technical_language>forget delete this</technical_language>

Target:
private void disconnect() { try { if (outputStream != null) { outputStream.close(); outputStream = null; } } catch (IOException e) { log.debug("Error while disconnecting to " + hostUrl + " : " + e.getMessage(), e); } try { if (clientSocket != null) { clientSocket.close(); clientSocket = null; } } catch (IOException e) { log.debug("Error while closing socket to " + hostUrl + " : " + e.getMessage(), e); } finally { if(connectionCallback != null){ connectionCallback.onCepReceiverDisconnect(); } } }
Source:
<code>public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, Iterable<T> subjects ) throws E { E exception = null; for ( T subject : subjects ) { try { consumer.accept( subject ); } catch ( Exception caught ) { <START> E castedException = (E) caught; <END> if ( exception == null ) { exception = castedException; } else { exception.addSuppressed( castedException ); } } } if ( exception != null ) { throw exception; } }</code><technical_language>This replaced org.neo4j.helpers.Exceptions#chain</technical_language>

Target:
public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, Iterable<T> subjects ) throws E { E exception = null; for ( T subject : subjects ) { try { consumer.accept( subject ); } catch ( Exception e ) { exception = Exceptions.chain( exception, (E) e ); } } if ( exception != null ) { throw exception; } }
Source:
<code>private void refreshCoordinateData() throws CloudnameException { if (! zkClient.isConnected()) { throw new CloudnameException("No connection to storage."); } String oldDataSerialized = ""; synchronized (coordinateDataMonitor) { if (null != coordinateData) { <START> oldDataSerialized = coordinateData.serialize(); <END> } coordinateData = ZkCoordinateData.loadCoordinateData( path, zkClient.getZookeeper(), this).snapshot(); isSynchronizedWithZookeeper.set(true); if (! oldDataSerialized.equals(coordinateData.toString())) { client.stateChanged(); } } }</code><technical_language>oldDataSerialized = (null != coordinateData) ? "" : coordinateData.serialize(); final</technical_language>

Target:
private void refreshCoordinateData() throws CloudnameException { if (! zkClient.isConnected()) { throw new CloudnameException("No connection to storage."); } synchronized (coordinateDataMonitor) { String oldDataSerialized = (null == coordinateData) ? "" : coordinateData.serialize(); coordinateData = ZkCoordinateData.loadCoordinateData( path, zkClient.getZookeeper(), this).snapshot(); isSynchronizedWithZookeeper.set(true); if (! oldDataSerialized.equals(coordinateData.toString())) { client.stateChanged(); } } }
Source:
<code>public void onEvent(ClusterEvent event) { try { queue.put(event); } catch (InterruptedException e) { <START> Throwables.propagate(e); <END> } }</code><technical_language>propagate simply Thread.currentThread().interrupt()</technical_language>

Target:
public void onEvent(ClusterEvent event) { try { queue.put(event); } catch (InterruptedException e) { } }
Source:
<code>public SnapshotStatus[] getSnapshotListing(INodesInPath iip) throws IOException { INodeDirectory srcRoot = getSnapshottableRoot(iip); ReadOnlyList<Snapshot> snapshotList = srcRoot.getDirectorySnapshottableFeature(). getSnapshotList(); if (snapshotList.isEmpty()) { return null; } List<SnapshotStatus> statusList = <START> new ArrayList<>(); <END> for (Snapshot s : snapshotList) { Snapshot.Root dir = s.getRoot(); SnapshotStatus status = new SnapshotStatus(dir.getModificationTime() , dir.getAccessTime(), dir.getFsPermission(), EnumSet.noneOf(HdfsFileStatus.Flags.class), dir.getUserName(), dir.getGroupName(), dir.getLocalNameBytes(), dir.getId(), dir.getChildrenNum(Snapshot.CURRENT_STATE_ID), s.getId(), DFSUtil.string2Bytes(dir.getParent().getFullPathName())); statusList.add(status); } return statusList.toArray( new SnapshotStatus[statusList.size()]); }</code><technical_language>size of list equal size of snapshotList?, if size is need of a list converting array, array of size of snapshotList</technical_language>

Target:
public SnapshotStatus[] getSnapshotListing(INodesInPath iip) throws IOException { INodeDirectory srcRoot = getSnapshottableRoot(iip); ReadOnlyList<Snapshot> snapshotList = srcRoot. getDirectorySnapshottableFeature().getSnapshotList(); SnapshotStatus[] statuses = new SnapshotStatus[snapshotList.size()]; for (int count = 0; count < snapshotList.size(); count++) { Snapshot s = snapshotList.get(count); Snapshot.Root dir = s.getRoot(); statuses[count] = new SnapshotStatus(dir.getModificationTime(), dir.getAccessTime(), dir.getFsPermission(), EnumSet.noneOf(HdfsFileStatus.Flags.class), dir.getUserName(), dir.getGroupName(), dir.getLocalNameBytes(), dir.getId(), dir.getChildrenNum(Snapshot.CURRENT_STATE_ID), s.getId(), DFSUtil.string2Bytes(dir.getParent().getFullPathName())); } return statuses; }
Source:
<code>public Optional<IgniteableData> build(DataView container) throws InvalidDataException { IgniteableData igniteableData = create(); igniteableData.set(Keys.FIRE_DAMAGE_DELAY, getData(container, Keys.FIRE_DAMAGE_DELAY)); <START> igniteableData.set(Keys.FIRE_TICKS, getData(container, Keys.FIRE_TICKS)); <END> return Optional.of(igniteableData); }</code><technical_language>assign delay ticks int vars in SpongeIgniteableData constructor</technical_language>

Target:
public Optional<IgniteableData> build(DataView container) throws InvalidDataException { int delay = getData(container, Keys.FIRE_DAMAGE_DELAY); int ticks = getData(container, Keys.FIRE_TICKS); IgniteableData igniteableData = new SpongeIgniteableData(ticks, delay); return Optional.of(igniteableData); }
Source:
<code>private void verifyActiveCourseStatistics(InstructorCoursesPage coursesPage, CourseAttributes course) { int numSections = 0; int numTeams = 0; int numStudents = 0; int numUnregistered = 0; Set<String> sections = new HashSet<>(); Set<String> teams = new HashSet<>(); for (StudentAttributes student : testData.students.values()) { <START> if (student.course.equals(course.getId())) { <END> if (!sections.contains(student.section)) { sections.add(student.section); numSections++; } if (!teams.contains(student.team)) { teams.add(student.team); numTeams++; } if (student.googleId.isEmpty()) { numUnregistered++; } numStudents++; } } coursesPage.verifyActiveCourseStatistics(course, Integer.toString(numSections), Integer.toString(numTeams), Integer.toString(numStudents), Integer.toString(numUnregistered)); }</code><technical_language>if want, do: if (!student.course.equals(course.getId())) { continue; } un-indent statements below</technical_language>

Target:
private void verifyActiveCourseStatistics(InstructorCoursesPage coursesPage, CourseAttributes course) { int numSections = 0; int numTeams = 0; int numStudents = 0; int numUnregistered = 0; Set<String> sections = new HashSet<>(); Set<String> teams = new HashSet<>(); for (StudentAttributes student : testData.students.values()) { if (!student.course.equals(course.getId())) { continue; } if (!sections.contains(student.section)) { sections.add(student.section); numSections++; } if (!teams.contains(student.team)) { teams.add(student.team); numTeams++; } if (student.googleId.isEmpty()) { numUnregistered++; } numStudents++; } coursesPage.verifyActiveCourseStatistics(course, Integer.toString(numSections), Integer.toString(numTeams), Integer.toString(numStudents), Integer.toString(numUnregistered)); }
Source:
<code>public MessageSelector getSelector() { return selector; <START> } <END></code><technical_language>is a public goal of this getter? prefer do expose avoid undesired mutation. I understand point for expression comparison, for encapsulte equals logic Recipient class. I hurt extra GC removeRecipient(String channelName, String selector). other side check type of MessageSelector get access expressionString</technical_language>

Target:
private MessageSelector getSelector() { return selector; }
Source:
<code>public void addToVersionPreviouslyDownloaded(Version downloadedVersion) { <START> if (listOfVersionsPreviouslyDownloaded == null) { <END> listOfVersionsPreviouslyDownloaded = new ArrayList<>(); } listOfVersionsPreviouslyDownloaded.add(downloadedVersion); }</code><technical_language>DRY, initialise this in constructor</technical_language>

Target:
public void addToVersionPreviouslyDownloaded(Version downloadedVersion) { versionsPreviouslyDownloaded.add(downloadedVersion); }
Source:
<code>public CodeActionCompletionProposal(Either<Command, CodeAction> command, LSPDocumentInfo info) { this.finfo = info; if (command.isLeft()) { fcommand = command.getLeft(); fdisplayString = fcommand.getTitle(); <START> this.fcompletionProposal = new CompletionProposal(fdisplayString, 0, 0, 0); <END> } else if (command.isRight()) { fcodeAction = command.getRight(); fdisplayString = fcodeAction.getTitle(); this.fcompletionProposal = new CompletionProposal(fdisplayString, 0, 0, 0); } }</code><technical_language>storing a completion proposal if display string is useful</technical_language>

Target:
public CodeActionCompletionProposal(Either<Command, CodeAction> command, LSPDocumentInfo info) { this.finfo = info; if (command.isLeft()) { fcommand = command.getLeft(); fdisplayString = fcommand.getTitle(); } else if (command.isRight()) { fcodeAction = command.getRight(); fdisplayString = fcodeAction.getTitle(); } }
Source:
<code>public void initScene() { mMainQuadMaterial = new Material(); mMainQuadMaterial.setColorInfluence(0); mMiniQuadMaterial = new Material(); mMiniQuadMaterial.setColorInfluence(0); mMainQuad = new WorkaroundScreenQuad(); mMainQuad.setMaterial(mMainQuadMaterial); mMainQuad.setTransparent(true); setupMiniTouchLimits(); mMiniQuad = new WorkaroundScreenQuad(); mMiniQuad.setScale(pipScale); <START> mMiniQuad.setX(.5 - pipScale / 2 - pipMarginX / (2 * mDefaultViewportWidth)); <END> mMiniQuad.setY(.5 - pipScale / 2 - pipMarginY / (2 * mDefaultViewportHeight)); mMiniQuad.setMaterial(mMiniQuadMaterial); mMainRenderTarget = new RenderTarget("pipMainRT", mDefaultViewportWidth, mDefaultViewportHeight); mMainRenderTarget.setFullscreen(false); mMiniRenderTarget = new RenderTarget("pipMiniRT", mDefaultViewportWidth, mDefaultViewportHeight); mMiniRenderTarget.setFullscreen(false); addRenderTarget(mMainRenderTarget); addRenderTarget(mMiniRenderTarget); mCompositeScene = getCurrentScene(); mCompositeScene.addChild(mMainQuad); mCompositeScene.addChild(mMiniQuad); try { mMiniQuadMaterial.addTexture(mMiniRenderTarget.getTexture()); mMainQuadMaterial.addTexture(mMainRenderTarget.getTexture()); } catch (ATexture.TextureException e) { e.printStackTrace(); } mMainRenderer.initScene(); mMiniRenderer.initScene(); }</code><technical_language>I prefer mixing floats/doubles/integers logic issues confuse intent. please update .5 .5d 2 instances 2d of this needs float</technical_language>

Target:
public void initScene() { mMainQuadMaterial = new Material(); mMainQuadMaterial.setColorInfluence(0); mMiniQuadMaterial = new Material(); mMiniQuadMaterial.setColorInfluence(0); mMainQuad = new WorkaroundScreenQuad(); mMainQuad.setMaterial(mMainQuadMaterial); mMainQuad.setTransparent(true); setupMiniTouchLimits(); mMiniQuad = new WorkaroundScreenQuad(); mMiniQuad.setScale(mPipScale); mMiniQuad.setX(.5d - mPipScale / 2d - mPipMarginX / mDefaultViewportWidth); mMiniQuad.setY(.5d - mPipScale / 2d - mPipMarginY / mDefaultViewportHeight); mMiniQuad.setMaterial(mMiniQuadMaterial); mMainRenderTarget = new RenderTarget("pipMainRT", mDefaultViewportWidth, mDefaultViewportHeight); mMainRenderTarget.setFullscreen(false); mMiniRenderTarget = new RenderTarget("pipMiniRT", mDefaultViewportWidth, mDefaultViewportHeight); mMiniRenderTarget.setFullscreen(false); addRenderTarget(mMainRenderTarget); addRenderTarget(mMiniRenderTarget); mCompositeScene = getCurrentScene(); mCompositeScene.addChild(mMainQuad); mCompositeScene.addChild(mMiniQuad); try { mMiniQuadMaterial.addTexture(mMiniRenderTarget.getTexture()); mMainQuadMaterial.addTexture(mMainRenderTarget.getTexture()); } catch (ATexture.TextureException e) { e.printStackTrace(); } mMainRenderer.initScene(); mMiniRenderer.initScene(); }
Source:
<code>public TaskRepository repository() { if (repository != null) { return repository; } repository = new TaskRepository(getConnectorKind(), getRepositoryUrl()); UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER); if (Boolean.parseBoolean(getProperty("api_key_enabled"))) { repository.setProperty(IBugzillaRestConstants.REPOSITORY_USE_API_KEY, Boolean.toString(true)); <START> switch (credentials.getUserName()) { <END> case "admin@mylyn.eclipse.org": repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "XkjcuGGfDcoNx0U6uyMM8ZaNuBlEdjrmXd8In3no"); break; case "tests@mylyn.eclipse.org": repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "wvkz2SoBMBQEKv6ishp1j7NY1R9l711g5w2afXc6"); break; default: repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "No Defined Key"); break; } repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), ""), false); } else { repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), credentials.getPassword()), true); } return repository; }</code><technical_language>this simpler if a map of usernames API keys. get key for username, set if present</technical_language>

Target:
public TaskRepository repository() { if (repository != null) { return repository; } repository = new TaskRepository(getConnectorKind(), getRepositoryUrl()); UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER); if (Boolean.parseBoolean(getProperty("api_key_enabled"))) { repository.setProperty(IBugzillaRestConstants.REPOSITORY_USE_API_KEY, Boolean.toString(true)); repository.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, userAPIKeyMap.getOrDefault(credentials.getUserName(), "")); repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), ""), false); } else { repository.setCredentials(org.eclipse.mylyn.commons.net.AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.getUserName(), credentials.getPassword()), true); } return repository; }
Source:
<code>public int hashCode() { return (_success ? 1 : 0); <START> } <END></code><technical_language>Please implement toString() provide debugging state information for debugging purposes</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (_success ? 1 : 0); return result; }
Source:
<code>public void CompleteUnknownPacketTest() throws IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); <START> PcapFile dummy = trace.getTrace(); <END> ByteBuffer byteBuffer = fPacket; if (byteBuffer == null) { fail("CompleteUnknownPacketTest has failed!"); return; } UnknownPacket packet = new UnknownPacket(dummy, null, byteBuffer); assertEquals(PcapProtocol.UNKNOWN, packet.getProtocol()); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.UDP)); assertTrue(packet.validate()); assertEquals(1089, packet.hashCode()); assertFalse(packet.equals(null)); assertEquals(new UnknownPacket(dummy, null, byteBuffer), packet); assertEquals(EXPECTED_FIELDS, packet.getFields()); assertEquals(fToString, packet.toString()); assertEquals("Len: 1 bytes", packet.getLocalSummaryString()); assertEquals("Data: 1 bytes", packet.getGlobalSummaryString()); assertFalse(packet.getSourceEndpoint().equals(new UnknownEndpoint(packet, true))); assertFalse(packet.getDestinationEndpoint().equals(new UnknownEndpoint(packet, false))); fPacket.position(0); byte[] payload = new byte[1]; fPacket.get(payload); ByteBuffer payloadBB = ByteBuffer.wrap(payload); payloadBB.flip(); assertEquals(payloadBB, packet.getPayload()); }</code><technical_language>I try</technical_language>

Target:
public void CompleteUnknownPacketTest() throws IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); try (PcapFile dummy = trace.getTrace();) { ByteBuffer byteBuffer = fPacket; if (byteBuffer == null) { fail("CompleteUnknownPacketTest has failed!"); return; } UnknownPacket packet = new UnknownPacket(dummy, null, byteBuffer); assertEquals(PcapProtocol.UNKNOWN, packet.getProtocol()); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.UDP)); assertTrue(packet.validate()); assertEquals(1089, packet.hashCode()); assertFalse(packet.equals(null)); assertEquals(new UnknownPacket(dummy, null, byteBuffer), packet); assertEquals(EXPECTED_FIELDS, packet.getFields()); assertEquals(fToString, packet.toString()); assertEquals("Len: 1 bytes", packet.getLocalSummaryString()); assertEquals("Data: 1 bytes", packet.getGlobalSummaryString()); assertFalse(packet.getSourceEndpoint().equals(new UnknownEndpoint(packet, true))); assertFalse(packet.getDestinationEndpoint().equals(new UnknownEndpoint(packet, false))); fPacket.position(0); byte[] payload = new byte[1]; fPacket.get(payload); ByteBuffer payloadBB = ByteBuffer.wrap(payload); payloadBB.flip(); assertEquals(payloadBB, packet.getPayload()); } }
Source:
<code>protected void writeScalarProperty(Property entity, CSVPrinter printer) throws IOException { Object value = entity.getValue(); Type type = entity.getType(); if (type instanceof BinaryType) { writeUnsupported(type, printer); } else { String valueAsString = null; if (value == null) { printer.print(null); } else { valueAsString = type.encode(value); printer.print(valueAsString); } <START> Directory vocabulary = getVocabulary(type); <END> if (vocabulary != null) { writeScalarVocabularyProperty(valueAsString, vocabulary, printer); } } }</code><technical_language>static import of getVocabulary is a bit surprising reader. Reading I expected a local method. Try static imports for well-known static methods constants semantic is clear</technical_language>

Target:
protected void writeScalarProperty(Property entity, CSVPrinter printer) throws IOException { Object value = entity.getValue(); Type type = entity.getType(); if (type instanceof BinaryType) { writeUnsupported(type, printer); } else { String valueAsString = null; if (value == null) { printer.print(null); } else { valueAsString = type.encode(value); printer.print(valueAsString); } Directory vocabulary = DocumentModelCSVHelper.getVocabulary(type); if (vocabulary != null) { writeScalarVocabularyProperty(valueAsString, vocabulary, printer); } } }
Source:
<code><START> public com.twitter.heron.api.Config getHeronConfig() { <END> return heronConfig; }</code><technical_language>Is this change necessary</technical_language>

Target:
com.twitter.heron.api.Config getHeronConfig() { return heronConfig; }
Source:
<code>public int hashCode() { <START> int hash = 7; <END> hash = 17 * hash + (this.id != null ? this.id.hashCode() : 0); return hash; }</code><technical_language>please HCB simplify this include proxy of hash id</technical_language>

Target:
public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(7, 17) .append(this.id); return builder.toHashCode(); }
Source:
<code>public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); try { ProfileResponse profileResponse = getAvailableProfiles(); setDefaultProfile(getBankId(profileResponse.getBanks())); HttpResponse httpResponse = urlopen.openAsHttpResponse(getResourceUri("engagement/overview"), false); if(httpResponse.getStatusLine().getStatusCode() != 200) { throw new BankException(httpResponse.getStatusLine().toString()); } OverviewResponse overviewResponse = readJsonValue(httpResponse.getEntity().getContent(),OverviewResponse.class); addAccounts(overviewResponse.getTransactionAccounts(),Account.REGULAR); addAccounts(overviewResponse.getSavingAccounts(),Account.REGULAR); addAccounts(overviewResponse.getTransactionDisposalAccounts(),Account.REGULAR); addAccounts(overviewResponse.getSavingDisposalAccounts(),Account.REGULAR); addCardAccounts(overviewResponse.getCardAccounts()); addAccounts(overviewResponse.getLoanAccounts(),Account.LOANS); if (this.accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } <START> } finally { <END> updateComplete(); } }</code><technical_language>remove finally {</technical_language>

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); ProfileResponse profileResponse = getAvailableProfiles(); setDefaultProfile(getBankId(profileResponse.getBanks())); HttpResponse httpResponse = urlopen.openAsHttpResponse(getResourceUri("engagement/overview"), false); if(httpResponse.getStatusLine().getStatusCode() != 200) { throw new BankException(httpResponse.getStatusLine().toString()); } OverviewResponse overviewResponse = readJsonValue(httpResponse.getEntity().getContent(),OverviewResponse.class); addAccounts(overviewResponse.getTransactionAccounts(),Account.REGULAR); addAccounts(overviewResponse.getSavingAccounts(),Account.REGULAR); addAccounts(overviewResponse.getTransactionDisposalAccounts(),Account.REGULAR); addAccounts(overviewResponse.getSavingDisposalAccounts(),Account.REGULAR); addCardAccounts(overviewResponse.getCardAccounts()); addAccounts(overviewResponse.getLoanAccounts(),Account.LOANS); if (this.accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } updateComplete(); }
Source:
<code>private JButton getBtnOK() { if (btnOK == null) { btnOK = new JButton(); btnOK.setName("btnOK"); btnOK.setText(Constant.messages.getString("all.button.ok")); btnOK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { validateParam(); saveParam(); exitResult = JOptionPane.OK_OPTION; AbstractParamDialog.this.setVisible(false); } catch (Exception ex) { <START> Constant.messages.getString("options.dialog.save.error", ex.getMessage()); <END> } } }); } return btnOK; }</code><technical_language>message is longer shown</technical_language>

Target:
private JButton getBtnOK() { if (btnOK == null) { btnOK = new JButton(); btnOK.setName("btnOK"); btnOK.setText(Constant.messages.getString("all.button.ok")); btnOK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { validateParam(); saveParam(); exitResult = JOptionPane.OK_OPTION; AbstractParamDialog.this.setVisible(false); } catch (Exception ex) { View.getSingleton().showWarningDialog( Constant.messages.getString("options.dialog.save.error", ex.getMessage())); } } }); } return btnOK; }
Source:
<code>public static HttpCompilationResponse readDefaultCompilationResponseFromBytes(byte[] bytes) { ObjectInput in = null; ByteArrayOutputStream bos = null; try { in = new ObjectInputStream(new ByteArrayInputStream(bytes)); Object newObj = in.readObject(); return (HttpCompilationResponse) newObj; } catch (NotSerializableException nse) { <START> logger.debug("Object is not serializable {}", nse.getMessage()); <END> StringBuilder sb = new StringBuilder("NotSerializableException:").append(nse.getMessage()); logger.error(sb.toString()); } catch (IOException ioe) { StringBuilder sb = new StringBuilder("IOException:").append(ioe.getMessage()); logger.error(sb.toString()); } catch (ClassNotFoundException cnfe) { StringBuilder sb = new StringBuilder("ClassNotFoundException:").append(cnfe.getMessage()); logger.error(sb.toString()); } catch (Exception e) { StringBuilder sb = new StringBuilder("Exception:").append(e.getMessage()); logger.error(sb.toString()); } finally { try { if (bos != null) { bos.close(); } if (in != null) { in.close(); } } catch (IOException ex) { logger.error(ex.getMessage()); } } return new DefaultHttpCompilationResponse(Boolean.FALSE); }</code><technical_language>here, is intentionally hided production server log</technical_language>

Target:
public static HttpCompilationResponse readDefaultCompilationResponseFromBytes(byte[] bytes) { ObjectInput in = null; ByteArrayOutputStream bos = null; try { in = new ObjectInputStream(new ByteArrayInputStream(bytes)); Object newObj = in.readObject(); return (HttpCompilationResponse) newObj; } catch (NotSerializableException nse) { logger.warn("Object is not serializable {}", nse.getMessage()); StringBuilder sb = new StringBuilder("NotSerializableException:").append(nse.getMessage()); logger.error(sb.toString()); } catch (IOException ioe) { StringBuilder sb = new StringBuilder("IOException:").append(ioe.getMessage()); logger.error(sb.toString()); } catch (ClassNotFoundException cnfe) { StringBuilder sb = new StringBuilder("ClassNotFoundException:").append(cnfe.getMessage()); logger.error(sb.toString()); } catch (Exception e) { StringBuilder sb = new StringBuilder("Exception:").append(e.getMessage()); logger.error(sb.toString()); } finally { try { if (bos != null) { bos.close(); } if (in != null) { in.close(); } } catch (IOException ex) { logger.error(ex.getMessage()); } } return new DefaultHttpCompilationResponse(Boolean.FALSE); }
Source:
<code>private static Integer tryParseInt( String s ) { try { if ( !isParsable( s ) ) { return null; } <START> long longValue = Long.parseLong( s ); <END> if ( longValue > Integer.MAX_VALUE ) { return null; } return (int) longValue; } catch ( NumberFormatException e ) { return null; } }</code><technical_language>Again, change in semantics long. Dislike this one. hassle, NumberUtils Commons Lang 3</technical_language>

Target:
private static Integer tryParseInt( String s ) { try { if ( !isDigits( s ) ) { return null; } long longValue = Long.parseLong( s ); if ( longValue > Integer.MAX_VALUE ) { return null; } return (int) longValue; } catch ( NumberFormatException e ) { return null; } }