auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public byte[] getAPIData() { ByteArrayOutputStream data = new ByteArrayOutputStream(); data.write(frameID); try { <START> if (sourceAddress64 != null) <END> data.write(sourceAddress64.getValue()); if (sourceAddress16 != null) data.write(sourceAddress16.getValue()); if (command != null) data.write(ByteUtils.stringToByteArray(command)); if (status != null) data.write(status.getId()); if (commandValue != null) data.write(commandValue); } catch (IOException e) { logger.error(e.getMessage(), e); } return data.toByteArray(); }</code><technical_language>Remove null checks leave of commandValue. Constructor takes care of avoiding null values</technical_language>

Target:
public byte[] getAPIData() { ByteArrayOutputStream data = new ByteArrayOutputStream(); data.write(frameID); try { data.write(sourceAddress64.getValue()); data.write(sourceAddress16.getValue()); data.write(ByteUtils.stringToByteArray(command)); data.write(status.getId()); if (commandValue != null) data.write(commandValue); } catch (IOException e) { logger.error(e.getMessage(), e); } return data.toByteArray(); }
Source:
<code><START> @Override public SecurityContext authenticate( AuthenticationContext authCtx) throws IgniteCheckedException { <END> SecurityCredentials credentials = authCtx.credentials(); if(credentials != null && user.equals(credentials.getLogin())) { if(credentials.getPassword().toString().equals(password)) { log.info("Admin access granted by " + authCtx.subjectType() + " from " + authCtx.address()); return new AllowAll(); } else { log.warning("Admin password error by " + authCtx.subjectType() + " from " + authCtx.address()); } } UUID uuid = authCtx.subjectId(); SecuritySubjectType securitySubjectType = authCtx.subjectType(); return new AllowSome( new Subject( uuid, securitySubjectType, credentials != null ? credentials.getLogin() : null, authCtx.address() ) ); }</code><technical_language>Please reformat this method current codestyle</technical_language>

Target:
@Override public SecurityContext authenticate(AuthenticationContext authCtx) { SecurityCredentials credentials = authCtx.credentials(); if (credentials != null && user.equals(credentials.getLogin())) { if (credentials.getPassword().toString().equals(password)) { log.info("Admin access granted by " + authCtx.subjectType() + " from " + authCtx.address()); return new AllowAll(); } else { log.warning("Admin password error by " + authCtx.subjectType() + " from " + authCtx.address()); } } UUID uuid = authCtx.subjectId(); SecuritySubjectType securitySubjectType = authCtx.subjectType(); return new AllowSome( new Subject(uuid, securitySubjectType, credentials != null ? credentials.getLogin() : null, authCtx.address()) ); }
Source:
<code>public String format(@Nullable String pattern) { String formatPattern = pattern; <START> if (formatPattern == null || "%s".equals(formatPattern)) { <END> formatPattern = "%2$s°N %3$s°E %1$sm"; } return String.format(formatPattern, getConstituents().values().toArray()); }</code><technical_language>If "%s".equals(formatPattern) is need check for null first. "%s".equals(null) safe return false</technical_language>

Target:
public String format(@Nullable String pattern) { String formatPattern = pattern; if (formatPattern == null || "%s".equals(formatPattern)) { formatPattern = LOCATION_PATTERN; } return String.format(formatPattern, getConstituents().values().toArray()); }
Source:
<code>public void shouldCallImporterMethodsWithCorrectArguments() { Range<DateTime> range = new Range<>(DATES.get(0), DATES.get(1)); <START> importer = Mockito.mock(CommcareFormImporterImpl.class); <END> when(importer.countForImport(eq(range), eq(CONFIG_NAME))).thenReturn(0); doNothing().when(importer).startImport(eq(range), eq(CONFIG_NAME)); eventHandler.setImporter(importer); MotechEvent event = prepareEvent(true); eventHandler.handleEvent(event); }</code><technical_language>annotation for this mock well</technical_language>

Target:
public void shouldCallImporterMethodsWithCorrectArguments() { Range<DateTime> range = new Range<>(DATES.get(0), DATES.get(1)); MotechEvent event = prepareEvent(true); when(importerFactory.getCommcareFormImporter()).thenReturn(importer); when(importer.countForImport(range, CONFIG_NAME)).thenReturn(0); doNothing().when(importer).startImport(range, CONFIG_NAME); eventHandler.handleEvent(event); verify(importer).countForImport(eq(range), eq(CONFIG_NAME)); verify(importer).startImport(eq(range), eq(CONFIG_NAME)); }
Source:
<code>public Collection<Partition<T>> definePartitions(Collection<Partition<T>> partitions, PartitioningContext context) { final int newPartitionCount = DefaultPartition.getRequiredPartitionCount(context, this.partitionCount); logger.debug("define partitions, partitionCount current requested {}", partitions.size(), newPartitionCount); DefaultPartition<T> partition = (DefaultPartition<T>)partitions.iterator().next(); <START> ArrayList<Partition<T>> newPartitions; <END> newPartitions = Lists.newArrayList(); Set partSet = Sets.newHashSet(); for (int partitionCounter = 0; partitionCounter < newPartitionCount; partitionCounter++) { DefaultPartition<T> partitionToAdd = new DefaultPartition<T>(partition.getPartitionedInstance()); newPartitions.add(partitionToAdd); partSet.add(partitionCounter); } List<InputPort<?>> inputPortList = context.getInputPorts(); if (inputPortList != null) { for (InputPort<?> port : inputPortList) { for (int i = 0; i < newPartitions.size(); i++) { newPartitions.get(i).getPartitionKeys().put(port, new PartitionKeys(i, partSet)); } } } logger.debug("new partition size {}", newPartitions.size()); return newPartitions; }</code><technical_language>ArrayList<Partition<T>> newPartitions = Lists.newArrayList(); remove line 112</technical_language>

