auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private final void init(byte r[], int rOff, int rLen, byte cf[], int cfOff, int cfLen, byte cq[], int cqOff, int cqLen, byte cv[], int cvOff, int cvLen, long ts, boolean del, boolean copy) { row = copyIfNeeded(r, rOff, rLen, copy); colFamily = copyIfNeeded(cf, cfOff, cfLen, copy); colQualifier = copyIfNeeded(cq, cqOff, cqLen, copy); colVisibility = copyIfNeeded(cv, cvOff, cvLen, copy); timestamp = ts; deleted = del; if (!sanityCheckKey()) { <START> throw new IllegalArgumentException("Invalid Key entry. Key exceeds " + Integer.MAX_VALUE + " bytes."); <END> } }</code><technical_language>nice include size. sanityCheck method throw exception</technical_language>

Target:
private final void init(byte r[], int rOff, int rLen, byte cf[], int cfOff, int cfLen, byte cq[], int cqOff, int cqLen, byte cv[], int cvOff, int cvLen, long ts, boolean del, boolean copy) { row = copyIfNeeded(r, rOff, rLen, copy); colFamily = copyIfNeeded(cf, cfOff, cfLen, copy); colQualifier = copyIfNeeded(cq, cqOff, cqLen, copy); colVisibility = copyIfNeeded(cv, cvOff, cvLen, copy); timestamp = ts; deleted = del; }
Source:
<code><START> private SampleListDTO translateToSampleListDto(final SampleListDto dto) throws ParseException { <END> final SampleListDTO sampleListDTO = new SampleListDTO(); sampleListDTO.setCreatedBy(securityService.getCurrentlyLoggedInUser().getName()); sampleListDTO.setCropName(dto.getCropName()); sampleListDTO.setDescription(dto.getDescription()); sampleListDTO.setInstanceIds(dto.getInstanceIds()); sampleListDTO.setNotes(dto.getNotes()); if (!dto.getSamplingDate().isEmpty()) { sampleListDTO.setSamplingDate(DateUtil.getSimpleDateFormat(DateUtil.FRONTEND_DATE_FORMAT).parse(dto.getSamplingDate())); } sampleListDTO.setSelectionVariableId(dto.getSelectionVariableId()); sampleListDTO.setStudyId(dto.getStudyId()); sampleListDTO.setTakenBy(dto.getTakenBy()); return sampleListDTO; }</code><technical_language>This a external mapper</technical_language>

Target:
private SampleListDTO translateToSampleListDto(final SampleListDto dto) throws ParseException { final SampleListDTO sampleListDTO = new SampleListDTO(); sampleListDTO.setCreatedBy(this.securityService.getCurrentlyLoggedInUser().getName()); sampleListDTO.setCropName(dto.getCropName()); sampleListDTO.setDescription(dto.getDescription()); sampleListDTO.setInstanceIds(dto.getInstanceIds()); sampleListDTO.setNotes(dto.getNotes()); if (!dto.getSamplingDate().isEmpty()) { sampleListDTO.setSamplingDate(DateUtil.getSimpleDateFormat(DateUtil.FRONTEND_DATE_FORMAT).parse(dto.getSamplingDate())); } sampleListDTO.setSelectionVariableId(dto.getSelectionVariableId()); sampleListDTO.setStudyId(dto.getStudyId()); sampleListDTO.setTakenBy(dto.getTakenBy()); return sampleListDTO; }
Source:
<code>private ForwardIndexReader<?> getForwardIndexReader(ColumnMetadata columnMetadata) throws IOException { if (!columnMetadata.hasDictionary()) { PinotDataBuffer buffer = _segmentWriter.getIndexFor(columnMetadata.getColumnName(), ColumnIndexType.FORWARD_INDEX); return new VarByteChunkSVForwardIndexReader(buffer, DataType.STRING); } else { PinotDataBuffer buffer = _segmentWriter.getIndexFor(columnMetadata.getColumnName(), ColumnIndexType.FORWARD_INDEX); <START> int numRows = columnMetadata.getTotalDocs(); <END> int numBitsPerValue = columnMetadata.getBitsPerElement(); return new FixedBitSVForwardIndexReader(buffer, numRows, numBitsPerValue); } }</code><technical_language>ColumnIndexType.DICTIONARY</technical_language>

Target:
private ForwardIndexReader<?> getForwardIndexReader(ColumnMetadata columnMetadata) throws IOException { if (!columnMetadata.hasDictionary()) { PinotDataBuffer buffer = _segmentWriter.getIndexFor(columnMetadata.getColumnName(), ColumnIndexType.FORWARD_INDEX); return new VarByteChunkSVForwardIndexReader(buffer, DataType.STRING); } else { PinotDataBuffer buffer = _segmentWriter.getIndexFor(columnMetadata.getColumnName(), ColumnIndexType.FORWARD_INDEX); int numRows = columnMetadata.getTotalDocs(); int numBitsPerValue = columnMetadata.getBitsPerElement(); if (columnMetadata.isSorted()) { return new SortedIndexReaderImpl(buffer, columnMetadata.getCardinality()); } else { return new FixedBitSVForwardIndexReader(buffer, numRows, numBitsPerValue); } } }
Source:
<code>public void setDate(long timeInMilliseconds) { Calendar tempDate = Calendar.getInstance(mConstant.locale); <START> tempDate.setTimeInMillis(timeInMilliseconds); <END> setDate(tempDate.get(Calendar.YEAR), tempDate.get(Calendar.MONTH), tempDate.get(Calendar.DAY_OF_MONTH), false); }</code><technical_language>mTempDate</technical_language>

Target:
public void setDate(long timeInMilliseconds) { mTempDate.setTimeInMillis(timeInMilliseconds); setDate(mTempDate.get(Calendar.YEAR), mTempDate.get(Calendar.MONTH), mTempDate.get(Calendar.DAY_OF_MONTH), false); }
Source:
<code>private void flushAll() throws AuthException { for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { CacheResource cacheResource = new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()); if (FlushCache.WEB_SESSIONS.equals(cacheResource.getName())) { continue; } flushCache.get().apply(cacheResource, <START> new FlushCache.Input()); <END> } }</code><technical_language>new for constant object in loop. pass null, construct instance of looop</technical_language>

