auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public <T extends Entity> EntitySpec<T> resolveSpec(Set<String> encounteredCatalogTypes) { if (alreadyBuilt.getAndSet(true)) throw new IllegalStateException("Spec can only be used once: "+this); EntitySpec<?> spec = serviceSpecResolver.resolve(type, loader, encounteredCatalogTypes); if (spec == null) { final String msgDetails; CatalogItem<?, ?> item = CatalogUtils.getCatalogItemOptionalVersion(mgmt, Strings.removeFromStart(type, "catalog:")); String proto = Urls.getProtocol(type); if (item != null && encounteredCatalogTypes.contains(item.getSymbolicName())) { msgDetails = "Cycle between catalog items detected, starting from " + type + ". Other catalog items being resolved up the stack are " + encounteredCatalogTypes + ". Tried loading it as a Java class instead but failed."; } else if (proto != null) { msgDetails = "The reference " + type + " looks like a URL (running the CAMP Brooklyn assembly-template instantiator) but the protocol " + proto + " isn't white listed (" + BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST + "). " + <START> "Not a catalog item or java type as well."; <END> } else { msgDetails = "No resolver knew how to handle it. Using resolvers: " + serviceSpecResolver; } throw new IllegalStateException("Unable to create spec for type " + type + ". " + msgDetails); } populateSpec(spec, encounteredCatalogTypes); @SuppressWarnings("unchecked") EntitySpec<T> typedSpec = (EntitySpec<T>) spec; return typedSpec; }</code><technical_language>phrase this "It's a catalog item a java type"</technical_language>