Target:
public Collection<Partition<T>> definePartitions(Collection<Partition<T>> partitions, PartitioningContext context) { final int newPartitionCount = DefaultPartition.getRequiredPartitionCount(context, this.partitionCount); logger.debug("define partitions, partitionCount current requested {}", partitions.size(), newPartitionCount); DefaultPartition<T> partition = (DefaultPartition<T>)partitions.iterator().next(); ArrayList<Partition<T>> newPartitions = Lists.newArrayList(); Set partSet = Sets.newHashSet(); for (int partitionCounter = 0; partitionCounter < newPartitionCount; partitionCounter++) { newPartitions.add(new DefaultPartition<T>(partition.getPartitionedInstance())); partSet.add(partitionCounter); } List<InputPort<?>> inputPortList = context.getInputPorts(); if (inputPortList != null) { for (InputPort<?> port : inputPortList) { for (int i = 0; i < newPartitions.size(); i++) { newPartitions.get(i).getPartitionKeys().put(port, new PartitionKeys(i, partSet)); } } } logger.debug("new partition size {}", newPartitions.size()); return newPartitions; }
Source:
<code>public boolean hasValue(Path desiredPath) { for (AbstractConfigNode node : children) { <START> if (node instanceof ConfigNodeField) { <END> Path key = ((ConfigNodeField) node).path().value(); if (key.equals(desiredPath) || key.startsWith(desiredPath)) { return true; } else if (desiredPath.startsWith(key)) { if (((ConfigNodeField) node).value() instanceof ConfigNodeObject) { Path remainingPath = desiredPath.subPath(key.length()); if (((ConfigNodeObject) ((ConfigNodeField) node).value()).hasValue(remainingPath)) { return true; } } } } } return false; }</code><technical_language>if put ConfigNodeField field = (ConfigNodeField) node field below, avoid some of cast noise in code below</technical_language>

Target:
public boolean hasValue(Path desiredPath) { for (AbstractConfigNode node : children) { if (node instanceof ConfigNodeField) { ConfigNodeField field = (ConfigNodeField) node; Path key = field.path().value(); if (key.equals(desiredPath) || key.startsWith(desiredPath)) { return true; } else if (desiredPath.startsWith(key)) { if (field.value() instanceof ConfigNodeObject) { ConfigNodeObject obj = (ConfigNodeObject) field.value(); Path remainingPath = desiredPath.subPath(key.length()); if (obj.hasValue(remainingPath)) { return true; } } } } } return false; }
Source:
<code>private static void skipGeneratedFiles(JavaContext context) { PsiClass[] classes = context.getJavaFile().getClasses(); if (classes.length > 0 && classes[0].getName() != null) { String qualifiedName = classes[0].getName(); if (qualifiedName.contains("PermissionsDispatcher") || qualifiedName <START> .contains("PermissionsDispatcher")) { <END> return; } } }</code><technical_language>exact check in this if statement</technical_language>

Target:
private static void skipGeneratedFiles(JavaContext context) { PsiClass[] classes = context.getJavaFile().getClasses(); if (classes.length > 0 && classes[0].getName() != null) { String qualifiedName = classes[0].getName(); if (qualifiedName.contains("PermissionsDispatcher")) { return; } } }
Source:
<code>public void startStatementWithinTransaction(Command command) { Transaction transaction = getTransaction(); if (transaction != null) { HashSet<MVMap<?, ?>> currentMaps = null, allMaps = null; if (command != null) { Set<DbObject> dependencies = command.getDependencies(); currentMaps = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { addTableToDependencies((MVTable) dependency, currentMaps); } } switch (isolationLevel) { case REPEATABLE_READ: { allMaps = new HashSet<>(); HashSet<MVTable> processed = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { <START> addTableToDependencies((MVTable) dependency, dependencies, allMaps, processed); <END> } } break; } case SERIALIZABLE: if (!transaction.hasStatementDependencies()) { allMaps = new HashSet<>(); for (Table table : database.getAllTablesAndViews(false)) { if (table instanceof MVTable) { addTableToDependencies((MVTable) table, allMaps); } } } } } transaction.markStatementStart(isolationLevel, currentMaps, allMaps); } startStatement = -1; if (command != null) { setCurrentCommand(command); } }</code><technical_language>do care tables referenced integrity constrains in this case only</technical_language>

Target:
public void startStatementWithinTransaction(Command command) { Transaction transaction = getTransaction(); if (transaction != null) { HashSet<MVMap<?, ?>> currentMaps = null, allMaps = null; if (command != null) { Set<DbObject> dependencies = command.getDependencies(); currentMaps = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { addTableToDependencies((MVTable) dependency, currentMaps); } } switch (transaction.getIsolationLevel()) { case REPEATABLE_READ: { allMaps = new HashSet<>(); HashSet<MVTable> processed = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { addTableToDependencies((MVTable) dependency, allMaps, processed); } } break; } case SERIALIZABLE: if (!transaction.hasStatementDependencies()) { allMaps = new HashSet<>(); for (Table table : database.getAllTablesAndViews(false)) { if (table instanceof MVTable) { addTableToDependencies((MVTable) table, allMaps); } } } } } transaction.markStatementStart(currentMaps, allMaps); } startStatement = -1; if (command != null) { setCurrentCommand(command); } }
Source:
<code>protected SLDGenerator(Item item, Item selectedItem, Integer ribbon, SLDConfig config) { this.item = item; this.ribbon = ribbon; if (config instanceof ShorelineConfig) { ShorelineConfig slc = (ShorelineConfig)config; <START> slc.finalize(item, selectedItem); <END> this.config = slc; } else { this.config = config; } }</code><technical_language>this point pass in selectedItem instead of both</technical_language>

