auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static boolean generatesPrivateAccess(VariableTree tree) { <START> if (tree.parent() instanceof ClassTree && generatesPrivateAccess((ClassTree) tree.parent())) { <END> return !tree.symbol().metadata().isAnnotatedWith("lombok.experimental.PackagePrivate"); } return false; }</code><technical_language>if sense tree.parent() return value, I safer consider (to avoid tricky bugs)</technical_language>

Target:
private static boolean generatesPrivateAccess(VariableTree tree) { Tree parent = tree.parent(); if (parent instanceof ClassTree && generatesPrivateAccess((ClassTree) parent)) { return !tree.symbol().metadata().isAnnotatedWith("lombok.experimental.PackagePrivate"); } return false; }
Source:
<code>public GCSSinkConfig(String referenceName, String bucketKey, String projectId, String serviceKeyFile, @Nullable String fileSystemProperties, String bucketDir) { super(referenceName); this.bucketKey = bucketKey; this.projectId = projectId; <START> this.jsonKey = serviceKeyFile; <END> this.bucketDir = bucketDir; this.fileSystemProperties = getFileSystemProperties(fileSystemProperties, projectId, serviceKeyFile); }</code><technical_language>this.jsonKeyFile = serviceKeyFile;</technical_language>

Target:
public GCSSinkConfig(String referenceName, String bucketKey, String projectId, String serviceKeyFile, @Nullable String fileSystemProperties, String bucketDir) { super(referenceName); this.bucketKey = bucketKey; this.projectId = projectId; this.jsonKeyFile = serviceKeyFile; this.bucketDir = bucketDir; this.fileSystemProperties = getFileSystemProperties(fileSystemProperties, projectId, serviceKeyFile); }
Source:
<code>public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException { if (skip) { return; } String packaging = getPackaging(helper); if (!SUPPORTED_PACKAGE_TYPES.contains(packaging)) { helper .getLog() .info( String.format( "Unsupported package type %s. Skipping artifact size enforcement.", packaging)); return; } String artifactPath = getArtifactPath(helper); long maxArtifactSizeBytes = maxArtifactSizeToBytes(helper); long artifactSize = getArtifact(artifactPath).length(); <START> if (artifactSize >= maxArtifactSizeBytes) { <END> throw new EnforcerRuleException( String.format( MAX_FILE_SIZE_EXCEEDED_MSG, artifactPath, artifactSize, maxArtifactSizeBytes)); } }</code><technical_language>lenient a bit? compilers OS (or OS) generating byte code. Hardcoding a hard limit suffer fate jacoco</technical_language>

Target:
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException { if (skip) { return; } String packaging = getPackaging(helper); if (!SUPPORTED_PACKAGE_TYPES.contains(packaging)) { helper .getLog() .info( String.format( "Unsupported package type %s. Skipping artifact size enforcement.", packaging)); return; } String artifactPath = getArtifactPath(helper); long maxArtifactSizeBytes = maxArtifactSizeToBytes(helper); long artifactSize = getArtifact(artifactPath).length(); if (artifactSize > maxArtifactSizeBytes) { throw new EnforcerRuleException( String.format( MAX_FILE_SIZE_EXCEEDED_MSG, artifactPath, artifactSize, maxArtifactSizeBytes)); } }
Source:
<code>protected void handleReceivedIkePacket(Message message) { ReceivedIkePacket receivedIkePacket = (ReceivedIkePacket) message.obj; IkeHeader ikeHeader = receivedIkePacket.ikeHeader; byte[] ikePacketBytes = receivedIkePacket.ikePacketBytes; if (ikeHeader.isResponseMsg) { DecodeResult decodeResult = IkeMessage.decode(0, ikeHeader, ikePacketBytes); switch (decodeResult.status) { case DECODE_STATUS_OK: handleResponseIkeMessage(decodeResult.ikeMessage); mIkeInitResponseMessage = decodeResult.ikeMessage; mCurrentIkeSaRecord.incrementLocalRequestMessageId(); break; case <START> DECODE_STATUS_PROTECTED_ERROR_MESSAGE: <END> throw new IllegalArgumentException( "Illegal decoding result for an unencrypted message. Decoding" + " result status: " + DECODE_STATUS_PROTECTED_ERROR_MESSAGE); case DECODE_STATUS_UNPROTECTED_ERROR_MESSAGE: throw new UnsupportedOperationException("Cannot handle this error."); default: throw new IllegalArgumentException("Unrecognized decoding status."); } } else { } }</code><technical_language>Suggest allowing this fall default, error message "Invalid decoding status: " + decodeResult.status Basically, check positive cases, invalid in this state</technical_language>

Target:
protected void handleReceivedIkePacket(Message message) { ReceivedIkePacket receivedIkePacket = (ReceivedIkePacket) message.obj; IkeHeader ikeHeader = receivedIkePacket.ikeHeader; byte[] ikePacketBytes = receivedIkePacket.ikePacketBytes; if (ikeHeader.isResponseMsg) { DecodeResult decodeResult = IkeMessage.decode(0, ikeHeader, ikePacketBytes); switch (decodeResult.status) { case DECODE_STATUS_OK: handleResponseIkeMessage(decodeResult.ikeMessage); mIkeInitResponseMessage = decodeResult.ikeMessage; mCurrentIkeSaRecord.incrementLocalRequestMessageId(); break; case DECODE_STATUS_PROTECTED_ERROR_MESSAGE: case DECODE_STATUS_UNPROTECTED_ERROR_MESSAGE: throw new UnsupportedOperationException("Cannot handle this error."); default: throw new IllegalArgumentException( "Invalid decoding status: " + decodeResult.status); } } else { Log.e(TAG, "Received a request while waiting for IKE_INIT response."); } }
Source:
<code>public List<Deployment> getDeployments(){ List<IService> services = conn.getResources(ResourceKind.SERVICE, project.getName()); Collection<IRoute> routes = conn.getResources(ResourceKind.ROUTE, project.getName()); List<Deployment> adapters = new ArrayList<>(services.size()); for (IService service : services) { adapters.add(getDeployment(service, routes)); } <START> <END> return adapters; }</code><technical_language>done List<Deployment> adapters = services.stream().map(service -> getDeployment(service, routes)).collect(Collectors.toList()); way, creating deployment complete iteration routes nice code bad performance if number of routes large. Is realistic more 100 number of services more 10? If not, nice code stay, if is another algorithm is needed treat service route once</technical_language>

