auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldCreateUniqueFileIndex() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); MongoOperations mongoOperations = mongoConfiguration.getDefaultMongoOperations(databaseName); DBCollection fileCollection = mongoRule.getCollection(databaseName, jobOptions.getDbCollectionsFilesName()); VariantSourceEntityMongoWriter filesWriter = new VariantSourceEntityMongoWriter( mongoOperations, jobOptions.getDbCollectionsFilesName()); VariantSourceEntity variantSourceEntity = getVariantSourceEntity(); filesWriter.write(Collections.singletonList(variantSourceEntity)); List<DBObject> indexInfo = fileCollection.getIndexInfo(); Set<String> createdIndexes = indexInfo.stream().map(index -> index.get("name").toString()) .collect(Collectors.toSet()); Set<String> expectedIndexes = new HashSet<>(); <START> expectedIndexes.addAll(Arrays.asList("unique_file", "_id_")); <END> assertEquals(expectedIndexes, createdIndexes); DBObject uniqueIndex = indexInfo.stream().filter( index -> ("unique_file".equals(index.get("name").toString()))).findFirst().get(); assertNotNull(uniqueIndex); assertEquals("true", uniqueIndex.get("unique").toString()); assertEquals("true", uniqueIndex.get("background").toString()); }</code><technical_language>move strings constants</technical_language>

Target:
public void shouldCreateUniqueFileIndex() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); MongoOperations mongoOperations = mongoConfiguration.getDefaultMongoOperations(databaseName); DBCollection fileCollection = mongoRule.getCollection(databaseName, jobOptions.getDbCollectionsFilesName()); VariantSourceEntityMongoWriter filesWriter = new VariantSourceEntityMongoWriter( mongoOperations, jobOptions.getDbCollectionsFilesName()); VariantSourceEntity variantSourceEntity = getVariantSourceEntity(); filesWriter.write(Collections.singletonList(variantSourceEntity)); List<DBObject> indexInfo = fileCollection.getIndexInfo(); Set<String> createdIndexes = indexInfo.stream().map(index -> index.get("name").toString()) .collect(Collectors.toSet()); Set<String> expectedIndexes = new HashSet<>(); expectedIndexes.addAll(Arrays.asList(VariantSourceEntityMongoWriter.UNIQUE_FILE_INDEX_NAME, "_id_")); assertEquals(expectedIndexes, createdIndexes); DBObject uniqueIndex = indexInfo.stream().filter( index -> (VariantSourceEntityMongoWriter.UNIQUE_FILE_INDEX_NAME.equals(index.get("name").toString()))) .findFirst().get(); assertNotNull(uniqueIndex); assertEquals("true", uniqueIndex.get(MongoDBHelper.UNIQUE_INDEX).toString()); assertEquals("true", uniqueIndex.get(MongoDBHelper.BACKGROUND_INDEX).toString()); }
Source:
<code>private void assertHasNoTags(ProjectResource rsrc) throws CannotDeleteProjectException { try { Repository repo = repoManager.openRepository(rsrc.getNameKey()); try { <START> RevWalk rw = new RevWalk(repo); <END> try { if (!repo.getRefDatabase().getRefs(Constants.R_TAGS).isEmpty()) { throw new CannotDeleteProjectException( String.format("Project %s has tags", rsrc.getName())); } } finally { rw.release(); } } finally { repo.close(); } } catch (IOException e) { throw new CannotDeleteProjectException(e); } }</code><technical_language>This rw is used, remove</technical_language>

Target:
private void assertHasNoTags(ProjectResource rsrc) throws CannotDeleteProjectException { try { Repository repo = repoManager.openRepository(rsrc.getNameKey()); try { if (!repo.getRefDatabase().getRefs(Constants.R_TAGS).isEmpty()) { throw new CannotDeleteProjectException( String.format("Project %s has tags", rsrc.getName())); } } finally { repo.close(); } } catch (IOException e) { throw new CannotDeleteProjectException(e); } }
Source:
<code>protected void processIterableBatch(InvocationContext ctx, PutMapCommand cmd, PersistenceManager.AccessMode mode, Predicate<Object> filter) { <START> Iterable<MarshalledEntry> iterable = () -> StreamSupport.stream(Spliterators.spliterator(cmd.getMap().keySet(), Spliterator.NONNULL), false) <END> .filter(filter) .peek(Void -> { if (getStatisticsEnabled()) cacheStores.incrementAndGet(); }) .map(key -> createMarshalledEntry(ctx, key)) .iterator(); persistenceManager.writeBatchToAllNonTxStores(iterable, mode, cmd.getFlagsBitSet()); }</code><technical_language>cmd.getMap().keySet().stream()</technical_language>

Target:
protected void processIterableBatch(InvocationContext ctx, PutMapCommand cmd, PersistenceManager.AccessMode mode, Predicate<Object> filter) { if (getStatisticsEnabled()) cacheStores.addAndGet(cmd.getMap().size()); Iterable<MarshalledEntry> iterable = () -> cmd.getMap().keySet().stream() .filter(filter) .map(key -> createMarshalledEntry(ctx, key)) .iterator(); persistenceManager.writeBatchToAllNonTxStores(iterable, mode, cmd.getFlagsBitSet()); }
Source:
<code>List<Boolean> resolveBooleanExpressions(List<String> expressions, Entity entity) { if (expressions.isEmpty()) { return Collections.emptyList(); } List<Boolean> validationResults = new ArrayList<>(expressions.size()); for (String expression : expressions) { Object value; try { value = jsMagmaScriptEvaluator.eval(expression, entity); } catch (ScriptExecutionException see) { <START> validationResults.add(false); <END> continue; } validationResults.add(value != null ? Boolean.valueOf(value.toString()) : null); } return validationResults; }</code><technical_language>exception bubble in cases? Fail fast fail hard</technical_language>