Target:
protected SLDGenerator(Item item, Item selectedItem, Integer ribbon, SLDConfig config) { this.item = item; this.ribbon = ribbon; if (config instanceof ShorelineConfig) { ShorelineConfig slc = (ShorelineConfig)config; slc.finalize(selectedItem); this.config = slc; } else { this.config = config; } }
Source:
<code>private boolean isMainMethod(ASTAnyTypeBodyDeclaration bodyDeclaration) { <START> if (!DeclarationKind.METHOD.equals(bodyDeclaration.getKind())) { <END> return false; } ASTMethodDeclaration decl = (ASTMethodDeclaration) bodyDeclaration.getDeclarationNode(); return decl.isStatic() && "main".equals(decl.getMethodName()) && decl.getResultType().isVoid() && decl.getFormalParameters().getParameterCount() == 1 && String[].class.equals(decl.getFormalParameters().iterator().next().getType()); }</code><technical_language>DeclarationKind.METHOD is a enum, I compare simply == != in case</technical_language>

Target:
private boolean isMainMethod(ASTAnyTypeBodyDeclaration bodyDeclaration) { if (DeclarationKind.METHOD != bodyDeclaration.getKind()) { return false; } ASTMethodDeclaration decl = (ASTMethodDeclaration) bodyDeclaration.getDeclarationNode(); return decl.isStatic() && "main".equals(decl.getMethodName()) && decl.getResultType().isVoid() && decl.getFormalParameters().getParameterCount() == 1 && String[].class.equals(decl.getFormalParameters().iterator().next().getType()); }
Source:
<code>public static boolean valueMatchesInUnaryTests(List<UnaryTest> unaryTests, Object value, DMNContext dmnContext) { FEELEventListenersManager manager = new FEELEventListenersManager(); FEELEventsListenerImpl listener = new FEELEventsListenerImpl(); manager.addListener( listener ); <START> EvaluationContextImpl ctx = new EvaluationContextImpl(Thread.currentThread().getContextClassLoader(), manager); <END> try { ctx.enterFrame(); if ( dmnContext != null ) { for ( Map.Entry<String,Object> entry : dmnContext.getAll().entrySet() ) { ctx.setValue( entry.getKey(), entry.getValue() ); } } for ( UnaryTest t : unaryTests ) { try { Boolean applyT = t.apply( ctx, value ); if ( applyT == null ) { return false; } else if ( applyT ) { return true; } } catch ( Throwable e ) { StringBuilder message = new StringBuilder( ); for( FEELEvent feelEvent : listener.getFeelEvents() ) { message.append( feelEvent.getMessage() ); message.append( "\n" ); } throw new RuntimeException( message.toString(), e ); } } } finally { ctx.exitFrame(); } return false; }</code><technical_language>is this correct? in Drools, is context classloader.. is a hierarchy of cases need respect... @mariofusco give details it... a method returns classloader call method logic is tricky get right</technical_language>

Target:
public static boolean valueMatchesInUnaryTests(List<UnaryTest> unaryTests, Object value, DMNContext dmnContext) { FEELEventListenersManager manager = new FEELEventListenersManager(); FEELEventsListenerImpl listener = new FEELEventsListenerImpl(); manager.addListener( listener ); EvaluationContextImpl ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), manager); try { ctx.enterFrame(); if ( dmnContext != null ) { for ( Map.Entry<String,Object> entry : dmnContext.getAll().entrySet() ) { ctx.setValue( entry.getKey(), entry.getValue() ); } } for ( UnaryTest t : unaryTests ) { try { Boolean applyT = t.apply( ctx, value ); if ( applyT == null ) { return false; } else if ( applyT ) { return true; } } catch ( Throwable e ) { StringBuilder message = new StringBuilder( ); for( FEELEvent feelEvent : listener.getFeelEvents() ) { message.append( feelEvent.getMessage() ); message.append( "\n" ); } throw new RuntimeException( message.toString(), e ); } } } finally { ctx.exitFrame(); } return false; }
Source:
<code>public void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException { final long barrierId = receivedBarrier.getId(); if (totalNumberOfInputChannels == 1) { resumeConsumption(channelInfo); if (barrierId > currentCheckpointId) { currentCheckpointId = barrierId; <START> markCheckpointStart(receivedBarrier.getTimestamp()); <END> markAlignmentEnd(0); notifyCheckpoint(receivedBarrier); } return; } if (isCheckpointPending()) { if (barrierId == currentCheckpointId) { onBarrier(channelInfo); } else if (barrierId > currentCheckpointId) { LOG.warn("{}: Received checkpoint barrier for checkpoint before completing current checkpoint {}. " + "Skipping current checkpoint.", taskName, barrierId, currentCheckpointId); notifyAbort(currentCheckpointId, new CheckpointException( "Barrier id: " + barrierId, CheckpointFailureReason.CHECKPOINT_DECLINED_SUBSUMED)); releaseBlocksAndResetBarriers(); beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } } else if (barrierId > currentCheckpointId) { beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } if (numBarriersReceived + numClosedChannels == totalNumberOfInputChannels) { if (LOG.isDebugEnabled()) { LOG.debug("{}: Received all barriers, triggering checkpoint at {}.", taskName, receivedBarrier.getId(), receivedBarrier.getTimestamp()); } releaseBlocksAndResetBarriers(); notifyCheckpoint(receivedBarrier); } }</code><technical_language>Is previous commit "correct" this change? feels squashed</technical_language>