Target:
public List<Deployment> getDeployments(){ List<IService> services = conn.getResources(ResourceKind.SERVICE, project.getName()); Map<String, Collection<IRoute>> serviceToRoutes = mapServiceToRoutes(project.getName()); List<Deployment> adapters = new ArrayList<>(services.size()); for (IService service : services) { adapters.add(getDeployment(service, serviceToRoutes.get(service.getName()))); } return adapters; }
Source:
<code>protected Object handleReadManyCommand(InvocationContext ctx, FlagAffectedCommand command, Collection<?> keys) throws Throwable { try { Object stage; if (!readNeedsLock(ctx, command)) { stage = invokeNext(ctx, command); } else { if (!needRemoteLocks(ctx, keys, command)) { acquireLocalLocks(ctx, command, keys); stage = invokeNext(ctx, command); } else { final TxInvocationContext txContext = (TxInvocationContext) ctx; LockControlCommand lcc = cf.buildLockControlCommand(keys, command.getFlagsBitSet(), txContext.getGlobalTransaction()); stage = invokeNextThenApply(ctx, lcc, (rCtx, rLockCommand, rv) -> { acquireLocalLocks(rCtx, command, keys); return invokeNext(rCtx, command); }); } } <START> return makeStage(stage).andExceptionally(ctx, command, (rCtx, rCommand, t) -> { <END> throw t; }); } catch (Throwable t) { throw t; } }</code><technical_language>This deserve some code cleanup, need register handler</technical_language>

Target:
protected Object handleReadManyCommand(InvocationContext ctx, FlagAffectedCommand command, Collection<?> keys) throws Throwable { Object maybeStage; if (!readNeedsLock(ctx, command)) { maybeStage = invokeNext(ctx, command); } else { if (!needRemoteLocks(ctx, keys, command)) { acquireLocalLocks(ctx, command, keys); maybeStage = invokeNext(ctx, command); } else { final TxInvocationContext txContext = (TxInvocationContext) ctx; LockControlCommand lcc = cf.buildLockControlCommand(keys, command.getFlagsBitSet(), txContext.getGlobalTransaction()); maybeStage = invokeNextThenApply(ctx, lcc, (rCtx, rLockCommand, rv) -> { acquireLocalLocks(rCtx, command, keys); return invokeNext(rCtx, command); }); } } return maybeStage; }
Source:
<code>private Provider<?> getProvider() { if (provider == null) { <START> provider = getDbFacade().getProviderDao().get(getExternalNetwork().getProviderId()); <END> } return provider; }</code><technical_language>if getExternalNetwork() returns null, end NPE</technical_language>

Target:
private Provider<?> getProvider() { if (provider == null && getExternalNetwork() != null) { provider = getDbFacade().getProviderDao().get(getExternalNetwork().getProviderId()); } return provider; }
Source:
<code>protected String valueErrorFor(T value) { double number = value.doubleValue(); if (number > upperLimit.doubleValue() || number < lowerLimit.doubleValue()) { <START> return value + " is out of range " + AbstractNumericProperty.rangeString(lowerLimit, upperLimit); <END> } return null; }</code><technical_language>Inheritance provides means share rangeString? "unrelated" abstract classes holders for static utility methods choice</technical_language>

Target:
protected String valueErrorFor(T value) { return module.valueErrorFor(value); }
Source:
<code>private void warnDeprecated( String fieldName, Object value ) { Parameter parameter = mojoDescriptor.getParameterMap().get( fieldName ); String deprecated = parameter.getDeprecated(); if ( deprecated != null && !deprecated.isEmpty() ) { if ( !toString( value ).equals( toString( parameter.getDefaultValue() ) ) ) { StringBuilder sb = new StringBuilder( " Parameter '" ); sb.append( fieldName ).append( '\'' ); if ( parameter.getExpression() != null ) { String userParam = parameter.getExpression().replace( "${", "'" ).replace( '}', '\'' ); <START> sb.append( " (User Parameter " ).append( userParam ).append( ")" ); <END> } sb.append( " is deprecated. " ).append( deprecated ); logger.warn( MessageUtils.buffer().warning( sb.toString() ).toString() ); } } }</code><technical_language>is called User Property, User Parameter. aware difference expression default-value clear in past, plugins odd values. show in case of a valid expression</technical_language>

Target:
private void warnDeprecated( String fieldName, Object value ) { Parameter parameter = mojoDescriptor.getParameterMap().get( fieldName ); String deprecated = parameter.getDeprecated(); if ( deprecated != null && !deprecated.isEmpty() ) { if ( !toString( value ).equals( toString( parameter.getDefaultValue() ) ) ) { StringBuilder sb = new StringBuilder( " Parameter '" ); sb.append( fieldName ).append( '\'' ); if ( parameter.getExpression() != null ) { String userProperty = parameter.getExpression().replace( "${", "'" ).replace( '}', '\'' ); sb.append( " (User Property " ).append( userProperty ).append( ")" ); } sb.append( " is deprecated. " ).append( deprecated ); logger.warn( MessageUtils.buffer().warning( sb.toString() ).toString() ); } } }
Source:
<code>public void destroy() { if (logger.isInfoEnabled()) { logger.info("Destroy registry:" + getUrl()); } Set<URL> destroyRegistered = new HashSet<>(getRegistered()); if (!destroyRegistered.isEmpty()) { for (URL url : new HashSet<>(getRegistered())) { if (url.getParameter(Constants.DYNAMIC_KEY, true)) { try { unregister(url); if (logger.isInfoEnabled()) { logger.info(String.format("Destroy unregister url %s", url)); } } catch (Throwable t) { logger.warn("Failed to unregister url " + url + " to registry " + getUrl() + " on destroy, cause: " + t.getMessage(), t); } } } } Map<URL, Set<NotifyListener>> destroySubscribed = new HashMap<>(getSubscribed()); if (!destroySubscribed.isEmpty()) { for (Map.Entry<URL, Set<NotifyListener>> entry : destroySubscribed.entrySet()) { URL url = entry.getKey(); for (NotifyListener listener : entry.getValue()) { try { unsubscribe(url, listener); if (logger.isInfoEnabled()) { <START> logger.info(String.format("Destroy unsubscribe url %s", url)); <END> } } catch (Throwable t) { logger.warn("Failed to unsubscribe url " + url + " to registry " + getUrl() + " on destroy, cause: " + t.getMessage(), t); } } } } }</code><technical_language>I string concatination, info log level this called lot time string concatination performance String.format</technical_language>