Target:
List<Boolean> resolveBooleanExpressions(List<String> expressions, Entity entity) { if (expressions.isEmpty()) { return Collections.emptyList(); } List<Boolean> validationResults = new ArrayList<>(expressions.size()); for (String expression : expressions) { Object value = jsMagmaScriptEvaluator.eval(expression, entity); validationResults.add(value != null ? Boolean.valueOf(value.toString()) : null); } return validationResults; }
Source:
<code>private void writeProperties(File file) { FileOutputStream outputStream = null; try { File formProperties = new File(file, "form.properties"); outputStream = new FileOutputStream(formProperties); Properties properties = new Properties(); SharedPreferences settings = CommCareApplication._().getCurrentApp().getAppPreferences(); String postUrl = settings.getString(CommCarePreferences.PREFS_SUBMISSION_URL_KEY, c.getString(R.string.PostURL)); properties.setProperty("PostURL", postUrl); properties.store(outputStream, null); } catch(IOException e){ <START> e.printStackTrace(); <END> } finally{ if(outputStream != null){ try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }</code><technical_language>I this is a great plan. reason fail process if this work</technical_language>

Target:
private void writeProperties(File file) throws IOException{ FileOutputStream outputStream = null; try { File formProperties = new File(file, "form.properties"); outputStream = new FileOutputStream(formProperties); Properties properties = new Properties(); SharedPreferences settings = CommCareApplication._().getCurrentApp().getAppPreferences(); String postUrl = settings.getString(CommCarePreferences.PREFS_SUBMISSION_URL_KEY, c.getString(R.string.PostURL)); properties.setProperty("PostURL", postUrl); properties.store(outputStream, null); } finally{ if(outputStream != null){ try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
Source:
<code>public DataFileWriter<D> appendTo(SeekableInput in, OutputStream out) throws IOException { assertNotOpen(); DataFileReader<D> reader = null; try { reader = new DataFileReader<D>(in, new GenericDatumReader<D>()); this.schema = reader.getSchema(); this.sync = reader.getHeader().sync; this.meta.putAll(reader.getHeader().meta); byte[] codecBytes = this.meta.get(DataFileConstants.CODEC); if (codecBytes != null) { String strCodec = new String(codecBytes, "UTF-8"); this.codec = CodecFactory.fromString(strCodec).createInstance(); } else { this.codec = CodecFactory.nullCodec().createInstance(); } } finally { if (reader != null) reader.close(); <START> in.close(); <END> } init(out); return this; }</code><technical_language>change close passed SeekableInput? caller</technical_language>

Target:
public DataFileWriter<D> appendTo(SeekableInput in, OutputStream out) throws IOException { assertNotOpen(); DataFileReader<D> reader = new DataFileReader<D>(in, new GenericDatumReader<D>()); this.schema = reader.getSchema(); this.sync = reader.getHeader().sync; this.meta.putAll(reader.getHeader().meta); byte[] codecBytes = this.meta.get(DataFileConstants.CODEC); if (codecBytes != null) { String strCodec = new String(codecBytes, "UTF-8"); this.codec = CodecFactory.fromString(strCodec).createInstance(); } else { this.codec = CodecFactory.nullCodec().createInstance(); } init(out); return this; }
Source:
<code>public HostAvailabilityListener withMinHosts(int numHosts) { if (moveMgr.getConnectionPolicy() == DatabaseClient.ConnectionPolicy.PRIMARY_HOST) { if (numHosts != 0) { <START> throw new IllegalArgumentException("numHosts must be 1 when using only the primary host for the connection"); <END> } } else { if (numHosts <= 0) throw new IllegalArgumentException("numHosts must be > 0"); int numConfigHosts = moveMgr.readForestConfig().getPreferredHosts().length; if (numHosts > numConfigHosts) throw new IllegalArgumentException ("numHosts must be less than or equal to the number of hosts in the cluster"); } this.minHosts = numHosts; return this; }</code><technical_language>condition if (numHosts != 1)</technical_language>

Target:
public HostAvailabilityListener withMinHosts(int numHosts) { if (moveMgr.getConnectionType() == DatabaseClient.ConnectionType.GATEWAY) { if (numHosts != 1) { throw new IllegalArgumentException("numHosts must be 1 when using only the primary host for the connection"); } } else { if (numHosts <= 0) throw new IllegalArgumentException("numHosts must be > 0"); int numConfigHosts = moveMgr.readForestConfig().getPreferredHosts().length; if (numHosts > numConfigHosts) throw new IllegalArgumentException ("numHosts must be less than or equal to the number of hosts in the cluster"); } this.minHosts = numHosts; return this; }
Source:
<code>public void addGraphType(String pResourceName, final Class<?> pGraphClass) { aNewDiagramMap.put(aAppResources.getString(pResourceName + ".text"), pEvent -> { try { GraphFrame frame = new GraphFrame((Graph) pGraphClass.newInstance(), aTabbedPane); addTab(frame); } catch (Exception exception) { exception.printStackTrace(); } }); aNewMenu.getItems().add(aAppFactory.createMenuItem(pResourceName, pEvent -> { try { GraphFrame frame = new GraphFrame((Graph) pGraphClass.newInstance(), aTabbedPane); addTab(frame); } <START> catch (Exception exception) <END> { exception.printStackTrace(); } })); }</code><technical_language>narrowed precise type: IllegalAccessException. Please remove excess white space lines. Replace printStackTrace assert false;</technical_language>

Target:
public void addGraphType(String pResourceName, final Class<?> pGraphClass) { aNewDiagramMap.put(aAppResources.getString(pResourceName + ".text"), pEvent -> { try { GraphFrame frame = new GraphFrame((Graph) pGraphClass.newInstance(), aTabbedPane); addTab(frame); } catch (InstantiationException | IllegalAccessException exception) { assert false; } }); aNewMenu.getItems().add(aAppFactory.createMenuItem(pResourceName, pEvent -> { try { GraphFrame frame = new GraphFrame((Graph) pGraphClass.newInstance(), aTabbedPane); addTab(frame); } catch (InstantiationException | IllegalAccessException exception) { assert false; } })); }
Source:
<code>private void init() { snapshotWriter = new StreamsSnapshotWriter(runtime, config, logReplicationMetadataManager); logEntryWriter = new LogEntryWriter(runtime, config, logReplicationMetadataManager); <START> CorfuStoreMetadata.Timestamp ts = logReplicationMetadataManager.getTimestamp(); <END> logEntryWriter.reset(logReplicationMetadataManager.getLastSrcBaseSnapshotTimestamp(ts), logReplicationMetadataManager.getLastProcessedLogTimestamp(ts)); logEntrySinkBufferManager = new LogEntrySinkBufferManager(ackCycleTime, ackCycleCnt, bufferSize, logReplicationMetadataManager.getLastProcessedLogTimestamp(ts), this); readConfig(); }</code><technical_language>I follow this timestamp does, please explain me</technical_language>

Target:
private void init() { snapshotWriter = new StreamsSnapshotWriter(runtime, config, logReplicationMetadataManager); logEntryWriter = new LogEntryWriter(runtime, config, logReplicationMetadataManager); CorfuStoreMetadata.Timestamp ts = logReplicationMetadataManager.getTimestamp(); logEntryWriter.reset(logReplicationMetadataManager.getLastSrcBaseSnapshotTimestamp(ts), logReplicationMetadataManager.getLastProcessedLogTimestamp(ts)); logEntrySinkBufferManager = new LogEntrySinkBufferManager(ackCycleTime, ackCycleCnt, bufferSize,this); snapshotSinkBufferManager = new SnapshotSinkBufferManager(ackCycleTime, ackCycleCnt, bufferSize, this); readConfig(); }
Source:
<code>public PerformSearchResponse performSearch(JsonRpcPeer peer, final JSONObject params) { return mDOMProvider.postAndWait(new UncheckedCallable<PerformSearchResponse>() { @Override public PerformSearchResponse call() { final PerformSearchRequest request = mObjectMapper.convertValue( params, PerformSearchRequest.class); <START> final String lowerCaseQuery = request.query.toLowerCase(); <END> final Object root = mShadowDOM.getRootElement(); final String id = UUID.randomUUID().toString(); final ArrayList<Integer> results = new ArrayList<>(); findMatches(lowerCaseQuery, root, results); mSearchResults.put(id, results); final PerformSearchResponse response = new PerformSearchResponse(); response.searchId = id; response.resultCount = results.size(); return response; } }); }</code><technical_language>Fun fact localization: a.toLowerCase().equals(b.toLowerCase()) is a.equalsIgnoreCase(b). I making this mistake here. EDIT: I contains case insensitive option in Java (!$#@). prefer Pattern.compile(Pattern.compile(Pattern.quote(queryString), Pattern.CASE_INSENSITIVE)). call matches pattern for instance. This perform worse, optimization search query string for unicode characters and, if exist, a search strategy involves toLowerCase contains. I doubt perf issue in practice easily precompile pattern test often</technical_language>

Target:
public PerformSearchResponse performSearch(JsonRpcPeer peer, final JSONObject params) { final PerformSearchRequest request = mObjectMapper.convertValue( params, PerformSearchRequest.class); final Pattern queryPattern = Pattern.compile(Pattern.quote(request.query), Pattern.CASE_INSENSITIVE); ArrayList<Integer> results = mDOMProvider.postAndWait(new UncheckedCallable<ArrayList<Integer>>() { @Override public ArrayList<Integer> call() { final Object rootElement = mShadowDOM.getRootElement(); final ArrayList<Integer> results = new ArrayList<>(); findMatches(queryPattern, rootElement, results); return results; } }); final String id = String.valueOf(mResultCounter.getAndIncrement()); mSearchResults.put(id, results); final PerformSearchResponse response = new PerformSearchResponse(); response.searchId = id; response.resultCount = results.size(); return response; }
Source:
<code>public String getEditCopyActionLink() { <START> return editCopyActionLink; <END> }</code><technical_language>call getInstructorFeedbackEditCopyActionLink right</technical_language>

Target:
public String getEditCopyActionLink() { return getInstructorFeedbackEditCopyActionLink(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); }
Source:
<code>public void start(String[] filename, int playerCount) { addToLog("[LAUNCHER]\tLoading files: " + Arrays.toString(filename) + "."); try { <START> MapParser mp = new MapParser(new BasicUnitFactory()); <END> ArrayList<Level> levelList = new ArrayList<>(); UnitFactory unitFactory = new BasicUnitFactory(); for(String levelFileName : filename) { InputStream map = getClass().getResourceAsStream(levelFileName); Level level = mp.parseMap(map); levelList.add(level); } addToLog("[LAUNCHER]\tLoading files: " + Arrays.toString(filename) + " succeeded."); Game game = new Game(levelList, unitFactory, playerCount); Map<Integer, Action> keyMappings = createKeyMappings(game); JBubbleBobbleUI ui = new JBubbleBobbleUI(game, keyMappings); InputStream map = getClass().getResourceAsStream("/game_over.txt"); Level gameOverLevel = mp.parseMap(map); game.setGameOver(gameOverLevel); InputStream winMap = getClass().getResourceAsStream("/game_won.txt"); Level gameWonLevel = mp.parseMap(winMap); game.setGameWon(gameWonLevel); game.setKeyListener(ui.getKeyListener()); ui.start(); startScheduler(game); } catch (IOException e) { addToLog("[ERROR]\tLoading file: " + Arrays.toString(filename) + " failed."); DumpLog.getInstance().createDump(); throw new RuntimeException(); } }</code><technical_language>Abbreviation Alert. <naming</technical_language>

Target:
public void start(String[] filename, int playerCount) { addToLog("[LAUNCHER]\tLoading files: " + Arrays.toString(filename) + "."); try { MapParser parser = new MapParser(new BasicUnitFactory()); ArrayList<Level> levelList = new ArrayList<>(); UnitFactory unitFactory = new BasicUnitFactory(); for(String levelFileName : filename) { InputStream map = getClass().getResourceAsStream(levelFileName); Level level = parser.parseMap(map); levelList.add(level); } addToLog("[LAUNCHER]\tLoading files: " + Arrays.toString(filename) + " succeeded."); Game game = new Game(levelList, unitFactory, playerCount); Map<Integer, Action> keyMappings = createKeyMappings(game); JBubbleBobbleUI ui = new JBubbleBobbleUI(game, keyMappings); InputStream map = getClass().getResourceAsStream("/game_over.txt"); Level gameOverLevel = parser.parseMap(map); game.setGameOver(gameOverLevel); InputStream winMap = getClass().getResourceAsStream("/game_won.txt"); Level gameWonLevel = parser.parseMap(winMap); game.setGameWon(gameWonLevel); game.setKeyListener(ui.getKeyListener()); ui.start(); startScheduler(game); } catch (IOException e) { addToLog("[ERROR]\tLoading file: " + Arrays.toString(filename) + " failed."); DumpLog.getInstance().createDump(); throw new RuntimeException(); } }
Source:
<code>public History[] refreshHistory(int limit, int offset) throws Exception { <START> Map<String,String> params = new HashMap<>(); <END> params.put("limit", String.valueOf(limit)); params.put("offset", String.valueOf(offset)); return constructHistory(params); }</code><technical_language>final</technical_language>

Target:
public History[] refreshHistory(int limit, int offset) throws Exception { final Map<String,String> params = new HashMap<>(); params.put("limit", String.valueOf(limit)); params.put("offset", String.valueOf(offset)); return constructHistory(params); }
Source:
<code>protected void executeCommand() { if (getDiskImage() != null) { try { VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); } catch (VdcBLLException e) { <START> if (e.getErrorCode() != VdcBllErrors.ImageDoesNotExistInDomainError) { <END> throw e; } } if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { performImageDbOperations(); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }</code><technical_language>Log added if get VdcBllErrors.ImageDoesNotExistInDomainError</technical_language>

Target:
protected void executeCommand() { if (getDiskImage() != null) { try { VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); } catch (VdcBLLException e) { if (e.getErrorCode() != VdcBllErrors.ImageDoesNotExistInDomainError) { throw e; } log.debugFormat("The image group with id {0} wasn't actually deleted from the storage domain {1} because it didn't exist in it", getDiskImage().getId(), getStorageDomainId()); } if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { performImageDbOperations(); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }
Source:
<code>public Mono<ServiceBusReceivedMessage> receiveDeferredMessage(long sequenceNumber) { return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType)) .flatMap(node -> node.receiveDeferredMessage(receiveMode, sequenceNumber)) <START> .map(receivedMessage -> { <END> if (receiveMode == ReceiveMode.PEEK_LOCK && !Objects.isNull(receivedMessage.getLockToken())) { UUID lockToken = UUID.fromString(receivedMessage.getLockToken()); if (!ZERO_LOCK_TOKEN.equals(lockToken)) { messageLockContainer.addOrUpdate(lockToken, receivedMessage.getLockedUntil()); } } return receivedMessage; }); }</code><technical_language>This logic is done in MessageProcessor now</technical_language>

Target:
public Mono<ServiceBusReceivedMessage> receiveDeferredMessage(long sequenceNumber) { return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType)) .flatMap(node -> node.receiveDeferredMessage(receiveMode, sequenceNumber)) .map(receivedMessage -> { if (receiveMode == ReceiveMode.PEEK_LOCK && !CoreUtils.isNullOrEmpty(receivedMessage.getLockToken())) { receivedMessage.setLockedUntil(messageLockContainer.addOrUpdate(receivedMessage.getLockToken(), receivedMessage.getLockedUntil())); } return receivedMessage; }); }
Source:
<code>protected void handleSwingNodeClick(TreePath path, final int swingMouseButton) { if (getUpdateSwingFromScoutLock().isAcquired()) { return; } if (getScoutObject() != null) { ensurePathSelected(path); final ITreeNode scoutNode = treePathToScoutNode(path); if (scoutNode != null) { Runnable t = new Runnable() { @Override public void run() { getScoutObject().getUIFacade().fireNodeClickFromUI(scoutNode, SwingUtility.swingToScoutMouseButton(swingMouseButton)); <START> getScoutObject().getUIFacade().setNodesCheckedFromUI(CollectionUtility.arrayList(scoutNode), <END> !scoutNode.isChecked()); } }; getSwingEnvironment().invokeScoutLater(t, 0); } } }</code><technical_language>Wrap isCheckable</technical_language>

Target:
protected void handleSwingNodeClick(TreePath path, final int swingMouseButton) { if (getUpdateSwingFromScoutLock().isAcquired()) { return; } if (getScoutObject() != null) { ensurePathSelected(path); final ITreeNode scoutNode = treePathToScoutNode(path); if (scoutNode != null) { Runnable t = new Runnable() { @Override public void run() { getScoutObject().getUIFacade().fireNodeClickFromUI(scoutNode, SwingUtility.swingToScoutMouseButton(swingMouseButton)); if (getScoutObject().isCheckable()) { getScoutObject().getUIFacade().setNodesCheckedFromUI(CollectionUtility.arrayList(scoutNode), !scoutNode.isChecked()); } } }; getSwingEnvironment().invokeScoutLater(t, 0); } } }
Source:
<code>private void downloadNotebook(String noteId, FileObject rootDir) throws IOException { logger.debug("download notebook from hdfs: " + rootDir.getName().getBaseName()); OneFileStatus fileStatus; Gson gson = new Gson(); String notebook = this.hdfsNotebookDir + "/" + noteId + "/" + NOTE_JSON; try { String notebookStatus = this.hdfsCmd.runCommand(this.hdfsCmd.getFileStatus, notebook, null); fileStatus = gson.fromJson(notebookStatus, OneFileStatus.class); } catch (Exception e) { <START> logger.warn("Warning: ", e); <END> return; } long length = fileStatus.length; if (length > this.hdfsMaxLength) { this.hdfsCmd = new HDFSCommand(this.hdfsUrl, this.hdfsUser, logger, (int) length); } FileObject noteDir; try { noteDir = rootDir.resolveFile(noteId, NameScope.CHILD); this.hdfsCmd.runCommand(this.hdfsCmd.openFile, notebook, noteDir, conf.getString(ConfVars.ZEPPELIN_ENCODING), null); } catch (Exception e) { throw new IOException(e.getCause()); } }</code><technical_language>some description give</technical_language>

Target:
private void downloadNotebook(String noteId, FileObject rootDir) throws IOException { logger.debug("download notebook from hdfs: " + rootDir.getName().getBaseName()); OneFileStatus fileStatus; Gson gson = new Gson(); String notebook = this.hdfsNotebookDir + "/" + noteId + "/" + NOTE_JSON; try { String notebookStatus = this.hdfsCmd.runCommand(this.hdfsCmd.getFileStatus, notebook, null); fileStatus = gson.fromJson(notebookStatus, OneFileStatus.class); } catch (Exception e) { logger.warn("exception occurred during checking hdfs file status: ", e); return; } long length = fileStatus.length; if (length > this.hdfsMaxLength) { this.hdfsCmd = new HDFSCommand(this.hdfsUrl, this.hdfsUser, logger, (int) length); } FileObject noteDir; try { noteDir = rootDir.resolveFile(noteId, NameScope.CHILD); this.hdfsCmd.runCommand(this.hdfsCmd.openFile, notebook, noteDir, conf.getString(ConfVars.ZEPPELIN_ENCODING), null); } catch (Exception e) { throw new IOException(e.getCause()); } }
Source:
<code>private Assignment forgeMapping(SourceRHS sourceRHS) { Type sourceType = sourceRHS.getSourceType(); if ( sourceType.isPrimitive() || targetType.isPrimitive() ) { return null; } String name = getName( sourceType, targetType ); List<Parameter> parameters = new ArrayList( method.getContextParameters() ); ForgedMethod forgedMethod; if ( method.isUpdateMethod() ) { <START> parameters.add( Parameter.forForgedMappingTarget( targetType ) ); <END> forgedMethod = new ForgedMethod( name, sourceType, ctx.getTypeFactory().getType( ctx.getTypeUtils().getNoType( TypeKind.VOID ) ), method.getMapperConfiguration(), method.getExecutable(), parameters, getForgedMethodHistory( sourceRHS ) ); } else { forgedMethod = new ForgedMethod( name, sourceType, targetType, method.getMapperConfiguration(), method.getExecutable(), parameters, getForgedMethodHistory( sourceRHS ) ); } Assignment assignment = new MethodReference( forgedMethod, null, ParameterBinding.fromParameters( forgedMethod.getParameters() ) ); assignment.setAssignment( sourceRHS ); this.forgedMethods.add( forgedMethod ); return assignment; }</code><technical_language>I add new parameter if method is update method. else stay before. If mappingTargetParameter is null is do update method, return type. TypeKind.VOID is obsolete</technical_language>

Target:
private Assignment forgeMapping(SourceRHS sourceRHS) { Type sourceType = sourceRHS.getSourceType(); if ( sourceType.isPrimitive() || targetType.isPrimitive() ) { return null; } String name = getName( sourceType, targetType ); List<Parameter> parameters = new ArrayList( method.getContextParameters() ); Type returnType; if ( method.isUpdateMethod() ) { parameters.add( Parameter.forForgedMappingTarget( targetType ) ); returnType = ctx.getTypeFactory().createVoidType(); } else { returnType = targetType; } ForgedMethod forgedMethod = new ForgedMethod( name, sourceType, returnType, method.getMapperConfiguration(), method.getExecutable(), parameters, getForgedMethodHistory( sourceRHS ) ); Assignment assignment = new MethodReference( forgedMethod, null, ParameterBinding.fromParameters( forgedMethod.getParameters() ) ); assignment.setAssignment( sourceRHS ); this.forgedMethods.add( forgedMethod ); return assignment; }
Source:
<code>public EventHubClientBuilder initialPartitionPublishingStates(Map<String, PartitionPublishingProperties> states) { <START> if (states != null) { <END> this.initialPartitionPublishingStates = new HashMap<>(); states.forEach((partitionId, state) -> { this.initialPartitionPublishingStates.put(partitionId, new PartitionPublishingState(state)); }); } return this; }</code><technical_language>If this method is called - time a non-null map time null map, 2nd call is a no-op builder map is user expected. If map is null, this builder's map set null</technical_language>

Target:
public EventHubClientBuilder initialPartitionPublishingStates(Map<String, PartitionPublishingProperties> states) { if (states != null) { this.initialPartitionPublishingStates = new HashMap<>(); states.forEach((partitionId, state) -> { this.initialPartitionPublishingStates.put(partitionId, new PartitionPublishingState(state)); }); this.initialPartitionPublishingStates = Collections.unmodifiableMap(this.initialPartitionPublishingStates); } else { this.initialPartitionPublishingStates = null; } return this; }
Source:
<code>public void checkRemoteStatusOf(Task task) { if (!task.remoteId().isPresent()) { <START> log.error("attempted to check remote status for task with no remote id", task.id()); <END> } resultHandler.handleRemoteCheckResult(task, client.checkRemoteStatusOf(task.remoteId().get())); }</code><technical_language>throw here</technical_language>

Target:
public void checkRemoteStatusOf(Task task) { if (!task.remoteId().isPresent()) { throw new RuntimeException("attempted to check remote status for task " + task.id() + " with no remote id"); } resultHandler.handleRemoteCheckResult(task, client.checkRemoteStatusOf(task.remoteId().get())); }
Source:
<code><START> public UserAgentPolicy(String applicationId, String sdkName, String sdkVersion, Configuration configuration, <END> ServiceVersion version) { boolean telemetryDisabled = configuration.get(Configuration.PROPERTY_AZURE_TELEMETRY_DISABLED, false); if (telemetryDisabled) { this.userAgent = String.format(DISABLED_TELEMETRY_USER_AGENT_FORMAT, sdkName, sdkVersion, version.getVersion()); } else { if (applicationId == null) { this.userAgent = String.format(USER_AGENT_FORMAT, sdkName, sdkVersion, getPlatformInfo(), version.getVersion()); } else { this.userAgent = String.format(APPLICATION_ID_USER_AGENT_FORMAT, applicationId, sdkName, sdkVersion, getPlatformInfo(), version.getVersion()); } } }</code><technical_language>This needs a new method overload</technical_language>

Target:
public UserAgentPolicy(String applicationId, String sdkName, String sdkVersion, Configuration configuration, ServiceVersion version) { Objects.requireNonNull(configuration, "'configuration' cannot be null."); boolean telemetryDisabled = configuration.get(Configuration.PROPERTY_AZURE_TELEMETRY_DISABLED, false); if (telemetryDisabled) { this.userAgent = String.format(DISABLED_TELEMETRY_USER_AGENT_FORMAT, sdkName, sdkVersion, version.getVersion()); } else { if (applicationId == null) { this.userAgent = String.format(USER_AGENT_FORMAT, sdkName, sdkVersion, getPlatformInfo(), version.getVersion()); } else { this.userAgent = String.format(APPLICATION_ID_USER_AGENT_FORMAT, applicationId, sdkName, sdkVersion, getPlatformInfo(), version.getVersion()); } } }
Source:
<code>private boolean handleForget() { if ((_theXAResource != null) && (_tranID != null)) <START> { <END> _heuristic = TwoPhaseOutcome.FINISH_OK; try { _theXAResource.forget(_tranID); } catch (Exception e) { return false; } } return true; }</code><technical_language>I need move _heuristic = TwoPhaseOutcome.FINISH_OK; place local JTA one</technical_language>

Target:
private void handleForget() throws org.omg.CORBA.SystemException { if ((_theXAResource != null) && (_tranID != null)) { try { _theXAResource.forget(_tranID); _heuristic = TwoPhaseOutcome.FINISH_OK; _forgotten = true; } catch (Exception e) { jtaLogger.i18NLogger.warn_recovery_forgetfailed( "XAResourceRecord forget failed:", e); throw new UNKNOWN(e.getMessage()); } } }
Source:
<code>public Builder assetFile(Context context, final String assetFile) { if (context == null) { throw new IllegalArgumentException("A non-null Context must be provided"); } if (TextUtils.isEmpty(assetFile)) { throw new IllegalArgumentException("A non-empty asset file path must be provided"); } <START> if (new File(folder, fileName).exists()) { <END> throw new RealmException("Asset file can not be used if Realm file exists."); } if (durability == SharedGroup.Durability.MEM_ONLY) { throw new RealmException("Realm can not use in-memory configuration if asset file is present."); } this.contextWeakRef = new WeakReference<>(context); this.assetFilePath = assetFile; return this; }</code><technical_language>This check kinda harsh. prevents case delete file _after_ configuration created. I remove it, this method is designed "fail" silently anyway. is check in copyRealmFileIfNeeded prevents copy anyway</technical_language>

Target:
public Builder assetFile(Context context, final String assetFile) { if (context == null) { throw new IllegalArgumentException("A non-null Context must be provided"); } if (TextUtils.isEmpty(assetFile)) { throw new IllegalArgumentException("A non-empty asset file path must be provided"); } if (durability == SharedGroup.Durability.MEM_ONLY) { throw new RealmException("Realm can not use in-memory configuration if asset file is present."); } this.contextWeakRef = new WeakReference<>(context); this.assetFilePath = assetFile; return this; }
Source:
<code>public void parseSingleGeneTest() { ArrayList<Gene> genes = new ArrayList<>(); Map<String, Label> labelMap = new HashMap<>(); Map<Integer, Gene> geneStart = new HashMap<>(); Map<Integer, Gene> geneEnd = new HashMap<>(); <START> String line = "585 Corndogp005 chr - 1110 1581 1110 1581 1 1110, 1581, 5 none cmpl cmpl 0,"; <END> Integer start = 1110; Integer end = 1581; Gene gene = new Gene("Corndogp005", start, end); GeneData.parseGene(line, genes, geneStart, geneEnd, labelMap); assertTrue(genes.get(0).equals(gene)); assertTrue(geneStart.get(start).equals(gene)); assertTrue(geneEnd.get(end).equals(gene)); }</code><technical_language>please do this</technical_language>

Target:
public void parseSingleGeneTest() { ArrayList<Gene> genes = new ArrayList<>(); Map<String, Label> labelMap = new HashMap<>(); Map<Integer, Gene> geneStart = new HashMap<>(); Map<Integer, Gene> geneEnd = new HashMap<>(); String line = "MT_H37RV_BRD_V5\tnull\tCDS\t3057261\t3058073\t0.0\t-\t.\tcalhounClass=Gene;Name=alanine rich " + "protein;ID=7000008459999039;displayName=RVBD_2744c.5 alanine rich protein"; Integer start = 3057261; Integer end = 3058073; Gene gene = new Gene("RVBD_2744c.5 alanine rich protein", start, end); GeneData.parseGene(line, genes, geneStart, geneEnd, labelMap); assertTrue(genes.get(0).equals(gene)); assertTrue(geneStart.get(start).equals(gene)); assertTrue(geneEnd.get(end).equals(gene)); }
Source:
<code>public static boolean isCounterClockwise(Geometry geometry) { if (geometry == null) return false; Coordinate[] coordinates = geometry.getCoordinates(); boolean orientation = false; try { orientation = CGAlgorithms.isCCW(coordinates); } catch (IllegalArgumentException ex) { <START> System.err.println("Illegal Argument"); <END> } return orientation; }</code><technical_language>sense propagate exception instead of silently ignoring it. return information checked in way. a caller if result isCounterClockwise is correct if internal error</technical_language>

Target:
public static boolean isCounterClockwise(Geometry geometry) { if (geometry == null) return false; Coordinate[] coordinates = geometry.getCoordinates(); boolean orientation = false; orientation = CGAlgorithms.isCCW(coordinates); return orientation; }
Source:
<code>public TaskTracker tasks() throws Exception { Database parentDb = context.hiveDb.getDatabase(tableDesc.getDatabaseName()); LoadTable.TableLocationTuple tableLocationTuple = LoadTable.tableLocation(tableDesc, parentDb, tableContext, context); tableDesc.setLocation(tableLocationTuple.location); if (table == null) { table = tableDesc.toTable(context.hiveConf); if (isPartitioned(tableDesc)) { updateReplicationState(initialReplicationState()); if (!forNewTable().hasReplicationState()) { Task<?> replLogTask = ReplUtils.getTableReplLogTask(tableDesc, replLogger, context.hiveConf); tracker.addDependentTask(replLogTask); } return tracker; } } else { if (table.isPartitioned()) { List<AlterTableAddPartitionDesc> partitionDescs = event.partitionDescriptions(tableDesc); if (!event.replicationSpec().isMetadataOnly() <START> && !Utils.shouldDumpMetaDataOnlyForExternalTables(table, context.hiveConf) <END> && !partitionDescs.isEmpty()) { updateReplicationState(initialReplicationState()); if (!forExistingTable(lastReplicatedPartition).hasReplicationState()) { Task<?> replLogTask = ReplUtils.getTableReplLogTask(tableDesc, replLogger, context.hiveConf); tracker.addDependentTask(replLogTask); } return tracker; } } } return tracker; }</code><technical_language>load time functions ..i if config ..it checked replicationspec</technical_language>

Target:
public TaskTracker tasks() throws Exception { Database parentDb = context.hiveDb.getDatabase(tableDesc.getDatabaseName()); LoadTable.TableLocationTuple tableLocationTuple = LoadTable.tableLocation(tableDesc, parentDb, tableContext, context); tableDesc.setLocation(tableLocationTuple.location); if (table == null) { table = tableDesc.toTable(context.hiveConf); if (isPartitioned(tableDesc)) { updateReplicationState(initialReplicationState()); if (!forNewTable().hasReplicationState()) { Task<?> replLogTask = ReplUtils.getTableReplLogTask(tableDesc, replLogger, context.hiveConf); tracker.addDependentTask(replLogTask); } return tracker; } } else { if (table.isPartitioned()) { List<AlterTableAddPartitionDesc> partitionDescs = event.partitionDescriptions(tableDesc); if (!event.replicationSpec().isMetadataOnly() && !partitionDescs.isEmpty()) { updateReplicationState(initialReplicationState()); if (!forExistingTable(lastReplicatedPartition).hasReplicationState()) { Task<?> replLogTask = ReplUtils.getTableReplLogTask(tableDesc, replLogger, context.hiveConf); tracker.addDependentTask(replLogTask); } return tracker; } } } return tracker; }
Source:
<code>public View getView(int i, View v, ViewGroup vg) { Object mObject = objectData[i]; <START> if(DeveloperPreferences.isGridMenuEnabled()){ <END> MenuGridEntryView emv = (MenuGridEntryView)v; String mQuestionText = textViewHelper(mObject); if(emv == null) { emv = new MenuGridEntryView(context); } if(mQuestionText != null) { mQuestionText = Localizer.processArguments(mQuestionText, new String[] {""}).trim(); } emv.setAVT(mQuestionText, getImageURI(mObject)); return emv; } MenuListEntryView emv = (MenuListEntryView)v; String mQuestionText = textViewHelper(mObject); if(emv == null) { emv = new MenuListEntryView(context); } if(mQuestionText != null) { mQuestionText = Localizer.processArguments(mQuestionText, new String[] {""}).trim(); } emv.setAVT(mQuestionText, getAudioURI(mObject), getImageURI(mObject)); return emv; }</code><technical_language>I super love check this well, a bit ugly error prone (IE: flag ideally triggered/processed end resulting in of changes later. I suggest instead MenuAdapter GridMenuAdapter extends MenuAdapter gridmenuadapter differently other providing a getView() method? code a bit cleaner, allow a bit more flexibility in future if need adapters function/initialize differently</technical_language>

Target:
public View getView(int i, View v, ViewGroup vg) { Object mObject = objectData[i]; HorizontalMediaView emv = (HorizontalMediaView)v; String mQuestionText = textViewHelper(mObject); if(emv == null) { emv = new HorizontalMediaView(context); } int iconChoice = HorizontalMediaView.NAVIGATION_NEXT; if(mObject instanceof Entry) { SessionDatum datum = asw.getSession().getNeededDatum((Entry)mObject); if(datum == null) { iconChoice = HorizontalMediaView.NAVIGATION_JUMP; } else if(datum.getNodeset() == null) { iconChoice = HorizontalMediaView.NAVIGATION_JUMP; } } if(!DeveloperPreferences.isNewNavEnabled()) { iconChoice = HorizontalMediaView.NAVIGATION_NONE; } if(mQuestionText != null) { mQuestionText = Localizer.processArguments(mQuestionText, new String[] {""}).trim(); } emv.setAVT(mQuestionText, getAudioURI(mObject), getImageURI(mObject), iconChoice); return emv; }
Source:
<code>SftpObjectDB(String path) throws TransportException { if (path.startsWith("/~")) path = path.substring(1); if (path.startsWith("~/")) path = path.substring(2); try { ftp = newSftp(); ftp.cd(path); <START> ftp.cd(Constants.OBJECTS); <END> objectsPath = ftp.pwd(); } catch (FtpChannel.FtpException f) { throw new TransportException(MessageFormat.format( JGitText.get().cannotEnterObjectsPath, path, f.getMessage()), f); } catch (IOException ioe) { close(); throw new TransportException(uri, ioe.getMessage(), ioe); } }</code><technical_language>import static</technical_language>

Target:
SftpObjectDB(String path) throws TransportException { if (path.startsWith("/~")) path = path.substring(1); if (path.startsWith("~/")) path = path.substring(2); try { ftp = newSftp(); ftp.cd(path); ftp.cd(OBJECTS); objectsPath = ftp.pwd(); } catch (FtpChannel.FtpException f) { throw new TransportException(MessageFormat.format( JGitText.get().cannotEnterObjectsPath, path, f.getMessage()), f); } catch (IOException ioe) { close(); throw new TransportException(uri, ioe.getMessage(), ioe); } }
Source:
<code>private static Duration computeIndexTimeout(String timeoutValue, EvaluationContext evaluationContext) { Object evaluatedTimeout = evaluatePotentialTemplateExpression(timeoutValue, evaluationContext); if (evaluatedTimeout == null) { return Duration.ZERO; } if (evaluatedTimeout instanceof Duration) { return (Duration) evaluatedTimeout; } String val = evaluatedTimeout.toString(); if (val == null) { return Duration.ZERO; } Matcher matcher = TIMEOUT_PATTERN.matcher(val); if (matcher.find()) { long timeout = NumberUtils.parseNumber(matcher.group(1), Long.class); String unit = matcher.group(3); switch (unit) { case "d": return Duration.ofDays(timeout); case "h": return Duration.ofHours(timeout); case "m": return Duration.ofMinutes(timeout); <START> case "s": <END> return Duration.ofSeconds(timeout); } } throw new IllegalArgumentException( String.format("Index timeout %s cannot be parsed. Please use the pattern '\\d+\\W?[dhms]'.", val)); }</code><technical_language>Hi, ms missed</technical_language>

Target:
private static Duration computeIndexTimeout(String timeoutValue, EvaluationContext evaluationContext) { Object evaluatedTimeout = evaluate(timeoutValue, evaluationContext); if (evaluatedTimeout == null) { return Duration.ZERO; } if (evaluatedTimeout instanceof Duration) { return (Duration) evaluatedTimeout; } String val = evaluatedTimeout.toString(); if (val == null) { return Duration.ZERO; } return DurationStyle.detectAndParse(val); }
Source:
<code>public int hashCode() { int hash = 3; <START> return hash; <END> }</code><technical_language>Is OK if a static hash</technical_language>

Target:
public int hashCode() { int hash = 7; hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 83 * hash + (this.parameters != null ? this.parameters.hashCode() : 0); hash = 83 * hash + (this.returnType != null ? this.returnType.hashCode() : 0); return hash; }
Source:
<code>public void execute() throws ExecutionFailedException { if (theme == null || theme.getName().isEmpty()) { return; } themeImportFile.getParentFile().mkdirs(); try { FileUtils.write( themeImportFile, "import {applyTheme as _applyTheme} from 'theme/" + theme.getName() + "/" <START> + theme.getName() + ".js';\nexport const applyTheme = _applyTheme;\n", <END> StandardCharsets.UTF_8); } catch (IOException e) { throw new ExecutionFailedException("Unable to write theme import file", e); } }</code><technical_language>this file is generated, name theme-generated.js instead ? users supposed touch</technical_language>

Target:
public void execute() throws ExecutionFailedException { if (theme == null || theme.getName().isEmpty()) { return; } if (!themeImportFile.getParentFile().mkdirs()) { LoggerFactory.getLogger(getClass()).debug( "Didn't create folders as they probably already exist. " + "If there is a problem check access rights for folder {}", themeImportFile.getParentFile().getAbsolutePath()); } try { FileUtils.write(themeImportFile, "import {applyTheme as _applyTheme} from 'theme/" + theme .getName() + "/" + theme.getName() + ".js';\nexport const applyTheme = _applyTheme;\n", StandardCharsets.UTF_8); } catch (IOException e) { throw new ExecutionFailedException( "Unable to write theme import file", e); } }
Source:
<code>private void parseSummaryInformation(DirectoryNode root, Metadata metadata) throws UnsupportedHwpFormatException { try { <START> Entry summaryEntry = root.getEntry("HwpSummaryInformation"); <END> SummaryInformation si = getSummaryInformation(summaryEntry); setMetadataWithSummaryInformation(si, metadata); } catch (NoPropertySetStreamException | IOException e) { throw new UnsupportedHwpFormatException( "cannot parse the Summary Information"); } }</code><technical_language>modify this "\u0000HwpSummaryInformation" correct unicode code is for character</technical_language>

Target:
private void parseSummaryInformation(DirectoryNode root, Metadata metadata) throws TikaException { try { Entry summaryEntry = root.getEntry("\u0005HwpSummaryInformation"); populateMatadata(summaryEntry, metadata); } catch (NoPropertySetStreamException | IOException e) { throw new UnsupportedFormatException( "cannot parse the Summary Information"); } }
Source:
<code>public XStreamJSONMessageConverter() { <START> super(MediaType.APPLICATION_JSON); <END> }</code><technical_language>passing text/json here</technical_language>

Target:
public XStreamJSONMessageConverter() { super(MediaType.APPLICATION_JSON, TEXT_JSON); }
Source:
<code><START> private String obsfucateIfSecret( Map.Entry<String,String> param ) <END> { return secrets.contains( param.getKey() ) ? Secret.OBSFUCATED : param.getValue(); }</code><technical_language>is a log updateDynamicSetting obfuscated</technical_language>

Target:
private String obsfucateIfSecret( Map.Entry<String,String> param ) { return obsfucateIfSecret( param.getKey(), param.getValue() ); }
Source:
<code><START> protected boolean deploymentNeverEnabled(List<String> previewListItems) { <END> return itemInListExistsLowerCase(previewListItems, "the deployment was never enabled"); }</code><technical_language>package private visibility? Protected visibility recommend subclassing of DeploymentsOperations. intention? Why</technical_language>

Target:
public boolean deploymentNeverEnabled(List<String> previewListItems) { return itemInListExistsLowerCase(previewListItems, "the deployment was never enabled"); }