Target:
public void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException { final long barrierId = receivedBarrier.getId(); if (totalNumberOfInputChannels == 1) { resumeConsumption(channelInfo); if (barrierId > currentCheckpointId) { currentCheckpointId = barrierId; markAlignmentStartAndEnd(receivedBarrier.getTimestamp()); notifyCheckpoint(receivedBarrier); } return; } if (isCheckpointPending()) { if (barrierId == currentCheckpointId) { onBarrier(channelInfo); } else if (barrierId > currentCheckpointId) { LOG.warn("{}: Received checkpoint barrier for checkpoint before completing current checkpoint {}. " + "Skipping current checkpoint.", taskName, barrierId, currentCheckpointId); notifyAbort(currentCheckpointId, new CheckpointException( "Barrier id: " + barrierId, CheckpointFailureReason.CHECKPOINT_DECLINED_SUBSUMED)); releaseBlocksAndResetBarriers(); beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } } else if (barrierId > currentCheckpointId) { beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } if (numBarriersReceived + numClosedChannels == totalNumberOfInputChannels) { if (LOG.isDebugEnabled()) { LOG.debug("{}: Received all barriers, triggering checkpoint at {}.", taskName, receivedBarrier.getId(), receivedBarrier.getTimestamp()); } releaseBlocksAndResetBarriers(); markAlignmentEnd(); notifyCheckpoint(receivedBarrier); } }
Source:
<code>public void onCreate() { super.onCreate(); setUpPicasso(); <START> FirebaseApp.initializeApp(this); <END> Mapbox.getInstance(this, getString(R.string.access_token)); Mapbox.getTelemetry().setDebugLoggingEnabled(true); setUpTileLoadingMeasurement(); if (!BuildConfig.DEBUG) { setUpCrashlytics(); } }</code><technical_language>This if-check for debug builds, otherwise, prints a lot of failure logs in logcat</technical_language>

Target:
public void onCreate() { super.onCreate(); setUpPicasso(); if (!BuildConfig.DEBUG) { FirebaseApp.initializeApp(this); setUpCrashlytics(); } Mapbox.getInstance(this, getString(R.string.access_token)); Mapbox.getTelemetry().setDebugLoggingEnabled(true); setUpTileLoadingMeasurement(); }
Source:
<code>public CSVTupleDataLoader(ClientImpl client, String procName, BulkLoaderErrorHandler errHandler) throws IOException, ProcCallException { m_client = client; m_insertProcedure = procName; m_errHandler = errHandler; <START> m_es = CoreUtils.getSingleThreadExecutor(procName + "-" + Thread.currentThread().getName()); <END> List<VoltType> typeList = Lists.newArrayList(); VoltTable procInfo = client.callProcedure("@SystemCatalog", "PROCEDURECOLUMNS").getResults()[0]; while (procInfo.advanceRow()) { if (m_insertProcedure.equalsIgnoreCase(procInfo.getString("PROCEDURE_NAME"))) { String typeStr = (String) procInfo.get("TYPE_NAME", VoltType.STRING); typeList.add(VoltType.typeFromString(typeStr)); } } if (typeList.isEmpty()) { throw new RuntimeException("No matching insert procedure available"); } m_columnTypes = typeList.toArray(new VoltType[0]); int sleptTimes = 0; while (!client.isHashinatorInitialized() && sleptTimes < 120) { try { Thread.sleep(500); sleptTimes++; } catch (InterruptedException ex) } }</code><technical_language>loader get this. success submit task kafkaloader side executor for kafka? create if successReporting is enabled</technical_language>

Target:
public CSVTupleDataLoader(ClientImpl client, String procName, BulkLoaderErrorHandler errHandler) throws IOException, ProcCallException { this(client, procName, errHandler, null); }
Source:
<code><START> public void read() throws Exception { <END> AlluxioURI path = new AlluxioURI(mFilePath); FileSystemTestUtils.createByteFile( mFileSystem, mFilePath, WritePType.MUST_CACHE, PAGE_SIZE_BYTES); try (FileInStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } URIStatus status = mFileSystem.getStatus(path); try (ReadableByteChannel channel = mCacheManager.get(new PageId(status.getFileId(), 0))) { assertNotNull(channel); assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(Channels.newInputStream(channel)))); } mClusterResource.get().stopWorkers(); try (InputStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } }</code><technical_language>I suggest remove assertions mCacheManager is implementation details for integration tests (meant testing user-facing APIs mCacheManager is not). great already: java @Test public void read() throws Exception { AlluxioURI path = new AlluxioURI(mFilePath); FileSystemTestUtils.createByteFile( mFileSystem, mFilePath, WritePType.MUST_CACHE, PAGE_SIZE_BYTES); // read a file populate cache try (FileInStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } mClusterResource.get().stopWorkers(); // verify reading local cache try (InputStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } }</technical_language>

Target:
public void read() throws Exception { AlluxioURI path = new AlluxioURI(mFilePath); FileSystemTestUtils.createByteFile( mFileSystem, mFilePath, WritePType.MUST_CACHE, PAGE_SIZE_BYTES); try (FileInStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } mClusterResource.get().stopWorkers(); try (InputStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } }
Source:
<code>private Long parseUploadSize(String maxUploadSizeString) throws SizeFormatValidationException { String sizeUnit = maxUploadSizeString.replaceAll("[^A-Z]", ""); Long size = Long.parseLong(maxUploadSizeString.replaceAll("[^0-9]", "")); int pow; switch (sizeUnit) { case "B": pow = 0; break; case "KB": pow = 1; break; case "MB": pow = 2; break; case "GB": pow = 3; break; default: throw new SizeFormatValidationException(sizeUnit + " is not acceptable upload size unit"); } <START> Long multiplier = new Double(Math.pow(1024,pow)).longValue(); <END> return multiplier*size; }</code><technical_language>suggestion Long multiplier = Double.valueOf(Math.pow(1024,pow)).longValue();</technical_language>

Target:
private Long parseUploadSize(String maxUploadSizeString) throws SizeFormatValidationException { String sizeUnit = maxUploadSizeString.replaceAll("[^A-Z]", ""); Long size = Long.parseLong(maxUploadSizeString.replaceAll("[^0-9]", "")); int pow; switch (sizeUnit) { case "B": pow = 0; break; case "KB": pow = 1; break; case "MB": pow = 2; break; case "GB": pow = 3; break; default: throw new SizeFormatValidationException(sizeUnit + " is not acceptable upload size unit"); } Long multiplier = Double.valueOf(Math.pow(1024,pow)).longValue(); return multiplier*size; }
Source:
<code>public void removeSessionPersistenceSslId() throws InsufficientRequestException, StingrayRestClientObjectNotFoundException, StingrayRestClientException, StmRollBackException { StingrayRestClient client = new StingrayRestClient(); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); <START> Assert.assertEquals(SessionPersistence.SOURCE_IP.name(), <END> client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.NONE); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals(SessionPersistence.SOURCE_IP.name(), client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(null); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); }</code><technical_language>this test pass? I set session persistence SSL_ID verify is SOURCE_IP</technical_language>