Target:
public void destroy() { if (logger.isInfoEnabled()) { logger.info("Destroy registry:" + getUrl()); } Set<URL> destroyRegistered = new HashSet<>(getRegistered()); for (URL url : destroyRegistered) { if (url.getParameter(Constants.DYNAMIC_KEY, true)) { try { unregister(url); if (logger.isInfoEnabled()) { logger.info("Destroy unregister url " + url); } } catch (Throwable t) { logger.warn("Failed to unregister url " + url + " to registry " + getUrl() + " on destroy, cause: " + t.getMessage(), t); } } } Map<URL, Set<NotifyListener>> destroySubscribed = new HashMap<>(getSubscribed()); for (Map.Entry<URL, Set<NotifyListener>> entry : destroySubscribed.entrySet()) { URL url = entry.getKey(); for (NotifyListener listener : entry.getValue()) { try { unsubscribe(url, listener); if (logger.isInfoEnabled()) { logger.info("Destroy unsubscribe url " + url); } } catch (Throwable t) { logger.warn("Failed to unsubscribe url " + url + " to registry " + getUrl() + " on destroy, cause: " + t.getMessage(), t); } } } }
Source:
<code>public DefaultAddressedEnvelope(M message, A recipient, A sender) { if (recipient == null && sender == null) { throw new NullPointerException("recipient and sender"); } <START> this.message = ObjectUtil.checkNotNull(message, "message"); <END> this.sender = sender; this.recipient = recipient; }</code><technical_language>move this assignment check in method change behaviour</technical_language>

Target:
public DefaultAddressedEnvelope(M message, A recipient, A sender) { ObjectUtil.checkNotNull(message, "message"); if (recipient == null && sender == null) { throw new NullPointerException("recipient and sender"); } this.message = message; this.sender = sender; this.recipient = recipient; }
Source:
<code>public void validate(final Diagram diagram, final Consumer<Collection<DomainViolation>> resultConsumer) { try { final List<Reader> dmnXMLReaders = new ArrayList<>(); final String uiDiagramXML = dmnMarshaller.marshall(diagram); <START> dmnXMLReaders.add(getStringReader(uiDiagramXML)); <END> final Definitions uiDefinitions = dmnDiagramUtils.getDefinitions(diagram); final List<Import> uiImports = uiDefinitions.getImport(); final List<org.kie.dmn.model.api.Import> dmnImports = uiImports.stream().map(ImportConverter::dmnFromWb).collect(Collectors.toList()); final Map<org.kie.dmn.model.api.Import, String> importedDiagramsXML = importsHelper.getImportXML(diagram.getMetadata(), dmnImports); importedDiagramsXML.values().forEach(importedDiagramXML -> dmnXMLReaders.add(getStringReader(importedDiagramXML))); final Reader[] aDMNXMLReaders = new Reader[]{}; final List<DMNMessage> messages = dmnValidator .validateUsing(DMNValidator.Validation.VALIDATE_MODEL, DMNValidator.Validation.VALIDATE_COMPILATION, DMNValidator.Validation.ANALYZE_DECISION_TABLE) .theseModels(dmnXMLReaders.toArray(aDMNXMLReaders)); resultConsumer.accept(convert(messages)); } catch (IOException ioe) { LOGGER.error("Error while converting diagram with UUID [" + diagram.getName() + "] to XML.", ioe); } }</code><technical_language>I close **StringReader**s</technical_language>

Target:
public void validate(final Diagram diagram, final Consumer<Collection<DomainViolation>> resultConsumer) { final List<Reader> dmnXMLReaders = new ArrayList<>(); try { final String uiDiagramXML = dmnMarshaller.marshall(diagram); dmnXMLReaders.add(getStringReader(uiDiagramXML)); final Definitions uiDefinitions = dmnDiagramUtils.getDefinitions(diagram); final List<Import> uiImports = uiDefinitions.getImport(); final List<org.kie.dmn.model.api.Import> dmnImports = uiImports.stream().map(ImportConverter::dmnFromWb).collect(Collectors.toList()); final Map<org.kie.dmn.model.api.Import, String> importedDiagramsXML = importsHelper.getImportXML(diagram.getMetadata(), dmnImports); importedDiagramsXML.values().forEach(importedDiagramXML -> dmnXMLReaders.add(getStringReader(importedDiagramXML))); final Reader[] aDMNXMLReaders = new Reader[]{}; final List<DMNMessage> messages = dmnValidator .validateUsing(DMNValidator.Validation.VALIDATE_MODEL, DMNValidator.Validation.VALIDATE_COMPILATION, DMNValidator.Validation.ANALYZE_DECISION_TABLE) .theseModels(dmnXMLReaders.toArray(aDMNXMLReaders)); resultConsumer.accept(convert(messages)); } catch (IOException ioe) { LOGGER.error("Error while converting diagram with UUID [" + diagram.getName() + "] to XML.", ioe); } finally { dmnXMLReaders.forEach(reader -> { try { reader.close(); } catch (IOException ioe) { } }); } }
Source:
<code>public abstract void create(boolean bare) throws IOException; @Deprecated <START> public File getDirectory() { <END> return getGitDir(); }</code><technical_language>I get need change this method's name, stick this name change new for GIT_COMMONT_DIR getCommonDirectory()</technical_language>

