auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public DrmSession<T> acquireSession(Looper playbackLooper, DrmInitData drmInitData) { Assertions.checkState(this.playbackLooper == null || this.playbackLooper == playbackLooper); if (++openCount != 1) { return this; } if (this.playbackLooper == null) { this.playbackLooper = playbackLooper; mediaDrmHandler = new MediaDrmHandler(playbackLooper); postResponseHandler = new PostResponseHandler(playbackLooper); } requestHandlerThread = new HandlerThread("DrmRequestHandler"); requestHandlerThread.start(); postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper()); if (offlineLicenseKeySetId == null) { SchemeData schemeData = drmInitData.get(uuid); if (schemeData == null) { onError(new IllegalStateException("Media does not support uuid: " + uuid)); return this; } schemeInitData = schemeData.data; schemeMimeType = schemeData.mimeType; if (Util.SDK_INT < 21) { byte[] psshData = PsshAtomUtil.parseSchemeSpecificData(schemeInitData, C.WIDEVINE_UUID); if (psshData == null) { } else { schemeInitData = psshData; } } <START> if (C.CENC_UUID.equals(uuid) && MimeTypes.VIDEO_MP4.equals(schemeMimeType)) { <END> if (Util.SDK_INT < 19 || !MediaDrm.isCryptoSchemeSupported(uuid, MimeTypes.VIDEO_MP4)) { schemeMimeType = CENC_INIT_DATA_FORMAT; } } } state = STATE_OPENING; openInternal(true); return this; }</code><technical_language>handle audio/mp4 for completeness, I think. a capping SDK level workaround is applied. applying workarounds for platform issues future platform releases; making problems fixed in platform (which appears done)</technical_language>

Target:
public DrmSession<T> acquireSession(Looper playbackLooper, DrmInitData drmInitData) { Assertions.checkState(this.playbackLooper == null || this.playbackLooper == playbackLooper); if (++openCount != 1) { return this; } if (this.playbackLooper == null) { this.playbackLooper = playbackLooper; mediaDrmHandler = new MediaDrmHandler(playbackLooper); postResponseHandler = new PostResponseHandler(playbackLooper); } requestHandlerThread = new HandlerThread("DrmRequestHandler"); requestHandlerThread.start(); postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper()); if (offlineLicenseKeySetId == null) { SchemeData schemeData = drmInitData.get(uuid); if (schemeData == null) { onError(new IllegalStateException("Media does not support uuid: " + uuid)); return this; } schemeInitData = schemeData.data; schemeMimeType = schemeData.mimeType; if (Util.SDK_INT < 21) { byte[] psshData = PsshAtomUtil.parseSchemeSpecificData(schemeInitData, C.WIDEVINE_UUID); if (psshData == null) { } else { schemeInitData = psshData; } } if (C.CENC_UUID.equals(uuid)) { if (MimeTypes.VIDEO_MP4.equals(schemeMimeType) || MimeTypes.AUDIO_MP4.equals( schemeMimeType)) { if (Util.SDK_INT >= 26) { } else if (Util.SDK_INT == 25 && !MediaDrm.isCryptoSchemeSupported(uuid, schemeMimeType)) { schemeMimeType = CENC_INIT_DATA_FORMAT; } else if (Util.SDK_INT <= 24) { schemeMimeType = CENC_INIT_DATA_FORMAT; } } } } state = STATE_OPENING; openInternal(true); return this; }
Source:
<code>public boolean equals(Object o) { if (o instanceof SLADueDate) { SLADueDate other = (SLADueDate) o; <START> return (null != value) ? value.equals(other.value) : null == other.value; <END> } return false; }</code><technical_language>this replaced of Object.equals, null checks..</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof SLADueDate) { SLADueDate other = (SLADueDate) o; return Objects.equals(value, other.value); } return false; }
Source:
<code>private Charset getCharset(FileStatement fileStatement) { final Charset charset; if (fileStatement.getCharset() != null) { final Object charsetValue = doSwitch(fileStatement.getCharset()); if (charsetValue != null) { final String charsetString = toString(charsetValue); Charset defaultCharset = <START> Charset.forName("UTF-8"); <END> try { defaultCharset = Charset.forName(charsetString); } catch (IllegalCharsetNameException | UnsupportedCharsetException e) { final BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.WARNING, ID, 0, e .getMessage() + " fallback to UTF-8", new Object[] {fileStatement.getUrl(), new HashMap<String, Object>(peekVariables()) }); environment.getGenerationResult().addDiagnostic(diagnostic); } charset = defaultCharset; } else { final BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.WARNING, ID, 0, "The Charset can't be null, fallback to UTF-8", new Object[] {fileStatement.getUrl(), new HashMap<String, Object>(peekVariables()) }); environment.getGenerationResult().addDiagnostic(diagnostic); charset = Charset.forName("UTF-8"); } } else { charset = Charset.forName("UTF-8"); } return charset; }</code><technical_language>possible, change for StandardCharsets constants</technical_language>

Target:
private Charset getCharset(FileStatement fileStatement) { final Charset charset; if (fileStatement.getCharset() != null) { final Object charsetValue = doSwitch(fileStatement.getCharset()); if (charsetValue != null) { final String charsetString = toString(charsetValue); Charset defaultCharset = StandardCharsets.UTF_8; try { defaultCharset = Charset.forName(charsetString); } catch (IllegalCharsetNameException | UnsupportedCharsetException e) { final BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.WARNING, ID, 0, e .getMessage() + " fallback to UTF-8", new Object[] {fileStatement.getUrl(), new HashMap<String, Object>(peekVariables()) }); environment.getGenerationResult().addDiagnostic(diagnostic); } charset = defaultCharset; } else { final BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.WARNING, ID, 0, "The Charset can't be null, fallback to UTF-8", new Object[] {fileStatement.getUrl(), new HashMap<String, Object>(peekVariables()) }); environment.getGenerationResult().addDiagnostic(diagnostic); charset = StandardCharsets.UTF_8; } } else { charset = StandardCharsets.UTF_8; } return charset; }
Source:
<code><START> public WriteOperation<?> createWriteOperation() { <END> return null; }</code><technical_language>Create defined write operation. it</technical_language>