Target:
private void flushAll() throws AuthException { for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { CacheResource cacheResource = new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()); if (FlushCache.WEB_SESSIONS.equals(cacheResource.getName())) { continue; } flushCache.apply(cacheResource, null); } }
Source:
<code>public void testElementMultipleRoots() throws XMLStreamException { XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(new StringWriter()); writer.writeStartDocument(); writer.writeStartElement("foo"); writer.writeEndElement(); writer.writeStartElement("bar"); <START> Assert.fail("execution successful without expected exception"); <END> }</code><technical_language>remove assert fail expected Exception is</technical_language>

Target:
public void testElementMultipleRoots() throws XMLStreamException { XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(new StringWriter()); writer.writeStartDocument(); writer.writeStartElement("foo"); writer.writeEndElement(); writer.writeStartElement("bar"); }
Source:
<code>public boolean softKill(final long time, final TimeUnit unit) throws InterruptedException { checkStarted(); if (processId != 0 && isStarted()) { try { if (isExecuteAsUser) { String cmd = <START> String.format("%s %s kill %d", executeAsUserBinary, <END> effectiveUser, processId); Runtime.getRuntime().exec(cmd); } else { Runtime.getRuntime().exec("kill " + processId); } return completeLatch.await(time, unit); } catch (IOException e) { logger.error("Kill attempt failed.", e); } return false; } return false; }</code><technical_language>"kill" a constant KILL_COMMAND</technical_language>

Target:
public boolean softKill(final long time, final TimeUnit unit) throws InterruptedException { checkStarted(); if (processId != 0 && isStarted()) { try { if (isExecuteAsUser) { String cmd = String.format("%s %s %s %d", executeAsUserBinary, effectiveUser, KILL_COMMAND, processId); Runtime.getRuntime().exec(cmd); } else { String cmd = String.format("%s %d", KILL_COMMAND, processId); Runtime.getRuntime().exec(cmd); } return completeLatch.await(time, unit); } catch (IOException e) { logger.error("Kill attempt failed.", e); } return false; } return false; }
Source:
<code>private void createTableReplLogTask(String tableName, TableType tableType) throws SemanticException { ReplStateLogWork replLogWork = new ReplStateLogWork(replLogger,tableName, tableType); Task<ReplStateLogWork> replLogTask = TaskFactory.get(replLogWork, context.hiveConf); <START> ReplLoadTask.dependency(tracker.tasks(), replLogTask); <END> }</code><technical_language>tacker is account this new task added</technical_language>

Target:
private void createTableReplLogTask(String tableName, TableType tableType) throws SemanticException { ReplStateLogWork replLogWork = new ReplStateLogWork(replLogger,tableName, tableType); Task<ReplStateLogWork> replLogTask = TaskFactory.get(replLogWork, context.hiveConf); ReplLoadTask.dependency(tracker.tasks(), replLogTask); if (tracker.tasks().isEmpty()) { tracker.addTask(replLogTask); } else { ReplLoadTask.dependency(tracker.tasks(), replLogTask); List<Task<? extends Serializable>> visited = new ArrayList<>(); tracker.updateTaskCount(replLogTask, visited); } }
Source:
<code>public static List<Trackable> parse(final InputSource page) { try { <START> SAXParserFactory saxPF = SAXParserFactory.newInstance(); <END> SAXParser saxP = saxPF.newSAXParser(); XMLReader xmlR = saxP.getXMLReader(); final GeokretyHandler gkXMLHandler = new GeokretyHandler(); xmlR.setContentHandler(gkXMLHandler); xmlR.parse(page); return gkXMLHandler.getTrackables(); } catch (final Exception e) { Log.w("Cannot parse geokrety", e); } return null; }</code><technical_language>final</technical_language>

Target:
public static List<Trackable> parse(final InputSource page) { try { final SAXParserFactory saxPF = SAXParserFactory.newInstance(); final SAXParser saxP = saxPF.newSAXParser(); final XMLReader xmlR = saxP.getXMLReader(); final GeokretyHandler gkXMLHandler = new GeokretyHandler(); xmlR.setContentHandler(gkXMLHandler); xmlR.parse(page); return gkXMLHandler.getTrackables(); } catch (final Exception e) { Log.w("Cannot parse geokrety", e); } return null; }
Source:
<code>public void showIfNeeded(Context context, Feed feed) { if (dontShowNotification) { return; } long feedId = feed.getId(); <START> int episodeCount = PodDBAdapter.getInstance().getFeedCounters(feedId).get(feedId); <END> int newEpisodes = episodeCount - lastEpisodeCount; if (newEpisodes > 0) { NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); showNotification(newEpisodes, feed, context, notificationManager); } }</code><technical_language>if adapter's open close methods currently do much, please for consistency. suggestion PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); int episodeCount = adapter.getFeedCounters(feedId).get(feedId); adapter.close();</technical_language>

Target:
public void showIfNeeded(Context context, Feed feed) { if (!shouldShowNotification) { return; } long feedId = feed.getId(); int newEpisodes = getNewEpisodeCount(feedId); if (newEpisodes > lastEpisodeCount) { NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); showNotification(newEpisodes, feed, context, notificationManager); } }
Source:
<code>public void shouldConcatenateDoseStrengthAndUnits() throws IOException, SQLException { upgradeTestUtil.executeDataset("/org/openmrs/util/databasechange/standardTest-1.9.7-dataSet.xml"); upgradeTestUtil.executeDataset("/org/openmrs/util/databasechange/database1_9To1_10UpgradeTest-dataSet.xml"); createOrderEntryUpgradeFileWithTestData("mg=111\ntab(s)=112\n1/day\\ x\\ 7\\ days/week=113\n2/day\\ x\\ 7\\ days/week=114"); upgradeTestUtil.upgrade(); <START> List<Map<String, String>> drugs = upgradeTestUtil.select("drug", "strength"); <END> Assert.assertThat(drugs.size(), Matchers.is(3)); Assert.assertTrue(drugs.get(1).containsValue("325.0mg")); }</code><technical_language>nice ensure rows strength units null upgrade</technical_language>