Target:
public abstract void create(boolean bare) throws IOException; public File getDirectory() { return gitDir; }
Source:
<code>public OAuthConsumerAppDTO getOAuthApplicationData(String consumerKey) throws IdentityOAuthAdminException { OAuthConsumerAppDTO dto = new OAuthConsumerAppDTO(); OAuthAppDAO dao = new OAuthAppDAO(); try { OAuthAppDO app = dao.getAppInformation(consumerKey); if (app != null) { dto.setApplicationName(app.getApplicationName()); dto.setCallbackUrl(app.getCallbackUrl()); dto.setOauthConsumerKey(app.getOauthConsumerKey()); dto.setOauthConsumerSecret(app.getOauthConsumerSecret()); dto.setOAuthVersion(app.getOauthVersion()); dto.setGrantTypes(app.getGrantTypes()); } return dto; } catch (InvalidOAuthClientException | IdentityOAuth2Exception e) { <START> throw new IdentityOAuthAdminException(e.getMessage(), e); <END> } }</code><technical_language>e.getMessage()</technical_language>

Target:
public OAuthConsumerAppDTO getOAuthApplicationData(String consumerKey) throws IdentityOAuthAdminException { OAuthConsumerAppDTO dto = new OAuthConsumerAppDTO(); OAuthAppDAO dao = new OAuthAppDAO(); try { OAuthAppDO app = dao.getAppInformation(consumerKey); if (app != null) { dto.setApplicationName(app.getApplicationName()); dto.setCallbackUrl(app.getCallbackUrl()); dto.setOauthConsumerKey(app.getOauthConsumerKey()); dto.setOauthConsumerSecret(app.getOauthConsumerSecret()); dto.setOAuthVersion(app.getOauthVersion()); dto.setGrantTypes(app.getGrantTypes()); } return dto; } catch (InvalidOAuthClientException | IdentityOAuth2Exception e) { throw new IdentityOAuthAdminException("Error while retrieving the app information using consumer key", e); } }
Source:
<code>public Response add(Storage storage) { validateParameters(storage, "address", "type", "host"); StorageServerConnections storageConnection = getMapper(Storage.class, StorageServerConnections.class).map(storage, null); Guid hostId = getHostId(storage.getHost()); switch (storageConnection.getstorage_type()) { case ISCSI: validateParameters(storage, "iqn", "port"); break; case NFS: validateParameters(storage, "path"); break; <START> case LOCALFS: <END> validateParameters(storage, "path"); break; case POSIXFS: case GLUSTERFS: validateParameters(storage, "path", "vfsType"); break; default: break; } return performCreate(VdcActionType.AddStorageServerConnection, getAddParams(storageConnection, hostId), ENTITY_RETRIEVER); }</code><technical_language>separate cases for NFS LOCALFS</technical_language>

Target:
public Response add(Storage storage) { validateParameters(storage, "address", "type", "host"); StorageServerConnections storageConnection = getMapper(Storage.class, StorageServerConnections.class).map(storage, null); Guid hostId = getHostId(storage.getHost()); switch (storageConnection.getstorage_type()) { case ISCSI: validateParameters(storage, "iqn", "port"); break; case NFS: case LOCALFS: validateParameters(storage, "path"); break; case POSIXFS: case GLUSTERFS: validateParameters(storage, "path", "vfsType"); break; default: break; } return performCreate(VdcActionType.AddStorageServerConnection, getAddParams(storageConnection, hostId), ENTITY_RETRIEVER); }
Source:
<code>private void releaseSlots(Iterable<AllocatedSlot> slotsToReturnToOwner, Throwable cause) { for (AllocatedSlot slotToReturn : slotsToReturnToOwner) { Preconditions.checkState(!slotToReturn.isUsed(), "Free slot must not be used."); <START> LOG.info("Releasing slot [{}].", slotToReturn.getAllocationId()); <END> final ResourceProfile matchingResourceProfile = getMatchingResourceProfile(slotToReturn.getAllocationId()); fulfilledResourceRequirements = fulfilledResourceRequirements.subtract(matchingResourceProfile, 1); slotToRequirementProfileMappings.remove(slotToReturn.getAllocationId()); final CompletableFuture<Acknowledge> freeSlotFuture = slotToReturn.getTaskManagerGateway().freeSlot( slotToReturn.getAllocationId(), cause, rpcTimeout); freeSlotFuture.whenComplete((Acknowledge ignored, Throwable throwable) -> { if (throwable != null) { LOG.debug("Releasing slot of registered TaskExecutor failed. Discarding slot.", slotToReturn.getAllocationId(), slotToReturn.getTaskManagerId(), throwable); } }); } }</code><technical_language>log debug cause</technical_language>

Target:
private void releaseSlots(Iterable<AllocatedSlot> slotsToReturnToOwner, Throwable cause) { for (AllocatedSlot slotToReturn : slotsToReturnToOwner) { Preconditions.checkState(!slotToReturn.isUsed(), "Free slot must not be used."); if (LOG.isDebugEnabled()) { LOG.info("Releasing slot [{}].", slotToReturn.getAllocationId(), cause); } else { LOG.info("Releasing slot [{}].", slotToReturn.getAllocationId()); } final ResourceProfile matchingResourceProfile = getMatchingResourceProfile(slotToReturn.getAllocationId()); fulfilledResourceRequirements = fulfilledResourceRequirements.subtract(matchingResourceProfile, 1); slotToRequirementProfileMappings.remove(slotToReturn.getAllocationId()); final CompletableFuture<Acknowledge> freeSlotFuture = slotToReturn.getTaskManagerGateway().freeSlot( slotToReturn.getAllocationId(), cause, rpcTimeout); freeSlotFuture.whenComplete((Acknowledge ignored, Throwable throwable) -> { if (throwable != null) { LOG.debug("Releasing slot of registered TaskExecutor failed. Discarding slot.", slotToReturn.getAllocationId(), slotToReturn.getTaskManagerId(), throwable); } }); } }
Source:
<code>public ServiceProvider getApplicationExcludingFileBasedSPs(String applicationName, String tenantDomain) throws IdentityApplicationManagementException { Collection<ApplicationMgtListener> listeners = ApplicationMgtListenerServiceComponent.getApplicationMgtListeners(); for (ApplicationMgtListener listener : listeners) { if (!listener.doPreGetApplication(applicationName, tenantDomain)) { return null; } } try { startTenantFlow(tenantDomain); ApplicationDAO appDAO = ApplicationMgtSystemConfig.getInstance().getApplicationDAO(); ServiceProvider serviceProvider = appDAO.getApplication(applicationName, tenantDomain); if (serviceProvider != null) { loadApplicationPermissions(applicationName, serviceProvider); } for (ApplicationMgtListener listener : listeners) { if (!listener.doPostGetApplication(serviceProvider, applicationName, tenantDomain)) { return null; } <START> } <END> return serviceProvider; } catch (Exception e) { String error = "Error occurred while retrieving the application, " + applicationName; log.error(error, e); throw new IdentityApplicationManagementException(error, e); } finally { endTenantFlow(); } }</code><technical_language>Invoking listeners final service method. return. try catch blocks need unnecessarily handle exception in service method throw listener</technical_language>