Target:
public <T extends Entity> EntitySpec<T> resolveSpec(Set<String> encounteredCatalogTypes) { if (alreadyBuilt.getAndSet(true)) throw new IllegalStateException("Spec can only be used once: "+this); EntitySpec<?> spec = serviceSpecResolver.resolve(type, loader, encounteredCatalogTypes); if (spec == null) { final String msgDetails; CatalogItem<?, ?> item = CatalogUtils.getCatalogItemOptionalVersion(mgmt, Strings.removeFromStart(type, "catalog:")); String proto = Urls.getProtocol(type); if (item != null && encounteredCatalogTypes.contains(item.getSymbolicName())) { msgDetails = "Cycle between catalog items detected, starting from " + type + ". Other catalog items being resolved up the stack are " + encounteredCatalogTypes + ". Tried loading it as a Java class instead but failed."; } else if (proto != null) { msgDetails = "The reference " + type + " looks like a URL (running the CAMP Brooklyn assembly-template instantiator) but the protocol " + proto + " isn't white listed (" + BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST + "). " + "It's also neither a catalog item nor a java type."; } else { msgDetails = "No resolver knew how to handle it. Using resolvers: " + serviceSpecResolver; } throw new IllegalStateException("Unable to create spec for type " + type + ". " + msgDetails); } populateSpec(spec, encounteredCatalogTypes); @SuppressWarnings("unchecked") EntitySpec<T> typedSpec = (EntitySpec<T>) spec; return typedSpec; }
Source:
<code>public List<BytecodeNode> getChildNodes() { <START> return null; <END> }</code><technical_language>decide this class a leaf ByteCode Node? (Alternative this returns ImmutableList.of(block, position)</technical_language>

Target:
public List<BytecodeNode> getChildNodes() { return ImmutableList.of(); }
Source:
<code>private boolean checkCreateInstancePermission(PermissionSubject permSubject) { <START> final Set<VdcObjectType> overriddenPermissionObjectTypes = new HashSet<VdcObjectType>() {{ <END> add(VdcObjectType.VdsGroups); add(VdcObjectType.VmTemplate); }}; final boolean isInstanceCreateObjectType = overriddenPermissionObjectTypes.contains(permSubject.getObjectType()); if (!isInstanceCreateObjectType) { return false; } final PermissionSubject alteredPermissionSubject = new PermissionSubject(permSubject.getObjectId(), permSubject.getObjectType(), ActionGroup.CREATE_INSTANCE, permSubject.getMessage()); return checkSinglePermission(alteredPermissionSubject, getReturnValue().getCanDoActionMessages()); }</code><technical_language>is internal data-structure.. put duplicate items here.. reducing amount of code Arrays.asList instead</technical_language>

Target:
private boolean checkCreateInstancePermission(PermissionSubject permSubject) { final List<VdcObjectType> overriddenPermissionObjectTypes = Arrays.asList( VdcObjectType.VdsGroups, VdcObjectType.VmTemplate); final boolean instanceCreateObjectType = overriddenPermissionObjectTypes.contains(permSubject.getObjectType()); if (!instanceCreateObjectType) { return false; } final PermissionSubject alteredPermissionSubject = new PermissionSubject(permSubject.getObjectId(), permSubject.getObjectType(), ActionGroup.CREATE_INSTANCE, permSubject.getMessage()); return checkSinglePermission(alteredPermissionSubject, getReturnValue().getCanDoActionMessages()); }
Source:
<code><START> public static boolean isInteger( char[] digitChars, int offset, int len ) { <END> String cmpStr = ( digitChars[offset] == '-' ) ? MIN_INT_STR_NO_SIGN : MAX_INT_STR; int cmpLen = cmpStr.length(); if ( len < cmpLen ) return true; if ( len > cmpLen ) return false; for ( int i = 0; i < cmpLen; ++i ) { int diff = digitChars[offset + i] - cmpStr.charAt( i ); if ( diff != 0 ) { return ( diff < 0 ); } } return true; }</code><technical_language>a problem if this isInteger calls isInteger(char[],int,int,boolean) simply this: return isInteger(digitChars,offset,len,digitChars[offset] == '-')</technical_language>

Target:
public static boolean isInteger( char[] digitChars, int offset, int len ) { return isInteger(digitChars,offset,len,digitChars[offset] == '-'); }
Source:
<code>public Map<String, Object> parseToMap(final String input) { if (!supportSkipHeaderRows && (hasHeaderRow || maxSkipHeaderRows > 0)) { throw new UnsupportedOperationException("hasHeaderRow or maxSkipHeaderRows is not supported. " + "Please check the indexTask supports these options."); } try { List<String> values = parseLine(input); if (skippedHeaderRows < maxSkipHeaderRows) { skippedHeaderRows++; return null; } if (hasHeaderRow && !hasParsedHeader) { if (fieldNames == null) { setFieldNames(values); } hasParsedHeader = true; return null; } if (fieldNames == null) { setFieldNames(ParserUtils.generateFieldNames(values.size())); } <START> Map<String, String> fieldValueMap = Utils.zipMapPartial(fieldNames, values); <END> return Maps.transformEntries(fieldValueMap, multiValueTransformer); } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }</code><technical_language>I suggest populate a HashMap in a simple loop, multiValueTransformer functional object, functionality in a method in AbstractFlatTextFormatParser class</technical_language>

Target:
public Map<String, Object> parseToMap(final String input) { if (!supportSkipHeaderRows && (hasHeaderRow || maxSkipHeaderRows > 0)) { throw new UnsupportedOperationException("hasHeaderRow or maxSkipHeaderRows is not supported. " + "Please check the indexTask supports these options."); } try { List<String> values = parseLine(input); if (skippedHeaderRows < maxSkipHeaderRows) { skippedHeaderRows++; return null; } if (hasHeaderRow && !hasParsedHeader) { if (fieldNames == null) { setFieldNames(values); } hasParsedHeader = true; return null; } if (fieldNames == null) { setFieldNames(ParserUtils.generateFieldNames(values.size())); } return computeKeyValues(fieldNames, values); } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }
Source:
<code>protected void auditClass(Audit.Action action, ChangeSpec changeSpec) { Audit[] annotations = getResourceClass().getAnnotationsByType(Audit.class); if (annotations == null) { return; } for (Audit annotation : annotations) { for (Audit.Action auditAction : annotation.action()) { if (auditAction == action) { <START> LogMessageImpl message = new LogMessageImpl(annotation, this, Optional.ofNullable(changeSpec)); <END> getRequestScope().getAuditLogger().log(message); } } } }</code><technical_language>suggestion LogMessage message = new LogMessageImpl(annotation, this, Optional.ofNullable(changeSpec));</technical_language>

Target:
protected void auditClass(Audit.Action action, ChangeSpec changeSpec) { Audit[] annotations = getResourceClass().getAnnotationsByType(Audit.class); if (annotations == null) { return; } for (Audit annotation : annotations) { for (Audit.Action auditAction : annotation.action()) { if (auditAction == action) { LogMessage message = new LogMessageImpl(annotation, this, Optional.ofNullable(changeSpec)); getRequestScope().getAuditLogger().log(message); } } } }
Source:
<code>public static void main(String[] args) { PrintStream stderr = System.err; String suiteClassName = System.getProperty(TEST_SUITE_PROPERTY_NAME); if (args.length >= 1 && args[args.length - 1].equals("--persistent_test_runner")) { System.err.println("Requested test strategy is currently unsupported."); System.exit(1); } if (!checkTestSuiteProperty(suiteClassName)) { System.exit(2); } int exitCode; try { exitCode = runTestsInSuite(suiteClassName, args); } catch (Throwable e) { <START> e.printStackTrace(System.err); <END> exitCode = 1; } System.err.printf("%nBazelTestRunner exiting with a return value of %d%n", exitCode); System.err.println("JVM shutdown hooks (if any) will run now."); System.err.println("The JVM will exit once they complete."); System.err.println(); printStackTracesIfJvmExitHangs(stderr); DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date shutdownTime = new Date(); String formattedShutdownTime = format.format(shutdownTime); System.err.printf("-- JVM shutdown starting at %s --%n%n", formattedShutdownTime); System.exit(exitCode); }</code><technical_language>omit System.err here, printStackTrace() parameters is same. (Also in other file)</technical_language>

Target:
public static void main(String[] args) { PrintStream stderr = System.err; String suiteClassName = System.getProperty(TEST_SUITE_PROPERTY_NAME); if (args.length >= 1 && args[args.length - 1].equals("--persistent_test_runner")) { System.err.println("Requested test strategy is currently unsupported."); System.exit(1); } if (!checkTestSuiteProperty(suiteClassName)) { System.exit(2); } int exitCode; try { exitCode = runTestsInSuite(suiteClassName, args); } catch (Throwable e) { e.printStackTrace(); exitCode = 1; } System.err.printf("%nBazelTestRunner exiting with a return value of %d%n", exitCode); System.err.println("JVM shutdown hooks (if any) will run now."); System.err.println("The JVM will exit once they complete."); System.err.println(); printStackTracesIfJvmExitHangs(stderr); DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date shutdownTime = new Date(); String formattedShutdownTime = format.format(shutdownTime); System.err.printf("-- JVM shutdown starting at %s --%n%n", formattedShutdownTime); System.exit(exitCode); }
Source:
<code>protected IType getType(IBinding binding) { if (!isAnonymousBinding(binding)) { if (binding instanceof IVariable) { return ((IVariable) binding).getType(); } else { <START> return null; <END> } } return null; }</code><technical_language>Redundant 'else' clause</technical_language>

Target:
protected IType getType(IBinding binding) { if (!isAnonymousBinding(binding) && binding instanceof IVariable) return ((IVariable) binding).getType(); return null; }
Source:
<code>public static String createFrame(ProtocolRead c) { String frame = null; String address[] = null; String who = null; String what = null; String where = null; who = c.getProperty("who"); what = c.getProperty("what"); address = c.getProperty("address").split("\\*"); where = address[0]; <START> if (who.equalsIgnoreCase("4")) { <END> if (what.substring(0, 2).equalsIgnoreCase("14")) { frame = "*#" + who + "*#" + where + "*#" + what + "##"; } else { switch (Integer.parseInt(what)) { case 40: frame = "*" + who + "*" + what + "*" + where + "##"; break; case 110: frame = "*#" + who + "*#" + where + "*#14*0200*3##"; break; default: frame = "*" + who + "*" + what + "*#" + where + "##"; break; } } } else { frame = "*" + who + "*" + what + "*" + where + "##"; } return (frame); }</code><technical_language>point in equalsIgnoreCase() here</technical_language>

Target:
public static String createFrame(ProtocolRead c) { String frame = null; String address[] = null; String who = null; String what = null; String where = null; who = c.getProperty("who"); what = c.getProperty("what"); address = c.getProperty("address").split("\\*"); where = address[0]; if (who.equals("4")) { if (what.substring(0, 2).equals("14")) { frame = "*#" + who + "*#" + where + "*#" + what + "##"; } else { switch (Integer.parseInt(what)) { case 40: frame = "*" + who + "*" + what + "*" + where + "##"; break; case 110: frame = "*#" + who + "*#" + where + "*#14*0200*3##"; break; default: frame = "*" + who + "*" + what + "*#" + where + "##"; break; } } } else { frame = "*" + who + "*" + what + "*" + where + "##"; } return (frame); }
Source:
<code>public Blob getBlobFromJSON(ObjectNode jsonObject) { if (!(jsonObject.has("providerId") && jsonObject.has("key"))) { return null; } String providerId = jsonObject.get("providerId").textValue(); BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(providerId); if (blobProvider == null) { return null; } NuxeoPrincipal principal = ClientLoginModule.getCurrentPrincipal(); if (principal == null) { throw new NuxeoException("The current user does not have the rights to fetch the blob", HttpServletResponse.SC_UNAUTHORIZED); } String authorizedUser = blobProvider.getProperties().get(NUXEO_USER_PROPERTY); if (principal.isAdministrator() <START> || (!principal.isAdministrator() && principal.getName().equals(authorizedUser))) { <END> try { String key = providerId + ":" + jsonObject.get("key").textValue(); BlobInfo blobInfo = new BlobInfo(); blobInfo.key = key; return blobProvider.readBlob(blobInfo); } catch (IOException e) { throw new NuxeoException(e); } } else { throw new NuxeoException("The current user does not have the rights to fetch the blob", HttpServletResponse.SC_UNAUTHORIZED); } }</code><technical_language>!principal.isAdministrator() && part is redundant. extract user check logic in a separate method returns a boolean, do: if (!hasCreateFromKeyPermission(blobProvider)) { throw new NuxeoException(...); } ... rest of actual logic hasCreateFromKeyPermission check cases, principal == null, administrator, user groups</technical_language>

Target:
public Blob getBlobFromJSON(ObjectNode jsonObject) { if (!(jsonObject.has("providerId") && jsonObject.has("key"))) { return null; } String providerId = jsonObject.get("providerId").textValue(); BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(providerId); if (blobProvider == null) { return null; } if (!blobProvider.hasCreateFromKeyPermission()) { throw new NuxeoException("The current user does not have the rights to fetch the blob", HttpServletResponse.SC_UNAUTHORIZED); } try { BlobInfo blobInfo = new BlobInfo(); blobInfo.key = providerId + ":" + jsonObject.get("key").textValue(); return blobProvider.readBlob(blobInfo); } catch (IOException e) { throw new NuxeoException(e); } }
Source:
<code>public void startServer() throws DataBridgeException, StreamDefinitionStoreException { try { msgCount.set(0); start(listeningPort); <START> } catch (Throwable t) { <END> t.printStackTrace(); } }</code><technical_language>@grainier I I miscommunicated discussed this fix offline. put a try..catch..Throwable thread is run startServer() method is called. need catch here</technical_language>

Target:
public void startServer() throws DataBridgeException, StreamDefinitionStoreException { msgCount.set(0); start(listeningPort); }
Source:
<code>protected void executeCommand() { GlusterVolumeEntity volume = getGlusterVolume(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.CommitRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(getUpServer().getId(), volume.getName(), getParameters().getBricks())); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_COMMIT_FAILED, returnValue.getVdsError() .getMessage()); return; } endStepJobCommitted(); getDbUtils().removeBricksFromVolumeInDb(volume, getParameters().getBricks(), getParameters().getReplicaCount()); releaseVolumeLock(); <START> getGlusterVolumeDao().updateVolumeTask(volume.getId(), null); <END> getReturnValue().setActionReturnValue(returnValue.getReturnValue()); }</code><technical_language>Again, release lock volume is updated</technical_language>