Target:
public void shouldConcatenateDoseStrengthAndUnits() throws IOException, SQLException { upgradeTestUtil.executeDataset("/org/openmrs/util/databasechange/standardTest-1.9.7-dataSet.xml"); upgradeTestUtil.executeDataset("/org/openmrs/util/databasechange/database1_9To1_10UpgradeTest-dataSet.xml"); createOrderEntryUpgradeFileWithTestData("mg=111\ntab(s)=112\n1/day\\ x\\ 7\\ days/week=113\n2/day\\ x\\ 7\\ days/week=114"); upgradeTestUtil.upgrade(); List<Map<String, String>> drugs = upgradeTestUtil.select("drug", "strength"); Assert.assertThat(drugs.size(), Matchers.is(3)); Assert.assertTrue(drugs.get(0).containsValue("1.0tab(s)")); Assert.assertTrue(drugs.get(1).containsValue("325.0mg")); Assert.assertTrue(drugs.get(2).get("strength").isEmpty()); }
Source:
<code>private static boolean hasFakeSequence(PoolableElementView view) { return view.getIndices().stream() .map(Index::getFamily) .map(IndexFamily::getFake) <START> .reduce(false, (a, b) -> a || b); <END> }</code><technical_language>Java streams a built in anyMatch instead of a reduce</technical_language>

Target:
private static boolean hasFakeSequence(PoolableElementView view) { return view.getIndices().stream() .map(Index::getFamily) .anyMatch(f -> f.hasFakeSequence()); }
Source:
<code>public T createOrReplace(T... items) { T itemToCreateOrReplace = getItem(); if (items.length > 1) { throw new IllegalArgumentException("Too many items to create."); } else if (items.length == 1) { itemToCreateOrReplace = items[0]; } if (itemToCreateOrReplace == null) { throw new IllegalArgumentException("Nothing to create."); } if (Utils.isNullOrEmpty(name)) { <START> return withName(itemToCreateOrReplace.getMetadata().getName()).createOrReplace(itemToCreateOrReplace); <END> } String resourceVersion = KubernetesResourceUtil.getResourceVersion(itemToCreateOrReplace); try { KubernetesResourceUtil.setResourceVersion(itemToCreateOrReplace, null); return create(itemToCreateOrReplace); } catch (KubernetesClientException exception) { if (exception.getCode() != HttpURLConnection.HTTP_CONFLICT) { throw exception; } T itemFromServer = fromServer().get(); if (ResourceCompare.equals(itemFromServer, itemToCreateOrReplace)) { return itemToCreateOrReplace; } else { KubernetesResourceUtil.setResourceVersion(itemToCreateOrReplace, resourceVersion); return replace(itemToCreateOrReplace); } } }</code><technical_language>guessing this recurses this function</technical_language>

Target:
public T createOrReplace(T... items) { T itemToCreateOrReplace = getItem(); if (items.length > 1) { throw new IllegalArgumentException("Too many items to create."); } else if (items.length == 1) { itemToCreateOrReplace = items[0]; } if (itemToCreateOrReplace == null) { throw new IllegalArgumentException("Nothing to create."); } if (Utils.isNullOrEmpty(name)) { return withName(itemToCreateOrReplace.getMetadata().getName()).createOrReplace(itemToCreateOrReplace); } try { KubernetesResourceUtil.setResourceVersion(itemToCreateOrReplace, null); return create(itemToCreateOrReplace); } catch (KubernetesClientException exception) { if (exception.getCode() != HttpURLConnection.HTTP_CONFLICT) { throw exception; } T itemFromServer = fromServer().get(); if (ResourceCompare.equals(itemFromServer, itemToCreateOrReplace)) { return itemToCreateOrReplace; } else { KubernetesResourceUtil.setResourceVersion(itemToCreateOrReplace, KubernetesResourceUtil.getResourceVersion(itemFromServer)); return replace(itemToCreateOrReplace); } } }
Source:
<code>public void initTempFile() throws Exception { <START> _tempFile = File.createTempFile("csv_file_analyzer", ".csv"); <END> }</code><technical_language>I guess if "columnToBeSortedOn" is null (sorting is turned off), write a temp file. write final file directly. rename "_tempFile" variable call a la "_targetFile". initialize null check</technical_language>

Target:
public void initTempFile() throws Exception { if(columnToBeSortedOn != null) { _targetFile = File.createTempFile("csv_file_analyzer", ".csv"); } else { _targetFile = file ; } }
Source:
<code>private int executeWithTimeout(CommandLine command, int timeout) throws LbAdapterExecuteException, IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(baos)); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); try { long start = System.currentTimeMillis(); executor.execute(command, resultHandler); while (System.currentTimeMillis() - start < timeout && !resultHandler.hasResult()) { Thread.sleep(50); } if (resultHandler.hasResult()) { <START> return resultHandler.getExitValue(); <END> } else { throw new LbAdapterExecuteException(baos.toString(Charsets.UTF_8.name()), command.toString()); } } catch (ExecuteException|InterruptedException e) { throw new LbAdapterExecuteException(baos.toString(Charsets.UTF_8.name()), e, command.toString()); } }</code><technical_language>docs clear, this return null if execution completed exceptionally. Do want check getException() explicitly here, is unnecessary</technical_language>

Target:
private int executeWithTimeout(CommandLine command, int timeout) throws LbAdapterExecuteException, IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(baos)); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); try { long start = System.currentTimeMillis(); executor.execute(command, resultHandler); while (System.currentTimeMillis() - start < timeout && !resultHandler.hasResult()) { Thread.sleep(50); } if (resultHandler.hasResult()) { if (resultHandler.getException() != null) { throw resultHandler.getException(); } return resultHandler.getExitValue(); } else { throw new LbAdapterExecuteException(baos.toString(Charsets.UTF_8.name()), command.toString()); } } catch (ExecuteException|InterruptedException e) { throw new LbAdapterExecuteException(baos.toString(Charsets.UTF_8.name()), e, command.toString()); } }
Source:
<code>public TransactionHandle bindConnection(Object connection) throws ConnectionException, TransactionException { checkArgument(connection != null, "Cannot bind a null connection"); if (this.connection != null) { throw new IllegalStateException("Connection can only be set once per " + SourceCallbackContext.class.getSimpleName()); } this.connection = connection; try { if (sourceCallback.getTransactionConfig().isTransacted() && connection instanceof TransactionalConnection) { ConnectionHandler<Object> connectionHandler = sourceCallback.getSourceConnectionManager().getConnectionHandler(connection) .orElseThrow(() -> new TransactionException(createWrongConnectionMessage(connection))); sourceCallback.getTransactionSourceBinder().bindToTransaction(sourceCallback.getTransactionConfig(), sourceCallback.getConfigurationInstance(), sourceCallback.getSourceLocation(), connectionHandler); transactionHandle = DEFAULT_TRANSACTION_HANDLE; } <START> } catch (TransactionException txE) { <END> releaseConnection(); throw txE; } return transactionHandle; }</code><technical_language>this generic one? happen for unexpected exception</technical_language>