Target:
public ServiceProvider getApplicationExcludingFileBasedSPs(String applicationName, String tenantDomain) throws IdentityApplicationManagementException { ServiceProvider serviceProvider = null; Collection<ApplicationMgtListener> listeners = ApplicationMgtListenerServiceComponent.getApplicationMgtListeners(); for (ApplicationMgtListener listener : listeners) { if (!listener.doPreGetApplicationExcludingFileBasedSPs(applicationName, tenantDomain)) { return null; } } try { startTenantFlow(tenantDomain); ApplicationDAO appDAO = ApplicationMgtSystemConfig.getInstance().getApplicationDAO(); serviceProvider = appDAO.getApplication(applicationName, tenantDomain); if (serviceProvider != null) { loadApplicationPermissions(applicationName, serviceProvider); } } catch (Exception e) { String error = "Error occurred while retrieving the application, " + applicationName; log.error(error, e); throw new IdentityApplicationManagementException(error, e); } finally { endTenantFlow(); } for (ApplicationMgtListener listener : listeners) { if (!listener.doPostGetApplicationExcludingFileBasedSPs(serviceProvider, applicationName, tenantDomain)) { return null; } } return serviceProvider; }
Source:
<code>public void toggleLineBreakpoints(final IWorkbenchPart part, final ISelection selection) throws CoreException { Job job = new Job("Script Toggle Line Breakpoint") { protected IStatus run(IProgressMonitor monitor) { final ITextEditor editor = getTextEditor(part); if (editor != null && selection instanceof ITextSelection) { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } try { report(null, part); int lineNumber = ((ITextSelection) selection) .getStartLine() + 1; final String debugModelId = getDebugModelId(); final IBreakpoint breakpoint = BreakpointUtils .findLineBreakpoint(editor, lineNumber, debugModelId); if (breakpoint != null) { breakpoint.delete(); } else { final IDocumentProvider documentProvider = editor .getDocumentProvider(); if (documentProvider == null) { return Status.CANCEL_STATUS; } final IDocument document = documentProvider .getDocument(editor.getEditorInput()); lineNumber = findBreakpointLine(document, lineNumber - 1, getValidator()) + 1; if (lineNumber != BREAKPOINT_LINE_NOT_FOUND) { if (BreakpointUtils.findLineBreakpoint(editor, lineNumber, debugModelId) == null) { BreakpointUtils.addLineBreakpoint(editor, lineNumber, debugModelId); } else { report( NLS .bind( Messages.ScriptToggleBreakpointAdapter_breakpointAlreadySetAtLine, <START> new Object[] { Integer.valueOf( <END> lineNumber) }), part); } } else { report( Messages.ScriptToggleBreakpointAdapter_invalidBreakpointPosition, part); } } } catch (CoreException e) { DLTKDebugUIPlugin.log(e); } } return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); }</code><technical_language>autoboxing + NLS.bind() array</technical_language>

Target:
public void toggleLineBreakpoints(final IWorkbenchPart part, final ISelection selection) throws CoreException { Job job = new Job("Script Toggle Line Breakpoint") { protected IStatus run(IProgressMonitor monitor) { final ITextEditor editor = getTextEditor(part); if (editor != null && selection instanceof ITextSelection) { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } try { report(null, part); int lineNumber = ((ITextSelection) selection) .getStartLine() + 1; final String debugModelId = getDebugModelId(); final IBreakpoint breakpoint = BreakpointUtils .findLineBreakpoint(editor, lineNumber, debugModelId); if (breakpoint != null) { breakpoint.delete(); } else { final IDocumentProvider documentProvider = editor .getDocumentProvider(); if (documentProvider == null) { return Status.CANCEL_STATUS; } final IDocument document = documentProvider .getDocument(editor.getEditorInput()); lineNumber = findBreakpointLine(document, lineNumber - 1, getValidator()) + 1; if (lineNumber != BREAKPOINT_LINE_NOT_FOUND) { if (BreakpointUtils.findLineBreakpoint(editor, lineNumber, debugModelId) == null) { BreakpointUtils.addLineBreakpoint(editor, lineNumber, debugModelId); } else { report(NLS.bind( Messages.ScriptToggleBreakpointAdapter_breakpointAlreadySetAtLine, lineNumber), part); } } else { report(Messages.ScriptToggleBreakpointAdapter_invalidBreakpointPosition, part); } } } catch (CoreException e) { DLTKDebugUIPlugin.log(e); } } return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); }
Source:
<code>public List<AsyncTasks> getTasksByEntity(Guid entityId) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource(); <START> parameterSource.addValue("entity_id", entityId); <END> return getCallsHandler().executeReadList("GetAsyncTasksByEntityId", AsyncTaskRowMapper.instance, parameterSource); }</code><technical_language>inline this - MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("entity_id", entityId);</technical_language>

Target:
public List<AsyncTasks> getTasksByEntity(Guid entityId) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("entity_id", entityId); return getCallsHandler().executeReadList("GetAsyncTasksByEntityId", AsyncTaskRowMapper.instance, parameterSource); }
Source:
<code>public void testGetDocContent_includedMetadata() throws Exception { options = TestObjectFactory.newConfigOptions( ImmutableMap.of("filenet.includedMetadata", "foo, bar")); String id = "{AAAAAAAA-0000-0000-0000-000000000000}"; DocId docId = newDocId(new Id(id)); MockObjectStore os = getObjectStore(); mockDocument(os, id, DOCUMENT_TIMESTAMP, RELEASED, 42d, "text/plain", <START> ImmutableList.<Property>of( <END> mockProperty("foo", "fooValue"), mockProperty("bar", "barValue")), new AccessPermissionListMock(), new ActiveMarkingListMock()); DocumentTraverser traverser = new DocumentTraverser(options); Request request = new MockRequest(docId); RecordingResponse response = new RecordingResponse(); traverser.getDocContent(new Id(id), request, response); assertEquals( new Metadata( ImmutableMap.of("foo", "fooValue", "bar", "barValue") .entrySet()), response.getMetadata()); }</code><technical_language>a baz property included</technical_language>