Target:
protected void executeCommand() { GlusterVolumeEntity volume = getGlusterVolume(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.CommitRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(getUpServer().getId(), volume.getName(), getParameters().getBricks())); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_COMMIT_FAILED, returnValue.getVdsError() .getMessage()); return; } endStepJobCommitted(); getDbUtils().removeBricksFromVolumeInDb(volume, getParameters().getBricks(), getParameters().getReplicaCount()); getGlusterVolumeDao().updateVolumeTask(volume.getId(), null); releaseVolumeLock(); getReturnValue().setActionReturnValue(returnValue.getReturnValue()); }
Source:
<code>public void testSendInvoice() throws StripeException { InvoiceItem invItem = InvoiceItem.create(getInvoiceItemParams()); Map<String,Object> params = new HashMap<String,Object>(); Long dueDate = (System.currentTimeMillis() / 1000) + 600; params.put("customer", invItem.getCustomer()); params.put("billing", "send_invoice"); params.put("due_date", dueDate); Invoice invoice = Invoice.create(params); assertEquals(invoice.getBilling(), "send_invoice"); assertEquals(invoice.getDueDate(), dueDate); Map<String,Object> updateParams = new HashMap<String,Object>(); updateParams.put("paid", true); Invoice updatedInvoice = invoice.update(updateParams); <START> assertEquals(updatedInvoice.getPaid(), true); <END> }</code><technical_language>assertTrue(updatedInvoice.getPaid()) here</technical_language>