Target:
public TransactionHandle bindConnection(Object connection) throws ConnectionException, TransactionException { checkArgument(connection != null, "Cannot bind a null connection"); if (this.connection != null) { throw new IllegalStateException("Connection can only be set once per " + SourceCallbackContext.class.getSimpleName()); } this.connection = connection; try { if (sourceCallback.getTransactionConfig().isTransacted() && connection instanceof TransactionalConnection) { ConnectionHandler<Object> connectionHandler = sourceCallback.getSourceConnectionManager().getConnectionHandler(connection) .orElseThrow(() -> new TransactionException(createWrongConnectionMessage(connection))); sourceCallback.getTransactionSourceBinder().bindToTransaction(sourceCallback.getTransactionConfig(), sourceCallback.getConfigurationInstance(), sourceCallback.getSourceLocation(), connectionHandler); transactionHandle = DEFAULT_TRANSACTION_HANDLE; } } catch (Exception e) { releaseConnection(); throw e; } return transactionHandle; }
Source:
<code>public Result getResult(Input input) { this.master.doWork(input); <START> return master.getFinalResult(); <END> }</code><technical_language>one-liner</technical_language>

Target:
public Result getResult(Input input) { this.master.doWork(input); return this.master.getFinalResult(); }
Source:
<code>protected boolean canDoAction() { List<String> canDoActionMessages = getReturnValue().getCanDoActionMessages(); Map<Guid, storage_domains> domainsMap = new HashMap<Guid, storage_domains>(); <START> if (!canDoAction_beforeCloneVm(canDoActionMessages, domainsMap)) { <END> return false; } if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); } if (!canDoAction_afterCloneVm(canDoActionMessages, domainsMap)) { return false; } return true; }</code><technical_language>Suggestion: I consider remove canDoActionMessages here, instead call in canDoAction_beforeCloneVm canDoAction_afterCloneVm. (It CDA more shorter I is more performance wise)</technical_language>

Target:
protected boolean canDoAction() { Map<Guid, storage_domains> domainsMap = new HashMap<Guid, storage_domains>(); if (!canDoAction_beforeCloneVm(domainsMap)) { return false; } if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); } return canDoAction_afterCloneVm(domainsMap); }
Source:
<code><START> public GarbageCollectionStatus getGarbageCollectionStatus() { <END> boolean forceCompacting = ledgerStorageList.stream() .anyMatch(single -> single.getGarbageCollectionStatus().isForceCompacting()); boolean majorCompacting = ledgerStorageList.stream() .anyMatch(single -> single.getGarbageCollectionStatus().isMajorCompacting()); boolean minorCompacting = ledgerStorageList.stream() .anyMatch(single -> single.getGarbageCollectionStatus().isMinorCompacting()); long lastMajorCompactionTime = ledgerStorageList.stream() .mapToLong(single -> single.getGarbageCollectionStatus().getLastMajorCompactionTime()).max().getAsLong(); long lastMinorCompactionTime = ledgerStorageList.stream() .mapToLong(single -> single.getGarbageCollectionStatus().getLastMinorCompactionTime()).max().getAsLong(); long majorCompactionCounter = ledgerStorageList.stream() .mapToLong(single -> single.getGarbageCollectionStatus().getMajorCompactionCounter()).sum(); long minorCompactionCounter = ledgerStorageList.stream() .mapToLong(single -> single.getGarbageCollectionStatus().getMinorCompactionCounter()).sum(); return GarbageCollectionStatus.builder() .forceCompacting(forceCompacting) .majorCompacting(majorCompacting) .minorCompacting(minorCompacting) .lastMajorCompactionTime(lastMajorCompactionTime) .lastMinorCompactionTime(lastMinorCompactionTime) .majorCompactionCounter(majorCompactionCounter) .minorCompactionCounter(minorCompactionCounter) .build(); }</code><technical_language>I suggest returning List<GarbageCollectionStatus>, in DbLedgerStorage is a list of storage instances</technical_language>

Target:
public List<GarbageCollectionStatus> getGarbageCollectionStatus() { return ledgerStorageList.stream() .map(single -> single.getGarbageCollectionStatus().get(0)).collect(Collectors.toList()); }
Source:
<code>public void testXmlElements() throws Exception { File in = new File(COMPILE_JSP_SEVER_XML); FileInputStream input = new FileInputStream(in); DocumentBuilderFactory inputBuilderFactory = DocumentBuilderFactory.newInstance(); inputBuilderFactory.setIgnoringComments(true); inputBuilderFactory.setCoalescing(true); inputBuilderFactory.setIgnoringElementContentWhitespace(true); inputBuilderFactory.setValidating(false); DocumentBuilder inputBuilder = inputBuilderFactory.newDocumentBuilder(); Document inputDoc=inputBuilder.parse(input); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "/server/featureManager/feature[text()]"; NodeList nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET); Assert.assertEquals("Number of <feature/> elements ==>", 3, nodes.getLength()); <START> Assert.assertEquals("Value of first <feature/> ==>", "ejbLite-3.2", nodes.item(0).getTextContent()); <END> Assert.assertEquals("Value of second <feature/> ==>", "mongodb-2.0", nodes.item(1).getTextContent()); Assert.assertEquals("Value of third <feature/> ==>", "jsp-2.3", nodes.item(2).getTextContent()); }</code><technical_language>Depending OS JDK, I order of vary. safer a collection of expected values check values in file contained in collection</technical_language>