Target:
public void testGetDocContent_includedMetadata() throws Exception { options = TestObjectFactory.newConfigOptions( ImmutableMap.of("filenet.includedMetadata", "foo, bar")); String id = "{AAAAAAAA-0000-0000-0000-000000000000}"; DocId docId = newDocId(new Id(id)); MockObjectStore os = getObjectStore(); mockDocument(os, id, DOCUMENT_TIMESTAMP, RELEASED, 42d, "text/plain", ImmutableList.<Property>of( mockProperty("foo", "fooValue"), mockProperty("bar", "barValue"), mockProperty("baz", "bazValue")), new AccessPermissionListMock(), new ActiveMarkingListMock()); DocumentTraverser traverser = new DocumentTraverser(options); Request request = new MockRequest(docId); RecordingResponse response = new RecordingResponse(); traverser.getDocContent(new Id(id), request, response); assertEquals( new Metadata( ImmutableMap.of("foo", "fooValue", "bar", "barValue").entrySet()), response.getMetadata()); }
Source:
<code>public CompletionStage<ExecutionResult> executeAsync(ExecutionContext executionContext, GraphQLObjectType parentType, Object source, Map<String, List<Field>> fields) { Map<String, Supplier<CompletionStage<ExecutionResult>>> executingFields = new LinkedHashMap<>(); <START> for (String fieldName : fields.keySet()) { <END> List<Field> fieldList = fields.get(fieldName); executingFields.put(fieldName, () -> resolveFieldAsync(executionContext, parentType, source, fieldList)); } CompletionStage<Map<String, ExecutionResult>> mapCompletionStage1 = awaitFields(executingFields); return mapCompletionStage1.thenApply(map -> { Map<String, Object> map2 = new HashMap<>(); map.forEach((key, result) -> { map2.put(key, result.getData()); }); return new graphql.ExecutionResultImpl(map2, executionContext.getErrors()); }); }</code><technical_language>of java8's stream.map.collect</technical_language>