Target:
public void testSendInvoice() throws StripeException { InvoiceItem invItem = InvoiceItem.create(getInvoiceItemParams()); Map<String,Object> params = new HashMap<String,Object>(); Long dueDate = (System.currentTimeMillis() / 1000) + 600; params.put("customer", invItem.getCustomer()); params.put("billing", "send_invoice"); params.put("due_date", dueDate); Invoice invoice = Invoice.create(params); assertEquals("send_invoice", invoice.getBilling()); assertEquals(dueDate, invoice.getDueDate()); Map<String,Object> updateParams = new HashMap<String,Object>(); updateParams.put("paid", true); Invoice updatedInvoice = invoice.update(updateParams); assertTrue(updatedInvoice.getPaid()); }
Source:
<code>public AboutPageView(Binder uiBinder, CommonResource commonResource) { initWidget(uiBinder.createAndBindUi(this)); <START> <END> activeStyleName = commonResource.style().active(); $(buttonCanada).click(new Function() { @Override public void f() { $(buttonCanada).addClass(activeStyleName); $(buttonQuebec).removeClass(activeStyleName); $(canada).show(); $(quebec).hide(); } }); $(buttonQuebec).click(new Function() { @Override public void f() { $(buttonCanada).removeClass(activeStyleName); $(buttonQuebec).addClass(activeStyleName); $(quebec).show(); $(canada).hide(); } }); }</code><technical_language>rm 49</technical_language>

Target:
public AboutPageView(Binder uiBinder, CommonResource commonResource) { initWidget(uiBinder.createAndBindUi(this)); activeStyleName = commonResource.style().active(); $(buttonCanada).click(new Function() { @Override public void f() { $(buttonQuebec).removeClass(activeStyleName); $(buttonCanada).addClass(activeStyleName); $(canada).show(); $(quebec).hide(); } }); $(buttonQuebec).click(new Function() { @Override public void f() { $(buttonCanada).removeClass(activeStyleName); $(buttonQuebec).addClass(activeStyleName); $(quebec).show(); $(canada).hide(); } }); }
Source:
<code>private void verifyDestinationStorage(Map<String, Storage.StoragePoolType> sourcePools, Host destHost) { if (MapUtils.isNotEmpty(sourcePools)) { <START> LOGGER.debug("Verifying NFS source pools are already mounted on destination host " + destHost.getUuid()); <END> CheckStorageAvailabilityCommand cmd = new CheckStorageAvailabilityCommand(sourcePools); try { Answer answer = _agentMgr.send(destHost.getId(), cmd); if (answer == null || !answer.getResult()) { throw new CloudRuntimeException("Storage verification failed on host " + destHost.getUuid() +": " + answer.getDetails()); } } catch (AgentUnavailableException | OperationTimedoutException e) { e.printStackTrace(); throw new CloudRuntimeException("Cannot perform storage verification on host " + destHost.getUuid() + "due to: " + e.getMessage()); } } }</code><technical_language>log message NFS source pools. But, storage pools respective Storage.StoragePoolType other pool types a valid input. Please correct log message if other pool types for verification. Else pool type is required</technical_language>

Target:
private void verifyDestinationStorage(Map<String, Storage.StoragePoolType> sourcePools, Host destHost) { if (MapUtils.isNotEmpty(sourcePools)) { LOGGER.debug("Verifying source pools are already available on destination host " + destHost.getUuid()); CheckStorageAvailabilityCommand cmd = new CheckStorageAvailabilityCommand(sourcePools); try { Answer answer = agentManager.send(destHost.getId(), cmd); if (answer == null || !answer.getResult()) { throw new CloudRuntimeException("Storage verification failed on host " + destHost.getUuid() +": " + answer.getDetails()); } } catch (AgentUnavailableException | OperationTimedoutException e) { e.printStackTrace(); throw new CloudRuntimeException("Cannot perform storage verification on host " + destHost.getUuid() + "due to: " + e.getMessage()); } } }
Source:
<code>private DlmsConnection createConnection() throws IOException { final byte[] authenticationKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION) .getKey()); final byte[] encryptionKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION).getKey()); <START> Authentication auth = Authentication.newGmacAuthentication(authenticationKey, encryptionKey); <END> final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(this.device.getIpAddress())) .setAuthentication(auth) .setLogicalDeviceId(this.logicalDeviceAddress); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.setChallengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); }</code><technical_language>This a nullpointer</technical_language>

Target:
private DlmsConnection createConnection() throws IOException { final byte[] authenticationKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION) .getKey()); final byte[] encryptionKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION).getKey()); Authentication auth = Authentication.newGmacAuthentication(authenticationKey, encryptionKey, CryptographicAlgorithm.AES_GMC_128); final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(this.device.getIpAddress())) .setAuthentication(auth) .setResponseTimeout(this.responseTimeout) .setLogicalDeviceId(this.logicalDeviceAddress) .setClientId(clientAccessPoint); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.setChallengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); }
Source:
<code>private void initArticleHeaderView() { pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { openImageInGallery(null); } @Override public void onCallToActionClicked() { if (imageEditType == ImageEditType.ADD_TAGS) { getActivity().startActivityForResult(SuggestedEditsImageTagEditActivity.Companion.newIntent(getActivity(), imagePage), ACTIVITY_REQUEST_IMAGE_TAGS_EDIT); <START> } <END> if (imageEditType == ImageEditType.ADD_CAPTION_TRANSLATION ? (callToActionTargetSummary != null && callToActionSourceSummary != null) : callToActionSourceSummary != null) { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), callToActionIsTranslation ? callToActionTargetSummary.getPageTitle() : callToActionSourceSummary.getPageTitle(), null, callToActionSourceSummary, callToActionTargetSummary, callToActionIsTranslation ? TRANSLATE_CAPTION : ADD_CAPTION, LEAD_IMAGE), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } } }); }</code><technical_language>} elseif here</technical_language>

