auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testDefaultConfig() throws Exception { Files.write(springTestFile.toPath(), "modification".getBytes(), StandardOpenOption.SYNC); Thread.sleep(50); Files.write(springTestFile.toPath(), "modification 2".getBytes(), StandardOpenOption.SYNC); MockEndpoint mock = getMockEndpoint("mock:springTest"); mock.setExpectedCount(1); mock.setResultWaitTime(1000); mock.assertIsSatisfied(); }

Target:
public void testDefaultConfig() throws Exception { Files.write(springTestFile.toPath(), "modification".getBytes(), StandardOpenOption.SYNC); Thread.sleep(50); Files.write(springTestFile.toPath(), "modification 2".getBytes(), StandardOpenOption.SYNC); MockEndpoint mock = getMockEndpoint("mock:springTest"); mock.setExpectedCount(2); mock.setResultWaitTime(1000); mock.assertIsSatisfied(); }
Source:
public EmbeddedZookeeper() throws IOException { this(-1); }

Target:
public EmbeddedZookeeper() throws IOException { this(0); }
Source:
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Map<String, Object> examples = parseExamples(apiResponse.examples()); Response response = new Response() .description(apiResponse.message()).headers(responseHeaders).setExamples(examples); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }

Target:
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Map<String, Object> examples = parseExamples(apiResponse.examples()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); response.setExamples(examples); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
Source:
void testUpdateEntry(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { dbmsProcessor.setupSharedDatabase(); BibEntry expectedEntry = getBibEntryExample(); dbmsProcessor.insertEntry(expectedEntry); expectedEntry.setType(StandardEntryType.Book); expectedEntry.setField(StandardField.AUTHOR, "Michael J and Hutchings"); expectedEntry.setField(new UnknownField("customField"), "custom value"); expectedEntry.clearField(StandardField.BOOKTITLE); dbmsProcessor.updateEntry(expectedEntry); Optional<BibEntry> actualEntryOptional = dbmsProcessor.getSharedEntry(expectedEntry.getSharedBibEntryData().getSharedID()); assertEquals(expectedEntry, actualEntryOptional.get()); clear(dbmsConnection); }

Target:
void testUpdateEntry(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { dbmsProcessor.setupSharedDatabase(); BibEntry expectedEntry = getBibEntryExample(); dbmsProcessor.insertEntry(expectedEntry); expectedEntry.setType(StandardEntryType.Book); expectedEntry.setField(StandardField.AUTHOR, "Michael J and Hutchings"); expectedEntry.setField(new UnknownField("customField"), "custom value"); expectedEntry.clearField(StandardField.BOOKTITLE); dbmsProcessor.updateEntry(expectedEntry); Optional<BibEntry> actualEntry = dbmsProcessor.getSharedEntry(expectedEntry.getSharedBibEntryData().getSharedID()); assertEquals(expectedEntry, actualEntry.get()); clear(dbmsConnection); }
Source:
private KieTuple readObjectFromADifferentClassloader(Object o) { ObjectInput in = null; ObjectOutput out; ByteArrayInputStream bis; ByteArrayOutputStream bos = null; try { bos = new ByteArrayOutputStream(); out = new ObjectOutputStream(bos); out.writeObject(o); out.flush(); byte[] objBytes = bos.toByteArray(); bis = new ByteArrayInputStream(objBytes); in = new ObjectInputStream(bis); Object newObj = in.readObject(); return new KieTuple(newObj); } catch (NotSerializableException nse) { logger.debug("Object it not serializable {}", nse.getMessage()); StringBuilder sb = new StringBuilder("NotSerializableException:").append(nse.getMessage()); return new KieTuple(sb.toString()); } catch (IOException ioe) { StringBuilder sb = new StringBuilder("IOException:").append(ioe.getMessage()); return new KieTuple(sb.toString()); } catch (ClassNotFoundException cnfe) { StringBuilder sb = new StringBuilder("ClassNotFoundException:").append(cnfe.getMessage()); return new KieTuple(sb.toString()); } catch (Exception e) { StringBuilder sb = new StringBuilder("Exception:").append(e.getMessage()); return new KieTuple(sb.toString()); } finally { try { if (bos != null) { bos.close(); } if (in != null) { in.close(); } } catch (IOException ex) { logger.error(ex.getMessage()); } } }

Target:
private KieTuple readObjectFromADifferentClassloader(Object o) { ObjectInput in = null; ObjectOutput out; ByteArrayInputStream bis; ByteArrayOutputStream bos = null; try { bos = new ByteArrayOutputStream(); out = new ObjectOutputStream(bos); out.writeObject(o); out.flush(); byte[] objBytes = bos.toByteArray(); bis = new ByteArrayInputStream(objBytes); in = new ObjectInputStream(bis); Object newObj = in.readObject(); return new KieTuple(newObj); } catch (NotSerializableException nse) { logger.warn("Object it not serializable {}", nse.getMessage()); StringBuilder sb = new StringBuilder("NotSerializableException:").append(nse.getMessage()); return new KieTuple(sb.toString()); } catch (IOException ioe) { StringBuilder sb = new StringBuilder("IOException:").append(ioe.getMessage()); return new KieTuple(sb.toString()); } catch (ClassNotFoundException cnfe) { StringBuilder sb = new StringBuilder("ClassNotFoundException:").append(cnfe.getMessage()); return new KieTuple(sb.toString()); } catch (Exception e) { StringBuilder sb = new StringBuilder("Exception:").append(e.getMessage()); return new KieTuple(sb.toString()); } finally { try { if (bos != null) { bos.close(); } if (in != null) { in.close(); } } catch (IOException ex) { logger.error(ex.getMessage()); } } }
Source:
private String[] loadMinimizedTargets( @NotNull Consumer<String> statusConsumer, @Nullable ProcessAdapter processAdapter ) throws IOException, ExecutionException { statusConsumer.consume("Determining optimal import set..."); final File outputFile = FileUtil.createTempFile("pants_minimzie_run", ".out"); final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("minimize"); commandLine.addParameter("--minimize-output-file=" + outputFile.getPath()); commandLine.addParameter("::"); LOG.debug(commandLine.toString()); final ProcessOutput processOutput = PantsUtil.getCmdOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { String output = FileUtil.loadFile(outputFile); return output.split("\n"); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } }

Target:
private String[] loadMinimizedTargets( @NotNull Consumer<String> statusConsumer, @Nullable ProcessAdapter processAdapter ) throws IOException, ExecutionException { statusConsumer.consume("Determining optimal import set..."); final File outputFile = FileUtil.createTempFile("pants_minimzie_run", ".out"); final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("minimize"); commandLine.addParameter("--minimize-output-file=" + outputFile.getPath()); commandLine.addParameters(getAllTargetAddresses()); LOG.debug(commandLine.toString()); final ProcessOutput processOutput = PantsUtil.getCmdOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { String output = FileUtil.loadFile(outputFile); return output.split("\n"); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } }
Source:
protected void createSentIndex() throws DbException { final Schema schema = MyriaConstants.SENT_SCHEMA; List<IndexRef> index = ImmutableList.of(IndexRef.of(schema, "queryId"), IndexRef.of(schema, "fragmentId"), IndexRef.of(schema, "destWorkerId")); try { accessMethod.createIndexIfNotExists(MyriaConstants.SENT_RELATION, schema, index); } catch (DbException e) { LOGGER.error("Couldn't create index for profiling logs:", e); } }

Target:
protected void createSentIndex() throws DbException { final Schema schema = MyriaConstants.SENT_SCHEMA; List<IndexRef> index = ImmutableList.of(IndexRef.of(schema, "queryId"), IndexRef.of(schema, "fragmentId")); try { accessMethod.createIndexIfNotExists(MyriaConstants.SENT_RELATION, schema, index); } catch (DbException e) { LOGGER.error("Couldn't create index for profiling logs:", e); } }
Source:
public static synchronized void init() { if (_initialized) { LOGGER.info("FunctionRegistry is already initialized"); return; } long startTimeMs = System.currentTimeMillis(); Reflections reflections = new Reflections( new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.apache.pinot")) .filterInputsBy(new FilterBuilder.Include(".*\\.function\\..*")) .setScanners(new MethodAnnotationsScanner())); Set<Method> methodSet = reflections.getMethodsAnnotatedWith(ScalarFunction.class); for (Method method : methodSet) { ScalarFunction scalarFunction = method.getAnnotation(ScalarFunction.class); if (scalarFunction.enabled()) { if (!scalarFunction.name().isEmpty()) { FunctionRegistry.registerFunction(scalarFunction.name(), method); } else { FunctionRegistry.registerFunction(method); } } } LOGGER.info("Initialized FunctionRegistry within {}ms", System.currentTimeMillis() - startTimeMs); _initialized = true; }

Target:
public static void init() { }
Source:
public ArrayList<String> getNoisyLocationIDsAsStrings(SQLiteDatabase db, long activityId) { Location zeroDegrees = new Location("null island"); zeroDegrees.setLatitude(0); zeroDegrees.setLongitude(0); Location oneDegrees = new Location(zeroDegrees); oneDegrees.setLatitude(1); double toleranceDeg = this.tolerance / zeroDegrees.distanceTo(oneDegrees); String[] pColumns = { "_id", Constants.DB.LOCATION.LATITUDE, Constants.DB.LOCATION.LONGITUDE, Constants.DB.LOCATION.TYPE }; Cursor c = db.query(Constants.DB.LOCATION.TABLE, pColumns, Constants.DB.LOCATION.ACTIVITY + " = " + activityId, null, null, null, Constants.DB.LOCATION.TIME); ArrayList<Location> locations = new ArrayList<>(); ArrayList<String> ids = new ArrayList<>(); ArrayList<String> simplifiedIDs = new ArrayList<>(); if (c.moveToFirst()) { do { int lstate = c.getInt(3); Location l = new Location(String.format("%d", c.getInt(0))); l.setLatitude(c.getDouble(1)); l.setLongitude(c.getDouble(2)); if (!gps_type_only || (lstate == Constants.DB.LOCATION.TYPE_GPS)) { ids.add(l.getProvider()); locations.add(l); } if ((lstate == Constants.DB.LOCATION.TYPE_PAUSE) || (lstate == Constants.DB.LOCATION.TYPE_END)) { if (locations.size() > 2) { Location[] simplifiedLocations = simplifySegment(locations, toleranceDeg); for (Location sl : simplifiedLocations) { simplifiedIDs.add(sl.getProvider()); } } locations = new ArrayList<>(); } } while (c.moveToNext()); } c.close(); ids.removeAll(simplifiedIDs); return ids; }

Target:
public ArrayList<String> getNoisyLocationIDsAsStrings(SQLiteDatabase db, long activityId) { String[] pColumns = { "_id", Constants.DB.LOCATION.LATITUDE, Constants.DB.LOCATION.LONGITUDE, Constants.DB.LOCATION.TYPE }; Cursor c = db.query(Constants.DB.LOCATION.TABLE, pColumns, Constants.DB.LOCATION.ACTIVITY + " = " + activityId, null, null, null, Constants.DB.LOCATION.TIME); ArrayList<Location> locations = new ArrayList<>(); ArrayList<String> ids = new ArrayList<>(); ArrayList<String> simplifiedIDs = new ArrayList<>(); if (c.moveToFirst()) { do { int lstate = c.getInt(3); Location l = new Location(String.format(Locale.US, "%d", c.getInt(0))); l.setLatitude(c.getDouble(1)); l.setLongitude(c.getDouble(2)); if (lstate == Constants.DB.LOCATION.TYPE_GPS) { ids.add(l.getProvider()); locations.add(l); } if ((lstate == Constants.DB.LOCATION.TYPE_PAUSE) || (lstate == Constants.DB.LOCATION.TYPE_END)) { if (locations.size() > 2) { Location[] simplifiedLocations = simplifySegment(locations); for (Location sl : simplifiedLocations) { simplifiedIDs.add(sl.getProvider()); } } locations = new ArrayList<>(); } } while (c.moveToNext()); } c.close(); ids.removeAll(simplifiedIDs); return ids; }
Source:
public static SavingsAccountFragment newInstance(int id, boolean isGroupAccount) { SavingsAccountFragment savingsAccountFragment = new SavingsAccountFragment(); Bundle args = new Bundle(); args.putInt(isGroupAccount ? Constants.GROUP_ID : Constants.CLIENT_ID, id); savingsAccountFragment.setArguments(args); return savingsAccountFragment; }

Target:
public static SavingsAccountFragment newInstance(int id, boolean isGroupAccount) { SavingsAccountFragment savingsAccountFragment = new SavingsAccountFragment(); Bundle args = new Bundle(); args.putInt(isGroupAccount ? Constants.GROUP_ID : Constants.CLIENT_ID, id); args.putBoolean(Constants.GROUP_ACCOUNT, isGroupAccount); savingsAccountFragment.setArguments(args); return savingsAccountFragment; }
Source:
private void visitBlock(IPDOMVisitor visitor) throws CoreException { Database db = linkage.getDB(); for (int item = 0; item < nextMemberPosition; item++) { final long memberRecord = db.getRecPtr(getMemberRecord(item)); if (record == 0) { throw new NullPointerException(); } PDOMNode node = linkage.getNode(memberRecord); if (visitor.visit(node) && node != null) { node.accept(visitor); } visitor.leave(node); } }

Target:
private void visitBlock(IPDOMVisitor visitor) throws CoreException { if (record == 0) { throw new NullPointerException(); } int item = 0; long memberRecord; while ((memberRecord = getMemberRecord(item++)) != 0) { PDOMNode node = linkage.getNode(memberRecord); if (visitor.visit(node) && node != null) { node.accept(visitor); } visitor.leave(node); } }
Source:
public List<FrameworkFulfillment> findByProjectModelId(Integer projectModelId) { return em().createQuery( "SELECT ff " + "FROM ProjectModel pm " + "JOIN pm.frameworkFulfillments ff " + "JOIN FETCH ff.frameworkElementImplementations fei " + "WHERE pm.id = :projectModelId " + "AND ff.framework.availabilityStatus = 'AVAILABLE' ", FrameworkFulfillment.class ).setParameter("projectModelId", projectModelId).getResultList(); }

Target:
public List<FrameworkFulfillment> findByProjectModelId(Integer projectModelId) { return em().createQuery( "SELECT ff " + "FROM ProjectModel pm " + "JOIN pm.frameworkFulfillments ff " + "JOIN FETCH ff.frameworkElementImplementations fei " + "WHERE pm.id = :projectModelId " + "AND ff.framework.availabilityStatus = :status ", FrameworkFulfillment.class) .setParameter("projectModelId", projectModelId) .setParameter("status", Framework.AvailabilityStatus.AVAILABLE.name()) .getResultList(); }
Source:
public static void run(Repository repository, Work work) throws IOException { try (ConfigScope scope = new ConfigScope(repository)) { work.execute(); } }

Target:
public static void run(Repository repository, Work work) throws IOException { try (ConfigScope scope = new ConfigScope(repository)) { work.run(); } }
Source:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.status) { startActivity(new Intent(getActivity(), StatusActivity.class)); return true; } else if (item.getItemId() == R.id.about) { startActivity(new Intent(getActivity(), AboutActivity.class)); return true; } else if (item.getItemId() == R.id.sosBroadcast) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View dialogView = inflater.inflate(R.layout.sos_setting_field, null); final EditText sosEditText = (EditText) dialogView.findViewById(R.id.sosEditText); String broadcast = sharedPreferences.getString(MainFragment.KEY_BROADCAST, ""); if(broadcast.trim().length() > 0) { sosEditText.setText(broadcast); } builder.setMessage(R.string.settings_sos_broadcast_summary) .setTitle(R.string.settings_sos_broadcast_title) .setView(dialogView); builder.setPositiveButton("Save", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(KEY_BROADCAST, sosEditText.getText().toString()); editor.commit(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.status) { startActivity(new Intent(getActivity(), StatusActivity.class)); return true; } else if (item.getItemId() == R.id.about) { startActivity(new Intent(getActivity(), AboutActivity.class)); return true; } else if (item.getItemId() == R.id.sosBroadcast) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View dialogView = inflater.inflate(R.layout.sos_setting_field, null); final EditText sosEditText = (EditText) dialogView.findViewById(R.id.sosEditText); String broadcast = sharedPreferences.getString(MainFragment.KEY_BROADCAST, ""); if (broadcast.trim().length() > 0) { sosEditText.setText(broadcast); } builder.setMessage(R.string.settings_sos_broadcast_summary) .setTitle(R.string.settings_sos_broadcast_title) .setView(dialogView); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(KEY_BROADCAST, sosEditText.getText().toString()); editor.commit(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } return super.onOptionsItemSelected(item); }
Source:
public static void setInstance(Object source, @MappingTarget Object target) { Integer level = LEVEL.get(); fireMethodCalled( level, "setInstance", source, target ); if ( level == null ) { LEVEL.set( 1 ); MAPPING.set( new IdentityHashMap<Object, Object>() ); } else { LEVEL.set( level.intValue() + 1 ); } MAPPING.get().put( source, target ); }

Target:
public static void setInstance(Object source, @MappingTarget Object target) { Integer level = LEVEL.get(); fireMethodCalled( level, "setInstance", source, target ); if ( level == null ) { LEVEL.set( 1 ); MAPPING.set( new IdentityHashMap<Object, Object>() ); } else { LEVEL.set( level + 1 ); } MAPPING.get().put( source, target ); }
Source:
private Map<String, IdealState> convertResourceAssignment( ResourceControllerDataProvider clusterData, Map<String, ResourceAssignment> assignments) throws HelixRebalanceException { Map<String, IdealState> finalIdealStateMap = new HashMap<>(); for (String resourceName : assignments.keySet()) { try { IdealState currentIdealState = clusterData.getIdealState(resourceName); Map<String, Integer> statePriorityMap = clusterData.getStateModelDef(currentIdealState.getStateModelDefRef()) .getStatePriorityMap(); IdealState newIdealState = new IdealState(resourceName); newIdealState.getRecord().setSimpleFields(currentIdealState.getRecord().getSimpleFields()); newIdealState.setPreferenceLists( getPreferenceLists(assignments.get(resourceName), statePriorityMap)); finalIdealStateMap.put(resourceName, newIdealState); } catch (Exception ex) { throw new HelixRebalanceException( "Fail to calculate the new IdealState for resource: " + resourceName, HelixRebalanceException.Type.INVALID_CLUSTER_STATUS, ex); } } return finalIdealStateMap; }

Target:
private Map<String, IdealState> convertResourceAssignment( ResourceControllerDataProvider clusterData, Map<String, ResourceAssignment> assignments) throws HelixRebalanceException { Map<String, IdealState> finalIdealStateMap = new HashMap<>(); for (String resourceName : assignments.keySet()) { try { IdealState currentIdealState = clusterData.getIdealState(resourceName); Map<String, Integer> statePriorityMap = clusterData.getStateModelDef(currentIdealState.getStateModelDefRef()) .getStatePriorityMap(); IdealState newIdealState = new IdealState(resourceName); newIdealState.getRecord().setSimpleFields(currentIdealState.getRecord().getSimpleFields()); newIdealState.setPreferenceLists( getPreferenceLists(assignments.get(resourceName), statePriorityMap)); finalIdealStateMap.put(resourceName, newIdealState); } catch (Exception ex) { throw new HelixRebalanceException( "Failed to calculate the new IdealState for resource: " + resourceName, HelixRebalanceException.Type.INVALID_CLUSTER_STATUS, ex); } } return finalIdealStateMap; }
Source:
private List<HistoryEntry> removeHistoryEntries(final History history) { final List<HistoryEntry> removedEntries = new ArrayList<>(); final int insertStampToRemove = history.currentInsertStamp; final Iterator<HistoryEntry> it = history.entries.iterator(); if (!it.hasNext()) return removedEntries; while (it.hasNext()) { final HistoryEntry entry = it.next(); if (entry.insertStamp != insertStampToRemove) break; removedEntries.add(entry); it.remove(); } return removedEntries; }

Target:
private List<HistoryEntry> removeHistoryEntries(final History history) { final List<HistoryEntry> removedEntries = new ArrayList<>(); final int insertStampToRemove = history.currentInsertStamp; final Iterator<HistoryEntry> it = history.entries.iterator(); while (it.hasNext()) { final HistoryEntry entry = it.next(); if (entry.insertStamp != insertStampToRemove) break; removedEntries.add(entry); it.remove(); } return removedEntries; }
Source:
public final void testDirectArenaMemoryCopy() { PooledByteBuf<ByteBuffer> src = (PooledByteBuf<ByteBuffer>) PooledByteBufAllocator.DEFAULT.directBuffer(512); PooledByteBuf<ByteBuffer> dst = (PooledByteBuf<ByteBuffer>) PooledByteBufAllocator.DEFAULT.directBuffer(512); dst.writeBytes(ByteBuffer.allocate(128)); dst.chunk.arena.memoryCopy(src.memory, 0, dst, 512); }

Target:
public void testDirectArenaMemoryCopy() { ByteBuf src = PooledByteBufAllocator.DEFAULT.directBuffer(512); ByteBuf dst = PooledByteBufAllocator.DEFAULT.directBuffer(512); PooledByteBuf<ByteBuffer> pooledSrc = unwrapIfNeeded(src); PooledByteBuf<ByteBuffer> pooledDst = unwrapIfNeeded(dst); pooledDst.writeBytes(ByteBuffer.allocate(128)); pooledDst.chunk.arena.memoryCopy(pooledSrc.memory, 0, pooledDst, 512); src.release(); dst.release(); }
Source:
private ContentItem readContent(URI uri) throws StorageException { Path path = getContentFilePath(uri); if (path == null) { throw new StorageException( "Unable to find file for content ID: " + uri.getSchemeSpecificPart()); } String filename = path.getFileName().toString(); InputStream contentInputStream; String extension; try { if (REF_EXT.equals(FilenameUtils.getExtension(path.getFileName().toString()))) { extension = FilenameUtils.getExtension( FilenameUtils.removeExtension(path.getFileName().toString())); contentInputStream = getInputStreamFromReference(path); } else { extension = FilenameUtils.getExtension(path.getFileName().toString()); contentInputStream = getInputStreamFromResource(path); } } catch (IOException e) { throw new StorageException( String.format("Unable to resolve InputStream given URI of %s", uri), e); } ByteSource byteSource = decryptStream(contentInputStream); long size = 0; try { size = byteSource.size(); } catch (IOException e) { LOGGER.debug("Problem determining size of resource; defaulting to {}.", size, e); } String mimeType = determineMimeType(extension, path, byteSource); return new ContentItemImpl( uri.getSchemeSpecificPart(), uri.getFragment(), byteSource, mimeType, filename, size, null); }

Target:
private ContentItem readContent(URI uri) throws StorageException { Path path = getContentFilePath(uri); if (path == null) { throw new StorageException( "Unable to find file for content ID: " + uri.getSchemeSpecificPart()); } String filename = path.getFileName().toString(); InputStream contentInputStream; String extension; try { if (REF_EXT.equals(FilenameUtils.getExtension(filename))) { extension = FilenameUtils.getExtension( FilenameUtils.removeExtension(path.getFileName().toString())); contentInputStream = getInputStreamFromReference(path); } else { extension = FilenameUtils.getExtension(path.getFileName().toString()); contentInputStream = getInputStreamFromResource(path); } } catch (IOException e) { throw new StorageException( String.format("Unable to resolve InputStream given URI of %s", uri), e); } ByteSource byteSource = decryptStream(contentInputStream); long size = 0; try { size = byteSource.size(); } catch (IOException e) { LOGGER.debug("Problem determining size of resource; defaulting to {}.", size, e); } String mimeType = determineMimeType(extension, path, byteSource); return new ContentItemImpl( uri.getSchemeSpecificPart(), uri.getFragment(), byteSource, mimeType, filename, size, null); }
Source:
private static void openTrace() { final Exception exception[] = new Exception[1]; exception[0] = null; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { try { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(TRACE_PROJECT_NAME); TmfTraceFolder destinationFolder = TmfProjectRegistry.getProject(project, true).getTracesFolder(); TmfOpenTraceHelper.openTraceFromPath(destinationFolder, pttt.getTrace().getPath(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "org.eclipse.linuxtools.lttng2.kernel.tracetype"); } catch (CoreException e) { exception[0] = e; } } }); if (exception[0] != null) { fail(exception[0].getMessage()); } SWTBotUtil.delay(1000); SWTBotUtil.waitForJobs(); }

Target:
private static void openTrace() { final Exception exception[] = new Exception[1]; exception[0] = null; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { try { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(TRACE_PROJECT_NAME); TmfTraceFolder destinationFolder = TmfProjectRegistry.getProject(project, true).getTracesFolder(); TmfOpenTraceHelper.openTraceFromPath(destinationFolder, pttt.getTrace().getPath(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "org.eclipse.linuxtools.tmf.pcap.core.pcaptrace"); } catch (CoreException e) { exception[0] = e; } } }); if (exception[0] != null) { fail(exception[0].getMessage()); } SWTBotUtil.delay(1000); SWTBotUtil.waitForJobs(); }
Source:
public static String[] prefixPaths(final String rawPath) { final String[] parts = rawPath.split(SEPARATOR); final Iterator<Path> itr = Paths.get("", parts).iterator(); final StringBuilder sb = new StringBuilder(SEPARATOR); final String[] paths = new String[parts.length - 1]; for (int i = 0; itr.hasNext(); i++) { final String part = itr.next().toString(); sb.append(part); paths[i] = sb.toString(); if (itr.hasNext()) { sb.append(SEPARATOR); } } return paths; }

Target:
public static String[] prefixPaths(final String rawPath) { final String[] parts = StringUtils.split(rawPath, SEPARATOR.charAt(0)); final Iterator<Path> itr = Paths.get("", parts).iterator(); final StringBuilder sb = new StringBuilder(SEPARATOR); final String[] paths = new String[parts.length]; for (int i = 0; itr.hasNext(); i++) { final String part = itr.next().toString(); sb.append(part); paths[i] = sb.toString(); if (itr.hasNext()) { sb.append(SEPARATOR); } } return paths; }
Source:
public void queryNative(Blackhole blackhole) throws Exception { HashMap<String, Object> context = Maps.newHashMap(); final Sequence<Row> resultSequence = QueryPlus.wrap(groupByQuery).run(walker, context); final ArrayList<Row> resultList = Sequences.toList(resultSequence, Lists.<Row>newArrayList()); for (Row row : resultList) { blackhole.consume(row); } }

Target:
public void queryNative(Blackhole blackhole) throws Exception { final Sequence<Row> resultSequence = QueryPlus.wrap(groupByQuery).run(walker, Maps.newHashMap()); final ArrayList<Row> resultList = Sequences.toList(resultSequence, Lists.<Row>newArrayList()); for (Row row : resultList) { blackhole.consume(row); } }
Source:
public void checkNullability( final Object[] values, final EntityPersister persister, final NullabilityCheckType checkType) { if ( checkNullability ) { final boolean[] nullability = persister.getPropertyNullability(); final boolean[] checkability = checkType == NullabilityCheckType.CREATE ? persister.getPropertyInsertability() : persister.getPropertyUpdateability(); final Type[] propertyTypes = persister.getPropertyTypes(); final InMemoryValueGenerationStrategy[] inMemoryValueGenerationStrategies = persister.getEntityMetamodel().getInMemoryValueGenerationStrategies(); boolean validValueGenerationStrategyCount = inMemoryValueGenerationStrategies.length == values.length; for ( int i = 0; i < values.length; i++ ) { if ( checkability[i] && values[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && ( validValueGenerationStrategyCount && GenerationTiming.NEVER == inMemoryValueGenerationStrategies[i] .getGenerationTiming() ) ) { final Object value = values[i]; if ( !nullability[i] && value == null ) { throw new PropertyValueException( "not-null property references a null or transient value", persister.getEntityName(), persister.getPropertyNames()[i] ); } else if ( value != null ) { final String breakProperties = checkSubElementsNullability( propertyTypes[i], value ); if ( breakProperties != null ) { throw new PropertyValueException( "not-null property references a null or transient value", persister.getEntityName(), buildPropertyPath( persister.getPropertyNames()[i], breakProperties ) ); } } } } } }

Target:
public void checkNullability( final Object[] values, final EntityPersister persister, final NullabilityCheckType checkType) { if ( checkNullability ) { final boolean[] nullability = persister.getPropertyNullability(); final boolean[] checkability = checkType == NullabilityCheckType.CREATE ? persister.getPropertyInsertability() : persister.getPropertyUpdateability(); final Type[] propertyTypes = persister.getPropertyTypes(); final InMemoryValueGenerationStrategy[] inMemoryValueGenerationStrategies = persister.getEntityMetamodel().getInMemoryValueGenerationStrategies(); for ( int i = 0; i < values.length; i++ ) { if ( checkability[i] && values[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && GenerationTiming.NEVER == inMemoryValueGenerationStrategies[i].getGenerationTiming() ) { final Object value = values[i]; if ( !nullability[i] && value == null ) { throw new PropertyValueException( "not-null property references a null or transient value", persister.getEntityName(), persister.getPropertyNames()[i] ); } else if ( value != null ) { final String breakProperties = checkSubElementsNullability( propertyTypes[i], value ); if ( breakProperties != null ) { throw new PropertyValueException( "not-null property references a null or transient value", persister.getEntityName(), buildPropertyPath( persister.getPropertyNames()[i], breakProperties ) ); } } } } } }
Source:
private boolean blockUnlessChangeOccurs(String sitemapname, String pageId) { boolean changeOccurred = true; Sitemap sitemap = getSitemap(sitemapname); if (sitemap != null) { if (pageId.equals(sitemap.getName())) { EList<Widget> children = itemUIRegistry.getChildren(sitemap); changeOccurred = waitForChanges(children); } else { Widget pageWidget = itemUIRegistry.getWidget(sitemap, pageId); if (pageWidget instanceof LinkableWidget) { EList<Widget> children = itemUIRegistry.getChildren((LinkableWidget) pageWidget); changeOccurred = waitForChanges(children); } } } return changeOccurred; }

Target:
private boolean blockUnlessChangeOccurs(String sitemapname, String pageId) { boolean timeout = false; Sitemap sitemap = getSitemap(sitemapname); if (sitemap != null) { if (pageId.equals(sitemap.getName())) { EList<Widget> children = itemUIRegistry.getChildren(sitemap); timeout = waitForChanges(children); } else { Widget pageWidget = itemUIRegistry.getWidget(sitemap, pageId); if (pageWidget instanceof LinkableWidget) { EList<Widget> children = itemUIRegistry.getChildren((LinkableWidget) pageWidget); timeout = waitForChanges(children); } } } return timeout; }
Source:
public final void validateDependencies() { getProject() .getConvention() .getPlugin(JavaPluginConvention.class) .getSourceSets() .forEach(ss -> { if (ss.getName().equals(IGNORE_MAIN_CONFIGURATION)) { return; } Optional<Test> maybeTestTask = BaselineTesting.getTestTaskForSourceSet(getProject(), ss); if (!maybeTestTask.isPresent()) { return; } Test task = maybeTestTask.get(); getProject().getLogger().info("Analyzing source set with task {}", ss.getName(), task.getName()); validateSourceSet(ss, task); }); }

Target:
public final void validateDependencies() { getProbablyTestSourceSets().forEach(ss -> { Optional<Test> maybeTestTask = BaselineTesting.getTestTaskForSourceSet(getProject(), ss); if (!maybeTestTask.isPresent()) { return; } Test task = maybeTestTask.get(); getProject().getLogger().info("Analyzing source set with task {}", ss.getName(), task.getName()); validateSourceSet(ss, task); }); }
Source:
public static Map<String, Object> getMetadata() { return new HashMap<>(getClient().getMetadataState().getMetadata().toMap()); }

Target:
public static Map<String, Object> getMetadata() { return getClient().getMetadata(); }
Source:
private MethodSpec createConstructor(StorIOContentResolverTypeMeta storIOSQLiteTypeMeta) { final ClassName putResolver = ClassName.get(storIOSQLiteTypeMeta.packageName, PutResolverGenerator.generateName(storIOSQLiteTypeMeta)); final ClassName getResolver = ClassName.get(storIOSQLiteTypeMeta.packageName, GetResolverGenerator.generateName(storIOSQLiteTypeMeta)); final ClassName deleteResolver = ClassName.get(storIOSQLiteTypeMeta.packageName, DeleteResolverGenerator.generateName(storIOSQLiteTypeMeta)); return MethodSpec.constructorBuilder() .addModifiers(PUBLIC) .addStatement("super(new $T(), new $T(), new $T())", putResolver, getResolver, deleteResolver) .build(); }

Target:
private MethodSpec createConstructor(StorIOContentResolverTypeMeta storIOSQLiteTypeMeta) { final ClassName putResolver = ClassName.get(storIOSQLiteTypeMeta.packageName, PutResolverGenerator.generateName(storIOSQLiteTypeMeta)); final ClassName getResolver = ClassName.get(storIOSQLiteTypeMeta.packageName, GetResolverGenerator.generateName(storIOSQLiteTypeMeta)); final ClassName deleteResolver = ClassName.get(storIOSQLiteTypeMeta.packageName, DeleteResolverGenerator.generateName(storIOSQLiteTypeMeta)); return MethodSpec.constructorBuilder() .addModifiers(PUBLIC) .addStatement("super(new $T(),\nnew $T(),\nnew $T())", putResolver, getResolver, deleteResolver) .build(); }
Source:
private String startResumableUpload() throws InterruptedException, IOException { InsertObjectSpec.Builder insertObjectSpecBuilder = InsertObjectSpec.newBuilder() .setResource( Object.newBuilder() .setBucket(resourceId.getBucketName()) .setName(resourceId.getObjectName()) .setContentType(contentType) .putAllMetadata(metadata) .build()); if (writeConditions.hasContentGenerationMatch()) { insertObjectSpecBuilder.setIfGenerationMatch( Int64Value.newBuilder().setValue(writeConditions.getContentGenerationMatch())); } if (writeConditions.hasMetaGenerationMatch()) { insertObjectSpecBuilder.setIfMetagenerationMatch( Int64Value.newBuilder().setValue(writeConditions.getMetaGenerationMatch())); } if (requesterPaysProject.isPresent()) { insertObjectSpecBuilder.setUserProject(requesterPaysProject.get()); } StartResumableWriteRequest request = StartResumableWriteRequest.newBuilder() .setInsertObjectSpec(insertObjectSpecBuilder) .build(); SimpleResponseObserver<StartResumableWriteResponse> responseObserver = new SimpleResponseObserver<>(); runWithRetries( () -> { stub.withDeadlineAfter(START_RESUMABLE_WRITE_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS) .startResumableWrite(request, responseObserver); try { responseObserver.done.await(); } catch (InterruptedException e) { e.printStackTrace(); } }, responseObserver); return responseObserver.getResponse().getUploadId(); }

Target:
private String startResumableUpload() throws InterruptedException, IOException { InsertObjectSpec.Builder insertObjectSpecBuilder = InsertObjectSpec.newBuilder() .setResource( Object.newBuilder() .setBucket(resourceId.getBucketName()) .setName(resourceId.getObjectName()) .setContentType(contentType) .putAllMetadata(metadata) .build()); if (writeConditions.hasContentGenerationMatch()) { insertObjectSpecBuilder.setIfGenerationMatch( Int64Value.newBuilder().setValue(writeConditions.getContentGenerationMatch())); } if (writeConditions.hasMetaGenerationMatch()) { insertObjectSpecBuilder.setIfMetagenerationMatch( Int64Value.newBuilder().setValue(writeConditions.getMetaGenerationMatch())); } if (requesterPaysProject.isPresent()) { insertObjectSpecBuilder.setUserProject(requesterPaysProject.get()); } StartResumableWriteRequest request = StartResumableWriteRequest.newBuilder() .setInsertObjectSpec(insertObjectSpecBuilder) .build(); SimpleResponseObserver<StartResumableWriteResponse> responseObserver = new SimpleResponseObserver<>(); runWithRetries( () -> { stub.withDeadlineAfter(START_RESUMABLE_WRITE_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS) .startResumableWrite(request, responseObserver); try { responseObserver.done.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException("Failed to start resumable upload.", e); } }, responseObserver); return responseObserver.getResponse().getUploadId(); }
Source:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { RefactoringStatus refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); boolean autoRefresh = Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if(autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); } return refactoringStatus; }

Target:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { RefactoringStatus refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); if (!refactoringStatus.isOK()) { boolean autoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if (autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); refactoringStatus= RefactoringStatus.create(Resources.checkInSync(fResource)); } } return refactoringStatus; }
Source:
public void launch(Instance machine, Agent agent) throws ServerException { try { String architecture = detectArchitecture(machine); machine.copy(archivePathProvider.getPath(architecture), terminalLocation); final AgentImpl agentCopy = new AgentImpl(agent); agentCopy.setScript(agent.getScript() + "\n" + terminalRunCommand); super.launch(machine, agentCopy); } catch (ConflictException e) { throw new ServerException("Internal server error occurs on terminal launching."); } }