Target:
public void testXmlElements() throws Exception { File in = new File(COMPILE_JSP_SEVER_XML); FileInputStream input = new FileInputStream(in); DocumentBuilderFactory inputBuilderFactory = DocumentBuilderFactory.newInstance(); inputBuilderFactory.setIgnoringComments(true); inputBuilderFactory.setCoalescing(true); inputBuilderFactory.setIgnoringElementContentWhitespace(true); inputBuilderFactory.setValidating(false); DocumentBuilder inputBuilder = inputBuilderFactory.newDocumentBuilder(); Document inputDoc=inputBuilder.parse(input); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "/server/featureManager/feature[text()]"; NodeList nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET); Assert.assertEquals("Number of <feature/> elements ==>", 3, nodes.getLength()); ArrayList<String> features = new ArrayList<String>(); for(int i = 0; i < nodes.getLength(); i++) { features.add(nodes.item(i).getTextContent().trim()); } Assert.assertTrue("ejbLite-3.2 <feature/> found ==>", features.contains("ejbLite-3.2")); Assert.assertTrue("mongodb-2.0 <feature/> found ==>", features.contains("mongodb-2.0")); Assert.assertTrue("jsp-2.3 <feature/> found ==>", features.contains("jsp-2.3")); }
Source:
<code>public void testStorageLocation() throws Exception { long expectedAvail = 1000L; <START> File location = temporaryFolder.newFolder("/tmp"); <END> StorageLocation loc = new StorageLocation(location, expectedAvail); verifyLoc(expectedAvail, loc); final DataSegment secondSegment = makeSegment("2012-01-02/2012-01-03", 23); loc.addSegment(makeSegment("2012-01-01/2012-01-02", 10)); expectedAvail -= 10; verifyLoc(expectedAvail, loc); loc.addSegment(makeSegment("2012-01-01/2012-01-02", 10)); verifyLoc(expectedAvail, loc); loc.addSegment(secondSegment); expectedAvail -= 23; verifyLoc(expectedAvail, loc); loc.removeSegment(makeSegment("2012-01-01/2012-01-02", 10)); expectedAvail += 10; verifyLoc(expectedAvail, loc); loc.removeSegment(makeSegment("2012-01-01/2012-01-02", 10)); verifyLoc(expectedAvail, loc); loc.removeSegment(secondSegment); expectedAvail += 23; verifyLoc(expectedAvail, loc); }</code><technical_language>this newFolder()? /tmp requirement previously existing is a bug in testing procedure</technical_language>

Target:
public void testStorageLocation() throws Exception { long expectedAvail = 1000L; File location = temporaryFolder.newFolder(); StorageLocation loc = new StorageLocation(location, expectedAvail); verifyLoc(expectedAvail, loc); final DataSegment secondSegment = makeSegment("2012-01-02/2012-01-03", 23); loc.addSegment(makeSegment("2012-01-01/2012-01-02", 10)); expectedAvail -= 10; verifyLoc(expectedAvail, loc); loc.addSegment(makeSegment("2012-01-01/2012-01-02", 10)); verifyLoc(expectedAvail, loc); loc.addSegment(secondSegment); expectedAvail -= 23; verifyLoc(expectedAvail, loc); loc.removeSegment(makeSegment("2012-01-01/2012-01-02", 10)); expectedAvail += 10; verifyLoc(expectedAvail, loc); loc.removeSegment(makeSegment("2012-01-01/2012-01-02", 10)); verifyLoc(expectedAvail, loc); loc.removeSegment(secondSegment); expectedAvail += 23; verifyLoc(expectedAvail, loc); }
Source:
<code>private void asyncNewSession() { if (refreshing.compareAndSet(false, true)) { try { new Thread() { @Override public void run() { <START> if (asyncRefreshing.compareAndSet(false, true)) { <END> try { casNewSession(); } finally { asyncRefreshing.set(false); } } } }.start(); } finally { refreshing.set(false); } } }</code><technical_language>avoid creating thread altogether if asyncRefreshing is false</technical_language>

Target:
private void asyncNewSession() { if (asyncRefreshing.compareAndSet(false, true)) { try { refreshThread.set(new Thread() { @Override public void run() { try { newSessionLock.lock(); sessionCredentials.compareAndSet(sessionCredentials.get(), newSession()); newSessionCondition.signalAll(); lastException.set(null); } catch (Exception e) { lastException.set(e); } finally { asyncRefreshing.set(false); newSessionLock.unlock(); } } }); refreshThread.get().start(); } catch (RuntimeException ex) { asyncRefreshing.set(false); throw ex; } } }
Source:
<code>private InputStream loadResource() { <START> final String RESOURCE_LOC = "/heron/common/tests/resources/defaults.yaml"; <END> InputStream inputStream = ConfigReaderTest.class. getResourceAsStream(RESOURCE_LOC); if (inputStream == null) { throw new RuntimeException("Sample output file not found"); } return inputStream; }</code><technical_language>please change a class-level psf String</technical_language>

Target:
private InputStream loadResource() { InputStream inputStream = ConfigReaderTest.class. getResourceAsStream(RESOURCE_LOC); if (inputStream == null) { throw new RuntimeException("Sample output file not found"); } return inputStream; }
Source:
<code>public static XDDFCategoryDataSource fromDataSource(final CTAxDataSource categoryDS) { if (categoryDS.getStrRef() == null) { <START> return new XDDFCategoryDataSource() { <END> private CTNumData category = (CTNumData) categoryDS.getNumRef().getNumCache().copy(); @Override public String getFormula() { return categoryDS.getNumRef().getF(); } @Override public boolean isNumeric() { return true; } @Override public boolean isReference() { return true; } @Override public int getPointCount() { return (int) category.getPtCount().getVal(); } @Override public String getPointAt(int index) { return category.getPtArray(index).getV(); } @Override public String getDataRangeReference() { return categoryDS.getStrRef().getF(); } @Override public int getColIndex() { return 0; } }; } else { return new XDDFCategoryDataSource() { private CTStrData category = (CTStrData) categoryDS.getStrRef().getStrCache().copy(); @Override public String getFormula() { return categoryDS.getStrRef().getF(); } @Override public boolean isNumeric() { return false; } @Override public boolean isReference() { return true; } @Override public int getPointCount() { return (int) category.getPtCount().getVal(); } @Override public String getPointAt(int index) { return category.getPtArray(index).getV(); } @Override public String getDataRangeReference() { return categoryDS.getStrRef().getF(); } @Override public int getColIndex() { return 0; } }; } }</code><technical_language>of code in 2 anonymous classes is - create class shared code 2 anonymous classes extend it</technical_language>