Target:
private void initArticleHeaderView() { pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { openImageInGallery(null); } @Override public void onCallToActionClicked() { if (imageEditType == ImageEditType.ADD_TAGS) { getActivity().startActivityForResult(SuggestedEditsImageTagEditActivity.Companion.newIntent(getActivity(), imagePage), ACTIVITY_REQUEST_IMAGE_TAGS_EDIT); return; } if (imageEditType == ImageEditType.ADD_CAPTION_TRANSLATION ? (callToActionTargetSummary != null && callToActionSourceSummary != null) : callToActionSourceSummary != null) { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), callToActionIsTranslation ? callToActionTargetSummary.getPageTitle() : callToActionSourceSummary.getPageTitle(), null, callToActionSourceSummary, callToActionTargetSummary, callToActionIsTranslation ? TRANSLATE_CAPTION : ADD_CAPTION, LEAD_IMAGE), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } } }); }
Source:
<code>public void testGetOnlyQueriesCacheOnOwners() throws CacheLoaderException { <START> prepareClearTest(); <END> final MagicKey k = new MagicKey("key1", c1, c2); final String v1 = "real-data"; final String v2 = "stale-data"; CacheStore store = TestingUtil.extractComponent(c3, CacheLoaderManager.class).getCacheStore(); store.store(TestInternalCacheEntryFactory.create(k, v2)); c1.put(k, v1); assertEquals(v1, c3.get(k)); }</code><technical_language>is this needed</technical_language>

Target:
public void testGetOnlyQueriesCacheOnOwners() throws CacheLoaderException { final MagicKey k = new MagicKey("key1", c1, c2); final String v1 = "real-data"; final String v2 = "stale-data"; CacheStore store = TestingUtil.extractComponent(c3, CacheLoaderManager.class).getCacheStore(); store.store(TestInternalCacheEntryFactory.create(k, v2)); c1.put(k, v1); assertEquals(v1, c3.get(k)); }
Source:
<code>public void start() throws Exception { defaultVersions.clear(); <START> String[] userSpecifiedVersion = OseeServerProperties.getOseeVersion(); <END> if (userSpecifiedVersion != null && userSpecifiedVersion.length > 0) { defaultVersions.addAll(Arrays.asList(userSpecifiedVersion)); } else { defaultVersions.add(OseeCodeVersion.getVersion()); } dataStore = new ApplicationServerDataStore(getLogger(), getDatabaseService()); serverInfo = createOseeServerInfo(getLogger(), dataStore, defaultVersions); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { boolean wasRegistered = executeLookupRegistration(); setServletRequestsAllowed(wasRegistered); } catch (Exception ex) { getLogger().error(ex, "Error during lookup registration"); } finally { timer.cancel(); } } }, 5 * 1000); }</code><technical_language>nice a Conditions.hasValues for String[] here</technical_language>

Target:
public void start() throws Exception { defaultVersions.clear(); String[] userSpecifiedVersion = OseeServerProperties.getOseeVersion(); if (Conditions.hasValues(userSpecifiedVersion)) { for (String version : userSpecifiedVersion) { defaultVersions.add(version); } } else { defaultVersions.add(OseeCodeVersion.getVersion()); } dataStore = new ApplicationServerDataStore(getLogger(), getDatabaseService()); serverInfo = createOseeServerInfo(getLogger(), dataStore, defaultVersions); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { boolean wasRegistered = executeLookupRegistration(); setServletRequestsAllowed(wasRegistered); } catch (Exception ex) { getLogger().error(ex, "Error during lookup registration"); } finally { timer.cancel(); } } }, 5 * 1000); }
Source:
<code>static int applyMaskPenaltyRule3(ByteMatrix matrix) { int numPenalties = 0; byte[][] array = matrix.getArray(); int width = matrix.getWidth(); int height = matrix.getHeight(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { byte[] arrayY = array[y]; if (x + 6 < width && arrayY[x + 0] == 1 && arrayY[x + 1] == 0 && arrayY[x + 2] == 1 && arrayY[x + 3] == 1 && arrayY[x + 4] == 1 && arrayY[x + 5] == 0 && arrayY[x + 6] == 1 && (isWhiteHorizontal(arrayY, x - 4, x) || isWhiteHorizontal(arrayY, x + 7, x + 11))) { numPenalties++; } if (y + 6 < height && <START> array[y + 0][x] == 1 && <END> array[y + 1][x] == 0 && array[y + 2][x] == 1 && array[y + 3][x] == 1 && array[y + 4][x] == 1 && array[y + 5][x] == 0 && array[y + 6][x] == 1 && (isWhiteVertical(array, x, y - 4, y) || isWhiteVertical(array, x, y + 7, y + 11))) { numPenalties++; } } } return numPenalties * N3; }</code><technical_language>Space changes OK. trivial I + 0 op line</technical_language>