Target:
public void launch(Instance machine, Agent agent) throws ServerException { try { String architecture = detectArchitecture(machine); machine.copy(archivePathProvider.getPath(architecture), terminalLocation); super.launch(machine, agent); } catch (ConflictException e) { throw new ServerException("Internal server error occurs on terminal launching."); } }
Source:
public ResponseEntity addOrUpdateRepository(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable String repositoryId, @ApiParam(value = "The repository object", required = true) @RequestBody @Validated({ Default.class, ProxyConfigurationFormChecks.class }) RepositoryForm repositoryForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_REPOSITORY, bindingResult); } if(configurationManagementService.getConfiguration().getStorage(storageId) != null) { try { MutableRepository repository = conversionService.convert(repositoryForm, MutableRepository.class); logger.debug("Creating repository " + storageId + ":" + repositoryId + "..."); configurationManagementService.saveRepository(storageId, repository); final RepositoryPath repositoryPath = repositoryPathResolver.resolve(new Repository(repository)); if (!Files.exists(repositoryPath)) { repositoryManagementService.createRepository(storageId, repository.getId()); } return getSuccessfulResponseEntity(SUCCESSFUL_REPOSITORY_SAVE, accept); } catch (IOException | ConfigurationException | RepositoryManagementStrategyException e) { logger.error(e.getMessage(), e); return getFailedResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR, FAILED_REPOSITORY_SAVE, accept); } } else { return getFailedResponseEntity(HttpStatus.NOT_FOUND,REPOSITORY_NOT_FOUND, accept); } }