Target:
public static XDDFCategoryDataSource fromDataSource(final CTAxDataSource categoryDS) { if (categoryDS.getStrRef() == null) { return new XDDFCategoryDataSource() { private CTNumData category = (CTNumData) categoryDS.getNumRef().getNumCache().copy(); @Override public boolean isNumeric() { return true; } @Override public String getFormula() { return categoryDS.getNumRef().getF(); } @Override public int getPointCount() { return (int) category.getPtCount().getVal(); } @Override public String getPointAt(int index) { return category.getPtArray(index).getV(); } }; } else { return new XDDFCategoryDataSource() { private CTStrData category = (CTStrData) categoryDS.getStrRef().getStrCache().copy(); @Override public String getFormula() { return categoryDS.getStrRef().getF(); } @Override public int getPointCount() { return (int) category.getPtCount().getVal(); } @Override public String getPointAt(int index) { return category.getPtArray(index).getV(); } }; } }
Source:
<code>public Handle<?> upload(LogFilePath localPath) throws Exception { String prefix = FileUtil.getPrefix(localPath.getTopic(), mConfig); LogFilePath path = localPath.withPrefix(prefix); final String localLogFilename = localPath.getLogFilePath(); final String logFileName; final String topicName = localPath.getTopic(); final Map<String,String> customTopicsNamesMap = getCustomTopicsNamesMap(mConfig); if (FileUtil.s3PathPrefixIsAltered(path.getLogFilePath(), mConfig)) { logFileName = localPath.withPrefix(FileUtil.getS3AlternativePrefix(mConfig)).getLogFilePath(); LOG.info("Will upload file to alternative s3 prefix path {}", logFileName); } else { logFileName = path.getLogFilePath(); } LOG.info("uploading file to {}", localLogFilename, logFileName); final Future<?> f = executor.submit(new Runnable() { @Override public void run() { try { if (customTopicsNamesMap != null) { String logFileNameCustomTopicName = logFileName; logFileNameCustomTopicName = logFileNameCustomTopicName.replace(topicName, customTopicsNamesMap.get(topicName)); FileUtil.moveToCloud(localLogFilename, logFileNameCustomTopicName); <START> }else { <END> FileUtil.moveToCloud(localLogFilename, logFileName); } } catch (IOException e) { throw new RuntimeException(e); } } }); return new FutureHandle(f); }</code><technical_language>Coding style: need a space }</technical_language>

Target:
public Handle<?> upload(LogFilePath localPath) throws Exception { String prefix = FileUtil.getPrefix(localPath.getTopic(), mConfig); LogFilePath path = localPath.withPrefix(prefix); path.setCustomTopicsNames(mConfig.getCustomTopicsNames()); final String localLogFilename = localPath.getLogFilePath(); final String logFileName; if (FileUtil.s3PathPrefixIsAltered(path.getLogFilePath(), mConfig)) { logFileName = localPath.withPrefix(FileUtil.getS3AlternativePrefix(mConfig)) .getLogFilePath(); LOG.info("Will upload file to alternative s3 prefix path {}", logFileName); } else { logFileName = path.getLogFilePath(); } LOG.info("uploading file to {}", localLogFilename, logFileName); final Future<?> f = executor.submit(new Runnable() { @Override public void run() { try { FileUtil.moveToCloud(localLogFilename, logFileName); } catch (IOException e) { throw new RuntimeException(e); } } }); return new FutureHandle(f); }
Source:
<code>public Connection getConnection(IDatabaseInfo dbInfo) throws Exception { Class.forName(JDBC_DRIVER); if (firstTime.compareAndSet(true, false)) { Pair<String, Integer> addressAndPort = OseeProperties.getOseeDbEmbeddedServerAddress(); <START> if (addressAndPort != null) { <END> int webPort = OseeProperties.getOseeDbEmbeddedWebServerPort(); if (webPort < 0) { webPort = PortUtil.getInstance().getValidPort(); } HyperSqlDbServer.startServer(addressAndPort.getFirst(), addressAndPort.getSecond(), webPort, dbInfo); } } Properties props = dbInfo.getConnectionProperties(); StringBuilder builder = new StringBuilder(); builder.append(dbInfo.getConnectionUrl()); HyperSqlServerUtil.appendProperties(builder, props); String url = builder.toString(); Connection connection = DriverManager.getConnection(url, props); return connection; }</code><technical_language>fail eariler accounting for null</technical_language>

Target:
public Connection getConnection(IDatabaseInfo dbInfo) throws Exception { Class.forName(JDBC_DRIVER); if (firstTime.compareAndSet(true, false)) { Pair<String, Integer> addressAndPort = OseeProperties.getOseeDbEmbeddedServerAddress(); if (addressAndPort != null) { int webPort = OseeProperties.getOseeDbEmbeddedWebServerPort(); if (webPort < 0) { webPort = PortUtil.getInstance().getValidPort(); } HyperSqlDbServer.startServer(addressAndPort.getFirst(), addressAndPort.getSecond(), webPort, dbInfo); } } Properties props = dbInfo.getConnectionProperties(); StringBuilder builder = new StringBuilder(); builder.append(dbInfo.getConnectionUrl()); HyperSqlServerUtil.appendProperties(builder, props); String url = builder.toString(); return DriverManager.getConnection(url, props); }
Source:
<code>public boolean filterOut(final SAMRecord record) { <START> boolean read1 = findOverlaps(record.getReferenceName(), record.getStart(), record.getEnd()); <END> boolean read2 = true; if (!record.getMateUnmappedFlag()) { read2 = findOverlaps(record.getMateReferenceName(), record.getMateAlignmentStart(), SAMUtils.getMateAlignmentEnd(record)); } if (read1 || read2) { return false; } else { return true; } }</code><technical_language>final</technical_language>