Target:
public WriteOperation<?> createWriteOperation() { return new MarkLogicWriteOperation(); }
Source:
<code>public void runWebConnectivity() { <START> final CountDownLatch signal = new CountDownLatch(1); <END> boolean submitted = false; String report_id_1 = "r1"; String report_id_2 = "r2"; OONIMKTask task = null; Settings settings = new Settings(c, a.getPreferenceManager()); Gson gson = a.getGson(); settings.name = MK_NAME; settings.inputs = Collections.singletonList("<LINK_0>"); settings.options.max_runtime = 10; settings.annotations.origin = TAG; settings.options.no_collector = false; settings.options.probe_services_base_url = CLIENT_URL; try { task = Engine.startExperimentTask(settings.toExperimentSettings(gson, c)); } catch (Exception exc) { Assert.fail(); signal.countDown(); } while (!task.isDone()){ try { String json = task.waitForNextEvent(); Log.d(TAG, json); EventResult event = gson.fromJson(json, EventResult.class); switch (event.key) { case "status.report_create": report_id_1 = event.value.report_id; break; case "measurement": JsonResult jr = gson.fromJson(event.value.json_str, JsonResult.class); Assert.assertNotNull(jr); report_id_2 = jr.report_id; if (jr.test_keys.blocking == null) { Assert.fail(); signal.countDown(); } break; case "failure.report_create": case "failure.measurement_submission": case "failure.startup": Assert.fail(); signal.countDown(); break; case "status.measurement_submission": submitted = true; break; default: Log.w(UNUSED_KEY, event.key); break; } } catch (Exception ignored) { } } Assert.assertEquals(report_id_1, report_id_2); Assert.assertTrue(submitted); signal.countDown(); }</code><technical_language>This code is synchronous, I need a countdown latch here</technical_language>

Target:
public void runWebConnectivity() { boolean submitted = false; String report_id_1 = "r1"; String report_id_2 = "r2"; OONIMKTask task = null; Settings settings = new Settings(c, a.getPreferenceManager()); Gson gson = a.getGson(); settings.name = EXPERIMENT_NAME; settings.inputs = Collections.singletonList("<LINK_0>"); settings.options.max_runtime = 10; settings.annotations.origin = TAG; settings.options.no_collector = false; settings.options.probe_services_base_url = CLIENT_URL; try { task = Engine.startExperimentTask(settings.toExperimentSettings(gson, c)); } catch (Exception exc) { Assert.fail(); } while (!task.isDone()){ try { String json = task.waitForNextEvent(); Log.d(TAG, json); EventResult event = gson.fromJson(json, EventResult.class); switch (event.key) { case "status.report_create": report_id_1 = event.value.report_id; break; case "measurement": JsonResult jr = gson.fromJson(event.value.json_str, JsonResult.class); Assert.assertNotNull(jr); report_id_2 = jr.report_id; if (jr.test_keys.blocking == null) { Assert.fail(); } break; case "failure.report_create": case "failure.measurement_submission": case "failure.startup": Assert.fail(); break; case "status.measurement_submission": submitted = true; break; default: Log.w(UNUSED_KEY, event.key); break; } } catch (Exception ignored) { } } Assert.assertEquals(report_id_1, report_id_2); Assert.assertTrue(submitted); }
Source:
<code>public void run() { <START> if (checkAndReportInvalidState()) { return; } <END> if (permissions != null) { notifyCallbackWithSuccess(permissions); } else { loadingPermissions = permissionRealm.where(Permission.class).findAllAsync(); loadingPermissions.addChangeListener(new RealmChangeListener <RealmResults<Permission>>() { @Override public void onChange(RealmResults <Permission> loadedPermissions) { loadingPermissions.removeChangeListener(this); if (checkAndReportInvalidState()) { return; } if (permissions == null) { permissions = loadedPermissions; } notifyCallbackWithSuccess(permissions); } }); } }</code><technical_language>a warning log helpful for debugging</technical_language>

Target:
public void run() { if (checkAndReportInvalidState()) { return; } if (permissions != null) { notifyCallbackWithSuccess(permissions); } else { loadingPermissions = permissionRealm.where(Permission.class).findAllAsync(); loadingPermissions.addChangeListener(new RealmChangeListener <RealmResults<Permission>>() { @Override public void onChange(RealmResults <Permission> loadedPermissions) { if (loadedPermissions.size() > 0) { loadingPermissions.removeChangeListener(this); if (checkAndReportInvalidState()) { return; } if (permissions == null) { permissions = loadedPermissions; } notifyCallbackWithSuccess(permissions); } } }); } }
Source:
<code>public void before() { InMemoryState state = new InMemoryState(); PersistedCassandraFrameworkConfiguration config = new PersistedCassandraFrameworkConfiguration( state, "name", 60, 30, "2.1", 0.5, 1024, 1024, 512, 1, 1, "role", "", false, true, "RACK1", "DC1", Arrays.asList(ExternalDc.newBuilder() .setName("dc") .setUrl("http://dc") .setSeedFetchTime(-SeedManager.FETCH_PERIOD) .build()) ); <START> seedManager = new SeedManager(config) { <END> @Override protected JsonNode fetchJson(String url) { try { return new ObjectMapper().readTree(jsonResponse); } catch (IOException e) { e.printStackTrace(); return null; } } }; }</code><technical_language>original code refactors this inline overriding place? This override shadows a method is pretty important</technical_language>