Target:
public ResponseEntity addOrUpdateRepository(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable String repositoryId, @ApiParam(value = "The repository object", required = true) @RequestBody @Validated({ Default.class, ProxyConfigurationFormChecks.class }) RepositoryForm repositoryForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if (configurationManagementService.getConfiguration().getStorage(storageId) != null) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_REPOSITORY, bindingResult); } try { MutableRepository repository = conversionService.convert(repositoryForm, MutableRepository.class); logger.debug("Creating repository " + storageId + ":" + repositoryId + "..."); configurationManagementService.saveRepository(storageId, repository); final RepositoryPath repositoryPath = repositoryPathResolver.resolve(new Repository(repository)); if (!Files.exists(repositoryPath)) { repositoryManagementService.createRepository(storageId, repository.getId()); } return getSuccessfulResponseEntity(SUCCESSFUL_REPOSITORY_SAVE, accept); } catch (IOException | ConfigurationException | RepositoryManagementStrategyException e) { logger.error(e.getMessage(), e); return getFailedResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR, FAILED_REPOSITORY_SAVE, accept); } } else { return getFailedResponseEntity(HttpStatus.NOT_FOUND, STORAGE_NOT_FOUND, accept); } }
Source:
private MigrateVDSCommandParameters createMigrateVDSCommandParameters() { String srcVdsHost = getVds().getHostName(); String dstVdsHost = String.format("%1$s:%2$s", getDestinationVds().getHostName(), getDestinationVds().getPort()); return new MigrateVDSCommandParameters(getVdsId(), getVmId(), srcVdsHost, getDestinationVdsId(), dstVdsHost, MigrationMethod.ONLINE, isTunnelMigrationUsed(), getMigrationNetworkIp(), getVds().getVdsGroupCompatibilityVersion(), getMaximumMigrationDowntime(), getAutoConverge(), getMigrateCompressed(), getVds().getConsoleAddress()); }