Target:
public boolean filterOut(final SAMRecord record) { if (record.isSecondaryOrSupplementary()) { return true; } if (!record.getReadUnmappedFlag() && hasOverlaps(record.getReferenceName(), record.getStart(), record.getEnd())) { return false; } return record.getMateUnmappedFlag() || !hasOverlaps(record.getMateReferenceName(), record.getMateAlignmentStart(), SAMUtils.getMateAlignmentEnd(record)); }
Source:
<code>public void refreshTable(boolean needToSort) { <START> if (Ode.getInstance().getCurrentView() == 8) { <END> refreshTable(needToSort, true); } else { refreshTable(needToSort, false); } }</code><technical_language>Consider making constants in Ode.java public reference TRASHCAN instead of replicating constant. want consider turning integers enum</technical_language>

Target:
public void refreshTable(boolean needToSort) { if (Ode.getInstance().getCurrentView() == Ode.TRASHCAN) { refreshTable(needToSort, true); } else { refreshTable(needToSort, false); } }
Source:
<code>protected String checkAndTransformValue(Value input) { <START> if (nullable && input.isEmptyString()) { <END> return null; } return input.getString(); }</code><technical_language>this default? null instead of "" - ifthe parameter isn marked nullable yield null Value.getString() filter null - asString do this</technical_language>

Target:
protected String checkAndTransformValue(Value input) { if (input.isEmptyString()) { return null; } return input.getString(); }
Source:
<code><START> public static Long getWSClientReceiveTimeout() throws Exception { <END> String defaultTimeout = "60000"; String inputTimeout = System.getProperty(WS_CLIENT_RECEIVE_TIME_VALUE); if (inputTimeout != null) { try { long timeout = Long.parseLong(inputTimeout); if (timeout > 0) { return new Long(inputTimeout); } } catch (Exception exception) { throw new RuntimeException("Webservice client receive timeout value '" + inputTimeout + "' is invalid", exception); } } return new Long(defaultTimeout); }</code><technical_language>beeter int type</technical_language>

Target:
public static int getWSClientReceiveTimeout() throws Exception { int defaultTimeout = 60000; String inputTimeout = System.getProperty(WS_CLIENT_RECEIVE_TIME_VALUE); if (inputTimeout != null) { try { int timeout = Integer.parseInt(inputTimeout); if (timeout > 0) { return timeout; } } catch (Exception exception) { throw new RuntimeException("Webservice client receive timeout value '" + inputTimeout + "' is invalid", exception); } } return defaultTimeout; }
Source:
<code>private void checkUnsupportedOperationsForFSTIndex(ColumnMetadata columnMetadata) { String column = columnMetadata.getColumnName(); if (columnMetadata.getDataType() != FieldSpec.DataType.STRING) { throw new UnsupportedOperationException("FST index is currently only supported on STRING columns: " + column); } if (!columnMetadata.hasDictionary()) { throw new UnsupportedOperationException("FST index is currently only supported on dictionary encoded columns: " + column); } if (!columnMetadata.isSingleValue()) { throw new UnsupportedOperationException( <START> "Text index is currently not supported on multi-value columns: " + column); <END> } }</code><technical_language>Fix log</technical_language>

Target:
private void checkUnsupportedOperationsForFSTIndex(ColumnMetadata columnMetadata) { String column = columnMetadata.getColumnName(); if (columnMetadata.getDataType() != FieldSpec.DataType.STRING) { throw new UnsupportedOperationException("FST index is currently only supported on STRING columns: " + column); } if (!columnMetadata.hasDictionary()) { throw new UnsupportedOperationException( "FST index is currently only supported on dictionary encoded columns: " + column); } if (!columnMetadata.isSingleValue()) { throw new UnsupportedOperationException("FST index is currently not supported on multi-value columns: " + column); } }
Source:
<code>public Configuration getServiceConfigurationWithoutNameResolver() { final Configuration networkConf = getNetworkConfigurationBuilder() .bindNamedParameter(EMMessageHandler.class, edu.snu.cay.services.em.evaluator.ElasticMemoryMsgHandler.class) .build(); final Configuration serviceConf = ServiceConfiguration.CONF .set(ServiceConfiguration.SERVICES, MemoryStoreImpl.class) .build(); final String evalId = EVAL_ID_PREFIX + numEvals.getAndIncrement(); <START> partitionManager.registerEvaluator(evalId.toString()); <END> final Configuration otherConf = Tang.Factory.getTang().newConfigurationBuilder() .bindImplementation(MemoryStore.class, MemoryStoreImpl.class) .bindNamedParameter(EMEvalId.class, evalId) .bindNamedParameter(DriverIdentifier.class, driverId) .build(); return Configurations.merge(networkConf, serviceConf, otherConf); }</code><technical_language>evalId is a string</technical_language>

Target:
public Configuration getServiceConfigurationWithoutNameResolver() { final Configuration networkConf = getNetworkConfigurationBuilder() .bindNamedParameter(EMMessageHandler.class, edu.snu.cay.services.em.evaluator.ElasticMemoryMsgHandler.class) .build(); final Configuration serviceConf = ServiceConfiguration.CONF .set(ServiceConfiguration.SERVICES, MemoryStoreImpl.class) .build(); final String evalId = EVAL_ID_PREFIX + numEvals.getAndIncrement(); partitionManager.registerEvaluator(evalId); final Configuration otherConf = Tang.Factory.getTang().newConfigurationBuilder() .bindImplementation(MemoryStore.class, MemoryStoreImpl.class) .bindNamedParameter(EMEvalId.class, evalId) .bindNamedParameter(DriverIdentifier.class, driverId) .build(); return Configurations.merge(networkConf, serviceConf, otherConf); }
Source:
<code>public void tearDown() throws Exception { <START> workspaceServiceClient.delete(WORKSPACE_NAME, defaultTestUser.getName()); <END> workspaceServiceClient.delete(WORKSPACE_NAME2, defaultTestUser.getName()); workspaceServiceClient.delete(WORKSPACE_NAME3, defaultTestUser.getName()); }</code><technical_language>removal of workspace wilh NEWEST_CREATED_WORKSPACE_NAME name class well</technical_language>