Target:
public void before() { InMemoryState state = new InMemoryState(); PersistedCassandraFrameworkConfiguration config = new PersistedCassandraFrameworkConfiguration( state, "name", 60, 30, "2.1", 0.5, 1024, 1024, 512, 1, 1, "role", "", false, true, "RACK1", "DC1", Arrays.asList(ExternalDc.newBuilder() .setName("dc") .setUrl("http://dc") .build()) ); seedManager = new SeedManager(config, new ObjectMapper(), new SystemClock()) { @Override @Nullable protected JsonNode fetchJson(@NotNull final String url) { try { return new ObjectMapper().readTree(jsonResponse); } catch (IOException e) { e.printStackTrace(); return null; } } }; }
Source:
<code>public ResponseEntity<String> searchConcepts(@RequestParam("searchTerm") String searchTerm) { ConceptpowerReply reply = connector.search(searchTerm, POS.NOUN); List<ConceptEntry> conceptList = reply.getConceptEntry(); reply = connector.search(searchTerm, POS.VERB); conceptList.addAll(reply.getConceptEntry()); reply = connector.search(searchTerm, POS.ADJECTIVE); conceptList.addAll(reply.getConceptEntry()); reply = connector.search(searchTerm, POS.ADVERB); conceptList.addAll(reply.getConceptEntry()); List<JSONObject> jsonResults = new ArrayList<JSONObject>(); CopyOnWriteArrayList<ConceptEntry> cowConceptList = new CopyOnWriteArrayList<>(conceptList); <START> Iterator<ConceptEntry> conceptIterator = cowConceptList.iterator(); <END> if (conceptList != null) { while (conceptIterator.hasNext()) { ConceptEntry result = conceptIterator.next(); try { JSONObject jsonResult = new JSONObject(); jsonResult.put("id", result.getId()); jsonResult.put("name", result.getLemma()); jsonResult.put("description", result.getDescription()); jsonResult.put("pos", result.getPos()); jsonResult.put("type", result.getType()); jsonResults.add(jsonResult); } catch (JSONException e) { logger.error("Json exception while adding the results", e); } } } JSONObject jsonResponse = new JSONObject(); try { jsonResponse.put("terms", jsonResults); } catch (JSONException e) { return new ResponseEntity<String>("{'error':'" + e.getMessage() + "'}", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<String>(jsonResponse.toString(), HttpStatus.OK); }</code><technical_language>do a CopyOnWriteArrayList here? conceptList is get modified threads, it</technical_language>

Target:
public ResponseEntity<String> searchConcepts(@RequestParam("searchTerm") String searchTerm) { ConceptpowerReply reply = connector.search(searchTerm, POS.NOUN); List<ConceptEntry> conceptList = reply.getConceptEntry(); reply = connector.search(searchTerm, POS.VERB); conceptList.addAll(reply.getConceptEntry()); reply = connector.search(searchTerm, POS.ADJECTIVE); conceptList.addAll(reply.getConceptEntry()); reply = connector.search(searchTerm, POS.ADVERB); conceptList.addAll(reply.getConceptEntry()); List<JSONObject> jsonResults = new ArrayList<JSONObject>(); if (conceptList != null) { for (ConceptEntry result : conceptList) { try { JSONObject jsonResult = new JSONObject(); jsonResult.put("id", result.getId()); jsonResult.put("name", result.getLemma()); jsonResult.put("description", result.getDescription()); jsonResult.put("pos", result.getPos()); jsonResult.put("type", result.getType()); jsonResults.add(jsonResult); } catch (JSONException e) { logger.error("Json exception while adding the results", e); } } } JSONObject jsonResponse = new JSONObject(); try { jsonResponse.put("terms", jsonResults); } catch (JSONException e) { return new ResponseEntity<String>("{'error':'" + e.getMessage() + "'}", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<String>(jsonResponse.toString(), HttpStatus.OK); }
Source:
<code>protected void done() { mFieldController.onDone(); boolean bChangeToText = false; if (mField.getType() == EFieldType.IMAGE) { if (mField.getImagePath() == null) { bChangeToText = true; } if (!bChangeToText) { File f = new File(mField.getImagePath()); if (!f.exists()) { bChangeToText = true; } long length = f.length(); <START> if (length > 1024 * 1024) { <END> showCropDialog((float) (1.0 * length / (1024 * 1024))); return; } } } else if (mField.getType() == EFieldType.AUDIO) { if (mField.getAudioPath() == null) { bChangeToText = true; } if (!bChangeToText) { File f = new File(mField.getAudioPath()); if (!f.exists()) { bChangeToText = true; } } } if (bChangeToText) { mField = new TextField(); } saveAndExit(); }</code><technical_language>for limit a static constant top of file if possible, defined place a clear name referenced</technical_language>

Target:
protected void done() { mFieldController.onDone(); boolean bChangeToText = false; if (mField.getType() == EFieldType.IMAGE) { if (mField.getImagePath() == null) { bChangeToText = true; } if (!bChangeToText) { File f = new File(mField.getImagePath()); if (!f.exists()) { bChangeToText = true; } long length = f.length(); if (length > sImageLimit) { String size = Formatter.formatFileSize(this, length); Uri uri = FileProvider.getUriForFile(this, getPackageName() + ".apkgfileprovider", f); showCropDialog(size, uri); return; } } } else if (mField.getType() == EFieldType.AUDIO_RECORDING) { if (mField.getAudioPath() == null) { bChangeToText = true; } if (!bChangeToText) { File f = new File(mField.getAudioPath()); if (!f.exists()) { bChangeToText = true; } } } if (bChangeToText) { mField = new TextField(); } saveAndExit(); }
Source:
<code>public boolean hasNext() { if (last != null) return true; while (super.hasNext()) { last = super.next(); if (last.getName().equals(name)) { return true; } else { last = null; <START> } <END> } return false; }</code><technical_language>Strictly speaking, "else" 230 is completely unnecessary line 229 is a return statement. line 228 is add a = null; right a new line</technical_language>

Target:
public boolean hasNext() { if (last != null) return true; while (super.hasNext()) { last = super.next(); if (last.getName().equals(name)) return true; last = null; } return false; }
Source:
<code>protected boolean canDoAction() { boolean retVal = super.canDoAction(); if (retVal) { StoragePool storagePool = DbFacade.getInstance().getStoragePoolDao().getForVds(getParameters().getVdsId()); if (storagePool == null) { addCanDoActionMessage(VdcBllMessages.NETWORK_CLUSTER_HAVE_NOT_EXISTING_DATA_CENTER_NETWORK); retVal = false; } else { setStoragePool(storagePool); } if (retVal && (getStorageDomain().getStorageDomainType() == StorageDomainType.Data || <START> getStorageDomain().getStorageDomainType() == StorageDomainType.ISO) && <END> storagePool.getStorageType() != StorageType.LOCALFS) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_IS_NOT_LOCAL); retVal = false; } if (retVal && storagePool.getstatus() != StoragePoolStatus.Uninitialized) { retVal = checkMasterDomainIsUp(); } if (retVal && this.getVds().getVdsType() == VDSType.oVirtNode) { StorageServerConnections conn = DbFacade.getInstance().getStorageServerConnectionDao().get(getParameters().getStorageDomain() .getStorage()); String rhevhLocalFSPath = Config.<String> GetValue(ConfigValues.RhevhLocalFSPath); if (!conn.getconnection().equals(rhevhLocalFSPath)) { addCanDoActionMessage(VdcBllMessages.RHEVH_LOCALFS_WRONG_PATH_LOCATION); addCanDoActionMessage(String.format("$path %1$s", rhevhLocalFSPath)); retVal = false; } } } return retVal; }</code><technical_language>IMHO, storage domain type is a mute point. in bugs this patch addresses, /never/ OK attach a local domain a non-local pool. Currently, local ISO DATA domain. Tomorrow, if add support for a local EXPORT domain, attaching NFS pool wrong too</technical_language>

Target:
protected boolean canDoAction() { boolean retVal = super.canDoAction(); if (retVal) { StoragePool storagePool = DbFacade.getInstance().getStoragePoolDao().getForVds(getParameters().getVdsId()); if (storagePool == null) { addCanDoActionMessage(VdcBllMessages.NETWORK_CLUSTER_HAVE_NOT_EXISTING_DATA_CENTER_NETWORK); retVal = false; } else { setStoragePool(storagePool); } if (retVal && getStorageDomain().getStorageType() == StorageType.LOCALFS && storagePool.getStorageType() != StorageType.LOCALFS) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_IS_NOT_LOCAL); retVal = false; } if (retVal && storagePool.getstatus() != StoragePoolStatus.Uninitialized) { retVal = checkMasterDomainIsUp(); } if (retVal && this.getVds().getVdsType() == VDSType.oVirtNode) { StorageServerConnections conn = DbFacade.getInstance().getStorageServerConnectionDao().get(getParameters().getStorageDomain() .getStorage()); String rhevhLocalFSPath = Config.<String> GetValue(ConfigValues.RhevhLocalFSPath); if (!conn.getconnection().equals(rhevhLocalFSPath)) { addCanDoActionMessage(VdcBllMessages.RHEVH_LOCALFS_WRONG_PATH_LOCATION); addCanDoActionMessage(String.format("$path %1$s", rhevhLocalFSPath)); retVal = false; } } } return retVal; }
Source:
<code>public void testGhostRendering() { GwtMockito.useProviderForType(Group.class, clazz -> ghostGroup); doReturn(new HashSet<>(Arrays.asList(container, expressionGrid))).when(gridLayer).getGridWidgets(); doReturn(ghostRectangle).when(gridLayer).getGhostRectangle(); when(expressionGrid.isSelected()).thenReturn(true); gridLayer.doBatch(); verify(ghostRectangle).setWidth(eq(CONTAINER_WIDTH + BaseExpressionGridTheme.STROKE_WIDTH)); verify(ghostRectangle).setHeight(eq(CONTAINER_HEIGHT + BaseExpressionGridTheme.STROKE_WIDTH)); <START> verify(ghostGroup).setX(CONTAINER_X + VIEWPORT_TRANSLATE_X); <END> verify(ghostGroup).setY(CONTAINER_Y + VIEWPORT_TRANSLATE_Y); verify(ghostGroup).setPathClipper(any(InverseGridWidgetClipper.class)); verify(ghostGroup).add(ghostRectangle); verify(ghostGroup).drawWithTransforms(eq(context2D), anyDouble(), any(BoundingBox.class)); }</code><technical_language>add like: java verify(ghostRectangle).setFillColor(ColorName.WHITE); verify(ghostRectangle).setAlpha(0.50); verify(ghostRectangle).setListening(false);</technical_language>