Target:
public CompletionStage<ExecutionResult> executeAsync(ExecutionContext executionContext, GraphQLObjectType parentType, Object source, Map<String, List<Field>> fields) { Map<String, Supplier<CompletionStage<ExecutionResult>>> fieldsToExecute = fields.keySet() .stream() .collect(Collectors.toMap( Function.identity(), field -> () -> resolveFieldAsync(executionContext, parentType, source, fields.get(field)), (a, b) -> a, LinkedHashMap::new )); return executeFields(fieldsToExecute).<ExecutionResult>thenApply(resultMap -> { Map<String, Object> dataMap = new HashMap<>(); resultMap.forEach((key, result) -> { dataMap.put(key, result.getData()); }); return new ExecutionResultImpl(dataMap, executionContext.getErrors()); }).exceptionally(e -> { if (e.getCause() instanceof NonNullException) { return new ExecutionResultImpl(null, null); } throw new RuntimeException(e); }); }
Source:
<code>private void load() { Snackbar.make(scrollView, R.string.loading, Snackbar.LENGTH_SHORT).show(); new ReadFileTask(getContentResolver(), mFile, getExternalCacheDir(), isRootExplorer(), (data) -> { switch (data.error) { case ReadFileTask.NORMAL: cacheFile = data.cachedFile; mOriginal = data.fileContents; try { mInput.setText(data.fileContents); <START> if (mFile.hybridFileParcelable != null && mFile.hybridFileParcelable.getPath().contains(getExternalCacheDir().getPath()) <END> && cacheFile == null) { mInput.setInputType(EditorInfo.TYPE_NULL); mInput.setSingleLine(false); mInput.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION); Snackbar snackbar = Snackbar.make(mInput, getResources().getString(R.string.file_read_only), Snackbar.LENGTH_INDEFINITE); snackbar.setAction(getResources().getString(R.string.got_it).toUpperCase(), v -> snackbar.dismiss()); snackbar.show(); } if (data.fileContents.isEmpty()) { mInput.setHint(R.string.file_empty); } else { mInput.setHint(null); } } catch (OutOfMemoryError e) { Toast.makeText(getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show(); finish(); } break; case ReadFileTask.EXCEPTION_STREAM_NOT_FOUND: Toast.makeText(getApplicationContext(), R.string.error_file_not_found, Toast.LENGTH_SHORT).show(); finish(); break; case ReadFileTask.EXCEPTION_IO: Toast.makeText(getApplicationContext(), R.string.error_io, Toast.LENGTH_SHORT).show(); finish(); break; } }).execute(); }</code><technical_language>for late respose. Remember getExternalCacheDir() >May return null if shared storage is currently available. --[Android Deveplopers - getExternalCacheDir()](<LINK_0></technical_language>

Target:
private void load() { Snackbar.make(scrollView, R.string.loading, Snackbar.LENGTH_SHORT).show(); new ReadFileTask(getContentResolver(), mFile, getExternalCacheDir(), isRootExplorer(), (data) -> { switch (data.error) { case ReadFileTask.NORMAL: cacheFile = data.cachedFile; mOriginal = data.fileContents; try { mInput.setText(data.fileContents); if (mFile.scheme == EditableFileAbstraction.SCHEME_FILE && getExternalCacheDir() != null && mFile.hybridFileParcelable.getPath().contains(getExternalCacheDir().getPath()) && cacheFile == null) { mInput.setInputType(EditorInfo.TYPE_NULL); mInput.setSingleLine(false); mInput.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION); Snackbar snackbar = Snackbar.make(mInput, getResources().getString(R.string.file_read_only), Snackbar.LENGTH_INDEFINITE); snackbar.setAction(getResources().getString(R.string.got_it).toUpperCase(), v -> snackbar.dismiss()); snackbar.show(); } if (data.fileContents.isEmpty()) { mInput.setHint(R.string.file_empty); } else { mInput.setHint(null); } } catch (OutOfMemoryError e) { Toast.makeText(getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show(); finish(); } break; case ReadFileTask.EXCEPTION_STREAM_NOT_FOUND: Toast.makeText(getApplicationContext(), R.string.error_file_not_found, Toast.LENGTH_SHORT).show(); finish(); break; case ReadFileTask.EXCEPTION_IO: Toast.makeText(getApplicationContext(), R.string.error_io, Toast.LENGTH_SHORT).show(); finish(); break; } }).execute(); }
Source:
<code>private void createCapitalAssetErrorDocument(String netid, String assetTag, String condition, String buildingCode, String roomNumber) { try { GlobalVariables.clear(); GlobalVariables.setUserSession(new UserSession("kp378")); BarcodeInventoryErrorDocument document = (BarcodeInventoryErrorDocument) getDocumentService().getNewDocument(BarcodeInventoryErrorDocument.class); document.getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(KualiDecimal.ZERO); <START> String errorDescription = "Error Scanning Asset Tag #" + assetTag; <END> document.getDocumentHeader().setExplanation(errorDescription + ". Asset Tag Not Found"); document.getDocumentHeader().setDocumentDescription(errorDescription); document.setUploaderUniversalIdentifier(netid); List<BarcodeInventoryErrorDetail> barcodeInventoryErrorDetails = new ArrayList<>(); barcodeInventoryErrorDetails.add(getErrorDetail(netid, assetTag, condition, buildingCode, roomNumber)); document.setBarcodeInventoryErrorDetail(barcodeInventoryErrorDetails); getDocumentService().saveDocument(document); List<AdHocRouteRecipient> adHocRecipients = new ArrayList<>(); getDocumentService().routeDocument(document, "Capital Asset Inventory Error Asset Not Found", adHocRecipients); } catch (Exception ex) { LOG.error("createCapitalAssetErrorDocument", ex); } }</code><technical_language>This error description added a properties a constants file</technical_language>

Target:
private void createCapitalAssetErrorDocument(String netid, String assetTag, String condition, String buildingCode, String roomNumber) { try { GlobalVariables.doInNewGlobalVariables(new UserSession(CuCamsConstants.CapAssetApi.KFS_SYSTEM_USER), () -> { try { BarcodeInventoryErrorDocument document = (BarcodeInventoryErrorDocument) getDocumentService().getNewDocument(BarcodeInventoryErrorDocument.class); String errorDescription = CuCamsConstants.CapAssetApi.ASSET_NOT_FOUND_ERROR + assetTag; document.getDocumentHeader().setExplanation(errorDescription + ". Asset Tag Not Found"); document.getDocumentHeader().setDocumentDescription(errorDescription); document.setUploaderUniversalIdentifier(netid); List<BarcodeInventoryErrorDetail> barcodeInventoryErrorDetails = new ArrayList<>(); barcodeInventoryErrorDetails.add(getErrorDetail(netid, assetTag, condition, buildingCode, roomNumber)); document.setBarcodeInventoryErrorDetail(barcodeInventoryErrorDetails); getDocumentService().saveDocument(document); getDocumentService().routeDocument(document, "Capital Asset Inventory Error Asset Not Found", new ArrayList<>()); return true; } catch (Exception ex) { LOG.error("createCapitalAssetErrorDocument", ex); } return false; } ); } catch (Exception ex) { LOG.error("createCapitalAssetErrorDocument", ex); } }
Source:
<code>public void testTransformSourceResponseByMimeType() throws CatalogTransformerException, MimeTypeParseException { BinaryContent mockBinaryContent = mock(BinaryContent.class); QueryResponseTransformer transformer = mock(QueryResponseTransformer.class); when(transformer.transform(any(SourceResponse.class), any(Map.class))) .thenReturn(mockBinaryContent); <START> when(transformerLocator.findQueryResponseTransformers(any(MimeType.class))) <END> .thenReturn(Collections.singletonList(transformer)); BinaryContent binaryContent = transform.transform( mock(SourceResponse.class), new MimeType("text/xml"), Collections.emptyMap()); assertThat(binaryContent, is(mockBinaryContent)); }</code><technical_language>this MimeType matcher eq(new MimeType("text/xml"))</technical_language>

Target:
public void testTransformSourceResponseByMimeType() throws CatalogTransformerException, MimeTypeParseException { BinaryContent mockBinaryContent = mock(BinaryContent.class); QueryResponseTransformer transformer = mock(QueryResponseTransformer.class); when(transformer.transform(any(SourceResponse.class), any(Map.class))) .thenReturn(mockBinaryContent); when(transformerLocator.findQueryResponseTransformers( argThat(isMimeType(new MimeType("text/xml"))))) .thenReturn(Collections.singletonList(transformer)); BinaryContent binaryContent = transform.transform( mock(SourceResponse.class), new MimeType("text/xml"), Collections.emptyMap()); assertThat(binaryContent, is(mockBinaryContent)); }
Source:
<code><START> public void testValidNonPatternName() { <END> Assert.assertTrue(new TestablePoolNameValidation().Validate("pool-T4534f").getSuccess()); }</code><technical_language>need prefix test methods' names "test" - needed in JUnit 3. In JUnit 4 is redundant @Test annotation</technical_language>

Target:
public void testValidNonPatternName() { assertTrue(new TestablePoolNameValidation().Validate("pool-T4534f").getSuccess()); }
Source:
<code>private void shutDownGracefully() { if (log.isDebugEnabled()) log.debugf("Wait for on-going transactions to finish for %s.", Util.prettyPrintTime(configuration.transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS)); long now = System.nanoTime(); long failTime = now + TimeUnit.MILLISECONDS.toNanos(configuration.transaction().cacheStopTimeout()); boolean txsOnGoing = areTxsOnGoing(); while (txsOnGoing && System.nanoTime() - failTime < 0) { try { Thread.sleep(30); txsOnGoing = areTxsOnGoing(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (clustered) { log.debugf("Interrupted waiting for on-going transactions to finish. %s local transactions and %s remote transactions", localTransactions.size(), remoteTransactions.size()); } else { log.debugf("Interrupted waiting for %s on-going transactions to finish.", localTransactions.size()); } } } if (txsOnGoing) { log.unfinishedTransactionsRemain(localTransactions == null ? 0 : localTransactions.size(), remoteTransactions == null ? 0 : remoteTransactions.size()); if (trace) log.tracef("Unfinished local transactions: %s", localTransactions.values().stream().map(tx -> tx.getGlobalTransaction().toString()) <START> .collect(Collectors.joining(", "))); <END> if (trace) log.tracef("Unfinished remote transactions: %s", remoteTransactions.keySet()); } else { log.debug("All transactions terminated"); } }</code><technical_language>noticed output is slightly line below, Collection.toString puts element in square brackets. change Collectors.toList() instead</technical_language>

Target:
private void shutDownGracefully() { if (log.isDebugEnabled()) log.debugf("Wait for on-going transactions to finish for %s.", Util.prettyPrintTime(configuration.transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS)); long now = System.nanoTime(); long failTime = now + TimeUnit.MILLISECONDS.toNanos(configuration.transaction().cacheStopTimeout()); boolean txsOnGoing = areTxsOnGoing(); while (txsOnGoing && System.nanoTime() - failTime < 0) { try { Thread.sleep(30); txsOnGoing = areTxsOnGoing(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (clustered) { log.debugf("Interrupted waiting for on-going transactions to finish. %s local transactions and %s remote transactions", localTransactions.size(), remoteTransactions.size()); } else { log.debugf("Interrupted waiting for %s on-going transactions to finish.", localTransactions.size()); } } } if (txsOnGoing) { log.unfinishedTransactionsRemain(localTransactions == null ? 0 : localTransactions.size(), remoteTransactions == null ? 0 : remoteTransactions.size()); if (trace) { log.tracef("Unfinished local transactions: %s", localTransactions.values().stream().map(tx -> tx.getGlobalTransaction().toString()) .collect(Collectors.joining(", ", "[", "]"))); log.tracef("Unfinished remote transactions: %s", remoteTransactions == null ? "none" : remoteTransactions.keySet()); } } else { log.debug("All transactions terminated"); } }
Source:
<code><START> public void clearJsonFields() { <END> this.newEntity = null; this.oldEntity = null; }</code><technical_language>sense automatically call this method on-persist/commit hook, depending event state</technical_language>

Target:
public void clearJsonFields() { if (!Event.Status.RECEIVED.equals(this.status)) { this.newEntity = null; this.oldEntity = null; } }
Source:
<code>public void loginWithEmailPassword() { <START> new LoginFlow().loginEmailPassword(); <END> }</code><technical_language>this changed</technical_language>

Target:
public void loginWithEmailPassword() { wpLogin(); }
Source:
<code>public static OkHttpClient getHttpClient() { if (sHttpClient == null) { sHttpClient = new OkHttpClient(); sHttpClient.setConnectTimeout(30, TimeUnit.SECONDS); <START> sHttpClient.setConnectTimeout(60, TimeUnit.SECONDS); <END> sHttpClient.setRetryOnConnectionFailure(true); int cacheSize = 10 * 1024 * 1024; File cacheLocation = new File(PrefUtils.get(ButterApplication.getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(ButterApplication.getAppContext()).toString())); cacheLocation.mkdirs(); com.squareup.okhttp.Cache cache = null; try { cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize); } catch (Exception e) { e.printStackTrace(); } sHttpClient.setCache(cache); } return sHttpClient; }</code><technical_language>gonna be? 30 seconds 60 seconds? :P</technical_language>

Target:
public static OkHttpClient getHttpClient() { if (sHttpClient == null) { sHttpClient = new OkHttpClient(); sHttpClient.setConnectTimeout(30, TimeUnit.SECONDS); sHttpClient.setReadTimeout(60, TimeUnit.SECONDS); sHttpClient.setRetryOnConnectionFailure(true); int cacheSize = 10 * 1024 * 1024; File cacheLocation = new File(PrefUtils.get(ButterApplication.getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(ButterApplication.getAppContext()).toString())); cacheLocation.mkdirs(); com.squareup.okhttp.Cache cache = null; try { cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize); } catch (Exception e) { e.printStackTrace(); } sHttpClient.setCache(cache); } return sHttpClient; }
Source:
<code>public User createUser(String email, String password) { User user = createModel(ImmutableMap.of("email", email, "password", password)); user.setRepository(this); return user; <START> } <END></code><technical_language>This implemented return createUser(email, password, null);</technical_language>

Target:
public User createUser(String email, String password) { Map<String, Object> map = new HashMap<String, Object>(); map.put("email", email); map.put("password", password); User user = createModel(map); return user; }
Source:
<code>private static boolean keepChomping(String suffix, int initialSuffixLength, int localMinStemLength) { boolean isSuffix = stemmerSuffixes.contains(suffix); if (!isSuffix) { return !suffix.isEmpty(); } if <START> (isSuffix && <END> (initialSuffixLength - suffix.length()) < localMinStemLength) { return suffix.charAt(0) != '-'; } return false; }</code><technical_language>is true</technical_language>

Target:
private static boolean keepChomping(String suffix, int initialSuffixLength, int localMinStemLength) { boolean isSuffix = STEMMER_SUFFIXES.contains(suffix); if (!isSuffix) { return !suffix.isEmpty(); } if (initialSuffixLength - suffix.length() < localMinStemLength) { return suffix.charAt(0) != '-'; } return false; }
Source:
<code>public User getUserByUsernameOrEmail(String usernameOrEmail) { if (StringUtils.isNotBlank(usernameOrEmail)) { User user = dao.getUserByEmail(usernameOrEmail); if (user == null) { return getUserByUsername(usernameOrEmail); <START> } else { <END> return user; } } throw new APIException("error.usernameOrEmail.notNullOrBlank", (Object[]) null); }</code><technical_language>This else clause is redundant else clause returns, return user</technical_language>

Target:
public User getUserByUsernameOrEmail(String usernameOrEmail) { if (StringUtils.isNotBlank(usernameOrEmail)) { User user = dao.getUserByEmail(usernameOrEmail); if (user == null) { return getUserByUsername(usernameOrEmail); } return user; } throw new APIException("error.usernameOrEmail.notNullOrBlank", (Object[]) null); }