Target:
static int applyMaskPenaltyRule3(ByteMatrix matrix) { int numPenalties = 0; byte[][] array = matrix.getArray(); int width = matrix.getWidth(); int height = matrix.getHeight(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { byte[] arrayY = array[y]; if (x + 6 < width && arrayY[x] == 1 && arrayY[x + 1] == 0 && arrayY[x + 2] == 1 && arrayY[x + 3] == 1 && arrayY[x + 4] == 1 && arrayY[x + 5] == 0 && arrayY[x + 6] == 1 && (isWhiteHorizontal(arrayY, x - 4, x) || isWhiteHorizontal(arrayY, x + 7, x + 11))) { numPenalties++; } if (y + 6 < height && array[y][x] == 1 && array[y + 1][x] == 0 && array[y + 2][x] == 1 && array[y + 3][x] == 1 && array[y + 4][x] == 1 && array[y + 5][x] == 0 && array[y + 6][x] == 1 && (isWhiteVertical(array, x, y - 4, y) || isWhiteVertical(array, x, y + 7, y + 11))) { numPenalties++; } } } return numPenalties * N3; }
Source:
<code>public void testPreserveAndPruneOldPacks() throws Exception { testPreserveOldPacks(); configureGc(gc, false).setPrunePreserved(true); gc.gc(); <START> assertEquals(false, repo.getObjectDatabase().getPreservedDirectory().exists()); <END> }</code><technical_language>This line a warnings in Eclipse implicit boxing false Boolean.FALSE is used. import import static org.junit.Assert.assertFalse; assertFalse(repo.getObjectDatabase().getPreservedDirectory().exists());</technical_language>

Target:
public void testPreserveAndPruneOldPacks() throws Exception { testPreserveOldPacks(); configureGc(gc, false).setPrunePreserved(true); gc.gc(); assertFalse(repo.getObjectDatabase().getPreservedDirectory().exists()); }
Source:
<code><START> public List<NameValuePair> getTopTokenRealOwners(int n) { <END> Map<String, Integer> tokenOwnerMap = new HashMap<>(); for (TokenIdent id : currentTokens.keySet()) { String realUser; if (id.getRealUser() != null && !id.getRealUser().toString().isEmpty()) { realUser = id.getRealUser().toString(); } else { realUser = id.getUser().getUserName(); } tokenOwnerMap.put(realUser, tokenOwnerMap.getOrDefault(realUser, 0)+1); } n = Math.min(n, tokenOwnerMap.size()); if (n == 0) { return new LinkedList<>(); } TopN topN = new TopN(n); for (Map.Entry<String, Integer> entry : tokenOwnerMap.entrySet()) { topN.offer(new NameValuePair( entry.getKey(), entry.getValue())); } List<NameValuePair> list = new LinkedList<>(); while (!topN.isEmpty()) { list.add(topN.poll()); } Collections.reverse(list); return list; }</code><technical_language>this get pretty expensive if lots of tokens stored? metrics pull needs iterate tokens</technical_language>

Target:
public List<NameValuePair> getTopTokenRealOwners(int n) { n = Math.min(n, tokenOwnerStats.size()); if (n == 0) { return new ArrayList<>(); } TopN topN = new TopN(n); for (Map.Entry<String, Long> entry : tokenOwnerStats.entrySet()) { topN.offer(new NameValuePair( entry.getKey(), entry.getValue())); } List<NameValuePair> list = new ArrayList<>(); while (!topN.isEmpty()) { list.add(topN.poll()); } Collections.reverse(list); return list; }
Source:
<code>private static void asyncRemoveFromBatchlog(ReplicaPlan.ForTokenWrite replicaPlan, UUID uuid) { MessageOut<UUID> message = new MessageOut<>(MessagingService.Verb.BATCH_REMOVE, uuid, UUIDSerializer.serializer); for (Replica target : replicaPlan.contacts()) { if (logger.isTraceEnabled()) logger.trace("Sending batchlog remove request to {}", uuid, target); <START> if (target.isLocal()) <END> performLocally(Stage.MUTATION, target, () -> BatchlogManager.remove(uuid)); else MessagingService.instance().sendOneWay(message, target.endpoint()); } }</code><technical_language>I thought ended calling this isSelf isLocal is overloaded in this code (meaning, variably, is this instance (has broadcast address); is DC this instance; 'local' address). strictly related this patch, rename isSelf while remember? This is consistent nomenclature TR patch, in ReplicaCollection (withoutSelf selfIfPresent)</technical_language>

Target:
private static void asyncRemoveFromBatchlog(ReplicaPlan.ForTokenWrite replicaPlan, UUID uuid) { MessageOut<UUID> message = new MessageOut<>(MessagingService.Verb.BATCH_REMOVE, uuid, UUIDSerializer.serializer); for (Replica target : replicaPlan.contacts()) { if (logger.isTraceEnabled()) logger.trace("Sending batchlog remove request to {}", uuid, target); if (target.isSelf()) performLocally(Stage.MUTATION, target, () -> BatchlogManager.remove(uuid)); else MessagingService.instance().sendOneWay(message, target.endpoint()); } }
Source:
<code>protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) { return monitor -> { IResource[] resources = getActionResources() .toArray(new IResource[getActionResources().size()]); if (resources.length == 1) { IWorkspaceRoot workspaceRoot = resources[0].getWorkspace() .getRoot(); IResource newResource = workspaceRoot.findMember(newPath); boolean go = true; if (newResource != null) { go = checkOverwrite(getShell(), newResource); <START> } <END> if (go) { MoveResourcesOperation op = new MoveResourcesOperation(resources[0], newPath, IDEWorkbenchMessages.RenameResourceAction_operationTitle); op.setModelProviderIds(getModelProviderIds()); try { PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); } catch (ExecutionException e) { IDEWorkbenchPlugin.log(e.toString()); if (e.getCause() instanceof CoreException) { errorStatus[0] = ((CoreException) e.getCause()) .getStatus(); } else { errorStatus[0] = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, getProblemsMessage(), e); } } } } }; }</code><technical_language>Please avoid newline readability</technical_language>