Target:
public void removeSessionPersistenceSslId() throws InsufficientRequestException, StingrayRestClientObjectNotFoundException, StingrayRestClientException, StmRollBackException { StingrayRestClient client = new StingrayRestClient(); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals(SessionPersistence.SSL_ID.name(), client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.NONE); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals(SessionPersistence.SSL_ID.name(), client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(null); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); }
Source:
<code>public int serialize(OutputStream out, Tuple input) throws IOException { JSONObject jsonObject = new JSONObject(); for (int i = 0; i < columnNum; i++) { if (input.isNull(i)) { continue; } String fieldName = simpleNames[i]; Type type = types[i]; switch (type) { case BOOLEAN: jsonObject.put(fieldName, input.getBool(i)); break; case INT1: case INT2: jsonObject.put(fieldName, input.getInt2(i)); break; case INT4: jsonObject.put(fieldName, input.getInt4(i)); break; case INT8: jsonObject.put(fieldName, input.getInt8(i)); break; case FLOAT4: jsonObject.put(fieldName, input.getFloat4(i)); break; case FLOAT8: jsonObject.put(fieldName, input.getFloat8(i)); break; case CHAR: case TEXT: case VARCHAR: case INET4: case TIMESTAMP: case DATE: case TIME: case INTERVAL: jsonObject.put(fieldName, input.getText(i)); break; case BIT: case BINARY: case BLOB: case VARBINARY: jsonObject.put(fieldName, input.getBytes(i)); break; case NULL_TYPE: break; default: throw new NotImplementedException(types[i].name() + " is not supported."); } } String jsonStr = jsonObject.toJSONString(); <START> byte jsonBytes = jsonStr.getBytes(); <END> out.write(jsonBytes); return jsonBytes.length; }</code><technical_language>add charset UTF8</technical_language>

Target:
public int serialize(OutputStream out, Tuple input) throws IOException { JSONObject jsonObject = new JSONObject(); for (int i = 0; i < columnNum; i++) { if (input.isNull(i)) { continue; } String fieldName = simpleNames[i]; Type type = types[i]; switch (type) { case BOOLEAN: jsonObject.put(fieldName, input.getBool(i)); break; case INT1: case INT2: jsonObject.put(fieldName, input.getInt2(i)); break; case INT4: jsonObject.put(fieldName, input.getInt4(i)); break; case INT8: jsonObject.put(fieldName, input.getInt8(i)); break; case FLOAT4: jsonObject.put(fieldName, input.getFloat4(i)); break; case FLOAT8: jsonObject.put(fieldName, input.getFloat8(i)); break; case CHAR: case TEXT: case VARCHAR: case INET4: case TIMESTAMP: case DATE: case TIME: case INTERVAL: jsonObject.put(fieldName, input.getText(i)); break; case BIT: case BINARY: case BLOB: case VARBINARY: jsonObject.put(fieldName, input.getBytes(i)); break; case NULL_TYPE: break; default: throw new NotImplementedException(types[i].name() + " is not supported."); } } String jsonStr = jsonObject.toJSONString(); byte jsonBytes = jsonStr.getBytes(TextDatum.DEFAULT_CHARSET); out.write(jsonBytes); return jsonBytes.length; }
Source:
<code>public int execute() throws HiveException { <START> Context ctx = context.getDriverQueue().getCtx(); <END> HiveTxnManager txnManager = ctx.getHiveTxnManager(); return txnManager.lockTable(context.getDb(), desc); }</code><technical_language>apparently this is a queue: a queue getCtx() method</technical_language>

Target:
public int execute() throws HiveException { Context ctx = context.getContext(); HiveTxnManager txnManager = ctx.getHiveTxnManager(); return txnManager.lockTable(context.getDb(), desc); }
Source:
<code>protected void setupTicks(boolean isSpout) { final Integer tickTimeSecs = ObjectReader.getInt(topoConf.get(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS), null); if (tickTimeSecs != null) { boolean enableMessageTimeout = (Boolean) topoConf.get(Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS); if ((!Acker.ACKER_COMPONENT_ID.equals(componentId) && Utils.isSystemId(componentId)) || (!enableMessageTimeout && isSpout)) { <START> LOG.info("Timeouts disabled for executor " + componentId + ":" + executorId); <END> } else { StormTimer timerTask = workerData.getUserTimer(); timerTask.scheduleRecurring(tickTimeSecs, tickTimeSecs, () -> { TupleImpl tuple = new TupleImpl(workerTopologyContext, new Values(tickTimeSecs), Constants.SYSTEM_COMPONENT_ID, (int) Constants.SYSTEM_TASK_ID, Constants.SYSTEM_TICK_STREAM_ID); AddressedTuple tickTuple = new AddressedTuple(AddressedTuple.BROADCAST_DEST, tuple); try { receiveQueue.publish(tickTuple); receiveQueue.flush(); } catch (InterruptedException e) { LOG.warn("Thread interrupted when emitting tick tuple. Setting interrupt flag."); Thread.currentThread().interrupt(); return; } } ); } } }</code><technical_language>nit: String concatenation</technical_language>