Target:
public void tearDown() throws Exception { workspaceServiceClient.delete(WORKSPACE_NAME, defaultTestUser.getName()); workspaceServiceClient.delete(WORKSPACE_NAME2, defaultTestUser.getName()); workspaceServiceClient.delete(NEWEST_CREATED_WORKSPACE_NAME, defaultTestUser.getName()); }
Source:
<code><START> public void testShouldThrottle() { <END> LeaveGroupResponse response = new LeaveGroupResponse(new LeaveGroupResponseData()); assertFalse(response.shouldClientThrottle((short) 0)); assertFalse(response.shouldClientThrottle((short) 1)); assertTrue(response.shouldClientThrottle((short) 2)); }</code><technical_language>nit: this relative latest version do in other tests</technical_language>

Target:
public void testShouldThrottle() { LeaveGroupResponse response = new LeaveGroupResponse(new LeaveGroupResponseData()); for (short version = 0; version <= ApiKeys.LEAVE_GROUP.latestVersion(); version++) { if (version >= 2) { assertTrue(response.shouldClientThrottle(version)); } else { assertFalse(response.shouldClientThrottle(version)); } } }
Source:
<code>public TmfXmlReadOnlyStateValue(TmfXmlReadOnlyModelFactory modelFactory, Element node, IXmlStateSystemContainer container, String eventField) { <START> super(modelFactory, node, container, new ArrayList<ITmfXmlStateAttribute>(), eventField); <END> }</code><technical_language>Collections.EMPTY_LIST</technical_language>

Target:
public TmfXmlReadOnlyStateValue(TmfXmlReadOnlyModelFactory modelFactory, Element node, IXmlStateSystemContainer container, String eventField) { super(modelFactory, node, container, Collections.EMPTY_LIST, eventField); }
Source:
<code>protected boolean authorize() { try { IAuthorizationContext context = client.getAuthorizationContext(); if (!context.isAuthorized() && credentialsPrompter != null && promptCredentialsEnabled){ credentialsPrompter.promptAndAuthenticate(this, null); } else { <START> updateCredentials(context); <END> } } catch (UnauthorizedException e) { if (isEnablePromptCredentials() && credentialsPrompter != null) { credentialsPrompter.promptAndAuthenticate(this, e.getAuthorizationDetails()); } else { throw e; } } return getToken() != null; }</code><technical_language>If context is authorized prompter is null (or enabled), updateCredentials called anyway. Is be? Though, if sets empty token in this case, ok</technical_language>

Target:
protected boolean authorize() { try { IAuthorizationContext context = loadAuthorizationContext(); if (!context.isAuthorized() && credentialsPrompter != null && promptCredentialsEnabled){ credentialsPrompter.promptAndAuthenticate(this, null); } else { updateCredentials(context); } } catch (UnauthorizedException e) { if (isEnablePromptCredentials() && credentialsPrompter != null) { credentialsPrompter.promptAndAuthenticate(this, e.getAuthorizationDetails()); } else { throw e; } } return getToken() != null; }
Source:
<code>private void checkStaticInitializer(MethodNode methodNode, IFilterOutput output) { AbstractInsnNode preClinitNode = null; for (AbstractInsnNode node = methodNode.instructions.getFirst(); node != null; node = node.getNext()) { <START> if (node.getOpcode() == Opcodes.INVOKESTATIC) { <END> String name = ((MethodInsnNode) node).name; if (name.equals("ajc$preClinit")) { if (isEffectivelyLast(node.getNext())) { output.ignore(methodNode.instructions.getFirst(), methodNode.instructions.getLast()); return; } else { preClinitNode = node; output.ignore(methodNode.instructions.getFirst(), node); } } if (name.equals("ajc$postClinit")) { if (isEffectivelyFirst(node.getPrevious()) || (preClinitNode != null && node == getNextRealOp(preClinitNode)) ) { output.ignore(methodNode.instructions.getFirst(), methodNode.instructions.getLast()); return; } else { output.ignore(node, methodNode.instructions.getLast()); } } } } }</code><technical_language>Inversion of condition usage of continue reduce nesting of this code improve readability. note AbstractMatcher simplifies matching of bytecode. here</technical_language>

Target:
private void checkStaticInitializer(MethodNode methodNode, IFilterOutput output) { PreClinitMatcher preClinitMatcher = new PreClinitMatcher(methodNode); AbstractInsnNode match = preClinitMatcher.match(); if (match != null) { output.ignore(methodNode.instructions.getFirst(), match); } for (TryCatchBlockNode tryCatchBlock : methodNode.tryCatchBlocks) { PostClinitMatcher postClinitMatcher = new PostClinitMatcher(tryCatchBlock.start); AbstractInsnNode end = postClinitMatcher.match(); if (end != null) { output.ignore(tryCatchBlock.start, end); } } }
Source:
<code>public void testCompareLocalWithLocal() { StorageDomain sd_local = new StorageDomain(); sd_local.setStorageType(StorageType.LOCALFS); StorageDomain sd_local2 = new StorageDomain(); sd_local2.setStorageType(StorageType.LOCALFS); int comparatorReturnValue = comparator.compare(sd_local, sd_local2); <START> assertTrue(comparatorReturnValue == 0); <END> }</code><technical_language>Please assertEquals(0, comparatorReturnValue)</technical_language>

Target:
public void testCompareLocalWithLocal() { storageDomain1.setStorageType(StorageType.LOCALFS); storageDomain2.setStorageType(StorageType.LOCALFS); assertEqualsTo(storageDomain1, storageDomain2); }
Source:
<code>public AccountAttributes getAccount(String googleId, boolean retrieveStudentProfile) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, googleId); Account a = getAccountEntity(googleId, retrieveStudentProfile); <START> if (a == null || JDOHelper.isDeleted(a)) { <END> return null; } closePM(); AccountAttributes accAttr = new AccountAttributes(a); return accAttr; }</code><technical_language>This is redundant <code>getAccountEntity</code> check already</technical_language>

Target:
public AccountAttributes getAccount(String googleId, boolean retrieveStudentProfile) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, googleId); Account a = getAccountEntity(googleId, retrieveStudentProfile); if (a == null) { return null; } closePM(); AccountAttributes accAttr = new AccountAttributes(a); return accAttr; }