Target:
protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) { return monitor -> { IResource[] resources = getActionResources() .toArray(new IResource[getActionResources().size()]); if (resources.length == 1) { IWorkspaceRoot workspaceRoot = resources[0].getWorkspace() .getRoot(); IResource newResource = workspaceRoot.findMember(newPath); boolean go = true; if (newResource != null) { go = checkOverwrite(getShell(), newResource); } if (go) { MoveResourcesOperation op = new MoveResourcesOperation(resources[0], newPath, IDEWorkbenchMessages.RenameResourceAction_operationTitle); op.setModelProviderIds(getModelProviderIds()); try { PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); } catch (ExecutionException e) { IDEWorkbenchPlugin.log(e.getMessage(), e); if (e.getCause() instanceof CoreException) { errorStatus[0] = ((CoreException) e.getCause()) .getStatus(); } else { errorStatus[0] = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, getProblemsMessage(), e); } } } } }; }
Source:
<code>private FileRepository newTestRepositoryWithOnePackfile() throws Exception { FileRepository repository = createBareRepository(); TestRepository<FileRepository> testRepository = new TestRepository(repository); testRepository.commit(); testRepository.packAndPrune(); FileBasedConfig repoConfig = repository.getConfig(); repoConfig.setBoolean(ConfigConstants.CONFIG_CORE_SECTION,null, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, <START> trustFolderStats); <END> repoConfig.save(); return repository; }</code><technical_language>needs unboxed</technical_language>

Target:
private FileRepository newTestRepositoryWithOnePackfile() throws Exception { FileRepository repository = createBareRepository(); TestRepository<FileRepository> testRepository = new TestRepository<FileRepository>(repository); testRepository.commit(); testRepository.packAndPrune(); FileBasedConfig repoConfig = repository.getConfig(); repoConfig.setBoolean(ConfigConstants.CONFIG_CORE_SECTION,null, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, trustFolderStats.booleanValue()); repoConfig.save(); return repository; }
Source:
<code>private void generateIntermediateList(List<Node> orderedNodes) { intermediateList.clear(); for (Node node : orderedNodes) { node.setTaskListGenerator(this); intermediateList.addAll(node.getDesiredStateChanges()); intermediateList.add(node); for (StateChange stateChange : node.getDesiredStateChanges()) { StateChange defaultInstance = stateChange.getDefaultInstance(); <START> if (defaultInstance != null) { <END> intermediateList.add(defaultInstance); } } } logList("-- Intermediate List --", intermediateList); }</code><technical_language>assuming in this PR is a _GOOD_ reason for a default instance _EVER_ null. :smiling_imp:</technical_language>

Target:
private void generateIntermediateList(List<Node> orderedNodes) { intermediateList.clear(); for (Node node : orderedNodes) { node.setTaskListGenerator(this); if (node.isEnabled()) { intermediateList.addAll(node.getDesiredStateChanges()); intermediateList.add(node); for (StateChange stateChange : node.getDesiredStateChanges()) { intermediateList.add(stateChange.getDefaultInstance()); } } } logList("-- Intermediate List --", intermediateList); }
Source:
<code><START> public String getCascadedResource(String resourceName) { <END> List<BrandingTheme> brandingThemes = getBrandingThemes(); for (int i = brandingThemes.size() - 1; i >= 0; i--) { String resourcePath = brandingThemes.get(i).getResourcePath(resourceName); if (resourcePath != null) { return resourcePath; } } return null; }</code><technical_language>resource name interface (branding.properties), relay file name</technical_language>

Target:
public String getCascadedResource(String resourceName) { if (resourceName != null) { List<BrandingTheme> brandingThemes = getBrandingThemes(); for (int i = brandingThemes.size() - 1; i >= 0; i--) { String resourcePath = brandingThemes.get(i).getResourcePath(resourceName); if (resourcePath != null) { return resourcePath; } } } return null; }
Source:
<code>private TileMatrixSet determineTileMatrixSetToUse(List<TileMatrixSet> possibleTileMatrixSets) throws IllegalArgumentException { JSONObject useThisTileMatrixSetInstead = layerService.find(layer.getId()).getOptions().optJSONObject("useThisAlternativeTileMatrixSet"); if (useThisTileMatrixSetInstead == null) { return possibleTileMatrixSets.get(0); } TileMatrixSet setToReturn = null; <START> for (TileMatrixSet tms : possibleTileMatrixSets) { <END> String tileMatrixSetName = tms.getTileMatrixMap().keySet().iterator().next(); for (int i = 0; i < useThisTileMatrixSetInstead.length(); i++) { String key = (String) useThisTileMatrixSetInstead.keys().next(); if (tileMatrixSetName.contains(useThisTileMatrixSetInstead.optString(key, "Something not in tmsName."))) { setToReturn = tms; break; } } } if (setToReturn != null) { return setToReturn; } throw new IllegalArgumentException("Could not find TileMatrixSet for the requested crs"); }</code><technical_language>This loop is weird things. This is I in mind: String id = useThisTileMatrixSetInstead.optString(srs); if (id == null) { return possibleTileMatrixSets.get(0); } for (TileMatrixSet tms : possibleTileMatrixSets) { if (tms.getId().equals(id)) { return tms; } } throw new IllegalArgumentException("Could find TileMatrixSet id " + id + " for layer " + layer.getId()); if prefer Streams instead of foor loop: return possibleTileMatrixSets.stream() .filter(tms -> tms.getId().equals(id)) .findAny() .orElseThrow(() -> new IllegalArgumentException("Could find TileMatrixSet id " + id + " for layer " + layer.getId()));</technical_language>