Target:
public void testGhostRendering() { GwtMockito.useProviderForType(Group.class, clazz -> ghostGroup); doReturn(new HashSet<>(Arrays.asList(container, expressionGrid))).when(gridLayer).getGridWidgets(); doReturn(ghostRectangle).when(gridLayer).getGhostRectangle(); when(expressionGrid.isSelected()).thenReturn(true); gridLayer.doBatch(); verify(ghostRectangle).setWidth(eq(CONTAINER_WIDTH + BaseExpressionGridTheme.STROKE_WIDTH)); verify(ghostRectangle).setHeight(eq(CONTAINER_HEIGHT + BaseExpressionGridTheme.STROKE_WIDTH)); verify(ghostRectangle).setFillColor(ColorName.WHITE); verify(ghostRectangle).setAlpha(0.50); verify(ghostRectangle).setListening(false); verify(ghostGroup).setX(CONTAINER_X + VIEWPORT_TRANSLATE_X); verify(ghostGroup).setY(CONTAINER_Y + VIEWPORT_TRANSLATE_Y); verify(ghostGroup).setPathClipper(any(InverseGridWidgetClipper.class)); verify(ghostGroup).add(ghostRectangle); verify(ghostGroup).drawWithTransforms(eq(context2D), anyDouble(), any(BoundingBox.class)); }
Source:
<code>private static void initCustomAbilities() { final String METHOD_NAME = "initCustomAbilities()"; customAbilities = new ArrayList<>(); Document xmlDoc = null; try { <START> InputStream is = new FileInputStream("data/universe/customspa.xml"); <END> DocumentBuilder db = MekHqXmlUtil.newUnsafeDocumentBuilder(); xmlDoc = db.parse(is); is.close(); } catch (Exception ex) { MekHQ.getLogger().error(CustomOption.class, METHOD_NAME, ex); } Element spaEle = xmlDoc.getDocumentElement(); NodeList nl = spaEle.getChildNodes(); spaEle.normalize(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); if (wn.getParentNode() != spaEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("option")) { CustomOption option = CustomOption.generateInstanceFromXML(wn); if (null != option) { customAbilities.add(option); } } } } }</code><technical_language>try-with-resources</technical_language>