Target:
protected void setupTicks(boolean isSpout) { final Integer tickTimeSecs = ObjectReader.getInt(topoConf.get(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS), null); if (tickTimeSecs != null) { boolean enableMessageTimeout = (Boolean) topoConf.get(Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS); if ((!Acker.ACKER_COMPONENT_ID.equals(componentId) && Utils.isSystemId(componentId)) || (!enableMessageTimeout && isSpout)) { LOG.info("Timeouts disabled for executor {}:{}", componentId, executorId); } else { StormTimer timerTask = workerData.getUserTimer(); timerTask.scheduleRecurring(tickTimeSecs, tickTimeSecs, () -> { TupleImpl tuple = new TupleImpl(workerTopologyContext, new Values(tickTimeSecs), Constants.SYSTEM_COMPONENT_ID, (int) Constants.SYSTEM_TASK_ID, Constants.SYSTEM_TICK_STREAM_ID); AddressedTuple tickTuple = new AddressedTuple(AddressedTuple.BROADCAST_DEST, tuple); try { receiveQueue.publish(tickTuple); receiveQueue.flush(); } catch (InterruptedException e) { LOG.warn("Thread interrupted when emitting tick tuple. Setting interrupt flag."); Thread.currentThread().interrupt(); return; } } ); } } }
Source:
<code>private String processQuery(String luceneQuery) throws DotDataException, DotSecurityException { if (luceneQuery == null) { return null; } if (luceneQuery.contains(Contentlet.STRUCTURE_NAME_KEY + ":")) { <START> luceneQuery = luceneQuery.replace(Contentlet.STRUCTURE_NAME_KEY + ":", "ContentType:"); <END> } String stInodeKey = Contentlet.STRUCTURE_INODE_KEY + ":"; if (luceneQuery.contains(stInodeKey)) { int startIndex = luceneQuery.indexOf(stInodeKey) + stInodeKey.length(); int endIndex = luceneQuery.indexOf(" ", startIndex); String inode = (endIndex < 0) ? luceneQuery.substring(startIndex) : luceneQuery.substring(startIndex, endIndex); ContentType type = APILocator.getContentTypeAPI(APILocator.systemUser()).find(inode); if (type != null && InodeUtils.isSet(type.inode())) { luceneQuery = luceneQuery.replace(Contentlet.STRUCTURE_INODE_KEY + ":", "ContentType:"); luceneQuery = luceneQuery.replace(inode, type.variable()); } } return luceneQuery; }</code><technical_language>do replace more one</technical_language>

Target:
private String processQuery(String luceneQuery) throws DotDataException, DotSecurityException { if (luceneQuery == null) { return null; } if (luceneQuery.contains(Contentlet.STRUCTURE_NAME_KEY + ":")) { luceneQuery = luceneQuery.replaceAll(Contentlet.STRUCTURE_NAME_KEY + ":", "ContentType:"); } String stInodeKey = Contentlet.STRUCTURE_INODE_KEY + ":"; if (luceneQuery.contains(stInodeKey)) { int startIndex = luceneQuery.indexOf(stInodeKey) + stInodeKey.length(); int endIndex = luceneQuery.indexOf(' ', startIndex); String inode = (endIndex < 0) ? luceneQuery.substring(startIndex) : luceneQuery.substring(startIndex, endIndex); ContentType type = APILocator.getContentTypeAPI(APILocator.systemUser()).find(inode); if (type != null && InodeUtils.isSet(type.inode())) { luceneQuery = luceneQuery.replace(Contentlet.STRUCTURE_INODE_KEY + ":", "ContentType:"); luceneQuery = luceneQuery.replace(inode, type.variable()); } } return luceneQuery; }
Source:
<code>private void closeErrorDialog() { int counterErrorDialog = 0; while (informationDialog.isFormOpened()) { counterErrorDialog++; if (counterErrorDialog > 5) { <START> Assert.assertEquals( <END> counterErrorDialog, 5, "The unexpected error information dialog is appeared more 5 times"); } informationDialog.waitFormToOpen(); informationDialog.clickOkBtn(); projectWizard.clickSaveButton(); loader.waitOnClosed(); } }</code><technical_language>"assertEquals" redundant, in opinion, "Assert.fail()" is in this case: fail("The unexpected error information dialog is appeared more "+ counterErrorDialog +" times");</technical_language>