Target:
private MigrateVDSCommandParameters createMigrateVDSCommandParameters() { String srcVdsHost = getVds().getHostName(); String dstVdsHost = String.format("%1$s:%2$s", getDestinationVds().getHostName(), getDestinationVds().getPort()); return new MigrateVDSCommandParameters(getVdsId(), getVmId(), srcVdsHost, getDestinationVdsId(), dstVdsHost, MigrationMethod.ONLINE, isTunnelMigrationUsed(), getMigrationNetworkIp(), getVds().getVdsGroupCompatibilityVersion(), getMaximumMigrationDowntime(), getAutoConverge(), getMigrateCompressed(), getDestinationVds().getConsoleAddress()); }
Source:
public static Properties writeUserDataAsProperties( Map<String,String> messagingConfiguration, String applicationName, String scopedInstancePath ) { Properties result = new Properties(); if( applicationName != null ) result.setProperty( APPLICATION_NAME, applicationName ); if( scopedInstancePath != null ) result.setProperty( SCOPED_INSTANCE_PATH, scopedInstancePath ); if( messagingConfiguration != null ) { for (String k : messagingConfiguration.keySet()) { String v = messagingConfiguration.get(k); if (v != null) { result.setProperty(k, v); } } } return result; }

Target:
public static Properties writeUserDataAsProperties( Map<String,String> messagingConfiguration, String applicationName, String scopedInstancePath ) { Properties result = new Properties(); if( applicationName != null ) result.setProperty( APPLICATION_NAME, applicationName ); if( scopedInstancePath != null ) result.setProperty( SCOPED_INSTANCE_PATH, scopedInstancePath ); if( messagingConfiguration != null ) { for (Map.Entry<String, String> e : messagingConfiguration.entrySet()) { if (e.getValue() != null) { result.setProperty(e.getKey(), e.getValue()); } } } return result; }
Source:
public void channelActive(ChannelHandlerContext ctx) throws RestServiceException { logger.debug("Channel with remote address active", ctx.channel(), ctx.channel().remoteAddress()); this.ctx = ctx; requestHandler = requestHandlerController.getRequestHandler(); responseHandler = new NettyResponseHandler(ctx, nettyMetrics); if (requestHandler == null || responseHandler == null) { String msg = new StringBuilder( (requestHandler == null ? "RestRequestHandler received was null" : "RestResponseHandler received was null")) .append(" during bootstrap of channel ").append(ctx.channel()) .append(". Channel will be destroyed since initialization has failed").toString(); logger.error(msg); nettyMetrics.channelActiveTasksFailure.inc(); throw new RestServiceException(msg, RestServiceErrorCode.ChannelActiveTasksFailure); } nettyMetrics.channelCreationRate.mark(); }

Target:
public void channelActive(ChannelHandlerContext ctx) throws RestServiceException { logger.trace("Channel active", ctx.channel()); this.ctx = ctx; requestHandler = requestHandlerController.getRequestHandler(); responseHandler = new NettyResponseHandler(ctx, nettyMetrics); if (requestHandler == null) { nettyMetrics.channelActiveTasksError.inc(); throw new RestServiceException("RestRequestHandler received during channel bootstrap was null", RestServiceErrorCode.ChannelActiveTasksFailure); } nettyMetrics.channelCreationRate.mark(); }