Target:
private static void initCustomAbilities() { final String METHOD_NAME = "initCustomAbilities()"; customAbilities = new ArrayList<>(); Document xmlDoc = null; try (InputStream is = new FileInputStream("data/universe/customspa.xml")) { DocumentBuilder db = MekHqXmlUtil.newUnsafeDocumentBuilder(); xmlDoc = db.parse(is); } catch (Exception ex) { MekHQ.getLogger().error(CustomOption.class, METHOD_NAME, ex); } Element spaEle = xmlDoc.getDocumentElement(); NodeList nl = spaEle.getChildNodes(); spaEle.normalize(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); if (wn.getParentNode() != spaEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("option")) { CustomOption option = CustomOption.generateInstanceFromXML(wn); if (null != option) { customAbilities.add(option); } } } } }
Source:
<code>public void shouldGetPreferences() throws Exception { Ruleset ruleset = rulesetService.getById(1); <START> List<DocStructTypeInterface> docStructTypeInterfaces = rulesetService.getPreferences(ruleset).getAllDocStructTypes(); <END> int actual = docStructTypeInterfaces.size(); assertEquals("Size of docstruct types in ruleset file is incorrect!", 2, actual); String firstName = docStructTypeInterfaces.get(0).getName(); assertEquals("Name of first docstruct type in ruleset file is incorrect!", "Acknowledgment", firstName); String secondName = docStructTypeInterfaces.get(1).getName(); assertEquals("Name of first docstruct type in ruleset file is incorrect!", "Article", secondName); }</code><technical_language>Interface appended name of variable</technical_language>

Target:
public void shouldGetPreferences() throws Exception { Ruleset ruleset = rulesetService.getById(1); List<DocStructTypeInterface> docStructTypes = rulesetService.getPreferences(ruleset).getAllDocStructTypes(); int actual = docStructTypes.size(); assertEquals("Size of docstruct types in ruleset file is incorrect!", 2, actual); String firstName = docStructTypes.get(0).getName(); assertEquals("Name of first docstruct type in ruleset file is incorrect!", "Acknowledgment", firstName); String secondName = docStructTypes.get(1).getName(); assertEquals("Name of first docstruct type in ruleset file is incorrect!", "Article", secondName); }
Source:
<code>private WebSocketProxy getDelegate(Integer channelId) { if (!connectedProxies.containsKey(channelId) && !closedProxies.containsKey(channelId)) { logger.warn("Selected WebSocket channel is not connected. Unable to send manual crafted message!"); throw new IllegalArgumentException(Constant.messages.getString("websocket.manual_send.fail.disconnected_channel") + " " + Constant.messages.getString("websocket.manual_send.fail")); }else if (closedProxies.containsKey(channelId)){ logger.warn("Selected WebSocket channel is not connected. Unable to send manual crafted message!"); throw new IllegalArgumentException(Constant.messages.getString("websocket.manual_send.fail.disconnected_channel") + " " + Constant.messages.getString("websocket.manual_send.use_reopen")); } <START> return connectedProxies.get(channelId); <END> }</code><technical_language>..not connected closed.</technical_language>

Target:
private WebSocketProxy getDelegate(Integer channelId) { if (closedProxies.containsKey(channelId)) { logger.warn("Selected WebSocket channel is not connected. Unable to send manual crafted message!"); throw new IllegalArgumentException(Constant.messages.getString("websocket.manual_send.fail.disconnected_channel") + " " + Constant.messages.getString("websocket.manual_send.use_reopen")); } return connectedProxies.get(channelId); }
Source:
<code>public void appendMediaFile(final MediaFile mediaFile, final String mediaUrl, ImageLoader imageLoader) { if (!mDomHasLoaded) { mWaitingMediaFiles.put(mediaUrl, mediaFile); return; } mWebView.post(new Runnable() { @Override public void run() { if (URLUtil.isNetworkUrl(mediaUrl)) { String mediaId = mediaFile.getMediaId(); mWebView.execJavaScriptFromString("ZSSEditor.insertImage('" + mediaUrl + "', '" + mediaId + "');"); <START> mEditorFragmentListener.onTrackableEvent(TrackableEvent.NETWORK_MEDIA_ADDED); <END> } else { String id = mediaFile.getMediaId(); mWebView.execJavaScriptFromString("ZSSEditor.insertLocalImage(" + id + ", '" + mediaUrl + "');"); mWebView.execJavaScriptFromString("ZSSEditor.setProgressOnImage(" + id + ", " + 0 + ");"); mUploadingMediaIds.add(id); mEditorFragmentListener.onTrackableEvent(TrackableEvent.LOCAL_MEDIA_ADDED); } } }); }</code><technical_language>NETWORK_IMAGE_ADDED LOCAL_IMAGE_ADDED instead of _MEDIA_, need differentiate images video add video insert/upload support</technical_language>