Target:
private void closeErrorDialog() { int counterErrorDialog = 0; while (informationDialog.isFormOpened()) { counterErrorDialog++; if (counterErrorDialog > 5) { fail( "The unexpected error information dialog is appeared more than " + counterErrorDialog + " times"); } informationDialog.waitFormToOpen(); informationDialog.clickOkBtn(); projectWizard.clickSaveButton(); loader.waitOnClosed(); } }
Source:
<code>public void poll() { try { StringFullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest(HttpMethod.GET, RulesResource.RULES_ENDPOINT) ); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while polling rules, status[%s] content[%s]", response.getStatus(), response.getContent() ); } <START> Map<String, List<Rule>> newRules = new HashMap<>( <END> (Map<String, List<Rule>>) jsonMapper.readValue( response.getContent(), new TypeReference<Map<String, List<Rule>>>() { } ) ); log.debug("Got [%,d] rules", newRules.size()); rules.set(newRules); } catch (Exception e) { log.error(e, "Exception while polling for rules"); } }</code><technical_language>new HashMap() unnecessary</technical_language>

Target:
public void poll() { try { StringFullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest(HttpMethod.GET, RulesResource.RULES_ENDPOINT) ); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while polling rules, status[%s] content[%s]", response.getStatus(), response.getContent() ); } rules.set( Collections.unmodifiableMap(jsonMapper.readValue( response.getContent(), new TypeReference<Map<String, List<Rule>>>() { } )) ); } catch (Exception e) { log.error(e, "Exception while polling for rules"); } }
Source:
<code>public void createVolume(OmVolumeArgs args) throws IOException { try { if(isAclEnabled) { if (!ozAdmins.contains(OZONE_ADMINISTRATORS_WILDCARD) && !ozAdmins.contains(ProtobufRpcEngine.Server.getRemoteUser() .getUserName())) { LOG.error("Only admin users are authorized to create " + <START> "Ozone volumes. User :{} is not an.", <END> ProtobufRpcEngine.Server.getRemoteUser().getUserName()); throw new OMException("Only admin users are authorized to create " + "Ozone volumes.", ResultCodes.PERMISSION_DENIED); } } metrics.incNumVolumeCreates(); volumeManager.createVolume(args); AUDIT.logWriteSuccess(buildAuditMessageForSuccess(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap())); metrics.incNumVolumes(); } catch (Exception ex) { metrics.incNumVolumeCreateFails(); AUDIT.logWriteFailure( buildAuditMessageForFailure(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap(), ex) ); throw ex; } }</code><technical_language>This error message is incomplete</technical_language>

Target:
public void createVolume(OmVolumeArgs args) throws IOException { try { if(isAclEnabled) { if (!ozAdmins.contains(OZONE_ADMINISTRATORS_WILDCARD) && !ozAdmins.contains(ProtobufRpcEngine.Server.getRemoteUser() .getUserName())) { LOG.error("Only admin users are authorized to create " + "Ozone volumes. User :{} is not an admin.", ProtobufRpcEngine.Server.getRemoteUser().getUserName()); throw new OMException("Only admin users are authorized to create " + "Ozone volumes.", ResultCodes.PERMISSION_DENIED); } } metrics.incNumVolumeCreates(); volumeManager.createVolume(args); AUDIT.logWriteSuccess(buildAuditMessageForSuccess(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap())); metrics.incNumVolumes(); } catch (Exception ex) { metrics.incNumVolumeCreateFails(); AUDIT.logWriteFailure( buildAuditMessageForFailure(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap(), ex) ); throw ex; } }
Source:
<code>public final List<CredentialsDescriptor> getCredentialsDescriptors() { List<CredentialsDescriptor> result = DescriptorVisibilityFilter.apply(this, ExtensionList.lookup(CredentialsDescriptor.class)); if (!(result instanceof ArrayList)) { result = new ArrayList<>(result); } <START> result.removeIf(d -> !_isApplicable(d)); <END> return result; }</code><technical_language>similarly</technical_language>

Target:
public final List<CredentialsDescriptor> getCredentialsDescriptors() { return DescriptorVisibilityFilter.apply(this, ExtensionList.lookup(CredentialsDescriptor.class)) .stream() .filter(this::_isApplicable) .collect(Collectors.toList()); }
Source:
<code>private boolean startPacketRecovery(FlexFec03Packet fecPacket, RawPacket recoveredPacket) { if (fecPacket.getLength() < FlexFec03Packet.FIXED_HEADER_SIZE) { logger.error("Given FlexFEC packet is too small"); return false; } if (recoveredPacket.getBuffer().length < RawPacket.FIXED_HEADER_SIZE) { logger.error("Given RawPacket buffer is too small"); return false; } <START> System.arraycopy(fecPacket.getBuffer(), fecPacket.getHeaderLength(), <END> recoveredPacket.getBuffer(), 0, RawPacket.FIXED_HEADER_SIZE); System.arraycopy( fecPacket.getBuffer(), fecPacket.getHeaderLength() + fecPacket.getFlexFecHeaderSize(), recoveredPacket.getBuffer(), RawPacket.FIXED_HEADER_SIZE, fecPacket.getPayloadLength()); return true; }</code><technical_language>I this needs fecPacket offset account</technical_language>

Target:
private boolean startPacketRecovery(FlexFec03Packet fecPacket, RawPacket recoveredPacket) { if (fecPacket.getLength() < RawPacket.FIXED_HEADER_SIZE) { logger.error("Given FlexFEC packet is too small"); return false; } if (recoveredPacket.getBuffer().length < fecPacket.getLength()) { logger.error("Given RawPacket buffer is too small"); return false; } System.arraycopy(fecPacket.getBuffer(), fecPacket.getFlexFecHeaderOffset(), recoveredPacket.getBuffer(), 0, RawPacket.FIXED_HEADER_SIZE); System.arraycopy( fecPacket.getBuffer(), fecPacket.getFlexFecHeaderOffset() + fecPacket.getFlexFecHeaderSize(), recoveredPacket.getBuffer(), RawPacket.FIXED_HEADER_SIZE, fecPacket.getFlexFecPayloadLength()); return true; }
Source:
<code>public void tearDown() { <START> mHandlerThread.quitSafely(); <END> }</code><technical_language>tearDown() call super.tearDown(); try { mHandlerThread.quitSafely(); } finally { super.tearDown(); }</technical_language>

Target:
public void tearDown() throws Exception { try { mHandlerThread.quitSafely(); } finally { super.tearDown(); } }
Source:
<code>public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx) { assert nonNull(cctx); if (rebuildIsMeaningless(cctx)) return null; boolean empty = true; for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) { if (!store.isEmpty()) { empty = false; break; } } if (empty) return null; if (!busyLock.enterBusy()) { return new GridFinishedFuture<>(new NodeStoppingException("Failed to rebuild indexes from hash " + "(grid is stopping).")); } try { <START> return rebuildIndexesFromHash0(cctx, false); <END> } finally { busyLock.leaveBusy(); } }</code><technical_language>This place rebuildInMemory=false. eliminate this new flag in bellow methods if add if if (cctx.group().persistenceEnabled()) return rebuildIndexesFromHash0(cctx); remove persistence check in // data in fresh in-memory cache. If force, this meant indexing is enabling dynamically. if (!cctx.group().persistenceEnabled() && !rebuildInMemory) return null;</technical_language>