Target:
private TileMatrixSet determineTileMatrixSetToUse(List<TileMatrixSet> possibleTileMatrixSets) throws IllegalArgumentException { JSONObject useThisTileMatrixSetInstead = layerService.find(layer.getId()).getAttributes().optJSONObject("preferredTileMatrix"); if (useThisTileMatrixSetInstead == null) { return possibleTileMatrixSets.get(0); } String id = useThisTileMatrixSetInstead.optString(srs); if (id == null) { return possibleTileMatrixSets.get(0); } for (TileMatrixSet tms : possibleTileMatrixSets) { if (tms.getId().equals(id)) { return tms; } } throw new IllegalArgumentException("Could not find TileMatrixSet with id " + id + " for layer " + layer.getId()); }
Source:
<code>public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } GlowWorld other = (GlowWorld) obj; <START> return getUID() == other.getUID(); <END> }</code><technical_language>equals</technical_language>

Target:
public boolean equals(Object obj) { return obj == this; }
Source:
<code>public void run() { if (WatchDogUtils.isEmpty(preferences.getUserid())) { displayUserRegistrationWizard(); } <START> if (!WatchDogUtils.isEmpty(preferences.getUserid()) <END> && !userRegistrationCancelled) { checkWorkspaceRegistration(); savePreferenceStoreIfNeeded(); } }</code><technical_language>No</technical_language>

Target:
public void run() { checkWhetherToDisplayUserProjectRegistrationWizard(); savePreferenceStoreIfNeeded(); if (WatchDogUtils.isEmpty(preferences.getUserid()) || userProjectRegistrationCancelled) { return; } checkIsWorkspaceAlreadyRegistered(); checkWhetherToDisplayProjectWizard(); checkWhetherToStartWatchDog(); }
Source:
<code>protected void createTitle(Composite parent) { label = new Label(parent, SWT.WRAP); GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 1, 1); label.setLayoutData(data); fFilterText = new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL); <START> fFilterText.setMessage("type filter text"); <END> fFilterText.setToolTipText("Filter by name"); fFilterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fFilterText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String text = fFilterText.getText(); fViewerFilter.setMatchingText(text); } }); }</code><technical_language>Please externalize strings</technical_language>

Target:
protected void createTitle(Composite parent) { label = new Label(parent, SWT.WRAP); GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 1, 1); label.setLayoutData(data); fFilterText = new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL); fFilterText.setMessage(Messages.GmonView_type_filter_text); fFilterText.setToolTipText(Messages.GmonView_filter_by_name); fFilterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fFilterText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String text = fFilterText.getText(); fViewerFilter.setMatchingText(text); } }); }
Source:
<code>public static <T> Vector<T> of(T... elements) { <START> return ofAll(List.of(elements)); <END> }</code><technical_language>loops :(</technical_language>

Target:
public static <T> Vector<T> of(T... elements) { return ofAll(Iterator.of(elements)); }
Source:
<code>public void didChange(DidChangeTextDocumentParams params) { <START> this.input = params.getContentChanges().get(0).getText(); <END> PublishDiagnosticsParams pd = new PublishDiagnosticsParams(); List<Diagnostic> diagnostics = pd.getDiagnostics(); String diagMsg = new String(); Range range = params.getContentChanges().get(0).getRange(); FilterCu inputValidity = FilterCu.compile(this.input); if (inputValidity != null) { diagMsg = "VALID"; } else { diagMsg = "INVALID"; } diagnostics.add(new Diagnostic(range, diagMsg)); pd.setDiagnostics(diagnostics); this.clients.get(0).publishDiagnostics(pd); }</code><technical_language>get(0).getText() is dangerous. get(0) return null if changes empty, do a null check before. need in 2 places, extract good extract local variable first</technical_language>

Target:
public void didChange(DidChangeTextDocumentParams params) throws NullPointerException { TextDocumentContentChangeEvent contentChange = params.getContentChanges().get(0); if (contentChange == null) { throw new NullPointerException("Event change param cannot be null"); } fInput = params.getContentChanges().get(0).getText() + "\n"; try { List<Diagnostic> diagnostics = Validation.validate(fInput); PublishDiagnosticsParams pd = new PublishDiagnosticsParams(); pd.setDiagnostics(diagnostics); LanguageClient client = fClients.get(0); if (client == null) { throw new NullPointerException("Client cannot be null"); } fClients.get(0).publishDiagnostics(pd); } catch (RecognitionException error) { error.printStackTrace(); } catch (IOException error) { error.printStackTrace(); } }
Source:
<code>private boolean setDocumentContent(IDocument document, IEditorInput input) throws CoreException { Reader reader = null; try { if (input instanceof FileStoreEditorInput){ reader = new InputStreamReader(((FileStoreEditorInput)input).getURI().toURL().openStream()); } else if (input instanceof IPathEditorInput){ reader= new FileReader(((IPathEditorInput)input).getPath().toFile()); } else { return false; } } catch (FileNotFoundException e) { return true; } catch (MalformedURLException e) { <START> throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", "Incorrect URL", e)); END> } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", "Error reading file", e)); } try { setDocumentContent(document, reader); return true; } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", IStatus.OK, "error reading file", e)); } }</code><technical_language>Please externalize strings. adding org.eclipse.linuxtools.systemtap.ui.editor constant in EditorPlugin it</technical_language>

Target:
private boolean setDocumentContent(IDocument document, IEditorInput input) throws CoreException { Reader reader = null; try { if (input instanceof FileStoreEditorInput){ reader = new InputStreamReader(((FileStoreEditorInput)input).getURI().toURL().openStream()); } else if (input instanceof IPathEditorInput){ reader= new FileReader(((IPathEditorInput)input).getPath().toFile()); } else { return false; } } catch (FileNotFoundException e) { return true; } catch (MalformedURLException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor",Localization.getString("SimpleDocumentProvider.incorrectURL"), e)); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", Localization.getString("SimpleDocumentProvider.errorCreatingFile"), e)); } try { setDocumentContent(document, reader); return true; } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", IStatus.OK, Localization.getString("SimpleDocumentProvider.errorCreatingFile"), e)); } }