Target:
public void appendMediaFile(final MediaFile mediaFile, final String mediaUrl, ImageLoader imageLoader) { if (!mDomHasLoaded) { mWaitingMediaFiles.put(mediaUrl, mediaFile); return; } mWebView.post(new Runnable() { @Override public void run() { if (URLUtil.isNetworkUrl(mediaUrl)) { String mediaId = mediaFile.getMediaId(); mWebView.execJavaScriptFromString("ZSSEditor.insertImage('" + mediaUrl + "', '" + mediaId + "');"); mEditorFragmentListener.onTrackableEvent(TrackableEvent.NETWORK_IMAGE_ADDED); } else { String id = mediaFile.getMediaId(); mWebView.execJavaScriptFromString("ZSSEditor.insertLocalImage(" + id + ", '" + mediaUrl + "');"); mWebView.execJavaScriptFromString("ZSSEditor.setProgressOnImage(" + id + ", " + 0 + ");"); mUploadingMediaIds.add(id); mEditorFragmentListener.onTrackableEvent(TrackableEvent.LOCAL_IMAGE_ADDED); } } }); }
Source:
<code>public void createInteractiveBrowserCredential() { InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredentialBuilder() <START> .port(8765) <END> .build(); SecretClient client = new SecretClientBuilder() .vaultUrl("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(interactiveBrowserCredential) .buildClient(); }</code><technical_language>client id too, needs added</technical_language>

Target:
public void createInteractiveBrowserCredential() { InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredentialBuilder() .clientId("<YOUR CLIENT ID>") .port(8765) .build(); SecretClient client = new SecretClientBuilder() .vaultUrl("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(interactiveBrowserCredential) .buildClient(); }
Source:
<code><START> public CommandProcessingResult update(Long likelihoodId, JsonCommand command) <END> { this.context.authenticatedUser(); try { this.likelihoodDataValidator.validateForUpdate(command); final Likelihood likelihood = this.repository.findOne(likelihoodId); String disableLikelihoodSql = "update ppi_likelihoods_ppi set enabled = "+ LikelihoodStatus.DISABLED + " WHERE ppi_likelihoods_ppi.id IN " + " ( SELECT t.id FROM ( SELECT * FROM ppi_likelihoods_ppi ) as t " + " WHERE t.ppi_name = '" + likelihood.getPpiName() + "' AND t.id !=" +likelihood.getId()+ " ) "; if (!likelihood.update(command).isEmpty()) { this.repository.save(likelihood); if(likelihood.isActivateCommand(command)) { jdbcTemplate.execute(disableLikelihoodSql); } } return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(likelihood.getId()).build(); } catch (final DataIntegrityViolationException dve) { handleDataIntegrityIssues(dve); return CommandProcessingResult.empty(); } }</code><technical_language>JPA(entity based) for DB write operations in write platform services</technical_language>

Target:
public CommandProcessingResult update(Long likelihoodId, JsonCommand command) { this.context.authenticatedUser(); try { this.likelihoodDataValidator.validateForUpdate(command); final Likelihood likelihood = this.repository.findOne(likelihoodId); if (!likelihood.update(command).isEmpty()) { this.repository.save(likelihood); if(likelihood.isActivateCommand(command)) { List<Likelihood> likelihoods = this.repository.findByPpiNameAndLikeliHoodId(likelihood.getPpiName(),likelihood.getId()); for(Likelihood aLikelihood:likelihoods) { aLikelihood.disable(); } this.repository.save(likelihoods); } } return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(likelihood.getId()).build(); } catch (final DataIntegrityViolationException dve) { handleDataIntegrityIssues(dve); return CommandProcessingResult.empty(); } }
Source:
<code>private String encode(String prefix, String userAndPass) { if (userAndPass==null) { return null; } <START> return prefix+" "+Scrambler.scramble(userAndPass); <END> }</code><technical_language>Base64. Scrambler considered deprecated</technical_language>

Target:
private String encode(String prefix, String userAndPass) { if (userAndPass==null) { return null; } return prefix + " " + Base64.getEncoder().encodeToString(userAndPass.getBytes(StandardCharsets.UTF_8)); }
Source:
<code>public void receiveMessage(PubsubMessage message, AckReplyConsumer consumer) { String messagePayload = message.getData().toStringUtf8(); <START> log.debug("Received message with payload: {}", messagePayload); <END> String messageKey = pubsubMessageCache.makeKey(messagePayload, pubsubType, subscriptionName); if (!pubsubMessageCache.acquireMessageLock(messageKey, identity.getIdentity(), 5 * TimeUnit.SECONDS.toMillis(ackDeadlineSeconds))) { consumer.nack(); return; } consumer.ack(); postEvent(message); pubsubMessageCache.setMessageHandled(messageKey, identity.getIdentity(), TimeUnit.DAYS.toMillis(7)); }</code><technical_language>I if generify some of this, other pubsub-style subscribers benefit this careful deduping logic</technical_language>

Target:
public void receiveMessage(PubsubMessage message, AckReplyConsumer consumer) { String messagePayload = message.getData().toStringUtf8(); log.debug("Received message with payload: {}", messagePayload); MessageInstanceDescription description = MessageInstanceDescription.builder() .subscriptionName(subscriptionName) .messagePayload(messagePayload) .pubsubType(pubsubType) .ackDeadlineMillis(5 * TimeUnit.SECONDS.toMillis(ackDeadlineSeconds)) .retentionDeadlineMillis(TimeUnit.DAYS.toMillis(7)) .build(); GoogleMessageAcknowledger acknowledger = new GoogleMessageAcknowledger(consumer); pubsubMessageHandler.handleMessage(description, acknowledger, identity.getIdentity()); }
Source:
<code>public void handleError(ClientHttpResponse response) throws IOException { <START> LOGGER.error("Http response error: {}", response.getStatusCode(), response.getStatusText()); <END> }</code><technical_language>HTTP</technical_language>

Target:
public void handleError(ClientHttpResponse response) throws IOException { LOGGER.error("HTTP response error: {}", response.getStatusCode(), response.getStatusText()); }
Source:
<code>public CaseRoleAssignmentLogDeleteBuilderImpl inCaseDefId(String caseDefId) { if (checkIfNull(caseDefId)) { <START> return (CaseRoleAssignmentLogDeleteBuilderImpl) this; <END> } this.caseDefId = caseDefId; return (CaseRoleAssignmentLogDeleteBuilderImpl) this; }</code><technical_language>Please create a CaseRoleAssignmentLogDeleteBuilder interface for other Delete builders return interface here</technical_language>

Target:
public CaseRoleAssignmentLogDeleteBuilder inCaseDefId(String caseDefId) { if (checkIfNull(caseDefId)) { return this; } this.caseDefId = caseDefId; return this; }
Source:
<code>public String endTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment, String eventName, boolean isValidated) { if (!isTaskActive(task)) { throw new ConcurrentUpdateException(String.format("The task '%s' is not active", task.getName())); <START> } else if (!canEndTask(principal, task)) { <END> throw new DocumentSecurityException( String.format("User with id '%s' cannot end this task", principal.getName())); } String taskProviderId = task.getVariable(Task.TASK_PROVIDER_KEY); if (taskProviderId == null) { taskProviderId = DEFAULT_TASK_PROVIDER; } TaskProvider taskProvider = tasksProviders.get(taskProviderId); if (taskProvider == null) { throw new NuxeoException(String.format( "No task provider registered, cannot end task. Please contribute at least the default task provider: %s.", DEFAULT_TASK_PROVIDER)); } return taskProvider.endTask(coreSession, principal, task, comment, eventName, isValidated); }</code><technical_language>I switch cases if user permission end task, if task is active shouldn't. Wdyt</technical_language>

Target:
public String endTask(CoreSession coreSession, NuxeoPrincipal principal, Task task, String comment, String eventName, boolean isValidated) { if (!checkPermissions(principal, task)) { throw new DocumentSecurityException( String.format("User with id '%s' cannot end this task", principal.getName())); } else if (!isTaskActive(task)) { throw new ConcurrentUpdateException(String.format("The task '%s' is not active", task.getName())); } String taskProviderId = task.getVariable(Task.TASK_PROVIDER_KEY); if (taskProviderId == null) { taskProviderId = DEFAULT_TASK_PROVIDER; } TaskProvider taskProvider = tasksProviders.get(taskProviderId); if (taskProvider == null) { throw new NuxeoException(String.format( "No task provider registered, cannot end task. Please contribute at least the default task provider: %s.", DEFAULT_TASK_PROVIDER)); } return taskProvider.endTask(coreSession, principal, task, comment, eventName, isValidated); }
Source:
<code><START> public Map<Integer, Iterable<T>> getInitPartitions() { <END> return partitions; }</code><technical_language>getPartitions() getPartitionData()</technical_language>

Target:
public Map<Integer, Iterable<T>> getInitPartitions() { return initPartitions; }
Source:
<code>public Token next() { char c = nextChar(); if (c == '(') { return finishToken(TokenType.PAREN_START); } else if (c == ')') { return finishToken(TokenType.PAREN_END); } else if (c == '{') { <START> return readEnumOrQuotedToken(TokenType.SYMBOL,'}'); <END> } else if (c == '[') { return readEnumOrQuotedToken(TokenType.SYMBOL,']'); } else if (c == ',') { return finishToken(TokenType.COMMA); } else if (c == '.') { return finishToken(TokenType.DOT); } else if (c == DOUBLE_QUOTE) { return readEnumOrQuotedToken(TokenType.STRING_LITERAL,DOUBLE_QUOTE); } else if (c == SINGLE_QUOTE) { return readEnumOrQuotedToken(TokenType.STRING_LITERAL,SINGLE_QUOTE); } else if (StringUtil.isWhitespace(c)) { return readWhitespace(); } else if (isNumberPart(c)) { return readNumber(); } else if (isOperator(c)) { return readOperator(c); } else if (isBooleanLiteral(c)) { return readBooleanLiteral(c); } else if (isSymbolStart(c)) { return readSymbol(TokenType.SYMBOL); } else { throw new RuntimeException("Symbol '" + c + "' is not supported"); } }</code><technical_language>Move this logic parser</technical_language>

Target:
public Token next() { char c = nextChar(); if (c == '(') { return finishToken(TokenType.PAREN_START); } else if (c == ')') { return finishToken(TokenType.PAREN_END); } else if (c == '{') { return readQuotedToken(TokenType.SYMBOL, '}'); } else if (c == '[') { return readQuotedToken(TokenType.SYMBOL, ']'); } else if (c == ',') { return finishToken(TokenType.COMMA); } else if (c == '.') { return finishToken(TokenType.DOT); } else if (c == DOUBLE_QUOTE) { return readQuotedToken(TokenType.STRING_LITERAL, DOUBLE_QUOTE); } else if (c == SINGLE_QUOTE) { return readQuotedToken(TokenType.STRING_LITERAL, SINGLE_QUOTE); } else if (StringUtil.isWhitespace(c)) { return readWhitespace(); } else if (isNumberPart(c)) { return readNumber(); } else if (isOperator(c)) { return readOperator(c); } else if (isBooleanLiteral(c)) { return readBooleanLiteral(c); } else if (isSymbolStart(c)) { return readSymbol(TokenType.SYMBOL); } else { throw new RuntimeException("Symbol '" + c + "' is not supported"); } }
Source:
<code>public void testSnackBarWithAction() { final BaseActivity activity = getActivity(); activity.runOnUiThread(new Runnable() { @Override public void run() { activity.snackBar("This is a SnackBar with action Test!", "Action", new View .OnClickListener() { @Override public void onClick(View v) { Toast.makeText( activity, "What?", Toast.LENGTH_LONG ).show(); } }); } }); expectVisibleSoon(viewWithText("This is a SnackBar with action Test!")); expectVisible(viewWithId(R.id.snackbar_action)); expectVisible(viewThat(hasText("Action"))); click(viewWithText("Action")); onView(withText("What?")) <START> .inRoot(withDecorView(not(is( <END> getActivity().getWindow().getDecorView()))) ).check(matches(isDisplayed())); }</code><technical_language>Actually, instead of a Toast for this, I a Mockito.mock(View.OnClickListener.class), Mockito.verify() ensure listener called</technical_language>

Target:
public void testSnackBarWithAction() { final View.OnClickListener mockListener = mock(View.OnClickListener.class); final BaseActivity activity = getActivity(); activity.runOnUiThread(new Runnable() { @Override public void run() { activity.snackBar("This is a SnackBar with action Test!", "Action", mockListener); } }); expectVisibleSoon(viewWithText("This is a SnackBar with action Test!")); expectVisible(viewWithId(R.id.snackbar_action)); expectVisible(viewThat(hasText("Action"))); click(viewWithText("Action")); verify(mockListener).onClick(any(View.class)); }
Source:
<code>public void handleNewSession(String sessionId) throws Exception { waitUntilConnected(); if (sessionId != null && !getSessionId().equals(sessionId)) { <START> LOG.info("Session is expired and not handled. Expected: {}. Actual: {}.", sessionId, <END> getSessionId()); return; } if (sessionId == null) { sessionId = getSessionId(); LOG.warn("Session id: <null> is passed in. Current session id: will be used.", sessionId); } LOG.info("Handle new session, instance: {}, type: {}, session id: {}.", _instanceName, _instanceType, sessionId); stopTimerTasks(); if (_leaderElectionHandler != null) { _leaderElectionHandler.reset(false); } resetHandlers(false); _baseDataAccessor.reset(); if (!ZKUtil.isClusterSetup(_clusterName, _zkclient)) { throw new HelixException("Cluster structure is not set up for cluster: " + _clusterName); } _sessionStartTime = System.currentTimeMillis(); switch (_instanceType) { case PARTICIPANT: handleNewSessionAsParticipant(sessionId); break; case CONTROLLER: handleNewSessionAsController(); break; case CONTROLLER_PARTICIPANT: handleNewSessionAsParticipant(sessionId); handleNewSessionAsController(); break; case ADMINISTRATOR: case SPECTATOR: default: break; } startTimerTasks(); initHandlers(_handlers); if (_stateListener != null) { try { _stateListener.onConnected(this); } catch (Exception e) { LOG.warn("stateListener.onConnected callback fails", e); } } }</code><technical_language>nit, LOG.warn</technical_language>

Target:
public void handleNewSession(String sessionId) throws Exception { waitUntilConnected(); if (sessionId != null && !getSessionId().equals(sessionId)) { LOG.warn("Session is expired and not handled. Expected: {}. Actual: {}.", sessionId, getSessionId()); return; } if (sessionId == null) { sessionId = getSessionId(); LOG.debug("Session id: <null> is passed in. Current session id: will be used.", sessionId); } LOG.info("Handle new session, instance: {}, type: {}, session id: {}.", _instanceName, _instanceType, sessionId); stopTimerTasks(); if (_leaderElectionHandler != null) { _leaderElectionHandler.reset(false); } resetHandlers(false); _baseDataAccessor.reset(); if (!ZKUtil.isClusterSetup(_clusterName, _zkclient)) { throw new HelixException("Cluster structure is not set up for cluster: " + _clusterName); } _sessionStartTime = System.currentTimeMillis(); switch (_instanceType) { case PARTICIPANT: handleNewSessionAsParticipant(sessionId); break; case CONTROLLER: handleNewSessionAsController(); break; case CONTROLLER_PARTICIPANT: handleNewSessionAsParticipant(sessionId); handleNewSessionAsController(); break; case ADMINISTRATOR: case SPECTATOR: default: break; } startTimerTasks(); initHandlers(_handlers); if (_stateListener != null) { try { _stateListener.onConnected(this); } catch (Exception e) { LOG.warn("stateListener.onConnected callback fails", e); } } }
Source:
<code>private static void postReport(final DeliveryOptions deliveryOptions, final Map<String, Object> reportParameters, final ByteArrayOutputStream outputStream, final String fileName) { final String url = deliveryOptions.getWebhookUrl(); final String substitutedUrl = substituteUrl(url, deliveryOptions, reportParameters); try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); final CloseableHttpClient client = HttpClients.createDefault(); ) { LOG.debug("Posting generated report with name to endpoint (input was {})", fileName, substitutedUrl, url); final HttpEntity entity = MultipartEntityBuilder.create() .addBinaryBody("file", inputStream, ContentType.DEFAULT_BINARY, fileName) .build(); final HttpPost httpPost = new HttpPost(substitutedUrl); httpPost.setEntity(entity); try (CloseableHttpResponse response = client.execute(httpPost)) { LOG.debug("Request performed. Received response: {}", response); final int statusCode = response.getStatusLine().getStatusCode(); <START> if (statusCode < 200 || statusCode >= 300) { <END> throw new IOException("Expected status code of >= 200 and <= 300 but received: " + statusCode + ". Reason: " + response.getStatusLine().toString()); } } } catch (IOException ex) { LOG.error("Error while posting data to endpoint {}: {}", url, ex.getMessage(), ex); } }</code><technical_language>if condition statusCode < 200 || statusCode > 300 match exception's text</technical_language>

Target:
private static void postReport(final DeliveryOptions deliveryOptions, final Map<String, Object> reportParameters, final ByteArrayOutputStream outputStream, final String fileName) { final String url = deliveryOptions.getWebhookUrl(); final String substitutedUrl = substituteUrl(url, deliveryOptions, reportParameters); try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); final CloseableHttpClient client = HttpClients.createDefault(); ) { LOG.debug("Posting generated report with name to endpoint (input was {})", fileName, substitutedUrl, url); final HttpEntity entity = MultipartEntityBuilder.create() .addBinaryBody("file", inputStream, ContentType.DEFAULT_BINARY, fileName) .build(); final HttpPost httpPost = new HttpPost(substitutedUrl); httpPost.setEntity(entity); try (CloseableHttpResponse response = client.execute(httpPost)) { LOG.debug("Request performed. Received response: {}", response); final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode < 200 || statusCode > 299) { throw new IOException("Expected status code of >= 200 and <= 299 but received: " + statusCode + ". Reason: " + response.getStatusLine().getReasonPhrase()); } } } catch (IOException ex) { LOG.error("Error while posting data to endpoint {}: {}", url, ex.getMessage(), ex); } }
Source:
<code>public CallAdapter<?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { Class<?> rawType = getRawType(returnType); final String canonicalName = rawType.getCanonicalName(); boolean isSingle = "rx.Single".equals(canonicalName); boolean isCompletable = "rx.Completable".equals(canonicalName); if (rawType != Observable.class && !isSingle && !isCompletable) { return null; } if (!isCompletable && !(returnType instanceof ParameterizedType)) { String name = isSingle ? "Single" : "Observable"; throw new IllegalStateException(name + " return type must be parameterized" + " as " + name + "<Foo> or " + name + "<? extends Foo>"); } if (isCompletable) { return CompletableHelper.makeCompletable(); <START> } else { <END> CallAdapter<Observable<?>> callAdapter = getCallAdapter(returnType); if (isSingle) { return SingleHelper.makeSingle(callAdapter); } return callAdapter; } }</code><technical_language>uber nit: need else a return. Helps save indentation (and diff a lot nicer)</technical_language>

Target:
public CallAdapter<?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { Class<?> rawType = getRawType(returnType); final String canonicalName = rawType.getCanonicalName(); boolean isSingle = "rx.Single".equals(canonicalName); boolean isCompletable = "rx.Completable".equals(canonicalName); if (rawType != Observable.class && !isSingle && !isCompletable) { return null; } if (!isCompletable && !(returnType instanceof ParameterizedType)) { String name = isSingle ? "Single" : "Observable"; throw new IllegalStateException(name + " return type must be parameterized" + " as " + name + "<Foo> or " + name + "<? extends Foo>"); } if (isCompletable) { return CompletableHelper.makeCompletable(); } CallAdapter<Observable<?>> callAdapter = getCallAdapter(returnType); if (isSingle) { return SingleHelper.makeSingle(callAdapter); } return callAdapter; }
Source:
<code><START> public void tearDown() throws IOException, SQLException { <END> try { globalScheduler.shutdown(); } catch (Exception e) { } cleanup(); tearDownOnce(); }</code><technical_language>is this needed now</technical_language>

Target:
public void tearDown(){ try { globalScheduler.shutdown(); } catch (Exception e) { } cleanup(); tearDownOnce(); }