Target:
public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx) { assert nonNull(cctx); if (rebuildIsMeaningless(cctx)) return chainIndexRebuildFuture(null, cctx); boolean empty = true; for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) { if (!store.isEmpty()) { empty = false; break; } } if (empty) return chainIndexRebuildFuture(null, cctx); if (!busyLock.enterBusy()) { return new GridFinishedFuture<>(new NodeStoppingException("Failed to rebuild indexes from hash " + "(grid is stopping).")); } try { return rebuildIndexesFromHash0(cctx); } finally { busyLock.leaveBusy(); } }
Source:
<code>protected void processAuxiliary(boolean finalize) { if (waitingEvents.size() > 0) { Iterator<Map.Entry<T, Future<Slice>>> waitIterator = waitingEvents.entrySet().iterator(); <START> while (waitIterator.hasNext()) { <END> Map.Entry<T, Future<Slice>> waitingEvent = waitIterator.next(); T tuple = waitingEvent.getKey(); Slice tupleKey = getKey(tuple); long tupleTime = getTime(tuple); Future<Slice> future = waitingEvent.getValue(); if (future.isDone() || finalize ) { try { if (future.get() == null && asyncEvents.get(tupleKey) == null) { managedState.put(tupleTime, tupleKey, tupleKey); asyncEvents.put(tupleKey, tupleTime); processUnique(tuple); } else { processDuplicate(tuple); } } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("handle idle time", e); } waitIterator.remove(); } } } else { try { Thread.sleep(sleepMillis); } catch (InterruptedException ie) { throw new RuntimeException(ie); } } }</code><technical_language>a single call handleIdleTime, please care of a single waitingEvent instead of care of events in a single handleIdleTime. In endWindow, this is fine.. in handleIdleTime, allow engine control amount of time handleIdleTime is called</technical_language>

Target:
protected void processAuxiliary(boolean finalize) { if (waitingEvents.size() > 0) { Iterator<Map.Entry<T, Future<Slice>>> waitIterator = waitingEvents.entrySet().iterator(); while (waitIterator.hasNext()) { Map.Entry<T, Future<Slice>> waitingEvent = waitIterator.next(); T tuple = waitingEvent.getKey(); Slice tupleKey = getKey(tuple); long tupleTime = getTime(tuple); Future<Slice> future = waitingEvent.getValue(); if (future.isDone() || finalize ) { try { if (future.get() == null && asyncEvents.get(tupleKey) == null) { managedState.put(tupleTime, tupleKey, new Slice(new byte[0])); asyncEvents.put(tupleKey, tupleTime); processUnique(tuple); } else { processDuplicate(tuple); } } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("handle idle time", e); } waitIterator.remove(); } if (!finalize) { break; } } } }
Source:
<code>public StreamDescriptor(String streamName, int streamId, String fieldName, OrcType orcType, OrcDataSource orcDataSource, List<StreamDescriptor> nestedStreams, int sequence) { this.streamName = requireNonNull(streamName, "streamName is null"); this.streamId = streamId; this.sequence = sequence; this.fieldName = requireNonNull(fieldName, "fieldName is null"); <START> this.orcType = requireNonNull(orcType, "type is null"); <END> this.orcDataSource = requireNonNull(orcDataSource, "orcDataSource is null"); this.nestedStreams = ImmutableList.copyOf(requireNonNull(nestedStreams, "nestedStreams is null")); }</code><technical_language>nit: "type is null" -> "orcType is null"</technical_language>

Target:
public StreamDescriptor(String streamName, int streamId, String fieldName, OrcType orcType, OrcDataSource orcDataSource, List<StreamDescriptor> nestedStreams, int sequence) { this.streamName = requireNonNull(streamName, "streamName is null"); this.streamId = streamId; this.sequence = sequence; this.fieldName = requireNonNull(fieldName, "fieldName is null"); this.orcType = requireNonNull(orcType, "orcType is null"); this.orcDataSource = requireNonNull(orcDataSource, "orcDataSource is null"); this.nestedStreams = ImmutableList.copyOf(requireNonNull(nestedStreams, "nestedStreams is null")); }
Source:
<code>public static double alpha(int indexBitLength) { double alpha; switch (indexBitLength) { case 4: <START> alpha = 0.673; <END> break; case 5: alpha = 0.697; break; case 6: alpha = 0.709; break; default: alpha = (0.7213 / (1 + 1.079 / numberOfBuckets(indexBitLength))); } return alpha; }</code><technical_language>Return</technical_language>

Target:
public static double alpha(int indexBitLength) { switch (indexBitLength) { case 4: return 0.673; case 5: return 0.697; case 6: return 0.709; default: return (0.7213 / (1 + 1.079 / numberOfBuckets(indexBitLength))); } }
Source:
<code>void enqueue() throws IOException; } private final List<QueueRequestCallback> pendingBatchEntries; private final BatchRequest batch; private final long maxRequestsPerBatch; private boolean flushing = false; private BatchHelper(HttpRequestInitializer requestInitializer, Storage gcs, long maxRequestsPerBatch) { this.pendingBatchEntries = new LinkedList<>(); this.batch = gcs.batch(requestInitializer); <START> this.batch.getBatchUrl().appendRawPath("/" + Storage.DEFAULT_SERVICE_PATH); <END> this.maxRequestsPerBatch = maxRequestsPerBatch; }</code><technical_language>Is / done guard this happening in 1.7</technical_language>

Target:
void enqueue() throws IOException; } private final List<QueueRequestCallback> pendingBatchEntries; private final BatchRequest batch; private final long maxRequestsPerBatch; private boolean flushing = false; private BatchHelper(HttpRequestInitializer requestInitializer, Storage gcs, long maxRequestsPerBatch) { this.pendingBatchEntries = new LinkedList<>(); this.batch = gcs.batch(requestInitializer); if (this.batch.getBatchUrl().getRawPath().endsWith("batch")) { this.batch.getBatchUrl().appendRawPath("/" + Storage.DEFAULT_SERVICE_PATH); } this.maxRequestsPerBatch = maxRequestsPerBatch; }